Mercurial > gnulib
annotate modules/stdlib @ 12766:2c14f1e449e5
warn-on-use: use instead of link-warning
Each *.in.h file serves two purposes - provide enough self-contained
content to serve as a replacement for the system header regardless of
the user's compiler, and offer the developer the ability to detect any
gnulib modules that might have been inadvertantly excluded. The
former requires independence from config.h, and routes everything
through a Makefile.am snippet that uses @@ substitution specific to
the modules that were in use, with details learned at configure time.
The latter works by poisoning anything that gnulib did not replace,
but which the developer had natively available, explaining why their
tests passed during development. Poisoning relies on gcc features,
and requires manual triggering by adding -DGNULIB_POSIXCHECK to
CFLAGS; it assumes that <config.h> is properly included. In fact, we
do not want to use @@ substitution for HAVE_DECL_* during poisoning,
because the warning is only relevant for the gnulib modules which were
not included, and thus where the m4 macros to set proper @@ values
have not been run. Furthermore, we only need to poison interfaces
that already have a declaration; if something is not declared, then
the developer wouldn't have been able to link, so their code won't be
using the problematic interface in the first place.
* modules/stdio (Depends-on, Makefile.am): Drop link-warning.
* modules/unistd (Depends-on, Makefile.am): Likewise.
* modules/arpa_inet (Depends-on): Replace link-warning with
warn-on-use.
(Makefile.am): Update rules accordingly.
* modules/ctype (Depends-on, Makefile.am): Likewise.
* modules/dirent (Depends-on, Makefile.am): Likewise.
* modules/fcntl-h (Depends-on, Makefile.am): Likewise.
* modules/inttypes (Depends-on, Makefile.am): Likewise.
* modules/langinfo (Depends-on, Makefile.am): Likewise.
* modules/locale (Depends-on, Makefile.am): Likewise.
* modules/math (Depends-on, Makefile.am): Likewise.
* modules/search (Depends-on, Makefile.am): Likewise.
* modules/signal (Depends-on, Makefile.am): Likewise.
* modules/spawn (Depends-on, Makefile.am): Likewise.
* modules/stdlib (Depends-on, Makefile.am): Likewise.
* modules/string (Depends-on, Makefile.am): Likewise.
* modules/strings (Depends-on, Makefile.am): Likewise.
* modules/sys_file (Depends-on, Makefile.am): Likewise.
* modules/sys_ioctl (Depends-on, Makefile.am): Likewise.
* modules/sys_select (Depends-on, Makefile.am): Likewise.
* modules/sys_socket (Depends-on, Makefile.am): Likewise.
* modules/sys_stat (Depends-on, Makefile.am): Likewise.
* modules/sys_times (Depends-on, Makefile.am): Likewise.
* modules/sys_utsname (Depends-on, Makefile.am): Likewise.
* modules/wchar (Depends-on, Makefile.am): Likewise.
* m4/arpa_inet_h.m4 (gl_HEADER_ARPA_INET): Check which functions
should be poisoned.
* m4/ctype.m4 (gl_CTYPE_H): Likewise.
* m4/dirent_h.m4 (gl_DIRENT_H): Likewise.
* m4/fcntl_h.m4 (gl_FCNTL_H): Likewise.
* m4/inttypes.m4 (gl_INTTYPES_H): Likewise.
* m4/langinfo_h.m4 (gl_LANGINFO_H): Likewise.
* m4/locale_h.m4 (gl_LOCALE_H): Likewise.
* m4/math_h.m4 (gl_MATH_H): Likewise.
* m4/search_h.m4 (gl_SEARCH_H): Likewise.
* m4/signal_h.m4 (gl_SIGNAL_H): Likewise.
* m4/spawn_h.m4 (gl_SPAWN_H): Likewise.
* m4/stdio_h.m4 (gl_STDIO_H): Likewise.
* m4/stdlib_h.m4 (gl_STDLIB_H): Likewise.
* m4/string_h.m4 (gl_HEADER_STRING_H_BODY): Likewise.
* m4/strings_h.m4 (gl_HEADER_STRINGS_H_BODY): Likewise.
* m4/sys_file_h.m4 (gl_HEADER_SYS_FILE_H_DEFAULTS): Likewise.
* m4/sys_ioctl_h.m4 (gl_SYS_IOCTL_H): Likewise.
* m4/sys_select_h.m4 (gl_HEADER_SYS_SELECT): Likewise.
* m4/sys_socket_h.m4 (gl_HEADER_SYS_SOCKET): Likewise.
* m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise.
* m4/sys_times_h.m4 (gl_SYS_TIMES_H): Likewise.
* m4/sys_utsname_h.m4 (gl_SYS_UTSNAME_H): Likewise.
* m4/unistd_h.m4 (gl_UNISTD_H): Likewise.
* m4/wchar.m4 (gl_WCHAR_H): Likewise.
* lib/arpa_inet.in.h: Use _GL_WARN_ON_USE instead of
GL_LINK_WARNING.
* lib/ctype.in.h: Likewise.
* lib/dirent.in.h: Likewise.
* lib/fcntl.in.h: Likewise.
* lib/inttypes.in.h: Likewise.
* lib/langinfo.in.h: Likewise.
* lib/locale.in.h: Likewise.
* lib/math.in.h: Likewise.
* lib/search.in.h: Likewise.
* lib/signal.in.h: Likewise.
* lib/spawn.in.h: Likewise.
* lib/stdio.in.h: Likewise.
* lib/stdlib.in.h: Likewise.
* lib/string.in.h: Likewise.
* lib/strings.in.h: Likewise.
* lib/sys_file.in.h: Likewise.
* lib/sys_ioctl.in.h: Likewise.
* lib/sys_select.in.h: Likewise.
* lib/sys_socket.in.h: Likewise.
* lib/sys_stat.in.h: Likewise.
* lib/sys_times.in.h: Likewise.
* lib/sys_utsname.in.h: Likewise.
* lib/unistd.in.h: Likewise.
* lib/wchar.in.h: Likewise.
Signed-off-by: Eric Blake <ebb9@byu.net>
author | Eric Blake <ebb9@byu.net> |
---|---|
date | Wed, 16 Dec 2009 16:20:28 -0700 |
parents | f7842310a565 |
children | 0c9896a5a035 |
rev | line source |
---|---|
8190 | 1 Description: |
2 A GNU-like <stdlib.h>. | |
3 | |
4 Files: | |
9263
bb62a6456893
Rename stdlib_.h to stdlib.in.h.
Bruno Haible <bruno@clisp.org>
parents:
9192
diff
changeset
|
5 lib/stdlib.in.h |
8190 | 6 m4/stdlib_h.m4 |
7 | |
8 Depends-on: | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
9 arg-nonnull |
9781
118f0bb3f732
Fix commit from 2007-06-20.
Bruno Haible <bruno@clisp.org>
parents:
9545
diff
changeset
|
10 include_next |
11832
ff3dd373542b
stddef: fix NetBSD 5.0 NULL bug, rather than working around it
Eric Blake <ebb9@byu.net>
parents:
11428
diff
changeset
|
11 stddef |
11428
766299801152
modules/stdlib (Depends-on): Add stdint.
Simon Josefsson <simon@josefsson.org>
parents:
11086
diff
changeset
|
12 stdint |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
13 unistd |
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
14 warn-on-use |
8190 | 15 |
16 configure.ac: | |
17 gl_STDLIB_H | |
18 | |
19 Makefile.am: | |
20 BUILT_SOURCES += stdlib.h | |
21 | |
22 # We need the following in order to create <stdlib.h> when the system | |
23 # doesn't have one that works with the given compiler. | |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
24 stdlib.h: stdlib.in.h $(WARN_ON_USE_H) $(ARG_NONNULL_H) |
11868
67c2b22aff08
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering <meyering@redhat.com>
parents:
11832
diff
changeset
|
25 $(AM_V_GEN)rm -f $@-t $@ && \ |
8190 | 26 { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \ |
10375
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10001
diff
changeset
|
27 sed -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ |
f96e845fc36d
Avoid some "gcc -pedantic" warnings.
Bruno Haible <bruno@clisp.org>
parents:
10001
diff
changeset
|
28 -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ |
8995
1025663f7658
* m4/include_next.m4 (gl_INCLUDE_NEXT): Define and AC_SUBST
Paul Eggert <eggert@cs.ucla.edu>
parents:
8819
diff
changeset
|
29 -e 's|@''NEXT_STDLIB_H''@|$(NEXT_STDLIB_H)|g' \ |
11997 | 30 -e 's|@''GNULIB_ATOLL''@|$(GNULIB_ATOLL)|g' \ |
9190 | 31 -e 's|@''GNULIB_CALLOC_POSIX''@|$(GNULIB_CALLOC_POSIX)|g' \ |
12015
9317d4a9ac96
canonicalize, canonicalize-lgpl: use <stdlib.h>
Eric Blake <ebb9@byu.net>
parents:
12008
diff
changeset
|
32 -e 's|@''GNULIB_CANONICALIZE_FILE_NAME''@|$(GNULIB_CANONICALIZE_FILE_NAME)|g' \ |
10673 | 33 -e 's|@''GNULIB_GETLOADAVG''@|$(GNULIB_GETLOADAVG)|g' \ |
8198
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
34 -e 's|@''GNULIB_GETSUBOPT''@|$(GNULIB_GETSUBOPT)|g' \ |
11997 | 35 -e 's|@''GNULIB_MALLOC_POSIX''@|$(GNULIB_MALLOC_POSIX)|g' \ |
8190 | 36 -e 's|@''GNULIB_MKDTEMP''@|$(GNULIB_MKDTEMP)|g' \ |
11882 | 37 -e 's|@''GNULIB_MKOSTEMP''@|$(GNULIB_MKOSTEMP)|g' \ |
12234
b45701f2ff71
mkstemps, mkostemps: new modules
Eric Blake <ebb9@byu.net>
parents:
12018
diff
changeset
|
38 -e 's|@''GNULIB_MKOSTEMPS''@|$(GNULIB_MKOSTEMPS)|g' \ |
8190 | 39 -e 's|@''GNULIB_MKSTEMP''@|$(GNULIB_MKSTEMP)|g' \ |
12234
b45701f2ff71
mkstemps, mkostemps: new modules
Eric Blake <ebb9@byu.net>
parents:
12018
diff
changeset
|
40 -e 's|@''GNULIB_MKSTEMPS''@|$(GNULIB_MKSTEMPS)|g' \ |
9434
b839560eec9f
Define the putenv substitute in <stdlib.h> rather than in <config.h>.
Bruno Haible <bruno@clisp.org>
parents:
9315
diff
changeset
|
41 -e 's|@''GNULIB_PUTENV''@|$(GNULIB_PUTENV)|g' \ |
10704 | 42 -e 's|@''GNULIB_RANDOM_R''@|$(GNULIB_RANDOM_R)|g' \ |
11997 | 43 -e 's|@''GNULIB_REALLOC_POSIX''@|$(GNULIB_REALLOC_POSIX)|g' \ |
12015
9317d4a9ac96
canonicalize, canonicalize-lgpl: use <stdlib.h>
Eric Blake <ebb9@byu.net>
parents:
12008
diff
changeset
|
44 -e 's|@''GNULIB_REALPATH''@|$(GNULIB_REALPATH)|g' \ |
10001 | 45 -e 's|@''GNULIB_RPMATCH''@|$(GNULIB_RPMATCH)|g' \ |
9545
c596ca4e89b4
Split setenv module into setenv and unsetenv. Get rid of setenv.h.
Bruno Haible <bruno@clisp.org>
parents:
9434
diff
changeset
|
46 -e 's|@''GNULIB_SETENV''@|$(GNULIB_SETENV)|g' \ |
9821
18bab9955c43
Document various strtod bugs, with some fixes.
Eric Blake <ebb9@byu.net>
parents:
9781
diff
changeset
|
47 -e 's|@''GNULIB_STRTOD''@|$(GNULIB_STRTOD)|g' \ |
10671
459974cd8b12
Add strtoll() declaration to <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
10665
diff
changeset
|
48 -e 's|@''GNULIB_STRTOLL''@|$(GNULIB_STRTOLL)|g' \ |
10672
66414a3e577c
Add strtoull() declaration to <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
10671
diff
changeset
|
49 -e 's|@''GNULIB_STRTOULL''@|$(GNULIB_STRTOULL)|g' \ |
9545
c596ca4e89b4
Split setenv module into setenv and unsetenv. Get rid of setenv.h.
Bruno Haible <bruno@clisp.org>
parents:
9434
diff
changeset
|
50 -e 's|@''GNULIB_UNSETENV''@|$(GNULIB_UNSETENV)|g' \ |
10673 | 51 -e 's|@''HAVE_ATOLL''@|$(HAVE_ATOLL)|g' \ |
9190 | 52 -e 's|@''HAVE_CALLOC_POSIX''@|$(HAVE_CALLOC_POSIX)|g' \ |
12015
9317d4a9ac96
canonicalize, canonicalize-lgpl: use <stdlib.h>
Eric Blake <ebb9@byu.net>
parents:
12008
diff
changeset
|
53 -e 's|@''HAVE_CANONICALIZE_FILE_NAME''@|$(HAVE_CANONICALIZE_FILE_NAME)|g' \ |
11997 | 54 -e 's|@''HAVE_DECL_GETLOADAVG''@|$(HAVE_DECL_GETLOADAVG)|g' \ |
8198
d84ab7c183f4
getsubopt.h is replaced with <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
8190
diff
changeset
|
55 -e 's|@''HAVE_GETSUBOPT''@|$(HAVE_GETSUBOPT)|g' \ |
9192 | 56 -e 's|@''HAVE_MALLOC_POSIX''@|$(HAVE_MALLOC_POSIX)|g' \ |
8190 | 57 -e 's|@''HAVE_MKDTEMP''@|$(HAVE_MKDTEMP)|g' \ |
11882 | 58 -e 's|@''HAVE_MKOSTEMP''@|$(HAVE_MKOSTEMP)|g' \ |
12234
b45701f2ff71
mkstemps, mkostemps: new modules
Eric Blake <ebb9@byu.net>
parents:
12018
diff
changeset
|
59 -e 's|@''HAVE_MKOSTEMPS''@|$(HAVE_MKOSTEMPS)|g' \ |
b45701f2ff71
mkstemps, mkostemps: new modules
Eric Blake <ebb9@byu.net>
parents:
12018
diff
changeset
|
60 -e 's|@''HAVE_MKSTEMPS''@|$(HAVE_MKSTEMPS)|g' \ |
11997 | 61 -e 's|@''HAVE_RANDOM_H''@|$(HAVE_RANDOM_H)|g' \ |
62 -e 's|@''HAVE_RANDOM_R''@|$(HAVE_RANDOM_R)|g' \ | |
9191
c7875dab3c3e
New module 'realloc-posix'.
Bruno Haible <bruno@clisp.org>
parents:
9190
diff
changeset
|
63 -e 's|@''HAVE_REALLOC_POSIX''@|$(HAVE_REALLOC_POSIX)|g' \ |
12016
4fac822214af
canonicalize-lgpl: use native realpath if it works
Eric Blake <ebb9@byu.net>
parents:
12015
diff
changeset
|
64 -e 's|@''HAVE_REALPATH''@|$(HAVE_REALPATH)|g' \ |
10001 | 65 -e 's|@''HAVE_RPMATCH''@|$(HAVE_RPMATCH)|g' \ |
9545
c596ca4e89b4
Split setenv module into setenv and unsetenv. Get rid of setenv.h.
Bruno Haible <bruno@clisp.org>
parents:
9434
diff
changeset
|
66 -e 's|@''HAVE_SETENV''@|$(HAVE_SETENV)|g' \ |
9821
18bab9955c43
Document various strtod bugs, with some fixes.
Eric Blake <ebb9@byu.net>
parents:
9781
diff
changeset
|
67 -e 's|@''HAVE_STRTOD''@|$(HAVE_STRTOD)|g' \ |
10671
459974cd8b12
Add strtoll() declaration to <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
10665
diff
changeset
|
68 -e 's|@''HAVE_STRTOLL''@|$(HAVE_STRTOLL)|g' \ |
10672
66414a3e577c
Add strtoull() declaration to <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
10671
diff
changeset
|
69 -e 's|@''HAVE_STRTOULL''@|$(HAVE_STRTOULL)|g' \ |
10719
620520e8b04c
stdlib: Provide struct random_data.
Simon Josefsson <simon@josefsson.org>
parents:
10704
diff
changeset
|
70 -e 's|@''HAVE_STRUCT_RANDOM_DATA''@|$(HAVE_STRUCT_RANDOM_DATA)|g' \ |
10665
5394a3a10398
Add a getloadavg() declaration to <stdlib.h>.
Bruno Haible <bruno@clisp.org>
parents:
10375
diff
changeset
|
71 -e 's|@''HAVE_SYS_LOADAVG_H''@|$(HAVE_SYS_LOADAVG_H)|g' \ |
9545
c596ca4e89b4
Split setenv module into setenv and unsetenv. Get rid of setenv.h.
Bruno Haible <bruno@clisp.org>
parents:
9434
diff
changeset
|
72 -e 's|@''HAVE_UNSETENV''@|$(HAVE_UNSETENV)|g' \ |
12018
586fda772b8f
canonicalize-lgpl: fix glibc bug with trailing slash
Eric Blake <ebb9@byu.net>
parents:
12016
diff
changeset
|
73 -e 's|@''REPLACE_CANONICALIZE_FILE_NAME''@|$(REPLACE_CANONICALIZE_FILE_NAME)|g' \ |
8190 | 74 -e 's|@''REPLACE_MKSTEMP''@|$(REPLACE_MKSTEMP)|g' \ |
9434
b839560eec9f
Define the putenv substitute in <stdlib.h> rather than in <config.h>.
Bruno Haible <bruno@clisp.org>
parents:
9315
diff
changeset
|
75 -e 's|@''REPLACE_PUTENV''@|$(REPLACE_PUTENV)|g' \ |
12015
9317d4a9ac96
canonicalize, canonicalize-lgpl: use <stdlib.h>
Eric Blake <ebb9@byu.net>
parents:
12008
diff
changeset
|
76 -e 's|@''REPLACE_REALPATH''@|$(REPLACE_REALPATH)|g' \ |
12300
c8288fd3f281
setenv, unsetenv: work around various bugs
Eric Blake <ebb9@byu.net>
parents:
12234
diff
changeset
|
77 -e 's|@''REPLACE_SETENV''@|$(REPLACE_SETENV)|g' \ |
9821
18bab9955c43
Document various strtod bugs, with some fixes.
Eric Blake <ebb9@byu.net>
parents:
9781
diff
changeset
|
78 -e 's|@''REPLACE_STRTOD''@|$(REPLACE_STRTOD)|g' \ |
12300
c8288fd3f281
setenv, unsetenv: work around various bugs
Eric Blake <ebb9@byu.net>
parents:
12234
diff
changeset
|
79 -e 's|@''REPLACE_UNSETENV''@|$(REPLACE_UNSETENV)|g' \ |
12422
f7842310a565
New module 'arg-nonnull'. Declare which arguments expect non-NULL values.
Bruno Haible <bruno@clisp.org>
parents:
12410
diff
changeset
|
80 -e '/definition of _GL_ARG_NONNULL/r $(ARG_NONNULL_H)' \ |
12766
2c14f1e449e5
warn-on-use: use instead of link-warning
Eric Blake <ebb9@byu.net>
parents:
12422
diff
changeset
|
81 -e '/definition of _GL_WARN_ON_USE/r $(WARN_ON_USE_H)' \ |
9263
bb62a6456893
Rename stdlib_.h to stdlib.in.h.
Bruno Haible <bruno@clisp.org>
parents:
9192
diff
changeset
|
82 < $(srcdir)/stdlib.in.h; \ |
11868
67c2b22aff08
annotate automake snippets with $(AM_V_GEN) and $(AM_V_at)
Jim Meyering <meyering@redhat.com>
parents:
11832
diff
changeset
|
83 } > $@-t && \ |
8190 | 84 mv $@-t $@ |
85 MOSTLYCLEANFILES += stdlib.h stdlib.h-t | |
86 | |
87 Include: | |
12008
18ea6ab4e81d
maint: make Include sections of modules consistent
Eric Blake <ebb9@byu.net>
parents:
11997
diff
changeset
|
88 <stdlib.h> |
8190 | 89 |
90 License: | |
9315
be88e4511678
Change license to LGPLv2+ on dummy, float, realloc, stdlib.
Simon Josefsson <simon@josefsson.org>
parents:
9263
diff
changeset
|
91 LGPLv2+ |
8190 | 92 |
93 Maintainer: | |
94 all |