<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/92590>92590</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            clang `-Wmissing-prototypes` advice contradicts clang-tidy `misc-use-anonymous-namespace` advice for C++
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang,
            clang-tidy
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          seanm
      </td>
    </tr>
</table>

<pre>
    Given this C++:

```c++
#include <cstdio>

void hello ()
{
 printf("hello\n");
}

int main ()
{
  hello();
  
 return 0;
}
```

compile with:

```
% clang++ -fsyntax-only -Wmissing-prototypes test.cxx
test.cxx:3:6: warning: no previous prototype for function 'hello' [-Wmissing-prototypes]
void hello ()
     ^
test.cxx:3:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void hello ()
^
static
```

Yet, for C++ (not C), clang-tidy's `misc-use-anonymous-namespace` (see [here](https://clang.llvm.org/extra/clang-tidy/checks/misc/use-anonymous-namespace.html)) advises that an anonymous namespace is a better choice.

Perhaps `-Wmissing-prototypes` should also suggest that as an alternative.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVMGOqzgQ_BpzaRGBGUM4cJjJvOx1b6s9GtMB7xo7cjd5k79fmZC8rDQzehGKA92uqi5X0ER29IidUG9CvWd64SnEjlD7OevDcO3-sBf0wJMlOAj5lq7qVRTvorh_18XtMlv59lRW1hu3DAiiOhjiwQZR_XjeeAl2gAmdCyDkXsh2KzYbBJyj9Xxaa3LtE-rghZSptbrzNO_PmNYzzNr6LxBvdFutejzd1oi8RA_FJ-D3GZ-5TJjP1iH8tDx95cndDAXGaT_eHIL8RFfP-iMP3l0h_2u2RNaP-TkGDnw9IwEj8c58fNwAHnfVayWq11pUr_BTR2_9mH76AOeIFxsWggcGnEKE0-IN25D8aLbZGxDq7TNOod6_PRhIH6F-fCqpvOlgTOuAxumIiZRYszWJ1Z6AJ_ylyFLqB-sZ_YADcIAeYSEcICxMdkAIp1vwOGpPTq_bFm_5-_zcFW7UXx_g38hCHlaftmgnoCTqkNDk4XZoOdvhmkYBURezJZMvhLn2wV_nsFDu9Yx01gZFXSQAQkwWTxgxWSr3E_OZUkLkUcjjirlz7jLvQhyFPOIHR30vbGRHM6H5l4Q8JkIhj19Q7iae3Sq2BT1cLKXoTJpBe3i0w6M9ma6hR2aMYKZgDe6eHfkT46TP66CfJqQugKawuAG0owC0jCMSb4y0kjrG6DXbC-6yoauGtmp1hl3ZlKptZFHss6mTfX1qm6busWz2qmiroixemrLEvlZtXZeZ7WQhXwpVNuVeVXK_U02l-la1rcJByboRLwXO2rqHj5klWrBrpWqLzOkeHa3vNCm3P54U8nC_20yW6Y0XuwSR98tI4qVwlph-gbJlh9265ztPkvMGwQTPUQ_WMD0l53dSswE8JTFbouv-H5zR8rT0OxNmIY9J4rYkMf-gYSGPqwkpNasP_wUAAP__uUrJ7Q">