From: Enze Li Date: Mon, 19 Sep 2022 12:43:50 +0000 (+0800) Subject: gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=77b7377bc4c8d404de00c5a360e64daee75acf80;p=binutils-gdb.git gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler I see this error when building with clang, CXX gdb_bfd.o gdb_bfd.c:1180:43: error: format string is not a string literal [-Werror,-Wformat-nonliteral] const std::string str = string_vprintf (fmt, ap_copy); ^~~ 1 error generated. This patch adds missing ATTRIBUTE_PRINTF to fix the error. Tested on x86_64-linux with gcc 12 and clang 14. --- diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c index 6299148d419..c5a5ed95e8e 100644 --- a/gdb/gdb_bfd.c +++ b/gdb/gdb_bfd.c @@ -1170,7 +1170,7 @@ static bfd_error_handler_type default_bfd_error_handler; messages which have been printed once already. This is done on a per-inferior basis. */ -static void +static void ATTRIBUTE_PRINTF (1, 0) gdb_bfd_error_handler (const char *fmt, va_list ap) { va_list ap_copy;