Warnings review in native code

Kelly O'Hair Kelly.Ohair at Sun.COM
Tue Dec 9 10:44:22 PST 2008


I myself have never found the warnings about unused parameters to
be that useful. It usually barks about the stub functions that need
to ignore parameters. I'm sure all the compilers have ways to shut that
warning up. We could just ban that warning from ever coming out
with compiler flags.
I hate to clutter up the code too much if it's excessive.

If the warning isn't helping to find problems, we need to be careful
we don't hack up our code just to manage unhelpful warnings.

Do people find the warning about unused parameters helpful?

-kto

Roman Kennke wrote:
> Hi there,
> 
> (Posting here, as this affects not only a single group. Please forward
> me to the correct list if this is not appropriate.)
> 
> we @aicas would like to review compiler warnings in OpenJDK's native
> code, and try to remove them im feasible. So far so good. But there is
> one thing that clutters up the compiler output, that is warnings related
> to unused parameters. As it is not always possible (infact, it is not
> possible in most cases) to simply remove parameters, be it that it's
> about an unused env parameter, or stuff that has to be there to
> implement a certain interface, I'd like to propose the introduction of a
> small macro like
> 
> #define OPENJDK_PARAMETER_UNUSED(par) (void)(par)
> 
> (or similar) that can be put at the beginning of a function to indicate
> that the parameter should indeed not be used, and make the compiler
> happy (while at the same time not generating code for it).
> 
> Does that sound feasible? Maybe has a better idea how to address this?
> And if it's feasible, where should it go? jni_util.h?
> 
> Thanks, Roman
> 



More information about the jdk7-dev mailing list