This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

odd bits in the tree


When browsing through the newlib tree, I noticed two things that strike
me as a little odd:
 - there are plenty of "standard" prototypes that are declared
   several times in libc/sys/*/sys (e.g. dirent.h), and sometimes also
   in libc/include/sys/*.h (e.g. stat.h)
 - libc/machine/i386 contains lots of functions that belong to libm

One side-effect of the latter is that libc needs symbols from libm
(e.g. powf, infinity), which fails my shared library build. I can work
around this, but I wonder if it wouldn't be cleaner to move them into
some yet to be created libm/machine instead ?

For the standard prototypes, let's examine dirent.h:
 - cygwin, decstation, go32, rtems, sparc64, sun4, and sysvi386 all
   declare opendir, readdir, rewinddir, and closedir conforming to 1003.1
 - cygwin declares telldir, seekdir, scandir, and alphasort unless
   _POSIX_SOURCE is defined, which is good
 - go32 and rtems declare telldir and seekdir unconditionally, which is
   probably not so good

Wouldn't it be better to have a single file, say sys/std_dirent.h, with
the cygwin prototypes, which could then be included by the others ?
(The simpler solution of declaring the prototypes in include/dirent.h
would break the include_next mechanism in the default include/sys/dirent.h,
so this does't seem to be an option.)

Also, opendir is always declared with  DIR *opendir (const char *);
Shouldn't that be _CONST ?

sys/errno.h, sys/stat.h, and sys/utmp.h have issues similar to
sys/dirent.h

I can make patches if there's interest in changing some of these things.

- Werner

-- 
  _________________________________________________________________________
 / Werner Almesberger, ICA, EPFL, CH       werner.almesberger@ica.epfl.ch /
/_IN_N_032__Tel_+41_21_693_6621__Fax_+41_21_693_6610_____________________/

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]