Bug 2471 - limited functionality of macro __CONCAT()
Summary: limited functionality of macro __CONCAT()
Status: RESOLVED WONTFIX
Alias: None
Product: glibc
Classification: Unclassified
Component: libc (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-20 21:54 IST by Petr.Salinger
Modified: 2006-04-01 19:16 IST (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments
proposed patch (330 bytes, patch)
2006-03-20 21:55 IST, Petr.Salinger
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Petr.Salinger 2006-03-20 21:54:22 IST
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 IST
Created attachment 934 [details]
proposed patch
Comment 2 Ulrich Drepper 2006-04-01 19:16:01 IST
This macro is traditionally defined this way.  Any change can disrupt existing
code.  There will be no change.