[PUSHED/OBVIOUS] Make extern declaration of dwarf_always_disassemble correct

Message ID 20190918045623.207809-1-cbiesinger@google.com
State New, archived
Headers

Commit Message

Terekhov, Mikhail via Gdb-patches Sept. 18, 2019, 4:56 a.m. UTC
  This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058;
dwarf2loc.c has an extern definition for dwarf_always_disassemble
that I missed. This patch updates it from int to bool to match
the definition in dwarf2read.c.

gdb/ChangeLog:

2019-09-18  Christian Biesinger  <cbiesinger@google.com>

	* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
	to bool to match definition in dwarf2read.c.
---
 gdb/ChangeLog   | 5 +++++
 gdb/dwarf2loc.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Simon Marchi Sept. 18, 2019, 11:17 a.m. UTC | #1
On 2019-09-18 12:56 a.m., Christian Biesinger via gdb-patches wrote:
> This was an oversight in 491144b5e21bbfd41969c175aebb663976f59058;
> dwarf2loc.c has an extern definition for dwarf_always_disassemble
> that I missed. This patch updates it from int to bool to match
> the definition in dwarf2read.c.

Hi Christian,

I think we should take that opportunity to fix the problem in a way
that would have prevented this mistake and make things cleaner.

Can you try to move the declaration of dwarf_always_disassemble to dwarf2read.h,
remove the declaration from dwarf2loc.c, and make dwarf2loc.c include dwarf2read.h?
I think it's just for historical reasons that this variable has a local declaration
in dwarf2loc.c (dwarf2read.h exists since not so long ago), but as we saw it's a
bit dangerous to do it this way.

Simon
  

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8cb5bfeeb98..39fcac7a04e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@ 
+2019-09-18  Christian Biesinger  <cbiesinger@google.com>
+
+	* dwarf2loc.c: Change extern declaration of dwarf_always_disassemble
+	to bool to match definition in dwarf2read.c.
+
 2019-09-17  Christian Biesinger  <cbiesinger@google.com>
 
 	* ada-lang.c (ada_ignore_descriptive_types_p): Change to bool.
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
index 63643cb45d5..29fccae5944 100644
--- a/gdb/dwarf2loc.c
+++ b/gdb/dwarf2loc.c
@@ -46,7 +46,7 @@ 
 #include "gdbsupport/underlying.h"
 #include "gdbsupport/byte-vector.h"
 
-extern int dwarf_always_disassemble;
+extern bool dwarf_always_disassemble;
 
 static struct value *dwarf2_evaluate_loc_desc_full (struct type *type,
 						    struct frame_info *frame,