Make function declarations proper prototypes by adding `void`.

Fixes the warning:
```
warning: a function declaration without a prototype is deprecated in all versions of C [-Wstrict-prototypes]
extern const upb_MiniTable* google__protobuf__OneofDescriptorProto_msg_init();
                                                                           ^
                                                                            void
```
PiperOrigin-RevId: 664971019
pull/17863/head
Joshua Haberman 3 months ago committed by Copybara-Service
parent a7ddd35206
commit ebd9838248
  1. 100
      upb/reflection/stage0/google/protobuf/descriptor.upb.h
  2. 8
      upb_generator/protoc-gen-upb.cc
  3. 14
      upb_generator/stage0/google/protobuf/compiler/plugin.upb.h

@ -18,56 +18,56 @@
extern "C" {
#endif
extern const upb_MiniTable* google__protobuf__FileDescriptorSet_msg_init();
extern const upb_MiniTable* google__protobuf__FileDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__DescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__DescriptorProto__ExtensionRange_msg_init();
extern const upb_MiniTable* google__protobuf__DescriptorProto__ReservedRange_msg_init();
extern const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init();
extern const upb_MiniTable* google__protobuf__ExtensionRangeOptions__Declaration_msg_init();
extern const upb_MiniTable* google__protobuf__FieldDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__OneofDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__EnumDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init();
extern const upb_MiniTable* google__protobuf__EnumValueDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__ServiceDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__MethodDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__FileOptions_msg_init();
extern const upb_MiniTable* google__protobuf__MessageOptions_msg_init();
extern const upb_MiniTable* google__protobuf__FieldOptions_msg_init();
extern const upb_MiniTable* google__protobuf__FieldOptions__EditionDefault_msg_init();
extern const upb_MiniTable* google__protobuf__FieldOptions__FeatureSupport_msg_init();
extern const upb_MiniTable* google__protobuf__OneofOptions_msg_init();
extern const upb_MiniTable* google__protobuf__EnumOptions_msg_init();
extern const upb_MiniTable* google__protobuf__EnumValueOptions_msg_init();
extern const upb_MiniTable* google__protobuf__ServiceOptions_msg_init();
extern const upb_MiniTable* google__protobuf__MethodOptions_msg_init();
extern const upb_MiniTable* google__protobuf__UninterpretedOption_msg_init();
extern const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init();
extern const upb_MiniTable* google__protobuf__FeatureSet_msg_init();
extern const upb_MiniTable* google__protobuf__FeatureSetDefaults_msg_init();
extern const upb_MiniTable* google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init();
extern const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init();
extern const upb_MiniTable* google__protobuf__SourceCodeInfo__Location_msg_init();
extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init();
extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_init();
extern const upb_MiniTableEnum* google_protobuf_Edition_enum_init();
extern const upb_MiniTableEnum* google_protobuf_ExtensionRangeOptions_VerificationState_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_EnumType_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_FieldPresence_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_JsonFormat_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_MessageEncoding_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_Utf8Validation_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FieldDescriptorProto_Label_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FieldDescriptorProto_Type_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_CType_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_JSType_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_OptionRetention_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_OptionTargetType_enum_init();
extern const upb_MiniTableEnum* google_protobuf_FileOptions_OptimizeMode_enum_init();
extern const upb_MiniTableEnum* google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init();
extern const upb_MiniTableEnum* google_protobuf_MethodOptions_IdempotencyLevel_enum_init();
extern const upb_MiniTable* google__protobuf__FileDescriptorSet_msg_init(void);
extern const upb_MiniTable* google__protobuf__FileDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__DescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__DescriptorProto__ExtensionRange_msg_init(void);
extern const upb_MiniTable* google__protobuf__DescriptorProto__ReservedRange_msg_init(void);
extern const upb_MiniTable* google__protobuf__ExtensionRangeOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__ExtensionRangeOptions__Declaration_msg_init(void);
extern const upb_MiniTable* google__protobuf__FieldDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__OneofDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__EnumDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__EnumDescriptorProto__EnumReservedRange_msg_init(void);
extern const upb_MiniTable* google__protobuf__EnumValueDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__ServiceDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__MethodDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__FileOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__MessageOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__FieldOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__FieldOptions__EditionDefault_msg_init(void);
extern const upb_MiniTable* google__protobuf__FieldOptions__FeatureSupport_msg_init(void);
extern const upb_MiniTable* google__protobuf__OneofOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__EnumOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__EnumValueOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__ServiceOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__MethodOptions_msg_init(void);
extern const upb_MiniTable* google__protobuf__UninterpretedOption_msg_init(void);
extern const upb_MiniTable* google__protobuf__UninterpretedOption__NamePart_msg_init(void);
extern const upb_MiniTable* google__protobuf__FeatureSet_msg_init(void);
extern const upb_MiniTable* google__protobuf__FeatureSetDefaults_msg_init(void);
extern const upb_MiniTable* google__protobuf__FeatureSetDefaults__FeatureSetEditionDefault_msg_init(void);
extern const upb_MiniTable* google__protobuf__SourceCodeInfo_msg_init(void);
extern const upb_MiniTable* google__protobuf__SourceCodeInfo__Location_msg_init(void);
extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init(void);
extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo__Annotation_msg_init(void);
extern const upb_MiniTableEnum* google_protobuf_Edition_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_ExtensionRangeOptions_VerificationState_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_EnumType_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_FieldPresence_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_JsonFormat_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_MessageEncoding_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_RepeatedFieldEncoding_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FeatureSet_Utf8Validation_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FieldDescriptorProto_Label_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FieldDescriptorProto_Type_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_CType_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_JSType_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_OptionRetention_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FieldOptions_OptionTargetType_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_FileOptions_OptimizeMode_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_GeneratedCodeInfo_Annotation_Semantic_enum_init(void);
extern const upb_MiniTableEnum* google_protobuf_MethodOptions_IdempotencyLevel_enum_init(void);
typedef struct google_protobuf_FileDescriptorSet { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorSet;
typedef struct google_protobuf_FileDescriptorProto { upb_Message UPB_PRIVATE(base); } google_protobuf_FileDescriptorProto;

@ -924,13 +924,15 @@ void WriteHeader(const DefPoolPair& pools, upb::FileDefPtr file,
if (options.bootstrap_stage == 0) {
for (auto message : this_file_messages) {
output("extern const upb_MiniTable* $0();\n", MessageInitName(message));
output("extern const upb_MiniTable* $0(void);\n",
MessageInitName(message));
}
for (auto message : forward_messages) {
output("extern const upb_MiniTable* $0();\n", MessageInitName(message));
output("extern const upb_MiniTable* $0(void);\n",
MessageInitName(message));
}
for (auto enumdesc : this_file_enums) {
output("extern const upb_MiniTableEnum* $0();\n", EnumInit(enumdesc));
output("extern const upb_MiniTableEnum* $0(void);\n", EnumInit(enumdesc));
}
output("\n");
}

@ -18,13 +18,13 @@
extern "C" {
#endif
extern const upb_MiniTable* google__protobuf__compiler__Version_msg_init();
extern const upb_MiniTable* google__protobuf__compiler__CodeGeneratorRequest_msg_init();
extern const upb_MiniTable* google__protobuf__compiler__CodeGeneratorResponse_msg_init();
extern const upb_MiniTable* google__protobuf__compiler__CodeGeneratorResponse__File_msg_init();
extern const upb_MiniTable* google__protobuf__FileDescriptorProto_msg_init();
extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init();
extern const upb_MiniTableEnum* google_protobuf_compiler_CodeGeneratorResponse_Feature_enum_init();
extern const upb_MiniTable* google__protobuf__compiler__Version_msg_init(void);
extern const upb_MiniTable* google__protobuf__compiler__CodeGeneratorRequest_msg_init(void);
extern const upb_MiniTable* google__protobuf__compiler__CodeGeneratorResponse_msg_init(void);
extern const upb_MiniTable* google__protobuf__compiler__CodeGeneratorResponse__File_msg_init(void);
extern const upb_MiniTable* google__protobuf__FileDescriptorProto_msg_init(void);
extern const upb_MiniTable* google__protobuf__GeneratedCodeInfo_msg_init(void);
extern const upb_MiniTableEnum* google_protobuf_compiler_CodeGeneratorResponse_Feature_enum_init(void);
typedef struct google_protobuf_compiler_Version { upb_Message UPB_PRIVATE(base); } google_protobuf_compiler_Version;
typedef struct google_protobuf_compiler_CodeGeneratorRequest { upb_Message UPB_PRIVATE(base); } google_protobuf_compiler_CodeGeneratorRequest;

Loading…
Cancel
Save