RFR(S): 8036122: Fix warning 'format not a string literal'
goetz.lindenmaier at sap.com
Mon Mar 3 22:33:12 UTC 2014
great, I missed the other ones! There is a third of the flags in the bsd gcc.make.
I updated the webrev to also remove the one in bsd and as you probably did
I also added some output of the compiler oracle test I did.
Thanks for your help,
From: Mike Duigou [mailto:mike.duigou at oracle.com]
Sent: Monday, March 03, 2014 6:07 PM
To: Lindenmaier, Goetz
Cc: hotspot-dev Source Developers
Subject: Re: RFR(S): 8036122: Fix warning 'format not a string literal'
This looks fine.
- I removed the --no-error=format-string-literal from solaris/gcc.make as well.
- The initial snprintf in os_linux.cpp could be the other branch of the "if (proc_task_unchecked && os::Linux::is_NPTL())" conditional.
I am testing the patch now though another reviewer is needed before this can be pushed.
On Mar 3 2014, at 08:03 , Lindenmaier, Goetz <goetz.lindenmaier at sap.com<mailto:goetz.lindenmaier at sap.com>> wrote:
I found a way to simplify my change considerably, and thus updated the webrev:
In compilerOracle.cpp was a loop checking three format strings with sscanf.
Before, I had unrolled the loop.
Now I figured, that before this loop is reached, the command lines are normalized
exclude java/lang/String indexOf
so that only one of the three format strings used will ever apply. So I need to
check only this one of the three formats anyways.
This makes this already small change much nicer.
From: Lindenmaier, Goetz
Sent: Montag, 3. März 2014 14:22
To: hotspot-dev Source Developers; 'Mike Duigou'
Subject: RFR(S): 8036122: Fix warning 'format not a string literal'
Since "8030350: Enable additional compiler warnings for GCC", the hotspot build issues warnings:
src/share/vm/compiler/compilerOracle.cpp: In function 'bool scan_line(const char*, char*, MethodMatcher::Mode*, char*, MethodMatcher::Mode*, int*, const char*&)':
src/share/vm/compiler/compilerOracle.cpp:425: warning: format not a string literal, argument types not checked
src/os/linux/vm/os_linux.cpp: In function 'jlong slow_thread_cpu_time(Thread*, bool)':
src/os/linux/vm/os_linux.cpp:5316: warning: format not a string literal, argument types not checked
Also, older gccs (4.2.2 and before) can not build hotspot any more. They don't know the option introduced in that change:
cc1plus: error: unrecognized command line option "-Wno-error=format-nonliteral"
This change fixes both by
- Fixing the warning in the hotspot code
- removing the flag from the makefiles.
Thus, the build with new gcc does no more issue warnings, and the build with older ones works again.
Please review and test this change - and I please need a sponsor.
More information about the hotspot-dev