Skip to content

Commit 4e3b01b

Browse files
committed
stdio: Switch legacy stdio config defines to __
Signed-off-by: Keith Packard <[email protected]>
1 parent 9e1d8d0 commit 4e3b01b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+198
-205
lines changed

CMakeLists.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ endif()
118118

119119
set(_ATEXIT_DYNAMIC_ALLOC 0)
120120

121-
set(_FSEEK_OPTIMIZATION 0)
121+
set(__FSEEK_OPTIMIZATION 0)
122122

123-
set(_FVWRITE_IN_STREAMIO 0)
123+
set(__FVWRITE_IN_STREAMIO 0)
124124

125125
# Use bitfields in packed structs
126126
picolibc_flag(__HAVE_BITFIELDS_IN_PACKED_STRUCTS)
@@ -189,13 +189,13 @@ if(NOT DEFINED __MB_EXTENDED_CHARSETS_JIS)
189189
option(__MB_EXTENDED_CHARSETS_JIS "Enable JIS multibyte encodings" OFF)
190190
endif()
191191

192-
set(_NANO_FORMATTED_IO OFF)
192+
set(__NANO_FORMATTED_IO OFF)
193193

194194
option(__NANO_MALLOC "Use smaller malloc implementation" ON)
195195

196196
set(_GLOBAL_ATEXIT OFF)
197197

198-
set(_UNBUF_STREAM_OPT OFF)
198+
set(__UNBUF_STREAM_OPT OFF)
199199

200200
if(NOT DEFINED __IO_C99_FORMATS)
201201
option(__IO_C99_FORMATS "Support C99 formats in printf/scanf" ON)
@@ -271,10 +271,10 @@ set(__MATH_ERRNO OFF)
271271

272272
set(_WANT_REGISTER_FINI OFF)
273273

274-
set(_WIDE_ORIENT OFF)
274+
set(__WIDE_ORIENT OFF)
275275

276-
if(NOT DEFINED _ELIX_LEVEL)
277-
set(_ELIX_LEVEL 4)
276+
if(NOT DEFINED __ELIX_LEVEL)
277+
set(__ELIX_LEVEL 4)
278278
endif()
279279

280280
# Use old math code for double funcs (0 no, 1 yes)

meson.build

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,6 @@ if tinystdio and printf_aliases
435435
endif
436436

437437
# A bunch of newlib-stdio only options
438-
newlib_global_stdio_streams = get_option('newlib-global-stdio-streams')
439438
newlib_fvwrite_in_streamio = get_option('newlib-fvwrite-in-streamio')
440439
newlib_fseek_optimization = get_option('newlib-fseek-optimization')
441440
newlib_nano_formatted_io = get_option('newlib-nano-formatted-io')
@@ -451,9 +450,6 @@ if tinystdio
451450
if newlib_io_float
452451
error('tinystdio uses a run-time mechanism to select floating point io (newlib-io-float)')
453452
endif
454-
if newlib_global_stdio_streams
455-
error('tinystdio always has (reentrant) global stdio streams (newlib-global-stdio-streams)')
456-
endif
457453
if newlib_fvwrite_in_streamio
458454
error('tinystdio has no fvwrite support (newlib-fvwrite-in-streamio)')
459455
endif
@@ -1418,16 +1414,15 @@ if tinystdio
14181414
atomic_ungetc,
14191415
description: 'Use atomics for fgetc/ungetc for re-entrancy')
14201416
else
1421-
conf_data.set('NO_FLOATING_POINT', not newlib_io_float)
1422-
conf_data.set('FLOATING_POINT', newlib_io_float)
1423-
conf_data.set('_WANT_REENT_GLOBAL_STDIO_STREAMS', newlib_global_stdio_streams)
1417+
conf_data.set('__IO_NO_FLOATING_POINT', not newlib_io_float)
1418+
conf_data.set('__IO_FLOATING_POINT', newlib_io_float)
14241419
conf_data.set('__LARGE64_FILES', newlib_stdio64)
1425-
conf_data.set('_ELIX_LEVEL', newlib_elix_level)
1426-
conf_data.set('_FVWRITE_IN_STREAMIO', newlib_fvwrite_in_streamio)
1427-
conf_data.set('_FSEEK_OPTIMIZATION', newlib_fseek_optimization)
1428-
conf_data.set('_WIDE_ORIENT', newlib_wide_orient)
1429-
conf_data.set('_UNBUF_STREAM_OPT', get_option('newlib-unbuf-stream-opt'))
1430-
conf_data.set('_NANO_FORMATTED_IO', newlib_nano_formatted_io)
1420+
conf_data.set('__ELIX_LEVEL', newlib_elix_level)
1421+
conf_data.set('__FVWRITE_IN_STREAMIO', newlib_fvwrite_in_streamio)
1422+
conf_data.set('__FSEEK_OPTIMIZATION', newlib_fseek_optimization)
1423+
conf_data.set('__WIDE_ORIENT', newlib_wide_orient)
1424+
conf_data.set('__UNBUF_STREAM_OPT', get_option('newlib-unbuf-stream-opt'))
1425+
conf_data.set('__NANO_FORMATTED_IO', newlib_nano_formatted_io)
14311426
endif
14321427

14331428
if enable_picocrt

meson_options.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -176,8 +176,6 @@ option('newlib-fseek-optimization', type: 'boolean', value: false,
176176
description: 'enable fseek optimization')
177177
option('newlib-fvwrite-in-streamio', type: 'boolean', value: false,
178178
description: 'disable iov in streamio')
179-
option('newlib-global-stdio-streams', type: 'boolean', value: false,
180-
description: 'enable global stdio streams')
181179
option('newlib-io-float', type: 'boolean', value: false,
182180
description: 'enable printf/scanf family float support')
183181
option('newlib-nano-formatted-io', type: 'boolean', value: false,

newlib/ChangeLog-2015

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1717,17 +1717,17 @@ summary.
17171717
2014-07-04 Bin Cheng <[email protected]>
17181718

17191719
* README (--enable-newlib-nano-formatted-io): Describe.
1720-
* acconfig.h (_NANO_FORMATTED_IO): Undef.
1721-
* newlib.hin (_NANO_FORMATTED_IO): Undef.
1720+
* acconfig.h (__NANO_FORMATTED_IO): Undef.
1721+
* newlib.hin (__NANO_FORMATTED_IO): Undef.
17221722
* configure.in (--enable-newlib-nano-formatted-io): New option.
17231723
* configure: Regenerated.
17241724
* libc/configure.in (--enable-newlib-nano-formatted-io): New option.
17251725
* libc/configure: Regenerated.
1726-
* libc/stdio/Makefile.am (NEWLIB_NANO_FORMATTED_IO): Support new
1726+
* libc/stdio/Makefile.am (NEWLIB__NANO_FORMATTED_IO): Support new
17271727
configuration option.
17281728
* libc/stdio/Makefile.in: Regenerated.
17291729
* libc/stdio/asnprintf.c (_asniprintf_r, asniprintf): Use
1730-
_NANO_FORMATTED_IO to declare alias prototypes.
1730+
__NANO_FORMATTED_IO to declare alias prototypes.
17311731
* libc/stdio/asprintf.c (_asiprintf_r, asiprintf): Ditto.
17321732
* libc/stdio/dprintf.c (_diprintf_r, diprintf): Ditto.
17331733
* libc/stdio/fprintf.c (_fiprintf_r, fiprintf): Ditto.
@@ -2783,8 +2783,8 @@ summary.
27832783

27842784
2013-06-19 Bin Cheng <[email protected]>
27852785

2786-
* acconfig.h (_UNBUF_STREAM_OPT): Undefine.
2787-
* newlib.hin (_UNBUF_STREAM_OPT): Undefine.
2786+
* acconfig.h (__UNBUF_STREAM_OPT): Undefine.
2787+
* newlib.hin (__UNBUF_STREAM_OPT): Undefine.
27882788
* configure.in (--enable-newlib-unbuf-stream-opt): New option.
27892789
* configure: Regenerate.
27902790
* libc/stdio/vfprintf.c (_VFPRINTF_R): Don't do optimization on
@@ -3109,11 +3109,11 @@ summary.
31093109

31103110
2013-04-10 Bin Cheng <[email protected]>
31113111

3112-
* acconfig.h (_FSEEK_OPTIMIZATION): Undef
3113-
* newlib.hin (_FSEEK_OPTIMIZATION): Undef
3112+
* acconfig.h (__FSEEK_OPTIMIZATION): Undef
3113+
* newlib.hin (__FSEEK_OPTIMIZATION): Undef
31143114
* configure.in (--disable-newlib-fseek-optimization): New option.
31153115
* configure: Regenerated.
3116-
* libc/stdio/fflush.c (__sflush_r): Use _FSEEK_OPTIMIZATION to
3116+
* libc/stdio/fflush.c (__sflush_r): Use __FSEEK_OPTIMIZATION to
31173117
control fseek optimization.
31183118
* libc/stdio/fseeko.c (_fseeko_r): Ditto.
31193119
* libc/stdio/makebuf.c (__smakebuf_r): Ditto.
@@ -3130,19 +3130,19 @@ summary.
31303130

31313131
2013-03-27 Bin Cheng <[email protected]>
31323132

3133-
* acconfig.h (_FVWRITE_IN_STREAMIO): Undefine.
3134-
* newlib.hin (_FVWRITE_IN_STREAMIO): Undefine.
3133+
* acconfig.h (__FVWRITE_IN_STREAMIO): Undefine.
3134+
* newlib.hin (__FVWRITE_IN_STREAMIO): Undefine.
31353135
* configure.in (--disable-newlib-fvwrite-in-streamio): New option.
31363136
* configure: Regenerated.
3137-
* libc/stdio/fputs.c (_fputs_r): Use _FVWRITE_IN_STREAMIO to
3137+
* libc/stdio/fputs.c (_fputs_r): Use __FVWRITE_IN_STREAMIO to
31383138
control __sfvwrite_r. Add alternative implementation.
31393139
* libc/stdio/fputws.c (_fputws_r): Ditto.
31403140
* libc/stdio/fwrite.c (_fwrite_r): Ditto.
31413141
* libc/stdio/puts.c (_puts_r): Ditto.
31423142
* libc/stdio/vfprintf.c (__ssputs_r, __sfputs_r): New function.
3143-
(_VFPRINTF_R): Use _FVWRITE_IN_STREAMIO to control vector buffer.
3144-
(__SPRINT): Use _FVWRITE_IN_STREAMIO to control macro definition.
3145-
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use _FVWRITE_IN_STREAMIO
3143+
(_VFPRINTF_R): Use __FVWRITE_IN_STREAMIO to control vector buffer.
3144+
(__SPRINT): Use __FVWRITE_IN_STREAMIO to control macro definition.
3145+
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use __FVWRITE_IN_STREAMIO
31463146
to control vector buffer.
31473147

31483148
2013-03-26 Sebastian Huber <[email protected]>
@@ -3586,7 +3586,7 @@ summary.
35863586
2012-08-10 Corinna Vinschen <[email protected]>
35873587

35883588
* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Fix guard around state to
3589-
allow usage in !FLOATING_POINT && __IO_C99_FORMATS case.
3589+
allow usage in !__IO_FLOATING_POINT && __IO_C99_FORMATS case.
35903590

35913591
2012-08-08 Eric Blake <[email protected]>
35923592

@@ -10307,7 +10307,7 @@ summary.
1030710307
2007-05-23 Eric Blake <[email protected]>
1030810308

1030910309
* libc/stdio/vfscanf.c (__SVFSCANF_R): Support scanf(%1$s).
10310-
Avoid warning when !FLOATING_POINT.
10310+
Avoid warning when !__IO_FLOATING_POINT.
1031110311
* libc/stdio/vfprintf.c (_VFPRINTF_R): Simplify _NO_POS_ARGS
1031210312
slightly.
1031310313

@@ -13483,7 +13483,7 @@ summary.
1348313483

1348413484
2004-08-16 Nathan Sidwell <[email protected]>
1348513485

13486-
* libc/stdio/vfscanf.c (_NO_LONGLONG): Move out of FLOATING_POINT
13486+
* libc/stdio/vfscanf.c (_NO_LONGLONG): Move out of __IO_FLOATING_POINT
1348713487
#if.
1348813488

1348913489
2004-08-12 Jeff Johnston <[email protected]>
@@ -14626,7 +14626,7 @@ summary.
1462614626
* iconvdata/Makefile.am: Make dependent on newlib's configure.host
1462714627
and set up default flags to pass to aclocal.
1462814628
* iconvdata/Makefile.in: Regenerated.
14629-
* libc/sys/linux/Makefile.am: Add _ELIX_LEVEL_4 getlogin, getpwnam,
14629+
* libc/sys/linux/Makefile.am: Add __ELIX_LEVEL_4 getlogin, getpwnam,
1463014630
and getpwuid routines.
1463114631
* libc/sys/linux/Makefile.in: Regenerated.
1463214632
* libc/sys/linux/getlogin.c: New stub file to allow x86-linux
@@ -14637,7 +14637,7 @@ summary.
1463714637
that were formerly supplied by /usr/include/linux/types.h with
1463814638
kernel types.
1463914639
* testsuite/newlib.wctype/twctype.c: Fix testcase to properly
14640-
test _ELIX_LEVEL macro.
14640+
test __ELIX_LEVEL macro.
1464114641

1464214642
2003-11-07 Jeff Johnston <[email protected]>
1464314643

@@ -14848,7 +14848,7 @@ summary.
1484814848

1484914849
2003-09-04 Ben Elliston <[email protected]>
1485014850

14851-
* libc/stdlib/mstats.c[_ELIX_LEVEL]: Fix guards. #ifndef FOO ||
14851+
* libc/stdlib/mstats.c[__ELIX_LEVEL]: Fix guards. #ifndef FOO ||
1485214852
FOO >= 2 is invalid; use #if !defined (FOO) || FOO >= 2 instead.
1485314853

1485414854
2003-09-02 Thomas Pfaff <[email protected]>
@@ -16767,14 +16767,14 @@ Thu Apr 3 14:01:16 2003 J"orn Rennecke <[email protected]>
1676716767

1676816768
2002-08-27 Jeff Johnston <[email protected]>
1676916769

16770-
* configure.host: Remove _ELIX_LEVEL flag setting.
16770+
* configure.host: Remove __ELIX_LEVEL flag setting.
1677116771
* Makefile.am(stmp-targ-include): Copy newlib.h to targ-include.
1677216772
(install-data-local): Install newlib.h.
1677316773
* Makefile.in: Regenerated.
1677416774
* aclocal.m4: Ditto.
1677516775
* configure: Ditto.
1677616776
* configure.in: Add AM_CONFIG_HEADER to generate newlib.h based on
16777-
newlib.hin. Add AC_DEFINE_UNQUOTED entries for _ELIX_LEVEL
16777+
newlib.hin. Add AC_DEFINE_UNQUOTED entries for __ELIX_LEVEL
1677816778
and _NEWLIB_VERSION to fill in newlib.h header file entries.
1677916779
In AC_OUTPUT statement, unset ac_file so multilib support does
1678016780
not use last ac_file temporary used in newlib.h configuration.
@@ -16793,7 +16793,7 @@ Thu Apr 3 14:01:16 2003 J"orn Rennecke <[email protected]>
1679316793
* acinclude.m4: Add support for --enable-newlib-elix-level option.
1679416794
* aclocal.m4: Regenerated.
1679516795
* configure: Ditto.
16796-
* configure.host: Add code to define _ELIX_LEVEL if
16796+
* configure.host: Add code to define __ELIX_LEVEL if
1679716797
--enable-newlib-elix-level option is used.
1679816798
* configure.in:
1679916799
* libc/aclocal.m4: Regenerated.
@@ -18957,16 +18957,16 @@ Wed Mar 6 10:24:26 2002 J"orn Rennecke <[email protected]>
1895718957
2002-02-27 Jeff Johnston <[email protected]>
1895818958

1895918959
* configure.host: Add check for --disable-newlib-io-float
18960-
configuration option and add -DNO_FLOATING_POINT to newlib cflags
18960+
configuration option and add -D__IO_NO_FLOATING_POINT to newlib cflags
1896118961
if appropriate.
1896218962
* acinclude.m4: Added --disable-newlib-io-float option.
1896318963
* aclocal.m4: Regenerated.
1896418964
* configure: Ditto.
1896518965
* doc/aclocal.m4 doc/configure libc/aclocal.m4 libc/configure
1896618966
* libc/*/aclocal.m4 libc/*/configure
1896718967
* libm/*/aclocal.m4 libm/*/configure: Ditto.
18968-
* libc/stdio/vfprintf.c [!INTEGER_ONLY]: Only set FLOATING_POINT
18969-
if NO_FLOATING_POINT flag is not defined.
18968+
* libc/stdio/vfprintf.c [!INTEGER_ONLY]: Only set __IO_FLOATING_POINT
18969+
if __IO_NO_FLOATING_POINT flag is not defined.
1897018970

1897118971
2002-02-25 Jeff Johnston <[email protected]>
1897218972

newlib/libc/stdio/fflush.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ _sflush (
111111
flags = fp->_flags;
112112
if ((flags & __SWR) == 0)
113113
{
114-
#ifdef _FSEEK_OPTIMIZATION
114+
#ifdef __FSEEK_OPTIMIZATION
115115
/* For a read stream, an fflush causes the next seek to be
116116
unoptimized (i.e. forces a system-level seek). This conforms
117117
to the POSIX and SUSv3 standards. */
@@ -185,7 +185,7 @@ _sflush (
185185
{
186186
/* Seek successful or ignorable error condition.
187187
We can clear read buffer now. */
188-
#ifdef _FSEEK_OPTIMIZATION
188+
#ifdef __FSEEK_OPTIMIZATION
189189
fp->_flags &= ~__SNPT;
190190
#endif
191191
fp->_r = 0;

newlib/libc/stdio/fputs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ fputs (
9090
char const *__restrict s,
9191
FILE *__restrict fp)
9292
{
93-
#ifdef _FVWRITE_IN_STREAMIO
93+
#ifdef __FVWRITE_IN_STREAMIO
9494
int result;
9595
struct __suio uio;
9696
struct __siov iov;

newlib/libc/stdio/fputws.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fputws (
9999
{
100100
size_t nbytes;
101101
char buf[BUFSIZ];
102-
#ifdef _FVWRITE_IN_STREAMIO
102+
#ifdef __FVWRITE_IN_STREAMIO
103103
struct __suio uio;
104104
struct __siov iov;
105105

newlib/libc/stdio/fseeko.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fseeko (
9898
int whence)
9999
{
100100
_fpos_t (*seekfn) (void *, _fpos_t, int);
101-
#ifdef _FSEEK_OPTIMIZATION
101+
#ifdef __FSEEK_OPTIMIZATION
102102
_fpos_t target;
103103
size_t n;
104104
#ifdef __USE_INTERNAL_STAT64
@@ -198,7 +198,7 @@ fseeko (
198198
if (fp->_bf._base == NULL)
199199
_smakebuf ( fp);
200200

201-
#ifdef _FSEEK_OPTIMIZATION
201+
#ifdef __FSEEK_OPTIMIZATION
202202
if (fp->_flags & (__SWR | __SRW | __SNBF | __SNPT))
203203
goto dumb;
204204
if ((fp->_flags & __SOPT) == 0)

newlib/libc/stdio/fwrite.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fwrite (
115115
FILE * __restrict fp)
116116
{
117117
size_t n;
118-
#ifdef _FVWRITE_IN_STREAMIO
118+
#ifdef __FVWRITE_IN_STREAMIO
119119
struct __suio uio;
120120
struct __siov iov;
121121

newlib/libc/stdio/local.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ extern void (*_stdio_cleanup)(void);
225225
#define FREELB(ptr, fp) { free((char *)(fp)->_lb._base); \
226226
(fp)->_lb._base = NULL; }
227227

228-
#ifdef _WIDE_ORIENT
228+
#ifdef __WIDE_ORIENT
229229
/*
230230
* Set the orientation for a stream. If o > 0, the stream has wide-
231231
* orientation. If o < 0, the stream has byte-orientation.
@@ -353,7 +353,7 @@ extern const __CH_CLASS __chclass[256];
353353
extern const __STATE __state_table[MAX_STATE][MAX_CH_CLASS];
354354
extern const __ACTION __action_table[MAX_STATE][MAX_CH_CLASS];
355355

356-
#if defined(_NANO_FORMATTED_IO) && defined(__strong_reference)
356+
#if defined(__NANO_FORMATTED_IO) && defined(__strong_reference)
357357
#define __nano_reference(a,b) __strong_reference(a,b)
358358
#else
359359
#define __nano_reference(a,b)

0 commit comments

Comments
 (0)