aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog65
-rw-r--r--gdb/aarch64-tdep.c5
-rw-r--r--gdb/alpha-tdep.c3
-rw-r--r--gdb/amd64-tdep.c13
-rw-r--r--gdb/amd64-windows-tdep.c7
-rw-r--r--gdb/arm-tdep.c5
-rw-r--r--gdb/avr-tdep.c3
-rw-r--r--gdb/breakpoint.c7
-rw-r--r--gdb/btrace.c13
-rw-r--r--gdb/cli/cli-cmds.c9
-rw-r--r--gdb/compile/compile-object-load.c3
-rw-r--r--gdb/ctf.c4
-rw-r--r--gdb/defs.h7
-rw-r--r--gdb/disasm.c3
-rw-r--r--gdb/doublest.c8
-rw-r--r--gdb/dwarf2loc.c5
-rw-r--r--gdb/dwarf2read.c9
-rw-r--r--gdb/environ.c6
-rw-r--r--gdb/exec.c7
-rw-r--r--gdb/f-exp.y3
-rw-r--r--gdb/findcmd.c4
-rw-r--r--gdb/ft32-tdep.c3
-rw-r--r--gdb/gcore.c3
-rw-r--r--gdb/hppa-tdep.c25
-rw-r--r--gdb/i386-darwin-tdep.c9
-rw-r--r--gdb/i386-tdep.c5
-rw-r--r--gdb/linux-thread-db.c9
-rw-r--r--gdb/lm32-tdep.c3
-rw-r--r--gdb/m32r-tdep.c4
-rw-r--r--gdb/m88k-tdep.c13
-rw-r--r--gdb/memrange.c7
-rw-r--r--gdb/minidebug.c3
-rw-r--r--gdb/mips-tdep.c5
-rw-r--r--gdb/moxie-tdep.c3
-rw-r--r--gdb/nds32-tdep.c4
-rw-r--r--gdb/nios2-tdep.c3
-rw-r--r--gdb/nto-procfs.c4
-rw-r--r--gdb/parse.c3
-rw-r--r--gdb/ppc-sysv-tdep.c3
-rw-r--r--gdb/probe.c12
-rw-r--r--gdb/record-btrace.c7
-rw-r--r--gdb/remote.c22
-rw-r--r--gdb/rs6000-tdep.c3
-rw-r--r--gdb/rx-tdep.c7
-rw-r--r--gdb/s390-linux-nat.c8
-rw-r--r--gdb/s390-linux-tdep.c3
-rw-r--r--gdb/ser-tcp.c3
-rw-r--r--gdb/sh-tdep.c7
-rw-r--r--gdb/sh64-tdep.c3
-rw-r--r--gdb/source.c7
-rw-r--r--gdb/sparc-tdep.c3
-rw-r--r--gdb/symfile.c2
-rw-r--r--gdb/target-memory.c5
-rw-r--r--gdb/target.c15
-rw-r--r--gdb/tic6x-tdep.c3
-rw-r--r--gdb/tilegx-tdep.c8
-rw-r--r--gdb/tracefile-tfile.c3
-rw-r--r--gdb/tracepoint.c5
-rw-r--r--gdb/valprint.c11
-rw-r--r--gdb/value.c26
-rw-r--r--gdb/xtensa-tdep.c5
61 files changed, 296 insertions, 170 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 91b31ef..d8cbd81 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,68 @@
+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)
diff --git a/gdb/aarch64-tdep.c b/gdb/aarch64-tdep.c
index 3b7e954..16dd365 100644
--- a/gdb/aarch64-tdep.c
+++ b/gdb/aarch64-tdep.c
@@ -60,6 +60,7 @@
#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)
@@ -427,7 +428,7 @@ aarch64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR 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
@@ -480,7 +481,7 @@ aarch64_scan_prologue (struct frame_info *this_frame,
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
diff --git a/gdb/alpha-tdep.c b/gdb/alpha-tdep.c
index b89ea13..8716fd8 100644
--- a/gdb/alpha-tdep.c
+++ b/gdb/alpha-tdep.c
@@ -43,6 +43,7 @@
#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
@@ -721,7 +722,7 @@ alpha_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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. */
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 41b9783..a3a1fde 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -40,6 +40,7 @@
#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"
@@ -846,10 +847,10 @@ amd64_return_value (struct gdbarch *gdbarch, struct value *function,
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);
}
@@ -957,7 +958,7 @@ amd64_push_arguments (struct regcache *regcache, int nargs,
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);
}
}
@@ -2067,7 +2068,7 @@ amd64_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
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. */
@@ -2249,7 +2250,7 @@ amd64_x32_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
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
@@ -2438,7 +2439,7 @@ amd64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
&& (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);
diff --git a/gdb/amd64-windows-tdep.c b/gdb/amd64-windows-tdep.c
index 1bec6de..4570622 100644
--- a/gdb/amd64-windows-tdep.c
+++ b/gdb/amd64-windows-tdep.c
@@ -30,6 +30,7 @@
#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[] =
@@ -141,7 +142,7 @@ amd64_windows_store_arg_in_reg (struct regcache *regcache,
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);
}
@@ -1143,7 +1144,7 @@ amd64_windows_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
@@ -1155,7 +1156,7 @@ amd64_windows_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR 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);
}
return pc;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index d2661cb..4dfd76b 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -58,6 +58,7 @@
#include "record.h"
#include "record-full.h"
+#include <algorithm>
#include "features/arm-with-m.c"
#include "features/arm-with-m-fpa-layout.c"
@@ -1393,7 +1394,7 @@ thumb_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR prev_pc,
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);
}
@@ -4287,7 +4288,7 @@ arm_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
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;
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index c5f32a6..71e401b 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -36,6 +36,7 @@
#include "regcache.h"
#include "dis-asm.h"
#include "objfiles.h"
+#include <algorithm>
/* AVR Background:
@@ -882,7 +883,7 @@ avr_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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;
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 6bb6bbf..28331f1 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -80,6 +80,7 @@
#include "mi/mi-common.h"
#include "extension.h"
+#include <algorithm>
/* Enums for exception-handling support. */
enum exception_event_kind
@@ -4435,8 +4436,8 @@ hardware_watchpoint_inserted_in_range (struct address_space *aspace,
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;
}
@@ -5996,7 +5997,7 @@ bpstat_what (bpstat bs_head)
_("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;
diff --git a/gdb/btrace.c b/gdb/btrace.c
index f2cb750..d1af128 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -37,6 +37,7 @@
#include <inttypes.h>
#include <ctype.h>
+#include <algorithm>
/* Command lists for btrace maintenance commands. */
static struct cmd_list_element *maint_btrace_cmdlist;
@@ -395,7 +396,7 @@ ftrace_new_return (struct btrace_function *prev,
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);
@@ -645,7 +646,7 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
/* 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
@@ -691,7 +692,7 @@ btrace_compute_ftrace_bts (struct thread_info *tp,
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);
}
}
@@ -801,7 +802,7 @@ ftrace_add_pt (struct pt_insn_decoder *decoder,
}
/* 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;
@@ -1827,7 +1828,7 @@ btrace_insn_next (struct btrace_insn_iterator *it, unsigned int stride)
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;
@@ -1906,7 +1907,7 @@ btrace_insn_prev (struct btrace_insn_iterator *it, unsigned int stride)
}
/* Advance the iterator as far as possible within this segment. */
- adv = min (index, stride);
+ adv = std::min (index, stride);
stride -= adv;
index -= adv;
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index c60b1d3..5ab4791 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -56,6 +56,7 @@
#endif
#include <fcntl.h>
+#include <algorithm>
/* Prototypes for local command functions */
@@ -918,7 +919,7 @@ list_command (char *arg, int from_tty)
{
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,
@@ -945,8 +946,8 @@ list_command (char *arg, int from_tty)
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);
}
@@ -1090,7 +1091,7 @@ list_command (char *arg, int from_tty)
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\"."));
diff --git a/gdb/compile/compile-object-load.c b/gdb/compile/compile-object-load.c
index 4392c15..9fc6c02 100644
--- a/gdb/compile/compile-object-load.c
+++ b/gdb/compile/compile-object-load.c
@@ -31,6 +31,7 @@
#include "compile.h"
#include "block.h"
#include "arch-utils.h"
+#include <algorithm>
/* Track inferior memory reserved by inferior mmap. */
@@ -186,7 +187,7 @@ setup_sections (bfd *abfd, asection *sect, void *data_voidp)
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;
diff --git a/gdb/ctf.c b/gdb/ctf.c
index 0e13cc1..7daa47e 100644
--- a/gdb/ctf.c
+++ b/gdb/ctf.c
@@ -29,8 +29,8 @@
#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).
@@ -1397,7 +1397,7 @@ ctf_xfer_partial (struct target_ops *ops, enum target_object object,
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)
diff --git a/gdb/defs.h b/gdb/defs.h
index fee5f41..9bc354e 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -102,13 +102,6 @@ enum compile_i_scope_types
#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;
diff --git a/gdb/disasm.c b/gdb/disasm.c
index bd1f760..07c3abe 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -25,6 +25,7 @@
#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
@@ -713,7 +714,7 @@ do_mixed_source_and_assembly (struct gdbarch *gdbarch, struct ui_out *uiout,
}
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,
diff --git a/gdb/doublest.c b/gdb/doublest.c
index 943a9f6..b1b0921 100644
--- a/gdb/doublest.c
+++ b/gdb/doublest.c
@@ -28,6 +28,7 @@
#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
@@ -255,7 +256,7 @@ convert_floatformat_to_doublest (const struct floatformat *fmt,
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);
@@ -565,7 +566,7 @@ floatformat_classify (const struct floatformat *fmt,
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);
@@ -862,7 +863,8 @@ convert_typed_floating (const void *from, const struct type *from_type,
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
{
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 946ddf8..f9f3216 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -38,6 +38,7 @@
#include "dwarf2loc.h"
#include "dwarf2-frame.h"
#include "compile/compile.h"
+#include <algorithm>
extern int dwarf_always_disassemble;
@@ -862,7 +863,7 @@ chain_candidate (struct gdbarch *gdbarch, struct call_site_chain **resultp,
/* 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))
{
@@ -872,7 +873,7 @@ chain_candidate (struct gdbarch *gdbarch, struct call_site_chain **resultp,
/* 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))
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index 40ee66d..d0f6e71 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -73,6 +73,7 @@
#include <fcntl.h>
#include <sys/types.h>
+#include <algorithm>
typedef struct symbol *symbolp;
DEF_VEC_P (symbolp);
@@ -12156,8 +12157,8 @@ dwarf2_get_subprogram_pc_bounds (struct die_info *die,
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
@@ -12221,8 +12222,8 @@ get_scope_pc_bounds (struct die_info *die,
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:
diff --git a/gdb/environ.c b/gdb/environ.c
index 9557cef..5c73757 100644
--- a/gdb/environ.c
+++ b/gdb/environ.c
@@ -15,11 +15,9 @@
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>
/* Return a new environment object. */
@@ -68,7 +66,7 @@ init_environ (struct gdb_environ *e)
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 *));
}
diff --git a/gdb/exec.c b/gdb/exec.c
index 00c31d3..b18ca8b 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -43,6 +43,7 @@
#include <ctype.h>
#include <sys/stat.h>
#include "solist.h"
+#include <algorithm>
void (*deprecated_file_changed_hook) (char *);
@@ -758,8 +759,8 @@ section_table_available_memory (VEC(mem_range_s) *memory,
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;
}
}
@@ -797,7 +798,7 @@ section_table_read_available_memory (gdb_byte *readbuf, ULONGEST offset,
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);
diff --git a/gdb/f-exp.y b/gdb/f-exp.y
index e3148a3..420f18e 100644
--- a/gdb/f-exp.y
+++ b/gdb/f-exp.y
@@ -53,6 +53,7 @@
#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))
@@ -866,7 +867,7 @@ growbuf_by_size (int count)
{
int growby;
- growby = max (count, GROWBY_MIN_SIZE);
+ growby = std::max (count, GROWBY_MIN_SIZE);
tempbufsize += growby;
if (tempbuf == NULL)
tempbuf = (char *) malloc (tempbufsize);
diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index f5202e8..adc0813 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -24,6 +24,7 @@
#include "value.h"
#include "target.h"
#include "cli/cli-utils.h"
+#include <algorithm>
/* Copied from bfd_put_bits. */
@@ -178,7 +179,8 @@ parse_find_args (char *args, ULONGEST *max_countp,
/* 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;
diff --git a/gdb/ft32-tdep.c b/gdb/ft32-tdep.c
index db04d2e..d7c2b40 100644
--- a/gdb/ft32-tdep.c
+++ b/gdb/ft32-tdep.c
@@ -41,6 +41,7 @@
#include "ft32-tdep.h"
#include "gdb/sim-ft32.h"
+#include <algorithm>
#define RAM_BIAS 0x800000 /* Bias added to RAM addresses. */
@@ -274,7 +275,7 @@ ft32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/gcore.c b/gdb/gcore.c
index a0ef0e6..cb4d703 100644
--- a/gdb/gcore.c
+++ b/gdb/gcore.c
@@ -34,6 +34,7 @@
#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
@@ -572,7 +573,7 @@ gcore_copy_callback (bfd *obfd, asection *osec, void *ignored)
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);
diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index f879a25..b74ff67 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -39,6 +39,7 @@
#include "gdbtypes.h"
#include "objfiles.h"
#include "hppa-tdep.h"
+#include <algorithm>
static int hppa_debug = 0;
@@ -1094,10 +1095,10 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
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--;
}
@@ -1109,7 +1110,7 @@ hppa64_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
/* 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. */
@@ -1251,9 +1252,9 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
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++;
}
}
@@ -1263,9 +1264,9 @@ hppa64_return_value (struct gdbarch *gdbarch, struct value *function,
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++;
}
}
@@ -1849,7 +1850,7 @@ hppa_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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));
}
diff --git a/gdb/i386-darwin-tdep.c b/gdb/i386-darwin-tdep.c
index e0090ef..97fb387 100644
--- a/gdb/i386-darwin-tdep.c
+++ b/gdb/i386-darwin-tdep.c
@@ -36,6 +36,7 @@
#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. */
@@ -137,8 +138,12 @@ i386_darwin_arg_type_alignment (struct type *type)
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. */
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 9ed24cf..ccdfec0 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -66,6 +66,7 @@
#include "expression.h"
#include "parser-defs.h"
#include <ctype.h>
+#include <algorithm>
/* Register names. */
@@ -1365,7 +1366,7 @@ i386_analyze_stack_align (CORE_ADDR pc, CORE_ADDR current_pc,
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. */
@@ -1836,7 +1837,7 @@ i386_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
&& (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;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 2300c81..6ed3997 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -45,6 +45,7 @@
#include <signal.h>
#include <ctype.h>
#include "nat/linux-namespaces.h"
+#include <algorithm>
/* GNU/Linux libthread_db support.
@@ -1599,13 +1600,13 @@ info_auto_load_libthread_db (char *args, int from_tty)
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;
}
@@ -1614,7 +1615,7 @@ info_auto_load_libthread_db (char *args, int from_tty)
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
diff --git a/gdb/lm32-tdep.c b/gdb/lm32-tdep.c
index ea83892..bb9a297 100644
--- a/gdb/lm32-tdep.c
+++ b/gdb/lm32-tdep.c
@@ -36,6 +36,7 @@
#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)
@@ -197,7 +198,7 @@ lm32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/m32r-tdep.c b/gdb/m32r-tdep.c
index bc4b2d2..8e1d79e 100644
--- a/gdb/m32r-tdep.c
+++ b/gdb/m32r-tdep.c
@@ -36,8 +36,8 @@
#include "trad-frame.h"
#include "dis-asm.h"
#include "objfiles.h"
-
#include "m32r-tdep.h"
+#include <algorithm>
/* Local functions */
@@ -484,7 +484,7 @@ m32r_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/m88k-tdep.c b/gdb/m88k-tdep.c
index 1a3c2cd..e8e19df 100644
--- a/gdb/m88k-tdep.c
+++ b/gdb/m88k-tdep.c
@@ -30,6 +30,7 @@
#include "symtab.h"
#include "trad-frame.h"
#include "value.h"
+#include <algorithm>
#include "m88k-tdep.h"
@@ -558,7 +559,7 @@ m88k_analyze_prologue (struct gdbarch *gdbarch,
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:
@@ -566,7 +567,7 @@ m88k_analyze_prologue (struct gdbarch *gdbarch,
/* 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. */
{
@@ -583,7 +584,7 @@ m88k_analyze_prologue (struct gdbarch *gdbarch,
/* 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);
@@ -593,7 +594,7 @@ m88k_analyze_prologue (struct gdbarch *gdbarch,
/* 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);
@@ -604,12 +605,12 @@ m88k_analyze_prologue (struct gdbarch *gdbarch,
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;
diff --git a/gdb/memrange.c b/gdb/memrange.c
index e99f54e..339c6f0 100644
--- a/gdb/memrange.c
+++ b/gdb/memrange.c
@@ -19,6 +19,7 @@
#include "defs.h"
#include "memrange.h"
+#include <algorithm>
int
mem_ranges_overlap (CORE_ADDR start1, int len1,
@@ -26,8 +27,8 @@ 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);
}
@@ -82,7 +83,7 @@ normalize_mem_ranges (VEC(mem_range_s) *ranges)
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 */
}
diff --git a/gdb/minidebug.c b/gdb/minidebug.c
index d38fc64..4323294 100644
--- a/gdb/minidebug.c
+++ b/gdb/minidebug.c
@@ -22,6 +22,7 @@
#include "symfile.h"
#include "objfiles.h"
#include "gdbcore.h"
+#include <algorithm>
#ifdef HAVE_LIBLZMA
@@ -201,7 +202,7 @@ lzma_pread (struct bfd *nbfd, void *stream, void *buf, file_ptr nbytes,
+ 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;
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 4e4d79e..84a78b9 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -55,6 +55,7 @@
#include "user-regs.h"
#include "valprint.h"
#include "ax.h"
+#include <algorithm>
static const struct objfile_data *mips_pdr_data;
@@ -3039,7 +3040,7 @@ micromips_scan_prologue (struct gdbarch *gdbarch,
&& ((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++)
@@ -6645,7 +6646,7 @@ mips_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/moxie-tdep.c b/gdb/moxie-tdep.c
index 714734d..5e5c19b 100644
--- a/gdb/moxie-tdep.c
+++ b/gdb/moxie-tdep.c
@@ -39,6 +39,7 @@
#include "record-full.h"
#include "moxie-tdep.h"
+#include <algorithm>
/* Local functions. */
@@ -225,7 +226,7 @@ moxie_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/nds32-tdep.c b/gdb/nds32-tdep.c
index de72656..0ec443a 100644
--- a/gdb/nds32-tdep.c
+++ b/gdb/nds32-tdep.c
@@ -41,6 +41,8 @@
#include "nds32-tdep.h"
#include "elf/nds32.h"
#include "opcode/nds32.h"
+#include <algorithm>
+
#include "features/nds32.c"
/* Simple macros for instruction analysis. */
@@ -894,7 +896,7 @@ nds32_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/nios2-tdep.c b/gdb/nios2-tdep.c
index 8bfd8b3..3ff325f 100644
--- a/gdb/nios2-tdep.c
+++ b/gdb/nios2-tdep.c
@@ -44,6 +44,7 @@
/* To get entry_point_address. */
#include "objfiles.h"
+#include <algorithm>
/* Nios II specific header. */
#include "nios2-tdep.h"
@@ -1685,7 +1686,7 @@ nios2_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_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);
}
/* Prologue analysis does the rest.... */
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index f358528..9d581f2 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -516,7 +516,7 @@ procfs_meminfo (char *args, int from_tty)
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. */
@@ -939,7 +939,7 @@ procfs_xfer_partial (struct target_ops *ops, enum target_object object,
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;
diff --git a/gdb/parse.c b/gdb/parse.c
index 2b00708..231eebf 100644
--- a/gdb/parse.c
+++ b/gdb/parse.c
@@ -49,6 +49,7 @@
#include "source.h"
#include "objfiles.h"
#include "user-regs.h"
+#include <algorithm>
/* Standard set of definitions for printing, dumping, prefixifying,
* and evaluating expressions. */
@@ -1925,7 +1926,7 @@ increase_expout_size (struct parser_state *ps, size_t lenelt)
{
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)
diff --git a/gdb/ppc-sysv-tdep.c b/gdb/ppc-sysv-tdep.c
index 140d993..4083cc8 100644
--- a/gdb/ppc-sysv-tdep.c
+++ b/gdb/ppc-sysv-tdep.c
@@ -28,6 +28,7 @@
#include "objfiles.h"
#include "infcall.h"
#include "dwarf2.h"
+#include <algorithm>
/* Check whether FTPYE is a (pointer to) function type that should use
@@ -1189,7 +1190,7 @@ ppc64_aggregate_candidate (struct type *type,
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. */
diff --git a/gdb/probe.c b/gdb/probe.c
index 56f93da..285f4e1 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -35,6 +35,7 @@
#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);
@@ -432,7 +433,7 @@ gen_ui_out_table_header_info (VEC (bound_probe_s) *probes,
if (val == NULL)
continue;
- size_max = max (strlen (val), size_max);
+ size_max = std::max (strlen (val), size_max);
}
do_cleanups (c2);
}
@@ -644,10 +645,11 @@ info_probes_for_ops (const char *arg, int from_tty,
{
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"));
diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index d50d5d8..257d0b0 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -39,6 +39,7 @@
#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;
@@ -1003,8 +1004,8 @@ btrace_compute_src_line_range (const struct btrace_function *bfun,
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:
@@ -1380,7 +1381,7 @@ record_btrace_xfer_partial (struct target_ops *ops, enum target_object object,
& 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;
}
}
diff --git a/gdb/remote.c b/gdb/remote.c
index 13258b9e..2309205 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -71,6 +71,7 @@
#include "agent.h"
#include "btrace.h"
#include "record-btrace.h"
+#include <algorithm>
/* Temp hacks for tracepoint encoding migration. */
static char *target_buf;
@@ -3354,7 +3355,7 @@ remote_threads_extra_info (struct target_ops *self, struct thread_info *tp)
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;
@@ -7466,7 +7467,7 @@ hexnumlen (ULONGEST num)
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. */
@@ -7671,18 +7672,22 @@ remote_write_bytes_aux (const char *header, CORE_ADDR memaddr,
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)
@@ -7841,7 +7846,8 @@ remote_read_bytes_1 (CORE_ADDR memaddr, gdb_byte *myaddr, ULONGEST len_units,
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);
@@ -9901,7 +9907,7 @@ remote_read_qxfer (struct target_ops *ops, const char *object_name,
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),
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c
index e180641..5f15780 100644
--- a/gdb/rs6000-tdep.c
+++ b/gdb/rs6000-tdep.c
@@ -64,6 +64,7 @@
#include "ax.h"
#include "ax-gdb.h"
+#include <algorithm>
#include "features/rs6000/powerpc-32.c"
#include "features/rs6000/powerpc-altivec32.c"
@@ -2185,7 +2186,7 @@ rs6000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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
diff --git a/gdb/rx-tdep.c b/gdb/rx-tdep.c
index 904aebd..5d55a98 100644
--- a/gdb/rx-tdep.c
+++ b/gdb/rx-tdep.c
@@ -36,6 +36,7 @@
#include "elf/rx.h"
#include "elf-bfd.h"
+#include <algorithm>
/* Certain important register numbers. */
enum
@@ -897,7 +898,7 @@ rx_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
&& 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,
@@ -960,7 +961,7 @@ rx_return_value (struct gdbarch *gdbarch,
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);
@@ -978,7 +979,7 @@ rx_return_value (struct gdbarch *gdbarch,
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);
diff --git a/gdb/s390-linux-nat.c b/gdb/s390-linux-nat.c
index d1d2bf8..687502c 100644
--- a/gdb/s390-linux-nat.c
+++ b/gdb/s390-linux-nat.c
@@ -700,8 +700,8 @@ s390_prepare_to_resume (struct lwp_info *lp)
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. */
@@ -722,8 +722,8 @@ s390_prepare_to_resume (struct lwp_info *lp)
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
diff --git a/gdb/s390-linux-tdep.c b/gdb/s390-linux-tdep.c
index 70364b4..399084a 100644
--- a/gdb/s390-linux-tdep.c
+++ b/gdb/s390-linux-tdep.c
@@ -58,6 +58,7 @@
#include "elf/common.h"
#include "elf/s390.h"
#include "elf-bfd.h"
+#include <algorithm>
#include "features/s390-linux32.c"
#include "features/s390-linux32v1.c"
@@ -1734,7 +1735,7 @@ s390_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
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);
diff --git a/gdb/ser-tcp.c b/gdb/ser-tcp.c
index df3af4c..e689bd7 100644
--- a/gdb/ser-tcp.c
+++ b/gdb/ser-tcp.c
@@ -54,6 +54,7 @@
#include <signal.h>
#include "gdb_select.h"
+#include <algorithm>
#ifndef HAVE_SOCKLEN_T
typedef int socklen_t;
@@ -183,7 +184,7 @@ net_open (struct serial *scb, const char *name)
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);
diff --git a/gdb/sh-tdep.c b/gdb/sh-tdep.c
index 694f5f7..12aedbb 100644
--- a/gdb/sh-tdep.c
+++ b/gdb/sh-tdep.c
@@ -52,6 +52,7 @@
#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;
@@ -654,7 +655,7 @@ sh_analyze_prologue (struct gdbarch *gdbarch,
{
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
@@ -728,7 +729,7 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
{
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
@@ -745,7 +746,7 @@ sh_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* 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);
diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c
index ee8d19c..f51186a 100644
--- a/gdb/sh64-tdep.c
+++ b/gdb/sh64-tdep.c
@@ -45,6 +45,7 @@
#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
@@ -685,7 +686,7 @@ sh64_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
/* 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);
}
diff --git a/gdb/source.c b/gdb/source.c
index 72da0e3..a703851 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -43,6 +43,7 @@
#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
@@ -283,7 +284,7 @@ select_source_symtab (struct symtab *s)
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;
}
@@ -1706,7 +1707,7 @@ forward_search_command (char *regex, int from_tty)
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++;
@@ -1784,7 +1785,7 @@ reverse_search_command (char *regex, int from_tty)
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--;
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c
index 5a8acce..f50468b 100644
--- a/gdb/sparc-tdep.c
+++ b/gdb/sparc-tdep.c
@@ -37,6 +37,7 @@
#include "sparc-tdep.h"
#include "sparc-ravenscar-thread.h"
+#include <algorithm>
struct regset;
@@ -561,7 +562,7 @@ sparc32_store_arguments (struct regcache *regcache, int nargs,
}
/* 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." */
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7d7843e..7eb6cdc 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1461,7 +1461,7 @@ find_separate_debug_file (const char *dir,
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);
diff --git a/gdb/target-memory.c b/gdb/target-memory.c
index 39d022b..c811448 100644
--- a/gdb/target-memory.c
+++ b/gdb/target-memory.c
@@ -24,6 +24,7 @@
#include "memory-map.h"
#include "gdb_sys_time.h"
+#include <algorithm>
static int
compare_block_starting_address (const void *a, const void *b)
@@ -71,11 +72,11 @@ claim_memory (VEC(memory_write_request_s) *blocks,
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);
diff --git a/gdb/target.c b/gdb/target.c
index bca25bd..628bceb 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -45,6 +45,7 @@
#include "target-debug.h"
#include "top.h"
#include "event-top.h"
+#include <algorithm>
static void target_info (char *, int);
@@ -1292,7 +1293,7 @@ memory_xfer_partial (struct target_ops *ops, enum target_object object,
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);
@@ -1858,7 +1859,7 @@ read_memory_robust (struct target_ops *ops,
}
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);
@@ -2445,7 +2446,8 @@ simple_search_memory (struct target_ops *ops,
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);
@@ -2478,7 +2480,8 @@ simple_search_memory (struct target_ops *ops,
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,
@@ -2850,7 +2853,7 @@ static void
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. */
@@ -3582,7 +3585,7 @@ simple_verify_memory (struct target_ops *ops,
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,
diff --git a/gdb/tic6x-tdep.c b/gdb/tic6x-tdep.c
index af53938..adb7f50 100644
--- a/gdb/tic6x-tdep.c
+++ b/gdb/tic6x-tdep.c
@@ -48,6 +48,7 @@
#include "tic6x-tdep.h"
#include "language.h"
#include "target-descriptions.h"
+#include <algorithm>
#include "features/tic6x-c64xp.c"
#include "features/tic6x-c64x.c"
@@ -308,7 +309,7 @@ tic6x_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
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
diff --git a/gdb/tilegx-tdep.c b/gdb/tilegx-tdep.c
index 550be4c..45eb162 100644
--- a/gdb/tilegx-tdep.c
+++ b/gdb/tilegx-tdep.c
@@ -41,6 +41,7 @@
#include "solib-svr4.h"
#include "tilegx-tdep.h"
#include "opcode/tilegx.h"
+#include <algorithm>
struct tilegx_frame_cache
{
@@ -428,7 +429,8 @@ tilegx_analyze_prologue (struct gdbarch* gdbarch,
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,
@@ -752,14 +754,14 @@ tilegx_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc)
= 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,
diff --git a/gdb/tracefile-tfile.c b/gdb/tracefile-tfile.c
index 9c561b9..57bb597 100644
--- a/gdb/tracefile-tfile.c
+++ b/gdb/tracefile-tfile.c
@@ -32,6 +32,7 @@
#include "xml-tdesc.h"
#include "target-descriptions.h"
#include "buffer.h"
+#include <algorithm>
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
@@ -987,7 +988,7 @@ tfile_xfer_partial (struct target_ops *ops, enum target_object object,
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)
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index a2189d5..c89c77e 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -56,6 +56,7 @@
#include "rsp-low.h"
#include "tracefile.h"
#include "location.h"
+#include <algorithm>
/* readline include files */
#include "readline/readline.h"
@@ -4324,8 +4325,8 @@ traceframe_available_memory (VEC(mem_range_s) **result,
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);
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 4a1ee13..93607e5 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -36,6 +36,7 @@
#include "charset.h"
#include "typeprint.h"
#include <ctype.h>
+#include <algorithm>
/* Maximum number of wchars returned from wchar_iterate. */
#define MAX_WCHARS 4
@@ -2178,7 +2179,7 @@ read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
{
/* 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;
@@ -2202,12 +2203,12 @@ read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit,
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);
@@ -2864,8 +2865,8 @@ val_print_string (struct type *elttype, const char *encoding,
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);
diff --git a/gdb/value.c b/gdb/value.c
index d6eab24..b825aec 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -40,6 +40,7 @@
#include "tracepoint.h"
#include "cp-abi.h"
#include "user-regs.h"
+#include <algorithm>
/* Prototypes for exported functions. */
@@ -84,8 +85,8 @@ ranges_overlap (LONGEST offset1, LONGEST len1,
{
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);
}
@@ -528,8 +529,8 @@ insert_into_bit_range_vector (VEC(range_s) **vectorp,
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;
@@ -572,8 +573,8 @@ insert_into_bit_range_vector (VEC(range_s) **vectorp,
{
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;
@@ -780,11 +781,11 @@ find_first_range_overlap_and_match (struct ranges_and_idx *rp1,
/* 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. */
@@ -1297,8 +1298,9 @@ ranges_copy_adjusted (VEC (range_s) **dst_range, int dst_bit_offset,
{
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,
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index 32beafd..aafb175 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -52,6 +52,7 @@
#include "xtensa-isa.h"
#include "xtensa-tdep.h"
#include "xtensa-config.h"
+#include <algorithm>
static unsigned int xtensa_debug_level = 0;
@@ -2417,10 +2418,10 @@ call0_analyze_prologue (struct gdbarch *gdbarch,
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));