JDK-8203939 : JVMFlag::printError missing ATTRIBUTE_PRINTF
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Priority: P4
  • Status: Closed
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2018-05-29
  • Updated: 2018-06-11
  • Resolved: 2018-06-04
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11
11 b17Fixed
Related Reports
Cloners :  
Relates :  
Relates :  
Description
JVMFlag::printError is a printf-style variadic function, added as part of JDK-8133564.  The declaration needs an ATTRIBUTE_PRINTF decorator.

Comments
It seems to be far more common to put the attribute at the end of the declaration, e.g. static void printError(bool verbose, const char* msg, ...) ATTRIBUTE_PRINTF(2, 3); The logging component seems to be very nearly the only place where the attribute is put before the declaration.
29-05-2018

After reading up on this, I believe it should be: ATTRIBUTE_PRINTF(2, 3) static void printError(bool verbose, const char* msg, ...);
29-05-2018

https://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Function-Attributes.html
29-05-2018

Based on the existing usage pattern of ATTRIBUTE_PRINTF in hotspot I believe the function: static void printError(bool verbose, const char* msg, ...); needs to be declared as: ATTRIBUTE_PRINTF(3, 4) static void printError(bool verbose, const char* msg, ...); but I don't understand yet, the significance of the arguments "3,4" to ATTRIBUTE_PRINTF
29-05-2018