diff options
author | Rich Felker <dalias@aerifal.cx> | 2018-09-12 00:08:09 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2018-09-12 14:34:37 -0400 |
commit | 5ce3737931bb411a8d167356d4d0287b53b0cbdc (patch) | |
tree | 726fc5dde9cc462316faa715158c38f0da72292d /src/stdio | |
parent | 0676c3a34c7bf12b33f8f5efb92476f4ffc7f20e (diff) | |
download | musl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.tar.gz musl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.tar.bz2 musl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.tar.xz musl-5ce3737931bb411a8d167356d4d0287b53b0cbdc.zip |
reduce spurious inclusion of libc.h
libc.h was intended to be a header for access to global libc state and
related interfaces, but ended up included all over the place because
it was the way to get the weak_alias macro. most of the inclusions
removed here are places where weak_alias was needed. a few were
recently introduced for hidden. some go all the way back to when
libc.h defined CANCELPT_BEGIN and _END, and all (wrongly implemented)
cancellation points had to include it.
remaining spurious users are mostly callers of the LOCK/UNLOCK macros
and files that use the LFS64 macro to define the awful *64 aliases.
in a few places, new inclusion of libc.h is added because several
internal headers no longer implicitly include libc.h.
declarations for __lockfile and __unlockfile are moved from libc.h to
stdio_impl.h so that the latter does not need libc.h. putting them in
libc.h made no sense at all, since the macros in stdio_impl.h are
needed to use them correctly anyway.
Diffstat (limited to 'src/stdio')
-rw-r--r-- | src/stdio/__fdopen.c | 1 | ||||
-rw-r--r-- | src/stdio/fclose.c | 2 | ||||
-rw-r--r-- | src/stdio/fgetpos.c | 1 | ||||
-rw-r--r-- | src/stdio/fmemopen.c | 2 | ||||
-rw-r--r-- | src/stdio/fopen.c | 1 | ||||
-rw-r--r-- | src/stdio/freopen.c | 1 | ||||
-rw-r--r-- | src/stdio/fscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/fseek.c | 1 | ||||
-rw-r--r-- | src/stdio/fsetpos.c | 1 | ||||
-rw-r--r-- | src/stdio/ftell.c | 1 | ||||
-rw-r--r-- | src/stdio/fwscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/getdelim.c | 1 | ||||
-rw-r--r-- | src/stdio/open_memstream.c | 2 | ||||
-rw-r--r-- | src/stdio/open_wmemstream.c | 2 | ||||
-rw-r--r-- | src/stdio/scanf.c | 1 | ||||
-rw-r--r-- | src/stdio/sscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/swscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/tmpfile.c | 1 | ||||
-rw-r--r-- | src/stdio/vfprintf.c | 1 | ||||
-rw-r--r-- | src/stdio/vfwprintf.c | 1 | ||||
-rw-r--r-- | src/stdio/vfwscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/vscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/vsscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/vswprintf.c | 1 | ||||
-rw-r--r-- | src/stdio/vswscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/vwscanf.c | 1 | ||||
-rw-r--r-- | src/stdio/wscanf.c | 1 |
27 files changed, 19 insertions, 12 deletions
diff --git a/src/stdio/__fdopen.c b/src/stdio/__fdopen.c index 8d6ce813..116e78e5 100644 --- a/src/stdio/__fdopen.c +++ b/src/stdio/__fdopen.c @@ -4,6 +4,7 @@ #include <fcntl.h> #include <errno.h> #include <string.h> +#include "libc.h" FILE *__fdopen(int fd, const char *mode) { diff --git a/src/stdio/fclose.c b/src/stdio/fclose.c index c675413d..889b96d2 100644 --- a/src/stdio/fclose.c +++ b/src/stdio/fclose.c @@ -1,5 +1,5 @@ #include "stdio_impl.h" -#include "libc.h" +#include <stdlib.h> static void dummy(FILE *f) { } weak_alias(dummy, __unlist_locked_file); diff --git a/src/stdio/fgetpos.c b/src/stdio/fgetpos.c index 6eb361e1..6b45f57f 100644 --- a/src/stdio/fgetpos.c +++ b/src/stdio/fgetpos.c @@ -1,4 +1,5 @@ #include "stdio_impl.h" +#include "libc.h" int fgetpos(FILE *restrict f, fpos_t *restrict pos) { diff --git a/src/stdio/fmemopen.c b/src/stdio/fmemopen.c index 5e0eeb50..82413b2d 100644 --- a/src/stdio/fmemopen.c +++ b/src/stdio/fmemopen.c @@ -1,7 +1,9 @@ #include "stdio_impl.h" #include <errno.h> #include <string.h> +#include <stdlib.h> #include <inttypes.h> +#include "libc.h" struct cookie { size_t pos, len, size; diff --git a/src/stdio/fopen.c b/src/stdio/fopen.c index 252f0824..2a20c7f2 100644 --- a/src/stdio/fopen.c +++ b/src/stdio/fopen.c @@ -2,6 +2,7 @@ #include <fcntl.h> #include <string.h> #include <errno.h> +#include "libc.h" FILE *fopen(const char *restrict filename, const char *restrict mode) { diff --git a/src/stdio/freopen.c b/src/stdio/freopen.c index a9c83c85..6d6d21d2 100644 --- a/src/stdio/freopen.c +++ b/src/stdio/freopen.c @@ -1,6 +1,7 @@ #include "stdio_impl.h" #include <fcntl.h> #include <unistd.h> +#include "libc.h" /* The basic idea of this implementation is to open a new FILE, * hack the necessary parts of the new FILE into the old one, then diff --git a/src/stdio/fscanf.c b/src/stdio/fscanf.c index acb8a106..f639e118 100644 --- a/src/stdio/fscanf.c +++ b/src/stdio/fscanf.c @@ -1,6 +1,5 @@ #include <stdio.h> #include <stdarg.h> -#include "libc.h" int fscanf(FILE *restrict f, const char *restrict fmt, ...) { diff --git a/src/stdio/fseek.c b/src/stdio/fseek.c index b160b74e..26d9f7ef 100644 --- a/src/stdio/fseek.c +++ b/src/stdio/fseek.c @@ -1,4 +1,5 @@ #include "stdio_impl.h" +#include "libc.h" int __fseeko_unlocked(FILE *f, off_t off, int whence) { diff --git a/src/stdio/fsetpos.c b/src/stdio/fsetpos.c index 6310424e..cea5ddbb 100644 --- a/src/stdio/fsetpos.c +++ b/src/stdio/fsetpos.c @@ -1,4 +1,5 @@ #include "stdio_impl.h" +#include "libc.h" int fsetpos(FILE *f, const fpos_t *pos) { diff --git a/src/stdio/ftell.c b/src/stdio/ftell.c index bb62897a..aad352bd 100644 --- a/src/stdio/ftell.c +++ b/src/stdio/ftell.c @@ -1,6 +1,7 @@ #include "stdio_impl.h" #include <limits.h> #include <errno.h> +#include "libc.h" off_t __ftello_unlocked(FILE *f) { diff --git a/src/stdio/fwscanf.c b/src/stdio/fwscanf.c index cb114b39..530bb7c7 100644 --- a/src/stdio/fwscanf.c +++ b/src/stdio/fwscanf.c @@ -1,7 +1,6 @@ #include <stdio.h> #include <stdarg.h> #include <wchar.h> -#include "libc.h" int fwscanf(FILE *restrict f, const wchar_t *restrict fmt, ...) { diff --git a/src/stdio/getdelim.c b/src/stdio/getdelim.c index d4b23882..26a56780 100644 --- a/src/stdio/getdelim.c +++ b/src/stdio/getdelim.c @@ -1,5 +1,6 @@ #include "stdio_impl.h" #include <string.h> +#include <stdlib.h> #include <inttypes.h> #include <errno.h> diff --git a/src/stdio/open_memstream.c b/src/stdio/open_memstream.c index 40f5ad60..600d2770 100644 --- a/src/stdio/open_memstream.c +++ b/src/stdio/open_memstream.c @@ -2,6 +2,8 @@ #include <errno.h> #include <limits.h> #include <string.h> +#include <stdlib.h> +#include "libc.h" struct cookie { char **bufp; diff --git a/src/stdio/open_wmemstream.c b/src/stdio/open_wmemstream.c index a7c3a645..ed1b561d 100644 --- a/src/stdio/open_wmemstream.c +++ b/src/stdio/open_wmemstream.c @@ -3,6 +3,8 @@ #include <errno.h> #include <limits.h> #include <string.h> +#include <stdlib.h> +#include "libc.h" struct cookie { wchar_t **bufp; diff --git a/src/stdio/scanf.c b/src/stdio/scanf.c index a740056c..bd77699c 100644 --- a/src/stdio/scanf.c +++ b/src/stdio/scanf.c @@ -1,6 +1,5 @@ #include <stdio.h> #include <stdarg.h> -#include "libc.h" int scanf(const char *restrict fmt, ...) { diff --git a/src/stdio/sscanf.c b/src/stdio/sscanf.c index 8a2302ff..f2ac2f5d 100644 --- a/src/stdio/sscanf.c +++ b/src/stdio/sscanf.c @@ -1,6 +1,5 @@ #include <stdio.h> #include <stdarg.h> -#include "libc.h" int sscanf(const char *restrict s, const char *restrict fmt, ...) { diff --git a/src/stdio/swscanf.c b/src/stdio/swscanf.c index d893fbac..03d572da 100644 --- a/src/stdio/swscanf.c +++ b/src/stdio/swscanf.c @@ -1,6 +1,5 @@ #include <stdarg.h> #include <wchar.h> -#include "libc.h" int swscanf(const wchar_t *restrict s, const wchar_t *restrict fmt, ...) { diff --git a/src/stdio/tmpfile.c b/src/stdio/tmpfile.c index 55d742fa..7013f645 100644 --- a/src/stdio/tmpfile.c +++ b/src/stdio/tmpfile.c @@ -2,6 +2,7 @@ #include <fcntl.h> #include <stdlib.h> #include "stdio_impl.h" +#include "libc.h" #define MAXTRIES 100 diff --git a/src/stdio/vfprintf.c b/src/stdio/vfprintf.c index 2100eb5e..9b961e7f 100644 --- a/src/stdio/vfprintf.c +++ b/src/stdio/vfprintf.c @@ -5,6 +5,7 @@ #include <string.h> #include <stdarg.h> #include <stddef.h> +#include <stdlib.h> #include <wchar.h> #include <inttypes.h> #include <math.h> diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c index 9d774fcc..0adf0b7a 100644 --- a/src/stdio/vfwprintf.c +++ b/src/stdio/vfwprintf.c @@ -5,6 +5,7 @@ #include <string.h> #include <stdarg.h> #include <stddef.h> +#include <stdlib.h> #include <wchar.h> #include <inttypes.h> diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c index a7cd0923..7be66344 100644 --- a/src/stdio/vfwscanf.c +++ b/src/stdio/vfwscanf.c @@ -11,7 +11,6 @@ #include "shgetc.h" #include "intscan.h" #include "floatscan.h" -#include "libc.h" #define SIZE_hh -2 #define SIZE_h -1 diff --git a/src/stdio/vscanf.c b/src/stdio/vscanf.c index 43892f01..9d46ab09 100644 --- a/src/stdio/vscanf.c +++ b/src/stdio/vscanf.c @@ -1,6 +1,5 @@ #include <stdio.h> #include <stdarg.h> -#include "libc.h" int vscanf(const char *restrict fmt, va_list ap) { diff --git a/src/stdio/vsscanf.c b/src/stdio/vsscanf.c index 929ffa3b..98500225 100644 --- a/src/stdio/vsscanf.c +++ b/src/stdio/vsscanf.c @@ -1,5 +1,4 @@ #include "stdio_impl.h" -#include "libc.h" static size_t do_read(FILE *f, unsigned char *buf, size_t len) { diff --git a/src/stdio/vswprintf.c b/src/stdio/vswprintf.c index 38efed65..7f98c5c9 100644 --- a/src/stdio/vswprintf.c +++ b/src/stdio/vswprintf.c @@ -2,6 +2,7 @@ #include <limits.h> #include <errno.h> #include <stdint.h> +#include <stdlib.h> #include <wchar.h> struct cookie { diff --git a/src/stdio/vswscanf.c b/src/stdio/vswscanf.c index 411dd39c..00b614bc 100644 --- a/src/stdio/vswscanf.c +++ b/src/stdio/vswscanf.c @@ -1,5 +1,4 @@ #include "stdio_impl.h" -#include "libc.h" #include <wchar.h> static size_t wstring_read(FILE *f, unsigned char *buf, size_t len) diff --git a/src/stdio/vwscanf.c b/src/stdio/vwscanf.c index 63c9cce1..5a3931e1 100644 --- a/src/stdio/vwscanf.c +++ b/src/stdio/vwscanf.c @@ -1,7 +1,6 @@ #include <stdio.h> #include <stdarg.h> #include <wchar.h> -#include "libc.h" int vwscanf(const wchar_t *restrict fmt, va_list ap) { diff --git a/src/stdio/wscanf.c b/src/stdio/wscanf.c index 80412252..4dfec25d 100644 --- a/src/stdio/wscanf.c +++ b/src/stdio/wscanf.c @@ -1,7 +1,6 @@ #include <stdio.h> #include <stdarg.h> #include <wchar.h> -#include "libc.h" int wscanf(const wchar_t *restrict fmt, ...) { |