* [PATCH] ada: Img attribute cannot take a parameter
@ 2007-11-14 16:16 Samuel Tardieu
0 siblings, 0 replies; only message in thread
From: Samuel Tardieu @ 2007-11-14 16:16 UTC (permalink / raw)
To: gcc-patches
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2007-11-14 14:49 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-14 16:16 [PATCH] ada: Img attribute cannot take a parameter Samuel Tardieu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).