diff --git a/cmd/wuffs-c/internal/cgen/cgen.go b/cmd/wuffs-c/internal/cgen/cgen.go index def9a777..b20f850d 100644 --- a/cmd/wuffs-c/internal/cgen/cgen.go +++ b/cmd/wuffs-c/internal/cgen/cgen.go @@ -779,9 +779,12 @@ func (g *gen) writeStruct(b *buffer, n *a.Struct) error { b.writes("// Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still\n") b.writes("// defines C++ convenience methods. These methods forward on \"this\", so that\n") b.writes("// you can write \"bar->baz(etc)\" instead of \"wuffs_foo__bar__baz(bar, etc)\".\n") - b.writes("struct {\n") + b.writes("private:\n") + b.writes("union {\n") + b.writes("uint32_t align_as_per_magic_field;\n") b.writes("uint8_t placeholder[1073741824]; // 1 GiB.\n") b.writes("} private_impl;\n\n") + b.writes("public:\n") b.writex(wiEnd) if n.AsNode().AsRaw().Flags()&a.FlagsPublic != 0 { diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 1495b08d..5ebbeafc 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -2308,10 +2308,14 @@ struct wuffs_adler32__hasher__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus @@ -2414,10 +2418,14 @@ struct wuffs_crc32__ieee_hasher__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus @@ -2584,10 +2592,14 @@ struct wuffs_deflate__decoder__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus @@ -2721,10 +2733,14 @@ struct wuffs_lzw__decoder__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus @@ -2973,10 +2989,14 @@ struct wuffs_gif__decoder__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus @@ -3144,10 +3164,14 @@ struct wuffs_gzip__decoder__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus @@ -3271,10 +3295,14 @@ struct wuffs_zlib__decoder__struct { // Even when WUFFS_IMPLEMENTATION is not defined, the outermost struct still // defines C++ convenience methods. These methods forward on "this", so that // you can write "bar->baz(etc)" instead of "wuffs_foo__bar__baz(bar, etc)". - struct { + private: + union { + uint32_t align_as_per_magic_field; uint8_t placeholder[1073741824]; // 1 GiB. } private_impl; + public: + #endif // WUFFS_IMPLEMENTATION #ifdef __cplusplus