Skip to contentSkip to conversation

libiodbc: fix build with gcc-15.0.1

PATCH Superseded [email protected] 2 participants 2 messages Apr 3, 2025

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libiodbc: fix build with gcc-15.0.1

From: "mark.yang" <[email protected]>

* GCC 15 considers it an error to pass arguments to a function pointer defined to take no arguments. This results in a 'too many arguments to function' error.

At the problematic function pointer call sites, the pointer is cast to a variadic function pointer type (SQLRETURN (*)(...)) to avoid the error.

* see more details in http://errors.yoctoproject.org/Errors/Details/850317
../../libiodbc-3.52.16/iodbc/hdbc.c: In function '_iodbcdm_SetConnectOption':
../../libiodbc-3.52.16/iodbc/hdbc.c:567:49: error: too many arguments to function 'hproc3'; expected 0, have 4

  567 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
      |                                                 ^~~~~~
  568 |                   (pdbc->dhdbc, fOption, vParam, 0));
      |                    ~~~~~~~~~~~

../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
113 | ret = proc plist; \
| ^~~~
../../libiodbc-3.52.16/iodbc/hdbc.c:583:49: error: too many arguments to function 'hproc3'; expected 0, have 4

  583 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
      |                                                 ^~~~~~
  584 |                   (pdbc->dhdbc, fOption, vParam, SQL_NTS));
      |                    ~~~~~~~~~~~

../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
113 | ret = proc plist; \
| ^~~~
../../libiodbc-3.52.16/iodbc/hdbc.c:597:45: error: too many arguments to function 'hproc2'; expected 0, have 3

  597 |           CALL_DRIVER (hdbc, pdbc, retcode, hproc2,
      |                                             ^~~~~~
  598 |               (pdbc->dhdbc, fOption, vParam));
      |                ~~~~~~~~~~~

....

../../libiodbc-3.52.16/iodbc/connect.c:2970:19: error: too many arguments to function 'dialproc'; expected 0, have 6
2970 | retcode = dialproc (hwnd, /* window or display handle */

      |                   ^~~~~~~~  ~~~~
---
 ...cc-15.0.1-too-many-arguments-to-func.patch | 73 +++++++++++++++++++
 .../libiodbc/libiodbc_3.52.16.bb              |  5 +-
 2 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/libiodbc/libiodbc/0001-fix-build-with-gcc-15.0.1-too-many-arguments-to-func.patch
meta-oe/recipes-support/libiodbc/libiodbc/0001-fix-build-with-gcc-15.0.1-too-many-arguments-to-func.patch new file +73 -0
new file mode 100644
index 0000000000..54b966dca1
@@ -0,0 +1,73 @@
+From f7529bffc8648a192bd98da0883b94ba86e7d2b6 Mon Sep 17 00:00:00 2001
+From: "mark.yang" <[email protected]>
+Date: Thu, 3 Apr 2025 17:45:26 +0900
+Subject: [PATCH] fix build with gcc-15.0.1 too many arguments to function
+ error
+
+* GCC 15 considers it an error to pass arguments to a function pointer
+  defined to take no arguments. This results in a 'too many arguments to function' error.
+
+  At the problematic function pointer call sites, the pointer is cast to a variadic function pointer type (SQLRETURN (*)(...)) to avoid the error.
+
+* see more details in http://errors.yoctoproject.org/Errors/Details/850317
+../../libiodbc-3.52.16/iodbc/hdbc.c: In function '_iodbcdm_SetConnectOption':
+../../libiodbc-3.52.16/iodbc/hdbc.c:567:49: error: too many arguments to function 'hproc3'; expected 0, have 4
+  567 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
+      |                                                 ^~~~~~
+  568 |                   (pdbc->dhdbc, fOption, vParam, 0));
+      |                    ~~~~~~~~~~~
+../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
+  113 |         ret = proc plist; \
+      |               ^~~~
+../../libiodbc-3.52.16/iodbc/hdbc.c:583:49: error: too many arguments to function 'hproc3'; expected 0, have 4
+  583 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
+      |                                                 ^~~~~~
+  584 |                   (pdbc->dhdbc, fOption, vParam, SQL_NTS));
+      |                    ~~~~~~~~~~~
+../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
+  113 |         ret = proc plist; \
+      |               ^~~~
+../../libiodbc-3.52.16/iodbc/hdbc.c:597:45: error: too many arguments to function 'hproc2'; expected 0, have 3
+  597 |           CALL_DRIVER (hdbc, pdbc, retcode, hproc2,
+      |                                             ^~~~~~
+  598 |               (pdbc->dhdbc, fOption, vParam));
+      |                ~~~~~~~~~~~
+....
+
+../../libiodbc-3.52.16/iodbc/connect.c:2970:19: error: too many arguments to function 'dialproc'; expected 0, have 6
+ 2970 |         retcode = dialproc (hwnd,       /* window or display handle */
+      |                   ^~~~~~~~  ~~~~
+
+Upstream-Status: Submitted [https://github.com/openlink/iODBC/pull/111]
+Signed-off-by: mark.yang <[email protected]>
+---
+ iodbc/connect.c | 2 +-
+ iodbc/itrace.h  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/iodbc/connect.c b/iodbc/connect.c
+index 632827f..1259516 100644
+--- a/iodbc/connect.c
++++ b/iodbc/connect.c
+@@ -2967,7 +2967,7 @@ SQLDriverConnect_Internal (
+             prov[size/sizeof(SQLWCHAR)] = L'\0';
+           }
+ 
+-        retcode = dialproc (hwnd,	/* window or display handle */
++        retcode = ((SQLRETURN (*)(...))dialproc) (hwnd,	/* window or display handle */
+           prov,		        /* input/output dsn buf */
+           sizeof (prov) / (waMode == 'A' ? 1 : sizeof (SQLWCHAR)), /* buf size */
+           &sqlstat,		/* error code */
+diff --git a/iodbc/itrace.h b/iodbc/itrace.h
+index 508359d..f3e6926 100644
+--- a/iodbc/itrace.h
++++ b/iodbc/itrace.h
+@@ -110,7 +110,7 @@ extern int ODBCSharedTraceFlag;
+ \
+ 	if (!t_penv->thread_safe) MUTEX_LOCK (t_penv->drv_lock); \
+ \
+-	ret = proc plist; \
++	ret = ((SQLRETURN (*)(...))proc) plist; \
+ 	if (errHandle) ((GENV_t *)(errHandle))->rc = ret; \
+ \
+ 	if (!t_penv->thread_safe) MUTEX_UNLOCK (t_penv->drv_lock); \
meta-oe/recipes-support/libiodbc/libiodbc_3.52.16.bb +4 -1
index 644c3ba07b..0d2d9d5f97 100644
@@ -12,7 +12,10 @@ LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=8c0138a8701f0e1282f5c8b2c7d39114 \
                     file://LICENSE.BSD;md5=5b36348a404e1d65b57df8d33fd6e414 \
                     "
 
-SRC_URI = "https://github.com/openlink/iODBC/releases/download/v${PV}/${BP}.tar.gz"
+SRC_URI = " \
+	https://github.com/openlink/iODBC/releases/download/v${PV}/${BP}.tar.gz \
+	file://0001-fix-build-with-gcc-15.0.1-too-many-arguments-to-func.patch \
+"
 SRC_URI[sha256sum] = "3898b32d07961360f6f2cf36db36036b719a230e476469258a80f32243e845fa"
 
 UPSTREAM_CHECK_URI = "https://github.com/openlink/iODBC/releases"
#1 lore raw

This fails when building with clang

../../libiodbc-3.52.16/iodbc/hstmt.c:579:7: error: ISO C requires a named parameter before '...'

Quoted 146 lines · mark.yang via lists.openembedded.org

From: "mark.yang" <[email protected]>

* GCC 15 considers it an error to pass arguments to a function pointer defined to take no arguments. This results in a 'too many arguments to function' error.

At the problematic function pointer call sites, the pointer is cast to a variadic function pointer type (SQLRETURN (*)(...)) to avoid the error.

* see more details in http://errors.yoctoproject.org/Errors/Details/850317
../../libiodbc-3.52.16/iodbc/hdbc.c: In function '_iodbcdm_SetConnectOption':
../../libiodbc-3.52.16/iodbc/hdbc.c:567:49: error: too many arguments to function 'hproc3'; expected 0, have 4

  567 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
      |                                                 ^~~~~~
  568 |                   (pdbc->dhdbc, fOption, vParam, 0));
      |                    ~~~~~~~~~~~

../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
113 | ret = proc plist; \
| ^~~~
../../libiodbc-3.52.16/iodbc/hdbc.c:583:49: error: too many arguments to function 'hproc3'; expected 0, have 4

  583 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
      |                                                 ^~~~~~
  584 |                   (pdbc->dhdbc, fOption, vParam, SQL_NTS));
      |                    ~~~~~~~~~~~

../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
113 | ret = proc plist; \
| ^~~~
../../libiodbc-3.52.16/iodbc/hdbc.c:597:45: error: too many arguments to function 'hproc2'; expected 0, have 3

  597 |           CALL_DRIVER (hdbc, pdbc, retcode, hproc2,
      |                                             ^~~~~~
  598 |               (pdbc->dhdbc, fOption, vParam));
      |                ~~~~~~~~~~~

....

../../libiodbc-3.52.16/iodbc/connect.c:2970:19: error: too many arguments to function 'dialproc'; expected 0, have 6
2970 | retcode = dialproc (hwnd, /* window or display handle */

      |                   ^~~~~~~~  ~~~~
---
 ...cc-15.0.1-too-many-arguments-to-func.patch | 73 +++++++++++++++++++
 .../libiodbc/libiodbc_3.52.16.bb              |  5 +-
 2 files changed, 77 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/libiodbc/libiodbc/0001-fix-build-with-gcc-15.0.1-too-many-arguments-to-func.patch
meta-oe/recipes-support/libiodbc/libiodbc/0001-fix-build-with-gcc-15.0.1-too-many-arguments-to-func.patch new file +73 -0
new file mode 100644
index 0000000000..54b966dca1
@@ -0,0 +1,73 @@
+From f7529bffc8648a192bd98da0883b94ba86e7d2b6 Mon Sep 17 00:00:00 2001
+From: "mark.yang" <[email protected]>
+Date: Thu, 3 Apr 2025 17:45:26 +0900
+Subject: [PATCH] fix build with gcc-15.0.1 too many arguments to function
+ error
+
+* GCC 15 considers it an error to pass arguments to a function pointer
+  defined to take no arguments. This results in a 'too many arguments to function' error.
+
+  At the problematic function pointer call sites, the pointer is cast to a variadic function pointer type (SQLRETURN (*)(...)) to avoid the error.
+
+* see more details in http://errors.yoctoproject.org/Errors/Details/850317
+../../libiodbc-3.52.16/iodbc/hdbc.c: In function '_iodbcdm_SetConnectOption':
+../../libiodbc-3.52.16/iodbc/hdbc.c:567:49: error: too many arguments to function 'hproc3'; expected 0, have 4
+  567 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
+      |                                                 ^~~~~~
+  568 |                   (pdbc->dhdbc, fOption, vParam, 0));
+      |                    ~~~~~~~~~~~
+../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
+  113 |         ret = proc plist; \
+      |               ^~~~
+../../libiodbc-3.52.16/iodbc/hdbc.c:583:49: error: too many arguments to function 'hproc3'; expected 0, have 4
+  583 |               CALL_DRIVER (hdbc, pdbc, retcode, hproc3,
+      |                                                 ^~~~~~
+  584 |                   (pdbc->dhdbc, fOption, vParam, SQL_NTS));
+      |                    ~~~~~~~~~~~
+../../libiodbc-3.52.16/iodbc/itrace.h:113:15: note: in definition of macro 'CALL_DRIVER'
+  113 |         ret = proc plist; \
+      |               ^~~~
+../../libiodbc-3.52.16/iodbc/hdbc.c:597:45: error: too many arguments to function 'hproc2'; expected 0, have 3
+  597 |           CALL_DRIVER (hdbc, pdbc, retcode, hproc2,
+      |                                             ^~~~~~
+  598 |               (pdbc->dhdbc, fOption, vParam));
+      |                ~~~~~~~~~~~
+....
+
+../../libiodbc-3.52.16/iodbc/connect.c:2970:19: error: too many arguments to function 'dialproc'; expected 0, have 6
+ 2970 |         retcode = dialproc (hwnd,       /* window or display handle */
+      |                   ^~~~~~~~  ~~~~
+
+Upstream-Status: Submitted [https://github.com/openlink/iODBC/pull/111]
+Signed-off-by: mark.yang <[email protected]>
+---
+ iodbc/connect.c | 2 +-
+ iodbc/itrace.h  | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/iodbc/connect.c b/iodbc/connect.c
+index 632827f..1259516 100644
+--- a/iodbc/connect.c
++++ b/iodbc/connect.c
+@@ -2967,7 +2967,7 @@ SQLDriverConnect_Internal (
+             prov[size/sizeof(SQLWCHAR)] = L'\0';
+           }
+
+-        retcode = dialproc (hwnd,     /* window or display handle */
++        retcode = ((SQLRETURN (*)(...))dialproc) (hwnd,       /* window or display handle */
+           prov,                       /* input/output dsn buf */
+           sizeof (prov) / (waMode == 'A' ? 1 : sizeof (SQLWCHAR)), /* buf size */
+           &sqlstat,           /* error code */
+diff --git a/iodbc/itrace.h b/iodbc/itrace.h
+index 508359d..f3e6926 100644
+--- a/iodbc/itrace.h
++++ b/iodbc/itrace.h
+@@ -110,7 +110,7 @@ extern int ODBCSharedTraceFlag;
+ \
+       if (!t_penv->thread_safe) MUTEX_LOCK (t_penv->drv_lock); \
+ \
+-      ret = proc plist; \
++      ret = ((SQLRETURN (*)(...))proc) plist; \
+       if (errHandle) ((GENV_t *)(errHandle))->rc = ret; \
+ \
+       if (!t_penv->thread_safe) MUTEX_UNLOCK (t_penv->drv_lock); \
meta-oe/recipes-support/libiodbc/libiodbc_3.52.16.bb +4 -2
index 644c3ba07b..0d2d9d5f97 100644
@@ -12,7 +12,10 @@ LIC_FILES_CHKSUM = "file://LICENSE.LGPL;md5=8c0138a8701f0e1282f5c8b2c7d39114 \
                     file://LICENSE.BSD;md5=5b36348a404e1d65b57df8d33fd6e414 \
                     "
 
-SRC_URI = "https://github.com/openlink/iODBC/releases/download/v${PV}/${BP}.tar.gz"
+SRC_URI = " \
+       https://github.com/openlink/iODBC/releases/download/v${PV}/${BP}.tar.gz \
+       file://0001-fix-build-with-gcc-15.0.1-too-many-arguments-to-func.patch \
+"
 SRC_URI[sha256sum] = "3898b32d07961360f6f2cf36db36036b719a230e476469258a80f32243e845fa"
 
 UPSTREAM_CHECK_URI = "https://github.com/openlink/iODBC/releases"
 
-=-=-=-=-=-=-=-=-=-=-=-

Links: You receive all messages sent to this group.
View/Reply Online (#116537): https://lists.openembedded.org/g/openembedded-devel/message/116537
Mute This Topic: https://lists.openembedded.org/mt/112062410/1997914
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-devel/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-