Add SAL_WNOUNREACHABLE_CODE_PUSH and _POP macros
To be used around code where some compiler, in some circumstances, generates bogus warnings about unreachable code, that it would be much uglier to work around otherwise. Specifically, I will at first now use this to get rid of MSVC warnings about unreachable code when calling a function defined in another source file (but going into the same library) that always throws. The compiler notices this when one uses link-time code generation and it thus can do global inlining of code from all compilation units that go into a library (or executable). For MSVC, the __pragma that the SAL_WNOUNREACHABLE_CODE_PUSH macro expands to needs to be in force at the start curly brace of a function, so place the PUSH macro before the function definition. For clarity, I guess it is best that the corresponding POP macro comes after the end of the function. Change-Id: Icef5259c5360b9facdc136fec1f207665ce79d90
Showing
Please
register
or
sign in
to comment