[llvm-bugs] [Bug 44143] New: Regression in -Wdocumentation behavior with typedef struct

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Nov 25 12:32:03 PST 2019


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

            Bug ID: 44143
           Summary: Regression in -Wdocumentation behavior with typedef
                    struct
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chris.hamilton at ericsson.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

The following code triggers a false positive warning when compiled with
-Wdocumentation:

    /**
     * @struct MyStruct
     * @brief Some blurb
     *
     * More details here.  Doesn't matter what.
     */
    typedef struct MyStruct
    {
      int   type;
      int   pid;
      int   msgPrio;
    } MyStruct;

The warning generated is:

    $ ./bin/clang -c -Wdocumentation foo.c 
    foo.c:2:5: warning: '@struct' command should not be used in a comment
attached to a non-struct declaration [-Wdocumentation]
     * @struct MyStruct
       ~^~~~~~~~~~~~~~~
    1 warning generated.

Separating the struct declaration from the typedef, as follows, avoids the
warning:

    /**
     * @struct MyStruct
     * @brief Some blurb
     *
     * More details here.  Doesn't matter what.
     */
    struct MyStruct
    {
      int   type;
      int   pid;
      int   msgPrio;
    };
    typedef struct MyStruct MyStruct;

This behavior changed about a week ago.  (Not exactly sure which commit--
haven't narrowed that down.)

-- 
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/20191125/ce393598/attachment.html>


More information about the llvm-bugs mailing list