PCH compiling emits a warning when using #pragma once
Summary
PCH compiling emits a warning when using #pragma once
, which can thus turn into an error of course if -Werror
is enabled :
FAILED: fwRenderOgre/include/fwRenderOgre/pch.hpp.gch
cd /home/eharquel/Dev/Builds/sight2/debug/fwRenderOgre && /usr/bin/g++-8 @/home/eharquel/Dev/Builds/sight2/debug/fwRenderOgre/compile_flags.rsp -x c++-header -include fwRenderOgre/spyLogLevel.hpp -o /home/eharquel/Dev/Builds/sight2/debug/fwRenderOgre/include/fwRenderOgre/pch.hpp.gch /home/eharquel/Dev/src/Sight2/sight/SrcLib/visu/fwRenderOgre/include/fwRenderOgre/pch.hpp -fopenmp -g -std=gnu++17 -fPIC
/home/eharquel/Dev/src/Sight2/sight/SrcLib/visu/fwRenderOgre/include/fwRenderOgre/pch.hpp:27:9: error: #pragma once in main file [-Werror]
#pragma once
^~~~
This issue was raised in this discussion.
Possible fixes
We should not force the usage of #pragma once
for such files and use a header guard instead.