Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/regress/usr.bin/xlint/lint1 Tiny stand-alone code fragments ...
details: https://anonhg.NetBSD.org/src/rev/6f07649c1bd1
branches: trunk
changeset: 538547:6f07649c1bd1
user: christos <christos%NetBSD.org@localhost>
date: Tue Oct 22 13:33:38 2002 +0000
description:
Tiny stand-alone code fragments to test lint's features/bugs.
Use obj/lint1 testX.c /dev/null to test.
We don't descend here or provide any test infrastructure yet.
diffstat:
regress/usr.bin/xlint/lint1/test0.c | 10 ++++++++++
regress/usr.bin/xlint/lint1/test1.c | 8 ++++++++
regress/usr.bin/xlint/lint1/test2.c | 13 +++++++++++++
regress/usr.bin/xlint/lint1/test3.c | 27 +++++++++++++++++++++++++++
regress/usr.bin/xlint/lint1/test4.c | 7 +++++++
regress/usr.bin/xlint/lint1/test5.c | 7 +++++++
regress/usr.bin/xlint/lint1/test6.c | 7 +++++++
7 files changed, 79 insertions(+), 0 deletions(-)
diffs (107 lines):
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test0.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test0.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,10 @@
+/* C99 struct initialization */
+struct {
+ int i;
+ char *s;
+} c[] = {
+ { .i = 2, },
+ { .s = "foo" },
+ { .i = 1, .s = "bar" },
+ { .s = "foo", .i = -1 },
+};
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test1.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test1.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,8 @@
+/* C99 union initialization */
+union {
+ int i;
+ char *s;
+} c[] = {
+ { i: 1 },
+ { s: "foo" }
+};
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test2.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test2.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,13 @@
+/* C99 recursive struct/union initialization */
+struct top {
+ int i;
+ char c;
+ union onion {
+ short us;
+ char uc;
+ } u;
+ char *s;
+} c[] = {
+ { .s = "foo", .c = 'b', .u = { .uc = 'c' } },
+ { .i = 1, .c = 'a', .u = { .us = 2 } },
+};
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test3.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test3.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,27 @@
+/* cast initialization */
+typedef unsigned char u_char;
+typedef unsigned int size_t;
+struct sockaddr_x25 {
+ u_char x25_len;
+ u_char x25_family;
+ short x25_net;
+ char x25_addr[16];
+ struct x25opts {
+ char op_flags;
+ char op_psize;
+ char op_wsize;
+ char op_speed;
+ } x25_opts;
+ short x25_udlen;
+ char x25_udata[16];
+};
+
+struct sockaddr_x25 x25_dgmask = {
+ (unsigned char)(unsigned char)(unsigned int)(unsigned long)(&((( struct sockaddr_x25 *)0)->x25_udata[1])) ,
+ 0,
+ 0,
+ {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+ {0, 0, 0, 0},
+ -1,
+ {-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1},
+};
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test4.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test4.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,7 @@
+/* cast initialization as the rhs of a - operand */
+struct sockaddr_dl {
+ char sdl_data[2];
+};
+
+int npdl_datasize = sizeof(struct sockaddr_dl) -
+((int) ((unsigned long)&((struct sockaddr_dl *) 0)->sdl_data[0]));
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test5.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test5.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,7 @@
+/* pointer casts are valid lhs lvalues */
+
+void
+foo() {
+ unsigned long p = 6;
+ ((struct sockaddr *)p) = 0;
+}
diff -r 50e23638ba6e -r 6f07649c1bd1 regress/usr.bin/xlint/lint1/test6.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test6.c Tue Oct 22 13:33:38 2002 +0000
@@ -0,0 +1,7 @@
+/* gcc __FUNCTION__ */
+
+void
+foo(const char *p) {
+ p = __FUNCTION__;
+ foo(p);
+}
Home |
Main Index |
Thread Index |
Old Index