diff options
author | Roland McGrath <roland@hack.frob.com> | 2015-01-30 15:26:34 -0800 |
---|---|---|
committer | Roland McGrath <roland@hack.frob.com> | 2015-01-30 15:26:34 -0800 |
commit | 4e1d2d363b8bb2bcaf3e297427456356dca4ca8e (patch) | |
tree | 73c34cc79d3962febb1fc68b70f58e48d56dfc58 | |
parent | b658fdd82b4524cf6a39881d092caa23f63d93ac (diff) | |
download | glibc-roland/Wundef.tar.gz |
Put -Wundef and -Werror in CPPFLAGS, not just CFLAGS.roland/Wundef
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | Makeconfig | 8 | ||||
-rw-r--r-- | include/libc-symbols.h | 24 | ||||
-rw-r--r-- | sysdeps/unix/make-syscalls.sh | 12 |
4 files changed, 39 insertions, 16 deletions
@@ -1,3 +1,14 @@ +2015-01-30 Roland McGrath <roland@hack.frob.com> + + * Makeconfig (+gccwarn): Don't add -Wundef here. + (CPPFLAGS): Instead put it first thing here. + Also add -Werror if $(enable-werror) is yes. + * include/libc-symbols.h (IN_MODULE, IS_IN, IS_IN_LIB): Move these + macros under [MODULE_NAME]. + [!MODULE_NAME] (IS_IN): New macro, always yields 0. + * sysdeps/unix/make-syscalls.sh: Always emit #define's for + SYSCALL_CANCELLABLE, SYSCALL_NOERRNO, SYSCALL_ERRVAL, to 1 or 0. + 2015-01-29 Andreas Schwab <schwab@suse.de> * sysdeps/nptl/allocrtsig.c: Include <signal.h>. diff --git a/Makeconfig b/Makeconfig index 751e9ffa32..f8780463af 100644 --- a/Makeconfig +++ b/Makeconfig @@ -716,9 +716,10 @@ ifeq ($(all-warnings),yes) else +gccwarn := -Wall -Wwrite-strings -Winline endif -+gccwarn += -Wundef ifeq ($(enable-werror),yes) -+gccwarn += -Werror -Wno-error=undef +# -Werror is in CPPFLAGS (below). XXX Disable it for -Wundef in C/C++ +# code, for now, because some test sources still need to be fixed up. ++gccwarn += -Wno-error=undef endif +gccwarn-c = -Wstrict-prototypes @@ -844,7 +845,8 @@ module-cppflags = $(if $(filter $(@F),$(skip-module-cppflags)), \ # Note that we can't use -std=* in CPPFLAGS, because it overrides # the implicit -lang-asm and breaks cpp behavior for .S files--notably # it causes cpp to stop predefining __ASSEMBLER__. -CPPFLAGS = $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \ +CPPFLAGS = -Wundef $(if $(filter yes,$(enable-werror)),-Werror) \ + $(config-extra-cppflags) $(CPPUNDEFS) $(CPPFLAGS-config) \ $($(subdir)-CPPFLAGS) \ $(+includes) $(defines) $(module-cppflags) \ -include $(..)include/libc-symbols.h $(sysdep-CPPFLAGS) \ diff --git a/include/libc-symbols.h b/include/libc-symbols.h index 2da0ab4896..12ea810056 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -20,16 +20,30 @@ #ifndef _LIBC_SYMBOLS_H #define _LIBC_SYMBOLS_H 1 -#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) -#define IS_IN(lib) (IN_MODULE == MODULE_##lib) +#ifdef MODULE_NAME + +# define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME) +# define IS_IN(lib) (IN_MODULE == MODULE_##lib) /* Returns true if the current module is a versioned library. Versioned library names culled from shlib-versions files are assigned a MODULE_* value lower than MODULE_LIBS_BEGIN. */ -#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN) +# define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN) + +# define PASTE_NAME(a,b) PASTE_NAME1 (a,b) +# define PASTE_NAME1(a,b) a##b + +#else -#define PASTE_NAME(a,b) PASTE_NAME1 (a,b) -#define PASTE_NAME1(a,b) a##b +/* In actual compilation, MODULE_NAME is defined on the command line + (see Makeconfig). The only time it should be undefined is for some + preprocessing-only runs used for files that are neither C nor + assembly. In those cases, the IN_LIB result doesn't matter to + anything, but we must avoid -Wundef errors. */ + +# define IS_IN(lib) 0 + +#endif /* This file's macros are included implicitly in the compilation of every file in the C library by -imacros. diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh index 567081a624..e3596b6ce3 100644 --- a/sysdeps/unix/make-syscalls.sh +++ b/sysdeps/unix/make-syscalls.sh @@ -250,14 +250,10 @@ while read file srcfile caller syscall args strong weak; do \$(make-target-directory) (echo '#define SYSCALL_NAME $syscall'; \\ echo '#define SYSCALL_NARGS $nargs'; \\ - echo '#define SYSCALL_SYMBOL $strong'; \\" - [ $cancellable = 0 ] || echo "\ - echo '#define SYSCALL_CANCELLABLE 1'; \\" - [ $noerrno = 0 ] || echo "\ - echo '#define SYSCALL_NOERRNO 1'; \\" - [ $errval = 0 ] || echo "\ - echo '#define SYSCALL_ERRVAL 1'; \\" - echo "\ + echo '#define SYSCALL_SYMBOL $strong'; \\ + echo '#define SYSCALL_CANCELLABLE $cancellable'; \\ + echo '#define SYSCALL_NOERRNO $noerrno'; \\ + echo '#define SYSCALL_ERRVAL $errval'; \\ echo '#include <syscall-template.S>'; \\" ;; esac |