[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pcc-list
Subject:    pcc fixes for gcc -Wunused-but-set-variable and Solaris 11
From:       <olga.kryzhanovska () gmail ! com>
Date:       2012-08-11 19:16:34
Message-ID: CA+OH3v38DNcmAH76hFEGvoAWfCpHzXzGEUn07GBi7BVSXu3n5g () mail ! gmail ! com
[Download RAW message or body]

Anders, attached is a set of patches which fixes build failures in cvs
with gcc -Wunused-but-set-variable on Suse 12.1 and a small patch from
Roland Mainz which fixes a Solaris 11 issue.

Olga
-- 
      ,   _                                    _   ,
     { \/`o;====-    Olga Kryzhanovska   -====;o`\/ }
.----'-/`-/     olga.kryzhanovska@gmail.com   \-`\-'----.
 `'-..-| /       http://twitter.com/fleyta     \ |-..-'`
      /\/\     Solaris/BSD//C/C++ programmer   /\/\
      `--`                                      `--`

["pcc_wsetunsed_solaris11.diff.txt" (text/plain)]

# fix for Solaris 11
--- os/sunos/ccconfig.h Fri Aug 10 21:54:55 2012
+++ os/sunos/ccconfig.h  Fri Aug 10 21:55:12 2012
@@ -51,7 +51,7 @@
 #endif
 
 /* host-independent */
-#define	DYNLINKER { "-Bdynamic", "/usr/lib/ld.so", NULL }
+#define	DYNLINKER { "-Bdynamic", "/usr/lib/ld.so.1", NULL }
 
 #if defined(mach_i386)
 #define	CPPMDADD { "-D__i386__", "-D__i386", NULL, }

# fixes for -Wunused-but-set-variable and -Werror on Suse 12.1
Index: cc/ccom/gcc_compat.c
===================================================================
RCS file: /cvsroot/pcc/cc/ccom/gcc_compat.c,v
retrieving revision 1.87
diff -u -r1.87 gcc_compat.c
--- cc/ccom/gcc_compat.c	11 Aug 2012 13:29:20 -0000	1.87
+++ cc/ccom/gcc_compat.c	11 Aug 2012 19:11:29 -0000
@@ -566,14 +566,14 @@
 pragmas_gcc(char *t)
 {
 	char u;
-	int ign, warn, err, i;
+	int warn, err, i;
 	extern bittype warnary[], werrary[];
 	extern char *flagstr[], *pragstore;
 
 	if (strcmp((t = pragtok(NULL)), "diagnostic") == 0) {
-		ign = warn = err = 0;
+		warn = err = 0;
 		if (strcmp((t = pragtok(NULL)), "ignored") == 0)
-			ign = 1;
+			;
 		else if (strcmp(t, "warning") == 0)
 			warn = 1;
 		else if (strcmp(t, "error") == 0)
Index: cc/ccom/main.c
===================================================================
RCS file: /cvsroot/pcc/cc/ccom/main.c,v
retrieving revision 1.119
diff -u -r1.119 main.c
--- cc/ccom/main.c	9 Aug 2012 11:41:27 -0000	1.119
+++ cc/ccom/main.c	11 Aug 2012 19:11:29 -0000
@@ -64,11 +64,10 @@
 segvcatch(int a)
 {
 	char buf[1024];
-	int dummy;
 
 	snprintf(buf, sizeof buf, "%sinternal compiler error: %s, line %d\n",
 	    nerrors ? "" : "major ", ftitle, lineno);
-	dummy = write(STDERR_FILENO, buf, strlen(buf));
+	(void)write(STDERR_FILENO, buf, strlen(buf));
 	_exit(1);
 }
 
Index: cc/ccom/trees.c
===================================================================
RCS file: /cvsroot/pcc/cc/ccom/trees.c,v
retrieving revision 1.309
diff -u -r1.309 trees.c
--- cc/ccom/trees.c	20 Jun 2012 20:01:10 -0000	1.309
+++ cc/ccom/trees.c	11 Aug 2012 19:11:30 -0000
@@ -2399,9 +2399,9 @@
 wrualfld(NODE *val, NODE *d, TWORD t, TWORD ct, int off, int fsz)
 { 
 	NODE *p, *q, *r, *rn, *s;
-	int tsz, ctsz, t2f, inbits;
+	int ctsz, t2f, inbits;
  
-	tsz = (int)tsize(t, 0, 0);
+	(void)tsize(t, 0, 0);
 	ctsz = (int)tsize(ct, 0, 0);
   
 	ct = ENUNSIGN(ct);
@@ -2473,16 +2473,21 @@
 static NODE *
 rmfldops(NODE *p)
 {
-	CONSZ msk;
 	TWORD t, ct;
 	NODE *q, *r, *t1, *t2, *bt, *t3, *t4;
-	int fsz, foff, tsz;
-
+	int fsz, foff;
+#if TARGET_ENDIAN == TARGET_BE
+	int tsz;
+#endif
 	if (p->n_op == FLD) {
 		/* Rewrite a field read operation */
 		fsz = UPKFSZ(p->n_rval);
 		foff = UPKFOFF(p->n_rval);
+#if TARGET_ENDIAN == TARGET_BE
 		tsz = (int)tsize(p->n_left->n_type, 0, 0);
+#else
+		(void)tsize(p->n_left->n_type, 0, 0);
+#endif
 		q = buildtree(ADDROF, p->n_left, NIL);
 
 		ct = t = p->n_type;
@@ -2511,11 +2516,12 @@
 		fsz = UPKFSZ(q->n_rval);
 		foff = UPKFOFF(q->n_rval);
 		t = q->n_left->n_type;
-		tsz = (int)tsize(t, 0, 0);
 #if TARGET_ENDIAN == TARGET_BE
+		tsz = (int)tsize(t, 0, 0);
 		foff = tsz - fsz - foff;
+#else
+		(void)tsize(t, 0, 0);
 #endif
-		msk = (((1LL << (fsz-1))-1) << 1) | 1;
 		bt = NULL;
 		if (p->n_right->n_op != ICON && p->n_right->n_op != NAME) {
 			t2 = tempnode(0, p->n_right->n_type, 0, 0);
Index: cc/cpp/cpp.c
===================================================================
RCS file: /cvsroot/pcc/cc/cpp/cpp.c,v
retrieving revision 1.154
diff -u -r1.154 cpp.c
--- cc/cpp/cpp.c	9 Aug 2012 18:21:29 -0000	1.154
+++ cc/cpp/cpp.c	11 Aug 2012 19:11:30 -0000
@@ -927,16 +927,15 @@
 {
 	usch *t;
 	usch *sb = stringbuf;
-	int dummy;
 
 	flbuf();
 	savch(0);
 	if (ifiles != NULL) {
 		t = sheap("%s:%d: warning: ", ifiles->fname, ifiles->lineno);
-		dummy = write (2, t, strlen((char *)t));
+		(void)write (2, t, strlen((char *)t));
 	}
-	dummy = write (2, s, strlen((char *)s));
-	dummy = write (2, "\n", 1);
+	(void)write (2, s, strlen((char *)s));
+	(void)write (2, "\n", 1);
 	stringbuf = sb;
 }
 
@@ -944,16 +943,15 @@
 xerror(usch *s)
 {
 	usch *t;
-	int dummy;
 
 	flbuf();
 	savch(0);
 	if (ifiles != NULL) {
 		t = sheap("%s:%d: error: ", ifiles->fname, ifiles->lineno);
-		dummy = write (2, t, strlen((char *)t));
+		(void)write (2, t, strlen((char *)t));
 	}
-	dummy = write (2, s, strlen((char *)s));
-	dummy = write (2, "\n", 1);
+	(void)write (2, s, strlen((char *)s));
+	(void)write (2, "\n", 1);
 	exit(1);
 }
 
Index: cc/cpp/token.c
===================================================================
RCS file: /cvsroot/pcc/cc/cpp/token.c,v
retrieving revision 1.71
diff -u -r1.71 token.c
--- cc/cpp/token.c	10 Aug 2012 08:12:35 -0000	1.71
+++ cc/cpp/token.c	11 Aug 2012 19:11:30 -0000
@@ -809,7 +809,7 @@
 	extern struct initar *initar;
 	struct includ ibuf;
 	struct includ *ic;
-	int otrulvl, i;
+	int otrulvl;
 
 	ic = &ibuf;
 	ic->next = ifiles;
@@ -843,7 +843,7 @@
 		prinit(initar, ic);
 		initar = NULL;
 		if (dMflag)
-			i = write(ofd, ic->buffer, strlen((char *)ic->buffer));
+			(void)write(ofd, ic->buffer, strlen((char *)ic->buffer));
 		fastscan();
 		prtline();
 		ic->infil = oin;
@@ -872,18 +872,17 @@
 prtline(void)
 {
 	usch *s, *os = stringbuf;
-	int i;
 
 	if (Mflag) {
 		if (dMflag)
 			return; /* no output */
 		if (ifiles->lineno == 1) {
 			s = sheap("%s: %s\n", Mfile, ifiles->fname);
-			i = write(ofd, s, strlen((char *)s));
+			(void)write(ofd, s, strlen((char *)s));
 			if (MPflag &&
 			    strcmp((const char *)ifiles->fname, (char *)MPfile)) {
 				s = sheap("%s:\n", ifiles->fname);
-				i = write(ofd, s, strlen((char *)s));
+				(void)write(ofd, s, strlen((char *)s));
 			}
 		}
 	} else if (!Pflag) {
Index: cc/cxxcom/gcc_compat.c
===================================================================
RCS file: /cvsroot/pcc/cc/cxxcom/gcc_compat.c,v
retrieving revision 1.3
diff -u -r1.3 gcc_compat.c
--- cc/cxxcom/gcc_compat.c	22 Apr 2012 21:07:41 -0000	1.3
+++ cc/cxxcom/gcc_compat.c	11 Aug 2012 19:11:31 -0000
@@ -512,14 +512,14 @@
 pragmas_gcc(char *t)
 {
 	char u;
-	int ign, warn, err, i;
+	int warn, err, i;
 	extern bittype warnary[], werrary[];
 	extern char *flagstr[], *pragstore;
 
 	if (strcmp((t = pragtok(NULL)), "diagnostic") == 0) {
-		ign = warn = err = 0;
+		warn = err = 0;
 		if (strcmp((t = pragtok(NULL)), "ignored") == 0)
-			ign = 1;
+			;
 		else if (strcmp(t, "warning") == 0)
 			warn = 1;
 		else if (strcmp(t, "error") == 0)
Index: cc/cxxcom/main.c
===================================================================
RCS file: /cvsroot/pcc/cc/cxxcom/main.c,v
retrieving revision 1.4
diff -u -r1.4 main.c
--- cc/cxxcom/main.c	22 Mar 2012 18:51:40 -0000	1.4
+++ cc/cxxcom/main.c	11 Aug 2012 19:11:31 -0000
@@ -63,11 +63,10 @@
 segvcatch(int a)
 {
 	char buf[1024];
-	int dummy;
 
 	snprintf(buf, sizeof buf, "%sinternal compiler error: %s, line %d\n",
 	    nerrors ? "" : "major ", ftitle, lineno);
-	dummy = write(STDERR_FILENO, buf, strlen(buf));
+	(void)write(STDERR_FILENO, buf, strlen(buf));
 	_exit(1);
 }
 
Index: mip/match.c
===================================================================
RCS file: /cvsroot/pcc/mip/match.c,v
retrieving revision 1.98
diff -u -r1.98 match.c
--- mip/match.c	22 Mar 2012 18:51:41 -0000	1.98
+++ mip/match.c	11 Aug 2012 19:11:31 -0000
@@ -60,6 +60,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define _SVID_SOURCE 1 /* needed to get ffs() prototype */
+
 #include "pass2.h"
 
 #ifdef HAVE_STRINGS_H
Index: mip/optim2.c
===================================================================
RCS file: /cvsroot/pcc/mip/optim2.c,v
retrieving revision 1.82
diff -u -r1.82 optim2.c
--- mip/optim2.c	16 Aug 2011 06:14:16 -0000	1.82
+++ mip/optim2.c	11 Aug 2012 19:11:32 -0000
@@ -1870,12 +1870,11 @@
 	struct block_map* map ;
 	unsigned long block_count = count_blocks(p2e);
 	unsigned long i ;
-	unsigned long threads;
 	struct interpass *front, *back ;
 
 	map = tmpalloc(block_count * sizeof(struct block_map));
 
-	threads = map_blocks(p2e, map, block_count) ;
+	(void)map_blocks(p2e, map, block_count) ;
 
 	back = map[0].block->last ;
 	for (i=1; i < block_count; i++) {
Index: mip/regs.c
===================================================================
RCS file: /cvsroot/pcc/mip/regs.c,v
retrieving revision 1.228
diff -u -r1.228 regs.c
--- mip/regs.c	22 Mar 2012 18:51:41 -0000	1.228
+++ mip/regs.c	11 Aug 2012 19:11:33 -0000
@@ -26,6 +26,8 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#define _SVID_SOURCE 1 /* needed to get ffs() prototype */
+
 #include "pass2.h"
 #include <string.h>
 #ifdef HAVE_STRINGS_H


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic