[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220520042145.GD5001@1wt.eu>
Date: Fri, 20 May 2022 06:21:45 +0200
From: Willy Tarreau <w@....eu>
To: Ammar Faizi <ammarfaizi2@...weeb.org>
Cc: "Paul E. McKenney" <paulmck@...nel.org>,
Alviro Iskandar Setiawan <alviro.iskandar@...weeb.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
GNU/Weeb Mailing List <gwml@...r.gnuweeb.org>,
Facebook Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v1 2/2] tools/nolibc/stdio: Add format attribute to
enable printf warnings
On Fri, May 20, 2022 at 12:21:16AM +0700, Ammar Faizi wrote:
> From: Alviro Iskandar Setiawan <alviro.iskandar@...weeb.org>
>
> 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 <w@....eu>
Willy
Powered by blists - more mailing lists