libio: Add __nonnull for FILE * arguments of fclose and freopen
commit71d9e0fe766a3c22a730995b9d024960970670af
authorXi Ruoyao <xry111@xry111.site>
Fri, 21 Apr 2023 06:21:33 +0000 (21 14:21 +0800)
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>
Tue, 16 May 2023 09:56:32 +0000 (16 06:56 -0300)
treebbf0973cd973a5195a1126aa46f9ea800309f4a9
parentbea1a4a77305cef90dac47b873bd9f01a6409c22
libio: Add __nonnull for FILE * arguments of fclose and freopen

Calling fclose or freopen with a null FILE * is undefined behavior, and
doing so in practice will cause a SIGSEGV.  So it seems suitable for
__nonnull.

This will help the compiler to warn for some buggy code, like
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109570.
Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
libio/stdio.h