[LLVMbugs] [Bug 16097] New: Add diagnostics for "static" function without keyword, "virtual" function without keyword

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 21 17:17:56 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16097

            Bug ID: 16097
           Summary: Add diagnostics for "static" function without keyword,
                    "virtual" function without keyword
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: arthur.j.odwyer at gmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 10561
  --> http://llvm.org/bugs/attachment.cgi?id=10561&action=edit
patch for "definition of %0 is missing the 'static' keyword"

We'd like to be able to diagnose the following two coding-standard violations
directly from Clang:

(1)
    static void foo();

    /* ... */

    void foo()
    {
        /* ... */
    }

(2)
    class B {
        virtual void bar();
    };

    class C : B {
        void bar();
    };

In example #1, foo() is silently treated as "static". In example #2, B::bar()
is silently treated as "virtual". This is all conforming, of course; but we'd
like to get a compiler diagnostic when it happens, so that we can keep our code
clean.

We've actually patched our local copy of Clang to handle #1 already. I've
attached the patch. However, this patch shouldn't be accepted as-is. It turns
on the warning by default, doesn't add any -Wdiagnostic-group, and doesn't add
any test cases. I would be willing to do that work, if I were assured that the
patch would get accepted into mainline. We would prefer not to have to use a
patched Clang indefinitely.

-- 
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/20130522/b1997592/attachment.html>


More information about the llvm-bugs mailing list