summaryrefslogtreecommitdiff
path: root/gcc/ada/i-c.adb
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-03 15:38:17 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-03 15:38:17 +0000
commit6c0ac121972a1b5706813e7be7934716a7298878 (patch)
treec76f60b2cb9eae7df4e45dfbb276d1ddc8ae71c8 /gcc/ada/i-c.adb
parentccf752cc331381b0a5882041a051081a4adf15a0 (diff)
downloadgcc-6c0ac121972a1b5706813e7be7934716a7298878.tar.gz
* i-c.adb (To_C): Raise CE if string is null and Append_Null
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@92839 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/ada/i-c.adb')
-rw-r--r--gcc/ada/i-c.adb17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/ada/i-c.adb b/gcc/ada/i-c.adb
index 65e40b29710..844f016441e 100644
--- a/gcc/ada/i-c.adb
+++ b/gcc/ada/i-c.adb
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 1992-2001 Free Software Foundation, Inc. --
+-- Copyright (C) 1992-2004 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- --
@@ -289,21 +289,20 @@ package body Interfaces.C is
return R;
end;
- else -- Append_Nul is False
+ -- Append_Nul False
+
+ else
-- A nasty case, if the string is null, we must return
-- a null char_array. The lower bound of this array is
-- required to be zero (RM B.3(50)) but that is of course
- -- impossible given that size_t is unsigned. This needs
- -- ARG resolution, but for now GNAT returns bounds 1 .. 0
+ -- impossible given that size_t is unsigned. According to
+ -- Ada 2005 AI-258, the result is to raise Constraint_Error.
if Item'Length = 0 then
- declare
- R : char_array (1 .. 0);
+ raise Constraint_Error;
- begin
- return R;
- end;
+ -- Normal case
else
declare