Otherwise including <string> or some other C++ header is broken.
E.g.:
In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0,
from /opt/gcc/include/c++/7.0.0/string:40,
from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68:
/opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2
min(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
/opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2
max(const _Tp& __a, const _Tp& __b, _Compare __comp)
^
In file included from .../src/gdb/infrun.c:21:0:
To the best of my grepping abilities, I believe I adjusted all min/max
calls.
gdb/ChangeLog:
2016-09-16 Pedro Alves <palves@redhat.com>
* defs.h (min, max): Delete.
* aarch64-tdep.c: Include <algorithm> and use std::min and
std::max throughout.
* aarch64-tdep.c: Likewise.
* alpha-tdep.c: Likewise.
* amd64-tdep.c: Likewise.
* amd64-windows-tdep.c: Likewise.
* arm-tdep.c: Likewise.
* avr-tdep.c: Likewise.
* breakpoint.c: Likewise.
* btrace.c: Likewise.
* ctf.c: Likewise.
* disasm.c: Likewise.
* doublest.c: Likewise.
* dwarf2loc.c: Likewise.
* dwarf2read.c: Likewise.
* environ.c: Likewise.
* exec.c: Likewise.
* f-exp.y: Likewise.
* findcmd.c: Likewise.
* ft32-tdep.c: Likewise.
* gcore.c: Likewise.
* hppa-tdep.c: Likewise.
* i386-darwin-tdep.c: Likewise.
* i386-tdep.c: Likewise.
* linux-thread-db.c: Likewise.
* lm32-tdep.c: Likewise.
* m32r-tdep.c: Likewise.
* m88k-tdep.c: Likewise.
* memrange.c: Likewise.
* minidebug.c: Likewise.
* mips-tdep.c: Likewise.
* moxie-tdep.c: Likewise.
* nds32-tdep.c: Likewise.
* nios2-tdep.c: Likewise.
* nto-procfs.c: Likewise.
* parse.c: Likewise.
* ppc-sysv-tdep.c: Likewise.
* probe.c: Likewise.
* record-btrace.c: Likewise.
* remote.c: Likewise.
* rs6000-tdep.c: Likewise.
* rx-tdep.c: Likewise.
* s390-linux-nat.c: Likewise.
* s390-linux-tdep.c: Likewise.
* ser-tcp.c: Likewise.
* sh-tdep.c: Likewise.
* sh64-tdep.c: Likewise.
* source.c: Likewise.
* sparc-tdep.c: Likewise.
* symfile.c: Likewise.
* target-memory.c: Likewise.
* target.c: Likewise.
* tic6x-tdep.c: Likewise.
* tilegx-tdep.c: Likewise.
* tracefile-tfile.c: Likewise.
* tracepoint.c: Likewise.
* valprint.c: Likewise.
* value.c: Likewise.
* xtensa-tdep.c: Likewise.
* cli/cli-cmds.c: Likewise.
* compile/compile-object-load.c: Likewise.
+2016-09-16 Pedro Alves <palves@redhat.com>
+
+ * defs.h (min, max): Delete.
+ * aarch64-tdep.c: Include <algorithm> and use std::min and
+ std::max throughout.
+ * aarch64-tdep.c: Likewise.
+ * alpha-tdep.c: Likewise.
+ * amd64-tdep.c: Likewise.
+ * amd64-windows-tdep.c: Likewise.
+ * arm-tdep.c: Likewise.
+ * avr-tdep.c: Likewise.
+ * breakpoint.c: Likewise.
+ * btrace.c: Likewise.
+ * ctf.c: Likewise.
+ * disasm.c: Likewise.
+ * doublest.c: Likewise.
+ * dwarf2loc.c: Likewise.
+ * dwarf2read.c: Likewise.
+ * environ.c: Likewise.
+ * exec.c: Likewise.
+ * f-exp.y: Likewise.
+ * findcmd.c: Likewise.
+ * ft32-tdep.c: Likewise.
+ * gcore.c: Likewise.
+ * hppa-tdep.c: Likewise.
+ * i386-darwin-tdep.c: Likewise.
+ * i386-tdep.c: Likewise.
+ * linux-thread-db.c: Likewise.
+ * lm32-tdep.c: Likewise.
+ * m32r-tdep.c: Likewise.
+ * m88k-tdep.c: Likewise.
+ * memrange.c: Likewise.
+ * minidebug.c: Likewise.
+ * mips-tdep.c: Likewise.
+ * moxie-tdep.c: Likewise.
+ * nds32-tdep.c: Likewise.
+ * nios2-tdep.c: Likewise.
+ * nto-procfs.c: Likewise.
+ * parse.c: Likewise.
+ * ppc-sysv-tdep.c: Likewise.
+ * probe.c: Likewise.
+ * record-btrace.c: Likewise.
+ * remote.c: Likewise.
+ * rs6000-tdep.c: Likewise.
+ * rx-tdep.c: Likewise.
+ * s390-linux-nat.c: Likewise.
+ * s390-linux-tdep.c: Likewise.
+ * ser-tcp.c: Likewise.
+ * sh-tdep.c: Likewise.
+ * sh64-tdep.c: Likewise.
+ * source.c: Likewise.
+ * sparc-tdep.c: Likewise.
+ * symfile.c: Likewise.
+ * target-memory.c: Likewise.
+ * target.c: Likewise.
+ * tic6x-tdep.c: Likewise.
+ * tilegx-tdep.c: Likewise.
+ * tracefile-tfile.c: Likewise.
+ * tracepoint.c: Likewise.
+ * valprint.c: Likewise.
+ * value.c: Likewise.
+ * xtensa-tdep.c: Likewise.
+ * cli/cli-cmds.c: Likewise.
+ * compile/compile-object-load.c: Likewise.
+
2016-09-16 Andreas Arnez <arnez@linux.vnet.ibm.com>
* s390-linux-nat.c (PER_BIT, PER_EVENT_BRANCH, PER_EVENT_IFETCH)
#include "arch/aarch64-insn.h"
#include "opcode/aarch64.h"
+#include <algorithm>
#define submask(x) ((1L << ((x) + 1)) - 1)
#define bit(obj,st) (((obj) >> (st)) & 1)
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
prologue_end = sal.end;
}
- prologue_end = min (prologue_end, prev_pc);
+ prologue_end = std::min (prologue_end, prev_pc);
aarch64_analyze_prologue (gdbarch, prologue_start, prologue_end, cache);
}
else
#include "elf-bfd.h"
#include "alpha-tdep.h"
+#include <algorithm>
/* Instruction decoding. The notations for registers, immediates and
opcodes are the same as the one used in Compaq's Alpha architecture
post_prologue_pc = alpha_after_prologue (pc);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
/* Can't determine prologue from the symbol table, need to examine
instructions. */
#include "amd64-tdep.h"
#include "i387-tdep.h"
#include "x86-xstate.h"
+#include <algorithm>
#include "features/i386/amd64.c"
#include "features/i386/amd64-avx.c"
gdb_assert (regnum != -1);
if (readbuf)
- regcache_raw_read_part (regcache, regnum, offset, min (len, 8),
+ regcache_raw_read_part (regcache, regnum, offset, std::min (len, 8),
readbuf + i * 8);
if (writebuf)
- regcache_raw_write_part (regcache, regnum, offset, min (len, 8),
+ regcache_raw_write_part (regcache, regnum, offset, std::min (len, 8),
writebuf + i * 8);
}
gdb_assert (regnum != -1);
memset (buf, 0, sizeof buf);
- memcpy (buf, valbuf + j * 8, min (len, 8));
+ memcpy (buf, valbuf + j * 8, std::min (len, 8));
regcache_raw_write_part (regcache, regnum, offset, 8, buf);
}
}
if (current_pc > pc + offset_and)
cache->saved_sp_reg = amd64_arch_reg_to_regnum (reg);
- return min (pc + offset + 2, current_pc);
+ return std::min (pc + offset + 2, current_pc);
}
/* Similar to amd64_analyze_stack_align for x32. */
if (current_pc > pc + offset_and)
cache->saved_sp_reg = amd64_arch_reg_to_regnum (reg);
- return min (pc + offset + 2, current_pc);
+ return std::min (pc + offset + 2, current_pc);
}
/* Do a limited analysis of the prologue at PC and update CACHE
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
&& startswith (COMPUNIT_PRODUCER (cust), "clang ")))
- return max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
amd64_init_frame_cache (&cache);
#include "coff/pe.h"
#include "libcoff.h"
#include "value.h"
+#include <algorithm>
/* The registers used to pass integer arguments during a function call. */
static int amd64_windows_dummy_call_integer_regs[] =
gdb_assert (TYPE_LENGTH (type) <= 8);
memset (buf, 0, sizeof buf);
- memcpy (buf, valbuf, min (TYPE_LENGTH (type), 8));
+ memcpy (buf, valbuf, std::min (TYPE_LENGTH (type), (unsigned int) 8));
regcache_cooked_write (regcache, regno, buf);
}
else if (target_read_memory (image_base + unwind_info,
(gdb_byte *) &ex_ui, sizeof (ex_ui)) == 0
&& PEX64_UWI_VERSION (ex_ui.Version_Flags) == 1)
- return max (pc, image_base + start_rva + ex_ui.SizeOfPrologue);
+ return std::max (pc, image_base + start_rva + ex_ui.SizeOfPrologue);
}
/* See if we can determine the end of the prologue via the symbol
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
return pc;
#include "record.h"
#include "record-full.h"
+#include <algorithm>
#include "features/arm-with-m.c"
#include "features/arm-with-m-fpa-layout.c"
function is. */
return;
- prologue_end = min (prologue_end, prev_pc);
+ prologue_end = std::min (prologue_end, prev_pc);
thumb_analyze_prologue (gdbarch, prologue_start, prologue_end, cache);
}
footwork to distinguish a real IT instruction from the second
half of a 32-bit instruction, but there is no need for that if
there's no candidate. */
- buf_len = min (bpaddr - boundary, MAX_IT_BLOCK_PREFIX);
+ buf_len = std::min (bpaddr - boundary, (CORE_ADDR) MAX_IT_BLOCK_PREFIX);
if (buf_len == 0)
/* No room for an IT instruction. */
return bpaddr;
#include "regcache.h"
#include "dis-asm.h"
#include "objfiles.h"
+#include <algorithm>
/* AVR Background:
post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
{
CORE_ADDR prologue_end = pc;
#include "mi/mi-common.h"
#include "extension.h"
+#include <algorithm>
/* Enums for exception-handling support. */
enum exception_event_kind
CORE_ADDR l, h;
/* Check for intersection. */
- l = max (loc->address, addr);
- h = min (loc->address + loc->length, addr + len);
+ l = std::max (loc->address, addr);
+ h = std::min (loc->address + loc->length, addr + len);
if (l < h)
return 1;
}
_("bpstat_what: unhandled bptype %d"), (int) bptype);
}
- retval.main_action = max (retval.main_action, this_action);
+ retval.main_action = std::max (retval.main_action, this_action);
}
return retval;
#include <inttypes.h>
#include <ctype.h>
+#include <algorithm>
/* Command lists for btrace maintenance commands. */
static struct cmd_list_element *maint_btrace_cmdlist;
We start at the preceding function's level in case this has
already been a return for which we have not seen the call.
We start at level 0 otherwise, to handle tail calls correctly. */
- bfun->level = min (0, prev->level) - 1;
+ bfun->level = std::min (0, prev->level) - 1;
/* Fix up the call stack for PREV. */
ftrace_fixup_caller (prev, bfun, BFUN_UP_LINKS_TO_RET);
/* Maintain the function level offset.
For all but the last block, we do it here. */
if (blk != 0)
- level = min (level, end->level);
+ level = std::min (level, end->level);
size = 0;
TRY
and is not really part of the execution history, it shouldn't
affect the level. */
if (blk == 0)
- level = min (level, end->level);
+ level = std::min (level, end->level);
}
}
}
/* Maintain the function level offset. */
- *plevel = min (*plevel, end->level);
+ *plevel = std::min (*plevel, end->level);
btinsn.pc = (CORE_ADDR) insn.ip;
btinsn.size = (gdb_byte) insn.size;
space = end - index;
/* Advance the iterator as far as possible within this segment. */
- adv = min (space, stride);
+ adv = std::min (space, stride);
stride -= adv;
index += adv;
steps += adv;
}
/* Advance the iterator as far as possible within this segment. */
- adv = min (index, stride);
+ adv = std::min (index, stride);
stride -= adv;
index -= adv;
#endif
#include <fcntl.h>
+#include <algorithm>
/* Prototypes for local command functions */
{
int first;
- first = max (cursal.line - get_lines_to_list () / 2, 1);
+ first = std::max (cursal.line - get_lines_to_list () / 2, 1);
/* A small special case --- if listing backwards, and we
should list only one line, list the preceding line,
error (_("Already at the start of %s."),
symtab_to_filename_for_display (cursal.symtab));
print_source_lines (cursal.symtab,
- max (get_first_line_listed ()
- - get_lines_to_list (), 1),
+ std::max (get_first_line_listed ()
+ - get_lines_to_list (), 1),
get_first_line_listed (), 0);
}
error (_("No default source file yet. Do \"help list\"."));
if (dummy_beg)
print_source_lines (sal_end.symtab,
- max (sal_end.line - (get_lines_to_list () - 1), 1),
+ std::max (sal_end.line - (get_lines_to_list () - 1), 1),
sal_end.line + 1, 0);
else if (sal.symtab == 0)
error (_("No default source file yet. Do \"help list\"."));
#include "compile.h"
#include "block.h"
#include "arch-utils.h"
+#include <algorithm>
/* Track inferior memory reserved by inferior mmap. */
return;
alignment = ((CORE_ADDR) 1) << bfd_get_section_alignment (abfd, sect);
- data->last_max_alignment = max (data->last_max_alignment, alignment);
+ data->last_max_alignment = std::max (data->last_max_alignment, alignment);
data->last_size = (data->last_size + alignment - 1) & -alignment;
#include "inferior.h"
#include "gdbthread.h"
#include "tracefile.h"
-
#include <ctype.h>
+#include <algorithm>
/* GDB saves trace buffers and other information (such as trace
status) got from the remote target into Common Trace Format (CTF).
and this address falls within a read-only section, fallback
to reading from executable, up to LOW_ADDR_AVAILABLE */
if (offset < low_addr_available)
- len = min (len, low_addr_available - offset);
+ len = std::min (len, low_addr_available - offset);
res = exec_read_partial_read_only (readbuf, offset, len, xfered_len);
if (res == TARGET_XFER_OK)
#include "hashtab.h"
-#ifndef min
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#endif
-#ifndef max
-#define max(a, b) ((a) > (b) ? (a) : (b))
-#endif
-
/* * Enable dbx commands if set. */
extern int dbx_commands;
#include "gdbcore.h"
#include "dis-asm.h"
#include "source.h"
+#include <algorithm>
/* Disassemble functions.
FIXME: We should get rid of all the duplicate code in gdb that does
}
if (sal.end != 0)
- end_pc = min (sal.end, high);
+ end_pc = std::min (sal.end, high);
else
end_pc = pc + 1;
num_displayed += dump_insns (gdbarch, uiout, di, pc, end_pc,
#include "floatformat.h"
#include "gdbtypes.h"
#include <math.h> /* ldexp */
+#include <algorithm>
/* The odds that CHAR_BIT will be anything but 8 are low enough that I'm not
going to bother with trying to muck around with whether it is defined in
while (mant_bits_left > 0)
{
- mant_bits = min (mant_bits_left, 32);
+ mant_bits = std::min (mant_bits_left, 32);
mant = get_field (ufrom, order, fmt->totalsize, mant_off, mant_bits);
mant_zero = 1;
while (mant_bits_left > 0)
{
- mant_bits = min (mant_bits_left, 32);
+ mant_bits = std::min (mant_bits_left, 32);
mant = get_field (uval, order, fmt->totalsize, mant_off, mant_bits);
comment in store_typed_floating for a discussion about
zeroing out remaining bytes in the target buffer. */
memset (to, 0, TYPE_LENGTH (to_type));
- memcpy (to, from, min (TYPE_LENGTH (from_type), TYPE_LENGTH (to_type)));
+ memcpy (to, from, std::min (TYPE_LENGTH (from_type),
+ TYPE_LENGTH (to_type)));
}
else
{
#include "dwarf2loc.h"
#include "dwarf2-frame.h"
#include "compile/compile.h"
+#include <algorithm>
extern int dwarf_always_disassemble;
/* Intersect callers. */
- callers = min (result->callers, length);
+ callers = std::min ((long) result->callers, length);
for (idx = 0; idx < callers; idx++)
if (result->call_site[idx] != VEC_index (call_sitep, chain, idx))
{
/* Intersect callees. */
- callees = min (result->callees, length);
+ callees = std::min ((long) result->callees, length);
for (idx = 0; idx < callees; idx++)
if (result->call_site[result->length - 1 - idx]
!= VEC_index (call_sitep, chain, length - 1 - idx))
#include <fcntl.h>
#include <sys/types.h>
+#include <algorithm>
typedef struct symbol *symbolp;
DEF_VEC_P (symbolp);
if (dwarf2_get_pc_bounds (die, &low, &high, cu, NULL) >= PC_BOUNDS_RANGES)
{
- *lowpc = min (*lowpc, low);
- *highpc = max (*highpc, high);
+ *lowpc = std::min (*lowpc, low);
+ *highpc = std::max (*highpc, high);
}
/* If the language does not allow nested subprograms (either inside
if (current_low != ((CORE_ADDR) -1))
{
- best_low = min (best_low, current_low);
- best_high = max (best_high, current_high);
+ best_low = std::min (best_low, current_low);
+ best_high = std::max (best_high, current_high);
}
break;
default:
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
-#define min(a, b) ((a) < (b) ? (a) : (b))
-#define max(a, b) ((a) > (b) ? (a) : (b))
-
#include "defs.h"
#include "environ.h"
+#include <algorithm>
\f
/* Return a new environment object. */
if (e->allocated < i)
{
- e->allocated = max (i, e->allocated + 10);
+ e->allocated = std::max (i, e->allocated + 10);
e->vector = (char **) xrealloc ((char *) e->vector,
(e->allocated + 1) * sizeof (char *));
}
#include <ctype.h>
#include <sys/stat.h>
#include "solist.h"
+#include <algorithm>
void (*deprecated_file_changed_hook) (char *);
r = VEC_safe_push (mem_range_s, memory, NULL);
- r->start = max (lo1, lo2);
- r->length = min (hi1, hi2) - r->start;
+ r->start = std::max (lo1, lo2);
+ r->length = std::min (hi1, hi2) - r->start;
}
}
enum target_xfer_status status;
/* Get the intersection window. */
- end = min (offset + len, r->start + r->length);
+ end = std::min (offset + len, r->start + r->length);
gdb_assert (end - offset <= len);
#include "objfiles.h" /* For have_full_symbols and have_partial_symbols */
#include "block.h"
#include <ctype.h>
+#include <algorithm>
#define parse_type(ps) builtin_type (parse_gdbarch (ps))
#define parse_f_type(ps) builtin_f_type (parse_gdbarch (ps))
{
int growby;
- growby = max (count, GROWBY_MIN_SIZE);
+ growby = std::max (count, GROWBY_MIN_SIZE);
tempbufsize += growby;
if (tempbuf == NULL)
tempbuf = (char *) malloc (tempbufsize);
#include "value.h"
#include "target.h"
#include "cli/cli-utils.h"
+#include <algorithm>
/* Copied from bfd_put_bits. */
/* Keep it simple and assume size == 'g' when watching for when we
need to grow the pattern buf. */
pattern_buf_size_need = (pattern_buf_end - pattern_buf
- + max (TYPE_LENGTH (t), sizeof (int64_t)));
+ + std::max (TYPE_LENGTH (t),
+ (unsigned) sizeof (int64_t)));
if (pattern_buf_size_need > pattern_buf_size)
{
size_t current_offset = pattern_buf_end - pattern_buf;
#include "ft32-tdep.h"
#include "gdb/sim-ft32.h"
+#include <algorithm>
#define RAM_BIAS 0x800000 /* Bias added to RAM addresses. */
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
else
{
/* Can't determine prologue from the symbol table, need to examine
#include "regset.h"
#include "gdb_bfd.h"
#include "readline/tilde.h"
+#include <algorithm>
/* The largest amount of memory to read from the target at once. We
must throttle it to limit the amount of memory used by GDB during
if (!startswith (bfd_section_name (obfd, osec), "load"))
return;
- size = min (total_size, MAX_COPY_BYTES);
+ size = std::min (total_size, (bfd_size_type) MAX_COPY_BYTES);
memhunk = (gdb_byte *) xmalloc (size);
old_chain = make_cleanup (xfree, memhunk);
#include "gdbtypes.h"
#include "objfiles.h"
#include "hppa-tdep.h"
+#include <algorithm>
static int hppa_debug = 0;
while (regnum > HPPA_ARG0_REGNUM - 8 && len > 0)
{
regcache_cooked_write_part (regcache, regnum,
- offset % 8, min (len, 8), valbuf);
- offset += min (len, 8);
- valbuf += min (len, 8);
- len -= min (len, 8);
+ offset % 8, std::min (len, 8), valbuf);
+ offset += std::min (len, 8);
+ valbuf += std::min (len, 8);
+ len -= std::min (len, 8);
regnum--;
}
/* Allocate the outgoing parameter area. Make sure the outgoing
parameter area is multiple of 16 bytes in length. */
- sp += max (align_up (offset, 16), 64);
+ sp += std::max (align_up (offset, 16), (ULONGEST) 64);
/* Allocate 32-bytes of scratch space. The documentation doesn't
mention this, but it seems to be needed. */
while (len > 0)
{
regcache_cooked_read_part (regcache, regnum, offset,
- min (len, 8), readbuf);
- readbuf += min (len, 8);
- len -= min (len, 8);
+ std::min (len, 8), readbuf);
+ readbuf += std::min (len, 8);
+ len -= std::min (len, 8);
regnum++;
}
}
while (len > 0)
{
regcache_cooked_write_part (regcache, regnum, offset,
- min (len, 8), writebuf);
- writebuf += min (len, 8);
- len -= min (len, 8);
+ std::min (len, 8), writebuf);
+ writebuf += std::min (len, 8);
+ len -= std::min (len, 8);
regnum++;
}
}
may be the first instruction of the prologue. If that happens, then
the instruction skipping code has a bug that needs to be fixed. */
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
else
return (skip_prologue_hard_way (gdbarch, pc, 1));
}
#include "solib.h"
#include "solib-darwin.h"
#include "dwarf2-frame.h"
+#include <algorithm>
/* Offsets into the struct i386_thread_state where we'll find the saved regs.
From <mach/i386/thread_status.h> and i386-tdep.h. */
int i;
int res = 4;
for (i = 0; i < TYPE_NFIELDS (type); i++)
- res = max (res,
- i386_darwin_arg_type_alignment (TYPE_FIELD_TYPE (type, i)));
+ {
+ int align
+ = i386_darwin_arg_type_alignment (TYPE_FIELD_TYPE (type, i));
+
+ res = std::max (res, align);
+ }
return res;
}
/* 2. The caller aligns nonvector arguments to 4-byte boundaries. */
#include "expression.h"
#include "parser-defs.h"
#include <ctype.h>
+#include <algorithm>
/* Register names. */
if (current_pc > pc + offset_and)
cache->saved_sp_reg = regnums[reg];
- return min (pc + offset + 3, current_pc);
+ return std::min (pc + offset + 3, current_pc);
}
/* Maximum instruction length we need to handle. */
&& (cust != NULL
&& COMPUNIT_PRODUCER (cust) != NULL
&& startswith (COMPUNIT_PRODUCER (cust), "clang ")))
- return max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
cache.locals = -1;
#include <signal.h>
#include <ctype.h>
#include "nat/linux-namespaces.h"
+#include <algorithm>
/* GNU/Linux libthread_db support.
if (i == 0 || strcmp (array[i - 1]->filename, array[i]->filename) != 0)
{
unique_filenames++;
- max_filename_len = max (max_filename_len,
- strlen (array[i]->filename));
+ max_filename_len = std::max (max_filename_len,
+ strlen (array[i]->filename));
if (i > 0)
{
pids_len -= strlen (", ");
- max_pids_len = max (max_pids_len, pids_len);
+ max_pids_len = std::max (max_pids_len, pids_len);
}
pids_len = 0;
}
if (i)
{
pids_len -= strlen (", ");
- max_pids_len = max (max_pids_len, pids_len);
+ max_pids_len = std::max (max_pids_len, pids_len);
}
/* Table header shifted right by preceding "libthread-db: " would not match
#include "trad-frame.h"
#include "reggroups.h"
#include "opcodes/lm32-desc.h"
+#include <algorithm>
/* Macros to extract fields from an instruction. */
#define LM32_OPCODE(insn) ((insn >> 26) & 0x3f)
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
#include "trad-frame.h"
#include "dis-asm.h"
#include "objfiles.h"
-
#include "m32r-tdep.h"
+#include <algorithm>
/* Local functions */
the end of the function. In this case, there probably isn't a
prologue. */
{
- func_end = min (func_end, func_addr + DEFAULT_SEARCH_LIMIT);
+ func_end = std::min (func_end, func_addr + DEFAULT_SEARCH_LIMIT);
}
}
else
#include "symtab.h"
#include "trad-frame.h"
#include "value.h"
+#include <algorithm>
#include "m88k-tdep.h"
prologue. */
if (cache->fp_offset != -1
&& cache->saved_regs[M88K_R1_REGNUM].addr != -1)
- return min (pc, end);
+ return std::min (pc, end);
break;
case M88K_PIA_NOTE_ST:
/* If no frame has been allocated, the stores aren't part of
the prologue. */
if (cache->sp_offset == 0)
- return min (pc, end);
+ return std::min (pc, end);
/* Record location of saved registers. */
{
/* A second stack pointer adjustment isn't part of the
prologue. */
if (cache->sp_offset != 0)
- return min (pc, end);
+ return std::min (pc, end);
/* Store stack pointer adjustment. */
cache->sp_offset = -SUBU_OFFSET (insn);
/* A second frame pointer assignment isn't part of the
prologue. */
if (cache->fp_offset != -1)
- return min (pc, end);
+ return std::min (pc, end);
/* Record frame pointer assignment. */
cache->fp_offset = ADDU_OFFSET (insn);
the instruction in the delay slot might be. Limit the
prologue analysis to the delay slot and record the branch
instruction as the end of the prologue. */
- limit = min (limit, pc + 2 * M88K_INSN_SIZE);
+ limit = std::min (limit, pc + 2 * M88K_INSN_SIZE);
end = pc;
break;
case M88K_PIA_NOTE_PROLOGUE_END:
- return min (pc, end);
+ return std::min (pc, end);
}
pc += M88K_INSN_SIZE;
#include "defs.h"
#include "memrange.h"
+#include <algorithm>
int
mem_ranges_overlap (CORE_ADDR start1, int len1,
{
ULONGEST h, l;
- l = max (start1, start2);
- h = min (start1 + len1, start2 + len2);
+ l = std::max (start1, start2);
+ h = std::min (start1 + len1, start2 + len2);
return (l < h);
}
merge them. */
if (rb->start <= ra->start + ra->length)
{
- ra->length = max (ra->length,
+ ra->length = std::max ((CORE_ADDR) ra->length,
(rb->start - ra->start) + rb->length);
continue; /* next b, same a */
}
#include "symfile.h"
#include "objfiles.h"
#include "gdbcore.h"
+#include <algorithm>
#ifdef HAVE_LIBLZMA
+ iter.block.uncompressed_size);
}
- chunk_size = min (nbytes, lstream->data_end - offset);
+ chunk_size = std::min (nbytes, (file_ptr) lstream->data_end - offset);
memcpy (buf, lstream->data + offset - lstream->data_start, chunk_size);
buf = (gdb_byte *) buf + chunk_size;
offset += chunk_size;
#include "user-regs.h"
#include "valprint.h"
#include "ax.h"
+#include <algorithm>
static const struct objfile_data *mips_pdr_data;
&& ((reglist >= 1 && reglist <= 9)
|| (reglist >= 16 && reglist <= 25)))
{
- int sreglist = min(reglist & 0xf, 8);
+ int sreglist = std::min(reglist & 0xf, 8);
s = 4 << ((b12s4_op (insn) & 0x2) == 0x2);
for (i = 0; i < sreglist; i++)
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
#include "record-full.h"
#include "moxie-tdep.h"
+#include <algorithm>
/* Local functions. */
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
else
{
/* Can't determine prologue from the symbol table, need to examine
#include "nds32-tdep.h"
#include "elf/nds32.h"
#include "opcode/nds32.h"
+#include <algorithm>
+
#include "features/nds32.c"
/* Simple macros for instruction analysis. */
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
/* To get entry_point_address. */
#include "objfiles.h"
+#include <algorithm>
/* Nios II specific header. */
#include "nios2-tdep.h"
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
/* Prologue analysis does the rest.... */
return;
}
- num = min (num, num_mapinfos);
+ num = std::min (num, num_mapinfos);
/* Run through the list of mapinfos, and store the data and text info
so we can print it at the bottom of the loop. */
tempread = nto_read_auxv_from_initial_stack (initial_stack, tempbuf,
sizeof_tempbuf,
sizeof (auxv_t));
- tempread = min (tempread, len) - offset;
+ tempread = std::min (tempread, len) - offset;
memcpy (readbuf, tempbuf + offset, tempread);
*xfered_len = tempread;
return tempread ? TARGET_XFER_OK : TARGET_XFER_EOF;
#include "source.h"
#include "objfiles.h"
#include "user-regs.h"
+#include <algorithm>
/* Standard set of definitions for printing, dumping, prefixifying,
* and evaluating expressions. */
{
if ((ps->expout_ptr + lenelt) >= ps->expout_size)
{
- ps->expout_size = max (ps->expout_size * 2,
+ ps->expout_size = std::max (ps->expout_size * 2,
ps->expout_ptr + lenelt + 10);
ps->expout = (struct expression *)
xrealloc (ps->expout, (sizeof (struct expression)
#include "objfiles.h"
#include "infcall.h"
#include "dwarf2.h"
+#include <algorithm>
/* Check whether FTPYE is a (pointer to) function type that should use
if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
count += sub_count;
else
- count = max (count, sub_count);
+ count = std::max (count, sub_count);
}
/* There must be no padding. */
#include "ax-gdb.h"
#include "location.h"
#include <ctype.h>
+#include <algorithm>
typedef struct bound_probe bound_probe_s;
DEF_VEC_O (bound_probe_s);
if (val == NULL)
continue;
- size_max = max (strlen (val), size_max);
+ size_max = std::max (strlen (val), size_max);
}
do_cleanups (c2);
}
{
const char *probe_type = probe->probe->pops->type_name (probe->probe);
- size_type = max (strlen (probe_type), size_type);
- size_name = max (strlen (probe->probe->name), size_name);
- size_provider = max (strlen (probe->probe->provider), size_provider);
- size_objname = max (strlen (objfile_name (probe->objfile)), size_objname);
+ size_type = std::max (strlen (probe_type), size_type);
+ size_name = std::max (strlen (probe->probe->name), size_name);
+ size_provider = std::max (strlen (probe->probe->provider), size_provider);
+ size_objname = std::max (strlen (objfile_name (probe->objfile)),
+ size_objname);
}
ui_out_table_header (current_uiout, size_type, ui_left, "type", _("Type"));
#include "event-loop.h"
#include "inf-loop.h"
#include "vec.h"
+#include <algorithm>
/* The target_ops of record-btrace. */
static struct target_ops record_btrace_ops;
if (sal.symtab != symtab || sal.line == 0)
continue;
- begin = min (begin, sal.line);
- end = max (end, sal.line);
+ begin = std::min (begin, sal.line);
+ end = std::max (end, sal.line);
}
out:
& SEC_READONLY) != 0)
{
/* Truncate the request to fit into this section. */
- len = min (len, section->endaddr - offset);
+ len = std::min (len, section->endaddr - offset);
break;
}
}
#include "agent.h"
#include "btrace.h"
#include "record-btrace.h"
+#include <algorithm>
/* Temp hacks for tracepoint encoding migration. */
static char *target_buf;
getpkt (&rs->buf, &rs->buf_size, 0);
if (rs->buf[0] != 0)
{
- n = min (strlen (rs->buf) / 2, sizeof (display_buf));
+ n = std::min (strlen (rs->buf) / 2, sizeof (display_buf));
result = hex2bin (rs->buf, (gdb_byte *) display_buf, n);
display_buf [result] = '\0';
return display_buf;
for (i = 0; num != 0; i++)
num >>= 4;
- return max (i, 1);
+ return std::max (i, 1);
}
/* Set BUF to the minimum number of hex digits representing NUM. */
if (packet_format == 'X')
{
/* Best guess at number of bytes that will fit. */
- todo_units = min (len_units, payload_capacity_bytes / unit_size);
+ todo_units = std::min (len_units,
+ (ULONGEST) payload_capacity_bytes / unit_size);
if (use_length)
payload_capacity_bytes -= hexnumlen (todo_units);
- todo_units = min (todo_units, payload_capacity_bytes / unit_size);
+ todo_units = std::min (todo_units, payload_capacity_bytes / unit_size);
}
else
{
/* Number of bytes that will fit. */
- todo_units = min (len_units, (payload_capacity_bytes / unit_size) / 2);
+ todo_units
+ = std::min (len_units,
+ (ULONGEST) (payload_capacity_bytes / unit_size) / 2);
if (use_length)
payload_capacity_bytes -= hexnumlen (todo_units);
- todo_units = min (todo_units, (payload_capacity_bytes / unit_size) / 2);
+ todo_units = std::min (todo_units,
+ (payload_capacity_bytes / unit_size) / 2);
}
if (todo_units <= 0)
get_memory_packet_size ensures this. */
/* Number of units that will fit. */
- todo_units = min (len_units, (buf_size_bytes / unit_size) / 2);
+ todo_units = std::min (len_units,
+ (ULONGEST) (buf_size_bytes / unit_size) / 2);
/* Construct "m"<memaddr>","<len>". */
memaddr = remote_address_masked (memaddr);
may not, since we don't know how much of it will need to be escaped;
the target is free to respond with slightly less data. We subtract
five to account for the response type and the protocol frame. */
- n = min (get_remote_packet_size () - 5, len);
+ n = std::min (get_remote_packet_size () - 5, len);
snprintf (rs->buf, get_remote_packet_size () - 4, "qXfer:%s:read:%s:%s,%s",
object_name, annex ? annex : "",
phex_nz (offset, sizeof offset),
#include "ax.h"
#include "ax-gdb.h"
+#include <algorithm>
#include "features/rs6000/powerpc-32.c"
#include "features/rs6000/powerpc-altivec32.c"
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
#include "elf/rx.h"
#include "elf-bfd.h"
+#include <algorithm>
/* Certain important register numbers. */
enum
&& arg_size <= 4 * (RX_R4_REGNUM - arg_reg + 1)
&& arg_size % 4 == 0)
{
- int len = min (arg_size, 4);
+ int len = std::min (arg_size, (ULONGEST) 4);
if (write_pass)
regcache_cooked_write_unsigned (regcache, arg_reg,
while (valtype_len > 0)
{
- int len = min (valtype_len, 4);
+ int len = std::min (valtype_len, (ULONGEST) 4);
regcache_cooked_read_unsigned (regcache, argreg, &u);
store_unsigned_integer (readbuf + offset, len, byte_order, u);
while (valtype_len > 0)
{
- int len = min (valtype_len, 4);
+ int len = std::min (valtype_len, (ULONGEST) 4);
u = extract_unsigned_integer (writebuf + offset, len, byte_order);
regcache_cooked_write_unsigned (regcache, argreg, u);
VEC_iterate (s390_watch_area, state->watch_areas, ix, area);
ix++)
{
- watch_lo_addr = min (watch_lo_addr, area->lo_addr);
- watch_hi_addr = max (watch_hi_addr, area->hi_addr);
+ watch_lo_addr = std::min (watch_lo_addr, area->lo_addr);
+ watch_hi_addr = std::max (watch_hi_addr, area->hi_addr);
}
/* Enable storage-alteration events. */
VEC_iterate (s390_watch_area, state->break_areas, ix, area);
ix++)
{
- watch_lo_addr = min (watch_lo_addr, area->lo_addr);
- watch_hi_addr = max (watch_hi_addr, area->hi_addr);
+ watch_lo_addr = std::min (watch_lo_addr, area->lo_addr);
+ watch_hi_addr = std::max (watch_hi_addr, area->hi_addr);
}
/* If there's just one breakpoint, enable instruction-fetching
#include "elf/common.h"
#include "elf/s390.h"
#include "elf-bfd.h"
+#include <algorithm>
#include "features/s390-linux32.c"
#include "features/s390-linux32v1.c"
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
skip_pc = s390_analyze_prologue (gdbarch, pc, (CORE_ADDR)-1, &data);
#include <signal.h>
#include "gdb_select.h"
+#include <algorithm>
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
error (_("net_open: No colon in host name!")); /* Shouldn't ever
happen. */
- tmp = min (port_str - name, (int) sizeof hostname - 1);
+ tmp = std::min (port_str - name, (ptrdiff_t) sizeof hostname - 1);
strncpy (hostname, name, tmp); /* Don't want colon. */
hostname[tmp] = '\000'; /* Tie off host name. */
port = atoi (port_str + 1);
#include "dwarf2.h"
/* registers numbers shared with the simulator. */
#include "gdb/sim-sh.h"
+#include <algorithm>
/* List of "set sh ..." and "show sh ..." commands. */
static struct cmd_list_element *setshcmdlist = NULL;
{
pc += 2;
/* Don't go any further than six more instructions. */
- limit_pc = min (limit_pc, pc + (2 * 6));
+ limit_pc = std::min (limit_pc, pc + (2 * 6));
cache->uses_fp = 1;
/* At this point, only allow argument register moves to other
{
post_prologue_pc = skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
/* Do not allow limit_pc to be past the function end, if we know
where that end is... */
if (func_end_addr != 0)
- limit_pc = min (limit_pc, func_end_addr);
+ limit_pc = std::min (limit_pc, func_end_addr);
cache.sp_offset = -4;
post_prologue_pc = sh_analyze_prologue (gdbarch, pc, limit_pc, &cache, 0);
#include "gdb/sim-sh.h"
#include "language.h"
#include "sh64-tdep.h"
+#include <algorithm>
/* Information that is dependent on the processor variant. */
enum sh_abi
/* If after_prologue returned a useful address, then use it. Else
fall back on the instruction skipping code. */
if (post_prologue_pc != 0)
- return max (pc, post_prologue_pc);
+ return std::max (pc, post_prologue_pc);
else
return sh64_skip_prologue_hard_way (gdbarch, pc);
}
#include "ui-out.h"
#include "readline/readline.h"
#include "common/enum-flags.h"
+#include <algorithm>
#define OPEN_MODE (O_RDONLY | O_BINARY)
#define FDOPEN_MODE FOPEN_RB
xfree (sals.sals);
current_source_pspace = sal.pspace;
current_source_symtab = sal.symtab;
- current_source_line = max (sal.line - (lines_to_list - 1), 1);
+ current_source_line = std::max (sal.line - (lines_to_list - 1), 1);
if (current_source_symtab)
return;
}
do_cleanups (cleanups);
print_source_lines (current_source_symtab, line, line + 1, 0);
set_internalvar_integer (lookup_internalvar ("_"), line);
- current_source_line = max (line - lines_to_list / 2, 1);
+ current_source_line = std::max (line - lines_to_list / 2, 1);
return;
}
line++;
do_cleanups (cleanups);
print_source_lines (current_source_symtab, line, line + 1, 0);
set_internalvar_integer (lookup_internalvar ("_"), line);
- current_source_line = max (line - lines_to_list / 2, 1);
+ current_source_line = std::max (line - lines_to_list / 2, 1);
return;
}
line--;
#include "sparc-tdep.h"
#include "sparc-ravenscar-thread.h"
+#include <algorithm>
struct regset;
}
/* Always allocate at least six words. */
- sp -= max (6, num_elements) * 4;
+ sp -= std::max (6, num_elements) * 4;
/* The psABI says that "Software convention requires space for the
struct/union return value pointer, even if the word is unused." */
struct cleanup *back_to;
int ix;
- /* Set I to max (strlen (canon_dir), strlen (dir)). */
+ /* Set I to std::max (strlen (canon_dir), strlen (dir)). */
i = strlen (dir);
if (canon_dir != NULL && strlen (canon_dir) > i)
i = strlen (canon_dir);
#include "memory-map.h"
#include "gdb_sys_time.h"
+#include <algorithm>
static int
compare_block_starting_address (const void *a, const void *b)
if (end != 0 && end <= r->begin)
continue;
- claimed_begin = max (begin, r->begin);
+ claimed_begin = std::max (begin, r->begin);
if (end == 0)
claimed_end = r->end;
else
- claimed_end = min (end, r->end);
+ claimed_end = std::min (end, r->end);
if (claimed_begin == r->begin && claimed_end == r->end)
VEC_safe_push (memory_write_request_s, *result, r);
#include "target-debug.h"
#include "top.h"
#include "event-top.h"
+#include <algorithm>
static void target_info (char *, int);
shadow handling even though we only end up writing a small
subset of it. Cap writes to a limit specified by the target
to mitigate this. */
- len = min (ops->to_get_memory_xfer_limit (ops), len);
+ len = std::min (ops->to_get_memory_xfer_limit (ops), len);
buf = (gdb_byte *) xmalloc (len);
old_chain = make_cleanup (xfree, buf);
}
else
{
- LONGEST to_read = min (len - xfered_total, region_len);
+ LONGEST to_read = std::min (len - xfered_total, region_len);
gdb_byte *buffer = (gdb_byte *) xmalloc (to_read * unit_size);
struct cleanup *inner_cleanup = make_cleanup (xfree, buffer);
while (search_space_len >= pattern_len)
{
gdb_byte *found_ptr;
- unsigned nr_search_bytes = min (search_space_len, search_buf_size);
+ unsigned nr_search_bytes
+ = std::min (search_space_len, (ULONGEST) search_buf_size);
found_ptr = (gdb_byte *) memmem (search_buf, nr_search_bytes,
pattern, pattern_len);
gdb_assert (keep_len == pattern_len - 1);
memcpy (search_buf, search_buf + chunk_size, keep_len);
- nr_to_read = min (search_space_len - keep_len, chunk_size);
+ nr_to_read = std::min (search_space_len - keep_len,
+ (ULONGEST) chunk_size);
if (target_read (ops, TARGET_OBJECT_MEMORY, NULL,
search_buf + keep_len, read_addr,
release_fileio_fd (int fd, fileio_fh_t *fh)
{
fh->fd = -1;
- lowest_closed_fd = min (lowest_closed_fd, fd);
+ lowest_closed_fd = std::min (lowest_closed_fd, fd);
}
/* Return a pointer to the fileio_fhandle_t corresponding to FD. */
ULONGEST xfered_len;
enum target_xfer_status status;
gdb_byte buf[1024];
- ULONGEST howmuch = min (sizeof (buf), size - total_xfered);
+ ULONGEST howmuch = std::min (sizeof (buf), size - total_xfered);
status = target_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
buf, NULL, lma + total_xfered, howmuch,
#include "tic6x-tdep.h"
#include "language.h"
#include "target-descriptions.h"
+#include <algorithm>
#include "features/tic6x-c64xp.c"
#include "features/tic6x-c64x.c"
CORE_ADDR post_prologue_pc
= skip_prologue_using_sal (gdbarch, func_addr);
if (post_prologue_pc != 0)
- return max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
/* Can't determine prologue from the symbol table, need to examine
#include "solib-svr4.h"
#include "tilegx-tdep.h"
#include "opcode/tilegx.h"
+#include <algorithm>
struct tilegx_frame_cache
{
if (instbuf_size > size_on_same_page)
instbuf_size = size_on_same_page;
- instbuf_size = min (instbuf_size, (end_addr - next_addr));
+ instbuf_size = std::min ((CORE_ADDR) instbuf_size,
+ (end_addr - next_addr));
instbuf_start = next_addr;
status = safe_frame_unwind_memory (next_frame, instbuf_start,
= skip_prologue_using_sal (gdbarch, func_start);
if (post_prologue_pc != 0)
- return max (start_pc, post_prologue_pc);
+ return std::max (start_pc, post_prologue_pc);
}
/* Don't straddle a section boundary. */
s = find_pc_section (start_pc);
end_pc = start_pc + 8 * TILEGX_BUNDLE_SIZE_IN_BYTES;
if (s != NULL)
- end_pc = min (end_pc, obj_section_endaddr (s));
+ end_pc = std::min (end_pc, obj_section_endaddr (s));
/* Otherwise, try to skip prologue the hard way. */
return tilegx_analyze_prologue (gdbarch,
#include "xml-tdesc.h"
#include "target-descriptions.h"
#include "buffer.h"
+#include <algorithm>
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
and this address falls within a read-only section, fallback
to reading from executable, up to LOW_ADDR_AVAILABLE. */
if (offset < low_addr_available)
- len = min (len, low_addr_available - offset);
+ len = std::min (len, low_addr_available - offset);
res = exec_read_partial_read_only (readbuf, offset, len, xfered_len);
if (res == TARGET_XFER_OK)
#include "rsp-low.h"
#include "tracefile.h"
#include "location.h"
+#include <algorithm>
/* readline include files */
#include "readline/readline.h"
nr = VEC_safe_push (mem_range_s, *result, NULL);
- nr->start = max (lo1, lo2);
- nr->length = min (hi1, hi2) - nr->start;
+ nr->start = std::max (lo1, lo2);
+ nr->length = std::min (hi1, hi2) - nr->start;
}
normalize_mem_ranges (*result);
#include "charset.h"
#include "typeprint.h"
#include <ctype.h>
+#include <algorithm>
/* Maximum number of wchars returned from wchar_iterate. */
#define MAX_WCHARS 4
{
/* We want fetchlimit chars, so we might as well read them all in
one operation. */
- unsigned int fetchlen = min (len, fetchlimit);
+ unsigned int fetchlen = std::min ((unsigned) len, fetchlimit);
*buffer = (gdb_byte *) xmalloc (fetchlen * width);
bufptr = *buffer;
So we choose the minimum of 8 and fetchlimit. We used to use 200
instead of 8 but 200 is way too big for remote debugging over a
serial line. */
- chunksize = min (8, fetchlimit);
+ chunksize = std::min (8u, fetchlimit);
do
{
QUIT;
- nfetch = min (chunksize, fetchlimit - bufsize);
+ nfetch = std::min ((unsigned long) chunksize, fetchlimit - bufsize);
if (*buffer == NULL)
*buffer = (gdb_byte *) xmalloc (nfetch * width);
because finding the null byte (or available memory) is what actually
limits the fetch. */
- fetchlimit = (len == -1 ? options->print_max : min (len,
- options->print_max));
+ fetchlimit = (len == -1 ? options->print_max : std::min ((unsigned) len,
+ options->print_max));
err = read_string (addr, len, width, fetchlimit, byte_order,
&buffer, &bytes_read);
#include "tracepoint.h"
#include "cp-abi.h"
#include "user-regs.h"
+#include <algorithm>
/* Prototypes for exported functions. */
{
ULONGEST h, l;
- l = max (offset1, offset2);
- h = min (offset1 + len1, offset2 + len2);
+ l = std::max (offset1, offset2);
+ h = std::min (offset1 + len1, offset2 + len2);
return (l < h);
}
if (ranges_overlap (bef->offset, bef->length, offset, length))
{
/* #1 */
- ULONGEST l = min (bef->offset, offset);
- ULONGEST h = max (bef->offset + bef->length, offset + length);
+ ULONGEST l = std::min (bef->offset, offset);
+ ULONGEST h = std::max (bef->offset + bef->length, offset + length);
bef->offset = l;
bef->length = h - l;
{
ULONGEST l, h;
- l = min (t->offset, r->offset);
- h = max (t->offset + t->length, r->offset + r->length);
+ l = std::min (t->offset, r->offset);
+ h = std::max (t->offset + t->length, r->offset + r->length);
t->offset = l;
t->length = h - l;
/* Get the unavailable windows intersected by the incoming
ranges. The first and last ranges that overlap the argument
range may be wider than said incoming arguments ranges. */
- l1 = max (offset1, r1->offset);
- h1 = min (offset1 + length, r1->offset + r1->length);
+ l1 = std::max (offset1, r1->offset);
+ h1 = std::min (offset1 + length, r1->offset + r1->length);
- l2 = max (offset2, r2->offset);
- h2 = min (offset2 + length, offset2 + r2->length);
+ l2 = std::max (offset2, r2->offset);
+ h2 = std::min (offset2 + length, offset2 + r2->length);
/* Make them relative to the respective start offsets, so we can
compare them for equality. */
{
ULONGEST h, l;
- l = max (r->offset, src_bit_offset);
- h = min (r->offset + r->length, src_bit_offset + bit_length);
+ l = std::max (r->offset, (LONGEST) src_bit_offset);
+ h = std::min (r->offset + r->length,
+ (LONGEST) src_bit_offset + bit_length);
if (l < h)
insert_into_bit_range_vector (dst_range,
#include "xtensa-isa.h"
#include "xtensa-tdep.h"
#include "xtensa-config.h"
+#include <algorithm>
static unsigned int xtensa_debug_level = 0;
if (pc == 0)
{
find_pc_partial_function (start, 0, NULL, &end_pc);
- body_pc = min (end_pc, body_pc);
+ body_pc = std::min (end_pc, body_pc);
}
else
- body_pc = min (pc, body_pc);
+ body_pc = std::min (pc, body_pc);
cache->call0 = 1;
rtmp = (xtensa_c0reg_t*) alloca(nregs * sizeof(xtensa_c0reg_t));