From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1726) id 3D4BE3858C2D; Tue, 11 Oct 2022 14:18:41 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3D4BE3858C2D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665497921; bh=ch6FXHXx9q87mdhgc+u9swQTK9CL3TsCtE6ZFFqmeG0=; h=From:To:Subject:Date:From; b=vTewANzo6/Dc9pJbPaHN/8ad7uII+DfFACr9aVkoGQ48zq2s7Ujk4SmXYgDm9qe+K Qf+n7VQX1+t9RhKui5orV/0Bf/2w6BPACQDl6j+ryz0uyDC6aMP17ngJNQkVTnDB17 O2Iypajo/uTIhfT76iP6Fo/2U4Se/t7f8UvSqlQw= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Andrew Burgess To: gdb-cvs@sourceware.org Subject: [binutils-gdb] sim/common: Add ATTRIBUTE_PRINTF X-Act-Checkin: binutils-gdb X-Git-Author: Tsukasa OI X-Git-Refname: refs/heads/master X-Git-Oldrev: 735fab23d68d66678eaa19e5751c49091c3bd299 X-Git-Newrev: 7aaf9c03d143802302c49ed70d05766c9cf3cb5b Message-Id: <20221011141841.3D4BE3858C2D@sourceware.org> Date: Tue, 11 Oct 2022 14:18:41 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3D7aaf9c03d143= 802302c49ed70d05766c9cf3cb5b commit 7aaf9c03d143802302c49ed70d05766c9cf3cb5b Author: Tsukasa OI Date: Thu Oct 6 06:36:27 2022 +0000 sim/common: Add ATTRIBUTE_PRINTF =20 Clang generates a warning if the format string of a printf-like functio= n is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). =20 To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this rea= son. =20 This commit adds ATTRIBUTE_PRINTF to a printf-like function. Diff: --- sim/common/sim-cpu.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sim/common/sim-cpu.h b/sim/common/sim-cpu.h index d8b2b9c494a..9e09a55bf81 100644 --- a/sim/common/sim-cpu.h +++ b/sim/common/sim-cpu.h @@ -137,7 +137,8 @@ extern sim_cpu *sim_cpu_lookup (SIM_DESC, const char *); /* Return prefix to use in cpu specific messages. */ extern const char *sim_cpu_msg_prefix (sim_cpu *); /* Cover fn to sim_io_eprintf. */ -extern void sim_io_eprintf_cpu (sim_cpu *, const char *, ...); +extern void sim_io_eprintf_cpu (sim_cpu *, const char *, ...) + ATTRIBUTE_PRINTF (2, 3); =20 /* Get/set a pc value. */ #define CPU_PC_GET(cpu) ((* CPU_PC_FETCH (cpu)) (cpu))