From 81a64d68c7ce50617bac025061d8f6db91b00ee9 Mon Sep 17 00:00:00 2001 From: Ben Smith Date: Wed, 15 Mar 2017 16:29:37 -0700 Subject: Fix potential one-definition-rule breaking structs (#356) Context is the most common potential problem here, but I noticed that wasm-link.h had some others too (DataSegment and Export). These probably aren't an issue yet, since they all have trivial constructors. As soon as we add non-trivial types to these they break though. --- src/binary-reader-interpreter.cc | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/binary-reader-interpreter.cc') diff --git a/src/binary-reader-interpreter.cc b/src/binary-reader-interpreter.cc index a9a3f937..38f0a4b9 100644 --- a/src/binary-reader-interpreter.cc +++ b/src/binary-reader-interpreter.cc @@ -55,6 +55,8 @@ namespace wabt { +namespace { + typedef uint32_t Uint32; WABT_DEFINE_VECTOR(uint32, Uint32); WABT_DEFINE_VECTOR(uint32_vector, Uint32Vector); @@ -94,6 +96,8 @@ struct Context { uint32_t import_env_index; }; +} // namespace + static Label* get_label(Context* ctx, uint32_t depth) { assert(depth < ctx->label_stack.size); return &ctx->label_stack.data[ctx->label_stack.size - depth - 1]; -- cgit v1.2.3