[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [bug-gnulib] fts modules submission
From: |
Bruno Haible |
Subject: |
Re: [bug-gnulib] fts modules submission |
Date: |
Mon, 9 May 2005 19:25:25 +0200 |
User-agent: |
KMail/1.5 |
Henry Culver wrote:
> I would like to contribute an fts module for inclusion into gnulib.
> Systems that are not based on glibc may not have fts_open, fts_close,
> fts_read, fts_children or fts_set. I have extracted the fts.c and
> fts.h from glibc-2.3.5/io and modified them (providing a few #defines
> and removing __ from calls to open, close, fchdir, and set_errno).
Thanks. As Jim said four weeks ago, 'fts' is the interface to go for.
Nitpicking reveals several nits and bugs:
- modules/fts: The description is incorrect.
- fts.m4: The main() function needs a return type, otherwise it will not
compile with C99 compilers.
- fts.m4: The temporary file should have a name that matched "conftest*",
otherwise it will fail to be removed when the user interrupts the configure
script.
- fts.m4: The test doesn't work when cross-compiling. Look at size_max.m4
for a technique how to determine a number without running a program.
- fts.m4: -D defines belong in CPPFLAGS, not in CFLAGS.
- fts.m4: -D defines actually should be defined using AC_DEFINE, not -D.
- fts.h: If you install this file in a source tree, it will hide and override
the system's <fts.h>. To avoid this, rename it to fts_.h and use a
Makefile.am rule as the one found in modules/fnmatch or modules/stdbool.
- fts.h: Please resolve the conflict between fts.h and LFS. Many gnulib
programs (tar, coreutils, gzip, clisp, etc.) use LFS.
- fts.h: Don't use type names like 'u_short' as they are non-portable.
- fts.h: Be careful with type names 'dev_t', 'ino_t', 'nlink_t'. Some of them
may not be defined on mingw. For these, you need the appropriate replacement
macro in fts.m4.
- fts.h: Please add parameter names and comments describing the function
fts_*. Copying the entire manual page is not needed, but the comments
should describe reasonably what the functions do.
- fts.c: __alignof__ doesn't exist in compilers other than GNU C.
You can use the appended macro.
- fts.c (MAX): compound expressions and __typeof__ don't exist in compilers
other than GNU C. When taking some code from glibc, it is a good idea
to compile it with a compiler other than GCC on many different
platforms (such as FreeBSD, Solaris, mingw).
Bruno
/* Portable replacement for alignof. */
#ifdef __cplusplus
#ifdef GNU
#define alignof(type) __alignof__(type)
#else
template <class type> struct alignof_helper { char slot1; type slot2; };
#define alignof(type) offsetof(alignof_helper<type>, slot2)
#endif
#else
#define alignof(type) offsetof(struct { char slot1; type slot2; }, slot2)
#endif
Re: [bug-gnulib] fts modules submission,
Bruno Haible <=