bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: clang++ 11 compilation issues


From: Bruno Haible
Subject: Re: clang++ 11 compilation issues
Date: Thu, 14 Jan 2021 02:21:45 +0100
User-agent: KMail/5.1.3 (Linux/4.4.0-197-generic; KDE/5.18.0; x86_64; ; )

Hi Paul,

> Also, looking over the current verify.h, it's a little complicated and I 
> doubt whether the complexity is worth it nowadays. How about if we 
> simplify the C++ case, by simply relying on __cpp_static_assert there? 
> Although this could miss opportunities for generating diagnostics via 
> older C++ compilers, I doubt whether they're worth the trouble any more.

The risk here is not that the new code misses opportunities for generating
diagnostics. The risk here is that the new code introduces compilation errors
in C++ mode.

Recall that in this area C and C++ are very different; which is why the
code starts with a '#if[n]def __cplusplus'. If you try to handle C and C++
through the same code and conditions, it is not only possibly buggy, but
also certainly unmaintainable.

For example, say, someone use g++ version >= 5 with option -std=c++98. Then,
with your new code, __cpp_static_assert will be undefined,
_GL_HAVE__STATIC_ASSERT will be 1, and _GL_VERIFY(R, DIAGNOSTIC, ...) will
expand to
  _Static_assert (R, DIAGNOSTIC)
which most likely leads to a syntax error.

Also note that the C++ test coverage of this module is currently zero (none).
This means that if you make this change and it is buggy, we have no way to
catch it, before some user will stumble across it.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]