reent.h: _REENT_INIT bug

Engelthaler Jiří Jiri.Engelthaler@zat.cz
Tue Oct 6 10:08:00 GMT 2015


Hi.
  I have found a bug in _REENT_INIT. There are not filled all of items of _reent structure. 
I have file test.c (not test.cpp!)

#include <reent.h>
struct _reent X = _REENT_INIT(X);

After invoking compiler :
gcc -c -Wextra test.c

I got two warnings:
test.c:3:8: warning: missing initializer for field '_h_errno' of 'struct <anonymous>' [-Wmissing-field-initializers]
 struct _reent X = _REENT_INIT(X);
        ^
In file included from /usr/include/reent.h:93:0,
                 from test.c:1:
/usr/include/sys/reent.h:620:8: note: '_h_errno' declared here
    int _h_errno;
        ^
test.c:3:8: warning: missing initializer for field '__sf' of 'struct _reent' [-Wmissing-field-initializers]
 struct _reent X = _REENT_INIT(X);
        ^
In file included from /usr/include/reent.h:93:0,
                 from test.c:1:
/usr/include/sys/reent.h:646:10: note: '__sf' declared here
   __FILE __sf[3];    /* first three file descriptors */
          ^

There is missing initializer for _h_errno and __sf items of _reent structure.
Jiri Engelthaler



More information about the Newlib mailing list