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] Avoid cyclic header dependencies
Date: Mon, 03 Jun 2019 08:40:00 -0000	[thread overview]
Message-ID: <20190603084017.105726.qmail@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=66e75b696133e889f514415a259d8d8d56f35d16

commit 66e75b696133e889f514415a259d8d8d56f35d16
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date:   Thu May 16 14:40:32 2019 +0200

    Avoid cyclic header dependencies
    
    RTEMS uses a considerable part of FreeBSD kernel and user space sources.
    These sources are compiled with a __FreeBSD__ define.  On 2018-06-26
    Gerald Pfeifer changed the GCC provided <stddef.h> so that it includes
    <sys/_types.h> if __FreeBSD__ is defined.  The Newlib <sys/_types.h>
    included <sys/lock.h> which includes <sys/cdefs.h> on RTEMS which
    includes <stddef.h>.  To get rid of this cyclic dependency move the
    optional _flock_t definition to <sys/reent.h>.
    
    Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>

Diff:
---
 newlib/libc/include/sys/_types.h | 5 -----
 newlib/libc/include/sys/reent.h  | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h
index fc10531..90383b0 100644
--- a/newlib/libc/include/sys/_types.h
+++ b/newlib/libc/include/sys/_types.h
@@ -22,7 +22,6 @@
 #include <newlib.h>
 #include <sys/config.h>
 #include <machine/_types.h>
-#include <sys/lock.h>
 
 #ifndef __machine_blkcnt_t_defined
 typedef long __blkcnt_t;
@@ -171,10 +170,6 @@ typedef struct
 } _mbstate_t;
 #endif
 
-#ifndef __machine_flock_t_defined
-typedef _LOCK_RECURSIVE_T _flock_t;
-#endif
-
 #ifndef __machine_iconv_t_defined
 /* Iconv descriptor type */
 typedef void *_iconv_t;
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 6e55e1c..7f8124d 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -30,6 +30,11 @@ typedef unsigned __Long __ULong;
 #include <sys/types.h>
 #endif
 
+#ifndef __machine_flock_t_defined
+#include <sys/lock.h>
+typedef _LOCK_RECURSIVE_T _flock_t;
+#endif
+
 #ifndef __Long
 #define __Long __int32_t
 typedef __uint32_t __ULong;


                 reply	other threads:[~2019-06-03  8:40 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=20190603084017.105726.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: link
Be 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).