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

    <tr>
        <th>Summary</th>
        <td>
            clang-tidy considers namespace scope static variables to be global variables in several checks
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

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

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

<pre>
    I don't think considering these the same as true globals is right as they have internal linkage. 

Given this code:
```
static int x;

int f(void)
{
    return x;
}
```

With for example these checks:
```
  Checks: >
    readability-identifier-naming,
 cppcoreguidelines-avoid-non-const-global-variables
  CheckOptions:    
 - { key: readability-identifier-naming.GlobalVariablePrefix, value: g_ }
    - { key: readability-identifier-naming.GlobalVariableCase, value: lower_case }
```

The output is:
```
C:\code\ivy\duo\.\test.c:1:12: warning: variable 'x' is non-const and globally accessible, consider making it const [cppcoreguidelines-avoid-non-const-global-variables]
static int x;
 ^
C:\code\ivy\duo\.\test.c:1:12: warning: invalid case style for global variable 'x' [readability-identifier-naming]
static int x;
 ^
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVMFu4zYQ_Rr6MpAhU6EVH3SIlfWip_ZQtMfFiBxLs6ZIg6ScuF9fUFbcbNsNii0gURCHnDfz3iMxRu4dUSPUXqjnFU5p8KH5Ov5BNKJbdd5cm5_AeCdknSAN7E6gvYtsKLDrIQ0UKY8QcSTACClMBL31HdoIHCFwP6Q5MNAVBrwQsEsUHFqw7E7Y0xpE-SzKp9v4mS_kMlQE7Q2JapkX23J55t-YMLHOueBVVPv3GfLcUcjHi2cj5G4J1csaAIBAaQru_cb6-V9RbuPvnAY4-gD0iuPZ0tK2Hkif4vcKBGjf4iCqT-_B0WDHltO1YEMu8ZEpFA5Hdr2Q7bJSn8_aB-onNmTZUSwwN1Q474osQSpuLBcXDIydpfgN7s_nxN7N6AALwVCAqPdwomue_rCO9ec5-W9L7l8CHflVyBYuaKcsCvRf4M5ahvjh3C1G-iaz9S8UvmiMBB_r8utA4Kd0nhLwd3Voc0C1s5dUy5erUK2ZvFDtWqg2UUxrLaqnTX5lhn_B4LIS1RO8UQtC1q9C1tnQd_4BnVmcbq-AWlOM3Nm5l7czAiOe8jnhBLc9Qu1_QFj1_IHpQahP_79Vdhe0bGCmPaarpdnxt1L-SYRQ-499_B9Lvou1Mk1ldtUOV9RstnVdKiUfq9XQoD4arbaozXFrqnqz2-qtqmSnNBoqzcOKG1nKqpRSlo8PG1mtTbnppJK1qqqNko8oHkoake3a2su49qFfcYwTNdtyt1Erix3ZON-AUjp6gTkopMwXYmjynqKb-igeSssxxb-yJE6WGm3R9UVic72rHsHhSPGMmiBqf86EzizcFYXkoaO_sxuBHUS6UEC73C6rKdhmSOk8-1sehDz0nIapW2s_CnnIxSyf4hz8V9JJyMPcQhTyMLf4ZwAAAP__S5LZvg">