Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Jan 2017 23:05:29 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r311947 - head/usr.bin/rpcgen
Message-ID:  <201701112305.v0BN5Tsp021075@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Wed Jan 11 23:05:29 2017
New Revision: 311947
URL: https://svnweb.freebsd.org/changeset/base/311947

Log:
  rpcgen(1): Avoid unused variable warning on generated code.
  
  Avoid "unused variable 'i'" warnings in generated .c files by only
  emitting the "int i;" for non-opaque arrays. Opaque arrays use
  xdr_opaque() rather than iterating over the array.
  
  Obtained from:	OpenBSD (CVS rev 1.28)
  MFC after:	1 week

Modified:
  head/usr.bin/rpcgen/rpc_cout.c

Modified: head/usr.bin/rpcgen/rpc_cout.c
==============================================================================
--- head/usr.bin/rpcgen/rpc_cout.c	Wed Jan 11 22:54:04 2017	(r311946)
+++ head/usr.bin/rpcgen/rpc_cout.c	Wed Jan 11 23:05:29 2017	(r311947)
@@ -551,7 +551,8 @@ emit_struct(definition *def)
 	}
 
 	for (dl = def->def.st.decls; dl != NULL; dl = dl->next)
-		if (dl->decl.rel == REL_VECTOR){
+		if (dl->decl.rel == REL_VECTOR &&
+		    strcmp(dl->decl.type, "opaque") != 0){
 			f_print(fout, "\tint i;\n");
 			break;
 		}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201701112305.v0BN5Tsp021075>