RFR(S): 8036122: Fix warning 'format not a string literal'
Vladimir Kozlov
vladimir.kozlov at oracle.com
Mon Mar 3 22:08:19 UTC 2014
Goetz,
What is difference between 8036120 and 8036122 you filed? Please, close
8036120 if it is dup of this one we are reviewing.
Changes look fine to me. I assume you tested all variations of command
line processed by compilerOracle.
Thanks,
Vladimir
On 3/3/14 9:06 AM, Mike Duigou wrote:
> This looks fine.
>
> Minor comments:
>
> - 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.
>
> Mike
>
> On Mar 3 2014, at 08:03 , Lindenmaier, Goetz <goetz.lindenmaier at sap.com> wrote:
>
>> Hi,
>>
>> I found a way to simplify my change considerably, and thus updated the webrev:
>> http://cr.openjdk.java.net/~goetz/webrevs/8036122-1-fmtWrn/
>>
>> 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
>> to format
>> 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.
>>
>> Best regards,
>> Goetz.
>>
>>
>>
>> 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'
>>
>> Hi,
>> 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.
>>
>> http://cr.openjdk.java.net/~goetz/webrevs/8036122-1-fmtWrn/
>>
>> Best regards,
>>
>> Goetz.
>>
>
More information about the hotspot-dev
mailing list