This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] ada: Img attribute cannot take a parameter
- From: Samuel Tardieu <sam at rfc1149 dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Wed, 14 Nov 2007 15:44:12 +0100
- Subject: [PATCH] ada: Img attribute cannot take a parameter
- Organisation: RFC1149 (see http://www.rfc1149.net/)
This patch allows a construction such as X'Img (3) to return the third
character of X'Img. Previously, (3) was considered as a parameter by the
parser and swallowed silently.
gcc/ada/
PR ada/17318
* par-ch4.adb (P_Name at Scan_Name_Extension_Apostrophe): Do
not consider a left parenthesis to be the start of attribute
parameters if attribute is 'Img.
Ok for trunk?
---
gcc/ada/par-ch4.adb | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 89f3345..f0abeb3 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -484,9 +484,11 @@ package body Ch4 is
Set_Prefix (Name_Node, Prefix_Node);
Set_Attribute_Name (Name_Node, Attr_Name);
- -- Scan attribute arguments/designator
+ -- Scan attribute arguments/designator. Img attribute does
+ -- not take an argument and may be followed by a left paren
+ -- if a substring is taken.
- if Token = Tok_Left_Paren then
+ if Token = Tok_Left_Paren and then Attr_Name /= Name_Img then
Set_Expressions (Name_Node, New_List);
Scan; -- past left paren
--
1.5.3.5