slimserver-vendor icon indicating copy to clipboard operation
slimserver-vendor copied to clipboard

IO-Interface-1.06: -Wimplicit-function-declaration error on openindiana with gcc 14

Open Bill-Sommerfeld opened this issue 11 months ago • 1 comments

On a system running a recent version of the OpenIndiana distribution of illumos (with perl 5.40 built with gcc-14), CPAN/buildme.sh fails with:

/usr/gcc/14/bin/gcc -m64 -c    -D_REENTRANT -fwrapv -fno-strict-aliasing -pipe -fstack-protector-strong -m64 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_FORTIFY_SOURCE=2 -O3    -DVERSION=\"1.06\"  -DXS_VERS\
ION=\"1.06\" -fPIC "-I/usr/perl5/5.40/lib/i86pc-solaris-thread-multi-64/CORE"  -DUSE_GETIFADDRS -DHAVE_SOCKADDR_DL_STRUCT Interface.c
Interface.xs: In function 'XS_IO__Interface_if_addr':
Interface.xs:422:8: error: implicit declaration of function 'bzero' [-Wimplicit-function-declaration]
  422 |        bzero((void*)&ifr,sizeof(struct ifreq));
      |        ^~~~~
Interface.xs:422:8: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
Interface.xs: In function 'XS_IO__Interface_if_broadcast':
Interface.xs:461:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  461 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_netmask':
Interface.xs:499:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  499 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_dstaddr':
Interface.xs:537:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  537 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_flags':
Interface.xs:653:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  653 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_mtu':
Interface.xs:685:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  685 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
Interface.xs: In function 'XS_IO__Interface_if_metric':
Interface.xs:717:6: warning: incompatible implicit declaration of built-in function 'bzero' [-Wbuiltin-declaration-mismatch]
  717 |      bzero((void*)&ifr,sizeof(struct ifreq));
      |      ^~~~~
*** Error code 1
make: Fatal error: Command failed for target `Interface.o'

I did not see this failure on an earlier OpenIndiana with perl 5.38 built with gcc-13; this behavior appears to be new with gcc 14 and could potentially affect other platforms.

I patched around it by adding #include <strings.h> to Interface.xs.

Looking upstream in CPAN, there is now an IO::Interface 1.09 which adds an include of <string.h> but that doesn't have bzero on illumos (I believe XPG expects it it in <strings.h>); it also doesn't build as-is on OpenIndiana either with the same error.

It would seem most appropriate to replace bzero(x,y) with the more-portable memset(x,0,y).

Will happily provide a pull request but I'm new to LMS -- not sure what this project's preferences are in terms of tracking newer versions in CPAN, etc.,

Bill-Sommerfeld avatar Jan 24 '25 20:01 Bill-Sommerfeld