All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Alex Bennée" <alex.bennee@linaro.org>
To: qemu-devel@nongnu.org
Cc: Alistair Francis <alistair.francis@wdc.com>
Subject: Re: [Qemu-devel] [PATCH v2 01/29] include: Make headers more self-contained
Date: Wed, 07 Aug 2019 16:03:05 +0100	[thread overview]
Message-ID: <87k1bphvbq.fsf@linaro.org> (raw)
In-Reply-To: <20190806151435.10740-2-armbru@redhat.com>


Markus Armbruster <armbru@redhat.com> writes:

> Back in 2016, we discussed[1] rules for headers, and these were
> generally liked:
>
> 1. Have a carefully curated header that's included everywhere first.  We
>    got that already thanks to Peter: osdep.h.
>
> 2. Headers should normally include everything they need beyond osdep.h.
>    If exceptions are needed for some reason, they must be documented in
>    the header.  If all that's needed from a header is typedefs, put
>    those into qemu/typedefs.h instead of including the header.
>
> 3. Cyclic inclusion is forbidden.
>
> This patch gets include/ closer to obeying 2.
>
> It's actually extracted from my "[RFC] Baby steps towards saner
> headers" series[2], which demonstrates a possible path towards
> checking 2 automatically.  It passes the RFC test there.
>
> [1] Message-ID: <87h9g8j57d.fsf@blackfin.pond.sub.org>
>     https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg03345.html
> [2] Message-Id: <20190711122827.18970-1-armbru@redhat.com>
>     https://lists.nongnu.org/archive/html/qemu-devel/2019-07/msg02715.html
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> ---
<snip>
>  include/exec/cputlb.h                 | 2 ++
>  include/exec/exec-all.h               | 1 +
>  include/exec/ioport.h                 | 2 ++
>  include/exec/memory-internal.h        | 2 ++
>  include/exec/ram_addr.h               | 1 +
>  include/exec/softmmu-semi.h           | 2 ++
>  include/exec/tb-hash.h                | 2 ++
>  include/exec/user/thunk.h             | 1 +
>  include/fpu/softfloat-macros.h        | 2 ++
<snip>
>
>  /*
>   * bdrv_write_threshold_set:
> diff --git a/include/disas/disas.h b/include/disas/disas.h
> index 15da511f49..ba47e9197c 100644
> --- a/include/disas/disas.h
> +++ b/include/disas/disas.h
> @@ -1,6 +1,7 @@
>  #ifndef QEMU_DISAS_H
>  #define QEMU_DISAS_H
>
> +#include "exec/hwaddr.h"
>
>  #ifdef NEED_CPU_H
>  #include "cpu.h"
> diff --git a/include/exec/cputlb.h b/include/exec/cputlb.h
> index 5373188be3..23abd71579 100644
> --- a/include/exec/cputlb.h
> +++ b/include/exec/cputlb.h
> @@ -19,6 +19,8 @@
>  #ifndef CPUTLB_H
>  #define CPUTLB_H
>
> +#include "exec/cpu-common.h"
> +
>  #if !defined(CONFIG_USER_ONLY)
>  /* cputlb.c */
>  void tlb_protect_code(ram_addr_t ram_addr);
> diff --git a/include/exec/exec-all.h b/include/exec/exec-all.h
> index 16034ee651..135aeaab0d 100644
> --- a/include/exec/exec-all.h
> +++ b/include/exec/exec-all.h
> @@ -20,6 +20,7 @@
>  #ifndef EXEC_ALL_H
>  #define EXEC_ALL_H
>
> +#include "cpu.h"
>  #include "exec/tb-context.h"
>  #include "sysemu/cpus.h"
>
> diff --git a/include/exec/ioport.h b/include/exec/ioport.h
> index a298b89ce1..97feb296d2 100644
> --- a/include/exec/ioport.h
> +++ b/include/exec/ioport.h
> @@ -24,6 +24,8 @@
>  #ifndef IOPORT_H
>  #define IOPORT_H
>
> +#include "exec/memory.h"
> +
>  #define MAX_IOPORTS     (64 * 1024)
>  #define IOPORTS_MASK    (MAX_IOPORTS - 1)
>
> diff --git a/include/exec/memory-internal.h b/include/exec/memory-internal.h
> index d1a9dd1ec8..ef4fb92371 100644
> --- a/include/exec/memory-internal.h
> +++ b/include/exec/memory-internal.h
> @@ -20,6 +20,8 @@
>  #ifndef MEMORY_INTERNAL_H
>  #define MEMORY_INTERNAL_H
>
> +#include "cpu.h"
> +
>  #ifndef CONFIG_USER_ONLY
>  static inline AddressSpaceDispatch *flatview_to_dispatch(FlatView *fv)
>  {
> diff --git a/include/exec/ram_addr.h b/include/exec/ram_addr.h
> index b7b2e60ff6..a327a80cfe 100644
> --- a/include/exec/ram_addr.h
> +++ b/include/exec/ram_addr.h
> @@ -20,6 +20,7 @@
>  #define RAM_ADDR_H
>
>  #ifndef CONFIG_USER_ONLY
> +#include "cpu.h"
>  #include "hw/xen/xen.h"
>  #include "sysemu/tcg.h"
>  #include "exec/ramlist.h"
> diff --git a/include/exec/softmmu-semi.h b/include/exec/softmmu-semi.h
> index 970837992e..fbcae88f4b 100644
> --- a/include/exec/softmmu-semi.h
> +++ b/include/exec/softmmu-semi.h
> @@ -10,6 +10,8 @@
>  #ifndef SOFTMMU_SEMI_H
>  #define SOFTMMU_SEMI_H
>
> +#include "cpu.h"
> +
>  static inline uint64_t softmmu_tget64(CPUArchState *env, target_ulong addr)
>  {
>      uint64_t val;
> diff --git a/include/exec/tb-hash.h b/include/exec/tb-hash.h
> index 4f3a37d927..805235d321 100644
> --- a/include/exec/tb-hash.h
> +++ b/include/exec/tb-hash.h
> @@ -20,6 +20,8 @@
>  #ifndef EXEC_TB_HASH_H
>  #define EXEC_TB_HASH_H
>
> +#include "exec/cpu-defs.h"
> +#include "exec/exec-all.h"
>  #include "qemu/xxhash.h"
>
>  #ifdef CONFIG_SOFTMMU
> diff --git a/include/exec/user/thunk.h b/include/exec/user/thunk.h
> index 8d3af5a3be..d05a8a4dab 100644
> --- a/include/exec/user/thunk.h
> +++ b/include/exec/user/thunk.h
> @@ -20,6 +20,7 @@
>  #define THUNK_H
>
>  #include "cpu.h"
> +#include "exec/user/abitypes.h"
>
>  /* types enums definitions */

These all seem OK.

>
> diff --git a/include/fpu/softfloat-macros.h b/include/fpu/softfloat-macros.h
> index c55aa6d174..be83a833ec 100644
> --- a/include/fpu/softfloat-macros.h
> +++ b/include/fpu/softfloat-macros.h
> @@ -82,6 +82,8 @@ this code that are retained.
>  #ifndef FPU_SOFTFLOAT_MACROS_H
>  #define FPU_SOFTFLOAT_MACROS_H
>
> +#include "fpu/softfloat.h"
> +

What does softfloat-macros actually need from the core softfloat API?
These are lower level functions used by softfloat itself (and m68k for
it's own bit fiddling).

--
Alex Bennée


  reply	other threads:[~2019-08-07 15:03 UTC|newest]

Thread overview: 124+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-06 15:14 [Qemu-devel] [PATCH v2 00/29] Tame a few "touch this, recompile the world" headers Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 01/29] include: Make headers more self-contained Markus Armbruster
2019-08-07 15:03   ` Alex Bennée [this message]
2019-08-07 19:45     ` Markus Armbruster
2019-08-07 21:28       ` Alex Bennée
2019-08-08  4:21         ` Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 02/29] Include generated QAPI headers less Markus Armbruster
2019-08-06 21:50   ` Eric Blake
2019-08-07  9:53   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 03/29] qapi: Split error.json off common.json Markus Armbruster
2019-08-07  9:57   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 04/29] memory: Fix type of IOMMUMemoryRegionClass member @parent_class Markus Armbruster
2019-08-07 10:11   ` Philippe Mathieu-Daudé
2019-08-07 10:16     ` Paolo Bonzini
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 05/29] queue: Drop superfluous #include qemu/atomic.h Markus Armbruster
2019-08-07 10:21   ` Philippe Mathieu-Daudé
2019-08-07 15:40   ` Alex Bennée
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 06/29] trace: Eliminate use of TARGET_FMT_plx Markus Armbruster
2019-08-07  9:29   ` Stefan Hajnoczi
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 07/29] trace: Do not include qom/cpu.h into generated trace.h Markus Armbruster
2019-08-07  9:32   ` Stefan Hajnoczi
2019-08-07 10:30     ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 08/29] Include sysemu/reset.h a lot less Markus Armbruster
2019-08-07 10:38   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 09/29] Include migration/qemu-file-types.h " Markus Armbruster
2019-08-07 12:25   ` Philippe Mathieu-Daudé
2019-08-07 17:30     ` Philippe Mathieu-Daudé
2019-08-07 19:46       ` Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 10/29] ide: Include hw/ide/internal a bit less outside hw/ide/ Markus Armbruster
2019-08-06 21:40   ` John Snow
2019-08-07 12:29     ` Philippe Mathieu-Daudé
2019-08-07 14:56       ` John Snow
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 11/29] typedefs: Separate incomplete types and function types Markus Armbruster
2019-08-07 12:31   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 12/29] Include hw/irq.h a lot less Markus Armbruster
2019-08-07 13:04   ` Philippe Mathieu-Daudé
2019-08-07 21:06     ` Eric Blake
2019-08-08  4:27       ` Markus Armbruster
2019-08-08  5:09         ` Richard Henderson
2019-08-08 11:48         ` Eric Blake
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 13/29] Clean up inclusion of exec/cpu-common.h Markus Armbruster
2019-08-07 14:20   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 14/29] migration: Move the VMStateDescription typedef to typedefs.h Markus Armbruster
2019-08-07 15:22   ` Alex Bennée
2019-08-07 17:13   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 15/29] Include migration/vmstate.h less Markus Armbruster
2019-08-07 14:44   ` Philippe Mathieu-Daudé
2019-08-08 11:36     ` Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 16/29] Include exec/memory.h slightly less Markus Armbruster
2019-08-07 14:50   ` Philippe Mathieu-Daudé
2019-08-08 12:16     ` Markus Armbruster
2019-08-08 12:36       ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 17/29] Include qom/object.h " Markus Armbruster
2019-08-07 17:11   ` Philippe Mathieu-Daudé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 18/29] Include hw/hw.h exactly where needed Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 19/29] Include qemu/queue.h slightly less Markus Armbruster
2019-08-07 15:57   ` Alex Bennée
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 20/29] Include qemu/main-loop.h less Markus Armbruster
2019-08-07 13:18   ` Philippe Mathieu-Daudé
2019-08-07 13:49     ` Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 21/29] Include hw/qdev-properties.h less Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 22/29] Include hw/boards.h a bit less Markus Armbruster
2019-08-06 21:37   ` Alistair Francis
2019-08-07 17:26   ` Philippe Mathieu-Daudé
2019-08-07 17:57     ` Eduardo Habkost
2019-08-07 18:05       ` Philippe Mathieu-Daudé
2019-08-07 18:19         ` Eduardo Habkost
2019-08-08 11:57           ` Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 23/29] numa: Don't include hw/boards.h into sysemu/numa.h Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 24/29] Include sysemu/hostmem.h less Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 25/29] numa: Move remaining NUMA declarations from sysemu.h to numa.h Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 26/29] Clean up inclusion of sysemu/sysemu.h Markus Armbruster
2019-08-06 21:36   ` Alistair Francis
2019-08-07 15:47   ` Alex Bennée
2019-08-07 20:10     ` Markus Armbruster
2019-08-08 14:21       ` Alex Bennée
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 27/29] Include sysemu/sysemu.h a lot less Markus Armbruster
2019-08-06 21:38   ` Alistair Francis
2019-08-07  9:28   ` Stefan Hajnoczi
2019-08-07 13:24   ` Philippe Mathieu-Daudé
2019-08-07 13:51     ` Markus Armbruster
2019-08-07 17:31   ` Philippe Mathieu-Daudé
2019-08-07 20:16     ` Markus Armbruster
2019-08-07 21:05       ` Philippe Mathieu-Daudé
2019-08-08  4:48         ` [Qemu-devel] Is network backend netmap worth keeping? (was: [PATCH v2 27/29] Include sysemu/sysemu.h a lot less) Markus Armbruster
2019-08-08  5:38           ` [Qemu-devel] Is network backend netmap worth keeping? Jason Wang
2019-08-08 13:36             ` Philippe Mathieu-Daudé
2019-08-08 17:27               ` Vincenzo Maffione
2019-08-08  7:27           ` Giuseppe Lettieri
2019-08-08 11:52             ` Markus Armbruster
2019-08-12 12:32               ` Philippe Mathieu-Daudé
2019-08-12 12:34                 ` Philippe Mathieu-Daudé
2019-09-02 20:50                 ` Giuseppe Lettieri
2019-09-13 13:04                   ` Markus Armbruster
2019-09-16 14:45                     ` Giuseppe Lettieri
2019-09-23 11:21                       ` Markus Armbruster
2019-10-04 13:02                         ` [PATCH] netmap: support git-submodule build otption Giuseppe Lettieri
2019-10-04 13:08                           ` Peter Maydell
2019-10-07 10:49                             ` Markus Armbruster
2019-10-07 11:58                               ` Peter Maydell
2019-10-07 12:35                                 ` Markus Armbruster
2019-10-07 12:39                                   ` Peter Maydell
2019-10-08  9:17                                     ` Daniel P. Berrangé
2019-10-08 11:57                                       ` Markus Armbruster
2019-10-07 15:37                                   ` Thomas Huth
2019-10-07 17:53                                     ` Markus Armbruster
2019-10-07 15:44                                 ` Markus Armbruster
2019-08-08  8:12           ` [Qemu-devel] Is network backend netmap worth keeping? (was: [PATCH v2 27/29] Include sysemu/sysemu.h a lot less) Stefano Garzarella
2019-10-07 18:21           ` Is network backend vde worth keeping? (was: Is network backend netmap worth keeping?) Markus Armbruster
2019-10-09  9:13             ` Thomas Huth
2019-10-11  6:55               ` Thomas Huth
2019-10-10 17:07             ` Julia Suvorova
2019-10-10 17:39             ` Daniel P. Berrangé
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 28/29] sysemu: Move the VMChangeStateEntry typedef to qemu/typedefs.h Markus Armbruster
2019-08-07 15:26   ` Alex Bennée
2019-08-07 20:19     ` Markus Armbruster
2019-08-06 15:14 ` [Qemu-devel] [PATCH v2 29/29] sysemu: Split sysemu/runstate.h off sysemu/sysemu.h Markus Armbruster
2019-08-07  4:40   ` Markus Armbruster
2019-08-07 10:15     ` Paolo Bonzini
2019-08-06 16:02 ` [Qemu-devel] [PATCH v2 00/29] Tame a few "touch this, recompile the world" headers no-reply
2019-08-06 16:56 ` no-reply
2019-08-07 16:32 ` Alex Bennée
2019-08-07 20:21   ` Markus Armbruster
2019-08-08 13:21   ` Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1bphvbq.fsf@linaro.org \
    --to=alex.bennee@linaro.org \
    --cc=alistair.francis@wdc.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.