[llvm-bugs] [Bug 50940] New: Consider warning on redundant attributes

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jun 30 05:56:49 PDT 2021


https://bugs.llvm.org/show_bug.cgi?id=50940

            Bug ID: 50940
           Summary: Consider warning on redundant attributes
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

clang currently allows this without complaint:

    [[nodiscard]] [[nodiscard]] int f() { return 4; }

The duplicate `[[nodiscard]]` is harmless, but also pointless and a copy-paste
artifact. We should maybe warn on it.

We very likely shouldn't warn if one `[[nodiscard]]` is on the decl and another
on the definition.

We possibly shouldn't warn on it if one of the copies comes from a macro.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210630/854d84b5/attachment.html>


More information about the llvm-bugs mailing list