Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #if defined(__clang__) && __clang__ < 11 7 : /// \ingroup PeoGroup 8 : /// Workarounds for optimizer bugs 9 : namespace optimizer_hacks { 10 : /// \ingroup PeoGroup 11 : /// Produce a situation where the value of `*variable` could have been 12 : /// changed without the optimizer's knowledge, without actually 13 : /// changing the variable. 14 : void indicate_value_can_be_changed(void* variable); 15 : } // namespace optimizer_hacks 16 : 17 : #define VARIABLE_CAUSES_CLANG_FPE(var) \ 18 : ::optimizer_hacks::indicate_value_can_be_changed(&(var)) 19 : #else /* defined(__clang__) && __clang__ < 11 */ 20 : /// \ingroup PeoGroup 21 : /// Clang's optimizer has a known bug that sometimes produces spurious 22 : /// FPEs. This indicates that the variable `var` can trigger that bug 23 : /// and prevents some optimizations. This is fixed upstream in Clang 24 : /// 11. 25 1 : #define VARIABLE_CAUSES_CLANG_FPE(var) ((void)(var)) 26 : #endif /* defined(__clang__) && __clang__ < 11 */