Skip to content

ZEND_ELEMENT_COUNT usage reduction. #13324

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 4, 2024

Conversation

devnexen
Copy link
Member

@devnexen devnexen commented Feb 4, 2024

clang 18 is going to be released and in the meantime the counted_by attribute usage had been constrained to true flexible arrays, typical cases such as type name[1] ZEND_ELEMENT_COUNT(size) no longer build.

clang 18 is going to be released and in the meantime the counted_by
attribute usage had been constrained to true flexible arrays,
typical cases such as type name[1] ZEND_ELEMENT_COUNT(size) no longer
build.
Copy link
Member

@iluuu1994 iluuu1994 left a comment

Choose a reason for hiding this comment

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

Was nice while it lasted 😄 Thanks!

@iluuu1994
Copy link
Member

I suppose we could try to make two distinct macros for GCC and Clang (i.e. one that works with true flexible arrays, and one that works with the [1] variant) but it's probably not worth it. It would be interesting to see whether there's a difference in the generated assembly in the first place. I've been using these commands:

llvm-objdump --disassemble --no-addresses --no-show-raw-insn --demangle --symbolize-operands $(which php-dev) > before.txt
# Recompile
llvm-objdump --disassemble --no-addresses --no-show-raw-insn --demangle --symbolize-operands $(which php-dev) > after.txt
git diff --no-index before.txt after.txt

@devnexen
Copy link
Member Author

devnexen commented Feb 4, 2024

Was nice while it lasted 😄 Thanks!

There is still few usage left :-). Anyhow, I ve seen the feature being reverted once in llvm repo, might have cause subtle issues in the first place.

@devnexen devnexen merged commit b8f10de into php:master Feb 4, 2024
@bukka
Copy link
Member

bukka commented Feb 4, 2024

It might be worth to consider introducing some limited headers usable for C++ (making some structs opaque for C++) There are not probably that many C++ extensions and they could deal with that by having its own wrapper if they need something more complex.

@bukka
Copy link
Member

bukka commented Feb 4, 2024

Just for those that don't know that (which I was part of until recently), C++ is the reason why we don't use true flexible headers...

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