Module Name: src
Committed By: rillig
Date: Fri May 3 15:32:37 UTC 2024
Modified Files:
src/tests/usr.bin/xlint/lint1: expr_sizeof.c
Log Message:
tests/lint: skip test for sizeof struct on 32-bit platforms
Even though the test only uses fixed-size types, lint's computed size of
the resulting struct differs between i386 (80) and x86_64 (112). Both
are wrong, probably due to the unrelated struct declaration above, as
already mentioned in the comments.
To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/tests/usr.bin/xlint/lint1/expr_sizeof.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/expr_sizeof.c
diff -u src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.16 src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.17
--- src/tests/usr.bin/xlint/lint1/expr_sizeof.c:1.16 Thu May 2 20:03:33 2024
+++ src/tests/usr.bin/xlint/lint1/expr_sizeof.c Fri May 3 15:32:37 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: expr_sizeof.c,v 1.16 2024/05/02 20:03:33 rillig Exp $ */
+/* $NetBSD: expr_sizeof.c,v 1.17 2024/05/03 15:32:37 rillig Exp $ */
# 3 "expr_sizeof.c"
/*
@@ -7,6 +7,8 @@
*/
/* lint1-extra-flags: -X 351 */
+// TODO: Remove the lp64 restriction when sequence_of_structs has been fixed.
+/* lint1-only-if: lp64 */
/*
* A sizeof expression can either take a type name or an expression.
@@ -222,7 +224,6 @@ sequence_of_structs(void)
typedef short unsigned int uint16_t;
typedef unsigned int uint32_t;
typedef long unsigned int uint64_t;
- typedef unsigned long size_t;
union fp_addr {
uint64_t fa_64;
@@ -255,10 +256,10 @@ sequence_of_structs(void)
};
/* expect+1: error: negative array dimension (-20) [20] */
- typedef int o1[-(int)((size_t)(unsigned long)(&(((struct save87 *)0)->s87_dp)))];
+ typedef int o1[-(int)((unsigned long)(&(((struct save87 *)0)->s87_dp)))];
// FIXME: must be 28.
/* expect+1: error: negative array dimension (-32) [20] */
- typedef int o2[-(int)((size_t)(unsigned long)(&(((struct save87 *)0)->s87_ac)))];
+ typedef int o2[-(int)((unsigned long)(&(((struct save87 *)0)->s87_ac)))];
// FIXME: must be 108.
/* expect+1: error: negative array dimension (-112) [20] */
typedef int reveal[-(int)sizeof(struct save87)];