port: add MSVC600 CPython compatibility layer
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#ifndef PYTHON_WIN9X_MSVC600_STDBOOL_H
|
||||
#define PYTHON_WIN9X_MSVC600_STDBOOL_H
|
||||
|
||||
/* VC6-only fallback for the C99 <stdbool.h> header.
|
||||
*
|
||||
* Visual C++ 6.0 (_MSC_VER 1200) predates C99 and ships no <stdbool.h>;
|
||||
* in VC6's C mode `bool`/`true`/`false` are not keywords at all (they are
|
||||
* C++-only there). This project-local header is found ahead of any system
|
||||
* <stdbool.h> only because compat/msvc600 is placed first on the VC6 probe
|
||||
* scripts' include path (scripts/vc6-probe.sh, scripts/vc6-probe-core.sh);
|
||||
* it is never installed anywhere a standards-conforming compiler's own
|
||||
* <stdbool.h> would be found instead, so it never shadows a real one. The
|
||||
* _MSC_VER guard below is defence in depth for that same reason, and keeps
|
||||
* this file inert (and diagnosable, via the #error) if it is ever reached
|
||||
* by a compiler other than the VC6 this port targets.
|
||||
*
|
||||
* Modeled on the standard C99 <stdbool.h> contract: defines the macros
|
||||
* bool, true, false, and __bool_true_false_are_defined, and (matching
|
||||
* C99, which requires a program be able to #undef/redefine bool/true/
|
||||
* false) leaves them as plain macros rather than a typedef, so existing
|
||||
* C99-style `#undef bool` idioms, were CPython to use one, would still
|
||||
* work.
|
||||
*/
|
||||
|
||||
#if !defined(_MSC_VER) || _MSC_VER >= 1300
|
||||
#error "compat/msvc600/stdbool.h is a VC6-only (_MSC_VER < 1300) fallback; a standard <stdbool.h> should be used instead."
|
||||
#endif
|
||||
|
||||
#define bool int
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#define __bool_true_false_are_defined 1
|
||||
|
||||
#endif /* PYTHON_WIN9X_MSVC600_STDBOOL_H */
|
||||
Reference in New Issue
Block a user