From: "Loïc Minier" <loic.minier@linaro.org>
To: barebox@lists.infradead.org
Subject: [PATCH 2/5] Avoid warnings by using format(__printf__)
Date: Fri, 14 Oct 2011 00:06:38 +0200 [thread overview]
Message-ID: <1318543601-20819-3-git-send-email-loic.minier@linaro.org> (raw)
In-Reply-To: <1318543601-20819-1-git-send-email-loic.minier@linaro.org>
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 <loic.minier@linaro.org>
---
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
--
1.7.5.4
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next prev parent reply other threads:[~2011-10-13 22:06 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-13 22:06 [RFC] Fix misc warnings when building sandbox on 64-bits Loïc Minier
2011-10-13 22:06 ` [PATCH 1/5] Only pass -P to cpp when generating ld scripts Loïc Minier
2011-10-13 22:06 ` Loïc Minier [this message]
2011-10-14 6:50 ` [PATCH 2/5] Avoid warnings by using format(__printf__) Sascha Hauer
2011-10-13 22:06 ` [PATCH 3/5] fprintf() returns an int Loïc Minier
2011-10-14 7:04 ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 4/5] Use %p in format for pointers Loïc Minier
2011-10-14 7:18 ` Sascha Hauer
2011-10-14 7:22 ` Sascha Hauer
2011-10-13 22:06 ` [PATCH 5/5] Use size_t for memory offsets Loïc Minier
2011-10-14 7:20 ` Sascha Hauer
2011-10-14 8:59 ` Loïc Minier
2011-10-14 12:11 ` Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1318543601-20819-3-git-send-email-loic.minier@linaro.org \
--to=loic.minier@linaro.org \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox