]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/ada/gnatvsn.adb
Correct a function pre/postcondition [PR102403].
[thirdparty/gcc.git] / gcc / ada / gnatvsn.adb
CommitLineData
b4f94ac1
ZW
1------------------------------------------------------------------------------
2-- --
3-- GNAT COMPILER COMPONENTS --
4-- --
5-- G N A T V S N --
6-- --
7-- B o d y --
8-- --
8d0d46f4 9-- Copyright (C) 1992-2021, Free Software Foundation, Inc. --
b4f94ac1
ZW
10-- --
11-- GNAT is free software; you can redistribute it and/or modify it under --
12-- terms of the GNU General Public License as published by the Free Soft- --
748086b7 13-- ware Foundation; either version 3, or (at your option) any later ver- --
b4f94ac1
ZW
14-- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
15-- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
b740cf28
AC
16-- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License --
17-- for more details. You should have received a copy of the GNU General --
18-- Public License distributed with GNAT; see file COPYING3. If not, go to --
19-- http://www.gnu.org/licenses for a complete copy of the license. --
b4f94ac1
ZW
20-- --
21-- GNAT was originally developed by the GNAT team at New York University. --
fbf5a39b 22-- Extensive contributions were provided by Ada Core Technologies Inc. --
b4f94ac1
ZW
23-- --
24------------------------------------------------------------------------------
25
26package body Gnatvsn is
27
41c8951a
VC
28 ----------------------
29 -- Copyright_Holder --
30 ----------------------
31
32 function Copyright_Holder return String is
33 begin
34 return "Free Software Foundation, Inc.";
35 end Copyright_Holder;
36
33c423c8
AC
37 ------------------------
38 -- Gnat_Free_Software --
39 ------------------------
40
41 function Gnat_Free_Software return String is
42 begin
43 return
44 "This is free software; see the source for copying conditions." &
45 ASCII.LF &
46 "There is NO warranty; not even for MERCHANTABILITY or FITNESS" &
47 " FOR A PARTICULAR PURPOSE.";
48 end Gnat_Free_Software;
49
559d6055 50 type char_array is array (Natural range <>) of aliased Character;
15e6b45c
EB
51 C_Version_String : char_array (0 .. Ver_Len_Max - 1);
52 pragma Import (C, C_Version_String, "gnat_version_string");
53 -- Import the C string defined in the source file version.c using the
54 -- zero-based convention of the C language. The size is not the real
55 -- one, which does not matter since we will check for the nul character.
b4f94ac1 56
fbf5a39b
AC
57 -------------------------
58 -- Gnat_Version_String --
59 -------------------------
b4f94ac1 60
fbf5a39b 61 function Gnat_Version_String return String is
559d6055
EB
62 S : String (1 .. Ver_Len_Max);
63 Pos : Natural := 0;
b4f94ac1
ZW
64 begin
65 loop
15e6b45c 66 exit when C_Version_String (Pos) = ASCII.NUL;
b4f94ac1 67
15e6b45c 68 S (Pos + 1) := C_Version_String (Pos);
559d6055 69 Pos := Pos + 1;
2e333199
AO
70
71 exit when Pos = Ver_Len_Max;
fbf5a39b 72 end loop;
b4f94ac1 73
559d6055 74 return S (1 .. Pos);
b4f94ac1
ZW
75 end Gnat_Version_String;
76
77end Gnatvsn;