Module Name: src
Committed By: rillig
Date: Sat Jan 28 08:36:17 UTC 2023
Modified Files:
src/tests/usr.bin/xlint/lint1: gcc_bit_field_types.c
Log Message:
tests/lint: document how compilers promote bit-fields
To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c
diff -u src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c:1.7 src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c:1.8
--- src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c:1.7 Sat Jan 28 08:30:12 2023
+++ src/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c Sat Jan 28 08:36:17 2023
@@ -1,4 +1,4 @@
-/* $NetBSD: gcc_bit_field_types.c,v 1.7 2023/01/28 08:30:12 rillig Exp $ */
+/* $NetBSD: gcc_bit_field_types.c,v 1.8 2023/01/28 08:36:17 rillig Exp $ */
# 3 "gcc_bit_field_types.c"
struct incompatible {
@@ -92,6 +92,15 @@ type_of_bit_field(void)
* values from 'unsigned:3', see promote_c90. Maybe that's wrong,
* maybe not, the compilers disagree so lint can offer yet another
* alternative interpretation.
+ *
+ * GCC 12 says: expected 'struct incompatible' but argument is of
+ * type 'unsigned char:3'
+ *
+ * Clang 15 says: error: passing 'unsigned int' to parameter of
+ * incompatible type 'struct incompatible'
+ *
+ * MSVC 19 says: error C2440: 'function': cannot convert from
+ * 'unsigned int' to 'incompatible'
*/
/* expect+1: warning: passing 'unsigned int:3' to incompatible 'struct incompatible', arg #1 [155] */
reveal_type(s.bits);