gdb/command.h: Include common/scoped_restore.h
authorPedro Alves <palves@redhat.com>
Wed, 28 Jun 2017 14:19:02 +0000 (15:19 +0100)
committerPedro Alves <palves@redhat.com>
Wed, 28 Jun 2017 14:19:02 +0000 (15:19 +0100)
command.h depends on scoped_restore:

  extern scoped_restore_tmpl<int> prevent_dont_repeat (void);

But doesn't include the corresponding header
("common/scoped_restore.h").  We haven't noticed a problem because
utils.h includes scoped_restore.h, and defs.h includes utils.h.

However, a patch that makes "symtab.h" include "completer.h", exposed
the issue:
 https://sourceware.org/ml/gdb-patches/2017-06/msg00023.html.

Without this fix that 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 defs.h includes gdbarch.h before it includes utils.h.

gdb/ChangeLog:
2017-06-28  Pedro Alves  <palves@redhat.com>

* command.h: Include "common/scoped_restore.h".

gdb/ChangeLog
gdb/command.h

index d110c34f2d200408c1061b39f1ac559b9a8ca423..a82026f95e65f51d9ffae4d0f9b255df871c1d00 100644 (file)
@@ -1,3 +1,7 @@
+2017-06-28  Pedro Alves  <palves@redhat.com>
+
+       * command.h: Include "common/scoped_restore.h".
+
 2017-06-28  Yao Qi  <yao.qi@linaro.org>
 
        * mi/mi-cmd-break.c (mi_argv_to_format): Use obstack_grow_str
index aa179e91264538e293ffcfcec467ab7388d3fd1c..4a56a5173f51c5a38f11bf62c4aea5d6a2d7278d 100644 (file)
@@ -19,6 +19,7 @@
 #define COMMAND_H 1
 
 #include "gdb_vecs.h"
+#include "common/scoped_restore.h"
 
 /* This file defines the public interface for any code wanting to
    create commands.  */