mbox series

[0/2] C23 compatibility

Message ID 20241117013149.576671-1-sandals@crustytoothpaste.net (mailing list archive)
Headers show
Series C23 compatibility | expand

Message

brian m. carlson Nov. 17, 2024, 1:31 a.m. UTC
Most of our code works fine in C23, but there are some new additions to
the standard that conflict with either our struct tags or functions.
With this series, the code compiles and passes the testsuite with
-std=c23 on GCC 14.2.0.

brian m. carlson (2):
  index-pack: rename struct thread_local
  reflog: rename unreachable

 builtin/index-pack.c | 10 +++++-----
 reflog.c             |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

Comments

Sam James Nov. 17, 2024, 2:43 a.m. UTC | #1
"brian m. carlson" <sandals@crustytoothpaste.net> writes:

> Most of our code works fine in C23, but there are some new additions to
> the standard that conflict with either our struct tags or functions.
> With this series, the code compiles and passes the testsuite with
> -std=c23 on GCC 14.2.0.
>
> brian m. carlson (2):
>   index-pack: rename struct thread_local
>   reflog: rename unreachable
>
>  builtin/index-pack.c | 10 +++++-----
>  reflog.c             |  4 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)

Thank you for the fast response! It both works and the fixes look
correct.

For the series:
Tested-by: Sam James <sam@gentoo.org>
Reviewed-by: Sam James <sam@gentoo.org>
Patrick Steinhardt Nov. 18, 2024, 7:45 a.m. UTC | #2
On Sun, Nov 17, 2024 at 01:31:47AM +0000, brian m. carlson wrote:
> Most of our code works fine in C23, but there are some new additions to
> the standard that conflict with either our struct tags or functions.
> With this series, the code compiles and passes the testsuite with
> -std=c23 on GCC 14.2.0.
> 
> brian m. carlson (2):
>   index-pack: rename struct thread_local
>   reflog: rename unreachable
> 
>  builtin/index-pack.c | 10 +++++-----
>  reflog.c             |  4 ++--
>  2 files changed, 7 insertions(+), 7 deletions(-)

Both of the patches look obviously good to me. I was a bit surprised
that this is required in the first place as I thought we were passing
`-std=gnu99` to our compilers, but that is not the case with our current
Makefile. So I must have been misremembering.

Thanks!

Patrick
Jeff King Nov. 18, 2024, 9:58 a.m. UTC | #3
On Mon, Nov 18, 2024 at 08:45:03AM +0100, Patrick Steinhardt wrote:

> Both of the patches look obviously good to me. I was a bit surprised
> that this is required in the first place as I thought we were passing
> `-std=gnu99` to our compilers, but that is not the case with our current
> Makefile. So I must have been misremembering.

We do for DEVELOPER=1 mode, but it wouldn't make sense to pass something
unportable like "gnu99" for the general case.

-Peff
brian m. carlson Nov. 18, 2024, 10:11 p.m. UTC | #4
On 2024-11-18 at 07:45:03, Patrick Steinhardt wrote:
> Both of the patches look obviously good to me. I was a bit surprised
> that this is required in the first place as I thought we were passing
> `-std=gnu99` to our compilers, but that is not the case with our current
> Makefile. So I must have been misremembering.

We can't do that because FreeBSD's system headers require C11 and won't
work with `-std=gnu99`, in addition to the general unportability of that
construct as mentioned by Peff.  There's a comment to that effect in
`config.mak.dev`.

I'm pleased you found the patches acceptable, though.