The majority of atomic functions are inline and defined in the atomic.inline.hpp file. The .inline.hpp file should be included by the .cpp files that use the atomics. The .hpp file should not be included by other .hpp files unless actual atomic operations are referenced - in some cases this means those uses should themselves be moved into a .inline.hpp file.
Due to this kind of problem we can experience unexpected compilation failures eg:
In file included from /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/services/memTracker.hpp:78:0,
from /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/services/virtualMemoryTracker.cpp:28:
/opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/runtime/atomic.hpp:75:26: error: inline function 'static jint Atomic::add(jint, volatile jint*)' used but never defined [-Werror]
This may only appear on particular platforms and may depend on whether precompiled headers are used.
Due to this kind of problem we can experience unexpected compilation failures eg:
In file included from /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/services/memTracker.hpp:78:0,
from /opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/services/virtualMemoryTracker.cpp:28:
/opt/jprt/T/P1/195720.mockner/s/hotspot/src/share/vm/runtime/atomic.hpp:75:26: error: inline function 'static jint Atomic::add(jint, volatile jint*)' used but never defined [-Werror]
This may only appear on particular platforms and may depend on whether precompiled headers are used.