diff options
author | Mike Frysinger <vapier@gentoo.org> | 2016-01-04 22:24:03 -0500 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2016-01-04 22:24:03 -0500 |
commit | bc273e17510c7680bcffee75858d374aa93f7e4b (patch) | |
tree | 70fafc5ebb2b4104b5d0169578f8e24f4a497ba4 /sim/common | |
parent | ac8eefeb243ad326946c3b2b78ba5d1367fe0f99 (diff) | |
download | binutils-gdb-bc273e17510c7680bcffee75858d374aa93f7e4b.tar.gz |
sim: unify min/max macros
Import defines from gdb/defs.h to the sim core so we can delete the
various copies that already exist.
Diffstat (limited to 'sim/common')
-rw-r--r-- | sim/common/ChangeLog | 9 | ||||
-rw-r--r-- | sim/common/cgen-scache.c | 4 | ||||
-rw-r--r-- | sim/common/cgen-trace.c | 3 | ||||
-rw-r--r-- | sim/common/cgen-utils.c | 3 | ||||
-rw-r--r-- | sim/common/sim-basics.h | 7 |
5 files changed, 17 insertions, 9 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index e0eebb2214e..f8cdbf4d1b2 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,5 +1,14 @@ 2016-01-04 Mike Frysinger <vapier@gentoo.org> + * cgen-scache.c (MAX): Delete. + (scache_init): Change MAX to max. + * cgen-trace.c (min): Delete. + * cgen-utils.c (min): Delete. + * sim-basics.h [!min] (min): Define. + [!max] (max): Define. + +2016-01-04 Mike Frysinger <vapier@gentoo.org> + * sim-options.c (sim_parse_args): Tweak getopt error message. 2016-01-04 Mike Frysinger <vapier@gentoo.org> diff --git a/sim/common/cgen-scache.c b/sim/common/cgen-scache.c index e0c35704036..3a795140e40 100644 --- a/sim/common/cgen-scache.c +++ b/sim/common/cgen-scache.c @@ -27,8 +27,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sim-options.h" #include "sim-io.h" -#define MAX(a,b) ((a) > (b) ? (a) : (b)) - /* Unused address. */ #define UNUSED_ADDR 0xffffffff @@ -212,7 +210,7 @@ scache_init (SIM_DESC sd) #if WITH_SCACHE_PBB CPU_SCACHE_MAX_CHAIN_LENGTH (cpu) = MAX_CHAIN_LENGTH; CPU_SCACHE_NUM_HASH_CHAIN_ENTRIES (cpu) = MAX_HASH_CHAIN_LENGTH; - CPU_SCACHE_NUM_HASH_CHAINS (cpu) = MAX (MIN_HASH_CHAINS, + CPU_SCACHE_NUM_HASH_CHAINS (cpu) = max (MIN_HASH_CHAINS, CPU_SCACHE_SIZE (cpu) / SCACHE_HASH_RATIO); CPU_SCACHE_HASH_TABLE (cpu) = diff --git a/sim/common/cgen-trace.c b/sim/common/cgen-trace.c index 5adc552a0e6..2332df4f3d9 100644 --- a/sim/common/cgen-trace.c +++ b/sim/common/cgen-trace.c @@ -24,9 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "sim-main.h" #include "sim-fpu.h" -#undef min -#define min(a,b) ((a) < (b) ? (a) : (b)) - #ifndef SIZE_INSTRUCTION #define SIZE_INSTRUCTION 16 #endif diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c index b16a608063e..d17fb42ce1c 100644 --- a/sim/common/cgen-utils.c +++ b/sim/common/cgen-utils.c @@ -28,9 +28,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */ #define SEMOPS_DEFINE_INLINE #include "cgen-ops.h" -#undef min -#define min(a,b) ((a) < (b) ? (a) : (b)) - const char *mode_names[] = { "VOID", "BI", diff --git a/sim/common/sim-basics.h b/sim/common/sim-basics.h index e0cb6d17c91..16c7eb5c4fc 100644 --- a/sim/common/sim-basics.h +++ b/sim/common/sim-basics.h @@ -48,6 +48,13 @@ extern int asprintf (char **result, const char *format, ...); #endif +#ifndef min +#define min(a, b) ((a) < (b) ? (a) : (b)) +#endif +#ifndef max +#define max(a, b) ((a) > (b) ? (a) : (b)) +#endif + /* Some versions of GCC include an attribute operator, define it */ |