Paul Eggert wrote:
> > The _GL_WARN_ON_USE_CXX on three of these functions was introduced in 
> > gnulib commit
> > 467fb4fcc12e1c1e2f20417272feb740566ecc6e, see
> > https://lists.gnu.org/archive/html/bug-gnulib/2020-05/msg00099.html,
> > and there's nothing that makes me believe that the problem has gone away.
> 
> Unfortunately I'm not understanding the connection. That email is about 
> C++, but m4/posixcheck.m4 defines GNULIB_POSIXCHECK only for C. That is, 
> the #undefs that I'm talking about are for C, not for C++.
> ...
> Any reason not to install the attached patch? It simplifies Gnulib, and 
> it would avoid future problems like what we ran into with C23 strchr, as 
> I expect we will in the future with strchrnul etc.

Looking at the git history, in particular the commits

cc4f7d31b0b44d17bb3103e9d5b259e557dc63bd
8c3eae83a2639ca887e41a13055f890dd722e0c8
ce39969871dbd2612257899fd879de6519cd0cf9
cbd5934b1918d73022d1d1d9904112f3d6d7f187
467fb4fcc12e1c1e2f20417272feb740566ecc6e
154b4c4bb430ae91b541d0a4932cdef75710c966

I can see two things:
  - The '#undef's originates in 2007, before _GL_WARN_ON_USE was put in place.
    It is therefore possible that they are unnecessary nowadays.
  - Yes, m4/posixcheck.m4 defines GNULIB_POSIXCHECK only for C. But that is
    only a consequence of the last commit, that was meant to fix a few
    compilation errors in C++ mode, without too much effort. It is possible
    that GNULIB_POSIXCHECK could be supported again in C++ mode, by adding
    workarounds for these few symbols.

In the current state of gnulib, I refrain from approving this patch because:
  - We don't have any unit tests of GNULIB_POSIXCHECK functionality,
  - The #undef's shield the GNULIB_POSIXCHECK functionality from whatever
    macro-based wierdnesses are found in the system header files (mingw
    overrides, fortify definitions, and others) and from Gnulib's MDA aliases.
  - The patch modifies 554 symbols. While I guess that 95% of these changes
    would be harmless, some of them may cause trouble, on platforms from
    CentOS 7 to AIX. And due to the lack of a unit test, we have no way to
    know, which symbols will stop working on which platforms.

Therefore, in the current state, if we have a problem regarding 'strchrnul',
let's fix it for 'strchrnul' only.

Things would be different if we had a decent unit test of the GNULIB_POSIXCHECK
functionality. Can anyone propose how such a unit test could look like?

Bruno




Reply via email to