'static', ugh, means a few different things depending on context, but in this
kind of usage -- in front of a "global" variable declaration -- it means that
the variable is scoped to be visible only within this source module.
The compiler was noticing that the variable was not ever accessed in the module
(and, thus, never accessed, since it's visible to no other code). So it warns
about an unused variable, and we compile with a flag that makes all warnings
into full errors. Broken build.
Without the 'static' keyword, it would mean that the symbol might be visible to
separately-compiled modules, so it can't tell if anybody else will reference
it, hence no warning about not being used.
But here's the rub -- although PtexHalfInitialized is never read, it is
initialized by assigning it the value returned by PtexHalfInit(), which, when
run, has the side effect of setting the values of f2hTable and h2fTable, which
are used elsewhere and are necessary.
I would consider this a bug in gcc 5.0 (but not, apparently, in earlier
versions). It should not warn about an unused variable, if the variable's
initialization runs functions that have side effects.
I will push out the fix for you now.
-- lg
On Feb 11, 2015, at 7:36 PM, Richard Shaw <[email protected]> wrote:
> On Wed, Feb 11, 2015 at 4:37 PM, Larry Gritz <[email protected]> wrote:
> If you just remove the 'static', does it compile for you? (leaving the rest
> of the line in place)
>
> That got it... I know I'm not a programmer but how does that being static or
> not cause an unused <x> issue? :)
>
> Thanks,
> Richard
> _______________________________________________
> Oiio-dev mailing list
> [email protected]
> http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org
--
Larry Gritz
[email protected]
_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org