Skip to content

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

@Bill-Sommerfeld

Description

@Bill-Sommerfeld

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.,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions