[libcxx-commits] [PATCH] D146675: [libc++] Warn on including headers that are deprecated in C++17

Christopher Di Bella via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Thu Mar 23 12:43:39 PDT 2023


cjdb added inline comments.


================
Comment at: libcxx/include/ccomplex:24
+#if !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS) && _LIBCPP_STD_VER >= 17
+#  warning "Header <ccomplex> is deprecated in C++17"
+#endif
----------------
philnik wrote:
> cjdb wrote:
> > * "removed as of C++20" increases the urgency of the diagnostic.
> > * "Header" bit removed since that will be implied by context.
> > * Added backticks to support SARIF diagnostics rendering this in Markdown.
> > 
> > Same comment applies below.
> I don't think we want to say "and removed in C++20" if we don't actually remove the header. We'd have to move these headers into their own directory and teach clang about that, and this seems like quite a bit of work to remove these headers (although it might clean up the code base a bit).
> I don't think we want to say "and removed in C++20" if we don't actually remove the header. We'd have to move these headers into their own directory and teach clang about that, and this seems like quite a bit of work to remove these headers (although it might clean up the code base a bit).

It's implementable in library.

```
#if __cplusplus >= 202003L
#  error `<ccomplex>` removed in C++20.
#elif __cplusplus == 201703L
#  warning `<ccomplex>` deprecated in C++17
#endif
```

> Otherwise it just results in problems. Clang should just remove the quotes if the warning consists only of a string literal.

What problems are those?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146675/new/

https://reviews.llvm.org/D146675



More information about the libcxx-commits mailing list