From 68d86cbc5906b6821fd2d44080634891fb9f3fab Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Sun, 27 Jan 2019 21:57:28 -0800 Subject: Ported BUILD file fixes for google3 to arrayapi branch. --- BUILD | 167 ++++++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 92 insertions(+), 75 deletions(-) (limited to 'BUILD') diff --git a/BUILD b/BUILD index ea63482..8ef3c79 100644 --- a/BUILD +++ b/BUILD @@ -1,15 +1,32 @@ load( ":build_defs.bzl", + "licenses", # copybara:strip_for_google3 "lua_cclibrary", "lua_library", "lua_binary", "lua_test", "generated_file_staleness_test", "make_shell_script", + "map_dep", "upb_amalgamation", "upb_proto_library", ) +licenses(["notice"]) # BSD (Google-authored w/ possible external contributions) + +exports_files([ + "LICENSE", + "build_defs", +]) + +COPTS = [ + # copybara:strip_for_google3_begin + "-std=c89", + "-pedantic", + "-Wno-long-long", + # copybara:strip_end +] + # C/C++ rules ################################################################## cc_library( @@ -46,11 +63,7 @@ cc_library( "upb/sink.h", "upb/upb.h", ], - copts = [ - "-std=c89", - "-pedantic", - "-Wno-long-long", - ], + copts = COPTS, visibility = ["//visibility:public"], ) @@ -64,11 +77,7 @@ cc_library( "upb/descriptor/descriptor.upbdefs.h", "upb/descriptor/reader.h", ], - copts = [ - "-std=c89", - "-pedantic", - "-Wno-long-long", - ], + copts = COPTS, deps = [":upb"], ) @@ -83,6 +92,7 @@ cc_library( "upb/pb/textprinter.c", "upb/pb/varint.c", "upb/pb/varint.int.h", + "upb/table.int.h", ], hdrs = [ "upb/pb/decoder.h", @@ -90,11 +100,7 @@ cc_library( "upb/pb/glue.h", "upb/pb/textprinter.h", ], - copts = [ - "-std=c89", - "-pedantic", - "-Wno-long-long", - ], + copts = COPTS, deps = [ ":upb", ":upb_descriptor", @@ -111,11 +117,7 @@ cc_library( "upb/json/parser.h", "upb/json/printer.h", ], - copts = [ - "-std=c89", - "-pedantic", - "-Wno-long-long", - ], + copts = COPTS, deps = [ ":upb", ":upb_pb", @@ -130,32 +132,43 @@ cc_library( deps = [":upb"], ) -# Amalgamation ################################################################# +# upb compiler ################################################################# -py_binary( - name = "amalgamate", - srcs = ["tools/amalgamate.py"], +cc_library( + name = "upbc_generator", + srcs = [ + "upbc/generator.cc", + "upbc/message_layout.cc", + "upbc/message_layout.h", + ], + hdrs = ["upbc/generator.h"], + deps = [ + map_dep("@absl//absl/strings"), + map_dep("@com_google_protobuf//:protobuf"), + map_dep("@com_google_protobuf//:protoc_lib"), + ], ) -upb_amalgamation( - name = "gen_amalgamation", - outs = [ - "upb.c", - "upb.h", - ], - amalgamator = ":amalgamate", - libs = [ - ":upb", - ":upb_descriptor", - ":upb_pb", - ":upb_json", +cc_binary( + name = "protoc-gen-upb", + srcs = ["upbc/main.cc"], + deps = [ + ":upbc_generator", + map_dep("@com_google_protobuf//:protoc_lib"), ], ) -cc_library( - name = "amalgamation", - srcs = ["upb.c"], - hdrs = ["upb.h"], +# We strip the tests and remaining rules from google3 until the upb_proto_library() +# and upb_proto_reflection_library() rules are fixed. + +# copybara:strip_for_google3_begin + +lua_binary( + name = "lua_upbc", + luadeps = [ + "lua/upbc_lib", + ], + luamain = "tools/upbc.lua", ) # C/C++ tests ################################################################## @@ -266,11 +279,11 @@ cc_binary( srcs = [ "tests/conformance_upb.c", ], + copts = ["-Ibazel-out/k8-fastbuild/bin"], deps = [ ":conformance_proto_upb", ":upb", ], - copts = ["-Ibazel-out/k8-fastbuild/bin"], ) make_shell_script( @@ -290,6 +303,35 @@ sh_test( ], ) +# Amalgamation ################################################################# + +py_binary( + name = "amalgamate", + srcs = ["tools/amalgamate.py"], +) + +upb_amalgamation( + name = "gen_amalgamation", + outs = [ + "upb.c", + "upb.h", + ], + amalgamator = ":amalgamate", + libs = [ + ":upb", + ":upb_descriptor", + ":upb_pb", + ":upb_json", + ], +) + +cc_library( + name = "amalgamation", + srcs = ["upb.c"], + hdrs = ["upb.h"], + copts = COPTS, +) + # Lua libraries. ############################################################### lua_cclibrary( @@ -375,42 +417,12 @@ lua_test( luamain = "tests/bindings/lua/test_upb.pb.lua", ) -# upb compiler ################################################################# - -lua_binary( - name = "lua_upbc", - luadeps = [ - "lua/upbc_lib", - ], - luamain = "tools/upbc.lua", -) - -cc_library( - name = "upbc_generator", - hdrs = ["upbc/generator.h"], - srcs = ["upbc/generator.cc", "upbc/message_layout.h", "upbc/message_layout.cc"], - deps = [ - "@com_google_protobuf//:protobuf", - "@com_google_protobuf//:protoc_lib", - "@absl//absl/strings", - ], -) - -cc_binary( - name = "protoc-gen-upb", - srcs = ["upbc/main.cc"], - deps = [ - ":upbc_generator", - "@com_google_protobuf//:protoc_lib", - ], -) - # Test the CMake build ######################################################### make_shell_script( name = "gen_run_cmake_build", out = "run_cmake_build.sh", - contents = "mkdir build && cd build && cmake .. && make -j8 && make test" + contents = "mkdir build && cd build && cmake .. && make -j8 && make test", ) sh_test( @@ -464,10 +476,13 @@ py_binary( genrule( name = "gen_cmakelists", + srcs = [ + "BUILD", + "WORKSPACE", + ], outs = ["generated/CMakeLists.txt"], - srcs = ["BUILD", "WORKSPACE"], + cmd = "$(location :make_cmakelists) $@", tools = [":make_cmakelists"], - cmd = "$(location :make_cmakelists) $@" ) genrule( @@ -511,8 +526,8 @@ genrule( ], cmd = "$(location @com_google_protobuf//:protoc) $< --upb_out=$(GENDIR)/generated --plugin=protoc-gen-upb=$(location :protoc-gen-upb)", tools = [ + ":protoc-gen-upb", "@com_google_protobuf//:protoc", - ":protoc-gen-upb" ], ) @@ -564,3 +579,5 @@ generated_file_staleness_test( ], generated_pattern = "generated/%s", ) + +# copybara:strip_end -- cgit v1.2.3 From 22ad7121c2792e3c473776c22f8e7a63a0116d33 Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Mon, 28 Jan 2019 12:07:06 -0800 Subject: Fixes for google3. --- BUILD | 1 - CMakeLists.txt | 1 - tests/json/test.upbdefs.c | 2 - tools/dump_cinit.lua | 1 - upb/bindings/lua/upb/table.c | 1 - upb/def.c | 5 +- upb/def.h | 153 ++++++++++++++++++++++++++-- upb/descriptor/descriptor.upbdefs.c | 2 - upb/handlers-inl.h | 2 + upb/handlers.c | 1 - upb/msgfactory.h | 6 ++ upb/pb/decoder.int.h | 1 - upb/structdefs.int.h | 196 ------------------------------------ 13 files changed, 155 insertions(+), 217 deletions(-) delete mode 100644 upb/structdefs.int.h (limited to 'BUILD') diff --git a/BUILD b/BUILD index 8ef3c79..b3a72ff 100644 --- a/BUILD +++ b/BUILD @@ -44,7 +44,6 @@ cc_library( "upb/port_undef.inc", "upb/refcounted.c", "upb/sink.c", - "upb/structdefs.int.h", "upb/structs.int.h", "upb/table.c", "upb/table.int.h", diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e1de27..49a8385 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,6 @@ add_library(upb upb/port_undef.inc upb/refcounted.c upb/sink.c - upb/structdefs.int.h upb/structs.int.h upb/table.c upb/table.int.h diff --git a/tests/json/test.upbdefs.c b/tests/json/test.upbdefs.c index 933fe5f..826be52 100644 --- a/tests/json/test.upbdefs.c +++ b/tests/json/test.upbdefs.c @@ -7,8 +7,6 @@ * regenerated. */ #include "upb/def.h" -#include "upb/structdefs.int.h" - static const upb_msgdef msgs[8]; static const upb_fielddef fields[37]; static const upb_enumdef enums[1]; diff --git a/tools/dump_cinit.lua b/tools/dump_cinit.lua index 34d9dd1..b46f951 100644 --- a/tools/dump_cinit.lua +++ b/tools/dump_cinit.lua @@ -432,7 +432,6 @@ local function dump_defs_c(filedef, append) -- Emit forward declarations. emit_file_warning(filedef, append) append('#include "upb/def.h"\n') - append('#include "upb/structdefs.int.h"\n\n') append("static const upb_msgdef %s;\n", linktab:cdecl(upb.DEF_MSG)) append("static const upb_fielddef %s;\n", linktab:cdecl(upb.DEF_FIELD)) if not linktab:empty(upb.DEF_ENUM) then diff --git a/upb/bindings/lua/upb/table.c b/upb/bindings/lua/upb/table.c index 79120c7..3a9319d 100644 --- a/upb/bindings/lua/upb/table.c +++ b/upb/bindings/lua/upb/table.c @@ -21,7 +21,6 @@ #include "lauxlib.h" #include "upb/bindings/lua/upb.h" #include "upb/def.h" -#include "upb/structdefs.int.h" #include "upb/table.int.h" static void lupbtable_setnum(lua_State *L, int tab, const char *key, diff --git a/upb/def.c b/upb/def.c index 379be0b..44dfdb5 100644 --- a/upb/def.c +++ b/upb/def.c @@ -4,7 +4,6 @@ #include #include #include -#include "upb/structdefs.int.h" #include "upb/handlers.h" typedef struct { @@ -663,6 +662,8 @@ static void freefield(upb_refcounted *r) { upb_fielddef_uninit_default(f); if (f->subdef_is_symbolic) upb_gfree(f->sub.name); + if (f->msg_is_symbolic) + upb_gfree(f->msg.name); upb_def_uninit(upb_fielddef_upcast_mutable(f)); upb_gfree(f); } @@ -1020,7 +1021,7 @@ bool upb_fielddef_setnumber(upb_fielddef *f, uint32_t number, upb_status *s) { s, "cannot change field number after adding to a message"); return false; } - if (number == 0 || number > UPB_MAX_FIELDNUMBER) { + if (number == 0) { upb_status_seterrf(s, "invalid field number (%u)", number); return false; } diff --git a/upb/def.h b/upb/def.h index 98b458a..35f7f13 100644 --- a/upb/def.h +++ b/upb/def.h @@ -118,9 +118,24 @@ class upb::Def { private: UPB_DISALLOW_POD_OPS(Def, upb::Def) +#else +struct upb_def { + upb_refcounted base; + + const char *fullname; + const upb_filedef* file; + char type; /* A upb_deftype_t (char to save space) */ + + /* Used as a flag during the def's mutable stage. Must be false unless + * it is currently being used by a function on the stack. This allows + * us to easily determine which defs were passed into the function's + * current invocation. */ + bool came_from_user; +#endif }; -#endif /* __cplusplus */ +#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \ + { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false } UPB_BEGIN_EXTERN_C @@ -582,12 +597,57 @@ class upb::FieldDef { private: UPB_DISALLOW_POD_OPS(FieldDef, upb::FieldDef) -}; - +#else +struct upb_fielddef { + upb_def base; + + union { + int64_t sint; + uint64_t uint; + double dbl; + float flt; + void *bytes; + } defaultval; + union { + const upb_msgdef *def; /* If !msg_is_symbolic. */ + char *name; /* If msg_is_symbolic. */ + } msg; + union { + const upb_def *def; /* If !subdef_is_symbolic. */ + char *name; /* If subdef_is_symbolic. */ + } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */ + bool subdef_is_symbolic; + bool msg_is_symbolic; + const upb_oneofdef *oneof; + bool default_is_string; + bool type_is_set_; /* False until type is explicitly set. */ + bool is_extension_; + bool lazy_; + bool packed_; + upb_intfmt_t intfmt; + bool tagdelim; + upb_fieldtype_t type_; + upb_label_t label_; + uint32_t number_; + uint32_t selector_base; /* Used to index into a upb::Handlers table. */ + uint32_t index_; # endif /* defined(__cplusplus) */ +}; UPB_BEGIN_EXTERN_C +extern const struct upb_refcounted_vtbl upb_fielddef_vtbl; + +#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \ + packed, name, num, msgdef, subdef, selector_base, \ + index, defaultval, refs, ref2s) \ + { \ + UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \ + defaultval, {msgdef}, {subdef}, NULL, false, false, \ + type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \ + lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \ + } + /* Native C API. */ upb_fielddef *upb_fielddef_new(const void *owner); @@ -937,12 +997,45 @@ class upb::MessageDef { private: UPB_DISALLOW_POD_OPS(MessageDef, upb::MessageDef) -}; +#else +struct upb_msgdef { + upb_def base; + + size_t selector_count; + uint32_t submsg_field_count; + + /* Tables for looking up fields by number and name. */ + upb_inttable itof; /* int to field */ + upb_strtable ntof; /* name to field/oneof */ + + /* Is this a map-entry message? */ + bool map_entry; + + /* Whether this message has proto2 or proto3 semantics. */ + upb_syntax_t syntax; + /* Type of well known type message. UPB_WELLKNOWN_UNSPECIFIED for + * non-well-known message. */ + upb_wellknowntype_t well_known_type; + + /* TODO(haberman): proper extension ranges (there can be multiple). */ #endif /* __cplusplus */ +}; UPB_BEGIN_EXTERN_C +extern const struct upb_refcounted_vtbl upb_msgdef_vtbl; + +/* TODO: also support static initialization of the oneofs table. This will be + * needed if we compile in descriptors that contain oneofs. */ +#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \ + map_entry, syntax, well_known_type, refs, ref2s) \ + { \ + UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \ + selector_count, submsg_field_count, itof, ntof, map_entry, syntax, \ + well_known_type \ + } + /* Returns NULL if memory allocation failed. */ upb_msgdef *upb_msgdef_new(const void *owner); @@ -1121,12 +1214,24 @@ class upb::EnumDef { private: UPB_DISALLOW_POD_OPS(EnumDef, upb::EnumDef) -}; +#else +struct upb_enumdef { + upb_def base; + upb_strtable ntoi; + upb_inttable iton; + int32_t defaultval; #endif /* __cplusplus */ +}; UPB_BEGIN_EXTERN_C +extern const struct upb_refcounted_vtbl upb_enumdef_vtbl; + +#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \ + { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \ + iton, defaultval } + /* Native C API. */ upb_enumdef *upb_enumdef_new(const void *owner); @@ -1275,12 +1380,25 @@ class upb::OneofDef { private: UPB_DISALLOW_POD_OPS(OneofDef, upb::OneofDef) -}; - +#else +struct upb_oneofdef { + upb_refcounted base; + + uint32_t index; /* Index within oneofs. */ + const char *name; + upb_strtable ntof; + upb_inttable itof; + const upb_msgdef *parent; #endif /* __cplusplus */ +}; UPB_BEGIN_EXTERN_C +extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl; + +#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \ + { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof } + /* Native C API. */ upb_oneofdef *upb_oneofdef_new(const void *owner); @@ -1399,12 +1517,25 @@ class upb::FileDef { private: UPB_DISALLOW_POD_OPS(FileDef, upb::FileDef) -}; +#else +struct upb_filedef { + upb_refcounted base; + + const char *name; + const char *package; + const char *phpprefix; + const char *phpnamespace; + upb_syntax_t syntax; + upb_inttable defs; + upb_inttable deps; #endif +}; UPB_BEGIN_EXTERN_C +extern const struct upb_refcounted_vtbl upb_filedef_vtbl; + upb_filedef *upb_filedef_new(const void *owner); /* Include upb_refcounted methods like upb_msgdef_ref(). */ @@ -1534,9 +1665,13 @@ class upb::SymbolTable { private: UPB_DISALLOW_POD_OPS(SymbolTable, upb::SymbolTable) -}; +#else +struct upb_symtab { + upb_refcounted base; + upb_strtable symtab; #endif /* __cplusplus */ +}; UPB_BEGIN_EXTERN_C diff --git a/upb/descriptor/descriptor.upbdefs.c b/upb/descriptor/descriptor.upbdefs.c index fa5bb3b..d91f674 100644 --- a/upb/descriptor/descriptor.upbdefs.c +++ b/upb/descriptor/descriptor.upbdefs.c @@ -7,8 +7,6 @@ * regenerated. */ #include "upb/def.h" -#include "upb/structdefs.int.h" - static const upb_msgdef msgs[22]; static const upb_fielddef fields[107]; static const upb_enumdef enums[5]; diff --git a/upb/handlers-inl.h b/upb/handlers-inl.h index afc1382..4a0494c 100644 --- a/upb/handlers-inl.h +++ b/upb/handlers-inl.h @@ -7,6 +7,8 @@ #define UPB_HANDLERS_INL_H_ #include +#include "upb/upb.h" +#include "upb/handlers.h" /* C inline methods. */ diff --git a/upb/handlers.c b/upb/handlers.c index 0022c32..33c43c3 100644 --- a/upb/handlers.c +++ b/upb/handlers.c @@ -4,7 +4,6 @@ */ #include "upb/handlers.h" -#include "upb/structdefs.int.h" #include diff --git a/upb/msgfactory.h b/upb/msgfactory.h index 73a26ba..8b12461 100644 --- a/upb/msgfactory.h +++ b/upb/msgfactory.h @@ -5,6 +5,12 @@ #ifndef UPB_MSGFACTORY_H_ #define UPB_MSGFACTORY_H_ +#ifdef __cplusplus +namespace upb { +class MessageFactory; +} +#endif + UPB_DECLARE_TYPE(upb::MessageFactory, upb_msgfactory) /** upb_msgfactory ************************************************************/ diff --git a/upb/pb/decoder.int.h b/upb/pb/decoder.int.h index 4032570..f02bdd5 100644 --- a/upb/pb/decoder.int.h +++ b/upb/pb/decoder.int.h @@ -9,7 +9,6 @@ #include "upb/handlers.h" #include "upb/pb/decoder.h" #include "upb/sink.h" -#include "upb/structdefs.int.h" #include "upb/table.int.h" /* C++ names are not actually used since this type isn't exposed to users. */ diff --git a/upb/structdefs.int.h b/upb/structdefs.int.h deleted file mode 100644 index cf8bd1d..0000000 --- a/upb/structdefs.int.h +++ /dev/null @@ -1,196 +0,0 @@ -/* -** This file contains definitions of structs that should be considered private -** and NOT stable across versions of upb. -** -** The only reason they are declared here and not in .c files is to allow upb -** and the application (if desired) to embed statically-initialized instances -** of structures like defs. -** -** If you include this file, all guarantees of ABI compatibility go out the -** window! Any code that includes this file needs to recompile against the -** exact same version of upb that they are linking against. -** -** You also need to recompile if you change the value of the UPB_DEBUG_REFS -** flag. -*/ - -#include "upb/def.h" - -#ifndef UPB_STATICINIT_H_ -#define UPB_STATICINIT_H_ - -#ifdef __cplusplus -/* Because of how we do our typedefs, this header can't be included from C++. */ -#error This file cannot be included from C++ -#endif - -/* upb_refcounted *************************************************************/ - - -/* upb_def ********************************************************************/ - -struct upb_def { - upb_refcounted base; - - const char *fullname; - const upb_filedef* file; - char type; /* A upb_deftype_t (char to save space) */ - - /* Used as a flag during the def's mutable stage. Must be false unless - * it is currently being used by a function on the stack. This allows - * us to easily determine which defs were passed into the function's - * current invocation. */ - bool came_from_user; -}; - -#define UPB_DEF_INIT(name, type, vtbl, refs, ref2s) \ - { UPB_REFCOUNT_INIT(vtbl, refs, ref2s), name, NULL, type, false } - - -/* upb_fielddef ***************************************************************/ - -struct upb_fielddef { - upb_def base; - - union { - int64_t sint; - uint64_t uint; - double dbl; - float flt; - void *bytes; - } defaultval; - union { - const upb_msgdef *def; /* If !msg_is_symbolic. */ - char *name; /* If msg_is_symbolic. */ - } msg; - union { - const upb_def *def; /* If !subdef_is_symbolic. */ - char *name; /* If subdef_is_symbolic. */ - } sub; /* The msgdef or enumdef for this field, if upb_hassubdef(f). */ - bool subdef_is_symbolic; - bool msg_is_symbolic; - const upb_oneofdef *oneof; - bool default_is_string; - bool type_is_set_; /* False until type is explicitly set. */ - bool is_extension_; - bool lazy_; - bool packed_; - upb_intfmt_t intfmt; - bool tagdelim; - upb_fieldtype_t type_; - upb_label_t label_; - uint32_t number_; - uint32_t selector_base; /* Used to index into a upb::Handlers table. */ - uint32_t index_; -}; - -extern const struct upb_refcounted_vtbl upb_fielddef_vtbl; - -#define UPB_FIELDDEF_INIT(label, type, intfmt, tagdelim, is_extension, lazy, \ - packed, name, num, msgdef, subdef, selector_base, \ - index, defaultval, refs, ref2s) \ - { \ - UPB_DEF_INIT(name, UPB_DEF_FIELD, &upb_fielddef_vtbl, refs, ref2s), \ - defaultval, {msgdef}, {subdef}, NULL, false, false, \ - type == UPB_TYPE_STRING || type == UPB_TYPE_BYTES, true, is_extension, \ - lazy, packed, intfmt, tagdelim, type, label, num, selector_base, index \ - } - - -/* upb_msgdef *****************************************************************/ - -struct upb_msgdef { - upb_def base; - - size_t selector_count; - uint32_t submsg_field_count; - - /* Tables for looking up fields by number and name. */ - upb_inttable itof; /* int to field */ - upb_strtable ntof; /* name to field/oneof */ - - /* Is this a map-entry message? */ - bool map_entry; - - /* Whether this message has proto2 or proto3 semantics. */ - upb_syntax_t syntax; - - /* Type of well known type message. UPB_WELLKNOWN_UNSPECIFIED for - * non-well-known message. */ - upb_wellknowntype_t well_known_type; - - /* TODO(haberman): proper extension ranges (there can be multiple). */ -}; - -extern const struct upb_refcounted_vtbl upb_msgdef_vtbl; - -/* TODO: also support static initialization of the oneofs table. This will be - * needed if we compile in descriptors that contain oneofs. */ -#define UPB_MSGDEF_INIT(name, selector_count, submsg_field_count, itof, ntof, \ - map_entry, syntax, well_known_type, refs, ref2s) \ - { \ - UPB_DEF_INIT(name, UPB_DEF_MSG, &upb_fielddef_vtbl, refs, ref2s), \ - selector_count, submsg_field_count, itof, ntof, map_entry, syntax, \ - well_known_type \ - } - - -/* upb_enumdef ****************************************************************/ - -struct upb_enumdef { - upb_def base; - - upb_strtable ntoi; - upb_inttable iton; - int32_t defaultval; -}; - -extern const struct upb_refcounted_vtbl upb_enumdef_vtbl; - -#define UPB_ENUMDEF_INIT(name, ntoi, iton, defaultval, refs, ref2s) \ - { UPB_DEF_INIT(name, UPB_DEF_ENUM, &upb_enumdef_vtbl, refs, ref2s), ntoi, \ - iton, defaultval } - - -/* upb_oneofdef ***************************************************************/ - -struct upb_oneofdef { - upb_refcounted base; - - uint32_t index; /* Index within oneofs. */ - const char *name; - upb_strtable ntof; - upb_inttable itof; - const upb_msgdef *parent; -}; - -extern const struct upb_refcounted_vtbl upb_oneofdef_vtbl; - -#define UPB_ONEOFDEF_INIT(name, ntof, itof, refs, ref2s) \ - { UPB_REFCOUNT_INIT(&upb_oneofdef_vtbl, refs, ref2s), 0, name, ntof, itof } - - -/* upb_symtab *****************************************************************/ - -struct upb_symtab { - upb_refcounted base; - - upb_strtable symtab; -}; - -struct upb_filedef { - upb_refcounted base; - - const char *name; - const char *package; - const char *phpprefix; - const char *phpnamespace; - upb_syntax_t syntax; - - upb_inttable defs; - upb_inttable deps; -}; - -extern const struct upb_refcounted_vtbl upb_filedef_vtbl; - -#endif /* UPB_STATICINIT_H_ */ -- cgit v1.2.3 From 3d931557907307ecc19b74e8f3188301b149e99a Mon Sep 17 00:00:00 2001 From: Josh Haberman Date: Mon, 28 Jan 2019 12:45:08 -0800 Subject: Fix to deps. --- BUILD | 1 + build_defs.bzl | 1 + 2 files changed, 2 insertions(+) (limited to 'BUILD') diff --git a/BUILD b/BUILD index b3a72ff..1cef4b8 100644 --- a/BUILD +++ b/BUILD @@ -142,6 +142,7 @@ cc_library( ], hdrs = ["upbc/generator.h"], deps = [ + map_dep("@absl//absl/base:core_headers"), map_dep("@absl//absl/strings"), map_dep("@com_google_protobuf//:protobuf"), map_dep("@com_google_protobuf//:protoc_lib"), diff --git a/build_defs.bzl b/build_defs.bzl index a6e5086..6cf387e 100644 --- a/build_defs.bzl +++ b/build_defs.bzl @@ -210,6 +210,7 @@ upb_amalgamation = rule( is_bazel = not hasattr(native, "genmpm") google3_dep_map = { + "@absl//absl/base:core_headers": "//third_party/absl/base:core_headers", "@absl//absl/strings": "//third_party/absl/strings", "@com_google_protobuf//:protoc": "//third_party/protobuf:protoc", "@com_google_protobuf//:protobuf": "//third_party/protobuf:protobuf", -- cgit v1.2.3