aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/ada/gcc-interface')
-rw-r--r--gcc/ada/gcc-interface/Make-lang.in56
-rw-r--r--gcc/ada/gcc-interface/Makefile.in21
-rw-r--r--gcc/ada/gcc-interface/decl.cc20
-rw-r--r--gcc/ada/gcc-interface/misc.cc2
-rw-r--r--gcc/ada/gcc-interface/utils.cc41
-rw-r--r--gcc/ada/gcc-interface/utils2.cc11
6 files changed, 73 insertions, 78 deletions
diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in
index 964cae8..1c93816 100644
--- a/gcc/ada/gcc-interface/Make-lang.in
+++ b/gcc/ada/gcc-interface/Make-lang.in
@@ -185,6 +185,11 @@ ada.serial = gnat1$(exeext)
# variable conveys what we need for this, set to "g++" if not bootstrapping,
# ".../xg++" otherwise.
+GNATMAKE_FOR_HOST = $(GNATMAKE)
+GNATBIND_FOR_HOST = $(GNATBIND)
+GNATLINK_FOR_HOST = $(subst gnatmake,gnatlink,$(GNATMAKE))
+GNATLS_FOR_HOST = $(subst gnatmake,gnatls,$(GNATMAKE))
+
# There are too many Ada sources to check against here. Let's
# always force the recursive make.
ifeq ($(build), $(host))
@@ -214,20 +219,16 @@ ifeq ($(build), $(host))
CXX="$(CXX)" \
$(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \
ADA_INCLUDES="-I../generated -I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \
- GNATMAKE="gnatmake" \
- GNATBIND="gnatbind" \
- GNATLINK="gnatlink" \
+ GNATMAKE="$(GNATMAKE_FOR_HOST)" \
+ GNATBIND="$(GNATBIND_FOR_HOST)" \
+ GNATLINK="$(GNATLINK_FOR_HOST)" \
LIBGNAT=""
endif
else
# Build is different from host so we are either building a canadian cross
# or a cross-native compiler. We provide defaults for tools targeting the
- # host platform, but they can be overriden by just setting <tool>_FOR_HOST
+ # host platform, but they can be overridden by just setting <tool>_FOR_HOST
# variables.
- GNATMAKE_FOR_HOST=$(host_noncanonical)-gnatmake
- GNATBIND_FOR_HOST=$(host_noncanonical)-gnatbind
- GNATLINK_FOR_HOST=$(host_noncanonical)-gnatlink
- GNATLS_FOR_HOST=$(host_noncanonical)-gnatls
ifeq ($(host), $(target))
# This is a cross native. All the sources are taken from the currently
@@ -315,23 +316,17 @@ GNAT_ADA_OBJS = \
ada/cstand.o \
ada/debug.o \
ada/debug_a.o \
- ada/diagnostics-brief_emitter.o \
- ada/diagnostics-constructors.o \
- ada/diagnostics-converter.o \
- ada/diagnostics-json_utils.o \
- ada/diagnostics-pretty_emitter.o \
- ada/diagnostics-repository.o \
- ada/diagnostics-sarif_emitter.o \
- ada/diagnostics-switch_repository.o \
- ada/diagnostics-utils.o \
- ada/diagnostics.o \
ada/einfo-entities.o \
ada/einfo-utils.o \
ada/einfo.o \
ada/elists.o \
ada/err_vars.o \
+ ada/errid.o \
ada/errout.o \
ada/erroutc.o \
+ ada/erroutc-pretty_emitter.o \
+ ada/erroutc-sarif_emitter.o \
+ ada/errsw.o \
ada/eval_fat.o \
ada/exp_aggr.o \
ada/exp_spark.o \
@@ -380,6 +375,7 @@ GNAT_ADA_OBJS = \
ada/impunit.o \
ada/inline.o \
ada/itypes.o \
+ ada/json_utils.o \
ada/krunch.o \
ada/layout.o \
ada/lib-load.o \
@@ -535,6 +531,7 @@ GNAT_ADA_OBJS+= \
ada/libgnat/s-bitops.o \
ada/libgnat/s-carun8.o \
ada/libgnat/s-casuti.o \
+ ada/libgnat/s-cautns.o \
ada/libgnat/s-crtl.o \
ada/libgnat/s-conca2.o \
ada/libgnat/s-conca3.o \
@@ -562,8 +559,6 @@ GNAT_ADA_OBJS+= \
ada/libgnat/s-secsta.o \
ada/libgnat/s-soflin.o \
ada/libgnat/s-soliin.o \
- ada/libgnat/s-spark.o \
- ada/libgnat/s-spcuop.o \
ada/libgnat/s-stache.o \
ada/libgnat/s-stalib.o \
ada/libgnat/s-stoele.o \
@@ -575,11 +570,8 @@ GNAT_ADA_OBJS+= \
ada/libgnat/s-trasym.o \
ada/libgnat/s-unstyp.o \
ada/libgnat/s-valint.o \
- ada/libgnat/s-valspe.o \
ada/libgnat/s-valuns.o \
ada/libgnat/s-valuti.o \
- ada/libgnat/s-vs_int.o \
- ada/libgnat/s-vs_uns.o \
ada/libgnat/s-wchcnv.o \
ada/libgnat/s-wchcon.o \
ada/libgnat/s-wchjis.o \
@@ -615,23 +607,17 @@ GNATBIND_OBJS = \
ada/casing.o \
ada/csets.o \
ada/debug.o \
- ada/diagnostics-brief_emitter.o \
- ada/diagnostics-constructors.o \
- ada/diagnostics-converter.o \
- ada/diagnostics-json_utils.o \
- ada/diagnostics-pretty_emitter.o \
- ada/diagnostics-repository.o \
- ada/diagnostics-sarif_emitter.o \
- ada/diagnostics-switch_repository.o \
- ada/diagnostics-utils.o \
- ada/diagnostics.o \
ada/einfo-entities.o \
ada/einfo-utils.o \
ada/einfo.o \
ada/elists.o \
ada/err_vars.o \
+ ada/errid.o \
ada/errout.o \
ada/erroutc.o \
+ ada/erroutc-sarif_emitter.o \
+ ada/erroutc-pretty_emitter.o \
+ ada/errsw.o \
ada/exit.o \
ada/final.o \
ada/fmap.o \
@@ -639,6 +625,7 @@ GNATBIND_OBJS = \
ada/gnatbind.o \
ada/gnatvsn.o \
ada/hostparm.o \
+ ada/json_utils.o \
ada/lib.o \
ada/link.o \
ada/namet.o \
@@ -710,6 +697,7 @@ GNATBIND_OBJS += \
ada/libgnat/s-assert.o \
ada/libgnat/s-carun8.o \
ada/libgnat/s-casuti.o \
+ ada/libgnat/s-cautns.o \
ada/libgnat/s-conca2.o \
ada/libgnat/s-conca3.o \
ada/libgnat/s-conca4.o \
@@ -1108,7 +1096,7 @@ check-ada-subtargets: check-acats-subtargets check-gnat-subtargets
# No ada-specific selftests
selftest-ada:
-ACATSDIR = $(TESTSUITEDIR)/ada/acats
+ACATSDIR = $(TESTSUITEDIR)/ada/acats-2
ACATSCMD = run_acats.sh
check_acats_numbers0:=1 2 3 4 5 6 7 8 9
diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in
index 4ffdc1e..3557b46 100644
--- a/gcc/ada/gcc-interface/Makefile.in
+++ b/gcc/ada/gcc-interface/Makefile.in
@@ -104,6 +104,8 @@ INSTALL_DATA_DATE = cp -p
MAKEINFO = makeinfo
TEXI2DVI = texi2dvi
TEXI2PDF = texi2pdf
+
+GNATMAKE_FOR_BUILD = gnatmake
GNATBIND_FLAGS = -static -x
ADA_CFLAGS =
ADAFLAGS = -W -Wall -gnatpg -gnata -gnatU
@@ -321,23 +323,18 @@ GNATMAKE_OBJS = a-except.o ali.o ali-util.o aspects.o s-casuti.o alloc.o \
erroutc.o errutil.o err_vars.o fmap.o fname.o fname-uf.o fname-sf.o \
gnatmake.o gnatvsn.o hostparm.o interfac.o i-c.o i-cstrin.o krunch.o lib.o \
make.o makeusg.o make_util.o namet.o nlists.o opt.o osint.o osint-m.o \
- output.o restrict.o rident.o s-exctab.o \
+ output.o restrict.o rident.o s-exctab.o s-cautns.o \
s-secsta.o s-stalib.o s-stoele.o scans.o scng.o sdefault.o sfn_scan.o \
s-purexc.o s-htable.o scil_ll.o sem_aux.o sinfo.o sinput.o sinput-c.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 types.o uintp.o \
uname.o urealp.o usage.o widechar.o warnsw.o \
seinfo.o einfo-entities.o einfo-utils.o sinfo-nodes.o sinfo-utils.o \
- diagnostics-brief_emitter.o \
- diagnostics-constructors.o \
- diagnostics-converter.o \
- diagnostics-json_utils.o \
- diagnostics-pretty_emitter.o \
- diagnostics-repository.o \
- diagnostics-sarif_emitter.o \
- diagnostics-switch_repository.o \
- diagnostics-utils.o \
- diagnostics.o \
+ errid.o \
+ errsw.o \
+ erroutc-pretty_emitter.o \
+ erroutc-sarif_emitter.o \
+ json_utils.o
$(EXTRA_GNATMAKE_OBJS)
# Make arch match the current multilib so that the RTS selection code
@@ -634,7 +631,7 @@ OSCONS_EXTRACT=$(GCC_FOR_ADA_RTS) $(GNATLIBCFLAGS_FOR_C) -S s-oscons-tmplt.i
-$(MKDIR) ./bldtools/oscons
$(RM) $(addprefix ./bldtools/oscons/,$(notdir $^))
$(CP) $^ ./bldtools/oscons
- (cd ./bldtools/oscons ; gnatmake -q xoscons)
+ (cd ./bldtools/oscons ; $(GNATMAKE_FOR_BUILD) xoscons)
$(RTSDIR)/s-oscons.ads: ../stamp-gnatlib1-$(RTSDIR) s-oscons-tmplt.c gsocket.h ./bldtools/oscons/xoscons
$(RM) $(RTSDIR)/s-oscons-tmplt.i $(RTSDIR)/s-oscons-tmplt.s
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 1694b4e..972607a 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -1228,6 +1228,24 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
gnu_expr = gnat_build_constructor (gnu_type, v);
}
+ /* If we are allocating the anonymous object of a small aggregate on
+ the stack, zero-initialize it so that the entire object is assigned
+ and the subsequent assignments need not preserve unknown bits, but
+ do it only when optimization is enabled for the sake of consistency
+ with the gimplifier which does the same for CONSTRUCTORs. */
+ else if (definition
+ && !imported_p
+ && !static_flag
+ && !gnu_expr
+ && TREE_CODE (gnu_type) == RECORD_TYPE
+ && TREE_CODE (gnu_object_size) == INTEGER_CST
+ && compare_tree_int (gnu_object_size, MAX_FIXED_MODE_SIZE) <= 0
+ && Present (Related_Expression (gnat_entity))
+ && Nkind (Original_Node (Related_Expression (gnat_entity)))
+ == N_Aggregate
+ && optimize)
+ gnu_expr = build_constructor (gnu_type, NULL);
+
/* Convert the expression to the type of the object if need be. */
if (gnu_expr && initial_value_needs_conversion (gnu_type, gnu_expr))
gnu_expr = convert (gnu_type, gnu_expr);
@@ -5251,7 +5269,7 @@ inline_status_for_subprog (Entity_Id subprog)
&& Is_Record_Type (Etype (First_Formal (subprog)))
&& (gnu_type = gnat_to_gnu_type (Etype (First_Formal (subprog))))
&& !TYPE_IS_BY_REFERENCE_P (gnu_type)
- && tree_fits_uhwi_p (TYPE_SIZE (gnu_type))
+ && TREE_CODE (TYPE_SIZE (gnu_type)) == INTEGER_CST
&& compare_tree_int (TYPE_SIZE (gnu_type), MAX_FIXED_MODE_SIZE) <= 0)
return is_prescribed;
diff --git a/gcc/ada/gcc-interface/misc.cc b/gcc/ada/gcc-interface/misc.cc
index ca5c9a2..128040e 100644
--- a/gcc/ada/gcc-interface/misc.cc
+++ b/gcc/ada/gcc-interface/misc.cc
@@ -377,7 +377,7 @@ gnat_init (void)
line_table->default_range_bits = 0;
/* Register our internal error function. */
- global_dc->m_internal_error = &internal_error_function;
+ global_dc->set_internal_error_callback (&internal_error_function);
return true;
}
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index 1448716..23737c3 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -3286,30 +3286,6 @@ tree
create_param_decl (tree name, tree type)
{
tree param_decl = build_decl (input_location, PARM_DECL, name, type);
-
- /* Honor TARGET_PROMOTE_PROTOTYPES like the C compiler, as not doing so
- can lead to various ABI violations. */
- if (targetm.calls.promote_prototypes (NULL_TREE)
- && INTEGRAL_TYPE_P (type)
- && TYPE_PRECISION (type) < TYPE_PRECISION (integer_type_node))
- {
- /* We have to be careful about biased types here. Make a subtype
- of integer_type_node with the proper biasing. */
- if (TREE_CODE (type) == INTEGER_TYPE
- && TYPE_BIASED_REPRESENTATION_P (type))
- {
- tree subtype
- = make_unsigned_type (TYPE_PRECISION (integer_type_node));
- TREE_TYPE (subtype) = integer_type_node;
- TYPE_BIASED_REPRESENTATION_P (subtype) = 1;
- SET_TYPE_RM_MIN_VALUE (subtype, TYPE_MIN_VALUE (type));
- SET_TYPE_RM_MAX_VALUE (subtype, TYPE_MAX_VALUE (type));
- type = subtype;
- }
- else
- type = integer_type_node;
- }
-
DECL_ARG_TYPE (param_decl) = type;
return param_decl;
}
@@ -5259,7 +5235,7 @@ convert (tree type, tree expr)
: size_zero_node;
tree byte_diff = size_diffop (type_pos, etype_pos);
- expr = build1 (NOP_EXPR, type, expr);
+ expr = fold_convert (type, expr);
if (integer_zerop (byte_diff))
return expr;
@@ -5267,6 +5243,21 @@ convert (tree type, tree expr)
fold_convert (sizetype, byte_diff));
}
+ /* If converting from a thin pointer with zero offset from the base to
+ a pointer to the array, add the offset of the array field. */
+ if (TYPE_IS_THIN_POINTER_P (etype)
+ && !TYPE_UNCONSTRAINED_ARRAY (TREE_TYPE (etype)))
+ {
+ tree arr_field = DECL_CHAIN (TYPE_FIELDS (TREE_TYPE (etype)));
+
+ if (TREE_TYPE (type) == TREE_TYPE (arr_field))
+ {
+ expr = fold_convert (type, expr);
+ return build_binary_op (POINTER_PLUS_EXPR, type, expr,
+ byte_position (arr_field));
+ }
+ }
+
/* If converting fat pointer to normal or thin pointer, get the pointer
to the array and then convert it. */
if (TYPE_IS_FAT_POINTER_P (etype))
diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc
index 99e5927..58418ea 100644
--- a/gcc/ada/gcc-interface/utils2.cc
+++ b/gcc/ada/gcc-interface/utils2.cc
@@ -1628,11 +1628,12 @@ build_unary_op (enum tree_code op_code, tree result_type, tree operand)
= size_binop (PLUS_EXPR, offset,
size_int (bits_to_bytes_round_down (bitpos)));
- /* Take the address of INNER, convert it to a pointer to our type
- and add the offset. */
- inner = build_unary_op (ADDR_EXPR,
- build_pointer_type (TREE_TYPE (operand)),
- inner);
+ /* Take the address of INNER, formally convert it to a pointer
+ to the operand type, and finally add the offset. */
+ inner = build_unary_op (ADDR_EXPR, NULL_TREE, inner);
+ inner
+ = fold_convert (build_pointer_type (TREE_TYPE (operand)),
+ inner);
result = build_binary_op (POINTER_PLUS_EXPR, TREE_TYPE (inner),
inner, offset);
break;