Re: [rfc] removing/conditionalising WERROR= in Makefiles

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Fri, 30 Dec 2011 14:06:52 +0100
On 2011-12-26 11:10, Alexander Best wrote:
> that's why i'd like to propose the following patch. i ran a full tinderbox run
> against r228878 and it suceeded.

Did you also try this with clang?  For example the xfs module alone gets
a whole slew of warnings, which would be fatal if WERROR= was removed:

   sys/gnu/fs/xfs/xfs_dir2_block.c:1149:17: warning: array index of '1' indexes past the end of an array (that contains 1 element) [-Warray-bounds]
	  dep->name[0] = dep->name[1] = '.';
			 ^         ~
   sys/gnu/fs/xfs/xfs_dir2_data.h:90:2: note: array 'name' declared here
	  __uint8_t               name[1];        /* name bytes, no null */
	  ^
   1 warning generated.

   sys/gnu/fs/xfs/xfs_dir2_sf.c:117:27: warning: array index of '1' indexes past the end of an array (that contains 1 element) [-Warray-bounds]
			  dep->name[0] == '.' && dep->name[1] == '.';
						 ^         ~
   sys/gnu/fs/xfs/xfs_dir2_data.h:90:2: note: array 'name' declared here
	  __uint8_t               name[1];        /* name bytes, no null */
	  ^
   sys/gnu/fs/xfs/xfs_dir2_sf.c:237:28: warning: array index of '1' indexes past the end of an array (that contains 1 element) [-Warray-bounds]
			   dep->name[0] == '.' && dep->name[1] == '.')
						  ^         ~
   sys/gnu/fs/xfs/xfs_dir2_data.h:90:2: note: array 'name' declared here
	  __uint8_t               name[1];        /* name bytes, no null */
	  ^
   2 warnings generated.

   sys/gnu/fs/xfs/xfs_vfsops.c:1958:19: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
			  sbuf_printf(m, xfs_infop->str);
					 ^~~~~~~~~~~~~~
   1 warning generated.

   sys/gnu/fs/xfs/FreeBSD/xfs_super.c:257:9: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
	  printf(message);
		 ^~~~~~~
   1 warning generated.

   sys/gnu/fs/xfs/FreeBSD/xfs_stats.c:68:32: warning: format string is not a string literal (potentially insecure) [-Wformat-security]
		  len += sprintf(buffer + len, xstats[i].desc);
					       ^~~~~~~~~~~~~~
   sys/gnu/fs/xfs/FreeBSD/xfs_stats.c:99:33: warning: if statement has empty body [-Wempty-body]
	  if (&xfs_read_xfsstats != NULL);
					 ^
   2 warnings generated.
   sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c:1252:10: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
			  error = error;
			  ~~~~~ ^ ~~~~~
   sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c:1290:9: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
		  error = error;
		  ~~~~~ ^ ~~~~~
   sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c:1299:10: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
			  error = error;
			  ~~~~~ ^ ~~~~~
   sys/gnu/fs/xfs/FreeBSD/xfs_ioctl.c:1350:9: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]
		  error = error;
		  ~~~~~ ^ ~~~~~
   4 warnings generated.

Most of the warnings should probably be fixed, but as this is mainly
contrib code, and GPL to boot, it makes not much sense to do so.
Received on Fri Dec 30 2011 - 12:06:50 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:22 UTC