public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Possible spurious warning for isdigit() under sparc-sun-solaris2.5.1 and egcs 110597?
@ 1997-11-09  9:13 Daniel Eisenbud
  1997-11-09  9:25 ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Daniel Eisenbud @ 1997-11-09  9:13 UTC (permalink / raw)
  To: egcs

The following macro in <ctype.h> (both in /usr/include, and egcs's fixed
version):

#define isdigit(c)      ((__ctype + 1)[c] & _N)   

makes egcs -Wall emit a warning that the subscript is a char every time
isdigit is used on a char.  First of all, perhaps this is a bug, not a
feature.  But it seems like making Wall warn on every use of ischar,
isdigit, etc, is bad.  Maybe fixincludes should add a cast?  (Excuse me
if this has already been discussed - I have been following the list, but
sometimes intermittently.

-Daniel Eisenbud

-- 
Daniel Eisenbud
eisenbud@cs.swarthmore.edu

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Possible spurious warning for isdigit() under sparc-sun-solaris2.5.1 and egcs 110597?
  1997-11-09  9:13 Possible spurious warning for isdigit() under sparc-sun-solaris2.5.1 and egcs 110597? Daniel Eisenbud
@ 1997-11-09  9:25 ` Ian Lance Taylor
  1997-11-10  4:17   ` egcs/fortran warnings (Was : possible spurious warning for isdigit) Philippe De Muyter
  0 siblings, 1 reply; 9+ messages in thread
From: Ian Lance Taylor @ 1997-11-09  9:25 UTC (permalink / raw)
  To: eisenbud; +Cc: egcs

   Date: Sun, 9 Nov 1997 12:13:37 -0500
   From: Daniel Eisenbud <eisenbud@cs.swarthmore.edu>

   The following macro in <ctype.h> (both in /usr/include, and egcs's fixed
   version):

   #define isdigit(c)      ((__ctype + 1)[c] & _N)   

   makes egcs -Wall emit a warning that the subscript is a char every time
   isdigit is used on a char.  First of all, perhaps this is a bug, not a
   feature.  But it seems like making Wall warn on every use of ischar,
   isdigit, etc, is bad.  Maybe fixincludes should add a cast?  (Excuse me
   if this has already been discussed - I have been following the list, but
   sometimes intermittently.

ANSI C says that the argument to all these functions must be ``an int,
the value of which is representable as an unsigned char or [...] equal
[to] the value of the macro EOF.''

If your code is passing a char, and char is signed, then your code is
indeed doing something that is worth warning about, since a negative
value for signed char is not representable as unsigned char.  This
could catch you if you ever use a machine that uses character values
greater than 127.

In my opinion you should fix your code to include the casts.  Or you
shouldn't use -Wall.  I think it's reasonable to require casts to
disable warnings.

Adding a cast to unsigned char to isdigit, et. al., would be simply
incorrect, since it would cause the macros to return the wrong value
for EOF.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-09  9:25 ` Ian Lance Taylor
@ 1997-11-10  4:17   ` Philippe De Muyter
  1997-11-10 12:27     ` Craig Burley
  0 siblings, 1 reply; 9+ messages in thread
From: Philippe De Muyter @ 1997-11-10  4:17 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: eisenbud, egcs

> 
> ANSI C says that the argument to all these functions must be ``an int,
> the value of which is representable as an unsigned char or [...] equal
> [to] the value of the macro EOF.''
> 
> If your code is passing a char, and char is signed, then your code is
> indeed doing something that is worth warning about, since a negative
> value for signed char is not representable as unsigned char.  This
> could catch you if you ever use a machine that uses character values
> greater than 127.
> 
> In my opinion you should fix your code to include the casts.  Or you
> shouldn't use -Wall.  I think it's reasonable to require casts to
> disable warnings.
> 

Well, here are the warnings I get when compiling egcs-971105/g77 :

/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:459: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:459: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:488: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:488: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:506: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/expr.c:9608: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/implic.c:96: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/intrin.c:1554: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/intrin.c:1556: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/intrin.c:1556: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4296: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4302: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4431: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4466: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4526: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4547: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/proj.c:36: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1919: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1942: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1953: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1962: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1975: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:2565: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:2810: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:3108: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:3372: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:3383: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:4185: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:4806: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:5367: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:5600: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6470: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6585: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6692: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6706: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:7189: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:7344: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:7491: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:8688: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:9689: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:9711: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:9767: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:10047: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:10221: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:12011: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:12236: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:17977: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:19446: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:19664: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:19909: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:20602: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:20756: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:20968: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:22716: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:22749: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:24189: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:24444: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/target.c:2320: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/target.c:2364: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/target.c:2408: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/top.c:153: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:459: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:459: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:488: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:488: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/bad.c:506: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/expr.c:9608: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/implic.c:96: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/intrin.c:1554: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/intrin.c:1556: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/intrin.c:1556: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4296: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4302: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4431: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4466: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4526: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/lex.c:4547: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/proj.c:36: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1919: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1942: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1953: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1962: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:1975: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:2565: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:2810: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:3108: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:3372: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:3383: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:4185: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:4806: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:5367: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:5600: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6470: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6585: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6692: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:6706: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:7189: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:7344: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:7491: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:8688: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:9689: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:9711: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:9767: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:10047: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:10221: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:12011: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:12236: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:17977: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:19446: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:19664: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:19909: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:20602: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:20756: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:20968: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:22716: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:22749: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:24189: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/stb.c:24444: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/target.c:2320: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/target.c:2364: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/target.c:2408: warning: subscript has type `char'
/usr/gnu/tmp/egcs-971105/gcc/f/top.c:153: warning: subscript has type `char'

Philippe

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-10 13:47       ` Ian Lance Taylor
@ 1997-11-10 10:59         ` Philippe De Muyter
  1997-11-10 11:52         ` Craig Burley
  1 sibling, 0 replies; 9+ messages in thread
From: Philippe De Muyter @ 1997-11-10 10:59 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: burley, eisenbud, egcs

> 
>    Or, let me know if these functions are supposed to accept
>    int, not char, and I'll change g77 accordingly (though that
>    would seem to be a painful thing to do, offhand).
> 
> The functions take an int argument whose value is either representable
> as an unsigned char, or is EOF.  gcc is warning when you pass a char,
> since when char is sign extended to int it may take on values which
> are not representable as an unsigned char.

In some places, is* is applied to a char, member of a char array.
I surmise there can't be an EOF there.
Perhaps would it then be enough to use an unsigned char array there.

Philippe

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-10 13:47       ` Ian Lance Taylor
  1997-11-10 10:59         ` Philippe De Muyter
@ 1997-11-10 11:52         ` Craig Burley
  1997-11-10 12:27           ` Richard Henderson
  1997-11-10 13:47           ` Ian Lance Taylor
  1 sibling, 2 replies; 9+ messages in thread
From: Craig Burley @ 1997-11-10 11:52 UTC (permalink / raw)
  To: ian; +Cc: phdm, eisenbud, egcs

>The functions take an int argument whose value is either representable
>as an unsigned char, or is EOF.  gcc is warning when you pass a char,
>since when char is sign extended to int it may take on values which
>are not representable as an unsigned char.

Okay, that sounds like the right thing to do in general.

However, I'll have to put this off at least until I can take
enough time to figure out just how one is supposed to portably,
efficiently, and standard-conformingly do things like
`isalpha("foo"[0])' when the compiler encodes strings as `char *'.

That is, generally, I'm not sure offhand how to properly use
these functions when the character has already been read
via, say, getc(), validated as not being EOF, and copied into
an element of a `char *'.  Simply casting the `char' back to
`int' is plainly wrong, but maybe casting it to `unsigned char'
isn't?

(Any boilerplate or other guideline info would be appreciated!)

        tq vm, (burley)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-10  4:17   ` egcs/fortran warnings (Was : possible spurious warning for isdigit) Philippe De Muyter
@ 1997-11-10 12:27     ` Craig Burley
  1997-11-10 13:47       ` Ian Lance Taylor
  0 siblings, 1 reply; 9+ messages in thread
From: Craig Burley @ 1997-11-10 12:27 UTC (permalink / raw)
  To: phdm; +Cc: ian, eisenbud, egcs

>> In my opinion you should fix your code to include the casts.  Or you
>> shouldn't use -Wall.  I think it's reasonable to require casts to
>> disable warnings.
>> 
>
>Well, here are the warnings I get when compiling egcs-971105/g77 :

[warnings against g77 code I wrote omitted]

I looked at the first few of these, and they were all cases
of invocations of <ctype.h>'s "isfoo" functions with a char
argument.

Let me know about any exceptions to this -- I'm getting closer
to building egcs myself, but not quite there yet (still gotta
install a new disk drive).

In the meantime, it seems the right place to fix this is the
<ctype.h> implementations of is* (and maybe to*) functions on
the system(s) that yield these warnings.  Maybe all they
need is a cast; or maybe they need a way to properly handle
negative inputs that a simple cast wouldn't solve.

Or, let me know if these functions are supposed to accept
int, not char, and I'll change g77 accordingly (though that
would seem to be a painful thing to do, offhand).

        tq vm, (burley)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-10 11:52         ` Craig Burley
@ 1997-11-10 12:27           ` Richard Henderson
  1997-11-10 13:47           ` Ian Lance Taylor
  1 sibling, 0 replies; 9+ messages in thread
From: Richard Henderson @ 1997-11-10 12:27 UTC (permalink / raw)
  To: Craig Burley; +Cc: egcs

On Mon, Nov 10, 1997 at 01:31:41PM -0500, Craig Burley wrote:
> >The functions take an int argument whose value is either representable
> >as an unsigned char, or is EOF.  gcc is warning when you pass a char,
> >since when char is sign extended to int it may take on values which
> >are not representable as an unsigned char.

Depending on the context, you may be able to state that the characters,
due to previous scanning, are all < 128, and so the warning can be ignored.

Off and on I get patches for modutils "fixing" the same problem in the
output of gprof, despite the fact that I know the string being tested
is a C symbol.

> However, I'll have to put this off at least until I can take
> enough time to figure out just how one is supposed to portably,
> efficiently, and standard-conformingly do things like
> `isalpha("foo"[0])' when the compiler encodes strings as `char *'.

isalpha and friends take an int and are guaranteed to work for both
signed and unsigned character input.  They also work for EOF which,
I believe, is not a member of any set.


r~

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-10 11:52         ` Craig Burley
  1997-11-10 12:27           ` Richard Henderson
@ 1997-11-10 13:47           ` Ian Lance Taylor
  1 sibling, 0 replies; 9+ messages in thread
From: Ian Lance Taylor @ 1997-11-10 13:47 UTC (permalink / raw)
  To: burley; +Cc: phdm, eisenbud, egcs

   Date: Mon, 10 Nov 1997 13:31:41 -0500 (EST)
   From: Craig Burley <burley@gnu.org>

   However, I'll have to put this off at least until I can take
   enough time to figure out just how one is supposed to portably,
   efficiently, and standard-conformingly do things like
   `isalpha("foo"[0])' when the compiler encodes strings as `char *'.

Either
    isalpha ((unsigned char) ("foo"[0]))
or
    isalpha (((const unsigned char *) "foo")[0])

   That is, generally, I'm not sure offhand how to properly use
   these functions when the character has already been read
   via, say, getc(), validated as not being EOF, and copied into
   an element of a `char *'.  Simply casting the `char' back to
   `int' is plainly wrong, but maybe casting it to `unsigned char'
   isn't?

Right; just cast to unsigned char.  Some very very old compilers don't
support unsigned char, but that is presumably not a problem for the
code in question.  (For those compilers, you can safely `& 0xff').

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: egcs/fortran warnings (Was : possible spurious warning for isdigit)
  1997-11-10 12:27     ` Craig Burley
@ 1997-11-10 13:47       ` Ian Lance Taylor
  1997-11-10 10:59         ` Philippe De Muyter
  1997-11-10 11:52         ` Craig Burley
  0 siblings, 2 replies; 9+ messages in thread
From: Ian Lance Taylor @ 1997-11-10 13:47 UTC (permalink / raw)
  To: burley; +Cc: phdm, eisenbud, egcs

   Date: Mon, 10 Nov 1997 12:52:21 -0500 (EST)
   From: Craig Burley <burley@gnu.org>

   In the meantime, it seems the right place to fix this is the
   <ctype.h> implementations of is* (and maybe to*) functions on
   the system(s) that yield these warnings.  Maybe all they
   need is a cast; or maybe they need a way to properly handle
   negative inputs that a simple cast wouldn't solve.

I thought I mentioned this in my earlier message: there is no easy way
for fixincludes to fix these macros in a manner that will work for
both all unsigned char values and for EOF.  I suppose we could use
some inefficient hack using gcc expression statements, but I don't see
any efficient way to do it.

   Or, let me know if these functions are supposed to accept
   int, not char, and I'll change g77 accordingly (though that
   would seem to be a painful thing to do, offhand).

The functions take an int argument whose value is either representable
as an unsigned char, or is EOF.  gcc is warning when you pass a char,
since when char is sign extended to int it may take on values which
are not representable as an unsigned char.

Ian

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~1997-11-10 13:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-11-09  9:13 Possible spurious warning for isdigit() under sparc-sun-solaris2.5.1 and egcs 110597? Daniel Eisenbud
1997-11-09  9:25 ` Ian Lance Taylor
1997-11-10  4:17   ` egcs/fortran warnings (Was : possible spurious warning for isdigit) Philippe De Muyter
1997-11-10 12:27     ` Craig Burley
1997-11-10 13:47       ` Ian Lance Taylor
1997-11-10 10:59         ` Philippe De Muyter
1997-11-10 11:52         ` Craig Burley
1997-11-10 12:27           ` Richard Henderson
1997-11-10 13:47           ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).