>From 45122e72f2ea96bade6719b4ca3c6e8102573731 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Thu, 13 Apr 2023 23:48:40 +0200 Subject: [PATCH 2/2] Add more reminders to include . * lib/aligned-malloc.h: Check that config.h was already included. * lib/careadlinkat.h: Likewise. * lib/filemode.h: Likewise. * lib/freadptr.h: Likewise. * lib/fseterr.h: Likewise. * lib/glthread/lock.h: Likewise. * lib/glthread/tls.h: Likewise. * lib/immutable.h: Likewise. * lib/isapipe.h: Likewise. * lib/isnand-nolibm.h: Likewise. * lib/isnanf-nolibm.h: Likewise. * lib/isnanl-nolibm.h: Likewise. * lib/mbswidth.h: Likewise. * lib/md5.h: Likewise. * lib/minmax.h: Likewise. * lib/msvc-inval.h: Likewise. * lib/msvc-nothrow.h: Likewise. * lib/pathmax.h: Likewise. * lib/sha1.h: Likewise. * lib/sha256.h: Likewise. * lib/sha512.h: Likewise. * lib/size_max.h: Likewise. * lib/sm3.h: Likewise. * lib/stat-size.h: Likewise. * lib/termcap.h: Likewise. * lib/terminfo.h: Likewise. * lib/thread-optim.h: Likewise. * lib/unlocked-io.h: Likewise. * lib/vma-iter.h: Likewise. --- ChangeLog | 33 +++++++++++++++++++++++++++++++++ lib/aligned-malloc.h | 6 ++++++ lib/careadlinkat.h | 5 +++++ lib/filemode.h | 5 +++++ lib/freadptr.h | 5 +++++ lib/fseterr.h | 5 +++++ lib/glthread/lock.h | 8 ++++++++ lib/glthread/tls.h | 5 +++++ lib/immutable.h | 5 +++++ lib/isapipe.h | 5 +++++ lib/isnand-nolibm.h | 5 +++++ lib/isnanf-nolibm.h | 5 +++++ lib/isnanl-nolibm.h | 5 +++++ lib/mbswidth.h | 5 +++++ lib/md5.h | 5 +++++ lib/minmax.h | 5 +++++ lib/msvc-inval.h | 5 +++++ lib/msvc-nothrow.h | 5 +++++ lib/pathmax.h | 5 +++++ lib/sha1.h | 5 +++++ lib/sha256.h | 5 +++++ lib/sha512.h | 5 +++++ lib/size_max.h | 5 +++++ lib/sm3.h | 5 +++++ lib/stat-size.h | 5 +++++ lib/termcap.h | 5 +++++ lib/terminfo.h | 5 +++++ lib/thread-optim.h | 5 +++++ lib/unlocked-io.h | 5 +++++ lib/vma-iter.h | 5 +++++ 30 files changed, 182 insertions(+) diff --git a/ChangeLog b/ChangeLog index c15d67bb26..8a88a904fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,36 @@ +2023-04-13 Bruno Haible + + Add more reminders to include . + * lib/aligned-malloc.h: Check that config.h was already included. + * lib/careadlinkat.h: Likewise. + * lib/filemode.h: Likewise. + * lib/freadptr.h: Likewise. + * lib/fseterr.h: Likewise. + * lib/glthread/lock.h: Likewise. + * lib/glthread/tls.h: Likewise. + * lib/immutable.h: Likewise. + * lib/isapipe.h: Likewise. + * lib/isnand-nolibm.h: Likewise. + * lib/isnanf-nolibm.h: Likewise. + * lib/isnanl-nolibm.h: Likewise. + * lib/mbswidth.h: Likewise. + * lib/md5.h: Likewise. + * lib/minmax.h: Likewise. + * lib/msvc-inval.h: Likewise. + * lib/msvc-nothrow.h: Likewise. + * lib/pathmax.h: Likewise. + * lib/sha1.h: Likewise. + * lib/sha256.h: Likewise. + * lib/sha512.h: Likewise. + * lib/size_max.h: Likewise. + * lib/sm3.h: Likewise. + * lib/stat-size.h: Likewise. + * lib/termcap.h: Likewise. + * lib/terminfo.h: Likewise. + * lib/thread-optim.h: Likewise. + * lib/unlocked-io.h: Likewise. + * lib/vma-iter.h: Likewise. + 2023-04-13 Bruno Haible Adjust comments in reminders. diff --git a/lib/aligned-malloc.h b/lib/aligned-malloc.h index cc938b608d..f05941f7e4 100644 --- a/lib/aligned-malloc.h +++ b/lib/aligned-malloc.h @@ -45,6 +45,12 @@ returned by memalign() can be freed, but it actually can be freed with free(). */ +/* This file uses MALLOC_ALIGNMENT, HAVE_POSIX_MEMALIGN, HAVE_ALIGNED_ALLOC, + HAVE_MEMALIGN. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if !defined ALIGNMENT # error "ALIGNMENT is not defined" #endif diff --git a/lib/careadlinkat.h b/lib/careadlinkat.h index 201d0415ff..562cf013b7 100644 --- a/lib/careadlinkat.h +++ b/lib/careadlinkat.h @@ -20,6 +20,11 @@ #ifndef _GL_CAREADLINKAT_H #define _GL_CAREADLINKAT_H +/* This file uses HAVE_READLINKAT. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #include diff --git a/lib/filemode.h b/lib/filemode.h index 15a8dcc376..51e10053d2 100644 --- a/lib/filemode.h +++ b/lib/filemode.h @@ -18,6 +18,11 @@ #ifndef FILEMODE_H_ +/* This file uses HAVE_DECL_STRMODE. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # include diff --git a/lib/freadptr.h b/lib/freadptr.h index 1f0f0f94f5..a0fb3a4b7c 100644 --- a/lib/freadptr.h +++ b/lib/freadptr.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* This file uses HAVE___FREADPTR. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #include diff --git a/lib/fseterr.h b/lib/fseterr.h index 0e9d2060ae..87dc347332 100644 --- a/lib/fseterr.h +++ b/lib/fseterr.h @@ -17,6 +17,11 @@ #ifndef _FSETERR_H #define _FSETERR_H +/* This file uses HAVE___FSETERR. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include /* Set the error indicator of the stream FP. diff --git a/lib/glthread/lock.h b/lib/glthread/lock.h index ae3ee2d671..805cd1cf61 100644 --- a/lib/glthread/lock.h +++ b/lib/glthread/lock.h @@ -77,6 +77,14 @@ #ifndef _LOCK_H #define _LOCK_H +/* This file uses HAVE_THREADS_H, HAVE_PTHREAD_RWLOCK, + HAVE_PTHREAD_RWLOCK_RDLOCK_PREFER_WRITER, + PTHREAD_RWLOCK_WRITER_NONRECURSIVE_INITIALIZER_NP, + HAVE_PTHREAD_MUTEX_RECURSIVE. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #include diff --git a/lib/glthread/tls.h b/lib/glthread/tls.h index aaaf0bb3b7..4788fae4f5 100644 --- a/lib/glthread/tls.h +++ b/lib/glthread/tls.h @@ -43,6 +43,11 @@ #ifndef _TLS_H #define _TLS_H +/* This file uses HAVE_THREADS_H. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #include diff --git a/lib/immutable.h b/lib/immutable.h index c76c625e31..6c5583261e 100644 --- a/lib/immutable.h +++ b/lib/immutable.h @@ -50,6 +50,11 @@ functions work alike, except that the "read-only" pointers are actually writable. */ +/* This file uses HAVE_WORKING_MPROTECT. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #ifdef __cplusplus diff --git a/lib/isapipe.h b/lib/isapipe.h index 50a19c43b2..1a3f9c7bba 100644 --- a/lib/isapipe.h +++ b/lib/isapipe.h @@ -15,6 +15,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* This file uses HAVE_FIFO_PIPES. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Whether pipes are FIFOs; -1 if not known. */ #ifndef HAVE_FIFO_PIPES # define HAVE_FIFO_PIPES (-1) diff --git a/lib/isnand-nolibm.h b/lib/isnand-nolibm.h index 9c75a8c47b..bb5a38b39f 100644 --- a/lib/isnand-nolibm.h +++ b/lib/isnand-nolibm.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* This file uses HAVE_ISNAND_IN_LIBC. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if HAVE_ISNAND_IN_LIBC /* Get declaration of isnan macro. */ # include diff --git a/lib/isnanf-nolibm.h b/lib/isnanf-nolibm.h index cc6b4198ff..f4bcba143e 100644 --- a/lib/isnanf-nolibm.h +++ b/lib/isnanf-nolibm.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* This file uses HAVE_ISNANF_IN_LIBC. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if HAVE_ISNANF_IN_LIBC /* Get declaration of isnan macro or (older) isnanf function. */ # include diff --git a/lib/isnanl-nolibm.h b/lib/isnanl-nolibm.h index f04c489bb8..8becc5b409 100644 --- a/lib/isnanl-nolibm.h +++ b/lib/isnanl-nolibm.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU Lesser General Public License along with this program. If not, see . */ +/* This file uses HAVE_ISNANL_IN_LIBC. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if HAVE_ISNANL_IN_LIBC /* Get declaration of isnan macro or (older) isnanl function. */ # include diff --git a/lib/mbswidth.h b/lib/mbswidth.h index 5e4fc15b83..f385b64999 100644 --- a/lib/mbswidth.h +++ b/lib/mbswidth.h @@ -14,6 +14,11 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . */ +/* This file uses HAVE_DECL_MBSWIDTH_IN_WCHAR_H. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include /* Avoid a clash of our mbswidth() with a function of the same name defined diff --git a/lib/md5.h b/lib/md5.h index f34e7cb8df..92dc603898 100644 --- a/lib/md5.h +++ b/lib/md5.h @@ -20,6 +20,11 @@ #ifndef _MD5_H #define _MD5_H 1 +/* This file uses HAVE_OPENSSL_MD5. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #include diff --git a/lib/minmax.h b/lib/minmax.h index 1fbfc6616c..0ac40198e2 100644 --- a/lib/minmax.h +++ b/lib/minmax.h @@ -23,6 +23,11 @@ MIN, MAX macro redefinitions on some systems; the workaround is to #include this file as the last one among the #include list. */ +/* This file uses HAVE_MINMAX_IN_LIMITS_H, HAVE_MINMAX_IN_SYS_PARAM_H. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Before we define the following symbols we get the file since otherwise we get redefinitions on some systems if is included after this file. Likewise for . diff --git a/lib/msvc-inval.h b/lib/msvc-inval.h index ed00461ff7..c16d880178 100644 --- a/lib/msvc-inval.h +++ b/lib/msvc-inval.h @@ -52,6 +52,11 @@ AC_DEFINE([MSVC_INVALID_PARAMETER_HANDLING], [SANE_LIBRARY_HANDLING]) */ +/* This file uses HAVE_MSVC_INVALID_PARAMETER_HANDLER. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #define DEFAULT_HANDLING 0 #define HAIRY_LIBRARY_HANDLING 1 #define SANE_LIBRARY_HANDLING 2 diff --git a/lib/msvc-nothrow.h b/lib/msvc-nothrow.h index 82d3f6a2df..0dd229fd66 100644 --- a/lib/msvc-nothrow.h +++ b/lib/msvc-nothrow.h @@ -25,6 +25,11 @@ This file defines wrappers that turn such an invalid parameter notification into an error code. */ +/* This file uses HAVE_MSVC_INVALID_PARAMETER_HANDLER. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if defined _WIN32 && ! defined __CYGWIN__ /* Get original declaration of _get_osfhandle. */ diff --git a/lib/pathmax.h b/lib/pathmax.h index 0dd8f3bc5c..6930283b82 100644 --- a/lib/pathmax.h +++ b/lib/pathmax.h @@ -39,6 +39,11 @@ #endif */ +/* This file uses HAVE_SYS_PARAM_H. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # include diff --git a/lib/sha1.h b/lib/sha1.h index 5a58b567ce..854213a921 100644 --- a/lib/sha1.h +++ b/lib/sha1.h @@ -19,6 +19,11 @@ #ifndef SHA1_H # define SHA1_H 1 +/* This file uses HAVE_OPENSSL_SHA1. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # include diff --git a/lib/sha256.h b/lib/sha256.h index 2879477e89..938b106706 100644 --- a/lib/sha256.h +++ b/lib/sha256.h @@ -18,6 +18,11 @@ #ifndef SHA256_H # define SHA256_H 1 +/* This file uses HAVE_OPENSSL_SHA256. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # include diff --git a/lib/sha512.h b/lib/sha512.h index e3a98a2644..f3465bc8a6 100644 --- a/lib/sha512.h +++ b/lib/sha512.h @@ -18,6 +18,11 @@ #ifndef SHA512_H # define SHA512_H 1 +/* This file uses HAVE_OPENSSL_SHA512. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # include "u64.h" diff --git a/lib/size_max.h b/lib/size_max.h index 48af025055..2cfd31a59b 100644 --- a/lib/size_max.h +++ b/lib/size_max.h @@ -18,6 +18,11 @@ #ifndef GNULIB_SIZE_MAX_H #define GNULIB_SIZE_MAX_H +/* This file uses HAVE_STDINT_H. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Get SIZE_MAX declaration on systems like Solaris 7/8/9. */ # include /* Get SIZE_MAX declaration on systems like glibc 2. */ diff --git a/lib/sm3.h b/lib/sm3.h index 4ca7f7a103..28af4dff1c 100644 --- a/lib/sm3.h +++ b/lib/sm3.h @@ -27,6 +27,11 @@ #ifndef SM3_H # define SM3_H 1 +/* This file uses HAVE_OPENSSL_SM3. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # include diff --git a/lib/stat-size.h b/lib/stat-size.h index 48f0d3c356..bda00b7289 100644 --- a/lib/stat-size.h +++ b/lib/stat-size.h @@ -25,6 +25,11 @@ #ifndef STAT_SIZE_H #define STAT_SIZE_H +/* This file uses HAVE_SYS_PARAM_H, HAVE_STRUCT_STAT_ST_BLOCKS. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* sys/param.h may define DEV_BSIZE */ #if HAVE_SYS_PARAM_H # include diff --git a/lib/termcap.h b/lib/termcap.h index 93d78e2227..f56543558a 100644 --- a/lib/termcap.h +++ b/lib/termcap.h @@ -19,6 +19,11 @@ #ifndef _TERMCAP_H #define _TERMCAP_H +/* This file uses HAVE_TERMCAP, HAVE_TERMINFO, HAVE_TPARAM. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Including or is dangerous, because it also declares a lot of junk, such as variables PC, UP, and other. */ diff --git a/lib/terminfo.h b/lib/terminfo.h index 0b6aacbb76..eb0b3c855d 100644 --- a/lib/terminfo.h +++ b/lib/terminfo.h @@ -19,6 +19,11 @@ #ifndef _TERMINFO_H #define _TERMINFO_H +/* This file uses HAVE_TERMINFO, HAVE_TERMCAP, HAVE_TPARAM. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + /* Including or is dangerous, because it also declares a lot of junk, such as variables PC, UP, and other. */ diff --git a/lib/thread-optim.h b/lib/thread-optim.h index 9a4c80af32..b5ef15aaf4 100644 --- a/lib/thread-optim.h +++ b/lib/thread-optim.h @@ -50,6 +50,11 @@ same optimization cannot be applied to locks that synchronize different processes (e.g. through shared memory mappings). */ +/* This file uses HAVE_SYS_SINGLE_THREADED_H. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #if HAVE_SYS_SINGLE_THREADED_H /* glibc >= 2.32 */ # include # define gl_multithreaded() (!__libc_single_threaded) diff --git a/lib/unlocked-io.h b/lib/unlocked-io.h index fdef624ab9..4830df4a74 100644 --- a/lib/unlocked-io.h +++ b/lib/unlocked-io.h @@ -31,6 +31,11 @@ the *_unlocked functions directly. On hosts that lack those functions, invoke the non-thread-safe versions instead. */ +/* This file uses HAVE_DECL_*_UNLOCKED. */ +# if !_GL_CONFIG_H_INCLUDED +# error "Please include config.h first." +# endif + # include # if HAVE_DECL_CLEARERR_UNLOCKED || defined clearerr_unlocked diff --git a/lib/vma-iter.h b/lib/vma-iter.h index d181184aee..f89c8f0322 100644 --- a/lib/vma-iter.h +++ b/lib/vma-iter.h @@ -18,6 +18,11 @@ #ifndef _VMA_ITER_H #define _VMA_ITER_H +/* This file uses HAVE_PSTAT_GETPROCVM, HAVE_MQUERY. */ +#if !_GL_CONFIG_H_INCLUDED + #error "Please include config.h first." +#endif + #include #ifdef __cplusplus -- 2.34.1