Issue Details (XML | Word | Printable)

Key: PCC-199
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: Anders Magnusson
Reporter: andre f.
Votes: 0
Watchers: 0
Operations

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

cpp: syntax error (wrong VA_ARGS expansion)

Created: 03/Dec/10 09:49 AM   Updated: 03/Dec/10 10:13 AM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

Environment: pcc 101201 on OpenBSD 4.7 amd64 compiling OpenBSD 4.6 kernel source (GENERIC kernel config)


 Description  « Hide
pcc 101201 on OpenBSD 4.7 amd64 compiling OpenBSD 4.6 kernel source (GENERIC kernel config)
fails in dev/pci/if_ix.c: line 1156: syntax error

the reduced code fragment triggering the error:
---
struct ixgbe_hw {
int (*init_hw)(struct ixgbe_hw *);
};

#define ixgbe_hw(hw, func, ...) (hw)->func(hw, ##__VA_ARGS__)

void ixgbe_hardware_init()
{
struct ixgbe_hw hw;

ixgbe_hw(&hw, init_hw);
}
---

cpp expands the macro to '(&hw)->init_hw(&hw,)'
wheres gcc does '(&hw)->init_hw(&hw)'


 All   Comments   Change History      Sort Order: Descending order - Click to sort in ascending order
Anders Magnusson added a comment - 03/Dec/10 10:13 AM
This is another coding bug that slipped gcc and is fixed in later versions of the source code.
The 4.6 source code contains coding bugs that do not pass neither gcc nor pcc anymore.