Skip to contentSkip to conversation

bridge/vlan.c: fix build with gcc 14 on musl systems

PATCH Superseded Gabi Falk 2 participants 3 messages May 10, 2024 – May 14, 2024

Subsystems (2)
lore
Share & tools
lore

Gabi Falk

author
#0 lore raw

PATCH 1/1 bridge/vlan.c: fix build with gcc 14 on musl systems

On glibc based systems the definition of 'struct timeval' is pulled in with inclusion of <stdlib.h> header, but on musl based systems it doesn't work this way. Missing definition triggers an incompatible-pointer-types error with gcc 14 (warning on previous versions of gcc):

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
80 | _PRINT_FUNC(tv, const struct timeval *)
| ^~~~~~~
../include/json_print.h:50:37: note: in definition of macro '_PRINT_FUNC'

   50 |                                     type value);                        \
      |                                     ^~~~

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
80 | _PRINT_FUNC(tv, const struct timeval *)
| ^~~~~~~
../include/json_print.h:55:45: note: in definition of macro '_PRINT_FUNC'

   55 |                                             type value)                 \
      |                                             ^~~~
../include/json_print.h: In function 'print_tv':
../include/json_print.h:58:48: error: passing argument 5 of 'print_color_tv' from incompatible pointer type [-Wincompatible-pointer-types]
   58 |                                                value);                  \
      |                                                ^~~~~
      |                                                |
      |                                                const struct timeval *
---
 bridge/vlan.c | 1 +
 1 file changed, 1 insertion(+)
bridge/vlan.c +1 -0
index 5352eb24..0a7e6c45 100644
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <linux/if_bridge.h>

--
gabi

author
#1 lore raw

PATCH v2 1/1 bridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl systems

On glibc based systems the definition of 'struct timeval' is pulled in with inclusion of <stdlib.h> header, but on musl based systems it doesn't work this way. Missing definition triggers an incompatible-pointer-types error with gcc 14 (warning on previous versions of gcc):

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
80 | _PRINT_FUNC(tv, const struct timeval *)
| ^~~~~~~
../include/json_print.h:50:37: note: in definition of macro '_PRINT_FUNC'

   50 |                                     type value);                        \
      |                                     ^~~~

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
80 | _PRINT_FUNC(tv, const struct timeval *)
| ^~~~~~~
../include/json_print.h:55:45: note: in definition of macro '_PRINT_FUNC'

   55 |                                             type value)                 \
      |                                             ^~~~
../include/json_print.h: In function 'print_tv':
../include/json_print.h:58:48: error: passing argument 5 of 'print_color_tv' from incompatible pointer type [-Wincompatible-pointer-types]
   58 |                                                value);                  \
      |                                                ^~~~~
      |                                                |
      |                                                const struct timeval *
---
 bridge/vlan.c | 1 +
 bridge/vni.c  | 1 +
 vdpa/vdpa.c   | 1 +
 3 files changed, 3 insertions(+)
bridge/vlan.c +1 -0
index 5352eb24..0a7e6c45 100644
@@ -4,6 +4,7 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <linux/if_bridge.h>
bridge/vni.c +1 -0
index a7abe6de..e1f981fc 100644
@@ -10,6 +10,7 @@
 #include <string.h>
 #include <fcntl.h>
 #include <sys/socket.h>
+#include <sys/time.h>
 #include <net/if.h>
 #include <netinet/in.h>
 #include <linux/if_link.h>
vdpa/vdpa.c +1 -0
index 6e4a9c11..43f87824 100644
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <getopt.h>
 #include <errno.h>
+#include <sys/time.h>
 #include <linux/genetlink.h>
 #include <linux/if_ether.h>
 #include <linux/vdpa.h>

--
gabi

#2 lore raw

Re: [PATCH v2 iproute2] bridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl systems

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Hello:

This patch was applied to iproute2/iproute2.git (main) by Stephen Hemminger <[email protected]>:

Quoted 25 lines · On Fri, 10 May 2024 14:36:12 +0000 you wrote:

On glibc based systems the definition of 'struct timeval' is pulled in with inclusion of <stdlib.h> header, but on musl based systems it doesn't work this way. Missing definition triggers an incompatible-pointer-types error with gcc 14 (warning on previous versions of gcc):

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
80 | _PRINT_FUNC(tv, const struct timeval *)
| ^~~~~~~
../include/json_print.h:50:37: note: in definition of macro '_PRINT_FUNC'

   50 |                                     type value);                        \
      |                                     ^~~~

../include/json_print.h:80:30: warning: 'struct timeval' declared inside parameter list will not be visible outside of this definition or declaration
80 | _PRINT_FUNC(tv, const struct timeval *)
| ^~~~~~~
../include/json_print.h:55:45: note: in definition of macro '_PRINT_FUNC'

   55 |                                             type value)                 \
      |                                             ^~~~
../include/json_print.h: In function 'print_tv':
../include/json_print.h:58:48: error: passing argument 5 of 'print_color_tv' from incompatible pointer type [-Wincompatible-pointer-types]
   58 |                                                value);                  \
      |                                                ^~~~~
      |                                                |
      |                                                const struct timeval *
Quoted 1 line

[...]

Here is the summary with links:
- [v2,iproute2] bridge/vlan.c: bridge/vlan.c: fix build with gcc 14 on musl systems

    https://git.kernel.org/pub/scm/network/iproute2/iproute2.git/commit/?id=53a89bfd86ff

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html