diff options
author | Pedro Alves <pedro@palves.net> | 2022-06-17 11:10:40 +0100 |
---|---|---|
committer | Pedro Alves <pedro@palves.net> | 2022-06-17 11:39:57 +0100 |
commit | dfea48fc0f040e87c5d7d4fc34c0610dc0039ad1 (patch) | |
tree | 28800394fccffea283142330be810f4edaae8535 /gdb/location.h | |
parent | dac9773e17261f905d51684fe35da036e82c69cd (diff) | |
download | fsf-binutils-gdb-dfea48fc0f040e87c5d7d4fc34c0610dc0039ad1.zip fsf-binutils-gdb-dfea48fc0f040e87c5d7d4fc34c0610dc0039ad1.tar.gz fsf-binutils-gdb-dfea48fc0f040e87c5d7d4fc34c0610dc0039ad1.tar.bz2 |
Fix GDB build with GCC 4.8 & 4.9
With gcc 4.8/4.9, we run into this build failure (and other similar
ones):
/home/palves/gdb/binutils-gdb/src/gdb/location.h:224:59: error: could not convert ‘{0, LINE_OFFSET_UNKNOWN}’ from ‘<brace-enclosed initializer list>’ to ‘line_offset’
struct line_offset line_offset = {0, LINE_OFFSET_UNKNOWN};
^
The issue is that at around the GCC 4.8/4.9 era, a default member
initializer prevented the struct from being an aggregate, so you
cannot use aggregate initialization on them. That rule changed after
GCC 4.9 and GCC 5 & later uses new rules.
Fix this by not using aggregate initialization for struct line_offset.
The default member initization already leaves line_offset as {0,
LINE_OFFSET_UNKNOWN}, so initialization to those values can just go
away. The remaining cases are of the form {0, LINE_OFFSET_NONE}, and
those cases can be better rewritten to delay setting the sign field
until we know we have a valid offset.
Change-Id: I0506ea4a83c5fa2f15e159569db68b3b0a7509b4
Diffstat (limited to 'gdb/location.h')
-rw-r--r-- | gdb/location.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/gdb/location.h b/gdb/location.h index fd0b320..f9d0f95 100644 --- a/gdb/location.h +++ b/gdb/location.h @@ -221,7 +221,7 @@ struct explicit_location_spec : public location_spec /* A line offset relative to the start of the symbol identified by the above fields or the current symtab if the other fields are NULL. */ - struct line_offset line_offset = {0, LINE_OFFSET_UNKNOWN}; + struct line_offset line_offset; protected: explicit_location_spec (const explicit_location_spec &other); |