diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-08-30 21:49:49 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2019-08-30 21:49:49 +0000 |
commit | 4a140826453da37a134d792e0224f4e37343e68a (patch) | |
tree | 04d27dc317f007c64a3954cd2744b89bc7ed0b47 /libgo/runtime/go-unsafe-pointer.c | |
parent | aff0632d4fa0d55b2c830e5dc975242dd246fc87 (diff) | |
download | gcc-4a140826453da37a134d792e0224f4e37343e68a.zip gcc-4a140826453da37a134d792e0224f4e37343e68a.tar.gz gcc-4a140826453da37a134d792e0224f4e37343e68a.tar.bz2 |
compile, runtime: permit anonymous and empty fields in C header
Permit putting structs with anonymous and empty fields in the C header
file runtime.inc that is used to build the C runtime code. This is
required for upcoming 1.13 support, as the m struct has picked up an
anonymous field.
Doing this lets the C header contain all the type descriptor structs,
so start using those in the C code. This cuts the number of copies of
type descriptor definitions from 3 to 2.
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/192343
From-SVN: r275227
Diffstat (limited to 'libgo/runtime/go-unsafe-pointer.c')
-rw-r--r-- | libgo/runtime/go-unsafe-pointer.c | 69 |
1 files changed, 36 insertions, 33 deletions
diff --git a/libgo/runtime/go-unsafe-pointer.c b/libgo/runtime/go-unsafe-pointer.c index 5afd011..d987aca 100644 --- a/libgo/runtime/go-unsafe-pointer.c +++ b/libgo/runtime/go-unsafe-pointer.c @@ -7,14 +7,13 @@ #include <stddef.h> #include "runtime.h" -#include "go-type.h" /* This file provides the type descriptor for the unsafe.Pointer type. The unsafe package is defined by the compiler itself, which means that there is no package to compile to define the type descriptor. */ -extern const struct __go_type_descriptor unsafe_Pointer +extern const struct _type unsafe_Pointer __asm__ (GOSYM_PREFIX "unsafe.Pointer..d"); extern const byte unsafe_Pointer_gc[] @@ -42,31 +41,33 @@ extern const FuncVal runtime_pointerhash_descriptor extern const FuncVal runtime_pointerequal_descriptor __asm__ (GOSYM_PREFIX "runtime.pointerequal..f"); -const struct __go_type_descriptor unsafe_Pointer = +const struct _type unsafe_Pointer = { - /* __size */ + /* size */ sizeof (void *), - /* __ptrdata */ + /* ptrdata */ sizeof (void *), - /* __hash */ + /* hash */ 78501163U, - /* __code */ - GO_UNSAFE_POINTER | GO_DIRECT_IFACE, - /* __align */ + /* kind */ + kindUnsafePointer | kindDirectIface, + /* align */ __alignof (void *), - /* __field_align */ + /* fieldAlign */ offsetof (struct field_align, p) - 1, - /* __hashfn */ + /* _ */ + 0, + /* hashfn */ &runtime_pointerhash_descriptor, - /* __equalfn */ + /* equalfn */ &runtime_pointerequal_descriptor, - /* __gcdata */ + /* gcdata */ unsafe_Pointer_gc, - /* __reflection */ + /* _string */ &reflection_string, - /* __uncommon */ + /* uncommontype */ NULL, - /* __pointer_to_this */ + /* ptrToThis */ NULL }; @@ -74,7 +75,7 @@ const struct __go_type_descriptor unsafe_Pointer = since any package which refers to that type descriptor will expect it to be defined elsewhere. */ -extern const struct __go_ptr_type pointer_unsafe_Pointer +extern const struct ptrtype pointer_unsafe_Pointer __asm__ (GOSYM_PREFIX "type...1unsafe.Pointer"); /* The reflection string. */ @@ -90,35 +91,37 @@ extern const byte pointer_unsafe_Pointer_gc[] const byte pointer_unsafe_Pointer_gc[] = { 1 }; -const struct __go_ptr_type pointer_unsafe_Pointer = +const struct ptrtype pointer_unsafe_Pointer = { - /* __common */ + /* type */ { - /* __size */ + /* size */ sizeof (void *), - /* __ptrdata */ + /* ptrdata */ sizeof (void *), - /* __hash */ + /* hash */ 1256018616U, - /* __code */ - GO_PTR | GO_DIRECT_IFACE, - /* __align */ + /* kind */ + kindPtr | kindDirectIface, + /* align */ __alignof (void *), - /* __field_align */ + /* fieldAlign */ offsetof (struct field_align, p) - 1, - /* __hashfn */ + /* _ */ + 0, + /*_hashfn */ &runtime_pointerhash_descriptor, - /* __equalfn */ + /* equalfn */ &runtime_pointerequal_descriptor, - /* __gcdata */ + /* gcdata */ pointer_unsafe_Pointer_gc, - /* __reflection */ + /* _string */ &preflection_string, - /* __uncommon */ + /* uncommontype */ NULL, - /* __pointer_to_this */ + /* ptrToThis */ NULL }, - /* __element_type */ + /* elem */ &unsafe_Pointer }; |