Files
Python3-Win9x/compat/msvc600/stdint.h
T

46 lines
2.3 KiB
C

#ifndef PYTHON_WIN9X_MSVC600_STDINT_H
#define PYTHON_WIN9X_MSVC600_STDINT_H
/* VC6-only fallback for the C99 <stdint.h> header.
*
* Visual C++ 6.0 (_MSC_VER 1200) predates C99 and ships no <stdint.h>. This
* project-local header is found ahead of any system <stdint.h> only because
* compat/msvc600 is placed first on the VC6 probe scripts' include path
* (scripts/vc6-probe.sh, scripts/vc6-probe-core.sh, scripts/vc6-probe-
* pythoncore-frontier.sh); it is never installed anywhere a standards-
* conforming compiler's own <stdint.h> would be found instead, so it never
* shadows a real one.
*
* First consumer: cpython/Modules/_blake2/impl/blake2.h and
* blake2-impl.h, which use only uint8_t, uint32_t, and uint64_t (verified
* by grepping every fixed-width identifier used across Modules/_blake2/,
* including the blake2b/blake2s/*-ref.c reference implementations and
* clinic-generated wrappers: no int8_t/int16_t/int32_t/int64_t or intptr_t/
* uintptr_t appear anywhere in that tree). `size_t` is used too, but that
* already comes from <stddef.h>, which VC6 has natively.
*
* compat/msvc600/inttypes.h already defines exactly these typedefs (plus
* the PRI* macros CPython's own Include/pyport.h needs from a real C99
* <inttypes.h>) for this same VC6 target. Rather than re-declaring
* uint8_t/uint32_t/uint64_t a second time under a second include guard
* (which would risk a duplicate-typedef error in any translation unit that
* ends up including both this header and <inttypes.h>, e.g. anything that
* pulls in both Python.h and a <stdint.h>-using third-party header like
* blake2.h), this header just forwards to it. inttypes.h's own include
* guard makes this forwarding idempotent no matter which of the two headers
* a given translation unit reaches first.
*
* Width assumptions (all already relied upon by inttypes.h and unchanged
* here): uint8_t = unsigned char (1 byte), uint32_t = unsigned long
* (4 bytes on Win32/ILP32), uint64_t = unsigned __int64 (VC6's non-standard
* 64-bit extension, 8 bytes). These match the sizes BLAKE2 requires.
*/
#if !defined(_MSC_VER) || _MSC_VER >= 1300
#error "compat/msvc600/stdint.h is a VC6-only (_MSC_VER < 1300) fallback; a standard <stdint.h> should be used instead."
#endif
#include "inttypes.h"
#endif /* PYTHON_WIN9X_MSVC600_STDINT_H */