swig/Source/CParse
William S Fulton c046eb794e Include stdint.h in parser.y so bison uses ptrdiff_t not long
MSVC warned on 64 bit Windows:

  parser.c(5751,41): warning C4244: 'initializing': conversion from '__int64'
  to 'long', possible loss of data

The bison template picks long for YYPTRDIFF_T when PTRDIFF_MAX is not
defined, and it only includes stdint.h itself when __STDC_VERSION__ says C99
or later, which MSVC does not define by default.  long is 32 bits on 64 bit
Windows, so the pointer difference is truncated.

Including stdint.h from the prologue, which is emitted well before the
template code, makes PTRDIFF_MAX visible so ptrdiff_t is used instead.  This
is a no-op for GCC and Clang, which already take the __PTRDIFF_TYPE__ branch.

Assisted-by: Claude Code (Opus 5)
2026-08-01 09:42:44 +01:00
..
cparse.h C++20 concepts: drop the flat requires attribute and the capture helpers 2026-05-10 17:37:53 +01:00
cscanner.c Fix deleting invalid string when parsing Doxygen grouping comments 2026-07-08 23:26:47 +01:00
parser.y Include stdint.h in parser.y so bison uses ptrdiff_t not long 2026-08-01 09:42:44 +01:00
templ.c Fix C++17 inheriting constructor pack dropping the last base constructor 2026-06-18 22:01:51 +01:00
util.c Beautify using swig specific .clang-format 2026-03-04 21:53:30 +00:00