From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4ACB7C433F5 for ; Wed, 16 Mar 2022 13:30:45 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.291199.494090 (Exim 4.92) (envelope-from ) id 1nUTjV-0000BL-1v; Wed, 16 Mar 2022 13:30:33 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 291199.494090; Wed, 16 Mar 2022 13:30:33 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nUTjU-0000BE-V0; Wed, 16 Mar 2022 13:30:32 +0000 Received: by outflank-mailman (input) for mailman id 291199; Wed, 16 Mar 2022 13:30:31 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1nUTjT-0000B6-Oc for xen-devel@lists.xenproject.org; Wed, 16 Mar 2022 13:30:31 +0000 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 3eb97306-a52d-11ec-853b-5f4723681683; Wed, 16 Mar 2022 14:30:29 +0100 (CET) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-UC8-YLvZOc2NKSj3QhDYXg-1; Wed, 16 Mar 2022 09:30:11 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 447933802ACE; Wed, 16 Mar 2022 13:30:10 +0000 (UTC) Received: from redhat.com (unknown [10.39.195.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51AA830B9D; Wed, 16 Mar 2022 13:29:23 +0000 (UTC) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 3eb97306-a52d-11ec-853b-5f4723681683 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647437428; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=TVu/CeOwg7TjRwgWWJUd3qigmb0rClTETSGukZB9kvE=; b=fED5cCUiCguwoFHGFb32sHckPXpg0kQcGdgipvfTsBaX8oVIh21DKIuC2RUXFS7C0LKDVn k9t3CLAw7ENN+X9lTLj7Gnl6p9WaCTH18uwZ9zQV+QKbLx8mu549YQXnqk6eytHt8LfV2p Pd5lCwwpDIo7e5dWW5PbHHZsaVcQtXI= X-MC-Unique: UC8-YLvZOc2NKSj3QhDYXg-1 Date: Wed, 16 Mar 2022 13:29:17 +0000 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: marcandre.lureau@redhat.com Cc: qemu-devel@nongnu.org, Gerd Hoffmann , Christian Schoenebeck , Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Thomas Huth , Stefan Hajnoczi , Kevin Wolf , Hanna Reitz , "Richard W.M. Jones" , Warner Losh , Kyle Evans , Greg Kurz , "Michael S. Tsirkin" , Igor Mammedov , Ani Sinha , Huacai Chen , Jiaxun Yang , Aurelien Jarno , Jiri Pirko , Jason Wang , Stefano Stabellini , Anthony Perard , Paul Durrant , Paolo Bonzini , Eduardo Habkost , Marcel Apfelbaum , Yanan Wang , Markus Armbruster , Michael Roth , "Dr. David Alan Gilbert" , Eric Blake , Vladimir Sementsov-Ogievskiy , Konstantin Kostiuk , Laurent Vivier , "open list:blkverify" , "open list:X86 Xen CPUs" Subject: Re: [PATCH 07/27] Replace GCC_FMT_ATTR with G_GNUC_PRINTF Message-ID: Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= References: <20220316095248.2613601-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220316095248.2613601-1-marcandre.lureau@redhat.com> User-Agent: Mutt/2.1.5 (2021-12-30) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline On Wed, Mar 16, 2022 at 01:52:48PM +0400, marcandre.lureau@redhat.com wrote: > diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h > index 3baa5e3790f7..f2bd050e3b9a 100644 > --- a/include/qemu/compiler.h > +++ b/include/qemu/compiler.h > @@ -79,19 +79,12 @@ > #define QEMU_BUILD_BUG_ON_ZERO(x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ > sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) > > -#if defined(__clang__) > -/* clang doesn't support gnu_printf, so use printf. */ > -# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m))) > -#else > -/* Use gnu_printf (qemu uses standard format strings). */ > -# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m))) > -# if defined(_WIN32) > +#if !defined(__clang__) && defined(_WIN32) > /* > * Map __printf__ to __gnu_printf__ because we want standard format strings even > * when MinGW or GLib include files use __printf__. > */ > -# define __printf__ __gnu_printf__ > -# endif > +# define __printf__ __gnu_printf__ > #endif I'm not convinced we shold have this remaining define, even before your patch. For code we've implemented, we should have used __gnu_printf__ already if we know it uses GNU format on Windows. For code in GLib, its header file uses __gnu_printf__ for anything that relies on its portable printf replacement, which is basically everything in GLib. For anything else we should honour whatever they declare, and not assume their impl is the GNU one. I guess it is easy enough to validate by deleting this and seeing if we get any warnings from the mingw CI jobs about printf/gnu_printf mismatch. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED14AC433EF for ; Wed, 16 Mar 2022 13:58:20 +0000 (UTC) Received: from localhost ([::1]:43664 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nUUAO-0002Q1-21 for qemu-devel@archiver.kernel.org; Wed, 16 Mar 2022 09:58:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42372) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUTjX-00081a-7n for qemu-devel@nongnu.org; Wed, 16 Mar 2022 09:30:35 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]:43723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nUTjV-0005GF-5p for qemu-devel@nongnu.org; Wed, 16 Mar 2022 09:30:34 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1647437432; h=from:from:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references; bh=TVu/CeOwg7TjRwgWWJUd3qigmb0rClTETSGukZB9kvE=; b=SK+tnTEVNdIH3t9FKX+6pnWe05Mh3rsDRDvAMxl4BpSmr+cVgO5k7S4LapmM430Pl3xiIl 6ibAXuPP+E1fMPyYi//fcDsfP6aF7xDwBXWxWidorpG3eN9fLJcHerdTRl5MjyD71MNbV0 mV8G+C5cEkAleZ+aLQy3XbMc7Vk7+TI= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-377-UC8-YLvZOc2NKSj3QhDYXg-1; Wed, 16 Mar 2022 09:30:11 -0400 X-MC-Unique: UC8-YLvZOc2NKSj3QhDYXg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 447933802ACE; Wed, 16 Mar 2022 13:30:10 +0000 (UTC) Received: from redhat.com (unknown [10.39.195.81]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51AA830B9D; Wed, 16 Mar 2022 13:29:23 +0000 (UTC) Date: Wed, 16 Mar 2022 13:29:17 +0000 From: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= To: marcandre.lureau@redhat.com Subject: Re: [PATCH 07/27] Replace GCC_FMT_ATTR with G_GNUC_PRINTF Message-ID: References: <20220316095248.2613601-1-marcandre.lureau@redhat.com> MIME-Version: 1.0 In-Reply-To: <20220316095248.2613601-1-marcandre.lureau@redhat.com> User-Agent: Mutt/2.1.5 (2021-12-30) X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=berrange@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Received-SPF: pass client-ip=170.10.129.124; envelope-from=berrange@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -21 X-Spam_score: -2.2 X-Spam_bar: -- X-Spam_report: (-2.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: Daniel =?utf-8?B?UC4gQmVycmFuZ8Op?= Cc: "Michael S. Tsirkin" , Jason Wang , Christian Schoenebeck , qemu-devel@nongnu.org, Philippe =?utf-8?Q?Mathieu-Daud=C3=A9?= , Yanan Wang , Konstantin Kostiuk , Gerd Hoffmann , Ani Sinha , Eric Blake , Warner Losh , Stefano Stabellini , "open list:blkverify" , Huacai Chen , Markus Armbruster , Michael Roth , Anthony Perard , "open list:X86 Xen CPUs" , Laurent Vivier , Eduardo Habkost , Jiri Pirko , Kyle Evans , Greg Kurz , "Dr. David Alan Gilbert" , Paul Durrant , Stefan Hajnoczi , Paolo Bonzini , Kevin Wolf , Vladimir Sementsov-Ogievskiy , Thomas Huth , "Richard W.M. Jones" , Hanna Reitz , Igor Mammedov , Aurelien Jarno Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" On Wed, Mar 16, 2022 at 01:52:48PM +0400, marcandre.lureau@redhat.com wrote: > diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h > index 3baa5e3790f7..f2bd050e3b9a 100644 > --- a/include/qemu/compiler.h > +++ b/include/qemu/compiler.h > @@ -79,19 +79,12 @@ > #define QEMU_BUILD_BUG_ON_ZERO(x) (sizeof(QEMU_BUILD_BUG_ON_STRUCT(x)) - \ > sizeof(QEMU_BUILD_BUG_ON_STRUCT(x))) > > -#if defined(__clang__) > -/* clang doesn't support gnu_printf, so use printf. */ > -# define GCC_FMT_ATTR(n, m) __attribute__((format(printf, n, m))) > -#else > -/* Use gnu_printf (qemu uses standard format strings). */ > -# define GCC_FMT_ATTR(n, m) __attribute__((format(gnu_printf, n, m))) > -# if defined(_WIN32) > +#if !defined(__clang__) && defined(_WIN32) > /* > * Map __printf__ to __gnu_printf__ because we want standard format strings even > * when MinGW or GLib include files use __printf__. > */ > -# define __printf__ __gnu_printf__ > -# endif > +# define __printf__ __gnu_printf__ > #endif I'm not convinced we shold have this remaining define, even before your patch. For code we've implemented, we should have used __gnu_printf__ already if we know it uses GNU format on Windows. For code in GLib, its header file uses __gnu_printf__ for anything that relies on its portable printf replacement, which is basically everything in GLib. For anything else we should honour whatever they declare, and not assume their impl is the GNU one. I guess it is easy enough to validate by deleting this and seeing if we get any warnings from the mingw CI jobs about printf/gnu_printf mismatch. With regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|