From 5d2c2c84f2757bcf622e93d58393d379028f13d1 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Mon, 22 Apr 2024 16:10:12 -0400 Subject: [PATCH] gdb: move `enum compile_i_scope_types` to compile/compile.h Move it out of defs.h, adjust the includes here and there. Change-Id: I11901fdce55d54f5e51723e123cef154cfb1bbc5 Approved-By: John Baldwin --- gdb/cli/cli-script.h | 1 + gdb/compile/compile-object-load.h | 1 + gdb/compile/compile.h | 28 ++++++++++++++++++++++++++++ gdb/defs.h | 28 ---------------------------- 4 files changed, 30 insertions(+), 28 deletions(-) diff --git a/gdb/cli/cli-script.h b/gdb/cli/cli-script.h index d36743e5a31..512e37b8bf3 100644 --- a/gdb/cli/cli-script.h +++ b/gdb/cli/cli-script.h @@ -17,6 +17,7 @@ #ifndef CLI_CLI_SCRIPT_H #define CLI_CLI_SCRIPT_H +#include "compile/compile.h" #include "gdbsupport/function-view.h" struct ui_file; diff --git a/gdb/compile/compile-object-load.h b/gdb/compile/compile-object-load.h index eb6eb0dd871..83665b5c4c4 100644 --- a/gdb/compile/compile-object-load.h +++ b/gdb/compile/compile-object-load.h @@ -18,6 +18,7 @@ #define COMPILE_COMPILE_OBJECT_LOAD_H #include "compile-internal.h" +#include "compile.h" #include struct munmap_list diff --git a/gdb/compile/compile.h b/gdb/compile/compile.h index d584df6661c..4be6f50d4f3 100644 --- a/gdb/compile/compile.h +++ b/gdb/compile/compile.h @@ -19,6 +19,7 @@ #define COMPILE_COMPILE_H #include "gcc-c-interface.h" +#include "gdbsupport/gdb-hashtab.h" struct ui_file; struct gdbarch; @@ -27,6 +28,33 @@ struct dwarf2_per_objfile; struct symbol; struct dynamic_prop; +/* Scope types enumerator. List the types of scopes the compiler will + accept. */ + +enum compile_i_scope_types + { + COMPILE_I_INVALID_SCOPE, + + /* A simple scope. Wrap an expression into a simple scope that + takes no arguments, returns no value, and uses the generic + function name "_gdb_expr". */ + + COMPILE_I_SIMPLE_SCOPE, + + /* Do not wrap the expression, + it has to provide function "_gdb_expr" on its own. */ + COMPILE_I_RAW_SCOPE, + + /* A printable expression scope. Wrap an expression into a scope + suitable for the "compile print" command. It uses the generic + function name "_gdb_expr". COMPILE_I_PRINT_ADDRESS_SCOPE variant + is the usual one, taking address of the object. + COMPILE_I_PRINT_VALUE_SCOPE is needed for arrays where the array + name already specifies its address. See get_out_value_type. */ + COMPILE_I_PRINT_ADDRESS_SCOPE, + COMPILE_I_PRINT_VALUE_SCOPE, + }; + /* An object of this type holds state associated with a given compilation job. */ diff --git a/gdb/defs.h b/gdb/defs.h index ce8f29b2cf6..057581d2764 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -63,34 +63,6 @@ #include "gdbsupport/enum-flags.h" #include "gdbsupport/array-view.h" -/* Scope types enumerator. List the types of scopes the compiler will - accept. */ - -enum compile_i_scope_types - { - COMPILE_I_INVALID_SCOPE, - - /* A simple scope. Wrap an expression into a simple scope that - takes no arguments, returns no value, and uses the generic - function name "_gdb_expr". */ - - COMPILE_I_SIMPLE_SCOPE, - - /* Do not wrap the expression, - it has to provide function "_gdb_expr" on its own. */ - COMPILE_I_RAW_SCOPE, - - /* A printable expression scope. Wrap an expression into a scope - suitable for the "compile print" command. It uses the generic - function name "_gdb_expr". COMPILE_I_PRINT_ADDRESS_SCOPE variant - is the usual one, taking address of the object. - COMPILE_I_PRINT_VALUE_SCOPE is needed for arrays where the array - name already specifies its address. See get_out_value_type. */ - COMPILE_I_PRINT_ADDRESS_SCOPE, - COMPILE_I_PRINT_VALUE_SCOPE, - }; - - template using RequireLongest = gdb::Requires, std::is_same>>;