Hi in GCC I use:
#define DBUG(x,...) DebugPrintF("[%s:%-4ld] "x ,__FILE__,__LINE__, ##__VA_ARGS__)
examples:
DBUG("OpenAboutWindow() - START\n");
DBUG(" Licence path:'%s'\n",lic_path);
but under VBCC it complains "error 273 in line 185 of "main.c": not enough arguments to macro"
I can't find a valid replacement for ##__VA_ARGS__ (or wherever problem is)
any help would be appreciated :-)
Try with -c99 command line option.
In the makefile the compiler flags used are:
cflags = -c99 -warn=-1 -dontwarn=79,81,163,164,166,167,168,306,307 -D__USE_INLINE__ -ISDK:local/common/include -D__USE_OLD_TIMEVAL__ -D__USE_CLASSIC_MINTERM__ -D__AMIDATE__="$(AMIDATE)" $(DEBUG)
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
Seems like VBCC requires at least one argument for "..." and it does not like ## there.
If you remove ## and add ,0 to the first DBUG call, then it compiles.
THX removed ## and added 'NULL' argument to "empty" DBUG calls, noticed that last thing too since a few new SDK test builds.
Now working fine with VBCC "DBUG()". Thanks mate
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P
This use of '##' to remove the comma if the varargs parameter doesn't exist is AFAIK a gcc specific extension to the C language and not part of ANSI C, which is why it's not supported by vbcc.
The inline4 macros for Printf() and other varargs functions get around this by including the last regular argument into the varargs argument, e.g.:
#define Printf(...) IDOS->Printf(__VA_ARGS__)
instead of
#define Printf(fmt, ...) IDOS->Printf((fmt), ## __VA_ARGS__)
ok, thx understood.
AOS4.1/SAM460ex/PPC460EX-1155MHZ/2048MB/RadeonHD6570/SSD120GB/DVDRW :-P