RFR(S): 8036122: Fix warning 'format not a string literal'
goetz.lindenmaier at sap.com
Mon Mar 3 16:03:43 UTC 2014
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