This is the mail archive of the newlib@sourceware.org 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]
Other format: [Raw text]

Re: [PATCH v3] Merge parts of <sys/time.h> from FreeBSD




On 06/07/15 10:08, Corinna Vinschen wrote:
Hi Marco,

On Jul  5 16:33, Marco Atzeri wrote:
On 3/13/2015 1:24 PM, Corinna Vinschen wrote:
Hi Sebastian,

On Mar 13 11:00, Sebastian Huber wrote:
Merge parts of the latest <sys/time.h> from FreeBSD to Newlib.  This has
two reasons.
This patch also allowed to remove a Cygwin specific piece of code.
I now pushed your patch as well as the Cygwin ones.

Thanks,
Corinna


with the current settings, on cygwin with _GNU_SOURCE on
/usr/include/sys/time.h

bintime_mul(struct bintime *_bt, u_int _x)
is included but

u_int is not defined
Thanks, but you forgot to paste this detail from your mail to the
Cygwin list:

u_int is defined in
  /usr/include/sys/types.h
and
  /usr/include/sys/time.h
includes it, but it is coveread by a

  # ifndef        _POSIX_SOURCE
Also your project defines _POSIX_SOURCE.

So while u_int is guarded !_POSIX_SOURCE, the bintime_mul inline function
using it is guarded __BSD_VISIBLE.

Sebastian, the easy way out would be to redefine bintime_mul to use
and "unsigned int" as second parameter.

OTOH, shouldn't the affected types in sys/types.h guarded __BSD_VISIBLE,
too, instead?  They are on FreeBSD, afaics.

In FreeBSD sys/types.h we have:

#if __BSD_VISIBLE
typedef    unsigned char    u_char;
typedef    unsigned short    u_short;
typedef    unsigned int    u_int;
typedef    unsigned long    u_long;
#ifndef _KERNEL
typedef    unsigned short    ushort;        /* Sys V compatibility */
typedef    unsigned int    uint;        /* Sys V compatibility */
#endif
#endif

So this fits well with the bintime_mul(struct bintime *_bt, u_int _x).

In Newlib sys/types.h (newlib/libc/include/sys/types.h) we have:

# ifndef    _POSIX_SOURCE

#  define    physadr        physadr_t
#  define    quad        quad_t

#ifndef _BSDTYPES_DEFINED
/* also defined in mingw/gmon.h and in w32api/winsock[2].h */
#ifndef __u_char_defined
typedef    unsigned char    u_char;
#define __u_char_defined
#endif
#ifndef __u_short_defined
typedef    unsigned short    u_short;
#define __u_short_defined
#endif
#ifndef __u_int_defined
typedef    unsigned int    u_int;
#define __u_int_defined
#endif
#ifndef __u_long_defined
typedef    unsigned long    u_long;
#define __u_long_defined
#endif
#define _BSDTYPES_DEFINED
#endif

typedef    unsigned short    ushort;        /* System V compatibility */
typedef    unsigned int    uint;        /* System V compatibility */
typedef    unsigned long    ulong;        /* System V compatibility */
# endif    /*!_POSIX_SOURCE */

So this uses the _POSIX_SOURCE define. I would adjust this to use the __BSD_VISIBLE instead like on FreeBSD.

--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschÃftliche Mitteilung im Sinne des EHUG.


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