JDK-8204099 : Incorrect ATTRIBUTE_PRINTF usage
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 11
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • Submitted: 2018-05-30
  • Updated: 2018-05-30
  • Resolved: 2018-05-30
Related Reports
Relates :  
Description
There seems to be places in hotspot, where we are using ATTRIBUTE_PRINTF wrong according to https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Function-Attributes.html

Also, some declarations put ATTRIBUTE_PRINTF before the method, some afterwards.
Comments
"this" counts as implicit 1st arguments in a non-static class method, so the usage seems correct. Also, the compiler will complain if the arguments are wrong in simple (i.e. most of our) cases. Closing as "not an issue".
30-05-2018

Example: In open/src/hotspot/share/runtime/thread.hpp we have: void set_name(const char* format, ...) ATTRIBUTE_PRINTF(2, 3); but I think it should be: void set_name(const char* format, ...) ATTRIBUTE_PRINTF(1, 2); There are many other places where the arguments to ATTRIBUTE_PRINTF seem to be off by 1. Am I missing something?
30-05-2018