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)
commit325fac504a327de9c46a4e5cf9c88ece9d9d7701
tree70abe40fe0c2332f96acbc01cd4e2c841593f0bd
parent8193adea2f86e37423a5d0acffb69b80bde05d52
gdb: Use std::min and std::max throughout

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