Skip to content

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.

3 participants