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: add another test for a...
details: https://anonhg.NetBSD.org/src/rev/dbcfbad19f27
branches: trunk
changeset: 369683:dbcfbad19f27
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 27 21:59:41 2022 +0000
description:
tests/lint: add another test for aligned struct member
In the kernel, several structs have this attribute, and running lint on
them runs into a compile-time assertion. Typical error messages are:
* error: illegal bit-field size: 255 [36]
* error: integral constant expression expected [55]
diffstat:
tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c | 16 +++++++++++++++-
1 files changed, 15 insertions(+), 1 deletions(-)
diffs (27 lines):
diff -r b40cda405ecd -r dbcfbad19f27 tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c
--- a/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c Sat Aug 27 21:53:38 2022 +0000
+++ b/tests/usr.bin/xlint/lint1/gcc_attribute_aligned.c Sat Aug 27 21:59:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: gcc_attribute_aligned.c,v 1.3 2022/06/17 18:54:53 rillig Exp $ */
+/* $NetBSD: gcc_attribute_aligned.c,v 1.4 2022/08/27 21:59:41 rillig Exp $ */
# 3 "gcc_attribute_aligned.c"
/*
@@ -43,3 +43,17 @@
/* expect+1: error: illegal bit-field size: 255 [36] */
unsigned int sizeof_save87: sizeof(struct save87) == 108 ? 1 : -1;
};
+
+
+void
+aligned_struct_member(void)
+{
+ struct aligned {
+ int first;
+ int second __attribute__((__aligned__(16)));
+ };
+
+ /* TODO: should be -20 instead of -8. */
+ /* expect+1: error: negative array dimension (-8) [20] */
+ typedef int ctassert[-(int)sizeof(struct aligned)];
+}
Home |
Main Index |
Thread Index |
Old Index