diff mbox series

[PATCH-for-6.1] exec: Remove accel/tcg/ from include paths

Message ID 20210413081008.3409459-1-f4bug@amsat.org
State New
Headers show
Series [PATCH-for-6.1] exec: Remove accel/tcg/ from include paths | expand

Commit Message

Philippe Mathieu-Daudé April 13, 2021, 8:10 a.m. UTC
When TCG is enabled, the accel/tcg/ include path is added to the
project global include search list. This accel/tcg/ directory
contains a header named "internal.h" which, while intented to
be internal to accel/tcg/, is accessible by all files compiled
when TCG is enabled. This might lead to problem with other
directories using the same "internal.h" header name:

  $ git ls-files | fgrep /internal.h
  accel/tcg/internal.h
  include/hw/ide/internal.h
  target/hexagon/internal.h
  target/mips/internal.h
  target/ppc/internal.h
  target/s390x/internal.h

As we don't need to expose accel/tcg/ internals to the rest of
the code base, simplify by removing it from the include search
list, and include the accel/tcg/ public headers relative to the
project root search path (which is already in the generic include
search path).

Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
Arguably public accel/tcg/ headers should be exposed under include/.
---
 meson.build                 | 1 -
 include/exec/helper-gen.h   | 4 ++--
 include/exec/helper-proto.h | 4 ++--
 include/exec/helper-tcg.h   | 4 ++--
 4 files changed, 6 insertions(+), 7 deletions(-)

Comments

Claudio Fontana April 13, 2021, 8:17 a.m. UTC | #1
Reviewed-by: Claudio Fontana <cfontana@suse.de>

Ciao,

Claudio

On 4/13/21 10:10 AM, Philippe Mathieu-Daudé wrote:
> When TCG is enabled, the accel/tcg/ include path is added to the
> project global include search list. This accel/tcg/ directory
> contains a header named "internal.h" which, while intented to
> be internal to accel/tcg/, is accessible by all files compiled
> when TCG is enabled. This might lead to problem with other
> directories using the same "internal.h" header name:
> 
>   $ git ls-files | fgrep /internal.h
>   accel/tcg/internal.h
>   include/hw/ide/internal.h
>   target/hexagon/internal.h
>   target/mips/internal.h
>   target/ppc/internal.h
>   target/s390x/internal.h
> 
> As we don't need to expose accel/tcg/ internals to the rest of
> the code base, simplify by removing it from the include search
> list, and include the accel/tcg/ public headers relative to the
> project root search path (which is already in the generic include
> search path).
> 
> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> Arguably public accel/tcg/ headers should be exposed under include/.
> ---
>  meson.build                 | 1 -
>  include/exec/helper-gen.h   | 4 ++--
>  include/exec/helper-proto.h | 4 ++--
>  include/exec/helper-tcg.h   | 4 ++--
>  4 files changed, 6 insertions(+), 7 deletions(-)
> 
> diff --git a/meson.build b/meson.build
> index c6f4b0cf5e8..d8bb1ec5aa9 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -258,7 +258,6 @@
>      tcg_arch = 'riscv'
>    endif
>    add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
> -                        '-iquote', meson.current_source_dir() / 'accel/tcg',
>                          language: ['c', 'cpp', 'objc'])
>  
>    accelerators += 'CONFIG_TCG'
> diff --git a/include/exec/helper-gen.h b/include/exec/helper-gen.h
> index 29c02f85dcc..1c2e7a8ed39 100644
> --- a/include/exec/helper-gen.h
> +++ b/include/exec/helper-gen.h
> @@ -81,8 +81,8 @@ static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
>  #include "helper.h"
>  #include "trace/generated-helpers.h"
>  #include "trace/generated-helpers-wrappers.h"
> -#include "tcg-runtime.h"
> -#include "plugin-helpers.h"
> +#include "accel/tcg/tcg-runtime.h"
> +#include "accel/tcg/plugin-helpers.h"
>  
>  #undef DEF_HELPER_FLAGS_0
>  #undef DEF_HELPER_FLAGS_1
> diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h
> index 659f9298e8f..ba100793a7d 100644
> --- a/include/exec/helper-proto.h
> +++ b/include/exec/helper-proto.h
> @@ -39,8 +39,8 @@ dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
>  
>  #include "helper.h"
>  #include "trace/generated-helpers.h"
> -#include "tcg-runtime.h"
> -#include "plugin-helpers.h"
> +#include "accel/tcg/tcg-runtime.h"
> +#include "accel/tcg/plugin-helpers.h"
>  
>  #undef IN_HELPER_PROTO
>  
> diff --git a/include/exec/helper-tcg.h b/include/exec/helper-tcg.h
> index 27870509a20..68885146355 100644
> --- a/include/exec/helper-tcg.h
> +++ b/include/exec/helper-tcg.h
> @@ -60,8 +60,8 @@
>  
>  #include "helper.h"
>  #include "trace/generated-helpers.h"
> -#include "tcg-runtime.h"
> -#include "plugin-helpers.h"
> +#include "accel/tcg/tcg-runtime.h"
> +#include "accel/tcg/plugin-helpers.h"
>  
>  #undef str
>  #undef DEF_HELPER_FLAGS_0
>
Richard Henderson April 13, 2021, 2:20 p.m. UTC | #2
On 4/13/21 1:10 AM, Philippe Mathieu-Daudé wrote:
> When TCG is enabled, the accel/tcg/ include path is added to the
> project global include search list. This accel/tcg/ directory
> contains a header named "internal.h" which, while intented to
> be internal to accel/tcg/, is accessible by all files compiled
> when TCG is enabled. This might lead to problem with other
> directories using the same "internal.h" header name:
> 
>    $ git ls-files | fgrep /internal.h
>    accel/tcg/internal.h
>    include/hw/ide/internal.h
>    target/hexagon/internal.h
>    target/mips/internal.h
>    target/ppc/internal.h
>    target/s390x/internal.h
> 
> As we don't need to expose accel/tcg/ internals to the rest of
> the code base, simplify by removing it from the include search
> list, and include the accel/tcg/ public headers relative to the
> project root search path (which is already in the generic include
> search path).
> 
> Signed-off-by: Philippe Mathieu-Daudé<f4bug@amsat.org>
> ---

Queued on tcg-next, thanks.


r~
diff mbox series

Patch

diff --git a/meson.build b/meson.build
index c6f4b0cf5e8..d8bb1ec5aa9 100644
--- a/meson.build
+++ b/meson.build
@@ -258,7 +258,6 @@ 
     tcg_arch = 'riscv'
   endif
   add_project_arguments('-iquote', meson.current_source_dir() / 'tcg' / tcg_arch,
-                        '-iquote', meson.current_source_dir() / 'accel/tcg',
                         language: ['c', 'cpp', 'objc'])
 
   accelerators += 'CONFIG_TCG'
diff --git a/include/exec/helper-gen.h b/include/exec/helper-gen.h
index 29c02f85dcc..1c2e7a8ed39 100644
--- a/include/exec/helper-gen.h
+++ b/include/exec/helper-gen.h
@@ -81,8 +81,8 @@  static inline void glue(gen_helper_, name)(dh_retvar_decl(ret)          \
 #include "helper.h"
 #include "trace/generated-helpers.h"
 #include "trace/generated-helpers-wrappers.h"
-#include "tcg-runtime.h"
-#include "plugin-helpers.h"
+#include "accel/tcg/tcg-runtime.h"
+#include "accel/tcg/plugin-helpers.h"
 
 #undef DEF_HELPER_FLAGS_0
 #undef DEF_HELPER_FLAGS_1
diff --git a/include/exec/helper-proto.h b/include/exec/helper-proto.h
index 659f9298e8f..ba100793a7d 100644
--- a/include/exec/helper-proto.h
+++ b/include/exec/helper-proto.h
@@ -39,8 +39,8 @@  dh_ctype(ret) HELPER(name) (dh_ctype(t1), dh_ctype(t2), dh_ctype(t3), \
 
 #include "helper.h"
 #include "trace/generated-helpers.h"
-#include "tcg-runtime.h"
-#include "plugin-helpers.h"
+#include "accel/tcg/tcg-runtime.h"
+#include "accel/tcg/plugin-helpers.h"
 
 #undef IN_HELPER_PROTO
 
diff --git a/include/exec/helper-tcg.h b/include/exec/helper-tcg.h
index 27870509a20..68885146355 100644
--- a/include/exec/helper-tcg.h
+++ b/include/exec/helper-tcg.h
@@ -60,8 +60,8 @@ 
 
 #include "helper.h"
 #include "trace/generated-helpers.h"
-#include "tcg-runtime.h"
-#include "plugin-helpers.h"
+#include "accel/tcg/tcg-runtime.h"
+#include "accel/tcg/plugin-helpers.h"
 
 #undef str
 #undef DEF_HELPER_FLAGS_0