<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/94675>94675</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang cpp always passes `-traditional-cpp`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
gjurgensen
</td>
</tr>
</table>
<pre>
When `cpp` wraps `clang`, it always passes the flag `-traditional-cpp`, which prevents full preprocessing of modern C code. As far as I can tell, there is no way to disable or overrule the `-traditional-cpp` flag.
This manifest in the following example. Provided the following `main.c` file:
```c
#ifndef MY_MACRO
#define MY_MACRO 1
#endif
int main(void) {
return 0;
}
```
Preprocessing with the command `cpp -P main.c` yields the following:
```c
#define MY_MACRO 1
int main(void) {
return 0;
}
```
The issue here is that the output of `cpp` is not fully preprocessed as expected.
Running `cpp -E -P main.c` works as expected, as it does not pass the `-traditional-cpp` flag. It seems to me there should be a way to disable the usage of this flag from `cpp` (for reference, the `gcc`-version of `cpp` does not pass the `-traditional-cpp` flag by default).
This was observed on the following version:
```shell
Apple clang version 15.0.0 (clang-1500.3.9.4)
Target: arm64-apple-darwin23.5.0
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyslF2L2zgUhn-NcnOwkeWv-MIX6XQDvSg7lMKyV4tsHdvqypKR5Lj594sUT2eSzlIWFkKMvs5536PniDsnR43YkvIDKT8e-OonY9vx22pH1A71oTPi2v4xoQZS0X5ZSEVhs3xxcay4HklFCXsC6YGrjV8dLNw5dOAnhEHxMWxMvOVCemk0V8ktSjizTbKfYLF4Qe0dDKtSYbRY06NzUo9gBpiNQKvhCXojMIWTg4Fb4A4-Qc81eFQqxPITWgTpQBvY-BW8ASEd7xSCsWAuaO2qMKp6X1AUmxL6kdDT7f_rJB3MXMsBnQepb5aMUmYL2vA7nxeFKTxbc5ECxcM6qejMpU77GFwqJPkeONiPv34fs1wOWu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