Re: CVS commit: src/games

2014-03-23 Thread David Laight
On Sun, Mar 23, 2014 at 12:17:40AM +, David A. Holland wrote:
 Module Name:  src
 Committed By: dholland
 Date: Sun Mar 23 00:17:40 UTC 2014
 
 Modified Files:
   src/games: Makefile.inc
 
 Log Message:
 Add note cautioning against bothering with WARNS=6 until gcc improves
 (or -Wconversion is removed from WARNS=6) as it produces loads of false
 positives. The most entertaining of these that I've seen this afternoon:
 
 games/hack/hack.apply.c:143:22: error: conversion to 'unsigned char:1' from 
 'int' may alter its value [-Werror=conversion]
flags.move = multi = 0;

I agree.

If the compiler was doing some simple checks on the domain of the
value the it might be sensible, but otherwise is generates a lot
of false positives fo very little gain.

I dislike adding casts between integer types just to appease compiler
(and lint) warnings. They make the code unreadable and can hide
much more serious errors.

I'll live with -Wsign-compare even though that is sometimes painful.
Even then the compiler can 'know' that the signed variable never
contains a negative value - so need not emit a warning.

For instance with:
for (int i = 0; i  sizeof foo; i++)
it can't matter that the comparison is unsigned because 'i' can be
assumed to be non-negative (even if 'sizeof foo' is greater than MAXINT).


David

-- 
David Laight: da...@l8s.co.uk


Re: CVS commit: src/games

2014-03-23 Thread Christos Zoulas
In article 20140323125252.gx20...@snowdrop.l8s.co.uk,
David Laight  da...@l8s.co.uk wrote:

For instance with:
   for (int i = 0; i  sizeof foo; i++)
it can't matter that the comparison is unsigned because 'i' can be
assumed to be non-negative (even if 'sizeof foo' is greater than MAXINT).

But then you end up doing something with i, that is done in signed
context, while it would have been better done as unsinged.

christos



re: CVS commit: src/share/mk

2014-03-23 Thread matthew green

Matthias Scheler writes:
 Module Name:  src
 Committed By: tron
 Date: Sun Mar 23 19:49:52 UTC 2014
 
 Modified Files:
   src/share/mk: bsd.x11.mk
 
 Log Message:
 Fix generation of pkg-config(1) files. Patch from Ryo ONODERA via
 current-users mailing list.

thanks for fixing those.


.mrg.