This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug macros/9748] macros containing __extension__ won't run


------- Additional Comments From pedro at codesourcery dot com  2009-01-15 23:39 -------
Subject: Re:  macros containing __extension__ won't run

On Thursday 15 January 2009 21:40:25, drow at false dot org wrote:

> Also on statement expressions, which is what the __extension__ marker
> is for in the first place :-)

IIRC, the __extensions__ marker is for enabling
gnu-C-isms no matter the C dialect or e.g., if -pedantic is selected,
so it's for more things, but, yeah, missed that.  :-)

> I don't think statement expressions are likely to be implemented in
> GDB.  It currently has only a C expression parser, with no support for
> statements etc.

Stating the obvious, you can override the checked versions
in gdb expressions with:

 (gdb) macro define TREE_CHECK(T, CODE) (T)

If wanting to retain the checking ability when called from gdb,
perhaps the best would be to still override the whole TREE_CHECK macro
with macro define, retaining close enough semantics.  Say, add
something like this and similars to gcc:

 const_tree
 gdb_tree_check (const_tree __t, int code)
 {
   if (TREE_CODE (__t) != code)
     tree_check_failed (__t, "<gdb>", 0, "<nofunction>", code); // or call some other variant
   return __t;
 }

And this in .gdbinit:

 macro define TREE_CHECK(T, CODE) gdb_tree_check(T, CODE)



-- 


http://sourceware.org/bugzilla/show_bug.cgi?id=9748

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]