diff mbox series

[v2,19/23] exec/user: Do not include 'cpu.h' in 'abitypes.h'

Message ID 20231212123401.37493-20-philmd@linaro.org
State Superseded
Headers show
Series exec: Rework of various headers (user focused) | expand

Commit Message

Philippe Mathieu-Daudé Dec. 12, 2023, 12:33 p.m. UTC
"exec/user/abitypes.h" requires:

 - "exec/cpu-defs.h"           (TARGET_LONG_BITS)
 - "exec/tswap.h"              (tswap32)

In order to avoid "cpu.h", pick the minimum required headers.

Assert this user-specific header is only included from user
emulation.

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 include/exec/user/abitypes.h | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Thomas Huth Dec. 14, 2023, 6:30 p.m. UTC | #1
On 12/12/2023 13.33, Philippe Mathieu-Daudé wrote:
> "exec/user/abitypes.h" requires:
> 
>   - "exec/cpu-defs.h"           (TARGET_LONG_BITS)
>   - "exec/tswap.h"              (tswap32)
> 
> In order to avoid "cpu.h", pick the minimum required headers.
> 
> Assert this user-specific header is only included from user
> emulation.
> 
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
> ---
>   include/exec/user/abitypes.h | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)

Reviewed-by: Thomas Huth <thuth@redhat.com>
diff mbox series

Patch

diff --git a/include/exec/user/abitypes.h b/include/exec/user/abitypes.h
index ed10d5fe7e..fbb55684d3 100644
--- a/include/exec/user/abitypes.h
+++ b/include/exec/user/abitypes.h
@@ -1,7 +1,12 @@ 
 #ifndef EXEC_USER_ABITYPES_H
 #define EXEC_USER_ABITYPES_H
 
-#include "cpu.h"
+#ifndef CONFIG_USER_ONLY
+#error Cannot include this header from system emulation
+#endif
+
+#include "exec/cpu-defs.h"
+#include "exec/tswap.h"
 #include "exec/user/tswap-target.h"
 
 #ifdef TARGET_ABI32