[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Tinycc-devel] tcc stringize patch

From: Harald van Dijk
Subject: Re: [Tinycc-devel] tcc stringize patch
Date: Wed, 9 May 2007 23:05:52 +0200
User-agent: Mutt/1.5.15 (2007-04-06)

On Tue, May 08, 2007 at 02:33:13AM +0200, Harald van Dijk wrote:
> Hi,
> Here's a patch to handle spacing during stringizing

and here's a patch to be applied on top of it. It fixes stringizing in
cases involving macro or macro argument substitutions where the
replacement is empty. If this happens, whitespace before and after the
replacement needs to be combined. An example:

#define MKSTR(x) STR(x)
#define STR(x) #x
#define EMPTY /* nothing */
MKSTR(.EMPTY.)   /* ".."  */
MKSTR(.EMPTY .)  /* ". ." */
MKSTR(. EMPTY.)  /* ". ." */
MKSTR(. EMPTY .) /* ". ." */

With the first patch, the third MKSTR invocation would expand to "..".

It also fixes spacing in concatenated macro arguments.

#define MKSTR(x) STR(x)
#define STR(x) #x
#define CAT(x,y) x##y
MKSTR(CAT(. a,b .)) /* ". ab ." */

With the previous patch, it would expand to ".ab.".

Attachment: tcc-stringize-2.patch
Description: Text document

reply via email to

[Prev in Thread] Current Thread [Next in Thread]