[PATCH] D129170: [Sema] Add deprecation warnings for some compiler provided __has_* type traits

Erich Keane via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 6 06:06:30 PDT 2022


erichkeane added subscribers: aaron.ballman, erichkeane.
erichkeane added inline comments.


================
Comment at: clang/docs/ReleaseNotes.rst:305
 
+- Some type traits builtins like ``__has_trivial_assign`` have been documented
+  as deprecated for a while, because their semantics don't mix well with post-C++11 type
----------------



================
Comment at: clang/docs/ReleaseNotes.rst:306
+- Some type traits builtins like ``__has_trivial_assign`` have been documented
+  as deprecated for a while, because their semantics don't mix well with post-C++11 type
+  traits. Clang now emits deprecation warnings for them under the flag ``-Wdeprecated-has-builtins``.
----------------



================
Comment at: clang/include/clang/Basic/DiagnosticSemaKinds.td:5561
+def warn_deprecated_has_builtins : Warning<
+  "the %0 compiler builtin is deprecated from C++11 onwards. Use %1 instead.">,
+  InGroup<DeprecatedHasBuiltins>;
----------------
cor3ntin wrote:
> Should we say something like "and will be removed in the future"?
> 
> "%0 is deprecated from C++11 onward. Use %1 instead." might be sufficient
> 
> 
Diagnostics arent sentences. Also, we wouldn't say "C++11 onward", we can just say C++11. I might suggest:

`builtin %0 is deprecated in C++11, use %1 instead`

BUT @aaron.ballman always does great at this level of bikeshedding.



================
Comment at: clang/lib/Sema/SemaExprCXX.cpp:5454
 
+  IssueBuiltinDeprecationWarningIfNeeded(*this, Kind, KWLoc);
+
----------------



Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D129170



More information about the cfe-commits mailing list