Patchwork RFA: Fix frv --enable-werror-always build on 64 bit hosts

login
register
mail settings
Submitter Joern Rennecke
Date Dec. 2, 2010, 12:30 a.m.
Message ID <20101201193006.4c5mnv9j408s0coo-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/73919/
State New
Headers show

Comments

Joern Rennecke - Dec. 2, 2010, 12:30 a.m.
By using an inline function instead of a macro, warnings for 'always true'
comparisons are avoided.

cross-tested on x86_64-pc-linux-gnu and i686-pc-linux-gnu.
2010-12-02  Joern Rennecke  <amylaar@spamcop.net>

	PR target/46735
	* config/frv/frv.h (IN_RANGE_P): Change into an inline function.
Andrew Pinski - Dec. 2, 2010, 1:08 a.m.
On Wed, Dec 1, 2010 at 4:30 PM, Joern Rennecke <amylaar@spamcop.net> wrote:
> By using an inline function instead of a macro, warnings for 'always true'
> comparisons are avoided.
>

How about using the IN_RANGE macro from system.h instead of having a new one?

-- Pinski

Patch

Index: config/frv/frv.h
===================================================================
--- config/frv/frv.h	(revision 167318)
+++ config/frv/frv.h	(working copy)
@@ -27,10 +27,13 @@ 
 /* Align an address.  */
 #define ADDR_ALIGN(addr,align) (((addr) + (align) - 1) & ~((align) - 1))
 
-/* Return true if a value is inside a range.  */
-#define IN_RANGE_P(VALUE, LOW, HIGH)				\
-  (   (((HOST_WIDE_INT)(VALUE)) >= (HOST_WIDE_INT)(LOW))	\
-   && (((HOST_WIDE_INT)(VALUE)) <= ((HOST_WIDE_INT)(HIGH))))
+/* Return true if a value is inside a range.  Make this an inline
+   function rather than a macro, lest we get host-dependent warnings.  */
+static inline bool
+IN_RANGE_P (HOST_WIDE_INT value, HOST_WIDE_INT low, HOST_WIDE_INT high)
+{
+  return value >= low && value <= high;
+}
 
 
 /* Driver configuration.  */