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 Add union cast test



details:   https://anonhg.NetBSD.org/src/rev/e0516fa105ae
branches:  trunk
changeset: 817392:e0516fa105ae
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Aug 19 10:21:50 2016 +0000

description:
Add union cast test

diffstat:

 tests/usr.bin/xlint/lint1/Makefile           |   3 ++-
 tests/usr.bin/xlint/lint1/d_c99_union_cast.c |  18 ++++++++++++++++++
 2 files changed, 20 insertions(+), 1 deletions(-)

diffs (39 lines):

diff -r 49f244f68608 -r e0516fa105ae tests/usr.bin/xlint/lint1/Makefile
--- a/tests/usr.bin/xlint/lint1/Makefile        Fri Aug 19 10:20:42 2016 +0000
+++ b/tests/usr.bin/xlint/lint1/Makefile        Fri Aug 19 10:21:50 2016 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.12 2016/08/18 14:45:56 christos Exp $
+# $NetBSD: Makefile,v 1.13 2016/08/19 10:21:50 christos Exp $
 
 NOMAN=         # defined
 
@@ -24,6 +24,7 @@
 FILES+=                d_c99_recursive_init.c
 FILES+=                d_c99_struct_init.c
 FILES+=                d_c99_nested_struct.c
+FILES+=                d_c99_union_cast.c
 FILES+=                d_c99_union_init1.c
 FILES+=                d_c99_union_init2.c
 FILES+=                d_c99_union_init3.c
diff -r 49f244f68608 -r e0516fa105ae tests/usr.bin/xlint/lint1/d_c99_union_cast.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/usr.bin/xlint/lint1/d_c99_union_cast.c      Fri Aug 19 10:21:50 2016 +0000
@@ -0,0 +1,18 @@
+/* union cast */
+
+struct bar {
+       int a;
+       int b;
+};
+
+union foo {
+       struct bar *a;
+       int b;
+};
+
+void
+foo(void) {
+       struct bar *a;
+
+       ((union foo)a).a;
+}



Home | Main Index | Thread Index | Old Index