public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug exp/13206] New: support gcc's typeof
@ 2011-09-20 21:41 dje at google dot com
2012-02-22 15:39 ` [Bug exp/13206] " tromey at redhat dot com
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: dje at google dot com @ 2011-09-20 21:41 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
Bug #: 13206
Summary: support gcc's typeof
Product: gdb
Version: HEAD
Status: NEW
Severity: enhancement
Priority: P2
Component: exp
AssignedTo: unassigned@sourceware.org
ReportedBy: dje@google.com
Classification: Unclassified
IWBN if one could cut-n-paste expressions using typeof and have them Just Work.
Seems like this should be rather easy to implement.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug exp/13206] support gcc's typeof
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
@ 2012-02-22 15:39 ` tromey at redhat dot com
2012-02-22 17:10 ` dje at google dot com
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-02-22 15:39 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at redhat dot com
--- Comment #1 from Tom Tromey <tromey at redhat dot com> 2012-02-22 15:36:58 UTC ---
One wrinkle is that there's no way to tell if the source
was compiled with GNU extensions. So, we can't simply parse
"typeof" as a token. And, even the heuristic of looking up
a symbol named "typeof" may fail if different source files
were compiled with different options.
__typeof__ seems reasonably easy, though there is the question
of whether we'd want a new OP_TYPEOF. If not, it simplifies
parsing, but you could have sizeof($x) != sizeof(typeof($x))
if $x changes between parsing and evaluation.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug exp/13206] support gcc's typeof
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
2012-02-22 15:39 ` [Bug exp/13206] " tromey at redhat dot com
@ 2012-02-22 17:10 ` dje at google dot com
2012-02-22 20:50 ` tromey at redhat dot com
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: dje at google dot com @ 2012-02-22 17:10 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
--- Comment #2 from dje at google dot com 2012-02-22 17:07:22 UTC ---
$typeof?
cut-n-paste won't Just Work, but it could Mostly Work. 1/2 :-)
More seriously, a typeof function (of some kind) coud be generally useful.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug exp/13206] support gcc's typeof
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
2012-02-22 15:39 ` [Bug exp/13206] " tromey at redhat dot com
2012-02-22 17:10 ` dje at google dot com
@ 2012-02-22 20:50 ` tromey at redhat dot com
2012-06-28 15:39 ` tromey at redhat dot com
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-02-22 20:50 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
--- Comment #3 from Tom Tromey <tromey at redhat dot com> 2012-02-22 20:49:53 UTC ---
(In reply to comment #2)
> $typeof?
__typeof__ would work fine for that.
It might be useful in other cases if we could determine whether
or not GNU C was used. (We currently don't differentiate between
versions of C, either, which would also be useful.)
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug exp/13206] support gcc's typeof
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
` (2 preceding siblings ...)
2012-02-22 20:50 ` tromey at redhat dot com
@ 2012-06-28 15:39 ` tromey at redhat dot com
2012-07-19 15:39 ` cvs-commit at gcc dot gnu.org
2012-07-19 15:42 ` tromey at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-06-28 15:39 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at sourceware |tromey at redhat dot com
|dot org |
--- Comment #4 from Tom Tromey <tromey at redhat dot com> 2012-06-28 15:39:23 UTC ---
Working on it.
It seems reasonably hard to do in full generality.
E.g., you have to support it in arguments to function types like:
print (void (*) (typeof (x))) &function
I may not do that but I'll at least handle the more obviously
useful cases.
It seems like decltype can use the same code.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug exp/13206] support gcc's typeof
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
` (3 preceding siblings ...)
2012-06-28 15:39 ` tromey at redhat dot com
@ 2012-07-19 15:39 ` cvs-commit at gcc dot gnu.org
2012-07-19 15:42 ` tromey at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2012-07-19 15:39 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
--- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> 2012-07-19 15:38:48 UTC ---
CVSROOT: /cvs/src
Module name: src
Changes by: tromey@sourceware.org 2012-07-19 15:38:18
Modified files:
gdb : ChangeLog ax-gdb.c breakpoint.c c-exp.y eval.c
expprint.c parse.c std-operator.def varobj.c
gdb/testsuite : ChangeLog
gdb/testsuite/gdb.cp: casts.cc casts.exp
Log message:
PR exp/13206:
* ax-gdb.c (gen_expr) <OP_TYPEOF, OP_DECLTYPE>: New cases.
* breakpoint.c (watchpoint_exp_is_const) <OP_TYPEOF,
OP_DECLTYPE>: New cases.
* c-exp.y (TYPEOF, DECLTYPE): New tokens.
(type_exp): Add new productions.
(ident_tokens): Add __typeof__, typeof, __typeof, __decltype,
and decltype.
* eval.c (evaluate_subexp_standard) <OP_TYPEOF, OP_DECLTYPE>:
New case.
* expprint.c (dump_subexp_body_standard) <OP_TYPEOF,
OP_DECLTYPE>: New case.
* parse.c (operator_length_standard) <OP_TYPEOF, OP_DECLTYPE>:
New case.
* std-operator.def (OP_TYPEOF, OP_DECLTYPE): New constants.
* varobj.c (varobj_create): Handle OP_TYPEOF, OP_DECLTYPE.
gdb/testsuite
* gdb.cp/casts.exp: Add tests for typeof and decltype.
* gdb.cp/casts.cc (decltype): New function.
(main): Use it.
Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.14494&r2=1.14495
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ax-gdb.c.diff?cvsroot=src&r1=1.104&r2=1.105
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/breakpoint.c.diff?cvsroot=src&r1=1.693&r2=1.694
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/c-exp.y.diff?cvsroot=src&r1=1.99&r2=1.100
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/eval.c.diff?cvsroot=src&r1=1.166&r2=1.167
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/expprint.c.diff?cvsroot=src&r1=1.57&r2=1.58
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/parse.c.diff?cvsroot=src&r1=1.124&r2=1.125
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/std-operator.def.diff?cvsroot=src&r1=1.5&r2=1.6
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/varobj.c.diff?cvsroot=src&r1=1.196&r2=1.197
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/ChangeLog.diff?cvsroot=src&r1=1.3297&r2=1.3298
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/casts.cc.diff?cvsroot=src&r1=1.3&r2=1.4
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/testsuite/gdb.cp/casts.exp.diff?cvsroot=src&r1=1.18&r2=1.19
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug exp/13206] support gcc's typeof
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
` (4 preceding siblings ...)
2012-07-19 15:39 ` cvs-commit at gcc dot gnu.org
@ 2012-07-19 15:42 ` tromey at redhat dot com
5 siblings, 0 replies; 7+ messages in thread
From: tromey at redhat dot com @ 2012-07-19 15:42 UTC (permalink / raw)
To: gdb-prs
http://sourceware.org/bugzilla/show_bug.cgi?id=13206
Tom Tromey <tromey at redhat dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
Target Milestone|--- |7.6
--- Comment #6 from Tom Tromey <tromey at redhat dot com> 2012-07-19 15:41:51 UTC ---
Fix checked in.
--
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-07-19 15:42 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-20 21:41 [Bug exp/13206] New: support gcc's typeof dje at google dot com
2012-02-22 15:39 ` [Bug exp/13206] " tromey at redhat dot com
2012-02-22 17:10 ` dje at google dot com
2012-02-22 20:50 ` tromey at redhat dot com
2012-06-28 15:39 ` tromey at redhat dot com
2012-07-19 15:39 ` cvs-commit at gcc dot gnu.org
2012-07-19 15:42 ` tromey at redhat dot com
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).