| Title | Warning pragmas are not localised around the bad cases |
| Status | open |
| Priority | nice |
| Assigned user | Gareth Rees |
| Organization | Ravenbrook |
| Description | In 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. |
| Analysis | Microsoft 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) \ __pragma(warning(pop)) 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 found | inspection |
| Evidence | [1] https://msdn.microsoft.com/en-us/library/d9x1s805.aspx#Anchor_3 |
| Created by | Gareth Rees |
| Created on | 2017-03-04 12:38:21 |
| Last modified by | Gareth Rees |
| Last modified on | 2017-03-04 13:23:15 |
| History | 2017-03-04 GDR Created. |