On Mon, 2005-10-03 at 14:23, Jeff Johnston wrote:
James E Wilson wrote:
An alternative solution here would be to replace the #include_next with
a #error.
I think this idea would be cleaner. The creation of the file was done
long ago and it appears the original intention was simply to be a fail-safe:
OK. Here is a patch that uses the #error approach. I've tested this
with a mips-elf full toolchain build and make check. There were no
regressions.
I've also tested this with a mips-elf program that uses dirent.h to make
sure I get expected behaviour, i.e. an error. This works both from the
build tree and from the install tree, and also when we have both.
I also built a powerpc-rtems toolchain which includes dirent.h support,
and tested a program that uses dirent.h to make sure I get expected
behaviour, i.e. a successful compile. This works both from the build
tree and from the install tree, and also when we have both. This works
in the build tree because there is an -isystem option pointing to the
rtems sys directory (newlib/targ-include) before the -isystem option
pointing at the regular newlib include directory. This is in the
FLAGS_FOR_TARGET variable in the top level Makefile.
------------------------------------------------------------------------
2005-10-03 James E Wilson <wilson@specifix.com>
* libc/include/sys/dirent.h (_DIRENT_H_): Delete #include_next. Add
#error.
Index: dirent.h
===================================================================
RCS file: /cvs/src/src/newlib/libc/include/sys/dirent.h,v
retrieving revision 1.1.1.1
diff -p -p -r1.1.1.1 dirent.h
*** dirent.h 17 Feb 2000 19:39:46 -0000 1.1.1.1
--- dirent.h 4 Oct 2005 01:03:49 -0000
***************
*** 1,15 ****
/* <dirent.h> includes <sys/dirent.h>, which is this file. On a
system which supports <dirent.h>, this file is overridden by
dirent.h in the libc/sys/.../sys directory. On a system which does
! not support <dirent.h>, we will get this file which tries to find
! any other <dirent.h> which may be lurking around. If there isn't
! one, the user will get an error indicating that there is no
! <dirent.h>. */
#ifdef __cplusplus
extern "C" {
#endif
! #include_next <dirent.h>
#ifdef __cplusplus
}
#endif
--- 1,13 ----
/* <dirent.h> includes <sys/dirent.h>, which is this file. On a
system which supports <dirent.h>, this file is overridden by
dirent.h in the libc/sys/.../sys directory. On a system which does
! not support <dirent.h>, we will get this file which uses #error to force
! an error. */
#ifdef __cplusplus
extern "C" {
#endif
! #error "<dirent.h> not supported"
#ifdef __cplusplus
}
#endif