Skip to content

modulemap: remove config_macros#4531

Merged
Cyan4973 merged 1 commit intofacebook:devfrom
lukaskollmer:lukas/fix-swift-build
Dec 2, 2025
Merged

modulemap: remove config_macros#4531
Cyan4973 merged 1 commit intofacebook:devfrom
lukaskollmer:lukas/fix-swift-build

Conversation

@lukaskollmer
Copy link
Contributor

fixes #3328 and #3892

issue at hand: the module.modulemap file was changed in #2953 and #3363 to contain a config_macros block with a list of most of the macros that can be used to configure various aspects of how Zstd builds and behaves.

however, clang's definition of a "config macro" is different from what one might instinctively assume a config macro to be: it only covers those macros that are exclusively passed via the command line (e.g. as -DMACRO_NAME), and does not allow the macro be #define-d within the codebase, even if it wasn't defined via the CLI.

zstd.h (and some other headers) currently contain blocks that conditionally #define some of the macros used to configure zstd, setting them to their default values if they are undefined (ie, if they haven't explicitly been set somewhere prior in the build process).
this causes clang to emit a warning for each of these macros, unless the program using zstd explicitly specifies their values via the command line (which a program that wants to simply use the default value obviously would not do)

you can see e.g. here for an example of clang's / LLVM's usage & meaning of the term "config macro": they're effectively simple valueless macros that derive their meaning exclusively from the fact whether they are defined or whether they are not defined.

@meta-cla
Copy link

meta-cla bot commented Nov 25, 2025

Hi @lukaskollmer!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at [email protected]. Thanks!

@meta-cla
Copy link

meta-cla bot commented Nov 26, 2025

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@Cyan4973 Cyan4973 self-assigned this Dec 1, 2025
@Cyan4973 Cyan4973 added the build label Dec 1, 2025
@Cyan4973
Copy link
Contributor

Cyan4973 commented Dec 1, 2025

OK, so if I understand correctly, config_macros should only be for macros which are command-line only, and actually command-line required ? Otherwise, clang warn for any macro value not defined on the command line ?

@lukaskollmer
Copy link
Contributor Author

correct; technically clang is warning about the fact that in addition to the command line definition there also is a #define for the macro, though of course in a sense that's the same thing as what you described.

i think eg ZSTD_MULTITHREAD would qualify as a config macro but i haven't tested that

@Cyan4973 Cyan4973 merged commit f567f38 into facebook:dev Dec 2, 2025
2 checks passed
@lukaskollmer
Copy link
Contributor Author

@Cyan4973 thanks for merging this! do you have a rough estimate when the next release will be tagged?

@Cyan4973
Copy link
Contributor

Cyan4973 commented Dec 3, 2025

There's no ETA at this point.
We will likely discuss this next year.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SwiftPM package always produces warnings when import libzstd

2 participants