public inbox for newlib-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] Provide __size_t via <sys/_types.h> Date: Fri, 15 Apr 2016 12:55:00 -0000 [thread overview] Message-ID: <20160415125528.96387.qmail@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=3ad9b2fcbab86ad58224c91619782fab2f17f126 commit 3ad9b2fcbab86ad58224c91619782fab2f17f126 Author: Sebastian Huber <sebastian.huber@embedded-brains.de> Date: Fri Apr 15 13:44:28 2016 +0200 Provide __size_t via <sys/_types.h> Various FreeBSD source and header files need a typedef __size_t via <sys/_types.h>. Unfortunately the GCC provided <stddef.h> uses #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \ || defined(__DragonFly__) \ || defined(__FreeBSD_kernel__) /* __size_t is a typedef on FreeBSD 5, must not trash it. */ #elif defined (__VMS__) /* __size_t is also a typedef on VMS. */ #else #define __size_t #endif and therefore defines __size_t on Newlib targets which would trash a __size_t typedef. Include <stddef.h> before <sys/_types.h> in <sys/types.h> and undefine __size_t in <sys/_types.h> as a workaround. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de> Diff: --- newlib/libc/include/sys/_types.h | 15 +++++++++++++++ newlib/libc/include/sys/types.h | 4 ++-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index 6a2c94d..06ddd83 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -119,6 +119,21 @@ typedef _off64_t _fpos64_t; #endif #endif +/* Defined by GCC provided <stddef.h> */ +#undef __size_t + +#ifndef __machine_size_t_defined +#ifdef __SIZE_TYPE__ +typedef __SIZE_TYPE__ __size_t; +#else +#if defined(__INT_MAX__) && __INT_MAX__ == 2147483647 +typedef int __size_t; +#else +typedef long __size_t; +#endif +#endif +#endif + #ifndef __machine_ssize_t_defined #ifdef __SIZE_TYPE__ /* If __SIZE_TYPE__ is defined (gcc) we define ssize_t based on size_t. diff --git a/newlib/libc/include/sys/types.h b/newlib/libc/include/sys/types.h index 57b74ef..31f765e 100644 --- a/newlib/libc/include/sys/types.h +++ b/newlib/libc/include/sys/types.h @@ -56,11 +56,11 @@ typedef quad_t * qaddr_t; #ifndef __need_inttypes #define _SYS_TYPES_H +/* <stddef.h> must be before <sys/_types.h> for __size_t considerations */ +#include <stddef.h> #include <sys/_types.h> #include <sys/_stdint.h> -# include <stddef.h> - #if __BSD_VISIBLE #include <machine/endian.h> #include <sys/select.h>
reply other threads:[~2016-04-15 12:55 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20160415125528.96387.qmail@sourceware.org \ --to=corinna@sourceware.org \ --cc=newlib-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).