shithub: riscv

Download patch

ref: 1ddf581f8c820af6316f55e246fac3ceb29191f0
parent: 434fc6a1c4911922014b7fb8f5e9de278424fa97
author: spew <devnull@localhost>
date: Thu May 24 15:31:55 EDT 2018

cc: fix result of operation not used warning for void casts

--- a/sys/src/cmd/1c/cgen.c
+++ b/sys/src/cmd/1c/cgen.c
@@ -376,7 +376,10 @@
 
 	case OCAST:
 		if(result == D_NONE) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, D_NONE, Z);
 			break;
 		}
 		lg = result;
--- a/sys/src/cmd/2c/cgen.c
+++ b/sys/src/cmd/2c/cgen.c
@@ -376,7 +376,10 @@
 
 	case OCAST:
 		if(result == D_NONE) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, D_NONE, Z);
 			break;
 		}
 		lg = result;
--- a/sys/src/cmd/5c/cgen.c
+++ b/sys/src/cmd/5c/cgen.c
@@ -399,7 +399,10 @@
 
 	case OCAST:
 		if(nn == Z) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, Z);
 			break;
 		}
 		/*
--- a/sys/src/cmd/6c/cgen.c
+++ b/sys/src/cmd/6c/cgen.c
@@ -976,7 +976,10 @@
 
 	case OCAST:
 		if(nn == Z) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, Z);
 			break;
 		}
 		/*
--- a/sys/src/cmd/8c/cgen.c
+++ b/sys/src/cmd/8c/cgen.c
@@ -994,7 +994,10 @@
 
 	case OCAST:
 		if(nn == Z) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, Z);
 			break;
 		}
 		/*
--- a/sys/src/cmd/kc/cgen.c
+++ b/sys/src/cmd/kc/cgen.c
@@ -358,7 +358,10 @@
 
 	case OCAST:
 		if(nn == Z) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, Z);
 			break;
 		}
 		/*
--- a/sys/src/cmd/qc/cgen.c
+++ b/sys/src/cmd/qc/cgen.c
@@ -395,7 +395,10 @@
 
 	case OCAST:
 		if(nn == Z) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, Z);
 			break;
 		}
 		/*
--- a/sys/src/cmd/vc/cgen.c
+++ b/sys/src/cmd/vc/cgen.c
@@ -359,7 +359,10 @@
 
 	case OCAST:
 		if(nn == Z) {
-			nullwarn(l, Z);
+			if(n->type != types[TVOID])
+				nullwarn(l, Z);
+			else
+				cgen(l, Z);
 			break;
 		}
 		/*