]> git.ipfire.org Git - thirdparty/gcc.git/commit
ada: Accept static strings with External_Initialization
authorRonan Desplanques <desplanques@adacore.com>
Tue, 19 Nov 2024 09:10:31 +0000 (10:10 +0100)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 12 Dec 2024 09:57:58 +0000 (10:57 +0100)
commit003ed7d39343cdfb9dde70980c2aa67454bcacef
tree952b292f2fb6b11a1dad0ab5705b0b44a533b519
parentfac69bd389303362efc0ae6e86fc08f3fe99946a
ada: Accept static strings with External_Initialization

Before this patch, the argument to the External_Initialization aspect
had to be a string literal. This patch extends the possibilities so that
any static string is accepted.

A new helper function, Is_OK_Static_Expression_Of_Type, is introduced,
and in addition to the main change of this patch a couple of calls to
that helper function are added in other places to replace equivalent
inline code.

gcc/ada/ChangeLog:

* sem_eval.ads (Is_OK_Static_Expression_Of_Type): New function.
* sem_eval.adb (Is_OK_Static_Expression_Of_Type): Likewise.
* sem_ch13.adb (Check_Expr_Is_OK_Static_Expression): Use new function.
* sem_prag.adb (Check_Expr_Is_OK_Static_Expression): Likewise.
* sem_ch3.adb (Apply_External_Initialization): Accept static strings
for the parameter.
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_eval.adb
gcc/ada/sem_eval.ads
gcc/ada/sem_prag.adb