public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088)
@ 2008-11-12 21:26 Jakub Jelinek
  2008-11-12 21:36 ` Andrew Haley
  2008-11-13 17:55 ` Michael Meissner
  0 siblings, 2 replies; 5+ messages in thread
From: Jakub Jelinek @ 2008-11-12 21:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: Andrew Haley

[-- Attachment #1: Type: text/plain, Size: 301 bytes --]

Hi!

Attached are 2 alternative patches to fix this.  According to
hwint.h HOST_WIDEST_INT can be long, long long or __int64 and
__LONG_LONG_MAX__ is a GCC built-in macro that most other compilers
don't have.  Both have been (separately) bootstrapped/regtested
on x86_64-linux.

Ok for trunk?

	Jakub

[-- Attachment #2: Y107 --]
[-- Type: text/plain, Size: 630 bytes --]

2008-11-12  Jakub Jelinek  <jakub@redhat.com>

	PR bootstrap/38088
	* mcf.c (CAP_INFINITY): Use HOST_WIDEST_INT maximum, not GCC specific
	__LONG_LONG_MAX__.

--- gcc/mcf.c.jj	2008-09-30 16:57:11.000000000 +0200
+++ gcc/mcf.c	2008-11-12 14:05:04.000000000 +0100
@@ -56,7 +56,9 @@ along with GCC; see the file COPYING3.  
 #include "profile.h"
 
 /* CAP_INFINITY: Constant to represent infinite capacity.  */
-#define CAP_INFINITY __LONG_LONG_MAX__
+#define CAP_INFINITY \
+  ((HOST_WIDEST_INT) \
+   ((((unsigned HOST_WIDEST_INT) 1) << (HOST_BITS_PER_WIDEST_INT - 1)) - 1))
 
 /* COST FUNCTION.  */
 #define K_POS(b)        ((b))

[-- Attachment #3: Y107a --]
[-- Type: text/plain, Size: 557 bytes --]

2008-11-12  Andrew Haley  <aph@redhat.com>

	PR bootstrap/38088
	* mcf.c (CAP_INFINITY): Use HOST_WIDEST_INT maximum, not GCC specific
	__LONG_LONG_MAX__.

--- gcc/mcf.c.jj	2008-09-30 16:57:11.000000000 +0200
+++ gcc/mcf.c	2008-11-12 14:05:04.000000000 +0100
@@ -56,7 +56,7 @@ along with GCC; see the file COPYING3.  
 #include "profile.h"
 
 /* CAP_INFINITY: Constant to represent infinite capacity.  */
-#define CAP_INFINITY __LONG_LONG_MAX__
+#define CAP_INFINITY INTTYPE_MAXIMUM (HOST_WIDEST_INT)
 
 /* COST FUNCTION.  */
 #define K_POS(b)        ((b))

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

* Re: [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088)
  2008-11-12 21:26 [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088) Jakub Jelinek
@ 2008-11-12 21:36 ` Andrew Haley
  2008-11-12 21:46   ` Jakub Jelinek
  2008-11-13 17:55 ` Michael Meissner
  1 sibling, 1 reply; 5+ messages in thread
From: Andrew Haley @ 2008-11-12 21:36 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Jakub Jelinek wrote:
> Hi!
> 
> Attached are 2 alternative patches to fix this.  According to
> hwint.h HOST_WIDEST_INT can be long, long long or __int64 and
> __LONG_LONG_MAX__ is a GCC built-in macro that most other compilers
> don't have.  Both have been (separately) bootstrapped/regtested
> on x86_64-linux.
> 
> Ok for trunk?

For which one do you seek approval?  :-)

Andrew.

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

* Re: [PATCH] Fix mcf.c reliance on a GCC extension (PR  bootstrap/38088)
  2008-11-12 21:36 ` Andrew Haley
@ 2008-11-12 21:46   ` Jakub Jelinek
  2008-11-13 11:37     ` Andrew Haley
  0 siblings, 1 reply; 5+ messages in thread
From: Jakub Jelinek @ 2008-11-12 21:46 UTC (permalink / raw)
  To: Andrew Haley; +Cc: gcc-patches

On Wed, Nov 12, 2008 at 09:23:28PM +0000, Andrew Haley wrote:
> Jakub Jelinek wrote:
> > Attached are 2 alternative patches to fix this.  According to
> > hwint.h HOST_WIDEST_INT can be long, long long or __int64 and
> > __LONG_LONG_MAX__ is a GCC built-in macro that most other compilers
> > don't have.  Both have been (separately) bootstrapped/regtested
> > on x86_64-linux.
> > 
> > Ok for trunk?
> 
> For which one do you seek approval?  :-)

Doesn't matter. ;)

	Jakub

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

* Re: [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088)
  2008-11-12 21:46   ` Jakub Jelinek
@ 2008-11-13 11:37     ` Andrew Haley
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Haley @ 2008-11-13 11:37 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches

Jakub Jelinek wrote:
> On Wed, Nov 12, 2008 at 09:23:28PM +0000, Andrew Haley wrote:
>> Jakub Jelinek wrote:
>>> Attached are 2 alternative patches to fix this.  According to
>>> hwint.h HOST_WIDEST_INT can be long, long long or __int64 and
>>> __LONG_LONG_MAX__ is a GCC built-in macro that most other compilers
>>> don't have.  Both have been (separately) bootstrapped/regtested
>>> on x86_64-linux.
>>>
>>> Ok for trunk?
>> For which one do you seek approval?  :-)
> 
> Doesn't matter. ;)

Well, I prefer mine 'cos it's a lot easier to read.

Either way this is obvious/trivial and doesn't require approval.

Andrew.

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

* Re: [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088)
  2008-11-12 21:26 [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088) Jakub Jelinek
  2008-11-12 21:36 ` Andrew Haley
@ 2008-11-13 17:55 ` Michael Meissner
  1 sibling, 0 replies; 5+ messages in thread
From: Michael Meissner @ 2008-11-13 17:55 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: gcc-patches, Andrew Haley

On Wed, Nov 12, 2008 at 10:03:23PM +0100, Jakub Jelinek wrote:
> Hi!
> 
> Attached are 2 alternative patches to fix this.  According to
> hwint.h HOST_WIDEST_INT can be long, long long or __int64 and
> __LONG_LONG_MAX__ is a GCC built-in macro that most other compilers
> don't have.  Both have been (separately) bootstrapped/regtested
> on x86_64-linux.
> 
> Ok for trunk?

Yes.  I tend to prefer the second, but either on is ok.

> 	Jakub

> 2008-11-12  Jakub Jelinek  <jakub@redhat.com>
> 
> 	PR bootstrap/38088
> 	* mcf.c (CAP_INFINITY): Use HOST_WIDEST_INT maximum, not GCC specific
> 	__LONG_LONG_MAX__.
> 
> --- gcc/mcf.c.jj	2008-09-30 16:57:11.000000000 +0200
> +++ gcc/mcf.c	2008-11-12 14:05:04.000000000 +0100
> @@ -56,7 +56,9 @@ along with GCC; see the file COPYING3.  
>  #include "profile.h"
> 
>  /* CAP_INFINITY: Constant to represent infinite capacity.  */
> -#define CAP_INFINITY __LONG_LONG_MAX__
> +#define CAP_INFINITY \
> +  ((HOST_WIDEST_INT) \
> +   ((((unsigned HOST_WIDEST_INT) 1) << (HOST_BITS_PER_WIDEST_INT - 1)) - 1))
> 
>  /* COST FUNCTION.  */
>  #define K_POS(b)        ((b))

> 2008-11-12  Andrew Haley  <aph@redhat.com>
> 
> 	PR bootstrap/38088
> 	* mcf.c (CAP_INFINITY): Use HOST_WIDEST_INT maximum, not GCC specific
> 	__LONG_LONG_MAX__.
> 
> --- gcc/mcf.c.jj	2008-09-30 16:57:11.000000000 +0200
> +++ gcc/mcf.c	2008-11-12 14:05:04.000000000 +0100
> @@ -56,7 +56,7 @@ along with GCC; see the file COPYING3.  
>  #include "profile.h"
> 
>  /* CAP_INFINITY: Constant to represent infinite capacity.  */
> -#define CAP_INFINITY __LONG_LONG_MAX__
> +#define CAP_INFINITY INTTYPE_MAXIMUM (HOST_WIDEST_INT)
> 
>  /* COST FUNCTION.  */
>  #define K_POS(b)        ((b))


-- 
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com

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

end of thread, other threads:[~2008-11-13 16:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-11-12 21:26 [PATCH] Fix mcf.c reliance on a GCC extension (PR bootstrap/38088) Jakub Jelinek
2008-11-12 21:36 ` Andrew Haley
2008-11-12 21:46   ` Jakub Jelinek
2008-11-13 11:37     ` Andrew Haley
2008-11-13 17:55 ` Michael Meissner

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).