aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@embecosm.com>2023-02-10 23:49:19 +0000
committerMaciej W. Rozycki <macro@embecosm.com>2023-02-10 23:49:19 +0000
commit4a9efa5d63b2253a595ff9d6944415bf8cbfe408 (patch)
tree1641613dc4ca1ca92ebbee9fc1b2ec89532e9cc7 /gdb
parent5036bde964bc1a18282dde536a95aecd0d2c08fb (diff)
downloadfsf-binutils-gdb-4a9efa5d63b2253a595ff9d6944415bf8cbfe408.zip
fsf-binutils-gdb-4a9efa5d63b2253a595ff9d6944415bf8cbfe408.tar.gz
fsf-binutils-gdb-4a9efa5d63b2253a595ff9d6944415bf8cbfe408.tar.bz2
GDB: Switch to using C++ standard integer type limits
Use <climits> instead of <limits.h> and ditch local fallback definitions for minimum and maximum value macros provided by C++11. Add LONGEST_MAX and LONGEST_MIN definitions. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/defs.h33
-rw-r--r--gdb/gnu-nat.c1
2 files changed, 1 insertions, 33 deletions
diff --git a/gdb/defs.h b/gdb/defs.h
index b6a1321..f4fba9a 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -37,7 +37,7 @@
#include "bfd.h"
#include <sys/types.h>
-#include <limits.h>
+#include <climits>
/* The libdecnumber library, on which GDB depends, includes a header file
called gstdint.h instead of relying directly on stdint.h. GDB, on the
@@ -446,37 +446,6 @@ enum val_prettyformat
# include "fopen-bin.h"
#endif
-/* Defaults for system-wide constants (if not defined by xm.h, we fake it).
- FIXME: Assumes 2's complement arithmetic. */
-
-#if !defined (UINT_MAX)
-#define UINT_MAX ((unsigned int)(~0)) /* 0xFFFFFFFF for 32-bits */
-#endif
-
-#if !defined (INT_MAX)
-#define INT_MAX ((int)(UINT_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
-#endif
-
-#if !defined (INT_MIN)
-#define INT_MIN ((int)((int) ~0 ^ INT_MAX)) /* 0x80000000 for 32-bits */
-#endif
-
-#if !defined (ULONG_MAX)
-#define ULONG_MAX ((unsigned long)(~0L)) /* 0xFFFFFFFF for 32-bits */
-#endif
-
-#if !defined (LONG_MAX)
-#define LONG_MAX ((long)(ULONG_MAX >> 1)) /* 0x7FFFFFFF for 32-bits */
-#endif
-
-#if !defined (ULONGEST_MAX)
-#define ULONGEST_MAX (~(ULONGEST)0) /* 0xFFFFFFFFFFFFFFFF for 64-bits */
-#endif
-
-#if !defined (LONGEST_MAX) /* 0x7FFFFFFFFFFFFFFF for 64-bits */
-#define LONGEST_MAX ((LONGEST)(ULONGEST_MAX >> 1))
-#endif
-
/* * Convert a LONGEST to an int. This is used in contexts (e.g. number of
arguments to a function, number in a value history, register number, etc.)
where the value must not be larger than can fit in an int. */
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 004cacc..afaec46 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -52,7 +52,6 @@ extern "C"
#include "defs.h"
#include <ctype.h>
-#include <limits.h>
#include <setjmp.h>
#include <signal.h>
#include <sys/ptrace.h>