Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow compile with -std=c23 #135

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

heitbaum
Copy link

When compiling with -std=c23 the following errors are observed.

common/qtypes.h:37:15: error: cannot use keyword 'false' as enumeration constant
   37 | typedef enum{ false, true, ENSURE_INT_QBOOL = 0x70000000 } qboolean;
      |               ^~~~~
common/qtypes.h:37:23: error: cannot use keyword 'true' as enumeration constant
   37 | typedef enum{ false, true, ENSURE_INT_QBOOL = 0x70000000 } qboolean;
      |                       ^~~~

common/net_main.c:869:9: error: too many arguments to function 'pp->procedure'; expected 0, have 1
  869 |         pp->procedure(pp->arg);
      |         ^~            ~~~~~~~
common/net.h:320:12: note: declared here
  320 |     void (*procedure) ();
      |            ^~~~~~~~~

common/net_main.c:112:56: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
  112 | static PollProcedure slistSendProcedure = { NULL, 0.0, Slist_Send };
      |                                                        ^~~~~~~~~~
common/net_main.c:113:56: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
  113 | static PollProcedure slistPollProcedure = { NULL, 0.0, Slist_Poll };
      |                                                        ^~~~~~~~~~
common/net_dgrm.c:512:8: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(struct test_poll_state *)' [-Wincompatible-pointer-types]
  512 |        Test_Poll,
      |        ^~~~~~~~~
common/net_dgrm.c:647:7: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(struct test_poll_state *)' [-Wincompatible-pointer-types]
  647 |       Test2_Poll,
      |       ^~~~~~~~~~

Fix:

  • update enum as false0 and true1 as the enum are already 0 and 1, and map to false/true
  • Update the function declarations to pass (void *) as procedure

When compiling with -std=c23 the following errors are observed.

    common/qtypes.h:37:15: error: cannot use keyword 'false' as enumeration constant
       37 | typedef enum{ false, true, ENSURE_INT_QBOOL = 0x70000000 } qboolean;
          |               ^~~~~
    common/qtypes.h:37:23: error: cannot use keyword 'true' as enumeration constant
       37 | typedef enum{ false, true, ENSURE_INT_QBOOL = 0x70000000 } qboolean;
          |                       ^~~~

    common/net_main.c:869:9: error: too many arguments to function 'pp->procedure'; expected 0, have 1
      869 |         pp->procedure(pp->arg);
          |         ^~            ~~~~~~~
    common/net.h:320:12: note: declared here
      320 |     void (*procedure) ();
          |            ^~~~~~~~~

    common/net_main.c:112:56: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
      112 | static PollProcedure slistSendProcedure = { NULL, 0.0, Slist_Send };
          |                                                        ^~~~~~~~~~
    common/net_main.c:113:56: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(void)' [-Wincompatible-pointer-types]
      113 | static PollProcedure slistPollProcedure = { NULL, 0.0, Slist_Poll };
          |                                                        ^~~~~~~~~~
    common/net_dgrm.c:512:8: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(struct test_poll_state *)' [-Wincompatible-pointer-types]
      512 |        Test_Poll,
          |        ^~~~~~~~~
    common/net_dgrm.c:647:7: error: initialization of 'void (*)(void *)' from incompatible pointer type 'void (*)(struct test_poll_state *)' [-Wincompatible-pointer-types]
      647 |       Test2_Poll,
          |       ^~~~~~~~~~

Fix:
- update enum as false0 and true1 as the enum are already 0 and 1, and map to false/true
- Update the function declarations to pass (void *) as procedure
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.

Build fails with gcc-15 / std=c23
1 participant