diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2019-08-21 08:29:56 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-08-21 08:29:56 +0000 |
commit | 92ef57728eeec64cbe2c83cee3409466e3c98448 (patch) | |
tree | 1d2840945e7053df731fc142f7149d51afd1702d | |
parent | 5c34f30d16b99d7d0898d19193b3890452efa7cf (diff) | |
download | gcc-92ef57728eeec64cbe2c83cee3409466e3c98448.zip gcc-92ef57728eeec64cbe2c83cee3409466e3c98448.tar.gz gcc-92ef57728eeec64cbe2c83cee3409466e3c98448.tar.bz2 |
[Ada] Do not rewrite argument of pragma Entry_Queue_Length in analysis
It was unusual for the analysis phase of compiler to rewrite static
expression of pragma Entry_Queue_Length with its value. This typically
happens when expanding the AST and only if needed for a given backend.
In particular, GNATprove doesn't need such an expansion and actually
needs the unrewritten AST to detect references to constants declared
with SPARK_Mode => Off within a code with SPARK_Mode => On.
This change has no impact on compilation, so no frontend test is
provided.
2019-08-21 Piotr Trojanek <trojanek@adacore.com>
gcc/ada/
* sem_prag.adb (Max_Entry_Queue_Length): Do not substitute
expression of the pragma argument with its value during
analysis.
* sem_util.adb (Get_Max_Queue_Length): Compute value of the
pragma argument when needed.
From-SVN: r274781
-rw-r--r-- | gcc/ada/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 9 | ||||
-rw-r--r-- | gcc/ada/sem_util.adb | 3 |
3 files changed, 10 insertions, 10 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e422ee7..1a2ccbc 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,11 @@ +2019-08-21 Piotr Trojanek <trojanek@adacore.com> + + * sem_prag.adb (Max_Entry_Queue_Length): Do not substitute + expression of the pragma argument with its value during + analysis. + * sem_util.adb (Get_Max_Queue_Length): Compute value of the + pragma argument when needed. + 2019-08-21 Yannick Moy <moy@adacore.com> * checks.adb (Install_Null_Excluding_Check): Do not install diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 4ec8611..5a561ea 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -19599,15 +19599,6 @@ package body Sem_Prag is end if; - -- Manually substitute the expression value of the pragma argument - -- if it's not an integer literal because this is not taken care - -- of automatically elsewhere. - - if Nkind (Arg) /= N_Integer_Literal then - Rewrite (Arg, Make_Integer_Literal (Sloc (Arg), Val)); - Set_Etype (Arg, Etype (Original_Node (Arg))); - end if; - Record_Rep_Item (Entry_Id, N); end Max_Entry_Queue_Length; diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 58b7b08..86ae740 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -9763,7 +9763,8 @@ package body Sem_Util is return Uint_0; end if; - Max := Intval (Expression (First (Pragma_Argument_Associations (Prag)))); + Max := Expr_Value + (Expression (First (Pragma_Argument_Associations (Prag)))); -- Since -1 and 0 are equivalent, return 0 for instances of -1 for -- uniformity. |