Skip to content

fix -std=c23 build failure#321

Merged
braice merged 1 commit into
braice:mumudvb2from
heitbaum:gcc15
Dec 11, 2024
Merged

fix -std=c23 build failure#321
braice merged 1 commit into
braice:mumudvb2from
heitbaum:gcc15

Conversation

@heitbaum

@heitbaum heitbaum commented Dec 8, 2024

Copy link
Copy Markdown
Contributor

gcc-15 switched to -std=c23 by default:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result mumudvb fails the build so only typedef int bool for STDC_VERSION <= 201710L (C17)

    ../../src/mumudvb.h:136:47: error: expected ';', identifier or '(' before 'bool'
      136 |     typedef enum { false = 0, true = !false } bool;
          |                                               ^~~~

@braice

braice commented Dec 9, 2024

Copy link
Copy Markdown
Owner

Hello
Thanks for your fix
It seems though with the logic that there is a risk that it does not run with Clang

https://stackoverflow.com/questions/66954583/why-clang-running-on-windows-has-no-c-conformance-stdc-is-not-defined-to-1

Do you think there is a way to invert the logic so it does work as before unless version is defined and > than xxxx

Thank you

@heitbaum

heitbaum commented Dec 9, 2024

Copy link
Copy Markdown
Contributor Author

Hello Thanks for your fix It seems though with the logic that there is a risk that it does not run with Clang

https://stackoverflow.com/questions/66954583/why-clang-running-on-windows-has-no-c-conformance-stdc-is-not-defined-to-1

Do you think there is a way to invert the logic so it does work as before unless version is defined and > than xxxx

Thank you

I’m not sure on clang and windows. But an alternative that should work on c99 compiles (and does work with gcc-15 is)


--- mumudvb.h   2024-06-01 10:45:46.000000000 +0000
+++ new 2024-12-09 21:25:51.440129956 +0000
@@ -131,10 +131,7 @@
 
 #define SAP_GROUP_LENGTH 20
 
-/** define bool for plain C code **/
-#ifndef __cplusplus
-    typedef enum { false = 0, true = !false } bool;
-#endif
+#include <stdbool.h>
 
 enum
 {

@braice

braice commented Dec 9, 2024

Copy link
Copy Markdown
Owner

Looks good to me !

gcc-15 switched to -std=c23 by default:

    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result `mumudvb` fails the build so only typedef int bool
for __STDC_VERSION__ <= 201710L (C17)

    ../../src/mumudvb.h:136:47: error: expected ';', identifier or '(' before 'bool'
      136 |     typedef enum { false = 0, true = !false } bool;
          |                                               ^~~~

Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
@heitbaum

Copy link
Copy Markdown
Contributor Author

Looks good to me !

updated and build tested with both gcc-14.2 and gcc-15

@braice
braice merged commit ca565e6 into braice:mumudvb2 Dec 11, 2024
@heitbaum
heitbaum deleted the gcc15 branch December 11, 2024 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants