Re: [PATCH 05/40] command.h: Include scoped_restore_command.h

Pedro Alves
2017-06-27T12:03:02Z

On 06/27/2017 12:52 PM, Pedro Alves wrote:

> I don't remember exactly where I added the #include "command.h" that
> triggered this. Must have been somewhere that caused "command.h" to
> be included via "defs.h", before the "#include utils.h" line.
>
> Let me try removing it from the series, see if I can still reproduce it.

Found it. Patch #11 (https://sourceware.org/ml/gdb-patches/2017-06/msg00023.html)
later does:

diff --git c/gdb/symtab.h w/gdb/symtab.h
index 5901cf9..fb08479 100644
--- c/gdb/symtab.h
+++ w/gdb/symtab.h
@@ -25,6 +25,7 @@
#include "gdbtypes.h"
#include "common/enum-flags.h"
#include "common/function-view.h"
+#include "completer.h"

which without this fix would break building all .o files like this:

In file included from src/gdb/completer.h:21:0,
from src/gdb/symtab.h:28,
from src/gdb/language.h:26,
from src/gdb/frame.h:72,
from src/gdb/gdbarch.h:39,
from src/gdb/defs.h:636,
from src/gdb/top.c:20:
src/gdb/command.h:434:8: error: ‘scoped_restore_tmpl’ does not name a type
extern scoped_restore_tmpl<int> prevent_dont_repeat (void);
^
Makefile:1911: recipe for target 'top.o' failed

because completer.h includes command.h, and that include chain
happens before utils.h is included at the end of defs.h.
I think it'd be good if defs.h didn't pull in so much,
but I think that's orthogonal, and the current fix stands on
its own.

I should have included this info in the original submission.
Sorry about that.

Thanks,
Pedro Alves