[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: config.h inclusion
From: |
Ralf Wildenhues |
Subject: |
Re: config.h inclusion |
Date: |
Wed, 14 Sep 2005 17:07:33 +0200 |
User-agent: |
Mutt/1.4.1i |
Hi Paul,
* Paul Eggert wrote on Wed, Sep 14, 2005 at 01:21:18AM CEST:
> Ralf Wildenhues <address@hidden> writes:
>
> > Would you accept a patch to change all of these to use
> > #ifdef HAVE_CONFIG_H
> > # include <config.h>
> > #endif
> >
> > uniformly?
>
> That makes sense to me, yes. We should be consistent, and that's the
> majority usage.
>
> Also, no .h file should include config.h. This is because config.h
> must be included first, and it's the includer's responsibility to do
> that. You might as well fix that inconsistency too, while you're at
> it.
ACK.
Several steps:
0) Find any .c files that include config.h bug not first -- I have not
found any. :)
For reference, this is how I searched:
cd gnulib/lib
for i in *.c; do
if grep '^#.*include.*config\.h' $i > /dev/null; then
if sed -n '/^#.*include/{p;q;}' $i | grep -v config\\.h; then
echo $i
fi
fi
done
1) Fix the files that forgot to guard inclusion by HAVE_CONFIG_H.
This is the first patch.
2) Fix any header files not to include config.h, and their callers to
include it if not already. This part may break third-party software,
including possibly the upstream source, so pay attention to it!
I have added a warning to the headers that config.h needs to be
included beforehand.
This is the second patch.
3) Make all remaining usage uniform as well.
This is the third patch (gzip'ed because of the size).
Notable exception to uniformity is argz.c where Libtool is upstream.
I may look this eventually. :-)
4) Update gnulib documentation(?) about the preferred style.
This would most likely fit into either gnulib.texi or standards.texi,
I believe. I have not produced a patch for this, though.
5) Maybe even enforce the style by a check. Not done, either.
Thinking out loud, `#if HAVE*' vs. `#ifdef HAVE*' also could be
uniformized for other values of `*' .. not sure it's worth the effort.
Do I have to contact each upstream source now?
Cheers,
Ralf
* atexit.c, chdir-long.c chown.c, fchown-stub.c, getgroups.c,
gettimeofday.c, lchown.c, lstat.c, mkdir.c, mkstemp.c,
nanosleep.c, openat.c, raise.c, readtokens0.c, readutmp.c,
unlinkdir.c: Guard inclusion of config.h with HAVE_CONFIG_H.
* __fpending.h, argp-fmtstream.h, dirfd.h, getdate.h, human.h,
inttostr.h: Removed inclusion of config.h from header files.
* inttostr.c: Adjusted in-tree users.
* __fpending.c, acl.c, argmatch.c, argp-eexst.c,
argp-fmtstream.c, argp-fs-xinl.c, argp-help.c, argp-parse.c,
argp-pvh.c, argp-xinl.c, backupfile.c, basename.c, c-stack.c,
calloc.c, check-version.c, cloexec.c, closeout.c, copy-file.c,
creat-safer.c, cycle-check.c, dirfd.c, dirname.c, dup-safer.c,
dup2.c, euidaccess.c, exclude.c, exitfail.c, fatal-signal.c,
fd-safer.c, file-type.c, fileblocks.c, filemode.c,
filenamecat.c, findprog.c, fnmatch.c, fopen-safer.c, free.c,
fsusage.c, ftruncate.c, full-write.c, fwriteerror.c,
getaddrinfo.c, getcwd.c, getdelim.c, getline.c, getlogin_r.c,
getndelim2.c, getnline.c, getopt1.c, getpass.c, group-member.c,
hard-locale.c, hash-pjw.c, hash.c, human.c, idcache.c,
inet_ntop.c, isdir.c, long-options.c, malloc.c, memcasecmp.c,
memcmp.c, memcoll.c, memcpy.c, memmove.c, mkdir-p.c, mkdtemp.c,
modechange.c, mountlist.c, open-safer.c, physmem.c,
pipe-safer.c, pipe.c, poll.c, posixver.c, progname.c,
progreloc.c, putenv.c, quote.c, quotearg.c, readline.c,
readlink.c, realloc.c, regex.c, rename.c, rmdir.c, rpmatch.c,
safe-read.c, same.c, save-cwd.c, savedir.c, setenv.c, sig2str.c,
strcspn.c, strerror.c, stripslash.c, strncasecmp.c, strndup.c,
strnlen.c, strnlen1.c, strsep.c, strstr.c, strtod.c,
strtoimax.c, strtol.c, strverscmp.c, tempname.c, time_r.c,
unsetenv.c, userspec.c, utimecmp.c, version-etc-fsf.c,
version-etc.c, wait-process.c, xalloc-die.c, xgetcwd.c,
xmalloc.c, xmemcoll.c, xnanosleep.c, xreadlink.c, xsetenv.c,
xstrndup.c, xstrtoimax.c, xstrtol.c, xstrtoumax.c, yesno.c:
Standardize inclusion of config.h.
config-h-guard.diff
Description: Text document
config-h-not-in-headers.diff
Description: Text document
config-h-uniform.diff.gz
Description: GNU Zip compressed data