From owner-freebsd-bugs@FreeBSD.ORG Fri May 18 06:10:07 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 543811065675 for ; Fri, 18 May 2012 06:10:07 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id 25F178FC16 for ; Fri, 18 May 2012 06:10:07 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q4I6A7c4086958 for ; Fri, 18 May 2012 06:10:07 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q4I6A7Vl086957; Fri, 18 May 2012 06:10:07 GMT (envelope-from gnats) Resent-Date: Fri, 18 May 2012 06:10:07 GMT Resent-Message-Id: <201205180610.q4I6A7Vl086957@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Garrett Cooper Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D536A106566B for ; Fri, 18 May 2012 06:05:18 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id C059B8FC12 for ; Fri, 18 May 2012 06:05:18 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.4/8.14.4) with ESMTP id q4I65ITV048542 for ; Fri, 18 May 2012 06:05:18 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.4/8.14.4/Submit) id q4I65Icc048532; Fri, 18 May 2012 06:05:18 GMT (envelope-from nobody) Message-Id: <201205180605.q4I65Icc048532@red.freebsd.org> Date: Fri, 18 May 2012 06:05:18 GMT From: Garrett Cooper To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Cc: Subject: kern/168095: [patch] [libiconv] fix improper handling of variadic args with ICDEBUG X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 May 2012 06:10:07 -0000 >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: