[Bug 635351] New: __DATE__ , __TIME__ cpp macros and build-compare
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c0 Summary: __DATE__ , __TIME__ cpp macros and build-compare Classification: openSUSE Product: openSUSE 11.4 Version: Factory Platform: All OS/Version: Other Status: NEW Severity: Enhancement Priority: P5 - None Component: Basesystem AssignedTo: matz@novell.com ReportedBy: crrodriguez@novell.com QAContact: qa@suse.de Found By: Development Blocker: No Currently there are a lot of packages that get republished after running build-compare due to massive usage of preprocessor macros __DATE__ and __TIME__ The current solution is patching packages one by one, which is not very efficient. The alternatives are not that good either. a) We can let it as is b) we can build packages with -Wno-builtin-macro-redefined and redefine __TIME__ and __DATE__ unfortunately this switch not only silence warnings of those macros but also of __TIMESTAMP__,__FILE__, and __BASE_FILE__. certainly not what I expect. c) we can apply something like this to libcpp warning, I have not tested it, not sure it is correct, not even compiled it ! :-D Index: libcpp/macro.c =================================================================== --- libcpp/macro.c.orig 2010-04-06 13:56:00.000000000 +0200 +++ libcpp/macro.c 2010-08-28 23:54:52.501613000 +0200 @@ -237,6 +237,21 @@ _cpp_builtin_macro_text (cpp_reader *pfi if (tt != (time_t)-1 || errno == 0) tb = localtime (&tt); + if (getenv("SUSE_TIME_DATE")) { + cpp_buffer *pbuffer = cpp_get_buffer (pfile); + if (pbuffer) + { + struct _cpp_file *file = cpp_get_file (pbuffer); + if (file) + { + struct stat *st = _cpp_get_file_stat (file); + if (st) { + tb = localtime (&st->st_mtime); + } + } + } + } + if (tb) { pfile->date = _cpp_unaligned_alloc (pfile, .. So when SUSE_TIME_DATE enviroment variable is defined __DATE__ and __TIME__ take the values of the file modification instead of the file compilation time, this of couse is only export'ed during build... d) similar to the above, without enviroment variables but just emit a warning and catch it with some post build check.. cpp_errno (pfile, CPP_DL_WARNING, "Do not use __DATE__ or __TIME__ try __TIMESTAMP__ instead"); //with line numbers and so on, to make it very clear... Yup, I know it is non-standard, and/or crazy but it might help better than the current state. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c1 --- Comment #1 from Richard Guenther <rguenther@novell.com> 2010-08-29 11:00:24 UTC --- There's two valid options 1) fix the packages to use __TIMESTAMP__ 2) do not rebuild packages if their sources didn't change we can add a new warning to warn about uses of __DATE__ or __TIME__, but any environment hack isn't going to fly with me. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c2 --- Comment #2 from Cristian Rodríguez <crrodriguez@novell.com> 2010-08-29 15:03:14 UTC --- The new warning + an post build warning is enough to quickly screen build logs, find the offended lines, fix them and move on. Good enough for me. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c3 --- Comment #3 from Cristian Rodríguez <crrodriguez@novell.com> 2010-08-30 14:08:52 UTC --- Just curious, to what standard we are supposed to comply ? ANSI C says that __DATE__ and __TIME__ may be "implementation defined" "The date of translation of the source file (a character string literal of the form Mmm dd yyyy , where the names of the months are the same as those generated by the asctime function, and the first character of dd is a space character if the value is less than 10). If the date of translation is not available, an implementation-defined valid date shall be supplied. The time of translation of the source file (a character string literal of the form hh:mm:ss as in the time generated by the asctime function). If the time of translation is not available, an implementation-defined valid time shall be supplied." -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c4 Cristian Rodríguez <crrodriguez@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |NEEDINFO InfoProvider| |dmueller@novell.com --- Comment #4 from Cristian Rodríguez <crrodriguez@novell.com> 2010-09-28 05:37:28 UTC --- I while ago I wrote some rpmlint checks for this http://gitorious.org/opensuse/rpmlint-checks/merge_requests/2 Dirk: any objections on actually merging this one ? -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c5 --- Comment #5 from Dirk Mueller <dmueller@novell.com> 2010-10-21 11:14:20 CEST --- I merged it into git and will add it to the package.. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
https://bugzilla.novell.com/show_bug.cgi?id=635351 https://bugzilla.novell.com/show_bug.cgi?id=635351#c6 Dirk Mueller <dmueller@novell.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEEDINFO |RESOLVED InfoProvider|dmueller@novell.com | Resolution| |FIXED --- Comment #6 from Dirk Mueller <dmueller@novell.com> 2010-10-21 11:16:40 CEST --- done for factory. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.
http://bugzilla.novell.com/show_bug.cgi?id=635351 http://bugzilla.novell.com/show_bug.cgi?id=635351#c7 --- Comment #7 from Bernhard Wiedemann <bwiedemann@suse.com> --- This is an autogenerated message for OBS integration: This bug (635351) was mentioned in https://build.opensuse.org/request/show/51510 Factory / rpmlint -- You are receiving this mail because: You are on the CC list for the bug.
participants (1)
-
bugzilla_noreply@novell.com