From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id AA5D23858427 for ; Mon, 9 May 2022 09:15:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org AA5D23858427 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-631-m58t4VVUP9SDT0qQ9avZ_w-1; Mon, 09 May 2022 05:15:55 -0400 X-MC-Unique: m58t4VVUP9SDT0qQ9avZ_w-1 Received: by mail-oo1-f72.google.com with SMTP id o12-20020a4aa80c000000b0035ea8bd060aso6787950oom.3 for ; Mon, 09 May 2022 02:15:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=x9WGcS+NZ2VfV+2CozOvBL7M3Zz4SjwagSfGHPQzbmo=; b=jfvr8lhyDt+d+i5ZbII5CUopq0OZqh3MiUy7Pg1wSjbBKaek+FgUYMmj69A08IG+ho 6KPnuhXBgLB8vfhEWHs1OsNnIpO1WlY70CzphbvQJZJUM3pZIjcc68e4EL7rqVQW6ueb HGgYNxsEsOqjQCVBtFOC18uThxqleNcbNwfVLqOYFiH7EYzP0ZodA+2jKjf0gDwS9RVG ryOet28WbOiiwB6xWWvSq7WYeGLxZD14+1Oe7YsKdbWud+LeqaGS49NDYJPzKRI5Gvc5 PKmjxsusWk5g5vjs9IuBcDYgz/1TlvsXcKCmLHCWcyDzD8k2SpxNmC6yxG4K0iyBWmql fDww== X-Gm-Message-State: AOAM5330LoKbxMdoWnK4nyRqnwINiclMG6nySJtL+wDU7/7+GNYUkXri cpzUtWApXcyckJouLVW/29Lnw+fY/NQQYuRU7h7Uf9yN8++ryhkWYTcme6GIxPQUAHgljXyP7lN ocH3FL5hvFSAvrsQJk7XiAig= X-Received: by 2002:a05:6870:c182:b0:ed:da64:f9e with SMTP id h2-20020a056870c18200b000edda640f9emr6398189oad.188.1652087754968; Mon, 09 May 2022 02:15:54 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxuds9Zm1tcsupXDG+ViTjFSNgki8jD2rchy9OydZk2w4e4jGHzjZQOQEkwPQDKxn5unW/XDeOauhob1agUl6k= X-Received: by 2002:a05:6870:c182:b0:ed:da64:f9e with SMTP id h2-20020a056870c18200b000edda640f9emr6398179oad.188.1652087754665; Mon, 09 May 2022 02:15:54 -0700 (PDT) MIME-Version: 1.0 From: Ulrich Drepper Date: Mon, 9 May 2022 11:15:44 +0200 Message-ID: Subject: -Wformat and u8"" To: gcc@gcc.gnu.org X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-6.6 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, HTML_MESSAGE, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: gcc@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2022 09:16:07 -0000 I have a C++20+ code base which forces the program to run using an UTF-8 locale and then uses u8"" strings internally. This causes warnings with -Wformat. #include int main() { printf((const char*) u8"test %d\n", 1); return 0; } Compile with g++ -std=3Dgnu++20 -c -O -Wall t.cc and you'll see: t.cc: In function =E2=80=98int main()=E2=80=99: t.cc:5:24: warning: format string is not an array of type =E2=80=98char=E2= =80=99 [-Wformat=3D] 5 | printf((const char*) u8"test %d\n", 1); | ^~~~~~~~~~~~~ I would say it is not gcc's business to question my use of u8"" given that I use a cast and the u8"" string can be parsed by the -Wformat handling. Before filing a report I'd like to take the temperature and see whether people agree with this. Thanks.