diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2022-06-23 13:09:51 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-07-12 12:24:14 +0000 |
commit | 7e5a0317adbf1c9bc2ee5f6446bd161854c03373 (patch) | |
tree | 404cb9145da0dcfdb13527642d4705480cb8c53d /gcc/ada | |
parent | 3a7a02f4355bb81f7cb253fc900ad57c9503f5c7 (diff) | |
download | gcc-7e5a0317adbf1c9bc2ee5f6446bd161854c03373.zip gcc-7e5a0317adbf1c9bc2ee5f6446bd161854c03373.tar.gz gcc-7e5a0317adbf1c9bc2ee5f6446bd161854c03373.tar.bz2 |
[Ada] Fix confusing error expression on an unknown restriction
When pragma Restriction is used with an unknown restriction identifier,
it is better to not process the restriction expression, as it will
likely produce confusing error message.
In particular, an odd message appeared when there was a typo in the
restriction identifier whose expression requires special processing
(e.g. No_Dependence_On instead of No_Dependence).
gcc/ada/
* sem_prag.adb (Process_Restrictions_Or_Restriction_Warnings):
Do not process expression of unknown restrictions.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sem_prag.adb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index a24d19e..3591040 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -10792,13 +10792,15 @@ package body Sem_Prag is else R_Id := Get_Restriction_Id (Process_Restriction_Synonyms (Arg)); - Analyze_And_Resolve (Expr, Any_Integer); if R_Id not in All_Parameter_Restrictions then Error_Pragma_Arg ("invalid restriction parameter identifier", Arg); + end if; + + Analyze_And_Resolve (Expr, Any_Integer); - elsif not Is_OK_Static_Expression (Expr) then + if not Is_OK_Static_Expression (Expr) then Flag_Non_Static_Expr ("value must be static expression!", Expr); raise Pragma_Exit; |