linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xfsprogs: fix warnings/errors due to missing include
@ 2022-10-04 18:11 Holger Hoffstätte
  2022-10-04 18:28 ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Holger Hoffstätte @ 2022-10-04 18:11 UTC (permalink / raw)
  To: linux-xfs


Gentoo is currently trying to rebuild the world with clang-16, uncovering exciting
new errors in many packages since several warnings have been turned into errors,
among them missing prototypes, as documented at:
https://discourse.llvm.org/t/clang-16-notice-of-potentially-breaking-changes/65562

xfsprogs came up, with details at https://bugs.gentoo.org/875050.

The problem was easy to find: a missing include for the u_init/u_cleanup
prototypes. The error:

Building scrub
     [CC]     unicrash.o
unicrash.c:746:2: error: call to undeclared function 'u_init'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
         u_init(&uerr);
         ^
unicrash.c:746:2: note: did you mean 'u_digit'?
/usr/include/unicode/uchar.h:4073:1: note: 'u_digit' declared here
u_digit(UChar32 ch, int8_t radix);
^
unicrash.c:754:2: error: call to undeclared function 'u_cleanup'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
         u_cleanup();
         ^
2 errors generated.

The complaint is valid and the fix is easy enough: just add the missing include.

Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>

-- xfsprogs-5.18.0/scrub/unicrash.c	2021-12-13 21:02:19.000000000 +0100
+++ xfsprogs-5.18.0-nowarn/scrub/unicrash.c	2022-10-04 19:46:28.869402900 +0200
@@ -10,6 +10,7 @@
  #include <sys/types.h>
  #include <sys/statvfs.h>
  #include <strings.h>
+#include <unicode/uclean.h>
  #include <unicode/ustring.h>
  #include <unicode/unorm2.h>
  #include <unicode/uspoof.h>


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfsprogs: fix warnings/errors due to missing include
  2022-10-04 18:11 [PATCH] xfsprogs: fix warnings/errors due to missing include Holger Hoffstätte
@ 2022-10-04 18:28 ` Darrick J. Wong
  2022-10-04 18:34   ` Holger Hoffstätte
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2022-10-04 18:28 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: linux-xfs

On Tue, Oct 04, 2022 at 08:11:05PM +0200, Holger Hoffstätte wrote:
> 
> Gentoo is currently trying to rebuild the world with clang-16, uncovering exciting
> new errors in many packages since several warnings have been turned into errors,
> among them missing prototypes, as documented at:
> https://discourse.llvm.org/t/clang-16-notice-of-potentially-breaking-changes/65562
> 
> xfsprogs came up, with details at https://bugs.gentoo.org/875050.
> 
> The problem was easy to find: a missing include for the u_init/u_cleanup
> prototypes. The error:
> 
> Building scrub
>     [CC]     unicrash.o
> unicrash.c:746:2: error: call to undeclared function 'u_init'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>         u_init(&uerr);
>         ^
> unicrash.c:746:2: note: did you mean 'u_digit'?
> /usr/include/unicode/uchar.h:4073:1: note: 'u_digit' declared here
> u_digit(UChar32 ch, int8_t radix);
> ^
> unicrash.c:754:2: error: call to undeclared function 'u_cleanup'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>         u_cleanup();
>         ^
> 2 errors generated.
> 
> The complaint is valid and the fix is easy enough: just add the missing include.
> 
> Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>

Aha, that explains why I kept hearing reports about this but could never
get gcc to spit out this error.  Thanks for fixing this.

Reviewed-by: Darrick J. Wong <djwong@kernel.org>

--D

> 
> -- xfsprogs-5.18.0/scrub/unicrash.c	2021-12-13 21:02:19.000000000 +0100
> +++ xfsprogs-5.18.0-nowarn/scrub/unicrash.c	2022-10-04 19:46:28.869402900 +0200
> @@ -10,6 +10,7 @@
>  #include <sys/types.h>
>  #include <sys/statvfs.h>
>  #include <strings.h>
> +#include <unicode/uclean.h>
>  #include <unicode/ustring.h>
>  #include <unicode/unorm2.h>
>  #include <unicode/uspoof.h>
> 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfsprogs: fix warnings/errors due to missing include
  2022-10-04 18:28 ` Darrick J. Wong
@ 2022-10-04 18:34   ` Holger Hoffstätte
  2022-10-04 18:40     ` Darrick J. Wong
  0 siblings, 1 reply; 5+ messages in thread
From: Holger Hoffstätte @ 2022-10-04 18:34 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On 2022-10-04 20:28, Darrick J. Wong wrote:
> On Tue, Oct 04, 2022 at 08:11:05PM +0200, Holger Hoffstätte wrote:
>>
>> Gentoo is currently trying to rebuild the world with clang-16, uncovering exciting
>> new errors in many packages since several warnings have been turned into errors,
>> among them missing prototypes, as documented at:
>> https://discourse.llvm.org/t/clang-16-notice-of-potentially-breaking-changes/65562
>>
>> xfsprogs came up, with details at https://bugs.gentoo.org/875050.
>>
>> The problem was easy to find: a missing include for the u_init/u_cleanup
>> prototypes. The error:
>>
>> Building scrub
>>      [CC]     unicrash.o
>> unicrash.c:746:2: error: call to undeclared function 'u_init'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>>          u_init(&uerr);
>>          ^
>> unicrash.c:746:2: note: did you mean 'u_digit'?
>> /usr/include/unicode/uchar.h:4073:1: note: 'u_digit' declared here
>> u_digit(UChar32 ch, int8_t radix);
>> ^
>> unicrash.c:754:2: error: call to undeclared function 'u_cleanup'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>>          u_cleanup();
>>          ^
>> 2 errors generated.
>>
>> The complaint is valid and the fix is easy enough: just add the missing include.
>>
>> Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
> 
> Aha, that explains why I kept hearing reports about this but could never
> get gcc to spit out this error.  Thanks for fixing this.

You're welcome. This reproduces with gcc when explicitly enabled:

$CFLAGS="-Werror=implicit-function-declaration -Werror=implicit-int" ./configure

cheers,
Holger

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfsprogs: fix warnings/errors due to missing include
  2022-10-04 18:34   ` Holger Hoffstätte
@ 2022-10-04 18:40     ` Darrick J. Wong
  2022-10-04 18:54       ` Holger Hoffstätte
  0 siblings, 1 reply; 5+ messages in thread
From: Darrick J. Wong @ 2022-10-04 18:40 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: linux-xfs

On Tue, Oct 04, 2022 at 08:34:23PM +0200, Holger Hoffstätte wrote:
> On 2022-10-04 20:28, Darrick J. Wong wrote:
> > On Tue, Oct 04, 2022 at 08:11:05PM +0200, Holger Hoffstätte wrote:
> > > 
> > > Gentoo is currently trying to rebuild the world with clang-16, uncovering exciting
> > > new errors in many packages since several warnings have been turned into errors,
> > > among them missing prototypes, as documented at:
> > > https://discourse.llvm.org/t/clang-16-notice-of-potentially-breaking-changes/65562
> > > 
> > > xfsprogs came up, with details at https://bugs.gentoo.org/875050.
> > > 
> > > The problem was easy to find: a missing include for the u_init/u_cleanup
> > > prototypes. The error:
> > > 
> > > Building scrub
> > >      [CC]     unicrash.o
> > > unicrash.c:746:2: error: call to undeclared function 'u_init'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
> > >          u_init(&uerr);
> > >          ^
> > > unicrash.c:746:2: note: did you mean 'u_digit'?
> > > /usr/include/unicode/uchar.h:4073:1: note: 'u_digit' declared here
> > > u_digit(UChar32 ch, int8_t radix);
> > > ^
> > > unicrash.c:754:2: error: call to undeclared function 'u_cleanup'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
> > >          u_cleanup();
> > >          ^
> > > 2 errors generated.
> > > 
> > > The complaint is valid and the fix is easy enough: just add the missing include.
> > > 
> > > Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
> > 
> > Aha, that explains why I kept hearing reports about this but could never
> > get gcc to spit out this error.  Thanks for fixing this.
> 
> You're welcome. This reproduces with gcc when explicitly enabled:
> 
> $CFLAGS="-Werror=implicit-function-declaration -Werror=implicit-int" ./configure

Huh.  I don't know why my system won't complain.

$ gcc --version
gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
Copyright (C) 2021 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is
NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.

$ gcc -Wall -g -O3 -fstack-protector --param=ssp-buffer-size=4
-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_FILE_OFFSET_BITS=64
-Wno-address-of-packed-member -femit-struct-debug-detailed=any
-Wno-error=unused-but-set-variable -Wuninitialized -Wno-pointer-sign
-Wall -Wextra -Wno-unused-parameter -fstack-usage -Werror
-Wno-sign-compare -Wno-missing-field-initializers -Wmaybe-uninitialized
-Wno-error=unused-function -Wno-error=unused-variable
-Wno-error=maybe-uninitialized -Werror=implicit-function-declaration
-Werror=implicit-int   -g -O2 -DDEBUG
-DVERSION=\"6.1.0-rc0~WIP-2022-10-03\" -DLOCALEDIR=\"/usr/share/locale\"
-DPACKAGE=\"xfsprogs\" -I../include -I../libxfs -I.. -D_LGPL_SOURCE
-D_GNU_SOURCE -funsigned-char -fno-strict-aliasing -Wall -Werror -Wextra
-Wno-unused-parameter -DHAVE_MNTENT -DHAVE_FSETXATTR -DENABLE_BLKID
-DHAVE_GETFSMAP -DHAVE_GETFSREFCOUNTS -DHAVE_FALLOCATE
-DHAVE_LIBURCU_ATOMIC64 -DHAVE_MALLINFO -DHAVE_MALLINFO2 -DHAVE_SYNCFS
-DHAVE_LIBATTR -DHAVE_LIBICU  -DHAVE_SG_IO -DHAVE_HDIO_GETGEO -c
unicrash.c
$

--D
> 
> cheers,
> Holger

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] xfsprogs: fix warnings/errors due to missing include
  2022-10-04 18:40     ` Darrick J. Wong
@ 2022-10-04 18:54       ` Holger Hoffstätte
  0 siblings, 0 replies; 5+ messages in thread
From: Holger Hoffstätte @ 2022-10-04 18:54 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: linux-xfs

On 2022-10-04 20:40, Darrick J. Wong wrote:
> On Tue, Oct 04, 2022 at 08:34:23PM +0200, Holger Hoffstätte wrote:
>> On 2022-10-04 20:28, Darrick J. Wong wrote:
>>> On Tue, Oct 04, 2022 at 08:11:05PM +0200, Holger Hoffstätte wrote:
>>>>
>>>> Gentoo is currently trying to rebuild the world with clang-16, uncovering exciting
>>>> new errors in many packages since several warnings have been turned into errors,
>>>> among them missing prototypes, as documented at:
>>>> https://discourse.llvm.org/t/clang-16-notice-of-potentially-breaking-changes/65562
>>>>
>>>> xfsprogs came up, with details at https://bugs.gentoo.org/875050.
>>>>
>>>> The problem was easy to find: a missing include for the u_init/u_cleanup
>>>> prototypes. The error:
>>>>
>>>> Building scrub
>>>>       [CC]     unicrash.o
>>>> unicrash.c:746:2: error: call to undeclared function 'u_init'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>>>>           u_init(&uerr);
>>>>           ^
>>>> unicrash.c:746:2: note: did you mean 'u_digit'?
>>>> /usr/include/unicode/uchar.h:4073:1: note: 'u_digit' declared here
>>>> u_digit(UChar32 ch, int8_t radix);
>>>> ^
>>>> unicrash.c:754:2: error: call to undeclared function 'u_cleanup'; ISO C99 and later do not support implicit function declarations [-Werror,-Wimplicit-function-declaration]
>>>>           u_cleanup();
>>>>           ^
>>>> 2 errors generated.
>>>>
>>>> The complaint is valid and the fix is easy enough: just add the missing include.
>>>>
>>>> Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
>>>
>>> Aha, that explains why I kept hearing reports about this but could never
>>> get gcc to spit out this error.  Thanks for fixing this.
>>
>> You're welcome. This reproduces with gcc when explicitly enabled:
>>
>> $CFLAGS="-Werror=implicit-function-declaration -Werror=implicit-int" ./configure
> 
> Huh.  I don't know why my system won't complain.
> 
> $ gcc --version
> gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0
> Copyright (C) 2021 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is
> NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
> PURPOSE.
> 
> $ gcc -Wall -g -O3 -fstack-protector --param=ssp-buffer-size=4
> -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=3 -D_FILE_OFFSET_BITS=64
> -Wno-address-of-packed-member -femit-struct-debug-detailed=any
> -Wno-error=unused-but-set-variable -Wuninitialized -Wno-pointer-sign
> -Wall -Wextra -Wno-unused-parameter -fstack-usage -Werror
> -Wno-sign-compare -Wno-missing-field-initializers -Wmaybe-uninitialized
> -Wno-error=unused-function -Wno-error=unused-variable
> -Wno-error=maybe-uninitialized -Werror=implicit-function-declaration
> -Werror=implicit-int   -g -O2 -DDEBUG
> -DVERSION=\"6.1.0-rc0~WIP-2022-10-03\" -DLOCALEDIR=\"/usr/share/locale\"
> -DPACKAGE=\"xfsprogs\" -I../include -I../libxfs -I.. -D_LGPL_SOURCE
> -D_GNU_SOURCE -funsigned-char -fno-strict-aliasing -Wall -Werror -Wextra
> -Wno-unused-parameter -DHAVE_MNTENT -DHAVE_FSETXATTR -DENABLE_BLKID
> -DHAVE_GETFSMAP -DHAVE_GETFSREFCOUNTS -DHAVE_FALLOCATE
> -DHAVE_LIBURCU_ATOMIC64 -DHAVE_MALLINFO -DHAVE_MALLINFO2 -DHAVE_SYNCFS
> -DHAVE_LIBATTR -DHAVE_LIBICU  -DHAVE_SG_IO -DHAVE_HDIO_GETGEO -c
> unicrash.c
> $

holger>gcc --version
gcc (Gentoo 12.2.0 p1) 12.2.0
..
holger>cd /tmp
holger>tar xf /var/cache/distfiles/xfsprogs-5.18.0.tar.xz
holger>cd xfsprogs-5.18.0
holger>CFLAGS="-pipe -O2 -Werror=implicit-function-declaration -Werror=implicit-int" ./configure && make -j8
...
     [CC]     unicrash.o
unicrash.c: In function 'unicrash_load':
unicrash.c:746:9: error: implicit declaration of function 'u_init'; did you mean 'u_digit'? [-Werror=implicit-function-declaration]
   746 |         u_init(&uerr);
       |         ^~~~~~
       |         u_digit
unicrash.c: In function 'unicrash_unload':
unicrash.c:754:9: error: implicit declaration of function 'u_cleanup'; did you mean 'scrub_cleanup'? [-Werror=implicit-function-declaration]
   754 |         u_cleanup();
       |         ^~~~~~~~~
       |         scrub_cleanup
     [CC]     link.o
     [CC]     mmap.o
     [SED]    xfs_scrub_all
     [CC]     open.o
     [SED]    xfs_scrub_all.cron
     [CC]     parent.o
cc1: some warnings being treated as errors

Alternatively add CC=clang to the configure line and check out the other
nice warnings as well. :)

cheers
Holger

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-10-04 18:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-04 18:11 [PATCH] xfsprogs: fix warnings/errors due to missing include Holger Hoffstätte
2022-10-04 18:28 ` Darrick J. Wong
2022-10-04 18:34   ` Holger Hoffstätte
2022-10-04 18:40     ` Darrick J. Wong
2022-10-04 18:54       ` Holger Hoffstätte

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).