aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorSteve Baird <baird@adacore.com>2020-04-03 17:34:38 -0700
committerPierre-Marie de Rodat <derodat@adacore.com>2020-06-16 09:07:15 -0400
commit158b52c9616a3bc0b1c2622e3627a544318fd329 (patch)
tree709b9976644cf03e951725847b9157d209ef0d1b /gcc/c
parent51e2de474edf2be4997862eb878a5abf5b2a323b (diff)
downloadgcc-158b52c9616a3bc0b1c2622e3627a544318fd329.zip
gcc-158b52c9616a3bc0b1c2622e3627a544318fd329.tar.gz
gcc-158b52c9616a3bc0b1c2622e3627a544318fd329.tar.bz2
[Ada] Implement AI12-0249, AI12-0295 (user-defined numeric & string literals)
2020-06-16 Steve Baird <baird@adacore.com> gcc/ada/ * snames.ads-tmpl: Define names of the three new aspects. * aspects.ads: Define the three new aspects. * sem_util.ads, sem_util.adb, sem_dim.adb: Move the function String_From_Numeric_Literal from being declared in the body of package Sem_Dim to being declared in the visible part of package Sem_Util. * sem_ch13.ads, sem_ch13.adb: Declare new visible procedure Validate_Literal_Aspect. This is where most of the legality checking occurs for an aspect specification for one of the three new aspects, as well as resolution of the subprogram named in the aspect specification. Follow example of other aspects (e.g., Validate_Literal_Aspect is called in much the same way as Validate_Iterable_Aspect in Analyze_Aspects_At_Freeze_Point; a small amount of legality checking is performed in Analyze_One_Aspect in much the same way as for Default_Value or Default_Component_Value aspects). Most of the work is done in Validate_Literal_Aspect. * contracts.adb (Add_Contract_Item): Call Validate_Literal_Aspect in much the same way that Validate_Iterable_Aspect was already being called. * sem_res.adb (Resolve): Rewrite a literal as a call if it is a user-defined literal. This is where the dynamic semantics of the 3 new aspects are implemented. * sem_ch6.adb (Fully_Conformant_Expressions): Two numeric literals that have different text but the same value (e.g., 12345 and 12_345) do not conform if they are user-defined literals. Introduce a new function User_Defined_Numeric_Literal_Mismatch to avoid duplication in making this check. * sem_type.adb (Has_Compatible_Type): A numeric literal can be compatible with a non-numeric type (and a string literal can be compatible with a non-string type) if it can be interpreted as a user-defined literal.
Diffstat (limited to 'gcc/c')
0 files changed, 0 insertions, 0 deletions