public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
* [binutils-gdb] Change printf attribute to fix clang build
@ 2024-04-15 15:37 Tom Tromey
  0 siblings, 0 replies; only message in thread
From: Tom Tromey @ 2024-04-15 15:37 UTC (permalink / raw)
  To: gdb-cvs

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=5cb1d84e595aac021641622028d0e7f1e8ea8adf

commit 5cb1d84e595aac021641622028d0e7f1e8ea8adf
Author: Tom Tromey <tromey@adacore.com>
Date:   Mon Apr 15 09:33:21 2024 -0600

    Change printf attribute to fix clang build
    
    commit e8cd90f0 ("Rewrite gdb_bfd_error_handler") broke the clang
    build.
    
    The problem here is that print_error_callback isn't marked as being
    printf-like, but it calls string_file::vprintf, triggering:
    
    ../../binutils-gdb/gdb/gdb_bfd.c:1202:18: error: format string is not a string literal [-Werror,-Wformat-nonliteral]
    
    This patch applies the attribute to this function.
    
    It also removes the attribute from gdb_bfd_error_handler, because that
    function is no longer really printf-like.

Diff:
---
 gdb/gdb_bfd.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index 0120dd034fa..1462aaf0f89 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -1192,7 +1192,7 @@ increment_bfd_error_count (const std::string &str)
 
 /* A print callback for bfd_print_error.  */
 
-static int
+static int ATTRIBUTE_PRINTF (2, 0)
 print_error_callback (void *stream, const char *fmt, ...)
 {
   string_file *file = (string_file *) stream;
@@ -1208,7 +1208,7 @@ print_error_callback (void *stream, const char *fmt, ...)
    messages which have been printed once already.  This is done on a
    per-inferior basis.  */
 
-static void ATTRIBUTE_PRINTF (1, 0)
+static void
 gdb_bfd_error_handler (const char *fmt, va_list ap)
 {
   string_file output;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-04-15 15:37 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-15 15:37 [binutils-gdb] Change printf attribute to fix clang build Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).