From: "Michał Lowas-Rzechonek" <michal.lowas-rzechonek@silvair.com>
To: Inga Stotland <inga.stotland@intel.com>
Cc: linux-bluetooth@vger.kernel.org, brian.gix@intel.com
Subject: Re: [PATCH BlueZ] mesh: Clean up includes
Date: Tue, 18 Jun 2019 09:35:59 +0200 [thread overview]
Message-ID: <20190618073559.tmpaj2oellkf5354@mlowasrzechonek2133> (raw)
In-Reply-To: <20190617213847.21705-1-inga.stotland@intel.com>
Hi Inga,
On 06/17, Inga Stotland wrote:
> This adds #include for json-c/json.h in mesh-db.h and removes this
> include from the other files that don't need to reference json-c.
While I agree about removal from cfgmod-server, model and node, I don't
think we should remove the include from storage and move it to mesh-db.
I'd rather see #includes follow https://include-what-you-use.org/
approach, that is:
(...) for every symbol (type, function variable, or macro) that you
use in foo.cc, either foo.cc or foo.h should #include a .h file that
exports the declaration of that symbol.
Moreover, I think headers should only be included as-needed (mostly in
.c files), and headers should contain forward declarations of various
types, to make them opaque.
Such an approach cuts implicit dependencies, making code maintenance
easier: when, for example, someone decides to refactor mesh-db not to
use json_object anymore, they shouldn't need to suddenly deal with
missing declarations in other modules (in this case, storage).
Moreover, each header should be self-sufficient: in order to use API
exposed by a given header, it should be enough to include that header
only. At the moment, this is not the case.
A minor side-effect would be faster builds and less rebuilds when code
is being worked on.
If you agree, I am more than happy to fix this throughout the mesh/
codebase.
regards
--
Michał Lowas-Rzechonek <michal.lowas-rzechonek@silvair.com>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND
next prev parent reply other threads:[~2019-06-18 7:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-17 21:38 [PATCH BlueZ] mesh: Clean up includes Inga Stotland
2019-06-18 7:35 ` Michał Lowas-Rzechonek [this message]
2019-06-18 15:49 ` Stotland, Inga
2019-06-19 17:44 ` michal.lowas-rzechonek
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=20190618073559.tmpaj2oellkf5354@mlowasrzechonek2133 \
--to=michal.lowas-rzechonek@silvair.com \
--cc=brian.gix@intel.com \
--cc=inga.stotland@intel.com \
--cc=linux-bluetooth@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox