From 2fe2920e2dcfed7940e33b7b426a5035189ac04e Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Tue, 6 Nov 2012 10:49:23 +0100 Subject: [PATCH] [multiple changes] 2012-11-06 Robert Dewar * exp_prag.adb, impunit.adb, exp_ch9.adb, par-ch4.adb, s-tarest.adb: Minor reformatting. 2012-11-06 Tristan Gingold * s-tposen.ads: Minor comment update. 2012-11-06 Arnaud Charlet * sysdep.c: Rename sig* wrappers to use unique names. 2012-11-06 Yannick Moy * exp_dbug.adb (Qualify_Entity_Name): Mark entity as having a qualified name after being treated, in formal verification mode. 2012-11-06 Fedor Rybin * gnat_ugn.texi: Updating gnattest section to reflect changes in default behaviour of the tool. From-SVN: r193215 --- gcc/ada/ChangeLog | 23 +++++++++++++++++++++++ gcc/ada/exp_ch9.adb | 2 ++ gcc/ada/exp_dbug.adb | 14 ++++++++------ gcc/ada/exp_prag.adb | 26 +++++++++++++------------- gcc/ada/gnat_ugn.texi | 32 ++++++++++++++++++++++++++------ gcc/ada/impunit.adb | 13 ++++++++----- gcc/ada/par-ch4.adb | 11 ++++++----- gcc/ada/s-tarest.adb | 9 +++++---- gcc/ada/s-tposen.ads | 1 - gcc/ada/sysdep.c | 32 ++++++++++---------------------- 10 files changed, 101 insertions(+), 62 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 3d1ba27..e2b1c7e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,26 @@ +2012-11-06 Robert Dewar + + * exp_prag.adb, impunit.adb, exp_ch9.adb, par-ch4.adb, + s-tarest.adb: Minor reformatting. + +2012-11-06 Tristan Gingold + + * s-tposen.ads: Minor comment update. + +2012-11-06 Arnaud Charlet + + * sysdep.c: Rename sig* wrappers to use unique names. + +2012-11-06 Yannick Moy + + * exp_dbug.adb (Qualify_Entity_Name): Mark entity as having a qualified + name after being treated, in formal verification mode. + +2012-11-06 Fedor Rybin + + * gnat_ugn.texi: Updating gnattest section to reflect changes + in default behaviour of the tool. + 2012-11-06 Thomas Quinot * s-oscons-tmplt.c: Interfaces.C now needs to be WITH'd even diff --git a/gcc/ada/exp_ch9.adb b/gcc/ada/exp_ch9.adb index f148e81..781de86 100644 --- a/gcc/ada/exp_ch9.adb +++ b/gcc/ada/exp_ch9.adb @@ -14021,6 +14021,7 @@ package body Exp_Ch9 is declare Create_RE : RE_Id; + begin if Restricted_Profile then if Partition_Elaboration_Policy = 'S' then @@ -14031,6 +14032,7 @@ package body Exp_Ch9 is else Create_RE := RE_Create_Task; end if; + Name := New_Reference_To (RTE (Create_RE), Loc); end; diff --git a/gcc/ada/exp_dbug.adb b/gcc/ada/exp_dbug.adb index 9267982..c034fe5 100644 --- a/gcc/ada/exp_dbug.adb +++ b/gcc/ada/exp_dbug.adb @@ -1307,12 +1307,13 @@ package body Exp_Dbug is if Has_Qualified_Name (Ent) then return; - -- In formal verification mode, simply append a suffix for homonyms, but - -- do not mark the name as being qualified. We used to qualify entity - -- names as full expansion does, but this was removed as this prevents - -- the verification back-end from using a short name for debugging and - -- user interaction. The verification back-end already takes care of - -- qualifying names when needed. + -- In formal verification mode, simply append a suffix for homonyms. + -- We used to qualify entity names as full expansion does, but this was + -- removed as this prevents the verification back-end from using a short + -- name for debugging and user interaction. The verification back-end + -- already takes care of qualifying names when needed. Still mark the + -- name as being qualified, as Qualify_Entity_Name may be called more + -- than once on the same entity. elsif Alfa_Mode then if Has_Homonym (Ent) then @@ -1322,6 +1323,7 @@ package body Exp_Dbug is Set_Chars (Ent, Name_Enter); end if; + Set_Has_Qualified_Name (Ent); return; -- If the entity is a variable encoding the debug name for an object diff --git a/gcc/ada/exp_prag.adb b/gcc/ada/exp_prag.adb index ae743c3..5ce2aa1 100644 --- a/gcc/ada/exp_prag.adb +++ b/gcc/ada/exp_prag.adb @@ -819,20 +819,20 @@ package body Exp_Prag is -- Old_1 : ; -- Old_2 : ; -- Flag : Boolean := False; - -- + -- for | while ... loop -- - -- + -- pragma Assert (); - -- + -- if Flag then -- Old_1 := Curr_1; -- Old_2 := Curr_2; -- end if; - -- + -- Curr_1 := ; -- Curr_2 := ; - -- + -- if Flag then -- if Curr_1 /= Old_1 then -- pragma Assert (Curr_1 > Old_1); @@ -842,7 +842,7 @@ package body Exp_Prag is -- else -- Flag := True; -- end if; - -- + -- -- end loop; @@ -886,7 +886,8 @@ package body Exp_Prag is Make_Op_Gt (Loc, Left_Opnd => Curr_Val, Right_Opnd => Old_Val); - else + + else pragma Assert (Chars (Arg) = Name_Decreases); return Make_Op_Lt (Loc, Left_Opnd => Curr_Val, @@ -956,13 +957,11 @@ package body Exp_Prag is Object_Definition => New_Reference_To (Etype (Expr), Loop_Loc))); - -- Restore the original scope after all temporaries have been - -- analyzed. + -- Restore original scope after all temporaries have been analyzed Pop_Scope; - -- Step 3: Store the value of the expression from the previous - -- iteration. + -- Step 3: Store value of the expression from the previous iteration if No (Old_Assign) then Old_Assign := New_List; @@ -990,8 +989,7 @@ package body Exp_Prag is Name => New_Reference_To (Curr_Id, Loc), Expression => Relocate_Node (Expr))); - -- Step 5: Create the corresponding assertion to verify the change of - -- value. + -- Step 5: Create corresponding assertion to verify change of value -- Generate: -- pragma Assert (Curr <|> Old); @@ -1137,6 +1135,8 @@ package body Exp_Prag is Expression => New_Reference_To (Standard_True, Loc))))); end if; + -- Need a comment on this final rewrite ??? + Rewrite (N, Make_Null_Statement (Loc)); Analyze (N); end Expand_Pragma_Loop_Assertion; diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index 2455b88..330b818 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -18348,6 +18348,22 @@ specifies the directory that will hold the harness packages and project file for the test driver. If the @var{dirname} is a relative path, it is considered relative to the object directory of the project file. +@item --separates +@cindex @option{--separates} (@command{gnattest}) +Bodies of all test routines are generated as separates. This option is +temporarily provided for compatibility to support the old way of generating test +skeletons. Its usage is not recommended because at some point the option will be +abandoned together with this way of generating test packages. + + +@item --transition +@cindex @option{--transition} (@command{gnattest}) +This allows transition from separate test routines to monolith test packages. +All matching test routines are overwritten with contents of corresponding +separates. Note that if separate test routines had any manually added with +clauses they will be moved to the test package body as is and have to be moved +by hand. + @end table @option{--tests_root}, @option{--subdir} and @option{--tests-dir} switches are @@ -18432,8 +18448,11 @@ is located in: For each package containing visible subprograms, a child test package is generated. It contains one test routine per tested subprogram. Each declaration of a test subprogram has a comment specifying which tested -subprogram it corresponds to. All of the test routines have separate bodies. -The test routine located at simple-test_data-tests-test_inc_5eaee3.adb contains +subprogram it corresponds to. Bodies of test routines are placed in test package +bodies and are surrounded by special comment sections. Those comment sections +should not be removed or modified in order for gnattest to be able to regenerate +test packages and keep already written tests in place. +The test routine Test_Inc_5eaee3 located at simple-test_data-tests.adb contains a single statement: a call to procedure Assert. It has two arguments: the Boolean expression we want to check and the diagnosis message to display if the condition is false. @@ -18469,8 +18488,9 @@ values can be set by Set_Up routine and used in test routines afterwards. Bodies of test routines and test_data packages are never overridden after they have been created once. As long as the name of the subprogram, full expanded Ada -names, and the order of its parameters is the same, the old test routine will -fit in its place and no test skeleton will be generated for the subprogram. +names, and the order of its parameters is the same, and comment sections are +intact the old test routine will fit in its place and no test skeleton will be +generated for the subprogram. This can be demonstrated with the previous example. By uncommenting declaration and body of function Dec in simple.ads and simple.adb, running @@ -18487,7 +18507,7 @@ the old test is not replaced with a stub, nor is it lost, but a new test skeleton is created for function Dec. The only way of regenerating tests skeletons is to remove the previously created -tests. +tests together with corresponding comment sections. @node Default Test Behavior @section Default Test Behavior @@ -18615,7 +18635,7 @@ Gnattest has a special option to run overridden parent tests against objects of the type which have overriding primitives: @smallexample -gnattest --harness-dir=driver --liskov -Ptagged_rec.gpr +gnattest --harness-dir=driver --validate-type-extensions -Ptagged_rec.gpr cd driver gprbuild -Ptest_driver test_runner diff --git a/gcc/ada/impunit.adb b/gcc/ada/impunit.adb index ad4902a..efeb896 100644 --- a/gcc/ada/impunit.adb +++ b/gcc/ada/impunit.adb @@ -663,11 +663,14 @@ package body Impunit is return Not_Predefined_Unit; end if; - -- Not predefined if file name does not end in .ads or .adb. This can - -- happen when non-standard file names are being used. Calling this - -- function on a .adb file is used in GNATprove to detect when a - -- construct comes from an instance of a generic defined in a predefined - -- unit. + -- To be considered predefined, the file name must end in .ads or .adb. + -- File names with other extensions (coming from the use of non-standard + -- file naming schemes) can never be predefined. + + -- Note that in the context of a compiler, the .adb case will never + -- arise. However it can arise for other tools, e.g. gnatprove uses + -- this routine to detect when a construct comes from an instance of + -- a generic defined in a predefined unit. if Name_Buffer (Name_Len - 3 .. Name_Len) /= ".ads" and then diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb index c3a7a4a..3cb6579 100644 --- a/gcc/ada/par-ch4.adb +++ b/gcc/ada/par-ch4.adb @@ -2359,11 +2359,14 @@ package body Ch4 is -- Error recovery: can raise Error_Resync function P_Primary return Node_Id is - Lparen : constant Boolean := Prev_Token = Tok_Left_Paren; - Scan_State : Saved_Scan_State; Node1 : Node_Id; + Lparen : constant Boolean := Prev_Token = Tok_Left_Paren; + -- Remember if previous token is a left parenthesis. This is used to + -- deal with checking whether IF/CASE/FOR expressions appearing as + -- primaries require extra parenthesization. + begin -- The loop runs more than once only if misplaced pragmas are found -- or if a misplaced unary minus is skipped. @@ -2537,7 +2540,6 @@ package body Ch4 is -- For [all | some] indicates a quantified expression when Tok_For => - if Token_Is_At_Start_Of_Line then Error_Msg_AP ("misplaced loop"); return Error; @@ -2553,10 +2555,9 @@ package body Ch4 is return Node1; - else - -- Otherwise treat as misused identifier + else return P_Identifier; end if; diff --git a/gcc/ada/s-tarest.adb b/gcc/ada/s-tarest.adb index ec94313..e2a75e0 100644 --- a/gcc/ada/s-tarest.adb +++ b/gcc/ada/s-tarest.adb @@ -618,11 +618,12 @@ package body System.Tasking.Restricted.Stages is Elaborated : Access_Boolean; Chain : in out Activation_Chain; Task_Image : String; - Created_Task : Task_Id) is + Created_Task : Task_Id) + is begin - Create_Restricted_Task (Priority, Stack_Address, Size, Task_Info, - CPU, State, Discriminants, Elaborated, - Task_Image, Created_Task); + Create_Restricted_Task + (Priority, Stack_Address, Size, Task_Info, CPU, State, + Discriminants, Elaborated, Task_Image, Created_Task); -- Append this task to the activation chain diff --git a/gcc/ada/s-tposen.ads b/gcc/ada/s-tposen.ads index 8c07cfd..58c6d6d 100644 --- a/gcc/ada/s-tposen.ads +++ b/gcc/ada/s-tposen.ads @@ -163,7 +163,6 @@ package System.Tasking.Protected_Objects.Single_Entry is -- procedure _clean is -- begin -- service_entry (_object._object'unchecked_access); - -- unlock_entry (_object._object'unchecked_access); -- return; -- end _clean; -- begin diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 62a96dd..a2c4d86 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -933,47 +933,35 @@ __gnat_is_file_not_found_error (int errno_val) { /* Provide extern symbols for sig* as needed by the tasking run-time, instead of static inline functions. */ -#define sigismember android_sigismember -#define sigaddset android_sigaddset -#define sigdelset android_sigdelset -#define sigemptyset android_sigemptyset -#define sigfillset android_sigfillset - #include -#undef sigismember -#undef sigaddset -#undef sigdelset -#undef sigemptyset -#undef sigfillset - int -sigismember (sigset_t *set, int signum) +_sigismember (sigset_t *set, int signum) { - return android_sigismember (set, signum); + return sigismember (set, signum); } int -sigaddset (sigset_t *set, int signum) +_sigaddset (sigset_t *set, int signum) { - return android_sigaddset (set, signum); + return sigaddset (set, signum); } int -sigdelset (sigset_t *set, int signum) +_sigdelset (sigset_t *set, int signum) { - return android_sigdelset (set, signum); + return sigdelset (set, signum); } int -sigemptyset (sigset_t *set) +_sigemptyset (sigset_t *set) { - return android_sigemptyset (set); + return sigemptyset (set); } int -sigfillset(sigset_t *set) +_sigfillset(sigset_t *set) { - return android_sigfillset (set); + return sigfillset (set); } #endif -- 2.7.4