> On Dec 29, 2023, at 14:43, tue...@freebsd.org wrote:
>
>> On Dec 29, 2023, at 14:07, Konstantin Belousov <kostik...@gmail.com> wrote:
>>
>> On Fri, Dec 29, 2023 at 01:50:34PM +0100, Dimitry Andric wrote:
>>> The problem is really that our kernel headers (those under sys/) require
>>> C99. The only thing that
>>> https://cgit.freebsd.org/src/commit/?id=a8b70cf26030d68631200619bd1b0ad35b34b6b8
>>> did was move two static inline functions from sys/netinet/tcp_var.h to
>>> sys/netinet/tcp.h, and it looks like the former header is never directly
>>> included by ports. The latter is, so those ports should be switched to C99,
>>> or the sys/netinet/tcp.h header should be fixed to use __inline instead.
>>>
>> netinet/tcp.h is required by POSIX, and as far as we support applications
>> using C89, it must stay C89 compatible.
>>
>> But why userspace would need these newish accessors at all? IMO at least
> TCP is now using flags that are not contained in the th_flags field anymore,
> but also use the th_x2 field.
>
> People were assuming that all flags are in th_flags and th_x2 is not used and
> used it for internal processing. This was causing problems.
>
> Using the accessor functions hides the split between th_flags and th_x2.
> See, for example,
> https://cgit.FreeBSD.org/src/commit/?id=a8b70cf26030d68631200619bd1b0ad35b34b6b8
>
> <https://cgit.freebsd.org/src/commit/?id=a8b70cf26030d68631200619bd1b0ad35b34b6b8>
>> for userspace they do not add any value except additional namespace
>> pollution.
>> They should be hidden under #ifdef _KERNEL.
> That might be possible. A kernel build with this completes. Haven't checked a
> buildlworld. Will report when its done.
Thinking about it: since we expose the TCP flags to the world, we should
also expose the accessors related to it.
Best regards
Michael
>
> Best regards
> Michael
>>
>>> -Dimitry
>>>
>>>> On 29 Dec 2023, at 13:30, Nuno Teixeira <edua...@freebsd.org> wrote:
>>>>
>>>> (...)
>>>> -ansi == Same as -std=c89
>>>>
>>>> So it seems correct to remove it when -std=c99 is used.
>>>>
>>>> Nuno Teixeira <edua...@freebsd.org> escreveu no dia sexta, 29/12/2023 à(s)
>>>> 12:03:
>>>>
>>>>
>>>>
>>>> I think we have two options:
>>>> 1. Build the ports with a C version of at least C99.
>>>>
>>>> - Adding USE_CSTD=c99
>>>> - Removing -ansi:
>>>> --- configure.orig 2023-12-29 11:54:11 UTC
>>>> +++ configure
>>>> - CFLAGS="$CFLAGS $(DSO_CFLAGS) -ansi -Wall"
>>>> + CFLAGS="$CFLAGS $(DSO_CFLAGS) -Wall"
>>>>
>>>> Fix build.
>>>>
>>>> Notes:
>>>>
>>>> Adding USE_CSTD=c99 doesn't fix build by itself like we seen on some ports
>>>> that were fixed by it.
>>>>
>>>> Something have changed from current 1500007 to 1500008.
>>>>
>>>> 2. Remove the inline from tcp_[gs]et_flags().
>>>>
>>>> Best regards
>>>> Michael
>>>>> --
>>>>> Nuno Teixeira
>>>>> FreeBSD Committer (ports)
>>>>
>>>>
>>>>
>>>> --
>>>> Nuno Teixeira
>>>> FreeBSD Committer (ports)
>>>>
>>>>
>>>> --
>>>> Nuno Teixeira
>>>> FreeBSD Committer (ports)
>>>
>>>
>
>