Subject: Re: gcc-current and warnings in bin/sh
To: None <tech-userlevel@netbsd.org>
From: David Laight <david@l8s.co.uk>
List: tech-userlevel
Date: 06/06/2002 18:48:58
On Wed, Jun 05, 2002 at 10:52:40PM +0100, Ben Harris wrote:
> > Because it isn't! dunno where -129 might come from!
> 
> The "strange dance" I meant was:
> 

ok - I hadn't looked at the source last night - didn't realise
the file concerned was generated on the fly!  OTOH the source
quoted had ((unsigned char)-1)   :-(

Looking more closely....

- the layout of some of that source is horrid!
  the { for some functions isn't in col 1.
  there are { and } in col 1 that aren't the top of functions

- CTLQUOTEMARK was added a few years ago - but the is_name (etc)
  macros weren't updated.  It is possible that very strange
  things will happen if 0x88 gets into the input buffer.

- the domain of the netbsd isaplha (etc) seems to be -1..127
  now I haven't looked hard enough to see if the code does
  mask out the top bits - but it may be unlikely (and undesirable
  for non-english locales).
  If 8-bit data can get here (and the tests for > CTLESC imply
  it might) then isalpa will return random results.
  (the SuS says the domain of isalpha is (effectively) -1..255)

- the tests that failed ( all is_name(*p) ) can never have EOF
  so maybe a different test should be used?

Anyone fancy rototilling the character handling of sh?
Should it work with 8-bit characters?  If not should it
be using locale dependant isalpha() etc anyway?

	David

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