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 right shift of unsigned quantiti...



details:   https://anonhg.NetBSD.org/src/rev/e55e5824dab8
branches:  trunk
changeset: 753225:e55e5824dab8
user:      christos <christos%NetBSD.org@localhost>
date:      Sun Mar 21 00:03:46 2010 +0000

description:
right shift of unsigned quantities with constant.

diffstat:

 regress/usr.bin/xlint/lint1/test27.c |  23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)

diffs (27 lines):

diff -r ae5949590562 -r e55e5824dab8 regress/usr.bin/xlint/lint1/test27.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/regress/usr.bin/xlint/lint1/test27.c      Sun Mar 21 00:03:46 2010 +0000
@@ -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)&ll;
+       (void)&l;
+       (void)&i;
+       (void)&s;
+       (void)&c;
+}



Home | Main Index | Thread Index | Old Index