diff options
author | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-20 09:48:00 +0000 |
---|---|---|
committer | charlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-20 09:48:00 +0000 |
commit | 5c9329f44ef22adb94632ff7e4ec5abf78973ca2 (patch) | |
tree | a32a044ee02284902f110d5ffc5f7be3fdb24c39 | |
parent | 81bd1c0d6ca27ba2dd02e7e715e39cc4769f9ecd (diff) | |
download | gcc-5c9329f44ef22adb94632ff7e4ec5abf78973ca2.tar.gz |
2015-10-20 Bob Duff <duff@adacore.com>
* output.adb (Write_Int): Work with negative numbers in order to avoid
negating Int'First and thereby causing overflow.
* sem_util.adb: Minor comment fix.
2015-10-20 Eric Botcazou <ebotcazou@adacore.com>
* make.adb (Check): Skip multilib switches reinstated by the
compiler when doing the comparison with switches passed to
gnatmake.
2015-10-20 Yannick Moy <moy@adacore.com>
* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Return
False for procedures marked No_Return.
* sem_util.ads (Enclosing_Declaration): Improve comment.
* einfo.adb (Is_Completely_Hidden): Remove spurious assertion.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229029 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/ada/ChangeLog | 19 | ||||
-rw-r--r-- | gcc/ada/inline.adb | 6 | ||||
-rw-r--r-- | gcc/ada/make.adb | 7 | ||||
-rw-r--r-- | gcc/ada/output.adb | 29 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 16 | ||||
-rw-r--r-- | gcc/ada/sem_util.ads | 3 |
6 files changed, 63 insertions, 17 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 1ecd52f9131..612864835bc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,22 @@ +2015-10-20 Bob Duff <duff@adacore.com> + + * output.adb (Write_Int): Work with negative numbers in order to avoid + negating Int'First and thereby causing overflow. + * sem_util.adb: Minor comment fix. + +2015-10-20 Eric Botcazou <ebotcazou@adacore.com> + + * make.adb (Check): Skip multilib switches reinstated by the + compiler when doing the comparison with switches passed to + gnatmake. + +2015-10-20 Yannick Moy <moy@adacore.com> + + * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Return + False for procedures marked No_Return. + * sem_util.ads (Enclosing_Declaration): Improve comment. + * einfo.adb (Is_Completely_Hidden): Remove spurious assertion. + 2015-10-20 Thomas Quinot <quinot@adacore.com> * types.ads: Minor reformatting. diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index d68a972a6a7..bb26c4639d8 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -1534,6 +1534,12 @@ package body Inline is elsif In_Package_Visible_Spec (Id) then return False; + -- Do not inline subprograms marked No_Return, possibly used for + -- signaling errors, which GNATprove handles specially. + + elsif No_Return (Id) then + return False; + -- Do not inline subprograms that have a contract on the spec or the -- body. Use the contract(s) instead in GNATprove. diff --git a/gcc/ada/make.adb b/gcc/ada/make.adb index 67e44e0d245..8db25986cc3 100644 --- a/gcc/ada/make.adb +++ b/gcc/ada/make.adb @@ -1720,12 +1720,17 @@ package body Make is for J in 1 .. Last_Argument loop - -- Skip non switches -c, -I and -o switches + -- Skip -c, -I and -o switches, as well as multilib switches + -- reinstated by the compiler according to lang-specs.h. if Arguments (J) (1) = '-' and then Arguments (J) (2) /= 'c' and then Arguments (J) (2) /= 'o' and then Arguments (J) (2) /= 'I' + and then not (Arguments (J)'Length = 5 + and then Arguments (J) (2 .. 5) = "mrtp") + and then not (Arguments (J)'Length = 6 + and then Arguments (J) (2 .. 6) = "fsjlj") then Normalize_Compiler_Switches (Arguments (J).all, diff --git a/gcc/ada/output.adb b/gcc/ada/output.adb index 0a739370ae0..9261519b24b 100644 --- a/gcc/ada/output.adb +++ b/gcc/ada/output.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2013, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2015, 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- -- @@ -350,6 +350,7 @@ package body Output is procedure Write_Char (C : Character) is begin + pragma Assert (Next_Col in Buffer'Range); if Next_Col = Buffer'Length then Write_Eol; end if; @@ -406,17 +407,29 @@ package body Output is --------------- procedure Write_Int (Val : Int) is + -- Type Int has one extra negative number (i.e. two's complement), so we + -- work with negative numbers here. Otherwise, negating Int'First will + -- overflow. + + subtype Nonpositive is Int range Int'First .. 0; + procedure Write_Abs (Val : Nonpositive); + -- Write out the absolute value of Val + + procedure Write_Abs (Val : Nonpositive) is + begin + if Val < -9 then + Write_Abs (Val / 10); -- Recursively write higher digits + end if; + + Write_Char (Character'Val (-(Val rem 10) + Character'Pos ('0'))); + end Write_Abs; + begin if Val < 0 then Write_Char ('-'); - Write_Int (-Val); - + Write_Abs (Val); else - if Val > 9 then - Write_Int (Val / 10); - end if; - - Write_Char (Character'Val ((Val mod 10) + Character'Pos ('0'))); + Write_Abs (-Val); end if; end Write_Int; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index ce64755940d..d7177b85dc9 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -17148,14 +17148,16 @@ package body Sem_Util is then return New_Requires_Transient_Scope (Cloned_Subtype (Typ)); - -- Functions returning tagged types may dispatch on result so their - -- returned value is allocated on the secondary stack, even in the - -- definite case. Is_Tagged_Type includes controlled types and - -- class-wide types. Controlled type temporaries need finalization. + -- Functions returning specific tagged types may dispatch on result, so + -- their returned value is allocated on the secondary stack, even in the + -- definite case. We must treat nondispatching functions the same way, + -- because access-to-function types can point at both, so the calling + -- conventions must be compatible. Is_Tagged_Type includes controlled + -- types and class-wide types. Controlled type temporaries need + -- finalization. + -- ???It's not clear why we need to return noncontrolled types with - -- controlled components on the secondary stack. Also, it's not clear - -- why nonprimitive tagged type functions need the secondary stack, - -- since they can't be called via dispatching. + -- controlled components on the secondary stack. elsif Is_Tagged_Type (Typ) or else Has_Controlled_Component (Typ) then return True; diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 78265764663..543d31f0fb5 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -532,7 +532,8 @@ package Sem_Util is -- Returns the closest ancestor of Typ that is a CPP type. function Enclosing_Declaration (N : Node_Id) return Node_Id; - -- Returns the declaration node enclosing N, if any, or Empty otherwise + -- Returns the declaration node enclosing N (including possibly N itself), + -- if any, or Empty otherwise function Enclosing_Generic_Body (N : Node_Id) return Node_Id; |