From owner-svn-src-all@FreeBSD.ORG Sat Feb 12 12:46:01 2011 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E7131065670; Sat, 12 Feb 2011 12:46:01 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 528C58FC0C; Sat, 12 Feb 2011 12:46:01 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id p1CCk1ud001917; Sat, 12 Feb 2011 12:46:01 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id p1CCk1Ks001915; Sat, 12 Feb 2011 12:46:01 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201102121246.p1CCk1Ks001915@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 12 Feb 2011 12:46:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r218601 - head/lib/libufs X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 12 Feb 2011 12:46:01 -0000 Author: kib Date: Sat Feb 12 12:46:00 2011 New Revision: 218601 URL: http://svn.freebsd.org/changeset/base/218601 Log: Replace ERROR() macro with inline function. In-tree gcc cannot tolerate the construct like printf("%\s", NULL) resulting from macroexpand of ERROR(u, NULL), making it impossible to use LIBUFS_DEBUGGING. With inline function, compiler cannot detect the NULL argument to known function and does not try to convert it into puts(). In collaboration with: pho Modified: head/lib/libufs/libufs.h Modified: head/lib/libufs/libufs.h ============================================================================== --- head/lib/libufs/libufs.h Sat Feb 12 11:00:34 2011 (r218600) +++ head/lib/libufs/libufs.h Sat Feb 12 12:46:00 2011 (r218601) @@ -31,34 +31,6 @@ #define __LIBUFS_H__ /* - * libufs macros (internal, non-exported). - */ -#ifdef _LIBUFS -#ifdef _LIBUFS_DEBUGGING -/* - * Trace steps through libufs, to be used at entry and erroneous return. - */ -#define ERROR(uufsd, str) \ -do { \ - fprintf(stderr, "libufs in %s", __func__); \ - if (str != NULL) \ - fprintf(stderr, ": %s", str); \ - if (errno) \ - fprintf(stderr, ": %s", strerror(errno)); \ - fprintf(stderr, "\n"); \ - if ((uufsd) != NULL) \ - (uufsd)->d_error = str; \ -} while (0) -#else /* _LIBUFS_DEBUGGING */ -#define ERROR(uufsd, str) \ -do { \ - if ((uufsd) != NULL) \ - (uufsd)->d_error = str; \ -} while (0) -#endif /* _LIBUFS_DEBUGGING */ -#endif /* _LIBUFS */ - -/* * libufs structures. */ @@ -94,6 +66,30 @@ struct uufsd { #define d_cg d_cgunion.d_cg }; +/* + * libufs macros (internal, non-exported). + */ +#ifdef _LIBUFS +/* + * Trace steps through libufs, to be used at entry and erroneous return. + */ +static inline void +ERROR(struct uufsd *u, const char *str) +{ + +#ifdef _LIBUFS_DEBUGGING + if (str != NULL) { + fprintf(stderr, "libufs: %s", str); + if (errno != 0) + fprintf(stderr, ": %s", strerror(errno)); + fprintf(stderr, "\n"); + } +#endif + if (u != NULL) + u->d_error = str; +} +#endif /* _LIBUFS */ + __BEGIN_DECLS /*