From 8489c2956a08a7397d80cc21f67c1a1064c14cdc Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Wed, 6 Sep 2017 11:44:29 +0200 Subject: [multiple changes] 2017-09-06 Eric Botcazou * ali.ads (ALIs_Record): Add No_Component_Reordering component. (No_Component_Reordering_Specified): New switch. * ali.adb (Initialize_ALI): Set No_Component_Reordering_Specified. (Scan_ALI): Set No_Component_Reordering and deal with NC marker. * bcheck.adb (Check_Consistent_No_Component_Reordering): New check. (Check_Configuration_Consistency): Invoke it. * debug.adb (d.r): Toggle the effect of the switch. (d.v): Change to no-op. * einfo.ads (Has_Complex_Representation): Restrict to record types. (No_Reordering): New alias for Flag239. (OK_To_Reorder_Components): Delete. (No_Reordering): Declare. (Set_No_Reordering): Likewise. (OK_To_Reorder_Components): Delete. (Set_OK_To_Reorder_Components): Likewise. * einfo.adb (Has_Complex_Representation): Expect record types. (No_Reordering): New function. (OK_To_Reorder_Components): Delete. (Set_Has_Complex_Representation): Expect base record types. (Set_No_Reordering): New procedure. (Set_OK_To_Reorder_Components): Delete. (Write_Entity_Flags): Adjust to above change. * fe.h (Debug_Flag_Dot_R): New macro and declaration. * freeze.adb (Freeze_Record_Type): Remove conditional code setting OK_To_Reorder_Components on record types with convention Ada. * lib-writ.adb (Write_ALI): Deal with NC marker. * opt.ads (No_Component_Reordering): New flag. (No_Component_Reordering_Config): Likewise. (Config_Switches_Type): Add No_Component_Reordering component. * opt.adb (Register_Opt_Config_Switches): Copy No_Component_Reordering onto No_Component_Reordering_Config. (Restore_Opt_Config_Switches): Restore No_Component_Reordering. (Save_Opt_Config_Switches): Save No_Component_Reordering. (Set_Opt_Config_Switches): Set No_Component_Reordering. * par-prag.adb (Prag): Deal with Pragma_No_Component_Reordering. * sem_ch3.adb (Analyze_Private_Extension_Declaration): Also set the No_Reordering flag from the default. (Build_Derived_Private_Type): Likewise. (Build_Derived_Record_Type): Likewise. Then inherit it for untagged types and clean up handling of similar flags. (Record_Type_Declaration): Likewise. * sem_ch13.adb (Same_Representation): Deal with No_Reordering and remove redundant test on Is_Tagged_Type. * sem_prag.adb (Analyze_Pragma): Handle No_Component_Reordering. (Sig_Flags): Likewise. * snames.ads-tmpl (Name_No_Component_Reordering): New name. (Pragma_Id): Add Pragma_No_Component_Reordering value. * warnsw.adb (Set_GNAT_Mode_Warnings): Enable -gnatw.q as well. * gcc-interface/decl.c (gnat_to_gnu_entity) : Copy the layout of the parent type only if the No_Reordering settings match. (components_to_record): Reorder record types with convention Ada by default unless No_Reordering is set or -gnatd.r is specified and do not warn if No_Reordering is set in GNAT mode. 2017-09-06 Ed Schonberg * sem_util.ads, sem_util.adb (Check_Previous_Null_Procedure): new predicate to reject declarations that can be completions, when there is a visible prior homograph that is a null procedure. * sem_ch6.adb (Analyze_Null_Procedure): use it. * sem_ch8.adb (Analyze_Subprogram_Renaming): ditto. 2017-09-06 Thomas Quinot * s-regpat.adb (Compile.Parse_Literal): Fix handling of literal run of 253 characters or more. From-SVN: r251760 --- gcc/ada/bcheck.adb | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 69 insertions(+), 1 deletion(-) (limited to 'gcc/ada/bcheck.adb') diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb index fa83f89..a1727c6 100644 --- a/gcc/ada/bcheck.adb +++ b/gcc/ada/bcheck.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2016, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2017, 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 Bcheck is procedure Check_Consistent_Dynamic_Elaboration_Checking; procedure Check_Consistent_Interrupt_States; procedure Check_Consistent_Locking_Policy; + procedure Check_Consistent_No_Component_Reordering; procedure Check_Consistent_Normalize_Scalars; procedure Check_Consistent_Optimize_Alignment; procedure Check_Consistent_Partition_Elaboration_Policy; @@ -80,6 +81,10 @@ package body Bcheck is Check_Consistent_Locking_Policy; end if; + if No_Component_Reordering_Specified then + Check_Consistent_No_Component_Reordering; + end if; + if Partition_Elaboration_Policy_Specified /= ' ' then Check_Consistent_Partition_Elaboration_Policy; end if; @@ -643,6 +648,69 @@ package body Bcheck is end loop Find_Policy; end Check_Consistent_Locking_Policy; + ---------------------------------------------- + -- Check_Consistent_No_Component_Reordering -- + ---------------------------------------------- + + -- This routine checks for a consistent No_Component_Reordering setting. + -- Note that internal units are excluded from this check, since we don't + -- in any case allow the pragma to affect types in internal units, and + -- there is thus no requirement to recompile the run-time with the setting. + + procedure Check_Consistent_No_Component_Reordering is + OK : Boolean := True; + begin + -- Check that all entries have No_Component_Reordering set + + for A1 in ALIs.First .. ALIs.Last loop + if not Is_Internal_File_Name (ALIs.Table (A1).Sfile) + and then not ALIs.Table (A1).No_Component_Reordering + then + OK := False; + exit; + end if; + end loop; + + -- All do, return + + if OK then + return; + end if; + + -- Here we have an inconsistency + + Consistency_Error_Msg + ("some but not all files compiled with No_Component_Reordering"); + + Write_Eol; + Write_Str ("files compiled with No_Component_Reordering"); + Write_Eol; + + for A1 in ALIs.First .. ALIs.Last loop + if not Is_Internal_File_Name (ALIs.Table (A1).Sfile) + and then ALIs.Table (A1).No_Component_Reordering + then + Write_Str (" "); + Write_Name (ALIs.Table (A1).Sfile); + Write_Eol; + end if; + end loop; + + Write_Eol; + Write_Str ("files compiled without No_Component_Reordering"); + Write_Eol; + + for A1 in ALIs.First .. ALIs.Last loop + if not Is_Internal_File_Name (ALIs.Table (A1).Sfile) + and then not ALIs.Table (A1).No_Component_Reordering + then + Write_Str (" "); + Write_Name (ALIs.Table (A1).Sfile); + Write_Eol; + end if; + end loop; + end Check_Consistent_No_Component_Reordering; + ---------------------------------------- -- Check_Consistent_Normalize_Scalars -- ---------------------------------------- -- cgit v1.1