diff mbox series

kbuild: partial revert of "remove cc-option test of -Werror=date-time"

Message ID 20210110190807.134996-1-paul.gortmaker@windriver.com (mailing list archive)
State New, archived
Headers show
Series kbuild: partial revert of "remove cc-option test of -Werror=date-time" | expand

Commit Message

Paul Gortmaker Jan. 10, 2021, 7:08 p.m. UTC
In commit 87de84c9140e1ccb221c68bb7e4939e880b3f2bb ("kbuild: remove
cc-option test of -Werror=date-time") the check for support of the
date-time option was removed.

However, by removing it from the top level Makefile, it breaks all
the normal compiler version checks, because GCC fails at the command
line parsing, and never gets to the CPP #error check in the headers.

So for gcc-4.8 (now unsupported) you get the confusing:

   cc1: error: -Werror=date-time: no option -Wdate-time

instead of the previous and expected error message of:

   # error Sorry, your version of GCC is too old - please use 4.9 or newer.

Restore the check in the top level Makefile so the longstanding GCC
arch independent version check works again for v4.8 and older.

Fixes: 87de84c9140e ("kbuild: remove cc-option test of -Werror=date-time")
Cc: Masahiro Yamada <masahiroy@kernel.org>
Cc: Nathan Chancellor <natechancellor@gmail.com>
Cc: Will Deacon <will@kernel.org>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index e30cf02da8b8..e2f9e6582a10 100644
--- a/Makefile
+++ b/Makefile
@@ -937,7 +937,7 @@  KBUILD_CFLAGS  += -fno-stack-check
 KBUILD_CFLAGS   += $(call cc-option,-fconserve-stack)
 
 # Prohibit date/time macros, which would make the build non-deterministic
-KBUILD_CFLAGS   += -Werror=date-time
+KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
 
 # enforce correct pointer usage
 KBUILD_CFLAGS   += $(call cc-option,-Werror=incompatible-pointer-types)