[Spice-devel] [spice-server] style: Slight tweak to the header guard section

Christophe Fergeau cfergeau at redhat.com
Thu Feb 15 09:11:12 UTC 2018


On Wed, Feb 14, 2018 at 10:43:26PM +0100, Christophe de Dinechin wrote:
> 
> 
> > On 14 Feb 2018, at 17:29, Christophe Fergeau <cfergeau at redhat.com> wrote:
> > 
> > This changes the suggested style to what is currently used in
> > spice-server codebase. This also removes a few sentences which
> > are not really related to how one should format their header guards.
> > 
> > Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
> > ---
> > docs/spice_style.txt | 6 ++----
> > 1 file changed, 2 insertions(+), 4 deletions(-)
> > 
> > diff --git a/docs/spice_style.txt b/docs/spice_style.txt
> > index c8a4cff66..bc18b1d9e 100644
> > --- a/docs/spice_style.txt
> > +++ b/docs/spice_style.txt
> > @@ -365,12 +365,10 @@ Headers should be protected against multiple inclusion using a macro that contai
> > 
> > ...
> > 
> > -#endif // MY_MODULE_H
> > +#endif /* MY_MODULE_H */
> 
> I had first written it with C style, Frediano suggested C++ style.Both are OK. Currently, we have 44 of one and 208 of the other, so the existing code base does not imply one or the other.

spice/server/*.h is consistently using /* */, and this file is in
spice-server codebase. So I'd rather this reflects what is being done
there ;)

> 
> > ----
> > 
> > -The macro may include additional information, e.g. a component. For example a file generally referenced as foo/bar.h could use a FOO_BAR_H macro.
> 
> Nack the removal. We want a guideline, because right now it’s “anything goes” and it looks ugly:

There is a guideline at the top of the section before the example:
"Headers should be protected against multiple inclusion using a macro
that contains the header file name in uppercase, with all characters
that are invalid in C replaced with an underscore '_':"

So I'm not advocating for "anything goes", I'm removing some parts which
I don't think are bringing much, or could even be confusing.

Christophe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/spice-devel/attachments/20180215/db5d2621/attachment.sig>


More information about the Spice-devel mailing list