]> git.ipfire.org Git - thirdparty/gcc.git/blame - libgo/runtime/go-unsafe-pointer.c
libgo: don't use wc in gotest
[thirdparty/gcc.git] / libgo / runtime / go-unsafe-pointer.c
CommitLineData
e440a328 1/* go-unsafe-pointer.c -- unsafe.Pointer type descriptor for Go.
2
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
6
7#include <stddef.h>
8
1b1f2abf 9#include "runtime.h"
e440a328 10#include "go-type.h"
11
12/* This file provides the type descriptor for the unsafe.Pointer type.
13 The unsafe package is defined by the compiler itself, which means
14 that there is no package to compile to define the type
15 descriptor. */
16
17extern const struct __go_type_descriptor unsafe_Pointer
13f2fdb8 18 __asm__ (GOSYM_PREFIX "unsafe.Pointer..d");
e440a328 19
03118c21 20extern const byte unsafe_Pointer_gc[]
13f2fdb8 21 __asm__ (GOSYM_PREFIX "unsafe.Pointer..g");
aa5ae575 22
e440a328 23/* Used to determine the field alignment. */
24struct field_align
25{
26 char c;
27 void *p;
28};
29
30/* The reflection string. */
31#define REFLECTION "unsafe.Pointer"
1b1f2abf 32static const String reflection_string =
e440a328 33{
1b1f2abf 34 (const byte *) REFLECTION,
e440a328 35 sizeof REFLECTION - 1
36};
37
03118c21 38const byte unsafe_Pointer_gc[] = { 1 };
aa5ae575 39
13889f46 40extern const FuncVal runtime_pointerhash_descriptor
13f2fdb8 41 __asm__ (GOSYM_PREFIX "runtime.pointerhash..f");
13889f46 42extern const FuncVal runtime_pointerequal_descriptor
13f2fdb8 43 __asm__ (GOSYM_PREFIX "runtime.pointerequal..f");
13889f46 44
e440a328 45const struct __go_type_descriptor unsafe_Pointer =
46{
03118c21 47 /* __size */
48 sizeof (void *),
49 /* __ptrdata */
50 sizeof (void *),
51 /* __hash */
52 78501163U,
e440a328 53 /* __code */
f11c2155 54 GO_UNSAFE_POINTER | GO_DIRECT_IFACE,
e440a328 55 /* __align */
56 __alignof (void *),
57 /* __field_align */
58 offsetof (struct field_align, p) - 1,
e440a328 59 /* __hashfn */
13889f46 60 &runtime_pointerhash_descriptor,
e440a328 61 /* __equalfn */
13889f46 62 &runtime_pointerequal_descriptor,
03118c21 63 /* __gcdata */
aa5ae575 64 unsafe_Pointer_gc,
e440a328 65 /* __reflection */
66 &reflection_string,
67 /* __uncommon */
31c6ec42 68 NULL,
69 /* __pointer_to_this */
19d0f2fa 70 NULL
e440a328 71};
72
73/* We also need the type descriptor for the pointer to unsafe.Pointer,
74 since any package which refers to that type descriptor will expect
75 it to be defined elsewhere. */
76
77extern const struct __go_ptr_type pointer_unsafe_Pointer
13f2fdb8 78 __asm__ (GOSYM_PREFIX "type...1unsafe.Pointer");
e440a328 79
80/* The reflection string. */
81#define PREFLECTION "*unsafe.Pointer"
1b1f2abf 82static const String preflection_string =
e440a328 83{
1b1f2abf 84 (const byte *) PREFLECTION,
e440a328 85 sizeof PREFLECTION - 1,
86};
87
03118c21 88extern const byte pointer_unsafe_Pointer_gc[]
13f2fdb8 89 __asm__ (GOSYM_PREFIX "type...1unsafe.Pointer..g");
05d523f4 90
03118c21 91const byte pointer_unsafe_Pointer_gc[] = { 1 };
05d523f4 92
e440a328 93const struct __go_ptr_type pointer_unsafe_Pointer =
94{
95 /* __common */
96 {
03118c21 97 /* __size */
98 sizeof (void *),
99 /* __ptrdata */
100 sizeof (void *),
101 /* __hash */
102 1256018616U,
e440a328 103 /* __code */
f11c2155 104 GO_PTR | GO_DIRECT_IFACE,
e440a328 105 /* __align */
106 __alignof (void *),
107 /* __field_align */
108 offsetof (struct field_align, p) - 1,
e440a328 109 /* __hashfn */
13889f46 110 &runtime_pointerhash_descriptor,
e440a328 111 /* __equalfn */
13889f46 112 &runtime_pointerequal_descriptor,
03118c21 113 /* __gcdata */
05d523f4 114 pointer_unsafe_Pointer_gc,
e440a328 115 /* __reflection */
116 &preflection_string,
117 /* __uncommon */
31c6ec42 118 NULL,
119 /* __pointer_to_this */
19d0f2fa 120 NULL
e440a328 121 },
122 /* __element_type */
123 &unsafe_Pointer
124};