From af32b0503e3da9788e8a904dc44b590514b5fd28 Mon Sep 17 00:00:00 2001 From: ghazi Date: Sun, 21 Oct 2001 19:44:08 +0000 Subject: [PATCH] * arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE. * system.h (IN_RANGE): New macro. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46395 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/arm/arm.h | 3 +-- gcc/system.h | 10 ++++++++++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 056e39d9489..9e8abcc4505 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2001-10-21 Kaveh R. Ghazi + + * arm.h (FUNCTION_ARG_REGNO_P): Use IN_RANGE. + + * system.h (IN_RANGE): New macro. + 2001-10-21 Zack Weinberg * aclocal.m4 (AM_WITH_NLS): Also create and substitute diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index fcd3d42ce34..7347298772f 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -1505,8 +1505,7 @@ typedef struct /* 1 if N is a possible register number for function argument passing. On the ARM, r0-r3 are used to pass args. */ -#define FUNCTION_ARG_REGNO_P(REGNO) \ - ((REGNO) >= 0 && (REGNO) <= 3) +#define FUNCTION_ARG_REGNO_P(REGNO) (IN_RANGE ((REGNO), 0, 3)) /* Tail calling. */ diff --git a/gcc/system.h b/gcc/system.h index 55a9370aca4..7cf3b5fe8bf 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -168,6 +168,16 @@ extern int errno; /* Get definitions of HOST_WIDE_INT and HOST_WIDEST_INT. */ #include "hwint.h" +/* A macro to determine whether a VALUE lies inclusively within a + certain range without evaluating the VALUE more than once. This + macro won't warn if the VALUE is unsigned and the LOWER bound is + zero, as it would e.g. with "VALUE >= 0 && ...". Note the LOWER + bound *is* evaluated twice, and LOWER must not be greater than + UPPER. However the bounds themselves can be either positive or + negative. */ +#define IN_RANGE(VALUE, LOWER, UPPER) \ + ((unsigned HOST_WIDE_INT)((VALUE) - (LOWER)) <= ((UPPER) - (LOWER))) + /* Infrastructure for defining missing _MAX and _MIN macros. Note that macros defined with these cannot be used in #if. */ -- 2.11.4.GIT