Re: Bug#1121240: libhdf4: FTBFS on armhf (-Wincompatible-pointer-types)

Sebastiaan Couwenberg <[email protected]>
Newsgroups gmane.linux.debian.ports.arm
Message-ID <[email protected]>
Hi Emanuelle,

Thanks for helping fix this FTBFS on armhf.

On 3/4/26 9:49 AM, Emanuele Rocca wrote:
> On 2025-11-23 04:33, Sebastiaan Couwenberg wrote:
>> Making this a warning with following does not resolve the FTBFS:
>>
>>   ifneq (,$(filter $(DEB_BUILD_ARCH),armhf))
>>   export DEB_CFLAGS_MAINT_APPEND = -Wno-error=incompatible-pointer-types
>>   endif
>>
>> It then fails due to:
>>
>>   array.c:399:21: error: too many arguments to function 'xlen_funct'; expected 0, have 1
>>     399 |             len += (*xlen_funct)(vp);
>>         |                    ~^~~~~~~~~~~~ ~~
>>
> 
> The prototype of xlen_funct has no arguments defined. In C23 declaring a
> function as int foo() is equivalent as declaring that it takes no
> argument, hence calling it with arguments becomes an error. See:
> https://en.wikipedia.org/wiki/C23_(C_standard_revision)#Syntax

Upstream likely does that because the functions xlen_funct can be set to have different arguments:

  mfhdf/libsrc/nc_priv.h:HDFLIBAPI int NC_xlen_attr(NC_attr **app);
  mfhdf/libsrc/nc_priv.h:HDFLIBAPI int NC_xlen_dim(NC_dim **dpp);
  mfhdf/libsrc/nc_priv.h:HDFLIBAPI int NC_xlen_string(NC_string *cdfstr);
  mfhdf/libsrc/nc_priv.h:HDFLIBAPI int NC_xlen_var(NC_var **vpp);
  mfhdf/libsrc/array.c:                xlen_funct = NC_xlen_string;
  mfhdf/libsrc/array.c:                xlen_funct = NC_xlen_dim;
  mfhdf/libsrc/array.c:                xlen_funct = NC_xlen_var;
  mfhdf/libsrc/array.c:                xlen_funct = NC_xlen_attr;

> You can either fix the code or tell the compiler to stick to older
> versions of the standard, something like:
> 
>    export DEB_CFLAGS_MAINT_APPEND += -std=c17

This is confirmed to fix the FTBFS with GCC 15 on the armhf porterbox.

Kind Regards,

Bas
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.