[review] Remove unused includes in ada-*.c files

Message ID gerrit.1572185406000.I07c2f2237ef0ed5fd9aa855d33711d780794fce2@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Oct. 27, 2019, 2:10 p.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323
......................................................................

Remove unused includes in ada-*.c files

include-what-you-use reports:

../../../src/binutils-gdb/gdb/ada-lang.c should remove these lines:
- #include <sys/stat.h>  // lines 43-43
- #include <map>  // lines 66-66
- #include "c-lang.h"  // lines 33-33
- #include "demangle.h"  // lines 23-23
- #include "dictionary.h"  // lines 47-47
- #include "gdbsupport/gdb_vecs.h"  // lines 53-53
- #include "psymtab.h"  // lines 58-58

../../../src/binutils-gdb/gdb/ada-lang.c should remove these lines:
- #include <sys/stat.h>  // lines 43-43
- #include <map>  // lines 66-66
- #include "c-lang.h"  // lines 33-33
- #include "demangle.h"  // lines 23-23
- #include "dictionary.h"  // lines 47-47
- #include "gdbsupport/gdb_vecs.h"  // lines 53-53
- #include "psymtab.h"  // lines 58-58

../../../src/binutils-gdb/gdb/ada-valprint.c should remove these lines:
- #include "c-lang.h"  // lines 31-31
- #include "demangle.h"  // lines 26-26
- #include "infcall.h"  // lines 32-32
- #include "objfiles.h"  // lines 33-33
- #include "symtab.h"  // lines 22-22

Remove these includes.  Adding an include for gdbarch.h in
ada-valprint.c was necessary, because gdbarch_byte_order wouldn't be
found anymore.

gdb/ChangeLog:

	* ada-lang.c: Remove includes.
	* ada-typeprint.c: Remove includes.
	* ada-valprint.c: Remove includes.

Change-Id: I07c2f2237ef0ed5fd9aa855d33711d780794fce2
---
M gdb/ada-lang.c
M gdb/ada-typeprint.c
M gdb/ada-valprint.c
3 files changed, 1 insertion(+), 21 deletions(-)
  

Comments

Simon Marchi (Code Review) Oct. 27, 2019, 3:31 p.m. UTC | #1
Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323
......................................................................


Patch Set 1:

(2 comments)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323/1/gdb/ada-valprint.c 
File gdb/ada-valprint.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323/1/gdb/ada-valprint.c@57 
PS1, Line 57: print_optional_low_bound (struct ui_file *stream, struct type *type,
This is a test comment.


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323/1/gdb/ada-valprint.c@98 
PS1, Line 98: 	return 0;
This is another test comment.
  
Simon Marchi (Code Review) Oct. 27, 2019, 3:42 p.m. UTC | #2
Simon Marchi has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323
......................................................................


Patch Set 1:

(2 comments)

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323/1/gdb/ada-valprint.c 
File gdb/ada-valprint.c:

https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323/1/gdb/ada-valprint.c@59 
PS1, Line 59: 
50 | 
51 | /* Assuming TYPE is a simple array type, prints its lower bound on STREAM,
52 |    if non-standard (i.e., other than 1 for numbers, other than lower bound
53 |    of index type for enumerated type).  Returns 1 if something printed,
54 |    otherwise 0.  */
55 | 
56 | static int
57 | print_optional_low_bound (struct ui_file *stream, struct type *type,
58 | 			  const struct value_print_options *options)
59 | {

This is a test comment (2).


https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323/1/gdb/ada-valprint.c@100 
PS1, Line 100: 
 57 | print_optional_low_bound (struct ui_file *stream, struct type *type,
    | ...
 91 |     case TYPE_CODE_BOOL:
 92 |     case TYPE_CODE_CHAR:
 93 |       if (low_bound == 0)
 94 | 	return 0;
 95 |       break;
 96 |     case TYPE_CODE_ENUM:
 97 |       if (low_bound == TYPE_FIELD_ENUMVAL (index_type, 0))
 98 | 	return 0;
 99 |       break;
100 |     case TYPE_CODE_UNDEF:

This is another test comment (2).
  
Simon Marchi (Code Review) Oct. 28, 2019, 12:58 p.m. UTC | #3
Tom Tromey has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/323
......................................................................


Patch Set 1: Code-Review+2

Thanks, this looks good to me.
  

Patch

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 5b54971..d08a264 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -20,7 +20,6 @@ 
 
 #include "defs.h"
 #include <ctype.h>
-#include "demangle.h"
 #include "gdb_regex.h"
 #include "frame.h"
 #include "symtab.h"
@@ -30,7 +29,6 @@ 
 #include "parser-defs.h"
 #include "language.h"
 #include "varobj.h"
-#include "c-lang.h"
 #include "inferior.h"
 #include "symfile.h"
 #include "objfiles.h"
@@ -40,22 +38,18 @@ 
 #include "gdb_obstack.h"
 #include "ada-lang.h"
 #include "completer.h"
-#include <sys/stat.h>
 #include "ui-out.h"
 #include "block.h"
 #include "infcall.h"
-#include "dictionary.h"
 #include "annotate.h"
 #include "valprint.h"
 #include "source.h"
 #include "observable.h"
 #include "stack.h"
-#include "gdbsupport/gdb_vecs.h"
 #include "typeprint.h"
 #include "namespace.h"
 #include "cli/cli-style.h"
 
-#include "psymtab.h"
 #include "value.h"
 #include "mi/mi-common.h"
 #include "arch-utils.h"
@@ -63,7 +57,6 @@ 
 #include "gdbsupport/function-view.h"
 #include "gdbsupport/byte-vector.h"
 #include <algorithm>
-#include <map>
 
 /* Define whether or not the C operator '/' truncates towards zero for
    differently signed operands (truncation direction is undefined in C).
diff --git a/gdb/ada-typeprint.c b/gdb/ada-typeprint.c
index c246166..be37925 100644
--- a/gdb/ada-typeprint.c
+++ b/gdb/ada-typeprint.c
@@ -17,18 +17,9 @@ 
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include "defs.h"
-#include "gdb_obstack.h"
 #include "bfd.h"		/* Binary File Description */
-#include "symtab.h"
 #include "gdbtypes.h"
-#include "expression.h"
 #include "value.h"
-#include "gdbcore.h"
-#include "target.h"
-#include "command.h"
-#include "gdbcmd.h"
-#include "language.h"
-#include "demangle.h"
 #include "c-lang.h"
 #include "cli/cli-style.h"
 #include "typeprint.h"
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 714b625..5ab0365 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -19,20 +19,16 @@ 
 
 #include "defs.h"
 #include <ctype.h>
-#include "symtab.h"
 #include "gdbtypes.h"
 #include "expression.h"
 #include "value.h"
-#include "demangle.h"
 #include "valprint.h"
 #include "language.h"
 #include "annotate.h"
 #include "ada-lang.h"
-#include "c-lang.h"
-#include "infcall.h"
-#include "objfiles.h"
 #include "target-float.h"
 #include "cli/cli-style.h"
+#include "gdbarch.h"
 
 static int print_field_values (struct type *, const gdb_byte *,
 			       int,