aboutsummaryrefslogtreecommitdiff
path: root/src/runtime
diff options
context:
space:
mode:
authorRuss Cox <rsc@golang.org>2014-10-03 12:44:20 -0400
committerRuss Cox <rsc@golang.org>2014-10-03 12:44:20 -0400
commit3ffd29fb2cfeee77c7f58fcae3496665695eb938 (patch)
tree4f09c078f4d7d7cef4e957c32e7919dfb23800d3 /src/runtime
parentc65a47f890e33eeed6ee9d8b6d965a5534fb6e0e (diff)
downloadgo-3ffd29fb2cfeee77c7f58fcae3496665695eb938.tar.xz
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
Diffstat (limited to 'src/runtime')
-rw-r--r--src/runtime/malloc.h6
-rw-r--r--src/runtime/os_plan9.h2
-rw-r--r--src/runtime/proc.c2
-rw-r--r--src/runtime/runtime.h4
-rw-r--r--src/runtime/vdso_linux_amd64.c20
5 files changed, 18 insertions, 16 deletions
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];
diff --git a/src/runtime/os_plan9.h b/src/runtime/os_plan9.h
index 7ebaa9c0c6..6d18024834 100644
--- a/src/runtime/os_plan9.h
+++ b/src/runtime/os_plan9.h
@@ -63,7 +63,7 @@ typedef struct Tos Tos;
typedef intptr _Plink;
struct Tos {
- struct /* Per process profiling */
+ struct TosProf /* Per process profiling */
{
_Plink *pp; /* known to be 0(ptr) */
_Plink *next; /* known to be 4(ptr) */
diff --git a/src/runtime/proc.c b/src/runtime/proc.c
index e84dc1d048..1426790f40 100644
--- a/src/runtime/proc.c
+++ b/src/runtime/proc.c
@@ -2421,7 +2421,7 @@ runtime·mcount(void)
return runtime·sched.mcount;
}
-static struct {
+static struct ProfState {
uint32 lock;
int32 hz;
} prof;
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index aa300d7bb8..c4d8786089 100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -384,11 +384,11 @@ struct M
// these are here because they are too large to be on the stack
// of low-level NOSPLIT functions.
LibCall libcall;
- struct {
+ struct MTs {
int64 tv_sec;
int64 tv_nsec;
} ts;
- struct {
+ struct MScratch {
uintptr v[6];
} scratch;
#endif
diff --git a/src/runtime/vdso_linux_amd64.c b/src/runtime/vdso_linux_amd64.c
index 41a41fdd6a..681340c5b6 100644
--- a/src/runtime/vdso_linux_amd64.c
+++ b/src/runtime/vdso_linux_amd64.c
@@ -52,7 +52,7 @@ typedef uint16 Elf64_Section;
typedef Elf64_Half Elf64_Versym;
-typedef struct
+typedef struct Elf64_Sym
{
Elf64_Word st_name;
byte st_info;
@@ -62,7 +62,7 @@ typedef struct
Elf64_Xword st_size;
} Elf64_Sym;
-typedef struct
+typedef struct Elf64_Verdef
{
Elf64_Half vd_version; /* Version revision */
Elf64_Half vd_flags; /* Version information */
@@ -73,7 +73,7 @@ typedef struct
Elf64_Word vd_next; /* Offset in bytes to next verdef entry */
} Elf64_Verdef;
-typedef struct
+typedef struct Elf64_Ehdr
{
byte e_ident[EI_NIDENT]; /* Magic number and other info */
Elf64_Half e_type; /* Object file type */
@@ -91,7 +91,7 @@ typedef struct
Elf64_Half e_shstrndx; /* Section header string table index */
} Elf64_Ehdr;
-typedef struct
+typedef struct Elf64_Phdr
{
Elf64_Word p_type; /* Segment type */
Elf64_Word p_flags; /* Segment flags */
@@ -103,7 +103,7 @@ typedef struct
Elf64_Xword p_align; /* Segment alignment */
} Elf64_Phdr;
-typedef struct
+typedef struct Elf64_Shdr
{
Elf64_Word sh_name; /* Section name (string tbl index) */
Elf64_Word sh_type; /* Section type */
@@ -117,7 +117,7 @@ typedef struct
Elf64_Xword sh_entsize; /* Entry size if section holds table */
} Elf64_Shdr;
-typedef struct
+typedef struct Elf64_Dyn
{
Elf64_Sxword d_tag; /* Dynamic entry type */
union
@@ -127,13 +127,13 @@ typedef struct
} d_un;
} Elf64_Dyn;
-typedef struct
+typedef struct Elf64_Verdaux
{
Elf64_Word vda_name; /* Version or dependency names */
Elf64_Word vda_next; /* Offset in bytes to next verdaux entry */
} Elf64_Verdaux;
-typedef struct
+typedef struct Elf64_auxv_t
{
uint64 a_type; /* Entry type */
union
@@ -143,13 +143,13 @@ typedef struct
} Elf64_auxv_t;
-typedef struct {
+typedef struct symbol_key {
byte* name;
int32 sym_hash;
void** var_ptr;
} symbol_key;
-typedef struct {
+typedef struct version_key {
byte* version;
int32 ver_hash;
} version_key;