gdb: small cleanup in breakpoint.c's includes

Message ID 20190922014012.580651-1-simon.marchi@polymtl.ca
State New, archived
Headers

Commit Message

Simon Marchi Sept. 22, 2019, 1:40 a.m. UTC
  In an attempt to reduce the number of files re-build when some headers
are touched, I ran include-what-you-use with breakpoint.c as a guinea
pig.  It revealed a few files that were unnecessary to include, which
this patch removes.

breakpoint.c uses tilde_expand from readline, hence the necessity to
include tilde.h.  AFAIK, it's fine to include just that, and not the
whole readline headers.

include-what-you-use also reported many header files that should be
included but aren't, I suppose that breakpoint.c currently includes them
indirectly.  For now I'll pretend I didn't see that :).

gdb/ChangeLog:

	* breakpoint.c: Remove some includes: continuations.h, skip.h,
	mi/mi-main.h, readline/readline.h, readline/history.h.  Add
	include: readline/tilde.h.

-#include "skip.h"
 #include "ax-gdb.h"
 #include "dummy-frame.h"
 #include "interps.h"
@@ -69,11 +67,9 @@
 #include "thread-fsm.h"
 #include "tid-parse.h"
 #include "cli/cli-style.h"
-#include "mi/mi-main.h"

 /* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include "readline/tilde.h"

 /* readline defines this.  */
 #undef savestring
---
 gdb/breakpoint.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
  

Comments

Simon Marchi Oct. 13, 2019, 3:47 a.m. UTC | #1
On 2019-09-21 9:40 p.m., Simon Marchi wrote:
> In an attempt to reduce the number of files re-build when some headers
> are touched, I ran include-what-you-use with breakpoint.c as a guinea
> pig.  It revealed a few files that were unnecessary to include, which
> this patch removes.
> 
> breakpoint.c uses tilde_expand from readline, hence the necessity to
> include tilde.h.  AFAIK, it's fine to include just that, and not the
> whole readline headers.
> 
> include-what-you-use also reported many header files that should be
> included but aren't, I suppose that breakpoint.c currently includes them
> indirectly.  For now I'll pretend I didn't see that :).
> 
> gdb/ChangeLog:
> 
> 	* breakpoint.c: Remove some includes: continuations.h, skip.h,
> 	mi/mi-main.h, readline/readline.h, readline/history.h.  Add
> 	include: readline/tilde.h.

I pushed this.

Simon
  

Patch

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 838c9d136fd1..3813f28672be 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -59,9 +59,7 @@ 
 #include "gdb_regex.h"
 #include "probe.h"
 #include "cli/cli-utils.h"
-#include "continuations.h"
 #include "stack.h"
-#include "skip.h"
 #include "ax-gdb.h"
 #include "dummy-frame.h"
 #include "interps.h"
@@ -69,11 +67,9 @@ 
 #include "thread-fsm.h"
 #include "tid-parse.h"
 #include "cli/cli-style.h"
-#include "mi/mi-main.h"
 
 /* readline include files */
-#include "readline/readline.h"
-#include "readline/history.h"
+#include "readline/tilde.h"
 
 /* readline defines this.  */
 #undef savestring