Skip to content

Commit fe7c36c

Browse files
joshtriplettmichal42
authored andcommitted
Makefile: Build with -Werror=date-time if the compiler supports it
GCC 4.9 and newer have a new warning -Wdate-time, which warns on any use of __DATE__, __TIME__, or __TIMESTAMP__, which would make the build non-deterministic. Now that the kernel does not use any of those macros, turn on -Werror=date-time if available, to keep it that way. The kernel already (optionally) records this information at build time in a single place; other kernel code should not duplicate that. Signed-off-by: Josh Triplett <josh@joshtriplett.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
1 parent f9d7f77 commit fe7c36c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,9 @@ KBUILD_CFLAGS += $(call cc-option,-Werror=implicit-int)
682682
# require functions to have arguments in prototypes, not empty 'int foo()'
683683
KBUILD_CFLAGS += $(call cc-option,-Werror=strict-prototypes)
684684

685+
# Prohibit date/time macros, which would make the build non-deterministic
686+
KBUILD_CFLAGS += $(call cc-option,-Werror=date-time)
687+
685688
# use the deterministic mode of AR if available
686689
KBUILD_ARFLAGS := $(call ar-option,D)
687690

0 commit comments

Comments
 (0)