[libcxx-commits] [PATCH] D145508: [libc++] Reject standard attributes which are extensions in libcpp-uglify-attributes

Nikolas Klauser via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Mar 7 12:29:28 PST 2023


philnik added inline comments.


================
Comment at: libcxx/include/barrier:133
     }
-    [[nodiscard]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
+    [[__nodiscard__]] _LIBCPP_AVAILABILITY_SYNC _LIBCPP_INLINE_VISIBILITY
     arrival_token arrive(ptrdiff_t __update)
----------------
Mordante wrote:
> This looks odd, either we are Standard compliant and we can use `[[nodiscard]]` or this is an extension in some language modi, but we're not using `_LIBCPP_NODISCARD_EXT`. Do you know why this is needed here?
`<barrier>` itself is an extension in C++14 and C++17. This is how I noticed that we have them as extensions.


================
Comment at: libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp:50
+std::span<const char* const> get_standard_attributes(const clang::LangOptions& lang_opts) {
+  size_t attribute_count = 2;
+
----------------
Mordante wrote:
> This count feels extremely error prone, maybe an array per language version. This then has some duplicates but feels easier to maintain. It also allows for the removal of an attribute in a later version of the standard.
I don't disagree, but one array per version seems also error-prone.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D145508



More information about the libcxx-commits mailing list