Skip to content
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

C++20 Support #31

Merged
merged 28 commits into from
Sep 28, 2024
Merged

C++20 Support #31

merged 28 commits into from
Sep 28, 2024

Conversation

nicbarker
Copy link
Owner

@nicbarker nicbarker commented Sep 28, 2024

This PR adds support for direct #include clay.h in C++20. The changes should be opaque to C and other languages.

The main set of changes required were:

  • Macro around designated initializers because C99 uses (StructName) { members } and C++20 uses StructName { members }
  • Macro __attribute__((__packed__)) and swap out for enum : uint8_t for 1 byte enums
  • Reorder all designated initializer fields to be in declaration order, as required by C++20 standard (this was a pain)
  • Swap out the C99 hack for detecting the alignment of a type for the supported alignof in C++20

@nicbarker nicbarker changed the title [Draft] Testing github actions C++20 Support Sep 28, 2024
clay.h Outdated
@@ -28,41 +28,47 @@
#define CLAY_WASM_EXPORT(null)
#endif

#ifdef _MSC_VER
#define CLAY_PACKED_ENUM
Copy link
Contributor

@mikejsavage mikejsavage Sep 28, 2024

Choose a reason for hiding this comment

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

You could make this : uint8_t instead of a noop in C++

Copy link
Owner Author

Choose a reason for hiding this comment

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

Nice idea, have put it in 👍

@nicbarker nicbarker merged commit 948b7ce into main Sep 28, 2024
3 checks passed
@nicbarker nicbarker deleted the 012-github-actions branch September 29, 2024 00:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants