WPILibC++ 2027.0.0-alpha-3
Loading...
Searching...
No Matches
def_type.h
Go to the documentation of this file.
1// Protocol Buffers - Google's data interchange format
2// Copyright 2023 Google LLC. All rights reserved.
3//
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file or at
6// https://developers.google.com/open-source/licenses/bsd
7
8#ifndef UPB_REFLECTION_DEF_TYPE_H_
9#define UPB_REFLECTION_DEF_TYPE_H_
10
11#include "upb/hash/common.h"
12
13// Must be last.
14#include "upb/port/def.inc"
15
16// Inside a symtab we store tagged pointers to specific def types.
17typedef enum {
19
20 // Only inside symtab table.
26
27 // Only inside message table.
31
32#ifdef __cplusplus
33extern "C" {
34#endif
35
36// Our 3-bit pointer tagging requires all pointers to be multiples of 8.
37// The arena will always yield 8-byte-aligned addresses, however we put
38// the defs into arrays. For each element in the array to be 8-byte-aligned,
39// the sizes of each def type must also be a multiple of 8.
40//
41// If any of these asserts fail, we need to add or remove padding on 32-bit
42// machines (64-bit machines will have 8-byte alignment already due to
43// pointers, which all of these structs have).
45 UPB_ASSERT((size & UPB_DEFTYPE_MASK) == 0);
46}
47
49
51
53
54#ifdef __cplusplus
55} /* extern "C" */
56#endif
57
58#include "upb/port/undef.inc"
59
60#endif /* UPB_REFLECTION_DEF_TYPE_H_ */
#define UPB_ASSERT(expr)
Definition def.inc:329
#define UPB_INLINE
Definition def.inc:144
upb_deftype_t _upb_DefType_Type(upb_value v)
UPB_INLINE void _upb_DefType_CheckPadding(size_t size)
Definition def_type.h:44
upb_value _upb_DefType_Pack(const void *ptr, upb_deftype_t type)
upb_deftype_t
Definition def_type.h:17
@ UPB_DEFTYPE_FIELD
Definition def_type.h:28
@ UPB_DEFTYPE_ONEOF
Definition def_type.h:29
@ UPB_DEFTYPE_SERVICE
Definition def_type.h:25
@ UPB_DEFTYPE_ENUM
Definition def_type.h:23
@ UPB_DEFTYPE_EXT
Definition def_type.h:21
@ UPB_DEFTYPE_MSG
Definition def_type.h:22
@ UPB_DEFTYPE_ENUMVAL
Definition def_type.h:24
@ UPB_DEFTYPE_MASK
Definition def_type.h:18
const void * _upb_DefType_Unpack(upb_value v, upb_deftype_t type)
auto ptr(T p) -> const void *
Converts p to const void* for pointer formatting.
Definition format.h:3963
Definition common.h:44