Merge pull request #9566 from heitbaum/gcc15

Patches to support gcc-15 and -std=c23
This commit is contained in:
Christian Hewitt 2025-01-17 13:10:32 +04:00 committed by GitHub
commit 3689798504
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 226 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- a/comskip.c 2024-12-09 13:06:15.051318034 +0000
+++ b/comskip.c 2024-12-09 13:07:54.348640394 +0000
@@ -976,7 +976,7 @@
int FindUniformThreshold(double percentile);
void OutputFrameArray(bool screenOnly);
void OutputBlackArray();
-void OutputFrame();
+void OutputFrame(int frame_number);
void OpenOutputFiles();
void InitializeFrameArray(long i);
void InitializeBlackArray(long i);

View File

@ -0,0 +1,70 @@
From 8c7a865acea83d5144dd075ef40e0d4a3863b6b1 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Sun, 8 Dec 2024 11:51:12 +0000
Subject: [PATCH] t2scan: fix -std=c23 build failure
gcc-15 switched to -std=c23 by default:
https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212
As a result `t2scan` fails the build so only typedef int bool
for __STDC_VERSION__ <= 201710L (C17)
../tools.h:35:15: error: two or more data types in declaration specifiers
35 | typedef int bool;
| ^~~~
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
char-coding.h | 2 +-
emulate.c | 2 +-
tools.h | 10 ++++++----
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/char-coding.h b/char-coding.h
index 15bcdf9..93c78d2 100644
--- a/char-coding.h
+++ b/char-coding.h
@@ -31,7 +31,7 @@ int get_codepage_index(const char * codepage);
/*
* set the default charset that is used if a string does not include a charset definition in the first byte
*/
-void set_char_coding_default_charset();
+void set_char_coding_default_charset(char *);
/*
* reset default charset to the reset_to_charset
diff --git a/emulate.c b/emulate.c
index d0cd744..cfe7ebe 100644
--- a/emulate.c
+++ b/emulate.c
@@ -199,7 +199,7 @@ int em_getproperty(struct dtv_properties * cmdseq) {
}
-void em_lnb(int high_band, uint32_t high_val, uint32_t low_val) {
+void em_lnb(_Bool high_band, uint32_t high_val, uint32_t low_val) {
em_device.highband = high_band;
em_device.lnb_low = low_val;
em_device.lnb_high = high_val;
diff --git a/tools.h b/tools.h
index 20b6a0d..221580e 100644
--- a/tools.h
+++ b/tools.h
@@ -31,10 +31,12 @@
/*******************************************************************************
/* common typedefs && logging.
******************************************************************************/
-#ifndef bool
- typedef int bool;
- #define false 0
- #define true !(false)
+#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ <= 201710L
+ #ifndef bool
+ typedef int bool;
+ #define false 0
+ #define true !(false)
+ #endif
#endif
#define min(a,b) (b<a?b:a)

View File

@ -0,0 +1,30 @@
--- a/tools.h 2017-01-07 09:06:17.000000000 +0000
+++ b/tools.h 2024-12-07 09:14:24.126672083 +0000
@@ -32,10 +32,12 @@
/*******************************************************************************
/* common typedefs && logging.
******************************************************************************/
-#ifndef bool
- typedef int bool;
- #define false 0
- #define true !(false)
+#if defined __STDC__ && defined __STDC_VERSION__ && __STDC_VERSION__ <= 201710L
+ #ifndef bool
+ typedef int bool;
+ #define false 0
+ #define true !(false)
+ #endif
#endif
#define min(a,b) (b<a?b:a)
--- a/emulate.c 2017-01-07 09:06:17.000000000 +0000
+++ b/emulate.c 2024-12-07 09:21:15.216943907 +0000
@@ -199,7 +199,7 @@
}
-void em_lnb(int high_band, uint32_t high_val, uint32_t low_val) {
+void em_lnb(bool high_band, uint32_t high_val, uint32_t low_val) {
em_device.highband = high_band;
em_device.lnb_low = low_val;
em_device.lnb_high = high_val;

View File

@ -0,0 +1,22 @@
From a1f2a71b286135d89865bb0332cbe3db59cea300 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Mon, 9 Dec 2024 16:57:53 +1100
Subject: [PATCH] fix build with gcc-15
---
tsserve.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tsserve.c b/tsserve.c
index d81042e..253ba0c 100644
--- a/tsserve.c
+++ b/tsserve.c
@@ -2958,7 +2958,7 @@ static void set_child_exit_handler();
/*
* Signal handler - catch children and stop them becoming zombies
*/
-static void on_child_exit()
+static void on_child_exit(int signum)
{
#if 0
print_msg("sighandler: starting\n");

View File

@ -0,0 +1,26 @@
From 322c1aa1e0cc8ab1770929c42a2c84befd86d0dc Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Mon, 9 Dec 2024 11:45:03 +0000
Subject: [PATCH] fix gcc-15 build
Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
---
cfgfile.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cfgfile.h b/cfgfile.h
index 11ba475..55f9b9c 100644
--- a/cfgfile.h
+++ b/cfgfile.h
@@ -13,7 +13,7 @@ typedef struct {
int value;
} config_enumeration_type;
-int read_config();
+int read_config(char *, int);
char *config_get_string(const char *directive);
int config_get_bool(const char *directive);
--
2.43.0

View File

@ -0,0 +1,25 @@
From 6d80909a8c0fd19717010a3c76fec560f988ca48 Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <rudi@heitbaum.com>
Date: Mon, 9 Dec 2024 12:35:09 +0000
Subject: [PATCH] fix gcc-15 build
---
attach.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/attach.c b/attach.c
index 41a696c..e4a46bd 100644
--- a/attach.c
+++ b/attach.c
@@ -96,7 +96,7 @@ die(int sig)
/* Window size change. */
static RETSIGTYPE
-win_change()
+win_change(int sig)
{
signal(SIGWINCH, win_change);
win_changed = 1;
--
2.43.0

View File

@ -0,0 +1,20 @@
--- a/usb_modeswitch.c 2020-07-10 15:48:03.000000000 +0000
+++ b/usb_modeswitch.c 2024-12-09 12:18:10.953574344 +0000
@@ -570,7 +570,7 @@
/* Get current configuration of default device, note value if Configuration
* parameter is set. Also sets active_config
*/
- currentConfigVal = get_current_config_value(dev);
+ currentConfigVal = get_current_config_value();
if (Configuration > -1) {
SHOW_PROGRESS(output,"Current configuration number is %d\n", currentConfigVal);
} else
@@ -772,7 +772,7 @@
if (Configuration > 0) {
if (currentConfigVal != Configuration) {
if (switchConfiguration()) {
- currentConfigVal = get_current_config_value(dev);
+ currentConfigVal = get_current_config_value();
if (currentConfigVal == Configuration) {
SHOW_PROGRESS(output,"The configuration was set successfully\n");
} else {

View File

@ -0,0 +1,22 @@
diff --git a/src/htsmsg.h b/src/htsmsg.h
index 5cdcaa4867..d15c547e58 100644
--- a/src/htsmsg.h
+++ b/src/htsmsg.h
@@ -75,7 +75,7 @@ typedef struct htsmsg_field {
} bin;
htsmsg_t *msg;
double dbl;
- int bool;
+ int boolean;
} u;
#if ENABLE_SLOW_MEMORYINFO
@@ -91,7 +91,7 @@ typedef struct htsmsg_field {
#define hmf_bin u.bin.data
#define hmf_binsize u.bin.len
#define hmf_dbl u.dbl
-#define hmf_bool u.bool
+#define hmf_bool u.boolean
// backwards compat
#define htsmsg_get_map_by_field(f) htsmsg_field_get_map(f)