aboutsummaryrefslogtreecommitdiffstats
path: root/bug.adb
diff options
context:
space:
mode:
authorgingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2005-11-22 16:09:10 +0000
committergingold <gingold@b72b5c32-5f01-0410-b925-b5c7b92870f7>2005-11-22 16:09:10 +0000
commit171548c9d708fc13f5b6d3edde30630ee04bd06e (patch)
tree181c2a4f230ec445277ec4ed6a25c73f25aab3e2 /bug.adb
parent20e31a50417e5452dcc5797d27dc1383253e3161 (diff)
downloadghdl-171548c9d708fc13f5b6d3edde30630ee04bd06e.tar.gz
ghdl-171548c9d708fc13f5b6d3edde30630ee04bd06e.tar.bz2
ghdl-171548c9d708fc13f5b6d3edde30630ee04bd06e.zip
more optimizations + bug fixes
Diffstat (limited to 'bug.adb')
-rw-r--r--bug.adb27
1 files changed, 23 insertions, 4 deletions
diff --git a/bug.adb b/bug.adb
index 591e9a4c6..74d8f0715 100644
--- a/bug.adb
+++ b/bug.adb
@@ -30,12 +30,31 @@ package body Bug is
GNAT_Version : constant String (1 .. 31 + 15);
pragma Import (C, GNAT_Version, "__gnat_version");
- function Get_Gnat_Version return String is
+ function Get_Gnat_Version return String
+ is
+ C : Character;
begin
for I in GNAT_Version'Range loop
- if GNAT_Version (I) = ')' then
- return GNAT_Version (1 .. I);
- end if;
+ C := GNAT_Version (I);
+ case C is
+ when ' '
+ | 'A' .. 'Z'
+ | 'a' .. 'z'
+ | '0' .. '9'
+ | ':'
+ | '-'
+ | '.'
+ | '(' =>
+ -- Accept only a few printable characters.
+ -- Underscore is excluded since the next bytes after
+ -- GNAT_Version is Ada_Main_Program_Name, which often starts
+ -- with _ada_.
+ null;
+ when ')' =>
+ return GNAT_Version (1 .. I);
+ when others =>
+ return GNAT_Version (1 .. I - 1);
+ end case;
end loop;
return GNAT_Version;
end Get_Gnat_Version;