[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1114148: hplip: FTBFS: scan/sane/ledm.c:860:11: error: too many arguments to function 'bb_is_paper_in_adf'; expected 0, have 1



Control: forwarded -1 https://bugs.launchpad.net/hplip/+bug/2096650
Control: tags -1 + patch

On Fri, Sep 05, 2025 at 06:18:28PM +0000, Santiago Vila wrote:
> Package: src:hplip
> Version: 3.22.10+dfsg0-8.1
> Severity: serious
> Tags: ftbfs forky sid[B
> 
> Dear maintainer:
> 
> During a rebuild of all packages in unstable, your package failed to build.
...
> scan/sane/ledm.c: In function 'ledm_start':
> scan/sane/ledm.c:860:11: error: too many arguments to function 'bb_is_paper_in_adf'; expected 0, have 1
>   860 |     ret = bb_is_paper_in_adf(ps);   /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
>       |           ^~~~~~~~~~~~~~~~~~ ~~
> In file included from scan/sane/ledm.c:42:
> scan/sane/ledmi.h:165:5: note: declared here
>   165 | int bb_is_paper_in_adf();         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
>       |     ^~~~~~~~~~~~~~~~~~

Hi, this seems to be yet another C23 issue, with hplip failing to build
with C23 because of more strict data type checks.

In this case, prototype has bb_is_paper_in_adf(), but for C23 () in
function prototype means (void) and only (void), while could
previously mean that details will go later. This results in either of

 error: too many arguments to function 'bb_is_paper_in_adf'; expected 0, have 1"
 error: conflicting types for 'bb_is_paper_in_adf'; have 'int(struct ledm_session *)'

This has been reported upstream by Zdenek Dohnal from redhat (bug
report marked as forwarded), who added a proposed patch. I am attaching
his patch and a more commented one (with the same diff) created with
git format-patch.

I tried patch in my test box and after the usual git-debrebase
commands package builds with it.

Regards,

-- 
Agustin
diff --git a/scan/sane/ledmi.h b/scan/sane/ledmi.h
index a987c5d..f72847b 100644
--- a/scan/sane/ledmi.h
+++ b/scan/sane/ledmi.h
@@ -162,7 +162,7 @@ struct ledm_session
 int bb_open(struct ledm_session*);
 int bb_close(struct ledm_session*);
 int bb_get_parameters(struct ledm_session*, SANE_Parameters*, int);
-int bb_is_paper_in_adf();         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
+int bb_is_paper_in_adf(struct ledm_session*);         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
 SANE_Status bb_start_scan(struct ledm_session*);
 int bb_get_image_data(struct ledm_session*, int); 
 int bb_end_page(struct ledm_session*, int);
>From 77a9d2dc243e0ed123ae0d6adcc80852cf21741d Mon Sep 17 00:00:00 2001
From: Zdenek Dohnal <zdohnal@redhat.com>
Date: Sun, 19 Oct 2025 23:52:05 +0200
Subject: [PATCH] scan/sane/ledmi.h: Fix hplip does not build with GCC 15 and
 -std=c23

hplip fails to build with C23 because it has more strict data type checks.

hplip has one function prototype which does not show any arguments - `()`
but there are arguments in the function definition.

This is not allowed by C23 where () in function prototype means (void)
and only (void), while could previously mean that details will go later.
---
 scan/sane/ledmi.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scan/sane/ledmi.h b/scan/sane/ledmi.h
index a987c5d4..f72847bd 100644
--- a/scan/sane/ledmi.h
+++ b/scan/sane/ledmi.h
@@ -162,7 +162,7 @@ struct ledm_session
 int bb_open(struct ledm_session*);
 int bb_close(struct ledm_session*);
 int bb_get_parameters(struct ledm_session*, SANE_Parameters*, int);
-int bb_is_paper_in_adf();         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
+int bb_is_paper_in_adf(struct ledm_session*);         /* 0 = no paper in adf, 1 = paper in adf, -1 = error */
 SANE_Status bb_start_scan(struct ledm_session*);
 int bb_get_image_data(struct ledm_session*, int); 
 int bb_end_page(struct ledm_session*, int);
-- 
2.51.0


Reply to: