c++: Minimal handling of carries_dependency attribute
A comment in D2552R1: "The only questionable (but still conforming) case we found was [[carries_dependency(some_argument)]] on GCC, where the emitted diagnostic said that the carries_dependency attribute is not supported, but did not specifically call out the syntax error in the argument clause." made me try the following patch, where we'll error at least for arguments to the attribute and for some uses of the attribute appertaining to something not mentioned in the standard warn with different diagnostics (or should that be an error?; clang++ does that, but I think we never do for any attribute, standard or not). The diagnostics on toplevel attribute declaration is still an attribute ignored warning and on empty statement different wording. The paper additionally mentions struct X { [[nodiscard]]; }; // no diagnostic on GCC and 2 cases of missing diagnostics on [[fallthrough]] (guess I should file a PR about those; one problem is that do { ... } while (0); there is replaced during genericization just by ... and another that [[fallthrough]] there is followed by a label, but not user/case/default label, but an artificial one created from while loop genericization. 2022-11-09 Jakub Jelinek <jakub@redhat.com> * tree.cc (handle_carries_dependency_attribute): New function. (std_attribute_table): Add carries_dependency attribute. * parser.cc (cp_parser_check_std_attribute): Add carries_dependency attribute. * g++.dg/cpp0x/attr-carries_dependency1.C: New test.
Loading
Please register or sign in to comment