[Qemu-devel] Re: [PATCH] scripts: add a guard macro in generated .h files

2011-02-21 Thread Paolo Bonzini

On 02/21/2011 07:42 AM, Tristan Gingold wrote:

Mostly a style issue.  It is common to always protect header files
against multiple inclusion, unless the header is meant to be included
several times (which is not the case for these config files).  I
think this is a good practice.


Traditionally, autoconf's config.h headers have no guards either.  This 
can indeed cause some troubles.  However, it also helps highlighting 
poor practices, such as libraries installing a config.h file including 
it from a public header.



I once got redefinition warnings for macros in config-host.h, but I
agree that adding the guard macro doesn't fix this issue.


config-host.h should always be the first included header (we are poor at 
this) and its macros should never conflict with anything else.  I think 
we should rather fix the problems you've seen with config-host.h, if you 
can still reproduce them.


Paolo



[Qemu-devel] Re: [PATCH] scripts: add a guard macro in generated .h files

2011-02-21 Thread Tristan Gingold

On Feb 21, 2011, at 9:14 AM, Paolo Bonzini wrote:

 On 02/21/2011 07:42 AM, Tristan Gingold wrote:
 Mostly a style issue.  It is common to always protect header files
 against multiple inclusion, unless the header is meant to be included
 several times (which is not the case for these config files).  I
 think this is a good practice.
 
 Traditionally, autoconf's config.h headers have no guards either.  This can 
 indeed cause some troubles.  However, it also helps highlighting poor 
 practices, such as libraries installing a config.h file including it from a 
 public header.
 
 I once got redefinition warnings for macros in config-host.h, but I
 agree that adding the guard macro doesn't fix this issue.
 
 config-host.h should always be the first included header (we are poor at 
 this) and its macros should never conflict with anything else.  I think we 
 should rather fix the problems you've seen with config-host.h, if you can 
 still reproduce them.

Thank you.  I will investigate the next time I have the issue and the time.

Tristan.