Revision2: Corrected: RFR 8059557 (XL): Validate JVM Command-Line Flag Arguments

Kim Barrett kim.barrett at
Wed Jun 3 22:26:21 UTC 2015

On Jun 3, 2015, at 3:26 PM, Gerard Ziemski <gerard.ziemski at> wrote:
>> ------------------------------------------------------------------------------
>> src/share/vm/runtime/commandLineFlagRangeList.cpp 
>> The various emit_range_xxx functions are defined with global scope.
>> I 
>> *think*
>>  they should be defined at file scope.
>> Similarly for the constraint list functions.
> If I make them at file scope then the compiler complains that some methods are not used, so I would have to remove those corresponding methods whose flag type is not currently used yet in our macro tables. But then in a future, when we add constraint or a range to a flag, whose type has not been used yet, we will have to implement those methods, which might be confusing to whoever it is that happens to be doing that.
> I think we would be better off by leaving things here implemented as is and prepared for any new ranges/constraints flags.

Ick.  So the problem is we have not yet defined constraints that use
some of these functions (though we expect we eventually will) and the
compiler is being a whiny pain about the presently unused functions.

For gcc this is easy to fix: __attribute__((__unused__))

I don't know about other compilers.  And if we went down that path,
we'd want to macroize it, the same way ATTRIBUTE_PRINTF and
ATTRIBUTE_SCANF have been macroized.

OK, I think this doesn't need to be addressed in this change set, but
can be dealt with as a follow-on task.

More information about the hotspot-dev mailing list