Skip to content

mk-unity.pl: #include, and not concatenate input headers#21656

Closed
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:dont-concat-first-h
Closed

mk-unity.pl: #include, and not concatenate input headers#21656
vszakats wants to merge 2 commits into
curl:masterfrom
vszakats:dont-concat-first-h

Conversation

@vszakats
Copy link
Copy Markdown
Member

@vszakats vszakats commented May 18, 2026

When using -D_CURL_TESTS_CONCAT=ON with CMake, do not concatenate
first.h (or any future header) into the output C file, but #include
it instead. This is to play nice with compilers and analyzers which may
apply different checker rules on logic found in headers, vs. the input
source file. As seen for example with -Wunused-macro enabled in CI.
After this patch concatenated sources behave closer to regular C
sources.

Also:

  • first.h: drop some -Wunused-macro silencers that became redundant
    with this patch.

Follow-up to 47f411c #21554
Follow-up to 39542f0 #20667

When using `-D_CURL_TESTS_CONCAT=ON` with CMake, do not concatenate
`first.h` (or any future header) into the output C file, but `#include`
it instead. This is it play nice with compilers and analyzers which may
apply different checker rules on logic found in headers, vs. the input
source file. As seen for example with `-Wunused-macro`. After this patch
the concatenated source behaves closer to a regular C source.

Follow-up to 47f411c curl#21554
@vszakats vszakats changed the title mk-unity.pl: do not concat headers mk-unity.pl: do not concatenate headers, #include instead May 18, 2026
@vszakats vszakats changed the title mk-unity.pl: do not concatenate headers, #include instead mk-unity.pl: #include, and not concatenate input headers May 18, 2026
@vszakats vszakats added build cmake tests CI Continuous Integration labels May 18, 2026
@vszakats vszakats closed this in a55750a May 18, 2026
@vszakats vszakats deleted the dont-concat-first-h branch May 18, 2026 11:57
outcast36 pushed a commit to greearb/curl that referenced this pull request Jun 3, 2026
When using `-D_CURL_TESTS_CONCAT=ON` with CMake, do not concatenate
`first.h` (or any future header) into the output C file, but `#include`
it instead. This is to play nice with compilers and analyzers which may
apply different checker rules on logic found in headers, vs. the input
source file. As seen for example with `-Wunused-macro` enabled in CI.
After this patch concatenated sources behave closer to regular C
sources.

Also:
- first.h: drop some `-Wunused-macro` silencers that became redundant
  with this patch.

Follow-up to 47f411c curl#21554
Follow-up to 39542f0 curl#20667

Closes curl#21656
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

1 participant