Skip to content

[Windows] improve clang-cl support#21618

Open
henderkes wants to merge 9 commits intophp:masterfrom
henderkes:feat/clang-windows
Open

[Windows] improve clang-cl support#21618
henderkes wants to merge 9 commits intophp:masterfrom
henderkes:feat/clang-windows

Conversation

@henderkes
Copy link
Copy Markdown
Contributor

No description provided.

@arnaud-lb
Copy link
Copy Markdown
Member

Could you add the CI changes and the --with-toolset=clang flag to this PR as well?

@henderkes henderkes force-pushed the feat/clang-windows branch from fa889b9 to 51441d8 Compare April 3, 2026 11:35
@henderkes
Copy link
Copy Markdown
Contributor Author

@arnaud-lb done

TSRM/TSRM.h Outdated
Comment on lines 178 to 182
#if defined(__cplusplus) && defined(__clang__)
#define TSRMLS_MAIN_CACHE_EXTERN() extern "C" { extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR; }
#define TSRMLS_CACHE_EXTERN() extern "C" { extern TSRM_TLS void *TSRMLS_CACHE; }
#else
#define TSRMLS_MAIN_CACHE_EXTERN() extern TSRM_TLS void *TSRMLS_CACHE TSRM_TLS_MODEL_ATTR;
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

seems silly because it's already in an extern "C" block above, but intl fails to compile because it sees _tsrm_ls_cache as both C and C++ named symbol

some macro resolution weirdness that this works around

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Oh I see it now, extern "C" has no effect on symbols declared by these macros

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ah right! it's fine either way, extern "C" { extern "C" { } } is perfectly valid. removed the if clang

Copy link
Copy Markdown
Member

@arnaud-lb arnaud-lb left a comment

Choose a reason for hiding this comment

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

This looks right to me, but maybe others can take a look? cc @cmb69 @shivammathur @TimWolla

@arnaud-lb arnaud-lb requested review from cmb69 and shivammathur April 3, 2026 11:53
@arnaud-lb
Copy link
Copy Markdown
Member

@henderkes I think that the -Wno-microsoft-enum-forward-reference change also didn't make it here :)

@henderkes
Copy link
Copy Markdown
Contributor Author

Ah yeah, it's technically not necessary, just bloats the logs a lot. I'll add it in.

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.

3 participants