mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-21 00:47:28 +01:00
Pull struct definitions out of extern "C"
This avoids https://developercommunity.visualstudio.com/t/Cryptic-error-message:-error-C2065:-__/1363621
This commit is contained in:
1 parent
210021e584
commit
d05cae1e1a
2 files changed
+110
-108
No files matched your search
@@ -707,8 +707,7 @@ func (g *gen) genIncludes(b *buffer) error {
|
||||
}
|
||||
|
||||
func (g *gen) genHeader(b *buffer) error {
|
||||
b.writes("\n#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n")
|
||||
|
||||
b.writes("\n")
|
||||
b.writes("// ---------------- Status Codes\n\n")
|
||||
|
||||
wroteStatus := false
|
||||
@@ -734,6 +733,8 @@ func (g *gen) genHeader(b *buffer) error {
|
||||
b.printf("typedef struct %s%s__struct %s%s;\n\n", g.pkgPrefix, structName, g.pkgPrefix, structName)
|
||||
}
|
||||
|
||||
b.writes("#ifdef __cplusplus\nextern \"C\" {\n#endif\n\n")
|
||||
|
||||
b.writes("// ---------------- Public Initializer Prototypes\n\n")
|
||||
b.writes("// For any given \"wuffs_foo__bar* self\", \"wuffs_foo__bar__initialize(self,\n")
|
||||
b.writes("// etc)\" should be called before any other \"wuffs_foo__bar__xxx(self, etc)\".\n")
|
||||
@@ -794,6 +795,8 @@ func (g *gen) genHeader(b *buffer) error {
|
||||
return err
|
||||
}
|
||||
|
||||
b.writes("#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n")
|
||||
|
||||
b.writes("// ---------------- Struct Definitions\n\n")
|
||||
b.writes("// These structs' fields, and the sizeof them, are private implementation\n")
|
||||
b.writes("// details that aren't guaranteed to be stable across Wuffs versions.\n")
|
||||
@@ -806,9 +809,8 @@ func (g *gen) genHeader(b *buffer) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
b.writes("#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)\n")
|
||||
b.writes("#endif // defined(__cplusplus) || defined(WUFFS_IMPLEMENTATION)\n\n")
|
||||
|
||||
b.writes("\n#ifdef __cplusplus\n} // extern \"C\"\n#endif\n\n")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user