CVS commit: src/regress/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Sun Mar 21 00:03:46 UTC 2010 Added Files: src/regress/usr.bin/xlint/lint1: test27.c Log Message: right shift of unsigned quantities with constant. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/regress/usr.bin/xlint/lint1/test27.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/regress/usr.bin/xlint/lint1/test27.c diff -u /dev/null src/regress/usr.bin/xlint/lint1/test27.c:1.1 --- /dev/null Sat Mar 20 20:03:46 2010 +++ src/regress/usr.bin/xlint/lint1/test27.c Sat Mar 20 20:03:46 2010 @@ -0,0 +1,23 @@ +// Test that type shifts that result to narrower types don't produce warnings. +void +foo(void) { + unsigned long l = 100; + unsigned long long ll = 100; + unsigned int i = 100; + unsigned short s = 100; + unsigned char c = 1; + + l = ll >> 32; +// i = ll >> 31; + i = ll >> 32; + s = ll >> 48; + c = ll >> 56; + s = i >> 16; + c = i >> 24; + c = s >> 8; + (void)≪ + (void)&l; + (void)&i; + (void)&s; + (void)&c; +}
CVS commit: src/regress/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Sun Oct 4 15:12:42 UTC 2009 Added Files: src/regress/usr.bin/xlint/lint1: test26.c Log Message: add packed tests. To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/regress/usr.bin/xlint/lint1/test26.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/regress/usr.bin/xlint/lint1/test26.c diff -u /dev/null src/regress/usr.bin/xlint/lint1/test26.c:1.1 --- /dev/null Sun Oct 4 11:12:42 2009 +++ src/regress/usr.bin/xlint/lint1/test26.c Sun Oct 4 11:12:41 2009 @@ -0,0 +1,35 @@ +/* packed tests */ + +struct in_addr { + int x; +}; +struct ip_timestamp { + char ipt_code; + char ipt_len; + char ipt_ptr; + unsigned int ipt_flg:4, + ipt_oflw:4; + union ipt_timestamp { + int ipt_time[1]; + struct ipt_ta { + struct in_addr ipt_addr; + int ipt_time; + } ipt_ta[1] __packed; + } ipt_timestamp __packed; +} __packed; + +typedef struct __packed { + int x; +} t; + +struct x { + char c; + long l; +} __packed; + +struct y { + char c; + long l; +}; + +int a[sizeof(struct y) - sizeof(struct x) - 1];
CVS commit: src/regress/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Sat May 2 16:12:12 UTC 2009 Added Files: src/regress/usr.bin/xlint/lint1: test25.c Log Message: Add __alignof__ test To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/regress/usr.bin/xlint/lint1/test25.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/regress/usr.bin/xlint/lint1/test25.c diff -u /dev/null src/regress/usr.bin/xlint/lint1/test25.c:1.1 --- /dev/null Sat May 2 12:12:12 2009 +++ src/regress/usr.bin/xlint/lint1/test25.c Sat May 2 12:12:12 2009 @@ -0,0 +1,6 @@ +/* __alignof__ */ +int +main(void) +{ + return __alignof__(short); +}
CVS commit: src/regress/usr.bin/xlint/lint1
Module Name:src Committed By: christos Date: Fri May 1 22:06:07 UTC 2009 Added Files: src/regress/usr.bin/xlint/lint1: test24.c Log Message: add test for c99 for loops To generate a diff of this commit: cvs rdiff -u -r0 -r1.3 src/regress/usr.bin/xlint/lint1/test24.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/regress/usr.bin/xlint/lint1/test24.c diff -u /dev/null src/regress/usr.bin/xlint/lint1/test24.c:1.3 --- /dev/null Fri May 1 18:06:07 2009 +++ src/regress/usr.bin/xlint/lint1/test24.c Fri May 1 18:06:06 2009 @@ -0,0 +1,10 @@ +/* c99 for loops */ +extern void foo(int); + +int +main(void) +{ + for (int i = 0; i < 10; i++) + foo(i); + return 0; +}