MPS issue job004057

TitleWarning pragmas are not localised around the bad cases
Assigned userGareth Rees
DescriptionIn Microsoft Visual C we use

     #pragma warning(disable: 4127)

(see config.h) to suppress the warning "conditional expression is constant" from the MPS_END macro. But this may also suppress valuable warnings elsewhere in the code.
AnalysisMicrosoft Visual C provides the __pragma keyword [1] for localizing a pragma in the output of a macro. So in this case we could write:

    #define MPS_END \
        __pragma(warning(push)) \
        __pragma(warning(disable:4127)) \
        } while (0) \

except with suitable macros instead of __pragma so that this works on all our supported compilers. (But this will lead to another #if in mps.h so maybe it's not worth it.)
How foundinspection
Created byGareth Rees
Created on2017-03-04 12:38:21
Last modified byGareth Rees
Last modified on2017-03-04 13:23:15
History2017-03-04 GDR Created.