[Libvir] more missing #include's of "config.h"

Jim Meyering jim at meyering.net
Thu Dec 6 18:25:36 UTC 2007


Daniel Veillard <veillard at redhat.com> wrote:
> On Thu, Dec 06, 2007 at 06:32:24PM +0100, Jim Meyering wrote:
>> This is the last of the non-generated files requiring #include "config.h":
>>
>> 	Include "config.h" in remaining non-generated files.
>>         * docs/examples/info1.c: Likewise.
>> 	* docs/examples/suspend.c: Likewise.

Hi Daniel,

> For those 2 files I don't agree with adding it, they are example files
> showing how to use the API and config.h is an internal header, those
> user level examples should really not include it.

Don't you think people will understand that?
Would a comment help?

"config.h" really is required in every .c file that's compiled
as part of a build.  If it's not, you're asking for build failures
whenever you encounter a compiler with e.g, insufficient "const" support.

This is an issue even with those simple example files,
since there are uses of "const" in libvirt.h, which is included
by each of those two.  On a build host with a deficient compiler,
the config.h-supplied definition of "const" is required in that case.
Each also includes stdio.h, which (with gnulib) requires




More information about the libvir-list mailing list