Skip to content

build: drop superfluous STDC_HEADERS macro#22206

Closed
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:stdch
Closed

build: drop superfluous STDC_HEADERS macro#22206
vszakats wants to merge 5 commits into
curl:masterfrom
vszakats:stdch

Conversation

@vszakats

@vszakats vszakats commented Jun 28, 2026

Copy link
Copy Markdown
Member

It is traditionally defined by autotools to detect the presence of set
of standard C89 headers. autoconf 2.70 (2020-12-08) reduced the headers
covered to stdlib.h, string.h. After 2.59d (2006-06-05) obsoleting
it earlier. CMake replicated this detection, and curl included
curl/stdcheaders.h if standard headers were missing. However, such
condition could never happen because curl sources already assume all
checked standard headers (stdarg.h, stdlib.h, string.h) and
include them unconditionally.

Since this is an unused feature detection and an impossible fallback
path, drop them from CMake and curl's source. autotools continues to do
the detection by default, but its result is unused after this patch.

This leaves public curl/stdcheaders.h unused from within the codebase.

Refs:
autotools-mirror/autoconf@f0c7c42
autotools-mirror/autoconf@86c213d

Follow-up to 65dae4a #22191
Follow-up to 4c5307b
Ref: ae1912c

@github-actions github-actions Bot added the CI Continuous Integration label Jun 28, 2026
@vszakats vszakats changed the title build: drop STDC_HEADERS build: drop obsolete STDC_HEADERS Jun 28, 2026
@vszakats vszakats changed the title build: drop obsolete STDC_HEADERS build: drop unused STDC_HEADERS Jun 28, 2026
@vszakats vszakats requested a review from Copilot June 28, 2026 12:11

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the unused STDC_HEADERS feature probe and the associated (effectively unreachable) fallback include logic, aligning CMake/config headers and source usage with curl’s existing assumption that standard C headers are available. It also updates CI config-comparison filtering to account for autotools still defining STDC_HEADERS even though curl no longer uses it.

Changes:

  • Drop STDC_HEADERS checks/probing from CMake configuration and tests.
  • Remove STDC_HEADERS-gated inclusion of the public curl/stdcheaders.h from lib/curl_setup.h.
  • Remove STDC_HEADERS defines from platform config headers and ignore the autotools-only define in the CI cmp-config.pl script.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.

Show a summary per file
File Description
projects/vms/config_h.com Removes VMS config processing for STDC_HEADERS.
lib/curl_setup.h Removes conditional include of <curl/stdcheaders.h> based on STDC_HEADERS.
lib/curl_config-cmake.h.in Removes generated CMake config define for STDC_HEADERS.
lib/config-win32.h Removes hard-coded STDC_HEADERS define.
lib/config-os400.h Removes hard-coded STDC_HEADERS define and its comment block.
CMakeLists.txt Stops running the internal CMake test for STDC_HEADERS.
CMake/win32-cache.cmake Removes cached STDC_HEADERS value.
CMake/unix-cache.cmake Removes cached STDC_HEADERS value.
CMake/CurlTests.c Removes the STDC_HEADERS-guarded compile test block.
.github/scripts/cmp-config.pl Ignores #define STDC_HEADERS 1 when diffing autotools vs CMake config outputs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats changed the title build: drop unused STDC_HEADERS build: drop superfluous STDC_HEADERS Jun 28, 2026
@vszakats vszakats changed the title build: drop superfluous STDC_HEADERS build: drop superfluous STDC_HEADERS macro Jun 29, 2026
@vszakats vszakats closed this in 1671ebd Jun 29, 2026
@vszakats vszakats deleted the stdch branch June 29, 2026 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build CI Continuous Integration tidy-up

Development

Successfully merging this pull request may close these issues.

2 participants