diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-02 12:32:01 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2004-02-02 12:32:01 +0000 |
commit | 1e16c51c81c146ee5f1cd929c4bdbbe00e70d8c5 (patch) | |
tree | 30150d4eda55a02c6bc00f9262c17b795a63423d /gcc/ada/bcheck.adb | |
parent | 4e090328b4feb4b0227807217cca120441fab2d0 (diff) | |
download | gcc-1e16c51c81c146ee5f1cd929c4bdbbe00e70d8c5.tar.gz |
2004-02-02 Vincent Celier <celier@gnat.com>
* gprcmd.adb (Check_Args): If condition is false, print the invoked
comment before the usage.
Gprcmd: Fail when command is not recognized.
(Usage): Document command "prefix"
* g-md5.adb (Digest): Process last block.
(Update): Do not process last block. Store remaining characters and
length in Context.
* g-md5.ads (Update): Document that several call to update are
equivalent to one call with the concatenated string.
(Context): Add fields to allow new Update behaviour.
* fname-uf.ads/adb (Get_File_Name): New Boolean parameter May_Fail,
defaulted to False.
When May_Fail is True and no existing file can be found, return No_File.
* 6vcstrea.adb: Inlined functions are now wrappers to implementation
functions.
* lib-writ.adb (Write_With_Lines): When body file does not exist, use
spec file name instead on the W line.
2004-02-02 Robert Dewar <dewar@gnat.com>
* ali.adb: Read and acquire info from new format restrictions lines
* bcheck.adb: Add circuits for checking restrictions with parameters
* bindgen.adb: Output dummy restrictions data
To be changed later
* ali.ads, checks.adb, exp_aggr.adb, exp_attr.adb, exp_ch11.adb,
exp_ch3.adb, exp_ch5.adb, exp_ch6.adb, exp_ch7.adb, exp_util.adb,
freeze.adb, gnat1drv.adb, sem_attr.adb, sem_ch10.adb, sem_ch11.adb,
sem_ch12.adb, targparm.adb, targparm.ads, tbuild.adb, sem_ch2.adb,
sem_elab.adb, sem_res.adb: Minor changes for new restrictions handling.
* exp_ch9.adb (Build_Master_Entity): Cleanup the code (also suppresses
the warning message on access to possibly uninitialized variable S)
Minor changes for new restrictions handling.
* gnatbind.adb: Minor reformatting
Minor changes for new restrictions handling
Move circuit for -r processing here from bcheck (cleaner)
* gnatcmd.adb, gnatlink.adb: Minor reformatting
* lib-writ.adb: Output new format restrictions lines
* lib-writ.ads: Document new R format lines for new restrictions
handling.
* s-restri.ads/adb: New files
* Makefile.rtl: Add entry for s-restri.ads/adb
* par-ch3.adb: Fix bad error messages starting with upper case letter
Minor reformatting
* restrict.adb: Major rewrite throughout for new restrictions handling
Major point is to handle restrictions with parameters
* restrict.ads: Major changes in interface to handle restrictions with
parameters. Also generally simplifies setting of restrictions.
* snames.ads/adb: New entry for proper handling of No_Requeue
* sem_ch3.adb (Count_Tasks): New circuitry for implementing Max_Tasks
restriction counting.
Other minor changes for new restrictions handling
* sem_prag.adb: No_Requeue is a synonym for No_Requeue_Statements.
Restriction_Warnings now allows full parameter notation
Major rewrite of Restrictions for new restrictions handling
2004-02-02 Javier Miranda <miranda@gnat.com>
* par-ch3.adb (P_Identifier_Declarations): Give support to the Ada 0Y
syntax rule for object renaming declarations.
(P_Array_Type_Definition): Give support for the Ada 0Y syntax rule for
component definitions.
* sem_ch3.adb (Analyze_Component_Declaration): Give support to access
components.
(Array_Type_Declaration): Give support to access components. In addition
it was also modified to reflect the name of the object in anonymous
array types. The old code did not take into account that it is possible
to have an unconstrained anonymous array with an initial value.
(Check_Or_Process_Discriminants): Allow access discriminant in
non-limited types.
(Process_Discriminants): Allow access discriminant in non-limited types
Initialize the new Access_Definition field in N_Object_Renaming_Decl
node. Change Ada0Y to Ada 0Y in comments
* sem_ch4.adb (Find_Equality_Types): Allow anonymous access types in
equality operators.
Change Ada0Y to Ada 0Y in comments
* sem_ch8.adb (Analyze_Object_Renaming): Give support to access
renamings Change Ada0Y to Ada 0Y in comments
* sem_type.adb (Find_Unique_Type): Give support to the equality
operators for universal access types
Change Ada0Y to Ada 0Y in comments
* sinfo.adb (Access_Definition, Set_Access_Definition): New subprograms
* sinfo.ads (N_Component_Definition): Addition of Access_Definition
field.
(N_Object_Renaming_Declaration): Addition of Access_Definition field
Change Ada0Y to Ada 0Y in comments
* sprint.adb (Sprint_Node_Actual): Give support to the new syntax for
component definition and object renaming nodes
Change Ada0Y to Ada 0Y in comments
2004-02-02 Jose Ruiz <ruiz@act-europe.fr>
* restrict.adb: Use the new restriction identifier
No_Requeue_Statements instead of the old No_Requeue for defining the
restricted profile.
* sem_ch9.adb (Analyze_Requeue): Check the new restriction
No_Requeue_Statements.
* s-rident.ads: Adding restriction No_Requeue_Statements (AI-00249)
that supersedes the GNAT specific restriction No_Requeue. The later is
kept for backward compatibility.
2004-02-02 Ed Schonberg <schonberg@gnat.com>
* lib.ads, i-cobol.ads, * s-stoele.ads, s-thread.ads, style.ads,
5staprop.adb, atree.adb, atree.ads, g-crc32.ads: Remove redundant
pragma and fix incorrect ones.
* sem_prag.adb For pragma Inline and pragma Pure_Function, emit a
warning if the pragma is redundant.
2004-02-02 Thomas Quinot <quinot@act-europe.fr>
* 5staprop.adb: Add missing 'constant' keywords.
* Makefile.in: use consistent value for SYMLIB on
platforms where libaddr2line is supported.
2004-02-02 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* utils.c (end_subprog_body): Do not call rest_of_compilation if just
annotating types.
2004-02-02 Olivier Hainque <hainque@act-europe.fr>
* init.c (__gnat_install_handler): Setup an alternate stack for signal
handlers in the environment thread. This allows proper propagation of
an exception on stack overflows in this thread even when the builtin
ABI stack-checking scheme is used without support for a stack reserve
region.
* utils.c (create_field_decl): Augment the head comment about bitfield
creation, and don't account for DECL_BIT_FIELD in DECL_NONADDRESSABLE_P
here, because the former is not accurate enough at this point.
Let finish_record_type decide instead.
Don't make a bitfield if the field is to be addressable.
Always set a size for the field if the record is packed, to ensure the
checks for bitfield creation are triggered.
(finish_record_type): During last pass over the fields, clear
DECL_BIT_FIELD when possible in the !STRICT_ALIGNMENT case, as this is
not covered by the calls to layout_decl. Adjust DECL_NONADDRESSABLE_P
from DECL_BIT_FIELD.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@77110 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/bcheck.adb')
-rw-r--r-- | gcc/ada/bcheck.adb | 269 |
1 files changed, 128 insertions, 141 deletions
diff --git a/gcc/ada/bcheck.adb b/gcc/ada/bcheck.adb index fd55b9144c7..ff534ba8d13 100644 --- a/gcc/ada/bcheck.adb +++ b/gcc/ada/bcheck.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2003 Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2004 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- -- @@ -51,8 +51,8 @@ package body Bcheck is procedure Check_Consistent_Interrupt_States; procedure Check_Consistent_Locking_Policy; procedure Check_Consistent_Normalize_Scalars; - procedure Check_Consistent_Partition_Restrictions; procedure Check_Consistent_Queuing_Policy; + procedure Check_Consistent_Restrictions; procedure Check_Consistent_Zero_Cost_Exception_Handling; procedure Consistency_Error_Msg (Msg : String); @@ -84,7 +84,7 @@ package body Bcheck is Check_Consistent_Normalize_Scalars; Check_Consistent_Dynamic_Elaboration_Checking; - Check_Consistent_Partition_Restrictions; + Check_Consistent_Restrictions; Check_Consistent_Interrupt_States; end Check_Configuration_Consistency; @@ -362,184 +362,171 @@ package body Bcheck is end if; end Check_Consistent_Normalize_Scalars; - --------------------------------------------- - -- Check_Consistent_Partition_Restrictions -- - --------------------------------------------- - - -- The rule is that if a restriction is specified in any unit, - -- then all units must obey the restriction. The check applies - -- only to restrictions which require partition wide consistency, - -- and not to internal units. - - -- The check is done in two steps. First for every restriction - -- a unit specifying that restriction is found, if any. - -- Second, all units are verified against the specified restrictions. - - procedure Check_Consistent_Partition_Restrictions is - No_Restriction_List : constant array (All_Restrictions) of Boolean := - (No_Implicit_Conditionals => True, - -- This could modify and pessimize generated code - - No_Implicit_Dynamic_Code => True, - -- This could modify and pessimize generated code - - No_Implicit_Loops => True, - -- This could modify and pessimize generated code + ------------------------------------- + -- Check_Consistent_Queuing_Policy -- + ------------------------------------- - No_Recursion => True, - -- Not checkable at compile time + -- The rule is that all files for which the queuing policy is + -- significant must be compiled with the same setting. - No_Reentrancy => True, - -- Not checkable at compile time + procedure Check_Consistent_Queuing_Policy is + begin + -- First search for a unit specifying a policy and then + -- check all remaining units against it. - others => False); - -- Define those restrictions that should be output if the gnatbind -r - -- switch is used. Not all restrictions are output for the reasons given - -- above in the list, and this array is used to test whether the - -- corresponding pragma should be listed. True means that it should not - -- be listed. + Find_Policy : for A1 in ALIs.First .. ALIs.Last loop + if ALIs.Table (A1).Queuing_Policy /= ' ' then + Check_Policy : declare + Policy : constant Character := ALIs.Table (A1).Queuing_Policy; + begin + for A2 in A1 + 1 .. ALIs.Last loop + if ALIs.Table (A2).Queuing_Policy /= ' ' + and then + ALIs.Table (A2).Queuing_Policy /= Policy + then + Error_Msg_Name_1 := ALIs.Table (A1).Sfile; + Error_Msg_Name_2 := ALIs.Table (A2).Sfile; - R : array (All_Restrictions) of ALI_Id := (others => No_ALI_Id); - -- Record the first unit specifying each compilation unit restriction + Consistency_Error_Msg + ("% and % compiled with different queuing policies"); + exit Find_Policy; + end if; + end loop; + end Check_Policy; - V : array (All_Restrictions) of ALI_Id := (others => No_ALI_Id); - -- Record the last unit violating each partition restriction. Note - -- that entries in this array that do not correspond to partition - -- restrictions can never be modified. + exit Find_Policy; + end if; + end loop Find_Policy; + end Check_Consistent_Queuing_Policy; - Additional_Restrictions_Listed : Boolean := False; - -- Set True if we have listed header for restrictions + ----------------------------------- + -- Check_Consistent_Restrictions -- + ----------------------------------- - begin - -- Loop to find restrictions + -- The rule is that if a restriction is specified in any unit, + -- then all units must obey the restriction. The check applies + -- only to restrictions which require partition wide consistency, + -- and not to internal units. - for A in ALIs.First .. ALIs.Last loop - for J in All_Restrictions loop - if R (J) = No_ALI_Id and ALIs.Table (A).Restrictions (J) = 'r' then - R (J) := A; - end if; - end loop; - end loop; + procedure Check_Consistent_Restrictions is + Restriction_File_Output : Boolean; + -- Shows if we have output header messages for restriction violation - -- Loop to find violations + procedure Print_Restriction_File (R : All_Restrictions); + -- Print header line for R if not printed yet - for A in ALIs.First .. ALIs.Last loop - for J in All_Restrictions loop - if ALIs.Table (A).Restrictions (J) = 'v' - and then not Is_Internal_File_Name (ALIs.Table (A).Sfile) - then - -- A violation of a restriction was found + ---------------------------- + -- Print_Restriction_File -- + ---------------------------- - V (J) := A; + procedure Print_Restriction_File (R : All_Restrictions) is + begin + if not Restriction_File_Output then + Restriction_File_Output := True; - -- If this is a paritition restriction, and the restriction - -- was specified in some unit in the partition, then this - -- is a violation of the consistency requirement, so we - -- generate an appropriate error message. + -- Find the ali file specifying the restriction - if R (J) /= No_ALI_Id - and then J in Partition_Restrictions + for A in ALIs.First .. ALIs.Last loop + if ALIs.Table (A).Restrictions.Set (R) + and then (R in All_Boolean_Restrictions + or else ALIs.Table (A).Restrictions.Value (R) = + Cumulative_Restrictions.Value (R)) then + -- We have found that ALI file A specifies the restriction + -- that is being violated (the minimum value is specified + -- in the case of a parameter restriction). + declare - M1 : constant String := "% has Restriction ("; - S : constant String := Restriction_Id'Image (J); - M2 : String (1 .. M1'Length + S'Length + 1); + M1 : constant String := "% has restriction "; + S : constant String := Restriction_Id'Image (R); + M2 : String (1 .. 200); -- big enough! + P : Integer; begin Name_Buffer (1 .. S'Length) := S; Name_Len := S'Length; - Set_Casing - (Units.Table (ALIs.Table (R (J)).First_Unit).Icasing); + Set_Casing (Mixed_Case); M2 (M1'Range) := M1; - M2 (M1'Length + 1 .. M2'Last - 1) := - Name_Buffer (1 .. S'Length); - M2 (M2'Last) := ')'; + P := M1'Length + 1; + M2 (P .. P + S'Length - 1) := Name_Buffer (1 .. S'Length); + P := P + S'Length; + + if R in All_Parameter_Restrictions then + M2 (P .. P + 4) := " => #"; + Error_Msg_Nat_1 := + Int (Cumulative_Restrictions.Value (R)); + P := P + 5; + end if; - Error_Msg_Name_1 := ALIs.Table (R (J)).Sfile; - Consistency_Error_Msg (M2); Error_Msg_Name_1 := ALIs.Table (A).Sfile; + Consistency_Error_Msg (M2 (1 .. P - 1)); Consistency_Error_Msg - ("but file % violates this restriction"); + ("but the following files violate this restriction:"); end; end if; - end if; - end loop; - end loop; + end loop; + end if; + end Print_Restriction_File; - -- List applicable restrictions if option set + -- Start of processing for Check_Consistent_Restrictions - if List_Restrictions then + begin + -- Loop through all restriction violations - -- List any restrictions which were not violated and not specified + for R in All_Restrictions loop - for J in All_Restrictions loop - if V (J) = No_ALI_Id - and then R (J) = No_ALI_Id - and then not No_Restriction_List (J) - then - if not Additional_Restrictions_Listed then - Write_Eol; - Write_Line - ("The following additional restrictions may be" & - " applied to this partition:"); - Additional_Restrictions_Listed := True; - end if; + -- Check for violation of this restriction - Write_Str ("pragma Restrictions ("); + if Cumulative_Restrictions.Set (R) + and then Cumulative_Restrictions.Violated (R) + and then (R in Partition_Boolean_Restrictions + or else (R in All_Parameter_Restrictions + and then + Cumulative_Restrictions.Count (R) > + Cumulative_Restrictions.Value (R))) + then + Restriction_File_Output := False; - declare - S : constant String := Restriction_Id'Image (J); - begin - Name_Len := S'Length; - Name_Buffer (1 .. Name_Len) := S; - end; + -- Loop through files looking for violators - Set_Casing (Mixed_Case); - Write_Str (Name_Buffer (1 .. Name_Len)); - Write_Str (");"); - Write_Eol; - end if; - end loop; - end if; - end Check_Consistent_Partition_Restrictions; + for A2 in ALIs.First .. ALIs.Last loop + if ALIs.Table (A2).Restrictions.Violated (R) then - ------------------------------------- - -- Check_Consistent_Queuing_Policy -- - ------------------------------------- + -- We exclude predefined files from the list of + -- violators. This should be rethought. It is not + -- clear that this is the right thing to do, that + -- is particularly the case for restricted runtimes. - -- The rule is that all files for which the queuing policy is - -- significant must be compiled with the same setting. + if not Is_Internal_File_Name (ALIs.Table (A2).Sfile) then + Print_Restriction_File (R); - procedure Check_Consistent_Queuing_Policy is - begin - -- First search for a unit specifying a policy and then - -- check all remaining units against it. + Error_Msg_Name_1 := ALIs.Table (A2).Sfile; - Find_Policy : for A1 in ALIs.First .. ALIs.Last loop - if ALIs.Table (A1).Queuing_Policy /= ' ' then - Check_Policy : declare - Policy : constant Character := ALIs.Table (A1).Queuing_Policy; - begin - for A2 in A1 + 1 .. ALIs.Last loop - if ALIs.Table (A2).Queuing_Policy /= ' ' - and then - ALIs.Table (A2).Queuing_Policy /= Policy - then - Error_Msg_Name_1 := ALIs.Table (A1).Sfile; - Error_Msg_Name_2 := ALIs.Table (A2).Sfile; + if R in All_Boolean_Restrictions then + Consistency_Error_Msg (" %"); - Consistency_Error_Msg - ("% and % compiled with different queuing policies"); - exit Find_Policy; - end if; - end loop; - end Check_Policy; + elsif R in Checked_Add_Parameter_Restrictions + or else ALIs.Table (A2).Restrictions.Count (R) > + Cumulative_Restrictions.Value (R) + then + Error_Msg_Nat_1 := + Int (ALIs.Table (A2).Restrictions.Count (R)); - exit Find_Policy; + if ALIs.Table (A2).Restrictions.Unknown (R) then + Consistency_Error_Msg + (" % (count = at least #)"); + else + Consistency_Error_Msg + (" % (count = #)"); + end if; + end if; + end if; + end if; + end loop; end if; - end loop Find_Policy; - end Check_Consistent_Queuing_Policy; + end loop; + end Check_Consistent_Restrictions; --------------------------------------------------- -- Check_Consistent_Zero_Cost_Exception_Handling -- |