Re: [RFC PATCH] Add -Werror flag when building GNU/HURD.
Bradley Morgan <[email protected]> Tue, 28 Jul 2026 11:38:21 +0100
| Newsgroups | gmane.os.hurd.bugs |
|---|---|
| Message-ID | <[email protected]> |
On 28 July 2026 11:31:23 BST, Mikhail Karpov <[email protected]> wrote: >Hello, > >When compiling GNU/Hurd, quite a few warnings were generated. I fixed some >of >them, and now it compiles with flags: >CFLAGS += -std=gnu99 $(gnu89-inline-CFLAGS) -Wall -Werror \ > -Werror=old-style-definition \ > -Werror=implicit-function-declaration \ > -Werror=strict-prototypes \ > -g -O3 -fno-strict-aliasing $($*-CFLAGS) >Completes successfully. > >I have a few questions: >1. Is this flag even necessary? >2. Should I remove the -fno-strict-aliasing flag? I didn't remove it, so >the > -Wstrict-aliasing warnings are ignored. >3. Should I add the -Wextra flag? > >I agree that warnings are sometimes annoying, but I believe that catching >a >real error at compile time can save a lot of time searching for it in the >code. However, I'd still like to hear people's opinions on this matter. > >Now on to the patches. >I'm not sure about some of them, and they probably require more time to >study. For example, in pfinet/linux-src/include/linux/in_route.h there was >#define RTCF_NAT (RTCF_DNAT|RTCF_SNAT) (0x08000000|0x00800000), but >previously in tools-i686/include/net/route.h there was also #define >RTCF_NAT >0x00800000. The same problem occurs with #define NET_MAX_FILTER 512 from >libbpf/bpf_impl.h and #define NET_MAX_FILTER 128 from >tools-i686/include/device/net_status.h. > >I simply removed unused variables and moved unused functions to #if 0. > >pfinet encountered a false-positive warning -Werror=array-bounds in the >queue >handling functions. I couldn't find a simple solution, so I simply added >-Wno-array-bounds to the pfinet Makefile. > >And a few places that were unclear to me: >The -Werror=maybe-uninitialized warning was in >pfinet/linux-src/net/ipv4/igmp.c because im->loaded = 0 was only set >within >CONFIG_IP_MULTICAST, and the igmp_group_added function checked im->loaded >for 0 when it was called. >The -Werror=address warning was in pfinet/linux-src/net/ipv4/devinet.c >because ifa->ifa_label is an array, not a pointer, so the if >(ifa->ifa_label) >condition is always true. I removed this check and left only >strcpy(ifr.ifr_name, ifa->ifa_label). >The Werror=shift-overflow warning was in the libps/ps.h file: #define >PSTAT_USER_BASE 0x20000000, and #define W_PSTAT_LOGIN (PSTAT_USER_BASE << >3), >so the result didn't fit into the int type. I added the ULL suffix to >0x20000000 and that solved the problem. > >The fixing-structure-declaration-inside-parameter-list.patch patch applies >to >the libtirpc-1.3.6/tirpc/rpc/rpc_msg.h file. It must be applied >separately. > >Thanks, > > Hi, Where's the patch? Adding -WError is relatively a non issue, (as the user could build with W1,or W128 if they are feeling crazy) Forcing the user to build with warnings as errors makes the build(er) responsible for fixing someone elses BS If I see the patch, I'll have a look 😀 Thanks!