<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/60958>60958</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang -E incorrect -Wunicode diagnostic
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
andyhhp
</td>
</tr>
</table>
<pre>
Discovered entirely accidentally while trying to work around #60792
Given
```
$ cat hdr.h
.macro test uniq
mov $\uniq, %eax
.endm
$ cat src.c
#include "hdr.h"
$ clang-15 -E src.c -o out.i
In file included from src.c:1:
./hdr.h:2:11: warning: \u used with no following hex digits; treating as '\' followed by identifier [-Wunicode]
mov $\uniq, %eax
^
```
But there's are no strings here, and no context AFAICT where it would be legitimate to interpret `\u` as a unicode escape in the first place.
But if I rename src.c to src.S, it behaves differently
```
$ cp src.c src.S
$ clang-15 -E src.S -o out.i
$
```
and completes with no complaints.
Clearly this diagnostic is conditional on the file extension (which isn't great behaviour to start with), but I don't think it's a legitimate diagnostic for `*.c` files in the first place either.
It's worth saying for completeness that macros written entirely at the C level work fine, because they have to be written as
```
asm (".macro test uniq; mov $\\uniq, %eax; .endm");
```
with the backslash needing to be escaped, rather than the u.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMVcGO4jgQ_RpzKREFhwQ4cAB6WPV5VtqzY1eS2nFs1q6Q5u9XTtK9zHSPtK1WCGX7-dV7VYWKkVqHeBTlWZQvKzVw58NROfPoutuq9uZxfKGo_R0DGkDHFNA-QGlNBh0rax8wdmQRODzItcAeRh9-gAp-cAaELKp8d5AifxH5aX7-QXd0S6DKl__5q9yCVgydCVkHcyzrlQ4eGCPD4OifOQoA0Ps7CLkV5WWKywsIWaJ6W86hM_3zte_gMehMv4cKctoOBkFIOd0qpPx0yCrXrjclrL_Nh2HtwQ-c0bzn1UGTFFigDDTB98s1xWkjigUrE_I631GcZFp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