[clang] [Clang] Consider preferred_type in bitfield warnings (#116760) (PR #116785)

Oliver Hunt via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 09:12:26 PDT 2025


================
@@ -0,0 +1,113 @@
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify=expected,preferrednotes -std=c11 -Wno-unused-value -Wno-unused-but-set-variable
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify=expected,bitfieldwarning,preferrednotes -std=c11 -Wno-unused-value -Wno-unused-but-set-variable -Wbitfield-width -Wbitfield-enum-conversion
+// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -fsyntax-only -verify=noerror,preferrednotes -std=c11 -Wno-unused-value -Wno-unused-but-set-variable -Wno-error=preferred-type-bitfield-enum-conversion -Wno-error=preferred-type-bitfield-width
----------------
ojhunt wrote:

Out of paranoia I've explicitly tested no-error, and no-warn, but only for the smaller test as it's essentially just a basic sanity check.

Incidentally is there a way to do
```cpp
// expected-error at 1 otherprefix-warning at -1 {{...}}
```
I couldn't find any such mechanism so there's a bunch of duplication here

https://github.com/llvm/llvm-project/pull/116785


More information about the cfe-commits mailing list