MPS issue job003315

Titlemps.h defines the macro MPS_T_WORD
Assigned userGareth Rees
DescriptionThe MPS external interface in mps.h [1] defines the macro MPS_T_WORD:

#ifndef MPS_T_WORD
#if defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64)
#define MPS_T_WORD unsigned __int64
#define MPS_T_WORD unsigned long /* won't be true on W3I6MV */
#endif /* MPS_T_WORD */

and then uses it to define the type mps_word_t:

typedef MPS_T_WORD mps_word_t; /* pointer-sized word */

This is against the policy of not defining symbols from mpstd.h in the external interface.
AnalysisThe external interface is careful not to include mpstd.h, because the latter is "picky" about details of compilers, operating system versions and so on, and we don't want peoples' MPS programs to stop working just because an compiler upgrade causes a preprocessor constant to change. (If they are building MPS from source then they will be hosed, but if they are linking against a pre-built library, as they will be if they installed the MPS via a ports collection, the new platform will almost certainly continue to work.)

So perhaps the above code could be changed to:

#if defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64)
typedef unsigned __int64 mps_word_t;
typedef unsigned long mps_word_t;
How foundinspection
Evidence[1] <>
Observed in1.110.0
Created byGareth Rees
Created on2012-10-17 17:00:04
Last modified byGareth Rees
Last modified on2013-03-08 15:25:14
History2012-10-17 GDR Created.


Change Effect Date User Description
181096 closed 2013-03-08 14:03:10 Gareth Rees Follow policy of not defining symbols from mpstd.h in the external interface, by removing the definition of MPS_T_WORD from mps.h.