Skip to content

intl: stop including headers as C extern - #24617

Merged
Girgias merged 4 commits into
php:masterfrom
Girgias:2026-10-intl-stop-including-headers-via-externC
Oct 23, 2026
Merged

Girgias merged 4 commits into
php:masterfrom
Girgias:2026-10-intl-stop-including-headers-via-externC

Conversation

@Girgias

@Girgias Girgias commented Oct 23, 2026

Copy link
Copy Markdown
Member

Except for arginfo header as PHP_FUNCTION/PHP_METHOD are marked as U_CFUNC and ext/date/php_date.h header.

We now specificy the header symbols that need to follow the C function ABI, meaning in some places we drop U_CFUNC declarations and in others we add it.

Also use the BEGIN_EXTERN_C() portability macro when possible so that searching for this is easier.

I thought I needed #24378 before, but turns out we probably can drop the U_CFUNC in front of PHP_FUNCTION/PHP_METHOD as follow-ups.

Except for arginfo header as PHP_FUNCTION/PHP_METHOD are marked as U_CFUNC and ext/date/php_date.h header.

We now specificy the header symbols that _need_ to follow the C function ABI, meaning in some places we drop U_CFUNC declarations and in others we add it.
@Girgias
Girgias marked this pull request as ready for review October 23, 2026 18:47
Comment thread ext/intl/uchar/uchar.cpp
@@ -21,7 +20,6 @@ extern "C" {
#include <unicode/utf8.h>

#include "uchar_arginfo.h"

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.

am I correct to assume zim_IntlListFormatter_* has C linkage but zim_IntChar_* here has C++ ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, because all the IntlChar methods are declared via the IC_METHOD macro which does not use U_CFUNC.

@devnexen devnexen Oct 23, 2026 •

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.

Just asking because listformatter methods do not use U_CFUNC either but get C linkage with the BEGIN_EXTERN_C() part (for the listformatter_arginfo.h part to be precise).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah, I've been trying to find a way to get rid of including the arginfos via BEGIN_EXTERN_C() but some parts are entangled and quite complicated. Others are straight forward so I'll do follow-ups. :)

Ideally the whole extension should just be C++ IMHO.

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.

Ideally the whole extension should just be C++ IMHO.

yes I ve been patiently waiting to resume my plans.

@devnexen devnexen left a comment

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.

if CI green

@Girgias
Girgias merged commit c0250ba into php:master Oct 23, 2026
18 checks passed
@Girgias
Girgias deleted the 2026-10-intl-stop-including-headers-via-externC branch October 23, 2026 20:51
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.

2 participants