]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
gdb: Use std::min and std::max throughout
authorPedro Alves <palves@redhat.com>
Fri, 16 Sep 2016 18:55:17 +0000 (19:55 +0100)
committerPedro Alves <palves@redhat.com>
Fri, 16 Sep 2016 18:55:17 +0000 (19:55 +0100)
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.

61 files changed:
gdb/ChangeLog
gdb/aarch64-tdep.c
gdb/alpha-tdep.c
gdb/amd64-tdep.c
gdb/amd64-windows-tdep.c
gdb/arm-tdep.c
gdb/avr-tdep.c
gdb/breakpoint.c
gdb/btrace.c
gdb/cli/cli-cmds.c
gdb/compile/compile-object-load.c
gdb/ctf.c
gdb/defs.h
gdb/disasm.c
gdb/doublest.c
gdb/dwarf2loc.c
gdb/dwarf2read.c
gdb/environ.c
gdb/exec.c
gdb/f-exp.y
gdb/findcmd.c
gdb/ft32-tdep.c
gdb/gcore.c
gdb/hppa-tdep.c
gdb/i386-darwin-tdep.c
gdb/i386-tdep.c
gdb/linux-thread-db.c
gdb/lm32-tdep.c
gdb/m32r-tdep.c
gdb/m88k-tdep.c
gdb/memrange.c
gdb/minidebug.c
gdb/mips-tdep.c
gdb/moxie-tdep.c
gdb/nds32-tdep.c
gdb/nios2-tdep.c
gdb/nto-procfs.c
gdb/parse.c
gdb/ppc-sysv-tdep.c
gdb/probe.c
gdb/record-btrace.c
gdb/remote.c
gdb/rs6000-tdep.c
gdb/rx-tdep.c
gdb/s390-linux-nat.c
gdb/s390-linux-tdep.c
gdb/ser-tcp.c
gdb/sh-tdep.c
gdb/sh64-tdep.c
gdb/source.c
gdb/sparc-tdep.c
gdb/symfile.c
gdb/target-memory.c
gdb/target.c
gdb/tic6x-tdep.c
gdb/tilegx-tdep.c
gdb/tracefile-tfile.c
gdb/tracepoint.c
gdb/valprint.c
gdb/value.c
gdb/xtensa-tdep.c

index 91b31ef42022d3acc497d80103c605f902ee7651..d8cbd81658f34c72eb57bdeff89940f43c50adb3 100644 (file)
@@ -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)
index 3b7e954424e13df05c86c84c442501d719261f32..16dd365b0593edab77cd940d0facc0c2b1af9808 100644 (file)
@@ -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
index b89ea13852e2dba93092c2607c71c38413adf502..8716fd860fc6002f7d61600dcda161c658af05ab 100644 (file)
@@ -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.  */
index 41b97836c0cebafd5dbf1b47fccc6521b887e820..a3a1fde2b520ebb941b7fb7bff369d33b9087650 100644 (file)
@@ -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);
index 1bec6deb92d659b6e98abc00cbc1b3442d4cbb4c..4570622a17b1b303a1a6e951d6ea8ce4cf8d68ed 100644 (file)
@@ -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;
index d2661cb61cb60310e527bf61596986155b86a023..4dfd76be74e528a99458013625399ea32546ef53 100644 (file)
@@ -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;
index c5f32a6b33c40602b3355a00ebcf833a0b1e9762..71e401bcdcb9674429478ee213350efc9d830b42 100644 (file)
@@ -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;
index 6bb6bbfbef9ba573479b4fda575442026e9d3761..28331f10881fc36f41053eecef3146759353cb75 100644 (file)
@@ -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;
index f2cb7504e47930643fd700576c27084770db41ab..d1af128b5a93be954ae8b87011a5b57a1edff448 100644 (file)
@@ -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;
index c60b1d3c83c1a200207153ab020403ac7ff23cfb..5ab479185122afb1351f1f94c2dd90452cd11d74 100644 (file)
@@ -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\"."));
index 4392c150316503d4310e10577b1dc1e65ecb8b0b..9fc6c029c5aeb0dd814362bcc115cd32e4e8a2e4 100644 (file)
@@ -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;
 
index 0e13cc1374b1d0679c94679c944b4538033256b1..7daa47e28a411400ad83db7f8d3f25afa3901e60 100644 (file)
--- 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)
index fee5f411eb38fac7b76f12fb6d347cdeb40d1676..9bc354e66259463c87f60e62a95673f53c7eace4 100644 (file)
@@ -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;
 
index bd1f760a6eeb9fd76929d2053de3137ed74e6963..07c3abe39ba63190ce285356401e7a9ae974325b 100644 (file)
@@ -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,
index 943a9f6901f3422df2f96bddec3766a187251c06..b1b0921eeb5222f534f9b5f8e0697cbf3282dda9 100644 (file)
@@ -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
     {
index 946ddf8b6e94d8a4908d237ec8cf12ead2d8ff41..f9f3216418f8eb4b51b40391d528dfc398398af0 100644 (file)
@@ -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))
index 40ee66d577d499519b8f997ac700e45fa4018b0f..d0f6e71560f7e3c3ddbf30957aefa4ea82c22838 100644 (file)
@@ -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:
index 9557cefabb21a343165cb5e1bf77c37b01ef8464..5c737578054dd2dde75951efca460ce1baa3e246 100644 (file)
    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.  */
@@ -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 *));
     }
index 00c31d37da6b3339570d224d7c62f4a8809bd427..b18ca8b662e4eb43ec67ca7efacfe1f009da351b 100644 (file)
@@ -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);
 
index e3148a3026375f1f0029236ea8d0c8bf2cd4321d..420f18e56334c826870291941e8f9468243bf2d3 100644 (file)
@@ -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);
index f5202e8199628e183fe78c037531d1d30ea769af..adc0813bef56ecc22cc3f13ab7a8fd67e4c2f1cd 100644 (file)
@@ -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;
index db04d2e7abdeac4bf1c4b8890c7fbe84bef17f54..d7c2b405b0e16267d3ad4ae0b0321c316562cdcf 100644 (file)
@@ -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
index a0ef0e6081e245bde47261c2366f7f3605ecfbb7..cb4d70383ecd16fd0d06c60bb0e353ee5b1c13aa 100644 (file)
@@ -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);
 
index f879a25d5abe361c12fc9bf34cc016304fa7b464..b74ff67c945818772b3bbb1a4f37e93d0feff63d 100644 (file)
@@ -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));
 }
index e0090ef0ab0ae987852c133f6bda67fa6e4e866f..97fb38723b118b602bb4a1fd93f90620514ab106 100644 (file)
@@ -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.  */
index 9ed24cff663323d270f632d8cef696a5cad6c9d2..ccdfec07fe7d381f1f435632a62d4ae7afbd0271 100644 (file)
@@ -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;
index 2300c810a7465e92cfd8b3a2b09d50e4071e0f9a..6ed3997d1d5b364c81849208825dc274bfb8f0f1 100644 (file)
@@ -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
index ea83892b049a68f37ced0bcf9a794d0e544a4f95..bb9a29759c41044079ccb95db95b7d7b0be2e321 100644 (file)
@@ -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
index bc4b2d24242bd0f0cf22e3030066445ee4c70154..8e1d79e51286081eb8cbcbfefe26f4da9927cb33 100644 (file)
@@ -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
index 1a3c2cdb74d20fc7d33f4dc49f0f02ef06c048fa..e8e19df754d14836924a6d1b460e3d3ae05d6330 100644 (file)
@@ -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;
index e99f54e98cee370adf1ae205a2e8b5bdcf580d62..339c6f0637289ecdfcaa92994b127813db649be9 100644 (file)
@@ -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 */
            }
index d38fc6410a40f0927faeaee0f76355f2c09bf437..43232945b9df963dce8aa2bb4c598159e458abc2 100644 (file)
@@ -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;
index 4e4d79ed4abeb100361ef86b11b169ea58deede6..84a78b962c50a10e5e1ea0e173de1db91c1dbf6b 100644 (file)
@@ -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
index 714734ddab2ce1b037210b8235852b97f0d32c57..5e5c19bc38225383763e770fc7a255248bdc8345 100644 (file)
@@ -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
index de72656513ed755f9120a083faa9c631004bc18c..0ec443a96574cf29b2589761e0e3755c677c3038 100644 (file)
@@ -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
index 8bfd8b3bda4302cdcd616aa31e2da9df345eb6fa..3ff325fe0e37cef34caa6fd255a68560a450db5e 100644 (file)
@@ -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....  */
index f358528b9492d4eb9778e5e5d7a0d067b9bb8724..9d581f24673b26044f85a122a1e460055d4e1ce1 100644 (file)
@@ -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;
index 2b00708f1b83994158957ced4a3f936e0bfa05f1..231eebf1480ba5b00f78af8ab136145c37dc6d8a 100644 (file)
@@ -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)
index 140d993641bbe030a3c052d5ba3f4b60a900115b..4083cc81fc9e3f2402ef4d79432941cf0cc56440 100644 (file)
@@ -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.  */
index 56f93dad9b3e29f42bbec6d43af9c1c38cb19a28..285f4e128903e0cd2131d1ecf12c8d462590311e 100644 (file)
@@ -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"));
index d50d5d8b85022899711ead20ee36656a17b5bb44..257d0b0fa80a3dc8cdff2c5b002e2e1cafdd4348 100644 (file)
@@ -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;
                  }
              }
index 13258b9eb47e775486936c838547db0899e80e51..2309205ed7513366a136324b943b061e475cec21 100644 (file)
@@ -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),
index e18064165ff68a2fbf7e6ac841a44bb0b7d3e70b..5f15780820344ddc5b8623831df72a9fe9468aef 100644 (file)
@@ -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
index 904aebd801eec364ca2709e62db3dc4a5d8805ad..5d55a98dbea86e32c18f59d1a851aa241f366edd 100644 (file)
@@ -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);
index d1d2bf8e37e7643073832bdafb24045a1ca5bcf6..687502c87c064b430ed13c65311f771e33c30492 100644 (file)
@@ -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
index 70364b472a20bed3c2afb3d64a8b6d745993799b..399084a3295de5e7fbeaee12ee8771665a44b30e 100644 (file)
@@ -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);
index df3af4c17189b339a6a3395bacee64315fd2c5c9..e689bd7df8acfcf140588f16b6eba006c5669c44 100644 (file)
@@ -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);
index 694f5f742d0323cda4edf219933c59ce717ccac7..12aedbbbe628d6d33b9226dacbf5f8246a5361b7 100644 (file)
@@ -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);
index ee8d19ccd9ebc872734bf8b01fcfdf2d92f2dc14..f51186ac68b80c6c1978bc1b4b2ad695715d00d6 100644 (file)
@@ -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);
 }
index 72da0e33be2dcd8ea178d15f8ca08c1777a9daf5..a7038516adc90dd4dd29780d3189970b7dc6592b 100644 (file)
@@ -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--;
index 5a8acce8f257a4af9d86f4f07ec24325992be4b9..f50468bf6df2a610e7fea05a1662f4b52329e581 100644 (file)
@@ -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."  */
index 7d7843ea7ce5a74332fd27c3aad9fcd7549181a7..7eb6cdc0c448f9810e18ec07eaf00caea03062be 100644 (file)
@@ -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);
index 39d022b90dd1aa6600791dd0af32937c1478380a..c81144859fdf808d05b7ccda37d42f0b97b7becd 100644 (file)
@@ -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);
index bca25bd9dba4eef43057ba11af78d4f46de2727a..628bceb6642ce06724836ca24d14000906cedc38 100644 (file)
@@ -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,
index af5393828e6ec0b9e1b03e2521a46c2cc96cc1a0..adb7f5054651ad5e0ca751f2e2c955798bcebf6d 100644 (file)
@@ -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
index 550be4cd0b56d58997ecefb49e9f43166dc2b4af..45eb1625d67673272947350c6f71004c30d2183a 100644 (file)
@@ -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,
index 9c561b9e650d8d51cfe0e5e9fbc557138ac49d43..57bb597f4f3ceb1e250f76e973bd1ae1aaa93e09 100644 (file)
@@ -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)
index a2189d57198f78f1beee6d1b502effaddb6dd86e..c89c77e2a06a7de81dcd1c8829cda3fcad0af139 100644 (file)
@@ -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);
index 4a1ee13f0db1c6565aafb768067cdbadbeeead8c..93607e5a1b686de5e13828badd7c176d3c42c92e 100644 (file)
@@ -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);
index d6eab24e62a020b258bd09dc4b2819ccec49bdb4..b825aecdae2e427387721e643416aed25a601d88 100644 (file)
@@ -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,
index 32beafd0bb4f0ae39d3b8f3c51935a06f02ee21d..aafb1757322ed94a41957140822aa7605077b3a5 100644 (file)
@@ -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));