From dbb4cfef76186a547ac0c3ce1e0d895cd87685ec Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Mon, 20 Oct 2014 17:06:52 +0200 Subject: [PATCH] [multiple changes] 2014-10-20 Robert Dewar * sem_ch3.adb, prj-proc.adb, prj-proc.ads, prj-conf.adb: Minor reformatting. 2014-10-20 Robert Dewar * par-prag.adb (Add_List_Pragma_Entry): New procedure. * par.adb (P_Pragma): Document requirement to handle multiple calls. 2014-10-20 Robert Dewar * sem_prag.adb (Analyze_Pragma, case No_Elaboration_Code_All): Fix error of bad inheritance of this pragma from with'ed unit. 2014-10-20 Ed Schonberg * sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): For a subtype, inherit convention from parent type, because the subtype may have been declared on a partial view, prior to the pragma on the parent. 2014-10-20 Olivier Hainque Tristan Gingold * gcc-interface/Makefile.in: Handle arm-darwin and VxWorks 7. Misc clean ups. 2014-10-20 Nicolas Roche * gcc-interface/Make-lang.in: ensure that automatically generated dependency are referencing generated gnatvsn rather than original one. From-SVN: r216482 --- gcc/ada/ChangeLog | 34 ++++++++++++++++++++++++++ gcc/ada/gcc-interface/Make-lang.in | 32 ++++++++++++++++++++----- gcc/ada/gcc-interface/Makefile.in | 38 +++++++++++++++++++++++++----- gcc/ada/par-prag.adb | 33 ++++++++++++++++++-------- gcc/ada/par.adb | 7 +++++- gcc/ada/prj-conf.adb | 2 -- gcc/ada/prj-proc.adb | 10 ++++---- gcc/ada/prj-proc.ads | 1 + gcc/ada/sem_ch13.adb | 9 +++++++ gcc/ada/sem_ch3.adb | 10 ++++---- gcc/ada/sem_prag.adb | 15 ++++++++---- 11 files changed, 151 insertions(+), 40 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 5cabad4752f..759de61734a 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,37 @@ +2014-10-20 Robert Dewar + + * sem_ch3.adb, prj-proc.adb, prj-proc.ads, prj-conf.adb: Minor + reformatting. + +2014-10-20 Robert Dewar + + * par-prag.adb (Add_List_Pragma_Entry): New procedure. + * par.adb (P_Pragma): Document requirement to handle multiple calls. + +2014-10-20 Robert Dewar + + * sem_prag.adb (Analyze_Pragma, case No_Elaboration_Code_All): + Fix error of bad inheritance of this pragma from with'ed unit. + +2014-10-20 Ed Schonberg + + * sem_ch13.adb (Inherit_Aspects_At_Freeze_Point): For a subtype, + inherit convention from parent type, because the subtype may + have been declared on a partial view, prior to the pragma on + the parent. + +2014-10-20 Olivier Hainque + Tristan Gingold + + * gcc-interface/Makefile.in: Handle arm-darwin and VxWorks 7. + Misc clean ups. + +2014-10-20 Nicolas Roche + + * gcc-interface/Make-lang.in: ensure that automatically generated + dependency are referencing generated gnatvsn rather than original + one. + 2014-10-20 Gary Dismukes * gnat_ugn.texi: Minor reformatting. diff --git a/gcc/ada/gcc-interface/Make-lang.in b/gcc/ada/gcc-interface/Make-lang.in index e11794f9237..efae513ef79 100644 --- a/gcc/ada/gcc-interface/Make-lang.in +++ b/gcc/ada/gcc-interface/Make-lang.in @@ -68,7 +68,7 @@ ALL_ADAFLAGS = \ $(CFLAGS) $(ADA_CFLAGS) $(ADAFLAGS) $(CHECKING_ADAFLAGS) $(WARN_ADAFLAGS) FORCE_DEBUG_ADAFLAGS = -g ADA_CFLAGS = -ADA_INCLUDES = -nostdinc -I- -I. -Iada -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface +ADA_INCLUDES = -nostdinc -I- -I. -Iada/generated -Iada -I$(srcdir)/ada -I$(srcdir)/ada/gcc-interface GNATLIBFLAGS= -W -Wall -gnatpg -nostdinc GNATLIBCFLAGS= -g -O2 $(TCFLAGS) ADA_INCLUDE_DIR = $(libsubdir)/adainclude @@ -111,6 +111,7 @@ ADA_DEPS=case $@ in \ *)a="`echo $@ | sed -e 's/.o$$/.ali/'`"; \ echo "$@: `cat $$a | \ sed -ne 's;^D \([a-z0-9_\.-]*\).*;ada/\1;gp' | \ + sed -e 's;ada/gnatvsn.ads;ada/generated/gnatvsn.ads;g' | \ tr -d '\015' | tr '\n' ' '`" > $(dir $@)/$(DEPDIR)/$(patsubst %.o,%.Po,$(notdir $@));; \ esac; @@ -145,7 +146,7 @@ ifeq ($(build), $(host)) CC="../../xgcc -B../../" \ CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ - ADA_INCLUDES="-I- -I../rts" \ + ADA_INCLUDES="-I- -I../generated -I../rts" \ GNATMAKE="../../gnatmake" \ GNATLINK="../../gnatlink" \ GNATBIND="../../gnatbind" @@ -163,7 +164,7 @@ ifeq ($(build), $(host)) CC="$(CC)" \ CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ - ADA_INCLUDES="-I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \ + ADA_INCLUDES="-I../generated -I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \ GNATMAKE="gnatmake" \ GNATBIND="gnatbind" \ GNATLINK="gnatlink" \ @@ -186,7 +187,7 @@ else CC="$(CC)" \ CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ - ADA_INCLUDES="-I../rts" \ + ADA_INCLUDES="-I../generated -I../rts" \ GNATMAKE="$(GNATMAKE_FOR_HOST)" \ GNATBIND="$(GNATBIND_FOR_HOST)" \ GNATLINK="$(GNATLINK_FOR_HOST)" \ @@ -201,7 +202,7 @@ else CC="$(CC)" \ CXX="$(CXX)" \ $(COMMON_FLAGS_TO_PASS) $(ADA_FLAGS_TO_PASS) \ - ADA_INCLUDES="-I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \ + ADA_INCLUDES="-I../generated -I$(RTS_DIR)/../adainclude -I$(RTS_DIR)" \ GNATMAKE="$(GNATMAKE_FOR_HOST)" \ GNATBIND="$(GNATBIND_FOR_HOST)" \ GNATLINK="$(GNATLINK_FOR_HOST)" \ @@ -985,6 +986,24 @@ ada/a-tags.o : ada/a-tags.adb ada/a-tags.ads $< $(OUTPUT_OPTION) @$(ADA_DEPS) +# Handling of gnatvsn version string + +# This ensure the build works even if there is no GNAT_DATE present in the +# sources +ada/GNAT_DATE: + touch ada/GNAT_DATE + +ada/generated/gnatvsn.ads: ada/gnatvsn.ads BASE-VER ada/GNAT_DATE + $(MKDIR) ada/generated + s=`cat $(srcdir)/BASE-VER | sed -e "s/\([0-9]*\)\.\([0-9]*\)\..*/-\1\2/g"`; \ + d=`if test -f $(srcdir)/ada/GNAT_DATE; then \ + cat $(srcdir)/ada/GNAT_DATE; else date +%Y%m%d; fi`; \ + cat $< | sed -e "/Version/s/(\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*)/($$d$$s)/g" >$@ + +ada/gnatvsn.o : ada/gnatvsn.adb ada/generated/gnatvsn.ads + $(CC) -c $(ALL_ADAFLAGS) -Iada/generated -I../ada/generated $(ADA_INCLUDES) $< $(OUTPUT_OPTION) + @$(ADA_DEPS) + # Dependencies for windows specific tool (mdll) ada/mdll.o : ada/mdll.adb ada/mdll.ads ada/mdll-fil.ads ada/mdll-utl.ads @@ -997,7 +1016,8 @@ ada/mdll-utl.o : ada/mdll-utl.adb ada/mdll.ads ada/mdll-utl.ads ada/sdefault.ads $(CC) -c $(ALL_ADAFLAGS) $(ADA_INCLUDES) $< $(OUTPUT_OPTION) ada_generated_files = ada/sinfo.h ada/einfo.h ada/nmake.adb ada/nmake.ads \ - ada/treeprs.ads ada/snames.ads ada/snames.adb ada/snames.h + ada/treeprs.ads ada/snames.ads ada/snames.adb ada/snames.h \ + ada/generated/gnatvsn.ads # When building from scratch we don't have dependency files, the only thing # we need to ensure is that the generated files are created first. diff --git a/gcc/ada/gcc-interface/Makefile.in b/gcc/ada/gcc-interface/Makefile.in index 51c817b6b10..cedc7e93a03 100644 --- a/gcc/ada/gcc-interface/Makefile.in +++ b/gcc/ada/gcc-interface/Makefile.in @@ -523,6 +523,12 @@ ifeq ($(strip $(filter-out powerpc% wrs vxworks vxworks7,$(target_cpu) $(target_ ARCH_STR=ppc endif + ifeq ($(strip $(filter-out vxworks7%, $(target_os))),) + SVX=system-vxworks7 + else + SVX=system-vxworks + endif + LIBGNAT_TARGET_PAIRS = \ a-intnam.ads Check_Arg_Count (1); @@ -425,16 +443,12 @@ begin -- in the List (Off) case, the pragma will print even in a region -- of code with listing turned off (this is required). - List_Pragmas.Increment_Last; - List_Pragmas.Table (List_Pragmas.Last) := - (Ptyp => List_On, Ploc => Sloc (Pragma_Node)); + Add_List_Pragma_Entry (List_On, Sloc (Pragma_Node)); -- Now generate the list off entry for pragma List (Off) if Chars (Expression (Arg1)) = Name_Off then - List_Pragmas.Increment_Last; - List_Pragmas.Table (List_Pragmas.Last) := - (Ptyp => List_Off, Ploc => Semi); + Add_List_Pragma_Entry (List_Off, Semi); end if; ---------------- @@ -448,8 +462,7 @@ begin when Pragma_Page => Check_Arg_Count (0); - List_Pragmas.Increment_Last; - List_Pragmas.Table (List_Pragmas.Last) := (Page, Semi); + Add_List_Pragma_Entry (Page, Semi); ------------------ -- Restrictions -- diff --git a/gcc/ada/par.adb b/gcc/ada/par.adb index 53b19f53fce..0e938d72ea8 100644 --- a/gcc/ada/par.adb +++ b/gcc/ada/par.adb @@ -611,7 +611,12 @@ function Par (Configuration_Pragmas : Boolean) return List_Id is function P_Pragma (Skipping : Boolean := False) return Node_Id; -- Scan out a pragma. If Skipping is True, then the caller is skipping -- the pragma in the context of illegal placement (this is used to avoid - -- some junk cascaded messages). + -- some junk cascaded messages). Some pragmas must be dealt with during + -- the parsing phase (e.g. pragma Page, since we can generate a listing + -- in syntax only mode). It is possible that the parser uses the rescan + -- logic (using Save/Restore_Scan_State) with the effect of calling this + -- procedure more than once for the same pragma. All parse-time pragma + -- handling must be prepared to handle such multiple calls correctly. function P_Identifier (C : Id_Check := None) return Node_Id; -- Scans out an identifier. The parameter C determines the treatment diff --git a/gcc/ada/prj-conf.adb b/gcc/ada/prj-conf.adb index 0be49a079fb..53d29ac5d37 100644 --- a/gcc/ada/prj-conf.adb +++ b/gcc/ada/prj-conf.adb @@ -849,10 +849,8 @@ package body Prj.Conf is begin Proj := Project; - while Proj /= No_Project loop Id := Value_Of (Name_Runtime, Proj.Decl.Arrays, Shared); - while Id /= No_Array_Element loop Element := Shared.Array_Elements.Table (Id); Lang := Element.Index; diff --git a/gcc/ada/prj-proc.adb b/gcc/ada/prj-proc.adb index dbb77144104..bb07da9bdea 100644 --- a/gcc/ada/prj-proc.adb +++ b/gcc/ada/prj-proc.adb @@ -966,19 +966,19 @@ package body Prj.Proc is when List => case The_Default is - when Read_Only_Value => + when Read_Only_Value => null; - when Empty_Value => + when Empty_Value => The_Variable.Values := Nil_String; - when Dot_Value => + when Dot_Value => The_Variable.Values := Shared.Dot_String_List; when Object_Dir_Value | - Target_Value | - Runtime_Value => + Target_Value | + Runtime_Value => null; end case; end case; diff --git a/gcc/ada/prj-proc.ads b/gcc/ada/prj-proc.ads index 0156df87f44..face045b5f4 100644 --- a/gcc/ada/prj-proc.ads +++ b/gcc/ada/prj-proc.ads @@ -93,4 +93,5 @@ package Prj.Proc is procedure Set_Default_Runtime_For (Language : Name_Id; Value : String); -- Set the default value for the runtime of Language. To be used for the -- value of 'Runtime() when Runtime () is not declared. + end Prj.Proc; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index 211d9675681..a23001daa48 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -10664,6 +10664,9 @@ package body Sem_Ch13 is -- Component_Size, Machine_Radix, Object_Size, Pack, Predicates, -- Preelaborable_Initialization, RM_Size and Small. + -- In addition, Convention must be propagated from base type to subtype, + -- because the subtype may have been declared on an incomplete view. + if Nkind (Parent (Typ)) = N_Private_Extension_Declaration then return; end if; @@ -10700,6 +10703,12 @@ package body Sem_Ch13 is Set_Is_Volatile (Typ); end if; + -- Convention + + if Typ /= Base_Type (Typ) and then Is_Frozen (Base_Type (Typ)) then + Set_Convention (Typ, Convention (Base_Type (Typ))); + end if; + -- Default_Component_Value if Is_Array_Type (Typ) diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index ec4f7914c0c..7f42291317c 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3846,9 +3846,7 @@ package body Sem_Ch3 is -- for discriminants and are thus not indefinite. elsif Is_Unchecked_Union (T) then - if Constant_Present (N) - or else Nkind (E) = N_Function_Call - then + if Constant_Present (N) or else Nkind (E) = N_Function_Call then Set_Ekind (Id, E_Constant); else Set_Ekind (Id, E_Variable); @@ -3856,9 +3854,9 @@ package body Sem_Ch3 is Rewrite (N, Make_Object_Renaming_Declaration (Loc, - Defining_Identifier => Id, - Subtype_Mark => New_Occurrence_Of (T, Loc), - Name => E)); + Defining_Identifier => Id, + Subtype_Mark => New_Occurrence_Of (T, Loc), + Name => E)); Set_Renamed_Object (Id, E); Freeze_Before (N, T); diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index ea028abf064..5ef1010e3ca 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -16416,12 +16416,19 @@ package body Sem_Prag is Set_No_Elab_Code_All (Current_Sem_Unit); - -- Set restriction No_Elaboration_Code, including adding it to the - -- set of configuration restrictions so it will apply to all units - -- in the extended main source. + -- Set restriction No_Elaboration_Code Set_Restriction (No_Elaboration_Code, N); - Add_To_Config_Boolean_Restrictions (No_Elaboration_Code); + + -- If we are in the main unit or in an extended main source unit, + -- then we also add it to the configuration restrictions so that + -- it will apply to all units in the extended main source. + + if Current_Sem_Unit = Main_Unit + or else In_Extended_Main_Source_Unit (N) + then + Add_To_Config_Boolean_Restrictions (No_Elaboration_Code); + end if; -- If in main extended unit, activate transitive with test -- 2.30.2