diff options
author | Pedro Alves <palves@redhat.com> | 2016-09-16 19:55:17 +0100 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2016-09-16 19:55:17 +0100 |
commit | 325fac504a327de9c46a4e5cf9c88ece9d9d7701 (patch) | |
tree | 70abe40fe0c2332f96acbc01cd4e2c841593f0bd /gdb/hppa-tdep.c | |
parent | 8193adea2f86e37423a5d0acffb69b80bde05d52 (diff) | |
download | gdb-325fac504a327de9c46a4e5cf9c88ece9d9d7701.zip gdb-325fac504a327de9c46a4e5cf9c88ece9d9d7701.tar.gz gdb-325fac504a327de9c46a4e5cf9c88ece9d9d7701.tar.bz2 |
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.
Diffstat (limited to 'gdb/hppa-tdep.c')
-rw-r--r-- | gdb/hppa-tdep.c | 25 |
1 files changed, 13 insertions, 12 deletions
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)); } |