Bug 2471

Summary: limited functionality of macro __CONCAT()
Product: glibc Reporter: Petr.Salinger
Component: libcAssignee: Ulrich Drepper <drepper.fsp>
Status: RESOLVED WONTFIX    
Severity: normal CC: glibc-bugs
Priority: P2 Flags: fweimer: security-
Version: unspecified   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:
Attachments: proposed patch

Description Petr.Salinger 2006-03-20 21:54:22 UTC
Hi,

current definition of  macro __CONCAT() is limited, it does not allow to pass
__CONCAT()
as direct argument of __CONCAT(). The behaviour can be  shown by "gcc -E in.c" on

#define __CONCAT1(x,y)   x ## y
#define __CONCATN(x,y)   __CONCAT1(x,y)

__CONCAT1(First,__CONCAT1(Second,Third))
__CONCATN(First,__CONCATN(Second,Third))

Result of first test is First__CONCAT1(Second,Third), which is correct
behaviour of preprocessor , because "if an argument is stringified or
concatenated, the prescan does not occur".

But intuitively expected behaviour of __CONCAT()  would be same as result of
second test - FirstSecondThird.

Please, could you allow chaining of __CONCAT() via atached patch ?

Thanks

Petr
Comment 1 Petr.Salinger 2006-03-20 21:55:09 UTC
Created attachment 934 [details]
proposed patch
Comment 2 Ulrich Drepper 2006-04-01 19:16:01 UTC
This macro is traditionally defined this way.  Any change can disrupt existing
code.  There will be no change.