diff mbox series

gnat: fix lto-type-mismatch between C_Version_String and gnat_version_string [PR115917]

Message ID 20240815171753.1630083-1-arsen@aarsen.me
State New
Headers show
Series gnat: fix lto-type-mismatch between C_Version_String and gnat_version_string [PR115917] | expand

Commit Message

Arsen Arsenović Aug. 15, 2024, 5:17 p.m. UTC
Reg-tested on x86_64-pc-linux-gnu with all languages and yes,rtl,extra
checking.

OK for trunk?

TIA, have a lovely day.
---------- >8 ----------

gcc/ada/ChangeLog:

	PR ada/115917
	* gnatvsn.ads: Add note about the duplication of this value in
	verrsion.c.
	* version.c (VER_LEN_MAX): Define to the same value as
	Gnatvsn.Ver_Len_Max.
	(gnat_version_string): Use VER_LEN_MAX as bound.
---
 gcc/ada/gnatvsn.ads | 3 ++-
 gcc/ada/version.c   | 5 ++++-
 2 files changed, 6 insertions(+), 2 deletions(-)

Comments

Marc Poulhiès Aug. 19, 2024, 8:54 a.m. UTC | #1
Arsen Arsenović <arsen@aarsen.me> writes:

Hello Arsen,

> Reg-tested on x86_64-pc-linux-gnu with all languages and yes,rtl,extra
> checking.
>
> OK for trunk?
>
> TIA, have a lovely day.
> ---------- >8 ----------
>
> gcc/ada/ChangeLog:
>
> 	PR ada/115917
> 	* gnatvsn.ads: Add note about the duplication of this value in
> 	verrsion.c.
    ^^^^^^^^^^
nit: small typo here.

Except for this small typo, the patch looks good, thanks!

Marc
diff mbox series

Patch

diff --git a/gcc/ada/gnatvsn.ads b/gcc/ada/gnatvsn.ads
index 29238362cc04..f2082ece0965 100644
--- a/gcc/ada/gnatvsn.ads
+++ b/gcc/ada/gnatvsn.ads
@@ -83,7 +83,8 @@  package Gnatvsn is
    --  space to store any possible version string value for checks. This
    --  value should never be decreased in the future, but it would be
    --  OK to increase it if absolutely necessary. If it is increased,
-   --  be sure to increase GNAT.Compiler.Version.Ver_Len_Max as well.
+   --  be sure to increase GNAT.Compiler.Version.Ver_Len_Max, and to update
+   --  the VER_LEN_MAX define in version.c as well.
 
    Ver_Prefix : constant String := "GNAT Version: ";
    --  Prefix generated by binder. If it is changed, be sure to change
diff --git a/gcc/ada/version.c b/gcc/ada/version.c
index 5e64edd0b17d..2fa9b8c2c859 100644
--- a/gcc/ada/version.c
+++ b/gcc/ada/version.c
@@ -31,4 +31,7 @@ 
 
 #include "version.h"
 
-char gnat_version_string[] = version_string;
+/* Logically a reference to Gnatvsn.Ver_Len_Max.  Please keep in sync.  */
+#define VER_LEN_MAX 256
+
+char gnat_version_string[VER_LEN_MAX] = version_string;