* [PATCH] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler
@ 2022-09-18 4:58 Enze Li
2022-09-18 5:45 ` Tom de Vries
0 siblings, 1 reply; 3+ messages in thread
From: Enze Li @ 2022-09-18 4:58 UTC (permalink / raw)
To: gdb-patches; +Cc: enze.li
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.
---
gdb/gdb_bfd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
--
2.37.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler
2022-09-18 4:58 [PATCH] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler Enze Li
@ 2022-09-18 5:45 ` Tom de Vries
2022-09-19 12:49 ` Enze Li
0 siblings, 1 reply; 3+ messages in thread
From: Tom de Vries @ 2022-09-18 5:45 UTC (permalink / raw)
To: Enze Li, gdb-patches; +Cc: enze.li
On 9/18/22 06:58, Enze Li via Gdb-patches wrote:
> 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.
LGTM.
Thanks,
- Tom
> ---
> gdb/gdb_bfd.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler
2022-09-18 5:45 ` Tom de Vries
@ 2022-09-19 12:49 ` Enze Li
0 siblings, 0 replies; 3+ messages in thread
From: Enze Li @ 2022-09-19 12:49 UTC (permalink / raw)
To: Tom de Vries; +Cc: gdb-patches, enze.li
On Sun, Sep 18 2022 at 07:45:10 AM +0200, Tom de Vries wrote:
> On 9/18/22 06:58, Enze Li via Gdb-patches wrote:
>> 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.
>
>
> LGTM.
>
> Thanks,
> - Tom
>
Thanks, Tom. Pushed.
Enze
>> ---
>> gdb/gdb_bfd.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>> 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;
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-09-19 12:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-09-18 4:58 [PATCH] gdb: add ATTRIBUTE_PRINTF to gdb_bfd_error_handler Enze Li
2022-09-18 5:45 ` Tom de Vries
2022-09-19 12:49 ` Enze Li
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).