From 3ffd29fb2cfeee77c7f58fcae3496665695eb938 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Fri, 3 Oct 2014 12:44:20 -0400 Subject: cmd/cc, runtime: disallow structs without tags Structs without tags have no unique name to use in the Go definitions generated from the C types. This caused issue 8812, fixed by CL 149260043. Avoid future problems by requiring struct tags. Update runtime as needed. (There is no other C code in the tree.) LGTM=bradfitz, iant R=golang-codereviews, bradfitz, dave, iant CC=golang-codereviews, khr, r https://golang.org/cl/150360043 --- src/runtime/malloc.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/runtime/malloc.h') diff --git a/src/runtime/malloc.h b/src/runtime/malloc.h index b90f1baf29..d1930756a2 100644 --- a/src/runtime/malloc.h +++ b/src/runtime/malloc.h @@ -273,7 +273,8 @@ struct MStats bool debuggc; // Statistics about allocation size classes. - struct { + + struct MStatsBySize { uint32 size; uint64 nmalloc; uint64 nfree; @@ -282,6 +283,7 @@ struct MStats uint64 tinyallocs; // number of tiny allocations that didn't cause actual allocation; not exported to Go directly }; + #define mstats runtime·memstats extern MStats mstats; void runtime·updatememstats(GCStats *stats); @@ -489,7 +491,7 @@ struct MHeap // the padding makes sure that the MCentrals are // spaced CacheLineSize bytes apart, so that each MCentral.lock // gets its own cache line. - struct { + struct MHeapCentral { MCentral mcentral; byte pad[CacheLineSize]; } central[NumSizeClasses]; -- cgit v1.3