Skip to content

Update default compilation to C23 (from C11)#502

Merged
alevy merged 3 commits intomasterfrom
bump-to-c23
May 9, 2025
Merged

Update default compilation to C23 (from C11)#502
alevy merged 3 commits intomasterfrom
bump-to-c23

Conversation

@ppannuto
Copy link
Member

@ppannuto ppannuto commented May 7, 2025

This is basically a no-op at this point, as C23 didn't really break anything*.

The prior selection of C11 was mostly arbitrary. At the time the first
libtock-c build infrastructure was built, C17 hadn't been ratified yet,
but we needed some newer stuff than C99 provided, so we explicitly set
things to C11 (well, gnu11).

We have an impending need for the new C23 #embed compiler directive,
so this version bump lays the groundwork.

Future PRs may also look at other new C23 features; there are many that
are likely useful to libtock-c.

*There was one function signature it's more persnickety about, which
is the other commit in this PR.

ppannuto added 2 commits May 7, 2025 16:26
C23 is more pendantic than C11 about the function signature here.
This is a no-op at this point, as C23 didn't really break anything.
The prior selection of C11 was mostly aribtrary. At the time the first
libtock-c build infrastructure was built, C17 hadn't been ratified yet,
but we needed some newer stuff than C99 provided, so we explicitly set
things to C11 (well, gnu11).

We have an impending need for the new C23 `#embed` compiler directive,
so this version bump lays the groundwork.

Future PRs may also look at other new C23 features; there are many that
are likely useful to libtock-c.
@ppannuto
Copy link
Member Author

ppannuto commented May 7, 2025

Actually hold on, there's a few more (hopefully equally inconsequential) things to fix, e.g.

[-bash] Wed 07 May 16:33 [[bump-to-c23] ~/temp/libtock-c/examples/tests/hail]
$ make
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../../../libnrfserialization -f Makefile.setup all
make[1]: Nothing to be done for `all'.
/Applications/Xcode.app/Contents/Developer/usr/bin/make -C ../../../libnrfserialization -f Makefile all
  CC        ../libnrfserialization/nrf5x-base-f813b5dbfef3b7a71044bca72e2ab8b3c4d9e593/sdk/nrf51_sdk_11.0.0/components/libraries/util/app_error.c
../libnrfserialization/nrf5x-base-f813b5dbfef3b7a71044bca72e2ab8b3c4d9e593/sdk/nrf51_sdk_11.0.0/components/libraries/util/app_error.c: In function 'app_error_save_and_stop':
../libnrfserialization/nrf5x-base-f813b5dbfef3b7a71044bca72e2ab8b3c4d9e593/sdk/nrf51_sdk_11.0.0/components/libraries/util/app_error.c:118:5: error: implicit declaration of function '__disable_irq' [-Wimplicit-function-declaration]
  118 |     __disable_irq();
      |     ^~~~~~~~~~~~~

Turns out changing Configuration.mk doesn't force a re-build [and no, I'm not fixing that].

Copy link
Member

@alevy alevy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't have a strong opinion about this. In principle, since this is mostly a no-op, it just makes it hard for people with older compilers to build this, on the other hand... let's use the new thing!

@alevy alevy added this pull request to the merge queue May 9, 2025
Merged via the queue into master with commit b9ccccf May 9, 2025
4 checks passed
@alevy alevy deleted the bump-to-c23 branch May 9, 2025 23:43
@ppannuto ppannuto mentioned this pull request May 14, 2025
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.

4 participants