../../src/include/openct/ifd.h:181:35: warning: ISO C does not permit named
vari adic macros ifd-acr30u.c:357:24: warning: ISO C99 requires rest arguments to be used ifd-acr30u.c:364:24: warning: ISO C99 requires rest arguments to be used we have warnings like this in all ifdhandlers (but only with "-pedantic" option). does anyone know what the proper code is, so it works without warnings? the first warning is triggered by this: /* Debugging macro */ #ifdef __GNUC__ #define ifd_debug(level, fmt, args...) \ do { \ if ((level) <= ct_config.debug) \ ct_debug("%s: " fmt, __FUNCTION__ , ##args); \ } while (0) #else extern void ifd_debug(int level, const char *fmt, ...); #endif the later warnings are triggered by this: ifd_debug(1, "called."); I found nothing helpfull about the issue. And I don't mind those warnings. but if anyone knows a trick to fix them, that would be nice. Regards, Andreas _______________________________________________ opensc-devel mailing list [hidden email] http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel |
Andreas Jellinghaus wrote:
> ../../src/include/openct/ifd.h:181:35: warning: ISO C does not permit named > vari > adic macros > ifd-acr30u.c:357:24: warning: ISO C99 requires rest arguments to be used > ifd-acr30u.c:364:24: warning: ISO C99 requires rest arguments to be used > > we have warnings like this in all ifdhandlers (but only with "-pedantic" > option). does anyone know what the proper code is, so it works without > warnings? > > the first warning is triggered by this: > /* Debugging macro */ > #ifdef __GNUC__ > #define ifd_debug(level, fmt, args...) \ > do { \ > if ((level) <= ct_config.debug) \ > ct_debug("%s: " fmt, __FUNCTION__ , ##args); \ > } while (0) > #else > extern void ifd_debug(int level, const char *fmt, ...); > #endif > > the later warnings are triggered by this: > ifd_debug(1, "called."); > > I found nothing helpfull about the issue. And I don't mind those warnings. > but if anyone knows a trick to fix them, that would be nice. the compiler complains that the "args" macro parameter isn't used (afaik this is not allowed in ansi c). In C99 there's __VA_ARGS__ macro parameter for variable parameter list, however I'm not sure if every compiler support it => probably the best solution is to use functions (as it's done in opensc when no gcc is used). This is of course a bit slower but who cares ... Cheers, Nils _______________________________________________ opensc-devel mailing list [hidden email] http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel |
In reply to this post by Andreas Jellinghaus-2
On 16/09/05, Andreas Jellinghaus <[hidden email]> wrote:
> ../../src/include/openct/ifd.h:181:35: warning: ISO C does not permit named > vari > adic macros > ifd-acr30u.c:357:24: warning: ISO C99 requires rest arguments to be used > ifd-acr30u.c:364:24: warning: ISO C99 requires rest arguments to be used > > we have warnings like this in all ifdhandlers (but only with "-pedantic" > option). does anyone know what the proper code is, so it works without > warnings? I found some help in [1]. My proposed patch is: Index: include/openct/ifd.h =================================================================== --- include/openct/ifd.h (révision 764) +++ include/openct/ifd.h (copie de travail) @@ -178,10 +178,10 @@ extern void ifd_protocol_free(ifd_prot /* Debugging macro */ #ifdef __GNUC__ -#define ifd_debug(level, fmt, args...) \ +#define ifd_debug(level, fmt, ...) \ do { \ if ((level) <= ct_config.debug) \ - ct_debug("%s: " fmt, __FUNCTION__ , ##args); \ + ct_debug("%s: " fmt, __FUNCTION__ , ## __VA_ARGS__); \ } while (0) #else extern void ifd_debug(int level, const char *fmt, ...); The problem is this feature was added in C99 only. I have to use -std=c99 to make it compile with -pedantic (./configure CFLAGS="-pedantic-errors -std=c99"). If I don't use --pedantic I can also omit std=c99 so my patch _may_ work without too much trouble for many peple. I have no idea how it behaves with non GCC compilers. Bye, [1] http://www.developerweb.net/forum/showthread.php?s=e3b38696c9480d9a08483039ec7222ce&p=17875#post17875 -- Dr. Ludovic Rousseau For private mail use [hidden email] and not "big brother" Google _______________________________________________ opensc-devel mailing list [hidden email] http://www.opensc.org/cgi-bin/mailman/listinfo/opensc-devel |
Free forum by Nabble | Edit this page |