RFR(S): JDK-8139762 Format warnings in generateJvmOffsets.cpp and libjvm_db.c
serguei.spitsyn at oracle.com
serguei.spitsyn at oracle.com
Fri Oct 16 19:10:45 UTC 2015
The fixes in the libjvm_db.c look good.
But the fix in the generateJvmOffsets.cpp looks strange.
Why do you need to replace the format %d with %ld ?
@@ -121,11 +121,11 @@
}
#define GEN_VALUE(String,Value) \
switch(gen_variant) { \
case GEN_OFFSET: \
- printf("#define %-40s %d\n", #String, Value); \
+ printf("#define %-40s %ld\n", #String, Value); \
break; \
case GEN_INDEX: \
printf("#define IDX_%-40s %d\n", #String, index++); \
break; \
case GEN_TABLE: \
First, the line below still has the %d format:
case GEN_INDEX: \
printf("#define IDX_%-40s %d\n", #String, index++); \
second, the Value in the GEN_VALUE macro is expected to be int:
219 GEN_VALUE(OFFSET_HeapBlockHeader_used, (int) offset_of(HeapBlock::Header, _used));
283 GEN_VALUE(SIZE_HeapBlockHeader, (int) sizeof(HeapBlock::Header));
If there is a type mismatch anywhere then it is better to use the type
cast to int as above.
Thanks,
Serguei
On 10/16/15 07:56, Dmitry Samersoff wrote:
> Everybody.
>
> Please review the fix.
>
> http://cr.openjdk.java.net/~dsamersoff/JDK-8139762/webrev.01/
>
> printf format characters %d and %ld misused in couple of places in
> generateJvmOffsets.cpp and libjvm_db.c
>
> -Dmitry
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/serviceability-dev/attachments/20151016/7be977e1/attachment.html>
More information about the serviceability-dev
mailing list