From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26453 invoked by alias); 23 Feb 2008 11:57:40 -0000 Received: (qmail 26373 invoked by uid 48); 23 Feb 2008 11:56:57 -0000 Date: Sat, 23 Feb 2008 11:57:00 -0000 Message-ID: <20080223115657.26372.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug preprocessor/35301] Function macro nesting depth appears to be uncomfortably limited. In-Reply-To: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "_deepfire at feelingofgreen dot ru" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2008-02/txt/msg02409.txt.bz2 ------- 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, “Why mention the prescan, if it makes no difference? And why not skip it and make the preprocessor faster?” 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