https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101940
Bug ID: 101940 Summary: Implement -fignored-attributes Product: gcc Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: mpolacek at gcc dot gnu.org Target Milestone: --- It is desirable for -Wattributes to warn about e.g. [[deprecate]] void g(); // typo, should warn However, -Wattributes also warns about vendor-specific attributes (that's because lookup_scoped_attribute_spec -> find_attribute_namespace finds nothing), which, with -Werror, causes grief. We don't want the -Wattributes warning for [[company::attr]] void f(); GCC warns because it doesn't know the "company" namespace; it only knows the "gnu" and "omp" namespaces. We could entirely disable warning about attributes in unknown scopes but then the compiler would also miss typos like [[company::attrx]] void f(); or [[gmu::warn_used_result]] int write(); so that is not a viable solution. A workaround is to use a #pragma: #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wattributes" [[company::attr]] void f() {} #pragma GCC diagnostic pop but that's a mouthful and awkward to use and could also hide typos. In fact, any macro-based solution doesn't seem like a way forward. So this RFE asks for -fignored-attributes=, which, IMHO, should take these arguments: company::attr company:: clang the last is a special option to ignore clang-only attributes. Maybe we could also accept ::attr. This option should go well with using @file: we could have a file containing -fignored-attributes=vendor::attr1,vendor::attr2 and then invoke gcc with '@attrs' or similar. It might also make sense to implement a #pragma to go along: #pragma GCC ignored-attributes=vendor::attr1,vendor::attr2. This should help with various static analysis tools and similar.