public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug macros/24291] Incorrect/Partial Macro Expansion
[not found] <bug-24291-4717@http.sourceware.org/bugzilla/>
@ 2021-05-10 14:37 ` tromey at sourceware dot org
2021-05-10 18:32 ` tromey at sourceware dot org
1 sibling, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2021-05-10 14:37 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=24291
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |tromey at sourceware dot org
Last reconfirmed| |2021-05-10
Status|UNCONFIRMED |NEW
Ever confirmed|0 |1
--- Comment #1 from Tom Tromey <tromey at sourceware dot org> ---
Confirmed:
(gdb) macro define IIF(cond) IIF_ ## cond
(gdb) macro define IIF_0(t, f) f
(gdb) macro define IIF_1(t, f) t
(gdb) macro expand IIF(1)(true,false)
expands to: IIF_1(true,false)
Also:
murgatroyd. cat q.c
#define IIF(cond) IIF_ ## cond
#define IIF_0(t, f) f
#define IIF_1(t, f) t
IIF(1)(true,false)
murgatroyd. gcc -E q.c
# 1 "q.c"
# 1 "<built-in>"
# 1 "<command-line>"
# 31 "<command-line>"
# 1 "/usr/include/stdc-predef.h" 1 3 4
# 32 "<command-line>" 2
# 1 "q.c"
true
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug macros/24291] Incorrect/Partial Macro Expansion
[not found] <bug-24291-4717@http.sourceware.org/bugzilla/>
2021-05-10 14:37 ` [Bug macros/24291] Incorrect/Partial Macro Expansion tromey at sourceware dot org
@ 2021-05-10 18:32 ` tromey at sourceware dot org
1 sibling, 0 replies; 2+ messages in thread
From: tromey at sourceware dot org @ 2021-05-10 18:32 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=24291
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
The code in expand does:
shared_macro_buffer substituted_src (substituted.text, substituted.len);
scan (dest, &substituted_src, &new_no_loop, scope);
However this just tries to re-scan "IIF_1" -- it doesn't
concatenate the rest of the un-processed input.
This is why the function-like invocation isn't expanded.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-10 18:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <bug-24291-4717@http.sourceware.org/bugzilla/>
2021-05-10 14:37 ` [Bug macros/24291] Incorrect/Partial Macro Expansion tromey at sourceware dot org
2021-05-10 18:32 ` tromey at sourceware dot org
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).