Issue Details (XML | Word | Printable)

Key: PCC-130
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: Iain Hibbert
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
pcc

cpp does not handle nested varadic macros deep enough

Created: 22/Apr/10 08:30 PM   Updated: 09/Jan/11 04:28 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: NetBSD/i386


 Description  « Hide
The following code example

#define D1(s, ...) s
#define D2(s, ...) s D1(__VA_ARGS__)
#define D3(s, ...) s D2(__VA_ARGS__)
#define D4(s, ...) s D3(__VA_ARGS__)

D1(a)
D2(a, b)
D3(a, b, c)
D4(a, b, c, d)

when compiled, produces "error: expmac noexp=-1" on the line with D3

This preprocessor abuse brought to you by "src/usr.bin/error/input.c"

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Anders Magnusson added a comment - 09/Jan/11 04:28 PM
The macro expansion algorithm is now rewritten so this seems to work.