summaryrefslogtreecommitdiff
path: root/gcc/ada/gnatvsn.adb
diff options
context:
space:
mode:
authorZack Weinberg <zack@gcc.gnu.org>2002-09-24 03:44:36 +0000
committerZack Weinberg <zack@gcc.gnu.org>2002-09-24 03:44:36 +0000
commitb4f94ac15e97bee365a0c3bc33dcec98fb242c04 (patch)
tree3c1b3d7993c203fbf2075e0733e42db08d5c65e8 /gcc/ada/gnatvsn.adb
parent2e9ac4711ce15b88629a4c47373fb16f55e632fb (diff)
downloadgcc-b4f94ac15e97bee365a0c3bc33dcec98fb242c04.tar.gz
update_version: Do not check in files which are unchanged.
maintainer-scripts: * update_version: Do not check in files which are unchanged. * gcc_release: Only update the version in gcc/version.c. gcc: * version.c (version_string): Now const char[]. * version.h: Update to match. gcc/ada: * Make-lang.in (EXTRA_GNATBIND_OBJS): Add version.o. * Makefile.in (TOOLS_LIBS): Add ../../version.o. * gnatvsn.ads: Gnat_Version_String is now a function. * gnatvsn.adb: New file. When asked for Gnat_Version_String, copy the C version_string into a String and return it. * gnatcmd.adb, gnatkr.adb, gnatlbr.adb, gnatlink.adb, gnatls.adb,gnatmake.adb, gnatprep.adb, gnatpsta.adb: Remove pragma Ident (Gnat_Version_String). If this was the sole use of package Gnatvsn, remove the with statement too. * gnat1drv.adb: Tweak -gnatv output. gcc/f: * Make-lang.in (g77spec.o): Don't depend on f/version.h. (f/parse.o): Depend on version.h not f/version.h. (g77version.o, f/version.o): Delete all references. * com.c (ffecom_init_0): Fix transposed array indices in bsearch test. * g77spec.c: Don't include f/version.h or refer to ffe_version_string. * parse.c: Use version_string, not ffe_version_string. * version.c, version.h: Delete files. libf2c: * libF77/Version.c: Rename junk to __LIBF77_VERSION__. Add external decls for __LIBI77_VERSION__ and __LIBU77_VERSION__. Delete __G77_LIBF77_VERSION__ (g77__fvers__): Print all three __LIB*77_VERSION__ strings, and __VERSION__ if we have it; nothing else. * libI77/Version.c: Provide only __LIBI77_VERSION__ (formerly junk). * libU77/Version.c: Provide only __LIBU77_VERSION__ (formerly junk). From-SVN: r57461
Diffstat (limited to 'gcc/ada/gnatvsn.adb')
-rw-r--r--gcc/ada/gnatvsn.adb82
1 files changed, 82 insertions, 0 deletions
diff --git a/gcc/ada/gnatvsn.adb b/gcc/ada/gnatvsn.adb
new file mode 100644
index 00000000000..2555f7a570c
--- /dev/null
+++ b/gcc/ada/gnatvsn.adb
@@ -0,0 +1,82 @@
+------------------------------------------------------------------------------
+-- --
+-- GNAT COMPILER COMPONENTS --
+-- --
+-- G N A T V S N --
+-- --
+-- B o d y --
+-- --
+-- --
+-- Copyright (C) 2002 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- --
+-- ware Foundation; either version 2, or (at your option) any later ver- --
+-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
+-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
+-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
+-- for more details. You should have received a copy of the GNU General --
+-- Public License distributed with GNAT; see file COPYING. If not, write --
+-- to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, --
+-- MA 02111-1307, USA. --
+-- --
+-- As a special exception, if other files instantiate generics from this --
+-- unit, or you link this unit with other files to produce an executable, --
+-- this unit does not by itself cause the resulting executable to be --
+-- covered by the GNU General Public License. This exception does not --
+-- however invalidate any other reasons why the executable file might be --
+-- covered by the GNU Public License. --
+-- --
+-- GNAT was originally developed by the GNAT team at New York University. --
+-- It is now maintained by Ada Core Technologies Inc (http://www.gnat.com). --
+-- --
+------------------------------------------------------------------------------
+
+package body Gnatvsn is
+
+ -- Import the string constant defined in the (language-independent)
+ -- source file version.c.
+
+ -- The size is a lie; we have no way of writing the truth (the size
+ -- is variable and depends on the actual text of the constant).
+
+ -- FIXME: It should be possible to declare this to be a constant, but
+ -- that is rejected by the compiler ("invalid context for deferred
+ -- constant declaration"). Per Ada95 this constraint only applies to
+ -- deferred constants completed by a full constant declaration, not
+ -- deferred constants completed by a pragma Import.
+
+ Version_String : array (0 .. Ver_Len_Max) of aliased Character;
+ pragma Import (C, Version_String, "version_string");
+
+ -- Convert that string constant to an Ada String and return it.
+ -- This is essentially the same as the To_Ada routine in
+ -- Interfaces.C; that package is not linked into gnat1 so
+ -- we cannot use it.
+
+ function Gnat_Version_String return String
+ is
+ Count : Natural := 0;
+
+ begin
+ loop
+ if Version_String (Count) = Character'First then
+ exit;
+ else
+ Count := Count + 1;
+ end if;
+ end loop;
+
+ declare
+ R : String (1 .. Count);
+
+ begin
+ for J in R'Range loop
+ R (J) := Version_String (J - 1);
+ end loop;
+
+ return R;
+ end;
+ end Gnat_Version_String;
+
+end Gnatvsn;