nfrechette/rtm

pragma warnings on clang on windows

Closed this issue · 1 comments

in compiler_utils.h,

#if defined(_MSC_VER)
	#define RTM_IMPL_FILE_PRAGMA_PUSH \
		/* Disable fast math, it can hurt precision for little to no performance gain due to the heavy usage of intrinsics. */ \
		__pragma(float_control(precise, on, push))

	#define RTM_IMPL_FILE_PRAGMA_POP \
		__pragma(float_control(pop))
#else
	#define RTM_IMPL_FILE_PRAGMA_PUSH
	#define RTM_IMPL_FILE_PRAGMA_POP
#endif

_MSC_VER is defined in the clang toolchain in visual studio, so it tries to parse __pragma and throws a warning regarding unknown pragma.

It can be worked around by checking for #if defined(__clang__) inside _MSC_VER block, but that leads to another issue where clang doesn't seem support #pragma float_control outside a function scope. There was a recent merge that allows float_control in namespaces (https://reviews.llvm.org/D79631) but I don't know if that covers the use case in error.h.

This is a known issue that has been fixed some time ago in the develop branch. I'm trying to finish up RTM 2.0 in the next few weeks which will include the fix. Upgrading should be fairly painless.

I haven't had the time yet to look into disabling fast math type compiler options on clang and gcc. Namespace scope could definitely work but I would probably need a new macro for it with a similar pattern.