Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/tests/usr.bin/xlint/lint1 tests/lint: document how compilers...
details: https://anonhg.NetBSD.org/src/rev/40a7c7102cce
branches: trunk
changeset: 373266:40a7c7102cce
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jan 28 08:36:17 2023 +0000
description:
tests/lint: document how compilers promote bit-fields
diffstat:
tests/usr.bin/xlint/lint1/gcc_bit_field_types.c | 11 ++++++++++-
1 files changed, 10 insertions(+), 1 deletions(-)
diffs (25 lines):
diff -r d473dfc255e5 -r 40a7c7102cce tests/usr.bin/xlint/lint1/gcc_bit_field_types.c
--- a/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c Sat Jan 28 08:30:12 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_bit_field_types.c Sat Jan 28 08:36:17 2023 +0000
@@ -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 @@
* 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);
Home |
Main Index |
Thread Index |
Old Index