Somebody compiling OIIO (which embeds Ptex code) using gcc 5.0 noticed a new warning (and error, if using -Werror) that had not been flagged by earlier versions of gcc or by clang.
PtexHalf.cpp has a declaration:
static bool PtexHalfInitialized = PtexHalfInit();
This bool is never referenced elsewhere in the file, but its point is just to initialize, thus calling PtexHalfInit(), which fills in the f2hTable and h2fTable.
But interestingly, because it's 'static' (local module scope visibility only) and yet never referenced, in gcc 5.0 it pops up as an unused variable warning.
As a quick workaround, removing the 'static' keyword (and thus making it a globally visible symbol) makes the warning go away. I don't know if you like that as a final solution, but thought I'd give you the heads-up that gcc 5.0 will trigger the warning.
Personally, I would tend to consider this a gcc error -- I think a variable should not be flagged as unused if its initialization runs code that might have other side effects, as this one does. But I'm not inclined at the moment to read the C++ spec in such detail as to confidently tell gcc that they are wrong. I'll leave that for somebody else.
--
Larry Gritz
l...@larrygritz.com