Date: Fri, 18 May 2012 06:05:18 GMT From: Garrett Cooper <yanegomi@gmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: kern/168095: [patch] [libiconv] fix improper handling of variadic args with ICDEBUG Message-ID: <201205180605.q4I65Icc048532@red.freebsd.org> Resent-Message-ID: <201205180610.q4I6A7Vl086957@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 168095 >Category: kern >Synopsis: [patch] [libiconv] fix improper handling of variadic args with ICDEBUG >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Fri May 18 06:10:06 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Garrett Cooper >Release: 9-STABLE >Organization: EMC Isilon >Environment: FreeBSD forza.west.isilon.com 9.0-STABLE FreeBSD 9.0-STABLE #4 r235133: Mon May 7 10:31:22 PDT 2012 root@forza.isilon.com:/usr/obj/usr/src/sys/FORZA amd64 >Description: The ICDEBUG macro doesn't compile on iconv.c:555 because it doesn't have a proper format string to handle the variadic macro hack that's implemented in ICDEBUG(..). The attached patch fixes that by properly handling the variadic macro with the paste (##) preprocessor operator, as noted in 1 (amongst various other places). 1. http://gcc.gnu.org/onlinedocs/gcc/Variadic-Macros.html >How-To-Repeat: make -C /sys/modules/libiconv CFLAGS+=-DICONV_DEBUG all >Fix: Patch attached with submission follows: Index: sys/libkern/iconv.c =================================================================== --- sys/libkern/iconv.c (revision 234223) +++ sys/libkern/iconv.c (working copy) @@ -537,9 +537,7 @@ iconv_lookupcp(char **cpp, const char *s) { if (cpp == NULL) { - ICDEBUG("warning a NULL list passed\n", ""); /* XXX ISO variadic macros cannot - leave out the - variadic args */ + ICDEBUG("warning a NULL list passed\n"); return ENOENT; } for (; *cpp; cpp++) Index: sys/sys/iconv.h =================================================================== --- sys/sys/iconv.h (revision 234223) +++ sys/sys/iconv.h (working copy) @@ -239,7 +239,7 @@ int iconv_converter_handler(module_t mod, int type, void *data); #ifdef ICONV_DEBUG -#define ICDEBUG(format, ...) printf("%s: "format, __func__ , __VA_ARGS__) +#define ICDEBUG(format, ...) printf("%s: "format, __func__ , ## __VA_ARGS__) #else #define ICDEBUG(format, ...) #endif >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201205180605.q4I65Icc048532>