From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id yDjbBQp9RWPT3QkAWB0awg (envelope-from ) for ; Tue, 11 Oct 2022 10:26:18 -0400 Received: by simark.ca (Postfix, from userid 112) id 15DF21E112; Tue, 11 Oct 2022 10:26:18 -0400 (EDT) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=HNTraVFq; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RDNS_DYNAMIC,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id C40BB1E0D5 for ; Tue, 11 Oct 2022 10:26:17 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 6ECE8385116D for ; Tue, 11 Oct 2022 14:26:17 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6ECE8385116D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1665498377; bh=ngzxCtG14TXbCPDN7wwEbx+TgU5SJmAp0ey4hK7J3iI=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=HNTraVFqk5lx/bSpNDRpE6WC+q+yKDqUviolYOHaKw4UiRUlsnTDX3Gd69qYv2N66 t8Gx8aK8ldbXrA0vozKyeWFt0jotH1hjVI5NcLqh8BKPKfdDurXoLXCuGRYCFOTkKQ GVt9smxjoi4dbJ1HhgqDzyaAWoKoT4sHef7rkqaU= Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id F32DE3851C07 for ; Tue, 11 Oct 2022 14:25:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org F32DE3851C07 Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-620-2jU9LJG1OUGVDC4WhjFuSA-1; Tue, 11 Oct 2022 10:25:56 -0400 X-MC-Unique: 2jU9LJG1OUGVDC4WhjFuSA-1 Received: by mail-wm1-f72.google.com with SMTP id v125-20020a1cac83000000b003bd44dc5242so10679131wme.7 for ; Tue, 11 Oct 2022 07:25:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=ngzxCtG14TXbCPDN7wwEbx+TgU5SJmAp0ey4hK7J3iI=; b=eWCs6keh+CXKqiRdqB1NbdtpDI8kIQWwUv7LhX7T+vGyphA3o2Vr54AmYG927qovSG NjuFfC12a6iSiz1Fmm7fPkDqP3b1gcH5SCp9/hU/BfIJHGjJCLR6LUtblFQFo2hDlEXy zs+L0G4hwMJJMjNGvXavtUyUEB7FVw4d0tow8xCYEVb3zI5jZ4Nqp1q1QVRMP3tODVr6 XpCZnLh8+Q32FfAL6wH2y28uku6W7FBdhXTNzmqzVzX9GUC6vyFgXFWWUQiS2SSBKYy9 PjpUnTJr1L1/ngDrthc11u1zE0EELd8Xie7xskbdVXWATDli5vkpH/JMs4HPAI4OTNLv MHKg== X-Gm-Message-State: ACrzQf1UWVMpLr4XcPXEKLXDjs3LZXXgTyQWj5z34PTbKdX4L5vD0hhG HBayZVX7NLp8v55Sdh8w7HOAQXTP9DahGmss+GKTTYUmTSd+opZpg+YF19CyTOyxoMZCnU8Zl/6 SI/IcQjQ8SEPGTzdlFNA+2w== X-Received: by 2002:adf:efc5:0:b0:22e:4a6:2d5b with SMTP id i5-20020adfefc5000000b0022e04a62d5bmr15627227wrp.293.1665498355529; Tue, 11 Oct 2022 07:25:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4PAquO2ZM3/kJZ/utifZ8BeEJWOuIYeyvZKxO5Czd28W/YHEEkMgkNNoNy2hNNRVXGgMZPJg== X-Received: by 2002:adf:efc5:0:b0:22e:4a6:2d5b with SMTP id i5-20020adfefc5000000b0022e04a62d5bmr15627217wrp.293.1665498355309; Tue, 11 Oct 2022 07:25:55 -0700 (PDT) Received: from localhost (52.72.115.87.dyn.plus.net. [87.115.72.52]) by smtp.gmail.com with ESMTPSA id z2-20020a5d44c2000000b0022e55f40bc7sm11474861wrr.82.2022.10.11.07.25.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Oct 2022 07:25:54 -0700 (PDT) To: Tsukasa OI , Tsukasa OI , Mike Frysinger , Stephane Carrez , "Frank Ch . Eigler" Subject: Re: [PATCH v2 5/7] sim/m68hc11: Add ATTRIBUTE_PRINTF In-Reply-To: <9d993eb853ecc5911c85868931cec308925014d8.1665038133.git.research_trasio@irq.a4lg.com> References: <9d993eb853ecc5911c85868931cec308925014d8.1665038133.git.research_trasio@irq.a4lg.com> Date: Tue, 11 Oct 2022 15:25:54 +0100 Message-ID: <875ygqcu8d.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrew Burgess via Gdb-patches Reply-To: Andrew Burgess Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Tsukasa OI writes: > Clang generates a warning if the format string of a printf-like function is > not a literal ("-Wformat-nonliteral"). On the default configuration, it > causes a build failure (unless "--disable-werror" is specified). > > To avoid warnings on the printf-like wrapper, it requires proper > __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. > > This commit adds ATTRIBUTE_PRINTF to a printf-like function. > --- > sim/m68hc11/m68hc11_sim.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/sim/m68hc11/m68hc11_sim.c b/sim/m68hc11/m68hc11_sim.c > index 6ec45f78206..2770f17262a 100644 > --- a/sim/m68hc11/m68hc11_sim.c > +++ b/sim/m68hc11/m68hc11_sim.c > @@ -1017,7 +1017,7 @@ cpu_single_step (sim_cpu *cpu) > } > > /* VARARGS */ > -void > +void ATTRIBUTE_PRINTF (4, 5) > sim_memory_error (sim_cpu *cpu, SIM_SIGNAL excep, > uint16_t addr, const char *message, ...) > { I've pushed this patch, but moved the ATTRIBUTE_PRINTF to the function declaration. Thanks, Andrew --- commit 7f9495b21380c0184dde72920bcca37be9d76b9d Author: Tsukasa OI Date: Thu Oct 6 06:36:31 2022 +0000 sim/m68hc11: Add ATTRIBUTE_PRINTF Clang generates a warning if the format string of a printf-like function is not a literal ("-Wformat-nonliteral"). On the default configuration, it causes a build failure (unless "--disable-werror" is specified). To avoid warnings on the printf-like wrapper, it requires proper __attribute__((format)) and we have ATTRIBUTE_PRINTF macro for this reason. This commit adds ATTRIBUTE_PRINTF to a printf-like function. diff --git a/sim/m68hc11/sim-main.h b/sim/m68hc11/sim-main.h index e667c33a705..78dbd672867 100644 --- a/sim/m68hc11/sim-main.h +++ b/sim/m68hc11/sim-main.h @@ -539,7 +539,8 @@ extern void cpu_set_sp (sim_cpu *cpu, uint16_t val); extern int cpu_reset (sim_cpu *cpu); extern int cpu_restart (sim_cpu *cpu); extern void sim_memory_error (sim_cpu *cpu, SIM_SIGNAL excep, - uint16_t addr, const char *message, ...); + uint16_t addr, const char *message, ...) + ATTRIBUTE_PRINTF (4, 5); extern void emul_os (int op, sim_cpu *cpu); extern void cpu_interp_m6811 (sim_cpu *cpu); extern void cpu_interp_m6812 (sim_cpu *cpu);