* [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init()
2017-06-23 9:23 [PATCH 1/3] Remove superfluous parameter from std() Sebastian Huber
@ 2017-06-23 9:23 ` Sebastian Huber
2017-06-23 14:02 ` Corinna Vinschen
2017-06-23 9:23 ` [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS Sebastian Huber
1 sibling, 1 reply; 9+ messages in thread
From: Sebastian Huber @ 2017-06-23 9:23 UTC (permalink / raw)
To: newlib
This simplifies further changes in this area.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/stdio/findfp.c | 50 ++++++++++++++++++++++++++++++----------------
1 file changed, 33 insertions(+), 17 deletions(-)
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index ecc65d6d3..601795098 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -84,6 +84,36 @@ _DEFUN(std, (ptr, flags, file),
#endif
}
+static void
+stdin_init(FILE *ptr)
+{
+ std (ptr, __SRD, 0);
+}
+
+static void
+stdout_init(FILE *ptr)
+{
+ /* On platforms that have true file system I/O, we can verify
+ whether stdout is an interactive terminal or not, as part of
+ __smakebuf on first use of the stream. For all other platforms,
+ we will default to line buffered mode here. Technically, POSIX
+ requires both stdin and stdout to be line-buffered, but tradition
+ leaves stdin alone on systems without fcntl. */
+#ifdef HAVE_FCNTL
+ std (ptr, __SWR, 1);
+#else
+ std (ptr, __SWR | __SLBF, 1);
+#endif
+}
+
+static void
+stderr_init(FILE *ptr)
+{
+ /* POSIX requires stderr to be opened for reading and writing, even
+ when the underlying fd 2 is write-only. */
+ std (ptr, __SRW | __SNBF, 2);
+}
+
struct glue_with_file {
struct _glue glue;
FILE file;
@@ -235,23 +265,9 @@ _DEFUN(__sinit, (s),
s->_stderr = __sfp(s);
#endif
- std (s->_stdin, __SRD, 0);
-
- /* On platforms that have true file system I/O, we can verify
- whether stdout is an interactive terminal or not, as part of
- __smakebuf on first use of the stream. For all other platforms,
- we will default to line buffered mode here. Technically, POSIX
- requires both stdin and stdout to be line-buffered, but tradition
- leaves stdin alone on systems without fcntl. */
-#ifdef HAVE_FCNTL
- std (s->_stdout, __SWR, 1);
-#else
- std (s->_stdout, __SWR | __SLBF, 1);
-#endif
-
- /* POSIX requires stderr to be opened for reading and writing, even
- when the underlying fd 2 is write-only. */
- std (s->_stderr, __SRW | __SNBF, 2);
+ stdin_init (s->_stdin);
+ stdout_init (s->_stdout);
+ stderr_init (s->_stderr);
s->__sdidinit = 1;
--
2.12.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS
2017-06-23 9:23 [PATCH 1/3] Remove superfluous parameter from std() Sebastian Huber
2017-06-23 9:23 ` [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init() Sebastian Huber
@ 2017-06-23 9:23 ` Sebastian Huber
2017-06-23 21:53 ` Freddie Chopin
1 sibling, 1 reply; 9+ messages in thread
From: Sebastian Huber @ 2017-06-23 9:23 UTC (permalink / raw)
To: newlib
In Newlib, the stdio streams are defined to thread-specific pointers
_reent::_stdin, _reent::_stdout and _reent::_stderr. In case
_REENT_SMALL is not defined, then these pointers are initialized via
_REENT_INIT_PTR() or _REENT_INIT_PTR_ZEROED() to thread-specific FILE
objects provided via _reent::__sf[3]. There are two problems with this
(at least in case of RTEMS).
(1) The thread-specific FILE objects are closed by _reclaim_reent().
This leads to problems with language run-time libraries that provide
wrappers to the C/POSIX stdio streams (e.g. C++ and Ada), since they
use the thread-specific FILE objects of the initialization thread. In
case the initialization thread is deleted, then they use freed memory.
(2) Since thread-specific FILE objects are used with a common output
device via file descriptors 0, 1 and 2, the locking at FILE object level
cannot ensure atomicity of the output, e.g. a call to printf().
Introduce a new Newlib configuration option _REENT_GLOBAL_STDIO_STREAMS
to enable the use of global stdio FILE objects. Use this option for RTEMS.
As a side-effect this reduces the size of struct _reent by more than
50%.
The _REENT_GLOBAL_STDIO_STREAMS should not be used without
_STDIO_CLOSE_PER_REENT_STD_STREAMS.
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/include/sys/config.h | 1 +
newlib/libc/include/sys/reent.h | 21 +++++++++++++++------
newlib/libc/stdio/findfp.c | 24 ++++++++++++++++++++++++
newlib/libc/stdio/local.h | 2 +-
4 files changed, 41 insertions(+), 7 deletions(-)
diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h
index 555239f8b..ae8caff7b 100644
--- a/newlib/libc/include/sys/config.h
+++ b/newlib/libc/include/sys/config.h
@@ -238,6 +238,7 @@
#define _READ_WRITE_RETURN_TYPE _ssize_t
#define __DYNAMIC_REENT__
#define _REENT_GLOBAL_ATEXIT
+#define _REENT_GLOBAL_STDIO_STREAMS
#endif
#ifndef __EXPORT
diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h
index 8b67889ac..2a79ccc71 100644
--- a/newlib/libc/include/sys/reent.h
+++ b/newlib/libc/include/sys/reent.h
@@ -644,14 +644,23 @@ struct _reent
of the above members (on the off chance that future binary compatibility
would be broken otherwise). */
struct _glue __sglue; /* root of glue chain */
+# ifndef _REENT_GLOBAL_STDIO_STREAMS
__FILE __sf[3]; /* first three file descriptors */
+# endif
};
+#ifdef _REENT_GLOBAL_STDIO_STREAMS
+extern __FILE __sf[3];
+#define _REENT_STDIO_STREAM(var, index) &__sf[index]
+#else
+#define _REENT_STDIO_STREAM(var, index) &(var).__sf[index]
+#endif
+
#define _REENT_INIT(var) \
{ 0, \
- &(var).__sf[0], \
- &(var).__sf[1], \
- &(var).__sf[2], \
+ _REENT_STDIO_STREAM(var, 0), \
+ _REENT_STDIO_STREAM(var, 1), \
+ _REENT_STDIO_STREAM(var, 2), \
0, \
"", \
0, \
@@ -696,9 +705,9 @@ struct _reent
}
#define _REENT_INIT_PTR_ZEROED(var) \
- { (var)->_stdin = &(var)->__sf[0]; \
- (var)->_stdout = &(var)->__sf[1]; \
- (var)->_stderr = &(var)->__sf[2]; \
+ { (var)->_stdin = _REENT_STDIO_STREAM(var, 0); \
+ (var)->_stdout = _REENT_STDIO_STREAM(var, 1); \
+ (var)->_stderr = _REENT_STDIO_STREAM(var, 2); \
(var)->_new._reent._rand_next = 1; \
(var)->_new._reent._r48._seed[0] = _RAND48_SEED_0; \
(var)->_new._reent._r48._seed[1] = _RAND48_SEED_1; \
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 601795098..ffeb019fa 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -35,6 +35,10 @@ const struct __sFILE_fake __sf_fake_stderr =
{_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL};
#endif
+#ifdef _REENT_GLOBAL_STDIO_STREAMS
+__FILE __sf[3];
+#endif
+
#if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED))
_NOINLINE_STATIC _VOID
#else
@@ -218,6 +222,14 @@ _DEFUN(_cleanup_r, (ptr),
cleanup_func = _fclose_r;
#endif
#endif
+#ifdef _REENT_GLOBAL_STDIO_STREAMS
+ if (ptr->_stdin != &__sf[0])
+ (*cleanup_func) (ptr, ptr->_stdin);
+ if (ptr->_stdout != &__sf[1])
+ (*cleanup_func) (ptr, ptr->_stdout);
+ if (ptr->_stderr != &__sf[2])
+ (*cleanup_func) (ptr, ptr->_stderr);
+#endif
_CAST_VOID _fwalk_reent (ptr, cleanup_func);
}
@@ -250,8 +262,10 @@ _DEFUN(__sinit, (s),
s->__sglue._next = NULL;
#ifndef _REENT_SMALL
+# ifndef _REENT_GLOBAL_STDIO_STREAMS
s->__sglue._niobs = 3;
s->__sglue._iobs = &s->__sf[0];
+# endif
#else
s->__sglue._niobs = 0;
s->__sglue._iobs = NULL;
@@ -265,9 +279,19 @@ _DEFUN(__sinit, (s),
s->_stderr = __sfp(s);
#endif
+#ifdef _REENT_GLOBAL_STDIO_STREAMS
+ if (__sf[0]._cookie == NULL) {
+ _GLOBAL_REENT->__sglue._niobs = 3;
+ _GLOBAL_REENT->__sglue._iobs = &__sf[0];
+ stdin_init (&__sf[0]);
+ stdout_init (&__sf[1]);
+ stderr_init (&__sf[2]);
+ }
+#else
stdin_init (s->_stdin);
stdout_init (s->_stdout);
stderr_init (s->_stderr);
+#endif
s->__sdidinit = 1;
diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h
index 5f6995501..511e5e35f 100644
--- a/newlib/libc/stdio/local.h
+++ b/newlib/libc/stdio/local.h
@@ -38,7 +38,7 @@
case _STDIO_CLOSE_PER_REENT_STD_STREAMS is defined these file descriptors
will be closed via close() provided the owner of the reent structure
triggerd the on demand reent initilization, see CHECK_INIT(). */
-#if !defined(__rtems__) && !defined(__tirtos__)
+#if !defined(__tirtos__)
#define _STDIO_CLOSE_PER_REENT_STD_STREAMS
#endif
--
2.12.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/3] Remove superfluous parameter from std()
@ 2017-06-23 9:23 Sebastian Huber
2017-06-23 9:23 ` [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init() Sebastian Huber
2017-06-23 9:23 ` [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS Sebastian Huber
0 siblings, 2 replies; 9+ messages in thread
From: Sebastian Huber @ 2017-06-23 9:23 UTC (permalink / raw)
To: newlib
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
---
newlib/libc/stdio/findfp.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
index 83d3dc558..ecc65d6d3 100644
--- a/newlib/libc/stdio/findfp.c
+++ b/newlib/libc/stdio/findfp.c
@@ -40,11 +40,10 @@ _NOINLINE_STATIC _VOID
#else
static _VOID
#endif
-_DEFUN(std, (ptr, flags, file, data),
+_DEFUN(std, (ptr, flags, file),
FILE *ptr _AND
int flags _AND
- int file _AND
- struct _reent *data)
+ int file)
{
ptr->_p = 0;
ptr->_r = 0;
@@ -236,7 +235,7 @@ _DEFUN(__sinit, (s),
s->_stderr = __sfp(s);
#endif
- std (s->_stdin, __SRD, 0, s);
+ std (s->_stdin, __SRD, 0);
/* On platforms that have true file system I/O, we can verify
whether stdout is an interactive terminal or not, as part of
@@ -245,14 +244,14 @@ _DEFUN(__sinit, (s),
requires both stdin and stdout to be line-buffered, but tradition
leaves stdin alone on systems without fcntl. */
#ifdef HAVE_FCNTL
- std (s->_stdout, __SWR, 1, s);
+ std (s->_stdout, __SWR, 1);
#else
- std (s->_stdout, __SWR | __SLBF, 1, s);
+ std (s->_stdout, __SWR | __SLBF, 1);
#endif
/* POSIX requires stderr to be opened for reading and writing, even
when the underlying fd 2 is write-only. */
- std (s->_stderr, __SRW | __SNBF, 2, s);
+ std (s->_stderr, __SRW | __SNBF, 2);
s->__sdidinit = 1;
--
2.12.3
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init()
2017-06-23 9:23 ` [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init() Sebastian Huber
@ 2017-06-23 14:02 ` Corinna Vinschen
2017-06-26 6:15 ` Sebastian Huber
0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2017-06-23 14:02 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 1588 bytes --]
Hi Sebastian,
On Jun 23 11:22, Sebastian Huber wrote:
> This simplifies further changes in this area.
>
> Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
> ---
> newlib/libc/stdio/findfp.c | 50 ++++++++++++++++++++++++++++++----------------
> 1 file changed, 33 insertions(+), 17 deletions(-)
>
> diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c
> index ecc65d6d3..601795098 100644
> --- a/newlib/libc/stdio/findfp.c
> +++ b/newlib/libc/stdio/findfp.c
> @@ -84,6 +84,36 @@ _DEFUN(std, (ptr, flags, file),
> #endif
> }
>
> +static void
> +stdin_init(FILE *ptr)
> +{
> + std (ptr, __SRD, 0);
> +}
> +
> +static void
> +stdout_init(FILE *ptr)
> +{
> + /* On platforms that have true file system I/O, we can verify
> + whether stdout is an interactive terminal or not, as part of
> + __smakebuf on first use of the stream. For all other platforms,
> + we will default to line buffered mode here. Technically, POSIX
> + requires both stdin and stdout to be line-buffered, but tradition
> + leaves stdin alone on systems without fcntl. */
> +#ifdef HAVE_FCNTL
> + std (ptr, __SWR, 1);
> +#else
> + std (ptr, __SWR | __SLBF, 1);
> +#endif
> +}
> +
> +static void
> +stderr_init(FILE *ptr)
> +{
> + /* POSIX requires stderr to be opened for reading and writing, even
> + when the underlying fd 2 is write-only. */
> + std (ptr, __SRW | __SNBF, 2);
> +}
>. +
Perhaps these func should be inline?
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS
2017-06-23 9:23 ` [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS Sebastian Huber
@ 2017-06-23 21:53 ` Freddie Chopin
2017-06-26 5:59 ` Sebastian Huber
0 siblings, 1 reply; 9+ messages in thread
From: Freddie Chopin @ 2017-06-23 21:53 UTC (permalink / raw)
To: newlib
On Fri, 2017-06-23 at 11:22 +0200, Sebastian Huber wrote:
> Introduce a new Newlib configuration option
> _REENT_GLOBAL_STDIO_STREAMS
> to enable the use of global stdio FILE objects. Use this option for
> RTEMS.
Coult this be turned into an option for ./configure script? This seems
like a very useful change for any microcontroller target (like "arm-
none-eabi-"), but if this option can be enabled only by modifications
of the source code, then doing that for a generic case (no specific
RTOS) probably won't be popular.
Thanks in advance!
Regards,
FCh
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS
2017-06-23 21:53 ` Freddie Chopin
@ 2017-06-26 5:59 ` Sebastian Huber
0 siblings, 0 replies; 9+ messages in thread
From: Sebastian Huber @ 2017-06-26 5:59 UTC (permalink / raw)
To: Freddie Chopin, newlib
On 23/06/17 23:53, Freddie Chopin wrote:
> On Fri, 2017-06-23 at 11:22 +0200, Sebastian Huber wrote:
>> Introduce a new Newlib configuration option
>> _REENT_GLOBAL_STDIO_STREAMS
>> to enable the use of global stdio FILE objects. Use this option for
>> RTEMS.
> Coult this be turned into an option for ./configure script? This seems
> like a very useful change for any microcontroller target (like "arm-
> none-eabi-"), but if this option can be enabled only by modifications
> of the source code, then doing that for a generic case (no specific
> RTOS) probably won't be popular.
How safe is it to use configure generated options in header files? For
example during libgcc build, the Newlib configure didn't run yet. For
example:
[...]
make[2]: Entering directory
'/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/libgcc'
# If this is the top-level multilib, build all the other
/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/xgcc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/ -nostdinc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/newlib/
-isystem
/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/sparc-rtems4.12/bin/
-B/opt/rtems-4.12/sparc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/sparc-rtems4.12/include -isystem
/opt/rtems-4.12/sparc-rtems4.12/sys-include -g -O2 -O2
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../newlib/libc/sys/rtems/include
-g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wno-narrowing
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector -Dinhibit_libc -I. -I.
-I../.././gcc -I/home/EB/sebastian_h/archive/gcc-git/libgcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/.
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../gcc
-I/home/EB/sebastian_h/archive/gcc-git/libgcc/../include -DHAVE_CC_TLS
-o _mulsi3_s.o -MT _mulsi3_s.o -MD -MP -MF _mulsi3_s.dep -DSHARED
-DL_mulsi3 -xassembler-with-cpp -c
/home/EB/sebastian_h/archive/gcc-git/libgcc/config/sparc/lb1spc.S
[....]
=== configuring in libc
(/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/libc)
configure: running /bin/sh
/home/EB/sebastian_h/archive/gcc-git/newlib/libc/configure
--disable-option-checking '--prefix=/opt/rtems-4.12'
'--with-multisubdir=soft' '--with-multisrctop=' '--enable-multilib'
'--with-cross-host=x86_64-pc-linux-gnu' '--verbose' '--with-gnu-as'
'--with-gnu-ld' '--with-newlib' '--disable-libstdcxx-pch'
'--disable-nls' '--disable-lto' '--disable-plugin'
'--without-included-gettext' '--disable-win32-registry'
'--enable-version-specific-runtime-libs' '--enable-threads'
'--enable-newlib-iconv'
'--enable-newlib-iconv-encodings=big5,cp775,cp850,cp852,cp855,cp866,euc_jp,euc_kr,euc_tw,iso_8859_1,iso_8859_10,iso_8859_11,iso_8859_13,iso_8859_14,iso_8859_15,iso_8859_2,iso_8859_3,iso_8859_4,iso_8859_5,iso_8859_6,iso_8859_7,iso_8859_8,iso_8859_9,iso_ir_111,koi8_r,koi8_ru,koi8_u,koi8_uni,ucs_2,ucs_2_internal,ucs_2be,ucs_2le,ucs_4,ucs_4_internal,ucs_4be,ucs_4le,us_ascii,utf_16,utf_16be,utf_16le,utf_8,win_1250,win_1251,win_1252,win_1253,win_1254,win_1255,win_1256,win_1257,win_1258'
'--enable-newlib-io-c99-formats' '--enable-libgomp'
'--enable-languages=c,c++'
'--program-transform-name=s&^&sparc-rtems4.12-&'
'--with-target-subdir=sparc-rtems4.12' '--build=x86_64-pc-linux-gnu'
'--host=sparc-rtems4.12' '--target=sparc-rtems4.12'
'build_alias=x86_64-pc-linux-gnu' 'host_alias=sparc-rtems4.12'
'target_alias=sparc-rtems4.12'
'CC=/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/xgcc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/ -nostdinc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/newlib/
-isystem
/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/sparc-rtems4.12/bin/
-B/opt/rtems-4.12/sparc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/sparc-rtems4.12/include -isystem
/opt/rtems-4.12/sparc-rtems4.12/sys-include ' 'CFLAGS=-g -O2'
'LDFLAGS=' 'CPPFLAGS='
'CC=/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/xgcc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/ -nostdinc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/
-isystem
/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/sparc-rtems4.12/bin/
-B/opt/rtems-4.12/sparc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/sparc-rtems4.12/include -isystem
/opt/rtems-4.12/sparc-rtems4.12/sys-include -msoft-float'
'CXX=/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/xg++
-B/build/git-build/b-gcc-git-sparc-rtems4.12/./gcc/ -nostdinc++
-funconfigured-libstdc++-v3
-L/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/libstdc++-v3/src
-L/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/libstdc++-v3/src/.libs
-L/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/libstdc++-v3/libsupc++/.libs
-nostdinc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/
-isystem
/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/sparc-rtems4.12/bin/
-B/opt/rtems-4.12/sparc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/sparc-rtems4.12/include -isystem
/opt/rtems-4.12/sparc-rtems4.12/sys-include -msoft-float' 'F77=
-msoft-float' 'GCJ= -msoft-float' 'GFORTRAN=sparc-rtems4.12-gfortran
-nostdinc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/
-isystem
/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/sparc-rtems4.12/bin/
-B/opt/rtems-4.12/sparc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/sparc-rtems4.12/include -isystem
/opt/rtems-4.12/sparc-rtems4.12/sys-include -msoft-float'
'GOC=sparc-rtems4.12-gccgo -nostdinc
-B/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/
-isystem
/build/git-build/b-gcc-git-sparc-rtems4.12/sparc-rtems4.12/soft/newlib/targ-include
-isystem /home/EB/sebastian_h/archive/gcc-git/newlib/libc/include
-B/opt/rtems-4.12/sparc-rtems4.12/bin/
-B/opt/rtems-4.12/sparc-rtems4.12/lib/ -isystem
/opt/rtems-4.12/sparc-rtems4.12/include -isystem
/opt/rtems-4.12/sparc-rtems4.12/sys-include -msoft-float'
'LD_LIBRARY_PATH=/build/git-build/b-gcc-git-sparc-rtems4.12/./gmp/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./prev-gmp/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./mpfr/src/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./prev-mpfr/src/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./mpc/src/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./prev-mpc/src/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./isl/.libs:/build/git-build/b-gcc-git-sparc-rtems4.12/./prev-isl/.libs'
--cache-file=.././config.cache
--srcdir=/home/EB/sebastian_h/archive/gcc-git/newlib/libc
--
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init()
2017-06-23 14:02 ` Corinna Vinschen
@ 2017-06-26 6:15 ` Sebastian Huber
2017-06-26 6:24 ` Sebastian Huber
0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Huber @ 2017-06-26 6:15 UTC (permalink / raw)
To: newlib
On 23/06/17 16:02, Corinna Vinschen wrote:
>> +static void
>> +stderr_init(FILE *ptr)
>> +{
>> + /* POSIX requires stderr to be opened for reading and writing, even
>> + when the underlying fd 2 is write-only. */
>> + std (ptr, __SRW | __SNBF, 2);
>> +}
>> . +
> Perhaps these func should be inline?
Ok, I change them to "static __inline void".
--
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init()
2017-06-26 6:15 ` Sebastian Huber
@ 2017-06-26 6:24 ` Sebastian Huber
2017-06-26 8:22 ` Corinna Vinschen
0 siblings, 1 reply; 9+ messages in thread
From: Sebastian Huber @ 2017-06-26 6:24 UTC (permalink / raw)
To: newlib
On 26/06/17 08:15, Sebastian Huber wrote:
> On 23/06/17 16:02, Corinna Vinschen wrote:
>
>>> +static void
>>> +stderr_init(FILE *ptr)
>>> +{
>>> + /* POSIX requires stderr to be opened for reading and writing, even
>>> + when the underlying fd 2 is write-only. */
>>> + std (ptr, __SRW | __SNBF, 2);
>>> +}
>>> . +
>> Perhaps these func should be inline?
>
> Ok, I change them to "static __inline void".
Or simply "static inline void"? Is it time to assume at least a C99
compiler for the Newlib sources?
--
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.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init()
2017-06-26 6:24 ` Sebastian Huber
@ 2017-06-26 8:22 ` Corinna Vinschen
0 siblings, 0 replies; 9+ messages in thread
From: Corinna Vinschen @ 2017-06-26 8:22 UTC (permalink / raw)
To: newlib
[-- Attachment #1: Type: text/plain, Size: 941 bytes --]
On Jun 26 08:17, Sebastian Huber wrote:
> On 26/06/17 08:15, Sebastian Huber wrote:
>
> > On 23/06/17 16:02, Corinna Vinschen wrote:
> >
> > > > +static void
> > > > +stderr_init(FILE *ptr)
> > > > +{
> > > > + /* POSIX requires stderr to be opened for reading and writing, even
> > > > + when the underlying fd 2 is write-only. */
> > > > + std (ptr, __SRW | __SNBF, 2);
> > > > +}
> > > > . +
> > > Perhaps these func should be inline?
> >
> > Ok, I change them to "static __inline void".
>
> Or simply "static inline void"? Is it time to assume at least a C99 compiler
> for the Newlib sources?
We're already using inline in the local arc4random header and in a
couple of target dependent files. I guess we can safely assume a C99
compiler should be used for building newlib itself. That doesn't
hold for exported headers, of course.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
Red Hat
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2017-06-26 8:22 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-23 9:23 [PATCH 1/3] Remove superfluous parameter from std() Sebastian Huber
2017-06-23 9:23 ` [PATCH 2/3] Add stdin_init(), stdout_init() and stderr_init() Sebastian Huber
2017-06-23 14:02 ` Corinna Vinschen
2017-06-26 6:15 ` Sebastian Huber
2017-06-26 6:24 ` Sebastian Huber
2017-06-26 8:22 ` Corinna Vinschen
2017-06-23 9:23 ` [PATCH 3/3] Introduce _REENT_GLOBAL_STDIO_STREAMS Sebastian Huber
2017-06-23 21:53 ` Freddie Chopin
2017-06-26 5:59 ` Sebastian Huber
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).