[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Use the GL_CFLAG_GNULIB_WARNINGS for most AC_LIBOBJ compilation units
From: |
Bruno Haible |
Subject: |
Use the GL_CFLAG_GNULIB_WARNINGS for most AC_LIBOBJ compilation units |
Date: |
Sun, 09 Jan 2022 17:37:42 +0100 |
On 2022-01-05, I added a GL_CFLAG_GNULIB_WARNINGS and enabled it
- in lib/Makefile.am, for the compilation units that are part of
libgnu.a,
- in tests/Makefile.am, for all compilation units.
However, it turns out that in lib/Makefile.am it is only activated
for compilation units that the module description declares through
lib_SOURCES += foobar.c
Whereas when we use
AC_LIBOBJ([foobar])
then foobar.o appears in the variable gl_LIBOBJS, and the Automake
statement
libgnu_a_LIBADD = $(gl_LIBOBJS)
has the effect that
- the compilation unit foobar.c gets compiled *without* reference to
libgnu_a_CFLAGS, and thus without the GL_CFLAG_GNULIB_WARNINGS,
- the object file becomes part of the library only at link time.
This is not what we want. I don't think it's an Automake bug, because
this way of processing the *_LIBADD makes sense. (E.g. there may be
two libraries, and the same .o files getting added to both. They should
not be compiled twice in this situation.)
Recall also that with Automake, we can assign CFLAGS on a per-library
or per-program basis, not per object file. See
<https://www.gnu.org/software/automake/manual/html_node/Program-and-Library-Variables.html>.
The solution, in order to make use of the GL_CFLAG_GNULIB_WARNINGS, is
to eliminate the AC_LIBOBJ([foobar]) invocation and instead use a
lib_SOURCES augmentation.
This patch implements it for ca. 90% of the AC_LIBOBJ invocations.
For the moment, the following are left alone:
- The *printf* modules, because they are complex to refactor,
- AC_LIBOBJ invocations of the same source file, triggered by 2 or more
modules. Recall that AC_LIBOBJ has a built-in "eliminate duplicates"
mechanism, whereas lib_SOURCES augmentation doesn't. (In other words,
when you do
lib_SOURCES += foobar.c
then libgnu.a will contain foobar.o twice.)
2022-01-09 Bruno Haible <bruno@clisp.org>
Use the GL_CFLAG_GNULIB_WARNINGS for most AC_LIBOBJ compilation units.
* modules/_Exit (configure.ac): Define an Automake conditional. Remove
the AC_LIBOBJ invocation.
(Makefile.am): Augment lib_SOURCES, guarded by that Automake
conditional.
* modules/accept: Likewise.
* modules/access: Likewise.
* modules/acosf: Likewise.
* modules/acosl: Likewise.
* modules/aligned_alloc: Likewise.
* modules/alphasort: Likewise.
* modules/argz: Likewise.
* modules/asinf: Likewise.
* modules/asinl: Likewise.
* modules/atan2f: Likewise.
* modules/atanf: Likewise.
* modules/atanl: Likewise.
* modules/atexit: Likewise.
* modules/atoll: Likewise.
* modules/bind: Likewise.
* modules/btowc: Likewise.
* modules/c32rtomb: Likewise.
* modules/canonicalize-lgpl: Likewise.
* modules/cbrt: Likewise.
* modules/cbrtf: Likewise.
* modules/cbrtl: Likewise.
* modules/ceil: Likewise.
* modules/ceilf: Likewise.
* modules/ceill: Likewise.
* modules/chdir-long: Likewise.
* modules/chown: Likewise.
* modules/close: Likewise.
* modules/closedir: Likewise.
* modules/cnd: Likewise.
* modules/connect: Likewise.
* modules/copy-file-range: Likewise.
* modules/copysign: Likewise.
* modules/copysignf: Likewise.
* modules/copysignl: Likewise.
* modules/cosf: Likewise.
* modules/coshf: Likewise.
* modules/cosl: Likewise.
* modules/creat: Likewise.
* modules/crypto/gc: Likewise.
* modules/ctime: Likewise.
* modules/dirfd: Likewise.
* modules/dup: Likewise.
* modules/dup2: Likewise.
* modules/duplocale: Likewise.
* modules/error: Likewise.
* modules/euidaccess: Likewise.
* modules/execinfo: Likewise.
* modules/execl: Likewise.
* modules/execle: Likewise.
* modules/execlp: Likewise.
* modules/execv: Likewise.
* modules/execve: Likewise.
* modules/execvp: Likewise.
* modules/execvpe: Likewise.
* modules/exp2: Likewise.
* modules/exp2f: Likewise.
* modules/exp2l: Likewise.
* modules/expf: Likewise.
* modules/expl: Likewise.
* modules/explicit_bzero: Likewise.
* modules/expm1: Likewise.
* modules/expm1f: Likewise.
* modules/expm1l: Likewise.
* modules/fabsf: Likewise.
* modules/fabsl: Likewise.
* modules/faccessat: Likewise.
* modules/fchdir: Likewise.
* modules/fchmodat: Likewise.
* modules/fchownat: Likewise.
* modules/fclose: Likewise.
* modules/fcntl: Likewise.
* modules/fdatasync: Likewise.
* modules/fdopen: Likewise.
* modules/fdopendir: Likewise.
* modules/fflush: Likewise.
* modules/ffs: Likewise.
* modules/ffsl: Likewise.
* modules/ffsll: Likewise.
* modules/fileblocks: Likewise.
* modules/float: Likewise.
* modules/flock: Likewise.
* modules/floor: Likewise.
* modules/floorf: Likewise.
* modules/floorl: Likewise.
* modules/fma: Likewise.
* modules/fmaf: Likewise.
* modules/fmal: Likewise.
* modules/fmod: Likewise.
* modules/fmodf: Likewise.
* modules/fmodl: Likewise.
* modules/forkpty: Likewise.
* modules/fpending: Likewise.
* modules/fpurge: Likewise.
* modules/freadable: Likewise.
* modules/freadahead: Likewise.
* modules/freadptr: Likewise.
* modules/free-posix: Likewise.
* modules/freopen: Likewise.
* modules/frexpf: Likewise.
* modules/fseek: Likewise.
* modules/fseeko: Likewise.
* modules/fseterr: Likewise.
* modules/fstat: Likewise.
* modules/fstatat: Likewise.
* modules/fsusage: Likewise.
* modules/fsync: Likewise.
* modules/ftell: Likewise.
* modules/ftello: Likewise.
* modules/ftruncate: Likewise.
* modules/fts: Likewise.
* modules/futimens: Likewise.
* modules/fwritable: Likewise.
* modules/fwriting: Likewise.
* modules/getaddrinfo: Likewise.
* modules/getcwd: Likewise.
* modules/getcwd-lgpl: Likewise.
* modules/getdelim: Likewise.
* modules/getdomainname: Likewise.
* modules/getdtablesize: Likewise.
* modules/getentropy: Likewise.
* modules/getgroups: Likewise.
* modules/gethostname: Likewise.
* modules/getline: Likewise.
* modules/getloadavg: Likewise.
* modules/getlogin: Likewise.
* modules/getlogin_r: Likewise.
* modules/getopt-posix: Likewise.
* modules/getpagesize: Likewise.
* modules/getpeername: Likewise.
* modules/getrandom: Likewise.
* modules/getrusage: Likewise.
* modules/getsockname: Likewise.
* modules/getsockopt: Likewise.
* modules/getsubopt: Likewise.
* modules/gettimeofday: Likewise.
* modules/getumask: Likewise.
* modules/getusershell: Likewise.
* modules/glob: Likewise.
* modules/grantpt: Likewise.
* modules/group-member: Likewise.
* modules/hypot: Likewise.
* modules/hypotf: Likewise.
* modules/hypotl: Likewise.
* modules/iconv_open: Likewise.
* modules/ilogb: Likewise.
* modules/ilogbf: Likewise.
* modules/ilogbl: Likewise.
* modules/imaxabs: Likewise.
* modules/imaxdiv: Likewise.
* modules/inet_ntop: Likewise.
* modules/inet_pton: Likewise.
* modules/ioctl: Likewise.
* modules/isapipe: Likewise.
* modules/isatty: Likewise.
* modules/isblank: Likewise.
* modules/isfinite: Likewise.
* modules/isinf: Likewise.
* modules/iswblank: Likewise.
* modules/iswctype: Likewise.
* modules/iswdigit: Likewise.
* modules/iswxdigit: Likewise.
* modules/lchmod: Likewise.
* modules/lchown: Likewise.
* modules/ldexpf: Likewise.
* modules/ldexpl: Likewise.
* modules/libgmp: Likewise.
* modules/link: Likewise.
* modules/linkat: Likewise.
* modules/listen: Likewise.
* modules/localeconv: Likewise.
* modules/localtime: Likewise.
* modules/log: Likewise.
* modules/log10: Likewise.
* modules/log10f: Likewise.
* modules/log10l: Likewise.
* modules/log1p: Likewise.
* modules/log1pf: Likewise.
* modules/log1pl: Likewise.
* modules/log2: Likewise.
* modules/log2f: Likewise.
* modules/log2l: Likewise.
* modules/logb: Likewise.
* modules/logbf: Likewise.
* modules/logbl: Likewise.
* modules/logf: Likewise.
* modules/login_tty: Likewise.
* modules/logl: Likewise.
* modules/lseek: Likewise.
* modules/lstat: Likewise.
* modules/mbrlen: Likewise.
* modules/mbrtoc32: Likewise.
* modules/mbrtowc: Likewise.
* modules/mbsinit: Likewise.
* modules/mbsnrtowcs: Likewise.
* modules/mbsrtowcs: Likewise.
* modules/mbtowc: Likewise.
* modules/memalign: Likewise.
* modules/memchr: Likewise.
* modules/memcmp: Likewise.
* modules/memcpy: Likewise.
* modules/memmove: Likewise.
* modules/mempcpy: Likewise.
* modules/memrchr: Likewise.
* modules/memset: Likewise.
* modules/mkdir: Likewise.
* modules/mkdirat: Likewise.
* modules/mkdtemp: Likewise.
* modules/mkfifo: Likewise.
* modules/mkfifoat: Likewise.
* modules/mknod: Likewise.
* modules/mkostemp: Likewise.
* modules/mkostemps: Likewise.
* modules/mkstemp: Likewise.
* modules/mkstemps: Likewise.
* modules/modf: Likewise.
* modules/modff: Likewise.
* modules/modfl: Likewise.
* modules/mountlist: Likewise.
* modules/msvc-inval: Likewise.
* modules/msvc-nothrow: Likewise.
* modules/mtx: Likewise.
* modules/nanosleep: Likewise.
* modules/nl_langinfo: Likewise.
* modules/obstack: Likewise.
* modules/open: Likewise.
* modules/openat: Likewise.
* modules/opendir: Likewise.
* modules/openpty: Likewise.
* modules/pclose: Likewise.
* modules/perror: Likewise.
* modules/pipe-posix: Likewise.
* modules/poll: Likewise.
* modules/popen: Likewise.
* modules/posix_memalign: Likewise.
* modules/posix_openpt: Likewise.
* modules/posix_spawn: Likewise.
* modules/posix_spawn-internal: Likewise.
* modules/posix_spawn_file_actions_addchdir: Likewise.
* modules/posix_spawn_file_actions_addclose: Likewise.
* modules/posix_spawn_file_actions_adddup2: Likewise.
* modules/posix_spawn_file_actions_addfchdir: Likewise.
* modules/posix_spawn_file_actions_addopen: Likewise.
* modules/posix_spawn_file_actions_destroy: Likewise.
* modules/posix_spawn_file_actions_init: Likewise.
* modules/posix_spawnattr_destroy: Likewise.
* modules/posix_spawnattr_getflags: Likewise.
* modules/posix_spawnattr_getpgroup: Likewise.
* modules/posix_spawnattr_getschedparam: Likewise.
* modules/posix_spawnattr_getschedpolicy: Likewise.
* modules/posix_spawnattr_getsigdefault: Likewise.
* modules/posix_spawnattr_getsigmask: Likewise.
* modules/posix_spawnattr_init: Likewise.
* modules/posix_spawnattr_setflags: Likewise.
* modules/posix_spawnattr_setpgroup: Likewise.
* modules/posix_spawnattr_setschedparam: Likewise.
* modules/posix_spawnattr_setschedpolicy: Likewise.
* modules/posix_spawnattr_setsigdefault: Likewise.
* modules/posix_spawnattr_setsigmask: Likewise.
* modules/posix_spawnp: Likewise.
* modules/powf: Likewise.
* modules/pread: Likewise.
* modules/pselect: Likewise.
* modules/pthread-cond: Likewise.
* modules/pthread-mutex: Likewise.
* modules/pthread-once: Likewise.
* modules/pthread-rwlock: Likewise.
* modules/pthread-spin: Likewise.
* modules/pthread-thread: Likewise.
* modules/pthread-tss: Likewise.
* modules/pthread_mutex_timedlock: Likewise.
* modules/pthread_sigmask: Likewise.
* modules/ptsname: Likewise.
* modules/ptsname_r: Likewise.
* modules/putenv: Likewise.
* modules/pwrite: Likewise.
* modules/qsort_r: Likewise.
* modules/raise: Likewise.
* modules/random: Likewise.
* modules/random_r: Likewise.
* modules/rawmemchr: Likewise.
* modules/read: Likewise.
* modules/readdir: Likewise.
* modules/readline: Likewise.
* modules/readlink: Likewise.
* modules/readlinkat: Likewise.
* modules/readutmp: Likewise.
* modules/reallocarray: Likewise.
* modules/recv: Likewise.
* modules/recvfrom: Likewise.
* modules/regex: Likewise.
* modules/relocatable-prog: Likewise.
* modules/remainder: Likewise.
* modules/remainderf: Likewise.
* modules/remainderl: Likewise.
* modules/remove: Likewise.
* modules/rename: Likewise.
* modules/renameat: Likewise.
* modules/rewinddir: Likewise.
* modules/rint: Likewise.
* modules/rintf: Likewise.
* modules/rintl: Likewise.
* modules/rmdir: Likewise.
* modules/round: Likewise.
* modules/roundf: Likewise.
* modules/roundl: Likewise.
* modules/rpmatch: Likewise.
* modules/scandir: Likewise.
* modules/sched_yield: Likewise.
* modules/secure_getenv: Likewise.
* modules/select: Likewise.
* modules/selinux-h: Likewise.
* modules/send: Likewise.
* modules/sendto: Likewise.
* modules/setenv: Likewise.
* modules/sethostname: Likewise.
* modules/setlocale: Likewise.
* modules/setlocale-null: Likewise.
* modules/setsockopt: Likewise.
* modules/shutdown: Likewise.
* modules/sig2str: Likewise.
* modules/sigabbrev_np: Likewise.
* modules/sigaction: Likewise.
* modules/sigdescr_np: Likewise.
* modules/signbit: Likewise.
* modules/sigprocmask: Likewise.
* modules/sinf: Likewise.
* modules/sinhf: Likewise.
* modules/sinl: Likewise.
* modules/sleep: Likewise.
* modules/socket: Likewise.
* modules/spawn-pipe: Likewise.
* modules/sqrtf: Likewise.
* modules/sqrtl: Likewise.
* modules/stat: Likewise.
* modules/stdio: Likewise.
* modules/stpcpy: Likewise.
* modules/stpncpy: Likewise.
* modules/strcase: Likewise.
* modules/strchrnul: Likewise.
* modules/strcspn: Likewise.
* modules/strdup-posix: Likewise.
* modules/strerror: Likewise.
* modules/strerror-override: Likewise.
* modules/strerrorname_np: Likewise.
* modules/strfmon_l: Likewise.
* modules/strftime-fixes: Likewise.
* modules/strncat: Likewise.
* modules/strndup: Likewise.
* modules/strnlen: Likewise.
* modules/strpbrk: Likewise.
* modules/strptime: Likewise.
* modules/strsep: Likewise.
* modules/strsignal: Likewise.
* modules/strtod: Likewise.
* modules/strtoimax: Likewise.
* modules/strtok_r: Likewise.
* modules/strtol: Likewise.
* modules/strtold: Likewise.
* modules/strtoll: Likewise.
* modules/strtoul: Likewise.
* modules/strtoull: Likewise.
* modules/strtoumax: Likewise.
* modules/strverscmp: Likewise.
* modules/symlink: Likewise.
* modules/symlinkat: Likewise.
* modules/tanf: Likewise.
* modules/tanhf: Likewise.
* modules/tanl: Likewise.
* modules/tcgetsid: Likewise.
* modules/thrd: Likewise.
* modules/time_r: Likewise.
* modules/time_rz: Likewise.
* modules/timegm: Likewise.
* modules/times: Likewise.
* modules/timespec_get: Likewise.
* modules/timespec_getres: Likewise.
* modules/tmpfile: Likewise.
* modules/towctrans: Likewise.
* modules/trunc: Likewise.
* modules/truncate: Likewise.
* modules/truncf: Likewise.
* modules/truncl: Likewise.
* modules/tsearch: Likewise.
* modules/tss: Likewise.
* modules/ttyname_r: Likewise.
* modules/tzset: Likewise.
* modules/uname: Likewise.
* modules/unlink: Likewise.
* modules/unlinkat: Likewise.
* modules/unlockpt: Likewise.
* modules/unsetenv: Likewise.
* modules/usleep: Likewise.
* modules/utime: Likewise.
* modules/utimensat: Likewise.
* modules/waitpid: Likewise.
* modules/wcpcpy: Likewise.
* modules/wcpncpy: Likewise.
* modules/wcrtomb: Likewise.
* modules/wcscasecmp: Likewise.
* modules/wcscat: Likewise.
* modules/wcschr: Likewise.
* modules/wcscmp: Likewise.
* modules/wcscoll: Likewise.
* modules/wcscpy: Likewise.
* modules/wcscspn: Likewise.
* modules/wcsdup: Likewise.
* modules/wcsftime: Likewise.
* modules/wcslen: Likewise.
* modules/wcsncasecmp: Likewise.
* modules/wcsncat: Likewise.
* modules/wcsncmp: Likewise.
* modules/wcsncpy: Likewise.
* modules/wcsnlen: Likewise.
* modules/wcsnrtombs: Likewise.
* modules/wcspbrk: Likewise.
* modules/wcsrchr: Likewise.
* modules/wcsrtombs: Likewise.
* modules/wcsspn: Likewise.
* modules/wcsstr: Likewise.
* modules/wcstok: Likewise.
* modules/wcswidth: Likewise.
* modules/wcsxfrm: Likewise.
* modules/wctob: Likewise.
* modules/wctomb: Likewise.
* modules/wctrans: Likewise.
* modules/wctype: Likewise.
* modules/wcwidth: Likewise.
* modules/windows-cond: Likewise.
* modules/windows-mutex: Likewise.
* modules/windows-once: Likewise.
* modules/windows-recmutex: Likewise.
* modules/windows-rwlock: Likewise.
* modules/windows-spawn: Likewise.
* modules/windows-spin: Likewise.
* modules/windows-thread: Likewise.
* modules/windows-timedmutex: Likewise.
* modules/windows-timedrecmutex: Likewise.
* modules/windows-timedrwlock: Likewise.
* modules/windows-tls: Likewise.
* modules/wmemchr: Likewise.
* modules/wmemcmp: Likewise.
* modules/wmemcpy: Likewise.
* modules/wmemmove: Likewise.
* modules/wmempcpy: Likewise.
* modules/wmemset: Likewise.
* modules/write: Likewise.
0001-Use-the-GL_CFLAG_GNULIB_WARNINGS-for-most-AC_LIBOBJ-.patch.gz
Description: application/gzip
- Use the GL_CFLAG_GNULIB_WARNINGS for most AC_LIBOBJ compilation units,
Bruno Haible <=