Patchwork [Ada] Minor change to version string support

login
register
mail settings
Submitter Arnaud Charlet
Date Sept. 10, 2010, 10:13 a.m.
Message ID <20100910101344.GA696@adacore.com>
Download mbox | patch
Permalink /patch/64368/
State New
Headers show

Comments

Arnaud Charlet - Sept. 10, 2010, 10:13 a.m.
This is a small internal change to factor out the prefix of the version string
generated by the binder and make it more explicit that it is cross-referenced
in the runtime unit GNAT.Compiler_Version.

No functional change.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-09-10  Eric Botcazou  <ebotcazou@adacore.com>

	* gnatvsn.ads (Ver_Prefix): New constant string.
	* bindgen.adb (Gen_Output_File_Ada): Use it in lieu of hardcoded value.
	(Gen_Output_File_C): Likewise.
	* g-comver.adb (Ver_Prefix): Add cross-reference to Gnatvsn.Ver_Prefix
	in comment.
Richard Guenther - Sept. 10, 2010, 10:27 a.m.
On Fri, Sep 10, 2010 at 12:13 PM, Arnaud Charlet <charlet@adacore.com> wrote:
> This is a small internal change to factor out the prefix of the version string
> generated by the binder and make it more explicit that it is cross-referenced
> in the runtime unit GNAT.Compiler_Version.
>
> No functional change.
>
> Tested on x86_64-pc-linux-gnu, committed on trunk

One of your patch yesterday broke bootstrap with Ada enabled on at
least x86_64-linux.  I now get

make[3]: Entering directory `/home/abuild/rguenther/obj/gcc/ada/tools'
../../gnatmake -c -b -I../rts -I. -I/space/rguenther/src/svn/trunk/gcc/ada \
          --GNATBIND="../../gnatbind" --GCC="../../xgcc -B../../ -g
-O2  -gnatpg -gnata" \
          gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind gnatname \
          gnatclean -bargs -I../rts -I.
-I/space/rguenther/src/svn/trunk/gcc/ada -static -x
../../xgcc -c -I./ -I../rts -I.
-I/space/rguenther/src/svn/trunk/gcc/ada -B../../ -g -O2 -gnatpg
-gnata -I- /home/space/rguenther/src/svn/trunk/gcc/ada/gnatchop.adb
../../gnatbind -I../rts -I. -I/space/rguenther/src/svn/trunk/gcc/ada
-I../rts -I. -I/space/rguenther/src/svn/trunk/gcc/ada -static -x -x
gnatchop.ali
../../xgcc -c -I./ -I../rts -I.
-I/space/rguenther/src/svn/trunk/gcc/ada -B../../ -g -O2 -gnatpg
-gnata -I- /home/space/rguenther/src/svn/trunk/gcc/ada/gnatcmd.adb
gnatcmd.adb:50:06: file "vms_cmds.ads" not found
gnatcmd.adb:50:06: "Gnatcmd (body)" depends on "Vms_Conv (spec)"
gnatcmd.adb:50:06: "Vms_Conv (spec)" depends on "Vms_Cmds (spec)"
gnatmake: "/home/space/rguenther/src/svn/trunk/gcc/ada/gnatcmd.adb"
compilation error
make[3]: *** [common-tools] Error 4
make[3]: Leaving directory `/home/abuild/rguenther/obj/gcc/ada/tools'
make[2]: *** [gnattools-native] Error 2
make[2]: Leaving directory `/home/abuild/rguenther/obj/gnattools'
make[1]: *** [all-gnattools] Error 2
make[1]: Leaving directory `/home/abuild/rguenther/obj'
make: *** [all] Error 2

Richard.

> 2010-09-10  Eric Botcazou  <ebotcazou@adacore.com>
>
>        * gnatvsn.ads (Ver_Prefix): New constant string.
>        * bindgen.adb (Gen_Output_File_Ada): Use it in lieu of hardcoded value.
>        (Gen_Output_File_C): Likewise.
>        * g-comver.adb (Ver_Prefix): Add cross-reference to Gnatvsn.Ver_Prefix
>        in comment.
>
>
Arnaud Charlet - Sept. 10, 2010, 10:41 a.m.
> make[3]: Entering directory
> `/home/abuild/rguenther/obj/gcc/ada/tools'
> ../../gnatmake -c -b -I../rts -I.
> -I/space/rguenther/src/svn/trunk/gcc/ada \
>           --GNATBIND="../../gnatbind" --GCC="../../xgcc -B../../ -g
> -O2  -gnatpg -gnata" \
>           gnatchop gnatcmd gnatkr gnatls gnatprep gnatxref gnatfind
>           gnatname \
>           gnatclean -bargs -I../rts -I.
> -I/space/rguenther/src/svn/trunk/gcc/ada -static -x
> ../../xgcc -c -I./ -I../rts -I.
> -I/space/rguenther/src/svn/trunk/gcc/ada -B../../ -g -O2 -gnatpg
> -gnata -I-
> /home/space/rguenther/src/svn/trunk/gcc/ada/gnatchop.adb
> ../../gnatbind -I../rts -I.
> -I/space/rguenther/src/svn/trunk/gcc/ada
> -I../rts -I. -I/space/rguenther/src/svn/trunk/gcc/ada -static -x -x
> gnatchop.ali
> ../../xgcc -c -I./ -I../rts -I.
> -I/space/rguenther/src/svn/trunk/gcc/ada -B../../ -g -O2 -gnatpg
> -gnata -I- /home/space/rguenther/src/svn/trunk/gcc/ada/gnatcmd.adb
> gnatcmd.adb:50:06: file "vms_cmds.ads" not found
> gnatcmd.adb:50:06: "Gnatcmd (body)" depends on "Vms_Conv (spec)"
> gnatcmd.adb:50:06: "Vms_Conv (spec)" depends on "Vms_Cmds (spec)"

I indeed forgot to do an svn add on this new file apparently, sorry about that.
Now fixed.

Patch

Index: bindgen.adb
===================================================================
--- bindgen.adb	(revision 164149)
+++ bindgen.adb	(working copy)
@@ -2341,7 +2341,7 @@  package body Bindgen is
 
          WBI ("");
          WBI ("   GNAT_Version : constant String :=");
-         WBI ("                    ""GNAT Version: " &
+         WBI ("                    """ & Ver_Prefix &
                                    Gnat_Version_String &
                                    """ & ASCII.NUL;");
          WBI ("   pragma Export (C, GNAT_Version, ""__gnat_version"");");
@@ -2750,7 +2750,7 @@  package body Bindgen is
 
       if Bind_Main_Program then
          WBI ("");
-         WBI ("char __gnat_version[] = ""GNAT Version: " &
+         WBI ("char __gnat_version[] = """ & Ver_Prefix &
                                    Gnat_Version_String & """;");
 
          Set_String ("char __gnat_ada_main_program_name[] = """);
Index: g-comver.adb
===================================================================
--- g-comver.adb	(revision 164149)
+++ g-comver.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2002-2008, AdaCore                     --
+--                     Copyright (C) 2002-2010, AdaCore                     --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -42,7 +42,8 @@  package body GNAT.Compiler_Version is
    --  import this directly since run-time units cannot WITH compiler units.
 
    Ver_Prefix : constant String := "GNAT Version: ";
-   --  Prefix generated by binder
+   --  This is logically a reference to Gnatvsn.Ver_Prefix but we cannot
+   --  import this directly since run-time units cannot WITH compiler units.
 
    GNAT_Version : constant String (1 .. Ver_Len_Max + Ver_Prefix'Length);
    pragma Import (C, GNAT_Version, "__gnat_version");
Index: gnatvsn.ads
===================================================================
--- gnatvsn.ads	(revision 164149)
+++ gnatvsn.ads	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 S p e c                                  --
 --                                                                          --
---          Copyright (C) 1992-2010 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2010, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -77,6 +77,10 @@  package Gnatvsn is
    --  value should never be decreased in the future, but it would be
    --  OK to increase it if absolutely necessary.
 
+   Ver_Prefix : constant String := "GNAT Version: ";
+   --  Prefix generated by binder. If it is changed, be sure to change
+   --  GNAT.Compiler_Version.Ver_Prefix as well.
+
    Library_Version : constant String := "4.6";
    --  Library version. This value must be updated whenever any change to the
    --  compiler affects the library formats in such a way as to obsolete