PR 47802 Use builtins to check localtime_r return type
[official-gcc.git] / libgo / runtime / go-unreflect.c
blob886048548768d010b3048cdfc0091e8eb1445fd2
1 /* go-unreflect.c -- implement unsafe.Unreflect for Go.
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. */
7 #include "go-alloc.h"
8 #include "go-type.h"
9 #include "interface.h"
11 /* Implement unsafe.Unreflect. */
13 struct __go_empty_interface Unreflect (struct __go_empty_interface type,
14 void *object)
15 asm ("libgo_unsafe.unsafe.Unreflect");
17 struct __go_empty_interface
18 Unreflect (struct __go_empty_interface type, void *object)
20 struct __go_empty_interface ret;
22 /* FIXME: We should check __type_descriptor to verify that this is
23 really a type descriptor. */
24 ret.__type_descriptor = type.__object;
25 if (__go_is_pointer_type (ret.__type_descriptor))
26 ret.__object = *(void **) object;
27 else
28 ret.__object = object;
29 return ret;