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

    <tr>
        <th>Summary</th>
        <td>
            [clang] Disable POSIX builtin library functions in MSVC mode
        </td>
    </tr>

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

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

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

<pre>
    Filled as a follow up issue for issue #56607.

clang-cl fails for following test C code:
```c
int index;

int get(void) {
        return index;
}
```

```
D:\>clang-cl /c test.c
test.c(1,5): error: redefinition of 'index' as different kind of symbol
int index;
    ^
test.c(1,5): note: unguarded header; consider using #ifdef guards or #pragma once
test.c(1,5): note: previous definition is here
test.c(4,9): error: incompatible pointer to integer conversion returning 'char *(const char *, int)' from a function
      with result type 'int' [-Wint-conversion]
        return index;
               ^~~~~
2 errors generated.
```

I think this needs to be disabled in MSVC mode (clang-cl driver or `--target=<arch>-pc-windows-msvc`), as they are not supported by cl.exe or C runtime library.

CC @AaronBallman, @rnk, @zmodem
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVMuO2zoM_Rp7QySI387CixmnA3RR3AsU6L1byaZtdWTJ0CPT9OtL2elkJmiLGoJN0SJ5yEOK6_7SPAkpsQdmgcGgpdQv4BcQ1nqkvblKUZoVZXmo9tHhFB0etncnmRp3nYSBCWnX05sHoUZwaB200Okeo-xqEJWHbXXbXigHQvX4Lcoe3zoO-hFdlNZnLfooPUJUvR44GnTeqHvD6nQX463DO-UpICraKPvwmkKUPnUr5v0V21VO6yRK24IwkA2gMdoEwWCPg1DCCa1AD2RebXjSKpSyF8OABimNZ1KHA_Yycy1_lzbQExUf_hBZaRfqCF6NnpmeGJuQ9UhgHqnGygqSwdtQeeJKDAQP1pMWiBZSLYaNMwOtOvyLMIvBs9CeMrmlKSzFNPfWOVkf78sjVKfnhTnBJcKiKWFC5zQEYSSREJ_R2OB1Y3PDXXUTC2AfyG9IysFN0QbjEIcqPBg9h3b1qgvIbjUEeBFuIp_WSwfusuDGjAtWUfG4-4_k3S16VJzeGgP8srfg_ROIqt6s9Uy6JW-pbxUa5rDf_6EfP4KbhHoObwsKkVii6nCkxrGMh3kUCj59_tLCTPMDoRw_G7U3gsCvpJaH3c4xEyYlo5Zumekm6und0u1oBHv9YnezPXchdqhbGzrTTXgBZjAwDdYvizaEFfgFOrnHbxgct2C8cmJGkIIbZi7vpr5tIcoPD8xo9ciknJkKrkll1PNV-h5QzzE2SVlWeVUc8yzum6w_ZkcWO-EkNkTGmhIxAKctafj3n88f_wfuhXSU_jX2K8v2XU1ib2QzObfYMMvpE62RqPd8T51HGynPPz-7xeiv2FEPPK2XmSWhqKs6i6fmUKdHzjPOi7zKMe-PnGW8rI81pn1adkksGUdpA9woTRW-bPchyQQ8Fk16SNMkOWRJkhd5tseEdVnCy6zukNdlRbXAmS7HfcCx12aMTbNC4n609FMK6-ztJ7NWjNQOazjyz7ybtGm--8FL4eM1dLNC_wFGgr9R">