Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2008-09-24
16:53 • Closed ticket [2124814fff]: Compilation of tclOOMethod.c fails for MSVC 6.0 comp... artifact: de669ed143 user: dkf
2008-09-23
16:00 • New ticket [2124814fff]. artifact: 5ca5745fb4 user: flatworm

Compilation of tclOOMethod.c fails for MSVC 6.0 compiler

Closed / Fixed2124814fffffffffffffffffffffffffffffffffCreated 18 years agoUpdated 18 years ago
Descriptionplain2008-09-23 16:00:45
Compilation of tclOOMethod.c fails for MSVC 6.0 compiler with this error:

tclOOMethod.c ..\generic\tclOOMethod.c(24) : error C2010: '.' : unexpected in macro formal parameter list
..\generic\tclOOMethod.c(24) : error C2010: '.' : unexpected in macro formal parameter list
..\generic\tclOOMethod.c(24) : error C2010: '.' : unexpected in macro formal parameter list
..\generic\tclOOMethod.c(24) : error C2010: ')' : unexpected in macro formal parameter list

The culprit is the debugging code:

#if 0
#define DBPRINT(format, ...) (fprintf(stderr, "DEBUG:" format "\n", __VA_ARGS__))
#else
#define DBPRINT(format, ...) ((void) 0)
#endif

This particular compiler seem to doesn't understand "..." in macro definitions, and I'm sure if it's not gcc'ism, it can be at least C99'ism or so.

Changing 
#define DBPRINT(format, ...) ((void) 0)
to
#define DBPRINT(format, X) ((void) 0)
solved the problem.

I would propose using the "standard" technique:
if 0
#define DBPRINT(X) printf##X
#else
#define DBPRINT(X) do {} while(0)
#endif
...
DBPRINTF(("foo is %d\n", Foo));
dkfplain2008-09-24 16:53:32
Bother. I'd removed the use of that macro from the code, but forgot the declaration...
Log in (anonymous is fine) to add a comment.