[libcxx-commits] [PATCH] D115995: [libcxx] Add deprecation notices to macros deprecated in P0883R2
Raul Tambre via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Dec 19 08:39:20 PST 2021
tambre added inline comments.
================
Comment at: libcxx/include/atomic:2703
+#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
+#pragma clang deprecated(ATOMIC_FLAG_INIT)
+#pragma clang deprecated(ATOMIC_VAR_INIT)
----------------
Quuxplusone wrote:
> tambre wrote:
> > Separate macro deprecation macros didn't seem worth it as this is likely to be the only place we'd use them for a while. Since other compilers should simply ignore these guarding these shouldn't be necessary either.
> Sadly "other compilers" includes "old Clang."
> ```
> atomic:2703:15: error: unknown pragma ignored [-Werror,-Wunknown-pragmas]
> #pragma clang deprecated(ATOMIC_FLAG_INIT)
> ^
> ```
> So this should be guarded somehow.
> Today, if I grepped correctly, libcxx has zero instances of //any// `pragma clang` or `pragma GCC` except for `pragma {clang,GCC} diagnostic`. So we're unlikely to have any precedent for how to deal with conditionally supported pragmas. I suggest just this:
> ```
> #if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
> # if defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 1400
> # pragma clang deprecated ~~~
> # endif
> #endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_DISABLE_DEPRECATION_WARNINGS)
> ```
> (Separating the "semantic, why" from the "compiler-specific, how" — but really I did that only so I wouldn't have to deal with a super-long line. ;))
Good point, done.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D115995/new/
https://reviews.llvm.org/D115995
More information about the libcxx-commits
mailing list