From patchwork Thu Oct 13 22:06:38 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: loic.minier@linaro.org X-Patchwork-Id: 4678 Return-Path: X-Original-To: patchwork@peony.canonical.com Delivered-To: patchwork@peony.canonical.com Received: from fiordland.canonical.com (fiordland.canonical.com [91.189.94.145]) by peony.canonical.com (Postfix) with ESMTP id E2B9E23DEE for ; Fri, 14 Oct 2011 09:58:57 +0000 (UTC) Received: from mail-yx0-f174.google.com (mail-yx0-f174.google.com [209.85.213.174]) by fiordland.canonical.com (Postfix) with ESMTP id 9D225A1878C for ; Fri, 14 Oct 2011 09:58:57 +0000 (UTC) Received: by yxp4 with SMTP id 4so687410yxp.19 for ; Fri, 14 Oct 2011 02:58:57 -0700 (PDT) Received: by 10.223.77.69 with SMTP id f5mr3112301fak.3.1318586336850; Fri, 14 Oct 2011 02:58:56 -0700 (PDT) X-Forwarded-To: linaro-patchwork@canonical.com X-Forwarded-For: patch@linaro.org linaro-patchwork@canonical.com Delivered-To: patches@linaro.org Received: by 10.152.24.41 with SMTP id r9cs8249laf; Fri, 14 Oct 2011 02:58:56 -0700 (PDT) Received: by 10.216.37.140 with SMTP id y12mr2521032wea.88.1318586333817; Fri, 14 Oct 2011 02:58:53 -0700 (PDT) Received: from pig2.dooz.org (pig2.dooz.org. [88.191.118.219]) by mx.google.com with ESMTPS id x17si2504007weq.140.2011.10.14.02.58.53 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 14 Oct 2011 02:58:53 -0700 (PDT) Received-SPF: pass (google.com: domain of lool@dooz.org designates 88.191.118.219 as permitted sender) client-ip=88.191.118.219; Authentication-Results: mx.google.com; spf=pass (google.com: domain of lool@dooz.org designates 88.191.118.219 as permitted sender) smtp.mail=lool@dooz.org Received: from bee.dooz.org (unknown [IPv6:2a01:e35:8a6e:5e80:224:7eff:fe14:65c3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bee.dooz.org", Issuer "dooz.org CA" (verified OK)) by pig2.dooz.org (Postfix) with ESMTPS id 345B7C09E8 for ; Fri, 14 Oct 2011 11:58:53 +0200 (CEST) Received: by bee.dooz.org (Postfix, from userid 1000) id 417B81C56; Fri, 14 Oct 2011 11:58:51 +0200 (CEST) Resent-From: =?iso-8859-1?Q?Lo=EFc?= Minier Resent-Date: Fri, 14 Oct 2011 11:58:51 +0200 Resent-Message-ID: <20111014095851.GE27642@bee.dooz.org> Resent-To: patches@linaro.org X-Spam-Checker-Version: SpamAssassin 3.1.4 (2006-07-26) on pig.dooz.org X-Spam-Level: X-Spam-Status: No, score=-102.6 required=3.0 tests=BAYES_00, USER_IN_WHITELIST autolearn=disabled version=3.1.4 X-Original-To: lool@dooz.org Received: from mail-wy0-f179.google.com (mail-wy0-f179.google.com [74.125.82.179]) by pig.dooz.org (Postfix) with ESMTP id 247344C0A9 for ; Fri, 14 Oct 2011 00:21:08 +0200 (CEST) Received: by wyg36 with SMTP id 36so3101765wyg.24 for ; Thu, 13 Oct 2011 15:21:08 -0700 (PDT) Received: by 10.227.27.229 with SMTP id j37mr61552wbc.57.1318543610459; Thu, 13 Oct 2011 15:06:50 -0700 (PDT) X-Forwarded-To: lool@dooz.org X-X-Forwarded-For: loic.minier@linaro.org lool@dooz.org Received: by 10.180.105.167 with SMTP id gn7cs168667wib; Thu, 13 Oct 2011 15:06:50 -0700 (PDT) Received: by 10.204.135.24 with SMTP id l24mr4460378bkt.57.1318543609957; Thu, 13 Oct 2011 15:06:49 -0700 (PDT) Received: from pig2.dooz.org (pig2.dooz.org. [88.191.118.219]) by mx.google.com with ESMTPS id z11si3688115bkd.165.2011.10.13.15.06.49 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 13 Oct 2011 15:06:49 -0700 (PDT) Received-SPF: pass (google.com: domain of lool@bee.dooz.org designates 88.191.118.219 as permitted sender) client-ip=88.191.118.219; Received: from bee.dooz.org (unknown [IPv6:2a01:e35:8a6e:5e80:224:7eff:fe14:65c3]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "bee.dooz.org", Issuer "dooz.org CA" (verified OK)) by pig2.dooz.org (Postfix) with ESMTPS id 1E44FC05A5; Fri, 14 Oct 2011 00:06:49 +0200 (CEST) Received: by bee.dooz.org (Postfix, from userid 1000) id 3C25439CE; Fri, 14 Oct 2011 00:06:48 +0200 (CEST) From: =?UTF-8?q?Lo=C3=AFc=20Minier?= To: barebox@lists.infradead.org Cc: =?UTF-8?q?Lo=C3=AFc=20Minier?= Subject: [PATCH 2/5] Avoid warnings by using format(__printf__) Date: Fri, 14 Oct 2011 00:06:38 +0200 Message-Id: <1318543601-20819-3-git-send-email-loic.minier@linaro.org> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1318543601-20819-1-git-send-email-loic.minier@linaro.org> References: <1318543601-20819-1-git-send-email-loic.minier@linaro.org> MIME-Version: 1.0 When building sandbox, barebox is built with -Dprintf=barebox_printf as to not collide with the printf provided by libc. This would also match the format(printf) function __attribute__. Since gcc documents that __printf__ can be used instead of printf as a format attribute, use this instead and avoid a lot of noisy warnings. NB: this relates to 6b082cfe9f9b5b2bea294918ad916c739490cea7 which was an earlier attempt at solving this, which got reverted due to other regressions. Signed-off-by: Loïc Minier --- include/stdio.h | 12 ++++++------ scripts/mod/modpost.c | 2 +- scripts/mod/modpost.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/stdio.h b/include/stdio.h index c824764..a0d81d3 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -9,7 +9,7 @@ */ /* serial stuff */ -void serial_printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); +void serial_printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); /* stdin */ int tstc(void); @@ -30,12 +30,12 @@ static inline void putchar(char c) console_putc(CONSOLE_STDOUT, c); } -int printf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); +int printf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); int vprintf(const char *fmt, va_list args); -int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); -int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(printf, 3, 4))); +int sprintf(char *buf, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); +int snprintf(char *buf, size_t size, const char *fmt, ...) __attribute__ ((format(__printf__, 3, 4))); int vsprintf(char *buf, const char *fmt, va_list args); -char *asprintf(const char *fmt, ...) __attribute__ ((format(printf, 1, 2))); +char *asprintf(const char *fmt, ...) __attribute__ ((format(__printf__, 1, 2))); char *vasprintf(const char *fmt, va_list ap); int vsnprintf(char *buf, size_t size, const char *fmt, va_list args); int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); @@ -54,7 +54,7 @@ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args); #define stderr 2 #define MAX_FILES 128 -void fprintf(int file, const char *fmt, ...) __attribute__ ((format(printf, 2, 3))); +void fprintf(int file, const char *fmt, ...) __attribute__ ((format(__printf__, 2, 3))); int fputs(int file, const char *s); int fputc(int file, const char c); int ftstc(int file); diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 08b75b6..e994486 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -1300,7 +1300,7 @@ static void read_symbols(char *modname) * following helper, then compare to the file on disk and * only update the later if anything changed */ -void __attribute__((format(printf, 2, 3))) buf_printf(struct buffer *buf, +void __attribute__((format(__printf__, 2, 3))) buf_printf(struct buffer *buf, const char *fmt, ...) { char tmp[SZ]; diff --git a/scripts/mod/modpost.h b/scripts/mod/modpost.h index 4156dd3..0c23259 100644 --- a/scripts/mod/modpost.h +++ b/scripts/mod/modpost.h @@ -94,7 +94,7 @@ struct buffer { int size; }; -void __attribute__((format(printf, 2, 3))) +void __attribute__((format(__printf__, 2, 3))) buf_printf(struct buffer *buf, const char *fmt, ...); void