You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
#include should never be inside of scopes or namepsaces. But zstd seems to extern "C" and then include various headers within them. This then causes clang module building to fail. I will trying moving all of these outside of these scopes, but in general this is bad practice for code used in so many applications..
import of C++ module 'std_stdint_h' appears within extern "C" language linkage specification
#if !defined (__VMS) && (defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */) )
# if defined(_AIX)
# include <inttypes.h>
# else
# include <stdint.h> /* intptr_t */ <-
# endif
Another example from the concatenated zstddeclib.cpp
#if defined (__cplusplus)
extern "C" {
#endif
/*-****************************************
* Dependencies
******************************************/
#include <stddef.h> /* size_t, ptrdiff_t */
To Reproduce
Steps to reproduce the behavior:
turn on -fmodules and -fcxx-modules
setup a module.modulemap with zstd in it
Watch compile fail trying to build zstd
Expected behavior
All headers should just be included first and outside of any scoping. Then any concatenation should just work. extern "C" should only wrap function calls and structs for naming reasons.
Screenshots and charts
None
Desktop (please complete the following information):
OS: macOS
Version 15.0
Compiler clang
Flags any
Other relevant hardware specs 8/4 cores
Build system Xcode
Additional context
None
The text was updated successfully, but these errors were encountered:
Yes, from what I see one concatenated header will start an extern "C" scope, and then do #include of other zstd files. So end up with #include nested inside of these scopes. I've commented out the includes here.
This is from the top of zstd.h. I've just commented out the includes. But zstd.h, zstddeclib.cpp, and zstd.cpp all have similar patterns.
Describe the bug
#include should never be inside of scopes or namepsaces. But zstd seems to extern "C" and then include various headers within them. This then causes clang module building to fail. I will trying moving all of these outside of these scopes, but in general this is bad practice for code used in so many applications..
import of C++ module 'std_stdint_h' appears within extern "C" language linkage specification
To Reproduce
Steps to reproduce the behavior:
Expected behavior
All headers should just be included first and outside of any scoping. Then any concatenation should just work. extern "C" should only wrap function calls and structs for naming reasons.
Screenshots and charts
None
Desktop (please complete the following information):
Additional context
None
The text was updated successfully, but these errors were encountered: