RFR(S): 8036122: Fix warning 'format not a string literal'
goetz.lindenmaier at sap.com
Mon Mar 3 22:41:56 UTC 2014
>From your comment in the bug:
> Did the runtime team fix the one in:
> 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
Currently, there is no fix for the warning in the repo jdk9/hs-rt.
Also, I asked before whether somebody would fix it, but got no
answer saying somebody would do so.
My change fixes it, though.
Unfortunately I have to close the bug you commented on, as I generated two
of the same, and sent the webrev with the other bugid.
Should I move the comment into the other bug?
From: hotspot-dev-bounces at openjdk.java.net [mailto:hotspot-dev-bounces at openjdk.java.net] On Behalf Of Lindenmaier, Goetz
Sent: Monday, March 03, 2014 5:04 PM
To: hotspot-dev Source Developers; Mike Duigou
Subject: RE: RFR(S): 8036122: Fix warning 'format not a string literal'
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