Messages in this thread | | | Date | Fri, 20 May 2022 06:21:45 +0200 | From | Willy Tarreau <> | 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@gnuweeb.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@1wt.eu>
Willy
| |