public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "_deepfire at feelingofgreen dot ru" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug preprocessor/35301] Function macro nesting depth appears to be uncomfortably limited.
Date: Sat, 23 Feb 2008 11:57:00 -0000	[thread overview]
Message-ID: <20080223115657.26372.qmail@sourceware.org> (raw)
In-Reply-To: <bug-35301-15811@http.gcc.gnu.org/bugzilla/>



------- Comment #2 from _deepfire at feelingofgreen dot ru  2008-02-23 11:56 -------
> I think this is correct CPP behavior.
> it only evaluates one level of _ .

Interesting, reading the CPP manual[1] gives me an impression that there is
at least intent to support nested expansions:

> You might wonder, &#8220;Why mention the prescan, if it makes no difference? And why not skip it and make the preprocessor faster?&#8221; The answer is that the prescan does make a difference in three special cases:
>
>    * Nested calls to a macro.
>
>      We say that nested calls to a macro occur when a macro's argument contains a call to that very macro. For example, if f is a macro that expects one argument, f (f (1)) is a nested pair of calls to f. The desired expansion is  made by expanding f (1) and substituting that into the definition of f. The prescan causes the expected result to happen. Without the prescan, f (1) itself  would be substituted as an argument, and the inner use of f would appear during the main scan as an indirect self-reference and would not be expanded. 

But in my case the nesting is not immediately observable, and therefore
requires further body expansion to detect and apply that strategy.

I wonder what will be the final call of GCC people on that -- will this
use pattern be considered legit-enough to deserve support, or not.

1. http://gcc.gnu.org/onlinedocs/cpp/Argument-Prescan.html#Argument-Prescan


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35301


  parent reply	other threads:[~2008-02-23 11:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-23  3:32 [Bug preprocessor/35301] New: " _deepfire at feelingofgreen dot ru
2008-02-23  3:46 ` [Bug preprocessor/35301] " pinskia at gcc dot gnu dot org
2008-02-23 11:57 ` _deepfire at feelingofgreen dot ru [this message]
2008-02-23 13:48 ` joseph at codesourcery dot com
2008-02-23 14:03 ` neil at gcc dot gnu dot org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080223115657.26372.qmail@sourceware.org \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).