[C++] Fix -Winvalid-offsetof warnings with g++ 4.4
Ref: https://sourceware.org/ml/gdb/2015-12/msg00014.html
Fixes the build in C++ mode with g++ 4.4:
gdb/btrace.h: In function ‘size_t VEC_btrace_insn_s_embedded_size(int)’:
gdb/btrace.h:84: error: invalid access to non-static data member ‘VEC_btrace_insn_s::vec’ of NULL object
gdb/btrace.h:84: error: (perhaps the ‘offsetof’ macro was used incorrectly)
gdb/btrace.h: In function ‘VEC_btrace_insn_s* VEC_btrace_insn_s_alloc(int)’:
gdb/btrace.h:84: error: invalid access to non-static data member ‘VEC_btrace_insn_s::vec’ of NULL object
gdb/btrace.h:84: error: (perhaps the ‘offsetof’ macro was used incorrectly)
gdb/btrace.h: In function ‘VEC_btrace_insn_s* VEC_btrace_insn_s_copy(VEC_btrace_insn_s*)’:
gdb/btrace.h:84: error: invalid access to non-static data member ‘VEC_btrace_insn_s::vec’ of NULL object
gdb/btrace.h:84: error: (perhaps the ‘offsetof’ macro was used incorrectly)
gdb/btrace.h: In function ‘VEC_btrace_insn_s* VEC_btrace_insn_s_merge(VEC_btrace_insn_s*, VEC_btrace_insn_s*)’:
gdb/btrace.h:84: error: invalid access to non-static data member ‘VEC_btrace_insn_s::vec’ of NULL object
gdb/btrace.h:84: error: (perhaps the ‘offsetof’ macro was used incorrectly)
gdb/btrace.h: In function ‘int VEC_btrace_insn_s_reserve(VEC_btrace_insn_s**, int, const char*, unsigned int)’:
gdb/btrace.h:84: error: invalid access to non-static data member ‘VEC_btrace_insn_s::vec’ of NULL object
gdb/btrace.h:84: error: (perhaps the ‘offsetof’ macro was used incorrectly)
gdb/ChangeLog:
2015-12-16 Pedro Alves <palves@redhat.com>
* common/vec.h (vec_offset): New macro.
(DEF_VEC_ALLOC_FUNC_I, DEF_VEC_ALLOC_FUNC_O): Use it instead of
offsetof.