Issue Details (XML | Word | Printable)

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

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

cpp: EBLOCK sync error

Created: 16/Sep/11 10:27 AM   Updated: 06/Aug/12 09:34 PM
Component/s: C preprocessor
Affects Version/s: None
Fix Version/s: None

File Attachments: 1. File mesa.c (0.2 kB)

Environment: NetBSD/i386


 Description  « Hide
The following code, reduced from MesaLib code (src/mesa/drivers/dri/r200/r200_swtcl.c)

#define warning(msg, ...) do { \
    dprint((msg), ## __VA_ARGS__); \
} while(0)

#define WARN(fmt, ...) do { \
    warning((fmt), ## __VA_ARGS__); \
} while(0)

static void foo(int d)
{
    WARN("%d\n",
        d);
}

when passed to pcc -E fails with an "EBLOCK sync error"

(the original code was more complex and runs out of macro
space but that may be a secondary issue)

 All   Comments   Change History      Sort Order: Ascending order - Click to sort in descending order
Antoine Leca added a comment - 13/Apr/12 05:43 PM
Anyway cpp does not support the (GCC extension) syntax where in
        , ## __VA_ARGS__ )
the comma is "swallowed" by the ## when __VA_ARGS__ happen to be empty

Ref: http://gcc.gnu.org/onlinedocs/cpp/Variadic-Macros.html

Anders Magnusson added a comment - 29/Jul/12 07:37 PM
This seems to have been resolved sometime during the time being.

Iain Hibbert added a comment - 31/Jul/12 10:04 PM
this still occurs with pcc as of today, on i386 at least.. just to be sure (because I recall it was difficult to pin it down; I think whitespace is significant) I attach the exact code file I am using..

% pcc -E mesa.c
[....]

static void foo(int d)
{
    
mesa.c:13: error: EBLOCK sync error
% pcc --version
pcc 1.1.0.DEVEL 20120731 for netbsd-i386

Anders Magnusson added a comment - 06/Aug/12 09:34 PM
Yetch, it was the newline inside the varargs arg list that was the evil spot. Thanks, fixed now.