[multiple changes]

2012-10-01  Ed Schonberg  <schonberg@adacore.com>

	* sem_prag.adb (Process_Convention, Process_Import_Or_Interface):
	Adjust test so that when the pragma comes from an aspect
	specification it only applies to the entity in the original
	declaration.

2012-10-01  Thomas Quinot  <quinot@adacore.com>

	* gnat_ugn.texi: Document new command line switch -fada-spec-parent.

2012-10-01  Thomas Quinot  <quinot@adacore.com>

	* s-oscons-tmplt.c, g-socket.ads: Minor code improvement: use gcc
	builtin __alignof__ to get the alignment of struct fd_set.

2012-10-01  Vincent Pucci  <pucci@adacore.com>

	* exp_ch6.adb (Expand_Call): Remove call to
	Remove_Dimension_In_Call.
	* sem_aggr.adb (Resolve_Array_Aggregate): Analyze dimension of
	components in array aggregate.
	(Resolve_Aggr_Expr): Propagate dimensions from the original expression
	Expr to the new created expression New_Expr when resolving the
	expression of a component in record aggregates.
	(Resolve_Record_Aggregate): Analyze
	dimension of components in record (or extension) aggregate.
	* sem_ch6.adb (Analyze_Subprogram_Specification): Analyze
	dimension of formals with default expressions in subprogram
	specification.
	* sem_ch8.adb (Analyze_Expanded_Name): Analyze dimension of
	expanded names.
	(Find_Selected_Component): Analyze dimension of selected component.
	* sem_dim.adb: Several dimension error messages reformatting.
	(Dimensions_Msg_Of): New flag Description_Needed in order to
	differentiate two different sort of dimension error messages.
	(Dim_Warning_For_Numeric_Literal): New routine.
	(Exists): New routine.
	(Move_Dimensions): Routine spec moved to spec file.
	* sem_dim.ads (String_From_Numeric_Literal): New routine.
	(Analyze_Dimension): Analyze dimension only when the
	node comes from source.  Dimension analysis for expanded names added.
	(Analyze_Dimension_Array_Aggregate): New routine.
	(Analyze_Dimension_Call): New routine.
	(Analyze_Dimension_Component_Declaration): Warning if default
	expression is a numeric literal.
	(Analyze_Dimension_Extension_Or_Record_Aggregate): New routine.
	(Analyze_Dimension_Formals): New routine.
	(Analyze_Dimension_Object_Declaration): Warning if default
	expression is a numeric literal.
	(Symbol_Of): Return either the dimension subtype symbol or the
	dimension symbol built by From_Dim_To_Str_Of_Unit_Symbols.
	* sem_dim.ads (Analyze_Dimension_Array_Aggregate): New routine.
	(Analyze_Dimension_Call): New routine.
	(Analyze_Dimension_Extension_Or_Record_Aggregate): New routine.
	(Analyze_Dimension_Formals): New routine.
	(Move_Dimensions): Moved from sem_dim.adb.
	* s-dimmks.ads: Turn off the warnings for dimensioned object
	declaration.  Dimensioned subtypes sorted in alphabetical
	order. New subtypes Area, Speed, Volume.
	* s-dmotpr.ads: Turn off the warnings for dimensioned object
	declaration.
	* sem_res.adb (Resolve_Call): Analyze dimension for calls.

2012-10-01  Thomas Quinot  <quinot@adacore.com>

	* Make-generated.in: Minor cleanup of all targets: use
	MOVE_IF_CHANGE to put generated files in place, to avoid useless
	recompilations.

2012-10-01  Javier Miranda  <miranda@adacore.com>

	* exp_disp.adb (Expand_Dispatching_Call): For functions returning
	interface types add an implicit conversion to the returned object
	to force the displacement of the pointer to the returned object
	to reference the corresponding secondary dispatch table. This
	is needed to handle well combined calls involving secondary
	dispatch tables (for example Obj.Prim1.Prim2).
	* exp_ch4.adb (Expand_Allocator_Expression): Declare internal
	access type as access to constant or access to variable depending
	on the context. Found working in this ticket.

2012-10-01  Ed Schonberg  <schonberg@adacore.com>

	* checks.adb (Apply_Predicate_Check): Do not apply check to
	actual of predicate checking procedure, to prevent infinite
	recursion.

From-SVN: r191910
This commit is contained in:
Arnaud Charlet 2012-10-01 12:07:24 +02:00
parent 5f6e1c559b
commit 0929eaeb01
18 changed files with 1007 additions and 328 deletions

View File

@ -1,3 +1,91 @@
2012-10-01 Ed Schonberg <schonberg@adacore.com>
* sem_prag.adb (Process_Convention, Process_Import_Or_Interface):
Adjust test so that when the pragma comes from an aspect
specification it only applies to the entity in the original
declaration.
2012-10-01 Thomas Quinot <quinot@adacore.com>
* gnat_ugn.texi: Document new command line switch -fada-spec-parent.
2012-10-01 Thomas Quinot <quinot@adacore.com>
* s-oscons-tmplt.c, g-socket.ads: Minor code improvement: use gcc
builtin __alignof__ to get the alignment of struct fd_set.
2012-10-01 Vincent Pucci <pucci@adacore.com>
* exp_ch6.adb (Expand_Call): Remove call to
Remove_Dimension_In_Call.
* sem_aggr.adb (Resolve_Array_Aggregate): Analyze dimension of
components in array aggregate.
(Resolve_Aggr_Expr): Propagate dimensions from the original expression
Expr to the new created expression New_Expr when resolving the
expression of a component in record aggregates.
(Resolve_Record_Aggregate): Analyze
dimension of components in record (or extension) aggregate.
* sem_ch6.adb (Analyze_Subprogram_Specification): Analyze
dimension of formals with default expressions in subprogram
specification.
* sem_ch8.adb (Analyze_Expanded_Name): Analyze dimension of
expanded names.
(Find_Selected_Component): Analyze dimension of selected component.
* sem_dim.adb: Several dimension error messages reformatting.
(Dimensions_Msg_Of): New flag Description_Needed in order to
differentiate two different sort of dimension error messages.
(Dim_Warning_For_Numeric_Literal): New routine.
(Exists): New routine.
(Move_Dimensions): Routine spec moved to spec file.
* sem_dim.ads (String_From_Numeric_Literal): New routine.
(Analyze_Dimension): Analyze dimension only when the
node comes from source. Dimension analysis for expanded names added.
(Analyze_Dimension_Array_Aggregate): New routine.
(Analyze_Dimension_Call): New routine.
(Analyze_Dimension_Component_Declaration): Warning if default
expression is a numeric literal.
(Analyze_Dimension_Extension_Or_Record_Aggregate): New routine.
(Analyze_Dimension_Formals): New routine.
(Analyze_Dimension_Object_Declaration): Warning if default
expression is a numeric literal.
(Symbol_Of): Return either the dimension subtype symbol or the
dimension symbol built by From_Dim_To_Str_Of_Unit_Symbols.
* sem_dim.ads (Analyze_Dimension_Array_Aggregate): New routine.
(Analyze_Dimension_Call): New routine.
(Analyze_Dimension_Extension_Or_Record_Aggregate): New routine.
(Analyze_Dimension_Formals): New routine.
(Move_Dimensions): Moved from sem_dim.adb.
* s-dimmks.ads: Turn off the warnings for dimensioned object
declaration. Dimensioned subtypes sorted in alphabetical
order. New subtypes Area, Speed, Volume.
* s-dmotpr.ads: Turn off the warnings for dimensioned object
declaration.
* sem_res.adb (Resolve_Call): Analyze dimension for calls.
2012-10-01 Thomas Quinot <quinot@adacore.com>
* Make-generated.in: Minor cleanup of all targets: use
MOVE_IF_CHANGE to put generated files in place, to avoid useless
recompilations.
2012-10-01 Javier Miranda <miranda@adacore.com>
* exp_disp.adb (Expand_Dispatching_Call): For functions returning
interface types add an implicit conversion to the returned object
to force the displacement of the pointer to the returned object
to reference the corresponding secondary dispatch table. This
is needed to handle well combined calls involving secondary
dispatch tables (for example Obj.Prim1.Prim2).
* exp_ch4.adb (Expand_Allocator_Expression): Declare internal
access type as access to constant or access to variable depending
on the context. Found working in this ticket.
2012-10-01 Ed Schonberg <schonberg@adacore.com>
* checks.adb (Apply_Predicate_Check): Do not apply check to
actual of predicate checking procedure, to prevent infinite
recursion.
2012-10-01 Arnaud Charlet <charlet@adacore.com>
* gcc-interface/Make-lang.in: Update dependencies.

View File

@ -18,6 +18,7 @@ ifeq ($(origin MOVE_IF_CHANGE), undefined)
MOVE_IF_CHANGE=mv -f
endif
.PHONY: ada_extra_files
ada_extra_files : $(ADA_GEN_SUBDIR)/treeprs.ads $(ADA_GEN_SUBDIR)/einfo.h $(ADA_GEN_SUBDIR)/sinfo.h $(ADA_GEN_SUBDIR)/nmake.adb \
$(ADA_GEN_SUBDIR)/nmake.ads $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb $(ADA_GEN_SUBDIR)/snames.h
@ -27,19 +28,22 @@ $(ADA_GEN_SUBDIR)/treeprs.ads : $(ADA_GEN_SUBDIR)/treeprs.adt $(ADA_GEN_SUBDIR)/
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/treeprs
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/treeprs/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/treeprs
(cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs ../../treeprs.ads )
(cd $(ADA_GEN_SUBDIR)/bldtools/treeprs; gnatmake -q xtreeprs ; ./xtreeprs treeprs.ads )
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/treeprs/treeprs.ads $(ADA_GEN_SUBDIR)/treeprs.ads
$(ADA_GEN_SUBDIR)/einfo.h : $(ADA_GEN_SUBDIR)/einfo.ads $(ADA_GEN_SUBDIR)/einfo.adb $(ADA_GEN_SUBDIR)/xeinfo.adb $(ADA_GEN_SUBDIR)/ceinfo.adb
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/einfo
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/einfo/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/einfo
(cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo ../../einfo.h )
(cd $(ADA_GEN_SUBDIR)/bldtools/einfo; gnatmake -q xeinfo ; ./xeinfo einfo.h )
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/einfo/einfo.h $(ADA_GEN_SUBDIR)/einfo.h
$(ADA_GEN_SUBDIR)/sinfo.h : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/sinfo.adb $(ADA_GEN_SUBDIR)/xsinfo.adb $(ADA_GEN_SUBDIR)/csinfo.adb
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/sinfo
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/sinfo/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/sinfo
(cd $(ADA_GEN_SUBDIR)/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo ../../sinfo.h )
(cd $(ADA_GEN_SUBDIR)/bldtools/sinfo; gnatmake -q xsinfo ; ./xsinfo sinfo.h )
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/sinfo/sinfo.h $(ADA_GEN_SUBDIR)/sinfo.h
$(ADA_GEN_SUBDIR)/snames.h $(ADA_GEN_SUBDIR)/snames.ads $(ADA_GEN_SUBDIR)/snames.adb : $(ADA_GEN_SUBDIR)/stamp-snames ; @true
$(ADA_GEN_SUBDIR)/stamp-snames : $(ADA_GEN_SUBDIR)/snames.ads-tmpl $(ADA_GEN_SUBDIR)/snames.adb-tmpl $(ADA_GEN_SUBDIR)/snames.h-tmpl $(ADA_GEN_SUBDIR)/xsnamest.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
@ -52,17 +56,47 @@ $(ADA_GEN_SUBDIR)/stamp-snames : $(ADA_GEN_SUBDIR)/snames.ads-tmpl $(ADA_GEN_SUB
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/snamest/snames.nh $(ADA_GEN_SUBDIR)/snames.h
touch $(ADA_GEN_SUBDIR)/stamp-snames
$(ADA_GEN_SUBDIR)/nmake.adb : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/nmake.adt $(ADA_GEN_SUBDIR)/xnmake.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake_b
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake_b/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake_b
(cd $(ADA_GEN_SUBDIR)/bldtools/nmake_b; gnatmake -q xnmake ; ./xnmake -b ../../nmake.adb )
$(ADA_GEN_SUBDIR)/nmake.adb $(ADA_GEN_SUBDIR)/nmake.ads: $(ADA_GEN_SUBDIR)/stamp-nmake ; @true
$(ADA_GEN_SUBDIR)/stamp-nmake: $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/nmake.adt $(ADA_GEN_SUBDIR)/xnmake.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake
(cd $(ADA_GEN_SUBDIR)/bldtools/nmake; gnatmake -q xnmake ; ./xnmake -b nmake.adb ; ./xnmake -s nmake.ads)
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/nmake/nmake.ads $(ADA_GEN_SUBDIR)/nmake.ads
$(MOVE_IF_CHANGE) $(ADA_GEN_SUBDIR)/bldtools/nmake/nmake.adb $(ADA_GEN_SUBDIR)/nmake.adb
touch $(ADA_GEN_SUBDIR)/stamp-nmake
$(ADA_GEN_SUBDIR)/nmake.ads : $(ADA_GEN_SUBDIR)/sinfo.ads $(ADA_GEN_SUBDIR)/nmake.adt $(ADA_GEN_SUBDIR)/xnmake.adb $(ADA_GEN_SUBDIR)/nmake.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/nmake_s
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/nmake_s/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/nmake_s
(cd $(ADA_GEN_SUBDIR)/bldtools/nmake_s; gnatmake -q xnmake ; ./xnmake -s ../../nmake.ads )
ifeq ($(strip $(filter-out alpha64 ia64 dec hp vms% openvms% alphavms%,$(subst -, ,$(host)))),)
OSCONS_CPP=../../../$(DECC) -E /comment=as_is -DNATIVE \
-DTARGET='""$(target)""' s-oscons-tmplt.c
OSCONS_EXTRACT=../../../$(DECC) -DNATIVE \
-DTARGET='""$(target)""' s-oscons-tmplt.c ; \
ld -o s-oscons-tmplt.exe s-oscons-tmplt.obj; \
./s-oscons-tmplt.exe > s-oscons-tmplt.s
else
# GCC_FOR_TARGET has paths relative to the gcc directory, so we need to adjust
# for running it from $(ADA_GEN_SUBDIR)/bldtools/oscons
OSCONS_CC=`echo "$(GCC_FOR_TARGET)" \
| sed -e 's^\./xgcc^../../../xgcc^' -e 's^-B./^-B../../../^'`
OSCONS_CPP=$(OSCONS_CC) $(GNATLIBCFLAGS) -E -C \
-DTARGET=\"$(target)\" s-oscons-tmplt.c > s-oscons-tmplt.i
OSCONS_EXTRACT=$(OSCONS_CC) -S s-oscons-tmplt.i
endif
$(ADA_GEN_SUBDIR)/s-oscons.ads : $(ADA_GEN_SUBDIR)/s-oscons-tmplt.c $(ADA_GEN_SUBDIR)/gsocket.h $(ADA_GEN_SUBDIR)/xoscons.adb $(ADA_GEN_SUBDIR)/xutil.ads $(ADA_GEN_SUBDIR)/xutil.adb
-$(MKDIR) $(ADA_GEN_SUBDIR)/bldtools/oscons
$(RM) $(addprefix $(ADA_GEN_SUBDIR)/bldtools/oscons/,$(notdir $^))
$(CP) $^ $(ADA_GEN_SUBDIR)/bldtools/oscons
(cd $(ADA_GEN_SUBDIR)/bldtools/oscons ; gnatmake -q xoscons ; \
$(RM) s-oscons-tmplt.i s-oscons-tmplt.s ; \
$(OSCONS_CPP) ; \
$(OSCONS_EXTRACT) ; \
./xoscons ; \
$(RM) ../../s-oscons.ads ; \
$(MOVE_IF_CHANGE) s-oscons.ads $(ADA_GEN_SUBDIR)/s-oscons.ads ; \
$(MOVE_IF_CHANGE) s-oscons.h $(ADA_GEN_SUBDIR)/s-oscons.h)
$(ADA_GEN_SUBDIR)/sdefault.adb: $(ADA_GEN_SUBDIR)/stamp-sdefault ; @true
$(ADA_GEN_SUBDIR)/stamp-sdefault : $(srcdir)/version.c Makefile

View File

@ -2055,6 +2055,13 @@ package body Checks is
if Present (S) and then Get_TSS_Name (S) /= TSS_Null then
return;
-- Check certainly does not apply within the predicate function
-- itself, else we have a infinite recursion.
elsif S = Predicate_Function (Typ) then
return;
else
Insert_Action (N,
Make_Predicate_Check (Typ, Duplicate_Subexpr (N)));

View File

@ -1089,7 +1089,8 @@ package body Exp_Ch4 is
Make_Access_To_Object_Definition (Loc,
All_Present => True,
Null_Exclusion_Present => False,
Constant_Present => False,
Constant_Present =>
Is_Access_Constant (Etype (N)),
Subtype_Indication =>
New_Reference_To (Etype (Exp), Loc)));

View File

@ -2392,10 +2392,6 @@ package body Exp_Ch6 is
Expand_Put_Call_With_Symbol (Call_Node);
end if;
-- Remove the dimensions of every parameters in call
Remove_Dimension_In_Call (N);
-- Ignore if previous error
if Nkind (Call_Node) in N_Has_Etype

View File

@ -1068,6 +1068,32 @@ package body Exp_Disp is
-- to avoid the generation of spurious warnings under ZFP run-time.
Analyze_And_Resolve (Call_Node, Call_Typ, Suppress => All_Checks);
-- For functions returning interface types add implicit conversion to
-- force the displacement of the pointer to the object to reference
-- the corresponding secondary dispatch table. This is needed to
-- handle well nested calls through secondary dispatch tables
-- (for example Obj.Prim1.Prim2).
if Is_Interface (Res_Typ) then
Rewrite (Call_Node,
Make_Type_Conversion (Loc,
Subtype_Mark => New_Occurrence_Of (Res_Typ, Loc),
Expression => Relocate_Node (Call_Node)));
Set_Etype (Call_Node, Res_Typ);
Expand_Interface_Conversion (Call_Node, Is_Static => False);
Force_Evaluation (Call_Node);
pragma Assert (Nkind (Call_Node) = N_Explicit_Dereference
and then Nkind (Prefix (Call_Node)) = N_Identifier
and then Nkind (Parent (Entity (Prefix (Call_Node))))
= N_Object_Declaration);
Set_Assignment_OK (Parent (Entity (Prefix (Call_Node))));
if Nkind (Parent (Call_Node)) = N_Object_Declaration then
Set_Assignment_OK (Parent (Call_Node));
end if;
end if;
end Expand_Dispatching_Call;
---------------------------------

View File

@ -6,7 +6,7 @@
-- --
-- S p e c --
-- --
-- Copyright (C) 2001-2011, AdaCore --
-- Copyright (C) 2001-2012, 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- --
@ -1155,10 +1155,7 @@ private
type Fd_Set is
new System.Storage_Elements.Storage_Array (1 .. SOSC.SIZEOF_fd_set);
for Fd_Set'Alignment use Interfaces.C.long'Alignment;
-- Set conservative alignment so that our Fd_Sets are always adequately
-- aligned for the underlying data type (which is implementation defined
-- and may be an array of C long integers).
for Fd_Set'Alignment use SOSC.ALIGNOF_fd_set;
type Fd_Set_Access is access all Fd_Set;
pragma Convention (C, Fd_Set_Access);

View File

@ -18876,6 +18876,9 @@ and will attempt to generate corresponding Ada comments.
If you want to generate a single Ada file and not the transitive closure, you
can use instead the @option{-fdump-ada-spec-slim} switch.
You can optionally specify a parent unit, of which all generated units will
be children, using @code{-fada-spec-parent=}@var{unit}.
Note that we recommend when possible to use the @command{g++} driver to
generate bindings, even for most C headers, since this will in general
generate better Ada specs. For generating bindings for C++ headers, it is
@ -19059,6 +19062,11 @@ all header files that these headers depend upon).
Generate Ada spec files for the header files specified on the command line
only.
@item -fada-spec-parent=@var{unit}
@cindex -fada-spec-parent (@command{gcc})
Specifies that all files generated by @option{-fdump-ada-spec-slim} are
to be child units of the specified parent unit.
@item -C
@cindex @option{-C} (@command{gcc})
Extract comments from headers and generate Ada comments in the Ada spec files.

View File

@ -103,6 +103,9 @@ package System.Dim.Mks is
-- SI Base units
pragma Warnings (Off);
-- Turn off the all the dimension warnings
m : constant Length := 1.0;
kg : constant Mass := 1.0;
s : constant Time := 1.0;
@ -111,54 +114,48 @@ package System.Dim.Mks is
mol : constant Amount_Of_Substance := 1.0;
cd : constant Luminous_Intensity := 1.0;
pragma Warnings (On);
-- SI Derived dimensioned subtypes
subtype Absorbed_Dose is Mks_Type
with
Dimension => (Symbol => "Gy",
Meter => 2,
Second => -2,
others => 0);
subtype Angle is Mks_Type
with
Dimension => (Symbol => "rad",
others => 0);
subtype Solid_Angle is Mks_Type
subtype Area is Mks_Type
with
Dimension => (Symbol => "sr",
Dimension => (
Meter => 2,
others => 0);
subtype Frequency is Mks_Type
subtype Catalytic_Activity is Mks_Type
with
Dimension => (Symbol => "Hz",
Dimension => (Symbol => "kat",
Second => -1,
Mole => 1,
others => 0);
subtype Force is Mks_Type
subtype Celsius_Temperature is Mks_Type
with
Dimension => (Symbol => 'N',
Meter => 1,
Kilogram => 1,
Second => -2,
others => 0);
Dimension => (Symbol => "°C",
Kelvin => 1,
others => 0);
subtype Pressure is Mks_Type
subtype Electric_Capacitance is Mks_Type
with
Dimension => (Symbol => "Pa",
Meter => -1,
Kilogram => 1,
Second => -2,
others => 0);
subtype Energy is Mks_Type
with
Dimension => (Symbol => 'J',
Meter => 2,
Kilogram => 1,
Second => -2,
others => 0);
subtype Power is Mks_Type
with
Dimension => (Symbol => 'W',
Meter => 2,
Kilogram => 1,
Second => -3,
Dimension => (Symbol => 'F',
Meter => -2,
Kilogram => -1,
Second => 4,
Ampere => 2,
others => 0);
subtype Electric_Charge is Mks_Type
@ -168,6 +165,15 @@ package System.Dim.Mks is
Ampere => 1,
others => 0);
subtype Electric_Conductance is Mks_Type
with
Dimension => (Symbol => 'S',
Meter => -2,
Kilogram => -1,
Second => 3,
Ampere => 2,
others => 0);
subtype Electric_Potential_Difference is Mks_Type
with
Dimension => (Symbol => 'V',
@ -177,15 +183,6 @@ package System.Dim.Mks is
Ampere => -1,
others => 0);
subtype Electric_Capacitance is Mks_Type
with
Dimension => (Symbol => 'F',
Meter => -2,
Kilogram => -1,
Second => 4,
Ampere => 2,
others => 0);
subtype Electric_Resistance is Mks_Type
with
Dimension => (Symbol => "Ω",
@ -195,15 +192,57 @@ package System.Dim.Mks is
Ampere => -2,
others => 0);
subtype Electric_Conductance is Mks_Type
subtype Energy is Mks_Type
with
Dimension => (Symbol => 'S',
Meter => -2,
Kilogram => -1,
Second => 3,
Ampere => 2,
Dimension => (Symbol => 'J',
Meter => 2,
Kilogram => 1,
Second => -2,
others => 0);
subtype Equivalent_Dose is Mks_Type
with
Dimension => (Symbol => "Sv",
Meter => 2,
Second => -2,
others => 0);
subtype Force is Mks_Type
with
Dimension => (Symbol => 'N',
Meter => 1,
Kilogram => 1,
Second => -2,
others => 0);
subtype Frequency is Mks_Type
with
Dimension => (Symbol => "Hz",
Second => -1,
others => 0);
subtype Illuminance is Mks_Type
with
Dimension => (Symbol => "lx",
Meter => -2,
Candela => 1,
others => 0);
subtype Inductance is Mks_Type
with
Dimension => (Symbol => 'H',
Meter => 2,
Kilogram => 1,
Second => -2,
Ampere => -2,
others => 0);
subtype Luminous_Flux is Mks_Type
with
Dimension => (Symbol => "lm",
Candela => 1,
others => 0);
subtype Magnetic_Flux is Mks_Type
with
Dimension => (Symbol => "Wb",
@ -221,33 +260,21 @@ package System.Dim.Mks is
Ampere => -1,
others => 0);
subtype Inductance is Mks_Type
subtype Power is Mks_Type
with
Dimension => (Symbol => 'H',
Dimension => (Symbol => 'W',
Meter => 2,
Kilogram => 1,
Second => -2,
Ampere => -2,
Second => -3,
others => 0);
subtype Celsius_Temperature is Mks_Type
subtype Pressure is Mks_Type
with
Dimension => (Symbol => "°C",
Kelvin => 1,
others => 0);
subtype Luminous_Flux is Mks_Type
with
Dimension => (Symbol => "lm",
Candela => 1,
others => 0);
subtype Illuminance is Mks_Type
with
Dimension => (Symbol => "lx",
Meter => -2,
Candela => 1,
others => 0);
Dimension => (Symbol => "Pa",
Meter => -1,
Kilogram => 1,
Second => -2,
others => 0);
subtype Radioactivity is Mks_Type
with
@ -255,27 +282,27 @@ package System.Dim.Mks is
Second => -1,
others => 0);
subtype Absorbed_Dose is Mks_Type
subtype Solid_Angle is Mks_Type
with
Dimension => (Symbol => "Gy",
Meter => 2,
Second => -2,
Dimension => (Symbol => "sr",
others => 0);
subtype Equivalent_Dose is Mks_Type
subtype Speed is Mks_Type
with
Dimension => (Symbol => "Sv",
Meter => 2,
Second => -2,
others => 0);
subtype Catalytic_Activity is Mks_Type
with
Dimension => (Symbol => "kat",
Dimension => (
Meter => 1,
Second => -1,
Mole => 1,
others => 0);
subtype Volume is Mks_Type
with
Dimension => (
Meter => 3,
others => 0);
pragma Warnings (Off);
-- Turn off the all the dimension warnings
rad : constant Angle := 1.0;
sr : constant Solid_Angle := 1.0;
Hz : constant Frequency := 1.0;
@ -349,4 +376,5 @@ package System.Dim.Mks is
kA : constant Electric_Current := 1.0E+03; -- kilo
MeA : constant Electric_Current := 1.0E+06; -- mega
pragma Warnings (On);
end System.Dim.Mks;

View File

@ -38,6 +38,9 @@ package System.Dim.Mks.Other_Prefixes is
-- SI prefixes for Meter
pragma Warnings (Off);
-- Turn off the all the dimension warnings
ym : constant Length := 1.0E-24; -- yocto
zm : constant Length := 1.0E-21; -- zepto
am : constant Length := 1.0E-18; -- atto
@ -165,4 +168,5 @@ package System.Dim.Mks.Other_Prefixes is
Zecd : constant Luminous_Intensity := 1.0E+21; -- zetta
Yocd : constant Luminous_Intensity := 1.0E+24; -- yotta
pragma Warnings (On);
end System.Dim.Mks.Other_Prefixes;

View File

@ -1292,7 +1292,7 @@ CNS(MAX_tv_sec, "")
}
/*
-- Sizes of various data types
-- Sizes and alignments of various data types
*/
#define SIZEOF_sockaddr_in (sizeof (struct sockaddr_in))
@ -1306,6 +1306,9 @@ CND(SIZEOF_sockaddr_in6, "struct sockaddr_in6")
#define SIZEOF_fd_set (sizeof (fd_set))
CND(SIZEOF_fd_set, "fd_set");
#define ALIGNOF_fd_set (__alignof__ (fd_set))
CND(ALIGNOF_fd_set, "");
CND(FD_SETSIZE, "Max fd value");
#define SIZEOF_struct_hostent (sizeof (struct hostent))

View File

@ -47,6 +47,7 @@ with Sem_Cat; use Sem_Cat;
with Sem_Ch3; use Sem_Ch3;
with Sem_Ch8; use Sem_Ch8;
with Sem_Ch13; use Sem_Ch13;
with Sem_Dim; use Sem_Dim;
with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
@ -2549,6 +2550,10 @@ package body Sem_Aggr is
Duplicate_Subexpr (High_Bound (Aggregate_Bounds (N))));
end if;
-- Check the dimensions of each component in the array aggregate.
Analyze_Dimension_Array_Aggregate (N, Component_Typ);
return Success;
end Resolve_Array_Aggregate;
@ -3225,8 +3230,9 @@ package body Sem_Aggr is
-----------------------
procedure Resolve_Aggr_Expr (Expr : Node_Id; Component : Node_Id) is
New_C : Entity_Id := Component;
Expr_Type : Entity_Id := Empty;
New_C : Entity_Id := Component;
New_Expr : Node_Id;
function Has_Expansion_Delayed (Expr : Node_Id) return Boolean;
-- If the expression is an aggregate (possibly qualified) then its
@ -3380,10 +3386,17 @@ package body Sem_Aggr is
end if;
if Relocate then
Add_Association (New_C, Relocate_Node (Expr), New_Assoc_List);
New_Expr := Relocate_Node (Expr);
-- Since New_Expr is not gonna be analyzed later on, we need to
-- propagate here the dimensions form Expr to New_Expr.
Move_Dimensions (Expr, New_Expr);
else
Add_Association (New_C, Expr, New_Assoc_List);
New_Expr := Expr;
end if;
Add_Association (New_C, New_Expr, New_Assoc_List);
end Resolve_Aggr_Expr;
-- Start of processing for Resolve_Record_Aggregate
@ -4490,6 +4503,10 @@ package body Sem_Aggr is
Rewrite (N, New_Aggregate);
end Step_8;
-- Check the dimensions of the components in the record aggregate.
Analyze_Dimension_Extension_Or_Record_Aggregate (N);
end Resolve_Record_Aggregate;
-----------------------------

View File

@ -3450,6 +3450,10 @@ package body Sem_Ch6 is
Push_Scope (Designator);
Process_Formals (Formals, N);
-- Check dimensions in N for formals with default expression
Analyze_Dimension_Formals (N, Formals);
-- Ada 2005 (AI-345): If this is an overriding operation of an
-- inherited interface operation, and the controlling type is
-- a synchronized type, replace the type with its corresponding

View File

@ -577,6 +577,8 @@ package body Sem_Ch8 is
else
Find_Expanded_Name (N);
end if;
Analyze_Dimension (N);
end Analyze_Expanded_Name;
---------------------------------------
@ -6153,6 +6155,8 @@ package body Sem_Ch8 is
Analyze_Selected_Component (N);
end if;
Analyze_Dimension (N);
end Find_Selected_Component;
---------------

File diff suppressed because it is too large Load Diff

View File

@ -108,16 +108,19 @@ package Sem_Dim is
procedure Analyze_Dimension (N : Node_Id);
-- N may denote any of the following contexts:
-- * aggregate
-- * assignment statement
-- * attribute reference
-- * binary operator
-- * call
-- * compontent declaration
-- * extended return statement
-- * function call
-- * expanded name
-- * identifier
-- * indexed component
-- * object declaration
-- * object renaming declaration
-- * procedure call statement
-- * qualified expression
-- * selected component
-- * simple return statement
@ -129,6 +132,36 @@ package Sem_Dim is
-- Depending on the context, ensure that all expressions and entities
-- involved do not violate the rules of a system.
procedure Analyze_Dimension_Array_Aggregate
(N : Node_Id;
Comp_Typ : Entity_Id);
-- Check, for each component of the array aggregate denoted by N, the
-- dimensions of the component expression match the dimensions of the
-- component type Comp_Typ.
procedure Analyze_Dimension_Call (N : Node_Id; Nam : Entity_Id);
-- This routine is split in two steps. Note the second step applies only to
-- function calls.
-- Step 1. Dimension checking:
-- * General case: check the dimensions of each actual parameter match
-- the dimensions of the corresponding formal parameter.
-- * Elementary function case: check each actual is dimensionless except
-- for Sqrt call.
-- Step 2. Dimension propagation (only for functions):
-- * General case: propagate the dimensions from the returned type to the
-- function call.
-- * Sqrt case: the resulting dimensions equal to half the dimensions of
-- the actual
procedure Analyze_Dimension_Extension_Or_Record_Aggregate (N : Node_Id);
-- Check, for each component of the extension or record aggregate denoted
-- by N, the dimensions of the component expression match the dimensions of
-- the component type.
procedure Analyze_Dimension_Formals (N : Node_Id; Formals : List_Id);
-- For sub spec N, issue a warning for each dimensioned formal with a
-- literal default value in the list of formals Formals.
procedure Eval_Op_Expon_For_Dimensioned_Type
(N : Node_Id;
Btyp : Entity_Id);
@ -150,8 +183,8 @@ package Sem_Dim is
-- Return True if N is a package instantiation of System.Dim.Integer_IO or
-- of System.Dim.Float_IO.
procedure Remove_Dimension_In_Call (Call : Node_Id);
-- Remove the dimensions from all formal parameters of Call
procedure Move_Dimensions (From : Node_Id; To : Node_Id);
-- Copy dimension vector of From to To, delete dimension vector of From
procedure Remove_Dimension_In_Statement (Stmt : Node_Id);
-- Remove the dimensions associated with Stmt

View File

@ -3629,9 +3629,18 @@ package body Sem_Prag is
Generate_Reference (E, Id, 'i');
end if;
-- Loop through the homonyms of the pragma argument's entity
-- If the pragma comes from from an aspect, it only applies
-- to the given entity, not its homonyms.
if From_Aspect_Specification (N) then
return;
end if;
-- Otherwise Loop through the homonyms of the pragma argument's
-- entity, an apply convention to those in the current scope.
E1 := Ent;
loop
E1 := Homonym (E1);
exit when No (E1) or else Scope (E1) /= Current_Scope;
@ -3659,10 +3668,6 @@ package body Sem_Prag is
Generate_Reference (E1, Id, 'b');
end if;
end if;
-- For aspect case, do NOT apply to homonyms
exit when From_Aspect_Specification (N);
end loop;
end if;
end Process_Convention;
@ -4528,10 +4533,12 @@ package body Sem_Prag is
or else Is_Generic_Subprogram (Def_Id)
then
-- If the name is overloaded, pragma applies to all of the denoted
-- entities in the same declarative part.
-- entities in the same declarative part, unless the pragma comes
-- from an aspect specification.
Hom_Id := Def_Id;
while Present (Hom_Id) loop
Def_Id := Get_Base_Subprogram (Hom_Id);
-- Ignore inherited subprograms because the pragma will apply
@ -4642,6 +4649,9 @@ package body Sem_Prag is
exit;
elsif From_Aspect_Specification (N) then
exit;
else
Hom_Id := Homonym (Hom_Id);
end if;

View File

@ -5888,7 +5888,10 @@ package body Sem_Res is
end;
end if;
Analyze_Dimension (N);
-- Check the dimensions of the actuals in the call. For function calls,
-- propagate the dimensions from the returned type to N.
Analyze_Dimension_Call (N, Nam);
-- All done, evaluate call and deal with elaboration issues