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 lint/tests: test query for usual a...
details: https://anonhg.NetBSD.org/src/rev/8c2419052b9d
branches: trunk
changeset: 372973:8c2419052b9d
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Jan 08 18:21:00 2023 +0000
description:
lint/tests: test query for usual arithmetic conversions
diffstat:
tests/usr.bin/xlint/lint1/queries.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diffs (30 lines):
diff -r 0436faf2a349 -r 8c2419052b9d tests/usr.bin/xlint/lint1/queries.c
--- a/tests/usr.bin/xlint/lint1/queries.c Sun Jan 08 17:54:03 2023 +0000
+++ b/tests/usr.bin/xlint/lint1/queries.c Sun Jan 08 18:21:00 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: queries.c,v 1.6 2022/09/24 19:55:44 rillig Exp $ */
+/* $NetBSD: queries.c,v 1.7 2023/01/08 18:21:00 rillig Exp $ */
# 3 "queries.c"
/*
@@ -95,6 +95,20 @@
unsigned long long
Q4(signed char *ptr, int i, unsigned long long ull)
{
+
+ /* expect+1: usual arithmetic conversion for '&' from 'int' to 'unsigned int' [Q4] */
+ u32 = u32 & 0xff;
+ /*
+ * XXX: C99 5.6.16.2 says that the usual arithmetic conversions
+ * happen for compound assignments as well.
+ */
+ u32 &= 0xff;
+
+ /* expect+3: implicit conversion changes sign from 'unsigned char' to 'int' [Q3] */
+ /* expect+2: usual arithmetic conversion for '&' from 'int' to 'unsigned int' [Q4] */
+ /* expect+1: implicit conversion changes sign from 'int' to 'unsigned int' [Q3] */
+ u32 = u32 & u8;
+
/*
* The conversion from 'signed char' to 'int' is done by the integer
* promotions (C11 6.3.1.1p2), not by the usual arithmetic
Home |
Main Index |
Thread Index |
Old Index