Skip to contentSkip to conversation

Eliminate uses of __DATE__ and __TIME__

PATCH In review Josh Triplett 6 participants 19 messages Dec 23, 2013 – Jan 27, 2014

Subsystems (8)
lore
Share & tools
lore
#0 lore raw

cover Eliminate uses of __DATE__ and __TIME__

Using the __DATE__ and __TIME macros makes the kernel build non-deterministic. The kernel already optionally records this information at build time, so random kernel code shouldn't duplicate that. Eliminate all uses of __DATE__ and __TIME__, and then turn on a new GCC warning if available to make sure no new uses get added.

Josh Triplett (7):
mtd: denali: Drop print of build date/time
net: wireless: brcm80211: Drop debug version with build date/time
staging: rtl8188eu: Drop print of build date/time
staging: rts5139: Drop print of build time
staging: wlags49_h2: Drop debug macro recording build date/time
x86: math-emu: Drop already-disabled print of build date
Makefile: Build with -Werror=date-time if the compiler supports it

 Makefile                                             | 3 +++
 arch/x86/math-emu/errors.c                           | 5 -----
 drivers/mtd/nand/denali_pci.c                        | 1 -
 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | 7 -------
 drivers/staging/rtl8188eu/os_dep/usb_intf.c          | 1 -
 drivers/staging/rts5139/rts51x_scsi.c                | 1 -
 drivers/staging/wlags49_h2/wl_version.h              | 4 ----
 7 files changed, 3 insertions(+), 19 deletions(-)
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH 1/7 mtd: denali: Drop print of build date/time

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __DATE__ and __TIME__, which make the build non-deterministic.

---
 drivers/mtd/nand/denali_pci.c | 1 -
 1 file changed, 1 deletion(-)
drivers/mtd/nand/denali_pci.c +0 -1
index 033f177..ab64416 100644
@@ -131,7 +131,6 @@ static struct pci_driver denali_pci_driver = {
 
 static int denali_init_pci(void)
 {
-	pr_info("Spectra MTD driver built on %s @ %s\n", __DATE__, __TIME__);
 	return pci_register_driver(&denali_pci_driver);
 }
 module_init(denali_init_pci);
Signature · 1 line
1.8.5.2
Reviewed-by on v1 1/7
#2 lore raw

Re: [PATCH 1/7] mtd: denali: Drop print of build date/time

Quoted 6 lines · Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __DATE__ and __TIME__, which make the build non-deterministic.

(+cc Dinh Nguyen)

It looks good. :-)

Best regards,
Jingoo Han

Quoted 18 lines
---
 drivers/mtd/nand/denali_pci.c | 1 -
 1 file changed, 1 deletion(-)
drivers/mtd/nand/denali_pci.c +0 -2
index 033f177..ab64416 100644
@@ -131,7 +131,6 @@ static struct pci_driver denali_pci_driver = {
 
 static int denali_init_pci(void)
 {
-	pr_info("Spectra MTD driver built on %s @ %s\n", __DATE__, __TIME__);
 	return pci_register_driver(&denali_pci_driver);
 }
 module_init(denali_init_pci);
--

1.8.5.2

#3 lore raw

Re: [PATCH 1/7] mtd: denali: Drop print of build date/time

Quoted 4 lines · Jingoo Han
Quoted 3 lines · Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that.

BTW, it is possible for modules to be built at a different time than the kernel, and this code could show that. But it's not very useful anyway, so I agree.

Quoted 9 lines
Quoted 4 lines

This also eliminates the use of __DATE__ and
__TIME__, which make the build non-deterministic.

(+cc Dinh Nguyen)

It looks good. :-)

Thanks. Pushed to l2-mtd.git.

Brian

#4 lore raw

PATCH 2/7 net: wireless: brcm80211: Drop debug version with build date/time

In reply to Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __DATE__ and __TIME__, which make the build non-deterministic.

---
 drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/dhd_common.c +0 -7
index 9431af2..78e2999b 100644
@@ -32,15 +32,8 @@
 #define BRCMF_DEFAULT_SCAN_UNASSOC_TIME	40
 #define BRCMF_DEFAULT_PACKET_FILTER	"100 0 0 0 0x01 0x00"
 
-#ifdef DEBUG
-static const char brcmf_version[] =
-	"Dongle Host Driver, version " BRCMF_VERSION_STR "\nCompiled on "
-	__DATE__ " at " __TIME__;
-#else
 static const char brcmf_version[] =
 	"Dongle Host Driver, version " BRCMF_VERSION_STR;
-#endif
-
 
 bool brcmf_c_prec_enq(struct device *dev, struct pktq *q,
 		      struct sk_buff *pkt, int prec)
Signature · 1 line
1.8.5.2
#5 lore raw

PATCH 3/7 staging: rtl8188eu: Drop print of build date/time

In reply to Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __DATE__ and __TIME__, which make the build non-deterministic.

---
 drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +0 -1
index 7d14779..d44f606 100644
@@ -865,7 +865,6 @@ static int __init rtw_drv_entry(void)
 	RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_entry\n"));
 
 	DBG_88E(DRV_NAME " driver version=%s\n", DRIVERVERSION);
-	DBG_88E("build time: %s %s\n", __DATE__, __TIME__);
 
 	rtw_suspend_lock_init();
 
Signature · 1 line
1.8.5.2
Acked-by on v1 3/7
#6 lore raw

Re: [PATCH 3/7] staging: rtl8188eu: Drop print of build date/time

Quoted 14 lines · Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __DATE__ and __TIME__, which make the build non-deterministic.

---
  drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 -
  1 file changed, 1 deletion(-)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +0 -0
index 7d14779..d44f606 100644

drivers/staging/rtl8188eu/os_dep/usb_intf.c static int __init rtw_drv_entry(void) · line 869

Quoted 6 lines
drivers/staging/rtl8188eu/os_dep/usb_intf.c +0 -1
@@ -865,7 +865,6 @@ static int __init rtw_drv_entry(void)
  	RT_TRACE(_module_hci_intfs_c_, _drv_err_, ("+rtw_drv_entry\n"));
 
  	DBG_88E(DRV_NAME " driver version=%s\n", DRIVERVERSION);
-	DBG_88E("build time: %s %s\n", __DATE__, __TIME__);
 
  	rtw_suspend_lock_init();

Larry

Quoted 2 lines
#7 lore raw

PATCH 4/7 staging: rts5139: Drop print of build time

In reply to Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __TIME__, which makes the build non-deterministic. (And, without __DATE__, __TIME__ provided little useful information to begin with.)

---
 drivers/staging/rts5139/rts51x_scsi.c | 1 -
 1 file changed, 1 deletion(-)
drivers/staging/rts5139/rts51x_scsi.c +0 -1
index a474eed..3a99025 100644
@@ -1985,7 +1985,6 @@ static int show_info(struct seq_file *m, struct Scsi_Host *host)
 	SPRINTF("       Vendor: Realtek Corp.\n");
 	SPRINTF("      Product: RTS51xx USB Card Reader\n");
 	SPRINTF("      Version: %s\n", DRIVER_VERSION);
-	SPRINTF("        Build: %s\n", __TIME__);
 	return 0;
 }
 
Signature · 1 line
1.8.5.2
#8 lore raw

PATCH 5/7 staging: wlags49_h2: Drop debug macro recording build date/time

In reply to Josh Triplett

The kernel already has this information, and individual drivers shouldn't duplicate that. This also eliminates the use of __DATE__ and __TIME__, which make the build non-deterministic.

---
 drivers/staging/wlags49_h2/wl_version.h | 4 ----
 1 file changed, 4 deletions(-)
drivers/staging/wlags49_h2/wl_version.h +0 -4
index 037b526..019ebb2 100644
@@ -129,11 +129,7 @@ err: define bus type;
 #endif  /* HERMES25 */
 #endif  /* BUS_XXX */
 
-#ifdef DBG
-#define MODULE_DATE         __DATE__ " " __TIME__
-#else
 #define MODULE_DATE         "07/18/2004 13:30:00"
-#endif // DBG
 
 //#define STR2(m) #m
 //#define STR1(m) STR2(m)
Signature · 1 line
1.8.5.2
#9 lore raw

PATCH 6/7 x86: math-emu: Drop already-disabled print of build date

In reply to Josh Triplett

The kernel already has this information, so other bits of kernel code shouldn't duplicate that. This also eliminates the use of __DATE__, which makes the build non-deterministic.

This message was already disabled at build time, with PRINT_MESSAGES undef'd at the top of the file.

---
 arch/x86/math-emu/errors.c | 5 -----
 1 file changed, 5 deletions(-)
arch/x86/math-emu/errors.c +0 -5
index 59d353d..a544908 100644
@@ -330,11 +330,6 @@ asmlinkage void FPU_exception(int n)
 
 	RE_ENTRANT_CHECK_OFF;
 	if ((~control_word & n & CW_Exceptions) || (n == EX_INTERNAL)) {
-#ifdef PRINT_MESSAGES
-		/* My message from the sponsor */
-		printk(FPU_VERSION " " __DATE__ " (C) W. Metzenthen.\n");
-#endif /* PRINT_MESSAGES */
-
 		/* Get a name string for error reporting */
 		for (i = 0; exception_names[i].type; i++)
 			if ((exception_names[i].type & n) ==
Signature · 1 line
1.8.5.2
#10 lore raw

PATCH 7/7 Makefile: Build with -Werror=date-time if the compiler supports it

In reply to Josh Triplett

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.

---
 Makefile | 3 +++
 1 file changed, 3 insertions(+)
Makefile +3 -0
index 14d592c..188eea7 100644
@@ -668,6 +668,9 @@ KBUILD_CFLAGS   += $(call cc-option,-Werror=implicit-int)
 # require functions to have arguments in prototypes, not empty 'int foo()'
 KBUILD_CFLAGS   += $(call cc-option,-Werror=strict-prototypes)
 
+# Prohibit date/time macros, which would make the build non-deterministic
+KBUILD_CFLAGS   += $(call cc-option,-Werror=date-time)
+
 # use the deterministic mode of AR if available
 KBUILD_ARFLAGS := $(call ar-option,D)
 
Signature · 1 line
1.8.5.2
Acked-by on v1 7/7
#11 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 4 lines · Josh Triplett

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.

Nice, I didn't know about -Wdate-time. Do you want me to merge the entire series, or do you want individual maintainers merge the patches? In the latter case, I'd wait with applying 7/7 in order not to break the build. At any rate, you can add

Thanks,
Michal

author Reviewed-by Jingoo Han Acked-by Larry Finger
#12 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 6 lines · Michal Marek
Quoted 4 lines · Josh Triplett

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.

Quoted 6 lines

Nice, I didn't know about -Wdate-time. Do you want me to merge the entire series, or do you want individual maintainers merge the patches? In the latter case, I'd wait with applying 7/7 in order not to break the build. At any rate, you can add

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

Patch 1 should have:

and patch 3 should have:

Thanks,
Josh Triplett

#13 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 3 lines · Josh Triplett

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

OK. I will wait until mid next week and commit with any acks received.

Michal

#14 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 6 lines · Michal Marek
Quoted 3 lines · Josh Triplett

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

OK. I will wait until mid next week and commit with any acks received.

Thanks!

- Josh Triplett

#15 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Dne 3.1.2014 22:00, Josh Triplett napsal(a):

Quoted 9 lines · Michal Marek
Quoted 6 lines · Josh Triplett
Quoted 3 lines

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

OK. I will wait until mid next week and commit with any acks received.

Thanks!

I did not find time last week and Greg was faster and merged the driver patches. But I'm reluctant to only merge the Makefile patch now, because the kbuild branch would not build. I think I will send the patch to Linus after 3.14-rc1.

Michal

#16 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 7 lines · Michal Marek

Dne 3.1.2014 22:00, Josh Triplett napsal(a):

Quoted 6 lines · Michal Marek
Quoted 5 lines · Josh Triplett
Quoted 3 lines

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

OK. I will wait until mid next week and commit with any acks received.

Thanks!

I did not find time last week and Greg was faster and merged the driver patches. But I'm reluctant to only merge the Makefile patch now, because the kbuild branch would not build. I think I will send the patch to Linus after 3.14-rc1.

Greg, if you already have all the driver patches in your tree, perhaps you could go ahead and take the Makefile patch through your tree as well? (Assuming that's OK with you, Michal?)

- Josh Triplett

#17 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 12 lines · Josh Triplett
Quoted 11 lines · Michal Marek

Dne 3.1.2014 22:00, Josh Triplett napsal(a):

Quoted 9 lines · Michal Marek
Quoted 6 lines · Josh Triplett
Quoted 3 lines

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

OK. I will wait until mid next week and commit with any acks received.

Thanks!

Quoted 8 lines
Quoted 4 lines

I did not find time last week and Greg was faster and merged the driver patches. But I'm reluctant to only merge the Makefile patch now, because the kbuild branch would not build. I think I will send the patch to Linus after 3.14-rc1.

Greg, if you already have all the driver patches in your tree, perhaps you could go ahead and take the Makefile patch through your tree as well? (Assuming that's OK with you, Michal?)

Did I really grab all of the other patches? I don't remember how many there were in this series for stuff I maintain. If I have them all, sure, I'll be glad to take it, otherwise I agree with Michal, it should be sent to Linus after 3.14-rc1 is out to make sure everything is properly synced up and you didn't miss any new drivers coming in that missed getting converted.

thanks,

greg k-h

#18 lore raw

Re: [PATCH 7/7] Makefile: Build with -Werror=date-time if the compiler supports it

Quoted 22 lines · Greg KH
Quoted 12 lines · Josh Triplett
Quoted 11 lines · Michal Marek

Dne 3.1.2014 22:00, Josh Triplett napsal(a):

Quoted 9 lines · Michal Marek
Quoted 6 lines · Josh Triplett
Quoted 3 lines

Please feel free to take the entire series through your tree; I received some maintainer acks, but no indications that the patches are going through their trees.

OK. I will wait until mid next week and commit with any acks received.

Thanks!

Quoted 8 lines
Quoted 4 lines

I did not find time last week and Greg was faster and merged the driver patches. But I'm reluctant to only merge the Makefile patch now, because the kbuild branch would not build. I think I will send the patch to Linus after 3.14-rc1.

Greg, if you already have all the driver patches in your tree, perhaps you could go ahead and take the Makefile patch through your tree as well? (Assuming that's OK with you, Michal?)

Quoted 6 lines

Did I really grab all of the other patches? I don't remember how many there were in this series for stuff I maintain. If I have them all, sure, I'll be glad to take it, otherwise I agree with Michal, it should be sent to Linus after 3.14-rc1 is out to make sure everything is properly synced up and you didn't miss any new drivers coming in that missed getting converted.

FYI: The remaining patches are now in the kbuild.git#drop-time branch and also in the for-next branch.

Thanks,
Michal