From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on gnuweeb.org X-Spam-Level: X-Spam-Status: No, score=-0.0 required=5.0 tests=SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 Received: from 1wt.eu (wtarreau.pck.nerim.net [62.212.114.60]) by gnuweeb.org (Postfix) with ESMTP id 3B2867E2D2 for ; Fri, 20 May 2022 04:21:54 +0000 (UTC) Received: (from willy@localhost) by pcw.home.local (8.15.2/8.15.2/Submit) id 24K4LjYV005139; Fri, 20 May 2022 06:21:45 +0200 Date: Fri, 20 May 2022 06:21:45 +0200 From: Willy Tarreau To: Ammar Faizi Cc: "Paul E. McKenney" , Alviro Iskandar Setiawan , Linux Kernel Mailing List , GNU/Weeb Mailing List , Facebook Kernel Team Subject: Re: [PATCH v1 2/2] tools/nolibc/stdio: Add format attribute to enable printf warnings Message-ID: <20220520042145.GD5001@1wt.eu> References: <20220519172116.283687-1-ammarfaizi2@gnuweeb.org> <20220519172116.283687-3-ammarfaizi2@gnuweeb.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220519172116.283687-3-ammarfaizi2@gnuweeb.org> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: On Fri, May 20, 2022 at 12:21:16AM +0700, Ammar Faizi wrote: > From: Alviro Iskandar Setiawan > > When we use printf and fprintf functions from the nolibc, we don't > get any warning from the compiler if we have the wrong arguments. > For example, the following calls will compile silently: > ``` > printf("%s %s\n", "aaa"); > fprintf(stdout, "%s %s\n", "xxx", 1); > ``` > (Note the wrong arguments). > > Those calls are undefined behavior. The compiler can help us warn > about the above mistakes by adding a `printf` format attribute to > those functions declaration. I'm shocked I forgot it, I use it all the time, I'm even seeing this as a bug fix for the series I sent. Thanks for fixing this mistake of mine! Acked-by: Willy Tarreau Willy