Message ID | 1438593291-27109-11-git-send-email-alex.bennee@linaro.org |
---|---|
State | New |
Headers | show |
On 3 August 2015 at 10:14, Alex Bennée <alex.bennee@linaro.org> wrote: > This makes it a little easier to remember how you generated that 100Mb > trace log you saved for a future date. > > Signed-off-by: Alex Bennée <alex.bennee@linaro.org> > --- > configure | 2 +- > vl.c | 18 ++++++++++++++++++ > 2 files changed, 19 insertions(+), 1 deletion(-) > > diff --git a/configure b/configure > index 704b34c..9cc6a48 100755 > --- a/configure > +++ b/configure > @@ -1445,7 +1445,7 @@ else > fi > > gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" > -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" > +gcc_flags="-Wformat-security -Wno-format-y2k -Winit-self -Wignored-qualifiers $gcc_flags" Why do we need this warning switch change? thanks -- PMM
On 4 August 2015 at 13:46, Aurelien Jarno <aurelien@aurel32.net> wrote: > On 2015-08-04 13:40, Peter Maydell wrote: >> On 3 August 2015 at 10:14, Alex Bennée <alex.bennee@linaro.org> wrote: >> > gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" >> > -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" >> > +gcc_flags="-Wformat-security -Wno-format-y2k -Winit-self -Wignored-qualifiers $gcc_flags" >> >> Why do we need this warning switch change? > > Some locales might have the year on 2 digits only, so this triggers a > warning. That's also a reason I suggested to use a fixed date format. Agreed -- we don't want locale-specific log formats. thanks -- PMM
Peter Maydell <peter.maydell@linaro.org> writes: > On 4 August 2015 at 13:46, Aurelien Jarno <aurelien@aurel32.net> wrote: >> On 2015-08-04 13:40, Peter Maydell wrote: >>> On 3 August 2015 at 10:14, Alex Bennée <alex.bennee@linaro.org> wrote: >>> > gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" >>> > -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" >>> > +gcc_flags="-Wformat-security -Wno-format-y2k -Winit-self -Wignored-qualifiers $gcc_flags" >>> >>> Why do we need this warning switch change? >> >> Some locales might have the year on 2 digits only, so this triggers a >> warning. That's also a reason I suggested to use a fixed date format. > > Agreed -- we don't want locale-specific log formats. Is is worth pulling out the standard log date fmt into a #define somewhere? > > thanks > -- PMM
diff --git a/configure b/configure index 704b34c..9cc6a48 100755 --- a/configure +++ b/configure @@ -1445,7 +1445,7 @@ else fi gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits" -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags" +gcc_flags="-Wformat-security -Wno-format-y2k -Winit-self -Wignored-qualifiers $gcc_flags" gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags" gcc_flags="-Wendif-labels $gcc_flags" gcc_flags="-Wno-initializer-overrides $gcc_flags" diff --git a/vl.c b/vl.c index 05211cf..6f0ae74 100644 --- a/vl.c +++ b/vl.c @@ -4094,12 +4094,30 @@ int main(int argc, char **argv, char **envp) if (log_mask) { int mask; + char fmt_time[512]; + time_t start_time = time(NULL); + struct tm *local_start = localtime(&start_time); + + + if (log_file) { + qemu_set_log_filename(log_file); + } + mask = qemu_str_to_log_mask(log_mask); if (!mask) { qemu_print_log_usage(stdout); exit(1); } qemu_set_log(mask); + + if (strftime(fmt_time, sizeof(fmt_time), "%c", local_start) > 0) { + qemu_log("System Emulation started at %s\n", fmt_time); + qemu_log("Invocation:"); + for (i = 0; i < argc; i++) { + qemu_log("%s ", argv[i]); + } + qemu_log("\n"); + } } if (!is_daemonized()) {
This makes it a little easier to remember how you generated that 100Mb trace log you saved for a future date. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> --- configure | 2 +- vl.c | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-)