Skip to contentSkip to conversation

some warnings seen while building librdmacm 1.0.16

DISCUSSION Or Gerlitz 2 participants 2 messages Oct 29, 2012 – Nov 5, 2012 1 message not in the archive InfiniBand

lore
Share & tools
lore

Or Gerlitz

author
#0 lore raw

Hi Sean,

FYI -- the below warnings seen while building librdmacm 1.0.16 with gcc 4.4.6 through rpmbuild

Or.

Quoted 41 lines

make[1]: Entering directory `/root/rpmbuild/BUILD/librdmacm-1.0.16'

  CC     src_librdmacm_la-cma.lo
  CC     src_librdmacm_la-addrinfo.lo
  CC     src_librdmacm_la-acm.lo
  CC     src_librdmacm_la-rsocket.lo
  CC     src_librdmacm_la-indexer.lo
  CC     src_librspreload_la-preload.lo
  CC     src_librspreload_la-indexer.lo
  CC     cmatose.o
  CC     common.o
  CC     rping.o
  CC     udaddy.o
  CC     mckey.o
  CC     rdma_client.o
  CC     rdma_server.o
  CC     rdma_xclient.o
  CC     rdma_xserver.o
  CC     rstream.o

src/rsocket.c: In function 'rs_configure':
src/rsocket.c:223: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result src/rsocket.c:228: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result src/rsocket.c:236: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result src/rsocket.c:241: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result src/rsocket.c:246: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result src/rsocket.c:254: warning: ignoring return value of 'fscanf', declared with attribute warn_unused_result examples/mckey.c: In function 'run':
examples/mckey.c:473: warning: dereferencing pointer 'sib' does break strict-aliasing rules examples/mckey.c:471: note: initialized from here

  CC     rcopy.o
  CCLD   src/librdmacm.la
  CCLD   src/librspreload.la
  CCLD   examples/ucmatose
  CCLD   examples/rping
  CCLD   examples/udaddy
  CCLD   examples/mckey
  CCLD   examples/rdma_client
  CCLD   examples/rdma_server
  CCLD   examples/rdma_xclient
  CCLD   examples/rstream
  CCLD   examples/rdma_xserver
  CCLD   examples/rcopy
Quoted 1 line

make[1]: Leaving directory `/root/rpmbuild/BUILD/librdmacm-1.0.16'

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

A message that is not in the archive (sent off-list or not yet received): 508E71F4.8080205-VPRAkNaXOzVWk0Htik3J/[email protected]

#2 lore raw

I've added the following patch to eliminate the fscanf warnings:

rsocket: Remove fscanf build warnings

Cast fscanf return values to (void) to indicate that we don't care if the call fails. In the case of a failure, we simply fall back to using default values.

Problem reported by Or Gerlitz <ogerlitz-VPRAkNaXOzVWk0Htik3J/[email protected]>

src/rsocket.c +7 -7
index 74dbcc7..58fcb8e 100644
@@ -256,12 +256,12 @@ void rs_configure(void)
 		goto out;
 
 	if ((f = fopen(RS_CONF_DIR "/polling_time", "r"))) {
-		fscanf(f, "%u", &polling_time);
+		(void) fscanf(f, "%u", &polling_time);
 		fclose(f);
 	}
 
 	if ((f = fopen(RS_CONF_DIR "/inline_default", "r"))) {
-		fscanf(f, "%hu", &def_inline);
+		(void) fscanf(f, "%hu", &def_inline);
 		fclose(f);
 
 		if (def_inline < RS_MIN_INLINE)
@@ -269,17 +269,17 @@ void rs_configure(void)
 	}
 
 	if ((f = fopen(RS_CONF_DIR "/sqsize_default", "r"))) {
-		fscanf(f, "%hu", &def_sqsize);
+		(void) fscanf(f, "%hu", &def_sqsize);
 		fclose(f);
 	}
 
 	if ((f = fopen(RS_CONF_DIR "/rqsize_default", "r"))) {
-		fscanf(f, "%hu", &def_rqsize);
+		(void) fscanf(f, "%hu", &def_rqsize);
 		fclose(f);
 	}
 
 	if ((f = fopen(RS_CONF_DIR "/mem_default", "r"))) {
-		fscanf(f, "%u", &def_mem);
+		(void) fscanf(f, "%u", &def_mem);
 		fclose(f);
 
 		if (def_mem < 1)
@@ -287,14 +287,14 @@ void rs_configure(void)
 	}
 
 	if ((f = fopen(RS_CONF_DIR "/wmem_default", "r"))) {
-		fscanf(f, "%u", &def_wmem);
+		(void) fscanf(f, "%u", &def_wmem);
 		fclose(f);
 		if (def_wmem < RS_SNDLOWAT)
 			def_wmem = RS_SNDLOWAT << 1;
 	}
 
 	if ((f = fopen(RS_CONF_DIR "/iomap_size", "r"))) {
-		fscanf(f, "%hu", &def_iomap_size);
+		(void) fscanf(f, "%hu", &def_iomap_size);
 		fclose(f);
 
 		/* round to supported values */

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html