all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* compiler warning "comparison is always true"
@ 2008-02-02  1:00 Glenn Morris
  2008-02-08 20:25 ` Glenn Morris
  0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2008-02-02  1:00 UTC (permalink / raw)
  To: emacs-devel


If anyone cares, there are now lots of warnings when compiling on
32-bit GNU/Linux with gcc 4.1:

  search.c:2456: warning: comparison is always true due to limited
  range of data type

Similar warnings all over the place in syntax.c (45 instances).




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

* Re: compiler warning "comparison is always true"
  2008-02-02  1:00 compiler warning "comparison is always true" Glenn Morris
@ 2008-02-08 20:25 ` Glenn Morris
  2008-02-09 10:53   ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2008-02-08 20:25 UTC (permalink / raw)
  To: emacs-devel

Glenn Morris wrote:

>   search.c:2456: warning: comparison is always true due to limited
>   range of data type
>
> Similar warnings all over the place in syntax.c (45 instances).

FWIW, looks like almost all of these are due to FETCH_CHAR_AS_MULTIBYTE.




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

* Re: compiler warning "comparison is always true"
  2008-02-08 20:25 ` Glenn Morris
@ 2008-02-09 10:53   ` Eli Zaretskii
  2008-02-09 19:41     ` Glenn Morris
  0 siblings, 1 reply; 9+ messages in thread
From: Eli Zaretskii @ 2008-02-09 10:53 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> From: Glenn Morris <rgm@gnu.org>
> Date: Fri, 08 Feb 2008 15:25:01 -0500
> 
> Glenn Morris wrote:
> 
> >   search.c:2456: warning: comparison is always true due to limited
> >   range of data type
> >
> > Similar warnings all over the place in syntax.c (45 instances).
> 
> FWIW, looks like almost all of these are due to FETCH_CHAR_AS_MULTIBYTE.

Thanks for this valuable hint.  I think I fixed this now in CVS.




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

* Re: compiler warning "comparison is always true"
  2008-02-09 10:53   ` Eli Zaretskii
@ 2008-02-09 19:41     ` Glenn Morris
  2008-02-16 14:52       ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2008-02-09 19:41 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii wrote:

> Thanks for this valuable hint.  I think I fixed this now in CVS.

Thank you from the bottom of my compilation-warning-obsessed heart. :)

There are three similar warnings left in font.c (3500, 3526, 3970),
all due to things of the form:

unsigned code;
if (code <= MOST_POSITIVE_FIXNUM);




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

* Re: compiler warning "comparison is always true"
  2008-02-09 19:41     ` Glenn Morris
@ 2008-02-16 14:52       ` Eli Zaretskii
  2008-02-16 22:34         ` Glenn Morris
  2008-02-16 23:08         ` Jason Rumney
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2008-02-16 14:52 UTC (permalink / raw)
  To: Glenn Morris; +Cc: emacs-devel

> From: Glenn Morris <rgm@gnu.org>
> Cc: emacs-devel@gnu.org
> Date: Sat, 09 Feb 2008 14:41:46 -0500
> 
> Eli Zaretskii wrote:
> 
> > Thanks for this valuable hint.  I think I fixed this now in CVS.
> 
> Thank you from the bottom of my compilation-warning-obsessed heart. :)
> 
> There are three similar warnings left in font.c (3500, 3526, 3970),
> all due to things of the form:
> 
> unsigned code;
> if (code <= MOST_POSITIVE_FIXNUM);

I think I fixed that as well.  Please try.




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

* Re: compiler warning "comparison is always true"
  2008-02-16 14:52       ` Eli Zaretskii
@ 2008-02-16 22:34         ` Glenn Morris
  2008-02-16 23:05           ` Jason Rumney
  2008-02-16 23:08         ` Jason Rumney
  1 sibling, 1 reply; 9+ messages in thread
From: Glenn Morris @ 2008-02-16 22:34 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

Eli Zaretskii wrote:

> I think I fixed that as well.  Please try.

Works for me. Thanks!

There was one more in fontset.c that I forgot to mention - I copied
what you did.

Wasn't the compiler right though - isn't comparing against
MOST_POSITIVE_FIXNUM pointless?




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

* Re: compiler warning "comparison is always true"
  2008-02-16 22:34         ` Glenn Morris
@ 2008-02-16 23:05           ` Jason Rumney
  0 siblings, 0 replies; 9+ messages in thread
From: Jason Rumney @ 2008-02-16 23:05 UTC (permalink / raw)
  To: Glenn Morris; +Cc: Eli Zaretskii, emacs-devel

Glenn Morris wrote:
> Eli Zaretskii wrote:
>
>   
>> I think I fixed that as well.  Please try.
>>     
>
> Works for me. Thanks!
>
> There was one more in fontset.c that I forgot to mention - I copied
> what you did.
>
> Wasn't the compiler right though - isn't comparing against
> MOST_POSITIVE_FIXNUM pointless?
>   

Only on 64 bit platforms where MOST_POSITIVE_FIXNUM is larger than MAX_UINT.







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

* Re: compiler warning "comparison is always true"
  2008-02-16 14:52       ` Eli Zaretskii
  2008-02-16 22:34         ` Glenn Morris
@ 2008-02-16 23:08         ` Jason Rumney
  2008-02-17  4:27           ` Eli Zaretskii
  1 sibling, 1 reply; 9+ messages in thread
From: Jason Rumney @ 2008-02-16 23:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Glenn Morris, emacs-devel

Eli Zaretskii wrote:
> I think I fixed that as well.  Please try.
>   

Doesn't "fixing" these warnings prevent the compiler from optimizing the 
tests away when they are not required?





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

* Re: compiler warning "comparison is always true"
  2008-02-16 23:08         ` Jason Rumney
@ 2008-02-17  4:27           ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2008-02-17  4:27 UTC (permalink / raw)
  To: Jason Rumney; +Cc: rgm, emacs-devel

> Date: Sat, 16 Feb 2008 23:08:00 +0000
> From: Jason Rumney <jasonr@gnu.org>
> CC: Glenn Morris <rgm@gnu.org>, emacs-devel@gnu.org
> 
> Eli Zaretskii wrote:
> > I think I fixed that as well.  Please try.
> >   
> 
> Doesn't "fixing" these warnings prevent the compiler from optimizing the 
> tests away when they are not required?

Maybe, I didn't look at the code.  But even if it does, I can hardly
believe it matters in this context.

If you know a way of fixing it without this side effect, please
install a different change.  Alternatively, you are welcome to try
convincing GCC developers to stop issuing warnings about perfectly
valid code, unless invoked with -Wall; I gave up on that a long time
ago, after being flamed into silence.




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

end of thread, other threads:[~2008-02-17  4:27 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-02-02  1:00 compiler warning "comparison is always true" Glenn Morris
2008-02-08 20:25 ` Glenn Morris
2008-02-09 10:53   ` Eli Zaretskii
2008-02-09 19:41     ` Glenn Morris
2008-02-16 14:52       ` Eli Zaretskii
2008-02-16 22:34         ` Glenn Morris
2008-02-16 23:05           ` Jason Rumney
2008-02-16 23:08         ` Jason Rumney
2008-02-17  4:27           ` Eli Zaretskii

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.