Skip to content

build: delete HAVE_STDINT_H and HAVE_INTTYPES_H#12275

Closed
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:stdinth
Closed

build: delete HAVE_STDINT_H and HAVE_INTTYPES_H#12275
vszakats wants to merge 6 commits into
curl:masterfrom
vszakats:stdinth

Conversation

@vszakats

@vszakats vszakats commented Nov 6, 2023

Copy link
Copy Markdown
Member

We use stdint.h unconditionally in all places except one. These uses
are imposed by external dependencies / features. nghttp2, quic, wolfSSL
and HAVE_MACH_ABSOLUTE_TIME do require this C99 header. It means that
any of these features make curl require a C99 compiler. (In case of
MSVC, this means Visual Studio 2010 or newer.)

This patch changes the single use of stdint.h guarded by
HAVE_STDINT_H to use stdint.h unconditionally. Also stop using
inttypes.h as an alternative there. HAVE_INTTYPES_H wasn't used
anywhere else, allowing to delete this feature check as well.

Closes #12275

We use `stdint.h` unconditionally in all places except one. All of these
uses are imposed by dependencies / features. nghttp2, quic, wolfSSL and
`HAVE_MACH_ABSOLUTE_TIME` do require this C99 header. It means that any
of these features make curl require a C99 compiler. (In case of MSVC,
this means Visual Studio 2010 minimum.)

This patch changes the only use of `stdint.h` guarded by `HAVE_STDINT_H`
to prioritize `inttypes.h` and fall back to `stdint.h` if not present.
C99 types are required by wolfSSL headers, so one of the must be
available.

Closes #xxxxx
@vszakats vszakats added the build label Nov 6, 2023
@vszakats vszakats changed the title build: delete HAVE_STDINT_H build: delete HAVE_STDINT_H and HAVE_INTTYPES_H Nov 6, 2023
@vszakats vszakats closed this in 60359ad Nov 6, 2023
@vszakats vszakats deleted the stdinth branch November 6, 2023 17:22
vszakats added a commit to vszakats/curl that referenced this pull request Jan 7, 2026
vszakats added a commit to vszakats/curl that referenced this pull request Jan 7, 2026
vszakats added a commit that referenced this pull request Jan 7, 2026
vszakats added a commit to vszakats/curl that referenced this pull request Jan 7, 2026
vszakats added a commit to vszakats/curl that referenced this pull request Jan 7, 2026
vszakats added a commit that referenced this pull request Jan 7, 2026
For `PRI*` printf masks for fixed-size C99 types.

Also:
- add simple fallback for `PRIu32`, `PRIx32`, if `inttypes.h` is
  missing.

Cherry-picked from #20200
Ref: #20207
Follow-up to 4701a6d #19695
Ref: 60359ad #12275
Closes #20208
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

1 participant