================ @@ -0,0 +1,42 @@ +// RUN: %clang_cc1 -Wconversion -fsyntax-only -verify %s +// RUN: %clang_cc1 -Wbitfield-conversion -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple armebv7-unknown-linux -Wbitfield-conversion \ +// RUN: -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple arm64-unknown-linux -Wbitfield-conversion \ +// RUN: -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple arm-unknown-linux -Wbitfield-conversion \ +// RUN: -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple aarch64-unknown-linux -Wbitfield-conversion \ +// RUN: -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple mipsel-unknown-linux -Wbitfield-conversion \ +// RUN: -fsyntax-only -verify %s +// RUN: %clang_cc1 -triple mips64el-unknown-linux -Wbitfield-conversion \ +// RUN: -fsyntax-only -verify %s + +typedef struct _xx { + int bf:9; // expected-note 3{{declared here}} + } xx, *pxx; + + xx vxx; + + void foo1(int x) { + vxx.bf = x; // expected-warning{{conversion from 'int' (32 bits) to bit-field 'bf' (9 bits) may change value}} ---------------- AaronBallman wrote:
I'm certainly not opposed to reducing the chattiness if there's an idea on how to do so. However, this is an off-by-default warning grouped under `-Wconversion` with its own diagnostic group (`-Wbitfield-conversion`) specifically to allow people to opt into conversion warnings while opting out of this new class of diagnostics. Is that insufficient? Also, this is diagnosing code that GCC also diagnoses under `-Wconversion`. https://godbolt.org/z/qYE8Kzr7f https://github.com/llvm/llvm-project/pull/69049 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits