diff options
author | Yannick Moy <moy@adacore.com> | 2019-12-11 10:21:57 +0100 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2020-05-25 10:00:55 -0400 |
commit | 1a14bfbd78324a25943998ed1e877e41ec4cd417 (patch) | |
tree | d0e872f1ccf8f88f00a3c65d46fc0245941a19e8 /gcc/ada/libgnat | |
parent | 4354291994e6f6cb6eba1acef3192fa5c18b1274 (diff) | |
download | gcc-1a14bfbd78324a25943998ed1e877e41ec4cd417.zip gcc-1a14bfbd78324a25943998ed1e877e41ec4cd417.tar.gz gcc-1a14bfbd78324a25943998ed1e877e41ec4cd417.tar.bz2 |
[Ada] Change pragma Compile_Time_Error to force compile-time evaluation
2020-05-25 Yannick Moy <moy@adacore.com>
gcc/ada/
* doc/gnat_rm/implementation_defined_pragmas.rst: Document
changes to pragmas Compile_Time_Error/Compile_Time_Warning.
* gnat_rm.texi: Regenerate.
* libgnat/g-bytswa.adb: Change uses of Compile_Time_Error to
Compile_Time_Warning, as the actual expression may not always be
known statically.
* sem_prag.adb (Analyze_Pragma): Handle differently pragma
Compile_Time_Error in both compilation and in GNATprove mode.
(Validate_Compile_Time_Warning_Or_Error): Issue an error or
warning when the expression is not known at compile time.
* usage.adb: Add missing documentation for warning switches _c
and _r.
* warnsw.ads: Update comment.
Diffstat (limited to 'gcc/ada/libgnat')
-rw-r--r-- | gcc/ada/libgnat/g-bytswa.adb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/ada/libgnat/g-bytswa.adb b/gcc/ada/libgnat/g-bytswa.adb index e915e58..abcfe77 100644 --- a/gcc/ada/libgnat/g-bytswa.adb +++ b/gcc/ada/libgnat/g-bytswa.adb @@ -45,7 +45,7 @@ package body GNAT.Byte_Swapping is function Swapped2 (Input : Item) return Item is function As_U16 is new Unchecked_Conversion (Item, U16); function As_Item is new Unchecked_Conversion (U16, Item); - pragma Compile_Time_Error (Item'Max_Size_In_Storage_Elements /= 2, + pragma Compile_Time_Warning (Item'Max_Size_In_Storage_Elements /= 2, "storage size must be 2 bytes"); begin return As_Item (Bswap_16 (As_U16 (Input))); @@ -58,7 +58,7 @@ package body GNAT.Byte_Swapping is function Swapped4 (Input : Item) return Item is function As_U32 is new Unchecked_Conversion (Item, U32); function As_Item is new Unchecked_Conversion (U32, Item); - pragma Compile_Time_Error (Item'Max_Size_In_Storage_Elements /= 4, + pragma Compile_Time_Warning (Item'Max_Size_In_Storage_Elements /= 4, "storage size must be 4 bytes"); begin return As_Item (Bswap_32 (As_U32 (Input))); @@ -71,7 +71,7 @@ package body GNAT.Byte_Swapping is function Swapped8 (Input : Item) return Item is function As_U64 is new Unchecked_Conversion (Item, U64); function As_Item is new Unchecked_Conversion (U64, Item); - pragma Compile_Time_Error (Item'Max_Size_In_Storage_Elements /= 8, + pragma Compile_Time_Warning (Item'Max_Size_In_Storage_Elements /= 8, "storage size must be 8 bytes"); begin return As_Item (Bswap_64 (As_U64 (Input))); |