<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Regression in -Wdocumentation behavior with typedef struct"
   href="https://bugs.llvm.org/show_bug.cgi?id=44143">44143</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Regression in -Wdocumentation behavior with typedef struct
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Frontend
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>chris.hamilton@ericsson.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, neeilans@live.com, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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.)</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>