diff options
author | Bob Duff <duff@adacore.com> | 2021-03-31 08:00:59 -0400 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2021-06-21 06:45:12 -0400 |
commit | 336438b6d225c3a5f28d57fd766e36f53faf8f3e (patch) | |
tree | 4d9c8a37c32c67c6121686a39ed3a053d7b79556 /gcc/cfgexpand.c | |
parent | 7f34e744c0bdb8b3f767463f290a32bc671bfcc8 (diff) | |
download | gcc-336438b6d225c3a5f28d57fd766e36f53faf8f3e.zip gcc-336438b6d225c3a5f28d57fd766e36f53faf8f3e.tar.gz gcc-336438b6d225c3a5f28d57fd766e36f53faf8f3e.tar.bz2 |
[Ada] Implement 'Valid_Value attribute
gcc/ada/
* libgnat/s-valuen.ads, libgnat/s-valuen.adb
(Value_Enumeration_Pos): New function to compute the 'Pos of the
enumeration literal for a given String. Return a special value
instead of raising an exception on invalid input. Called by both
Valid_Enumeration_Image and Value_Enumeration.
(Valid_Enumeration_Image): Return a Boolean indicating whether
the String is a valid Image for the given enumeration type.
(Value_Enumeration): Implement in terms of
Value_Enumeration_Pos.
* libgnat/s-vaenu8.ads, libgnat/s-vaen16.ads,
libgnat/s-vaen32.ads: Rename Valid_Enumeration_Image from the
instances.
* libgnat/s-valuti.ads: Correct documentation (it was not true
for the null string).
* libgnat/s-valuti.adb (Normalize_String): Do not raise
Constraint_Error for the null string, nor strings containing
nothing but blanks, so that Valid_Enumeration_Image can return
False in these cases, rather than raising an exception.
* rtsfind.ads (RE_Value_Enumeration_8, RE_Value_Enumeration_16,
RE_Value_Enumeration_32): New functions.
(RTE_Available): Improve comment (E doesn't have to be a
subprogram, although that's the usual case).
* sem_attr.adb (nalid_Value): Semantic analysis for new
attribute.
* exp_attr.adb: Call Expand_Valid_Value_Attribute for new
attribute.
* exp_imgv.ads, exp_imgv.adb (Expand_Valid_Value_Attribute): New
procedure to expand Valid_Value into a call to
Valid_Enumeration_Image_NN.
(Expand_Value_Attribute): Misc code cleanups. Remove two ???
mark comments. RTE_Available won't work here. For one thing,
RTE_Available (X) shouldn't be called until the compiler has
decided to make use of X (see comments on RTE_Available), and in
this case we're trying to AVOID calling something.
* snames.ads-tmpl: New attribute name.
* doc/gnat_rm/implementation_defined_attributes.rst: Document
new attribute.
* gnat_rm.texi: Regenerate.
Diffstat (limited to 'gcc/cfgexpand.c')
0 files changed, 0 insertions, 0 deletions