Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
14e74f6a
Commit
14e74f6a
authored
Sep 08, 2016
by
Sergio Campamá
Committed by
Thomas Van Lenten
Sep 08, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support the -Wassign-enum compiler flag. (#2085)
Support the -Wassign-enum compiler flag.
parent
4bc16578
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
102 additions
and
56 deletions
+102
-56
GPBArray.m
objectivec/GPBArray.m
+10
-10
GPBCodedOutputStream.m
objectivec/GPBCodedOutputStream.m
+1
-1
GPBDescriptor_PackagePrivate.h
objectivec/GPBDescriptor_PackagePrivate.h
+3
-0
project.pbxproj
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
+2
-0
project.pbxproj
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
+2
-0
Any.pbobjc.m
objectivec/google/protobuf/Any.pbobjc.m
+2
-2
Api.pbobjc.m
objectivec/google/protobuf/Api.pbobjc.m
+7
-7
Duration.pbobjc.m
objectivec/google/protobuf/Duration.pbobjc.m
+1
-1
Empty.pbobjc.m
objectivec/google/protobuf/Empty.pbobjc.m
+1
-1
FieldMask.pbobjc.m
objectivec/google/protobuf/FieldMask.pbobjc.m
+1
-1
SourceContext.pbobjc.m
objectivec/google/protobuf/SourceContext.pbobjc.m
+1
-1
Struct.pbobjc.m
objectivec/google/protobuf/Struct.pbobjc.m
+4
-4
Timestamp.pbobjc.m
objectivec/google/protobuf/Timestamp.pbobjc.m
+1
-1
Type.pbobjc.m
objectivec/google/protobuf/Type.pbobjc.m
+10
-10
Wrappers.pbobjc.m
objectivec/google/protobuf/Wrappers.pbobjc.m
+9
-9
objectivec_extension.cc
...ogle/protobuf/compiler/objectivec/objectivec_extension.cc
+1
-1
objectivec_field.cc
src/google/protobuf/compiler/objectivec/objectivec_field.cc
+1
-1
objectivec_helpers.cc
...google/protobuf/compiler/objectivec/objectivec_helpers.cc
+35
-3
objectivec_helpers.h
src/google/protobuf/compiler/objectivec/objectivec_helpers.h
+7
-1
objectivec_map_field.cc
...ogle/protobuf/compiler/objectivec/objectivec_map_field.cc
+1
-1
objectivec_message.cc
...google/protobuf/compiler/objectivec/objectivec_message.cc
+2
-1
No files found.
objectivec/GPBArray.m
View file @
14e74f6a
...
...
@@ -195,7 +195,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
//%}
//%
//%- (void)enumerate##ACCESSOR_NAME##ValuesWithBlock:(void (^)(TYPE value, NSUInteger idx, BOOL *stop))block {
//% [self enumerate##ACCESSOR_NAME##ValuesWithOptions:0 usingBlock:block];
//% [self enumerate##ACCESSOR_NAME##ValuesWithOptions:
(NSEnumerationOptions)
0 usingBlock:block];
//%}
//%
//%- (void)enumerate##ACCESSOR_NAME##ValuesWithOptions:(NSEnumerationOptions)opts
...
...
@@ -406,7 +406,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
int32_t
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -654,7 +654,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
uint32_t
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -902,7 +902,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
int64_t
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -1150,7 +1150,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
uint64_t
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -1398,7 +1398,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
float
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -1646,7 +1646,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
double
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -1894,7 +1894,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
BOOL
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -2166,7 +2166,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateRawValuesWithBlock
:
(
void
(
^
)(
int32_t
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateRawValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateRawValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateRawValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
@@ -2218,7 +2218,7 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
}
-
(
void
)
enumerateValuesWithBlock
:
(
void
(
^
)(
int32_t
value
,
NSUInteger
idx
,
BOOL
*
stop
))
block
{
[
self
enumerateValuesWithOptions
:
0
usingBlock
:
block
];
[
self
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
0
usingBlock
:
block
];
}
-
(
void
)
enumerateValuesWithOptions
:
(
NSEnumerationOptions
)
opts
...
...
objectivec/GPBCodedOutputStream.m
View file @
14e74f6a
...
...
@@ -290,7 +290,7 @@ static void GPBWriteRawLittleEndian64(GPBOutputBufferState *state,
maxLength
:
bufferBytesLeft
usedLength
:&
usedBufferLength
encoding
:
NSUTF8StringEncoding
options
:
0
options
:
(
NSStringEncodingConversionOptions
)
0
range
:
NSMakeRange
(
0
,
[
value
length
])
remainingRange
:
NULL
];
}
...
...
objectivec/GPBDescriptor_PackagePrivate.h
View file @
14e74f6a
...
...
@@ -37,6 +37,7 @@
// Describes attributes of the field.
typedef
NS_OPTIONS
(
uint16_t
,
GPBFieldFlags
)
{
GPBFieldNone
=
0
,
// These map to standard protobuf concepts.
GPBFieldRequired
=
1
<<
0
,
GPBFieldRepeated
=
1
<<
1
,
...
...
@@ -111,6 +112,7 @@ typedef struct GPBMessageFieldDescriptionWithDefault {
// Describes attributes of the extension.
typedef
NS_OPTIONS
(
uint8_t
,
GPBExtensionOptions
)
{
GPBExtensionNone
=
0
,
// These map to standard protobuf concepts.
GPBExtensionRepeated
=
1
<<
0
,
GPBExtensionPacked
=
1
<<
1
,
...
...
@@ -130,6 +132,7 @@ typedef struct GPBExtensionDescription {
}
GPBExtensionDescription
;
typedef
NS_OPTIONS
(
uint32_t
,
GPBDescriptorInitializationFlags
)
{
GPBDescriptorInitializationFlag_None
=
0
,
GPBDescriptorInitializationFlag_FieldsWithDefault
=
1
<<
0
,
GPBDescriptorInitializationFlag_WireFormat
=
1
<<
1
,
};
...
...
objectivec/ProtocolBuffers_OSX.xcodeproj/project.pbxproj
View file @
14e74f6a
...
...
@@ -782,6 +782,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND
=
YES
;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_ASSIGN_ENUM
=
YES
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_DOCUMENTATION_COMMENTS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
...
...
@@ -842,6 +843,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND
=
YES
;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_ASSIGN_ENUM
=
YES
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_DOCUMENTATION_COMMENTS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
...
...
objectivec/ProtocolBuffers_iOS.xcodeproj/project.pbxproj
View file @
14e74f6a
...
...
@@ -944,6 +944,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND
=
YES
;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_ASSIGN_ENUM
=
YES
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_DOCUMENTATION_COMMENTS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
...
...
@@ -1005,6 +1006,7 @@
CLANG_ANALYZER_SECURITY_INSECUREAPI_RAND
=
YES
;
CLANG_ANALYZER_SECURITY_INSECUREAPI_STRCPY
=
YES
;
CLANG_STATIC_ANALYZER_MODE
=
deep
;
CLANG_WARN_ASSIGN_ENUM
=
YES
;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS
=
YES
;
CLANG_WARN_DOCUMENTATION_COMMENTS
=
YES
;
CLANG_WARN_NULLABLE_TO_NONNULL_CONVERSION
=
YES
;
...
...
objectivec/google/protobuf/Any.pbobjc.m
View file @
14e74f6a
...
...
@@ -71,7 +71,7 @@ typedef struct GPBAny__storage_ {
.
number
=
GPBAny_FieldNumber_TypeURL
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBAny__storage_
,
typeURL
),
.
flags
=
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
)
,
.
dataType
=
GPBDataTypeString
,
},
{
...
...
@@ -91,7 +91,7 @@ typedef struct GPBAny__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBAny__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static
const
char
*
extraTextFormatInfo
=
"
\001\001\004\241
!!
\000
"
;
...
...
objectivec/google/protobuf/Api.pbobjc.m
View file @
14e74f6a
...
...
@@ -139,7 +139,7 @@ typedef struct GPBApi__storage_ {
.
number
=
GPBApi_FieldNumber_Syntax
,
.
hasIndex
=
3
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBApi__storage_
,
syntax
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
};
...
...
@@ -150,7 +150,7 @@ typedef struct GPBApi__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBApi__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -213,7 +213,7 @@ typedef struct GPBMethod__storage_ {
.
number
=
GPBMethod_FieldNumber_RequestTypeURL
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBMethod__storage_
,
requestTypeURL
),
.
flags
=
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
)
,
.
dataType
=
GPBDataTypeString
,
},
{
...
...
@@ -231,7 +231,7 @@ typedef struct GPBMethod__storage_ {
.
number
=
GPBMethod_FieldNumber_ResponseTypeURL
,
.
hasIndex
=
4
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBMethod__storage_
,
responseTypeURL
),
.
flags
=
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
)
,
.
dataType
=
GPBDataTypeString
,
},
{
...
...
@@ -258,7 +258,7 @@ typedef struct GPBMethod__storage_ {
.
number
=
GPBMethod_FieldNumber_Syntax
,
.
hasIndex
=
7
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBMethod__storage_
,
syntax
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
};
...
...
@@ -269,7 +269,7 @@ typedef struct GPBMethod__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBMethod__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static
const
char
*
extraTextFormatInfo
=
"
\002\002\007\244\241
!!
\000\004\010\244\241
!!
\000
"
;
...
...
@@ -340,7 +340,7 @@ typedef struct GPBMixin__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBMixin__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/Duration.pbobjc.m
View file @
14e74f6a
...
...
@@ -91,7 +91,7 @@ typedef struct GPBDuration__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBDuration__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/Empty.pbobjc.m
View file @
14e74f6a
...
...
@@ -67,7 +67,7 @@ typedef struct GPBEmpty__storage_ {
fields
:
NULL
fieldCount
:
0
storageSize
:
sizeof
(
GPBEmpty__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/FieldMask.pbobjc.m
View file @
14e74f6a
...
...
@@ -80,7 +80,7 @@ typedef struct GPBFieldMask__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBFieldMask__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/SourceContext.pbobjc.m
View file @
14e74f6a
...
...
@@ -80,7 +80,7 @@ typedef struct GPBSourceContext__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBSourceContext__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/Struct.pbobjc.m
View file @
14e74f6a
...
...
@@ -113,7 +113,7 @@ typedef struct GPBStruct__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBStruct__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -155,7 +155,7 @@ typedef struct GPBValue__storage_ {
.
number
=
GPBValue_FieldNumber_NullValue
,
.
hasIndex
=
-
1
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBValue__storage_
,
nullValue
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
{
...
...
@@ -211,7 +211,7 @@ typedef struct GPBValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
static
const
char
*
oneofs
[]
=
{
"kind"
,
};
...
...
@@ -277,7 +277,7 @@ typedef struct GPBListValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBListValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/Timestamp.pbobjc.m
View file @
14e74f6a
...
...
@@ -91,7 +91,7 @@ typedef struct GPBTimestamp__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBTimestamp__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/Type.pbobjc.m
View file @
14e74f6a
...
...
@@ -162,7 +162,7 @@ typedef struct GPBType__storage_ {
.
number
=
GPBType_FieldNumber_Syntax
,
.
hasIndex
=
2
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBType__storage_
,
syntax
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
};
...
...
@@ -173,7 +173,7 @@ typedef struct GPBType__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBType__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -234,7 +234,7 @@ typedef struct GPBField__storage_ {
.
number
=
GPBField_FieldNumber_Kind
,
.
hasIndex
=
0
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBField__storage_
,
kind
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
{
...
...
@@ -243,7 +243,7 @@ typedef struct GPBField__storage_ {
.
number
=
GPBField_FieldNumber_Cardinality
,
.
hasIndex
=
1
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBField__storage_
,
cardinality
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
{
...
...
@@ -270,7 +270,7 @@ typedef struct GPBField__storage_ {
.
number
=
GPBField_FieldNumber_TypeURL
,
.
hasIndex
=
4
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBField__storage_
,
typeURL
),
.
flags
=
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldTextFormatNameCustom
)
,
.
dataType
=
GPBDataTypeString
,
},
{
...
...
@@ -326,7 +326,7 @@ typedef struct GPBField__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBField__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
#if !GPBOBJC_SKIP_MESSAGE_TEXTFORMAT_EXTRAS
static
const
char
*
extraTextFormatInfo
=
"
\001\006\004\241
!!
\000
"
;
...
...
@@ -543,7 +543,7 @@ typedef struct GPBEnum__storage_ {
.
number
=
GPBEnum_FieldNumber_Syntax
,
.
hasIndex
=
2
,
.
offset
=
(
uint32_t
)
offsetof
(
GPBEnum__storage_
,
syntax
),
.
flags
=
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
,
.
flags
=
(
GPBFieldFlags
)(
GPBFieldOptional
|
GPBFieldHasEnumDescriptor
)
,
.
dataType
=
GPBDataTypeEnum
,
},
};
...
...
@@ -554,7 +554,7 @@ typedef struct GPBEnum__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBEnum__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -631,7 +631,7 @@ typedef struct GPBEnumValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBEnumValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -685,7 +685,7 @@ typedef struct GPBOption__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBOption__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
objectivec/google/protobuf/Wrappers.pbobjc.m
View file @
14e74f6a
...
...
@@ -80,7 +80,7 @@ typedef struct GPBDoubleValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBDoubleValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -123,7 +123,7 @@ typedef struct GPBFloatValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBFloatValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -166,7 +166,7 @@ typedef struct GPBInt64Value__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBInt64Value__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -209,7 +209,7 @@ typedef struct GPBUInt64Value__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBUInt64Value__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -252,7 +252,7 @@ typedef struct GPBInt32Value__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBInt32Value__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -295,7 +295,7 @@ typedef struct GPBUInt32Value__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBUInt32Value__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -337,7 +337,7 @@ typedef struct GPBBoolValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBBoolValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -380,7 +380,7 @@ typedef struct GPBStringValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBStringValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
@@ -423,7 +423,7 @@ typedef struct GPBBytesValue__storage_ {
fields
:
fields
fieldCount
:
(
uint32_t
)(
sizeof
(
fields
)
/
sizeof
(
GPBMessageFieldDescription
))
storageSize
:
sizeof
(
GPBBytesValue__storage_
)
flags
:
0
];
flags
:
GPBDescriptorInitializationFlag_None
];
NSAssert
(
descriptor
==
nil
,
@"Startup recursed!"
);
descriptor
=
localDescriptor
;
}
...
...
src/google/protobuf/compiler/objectivec/objectivec_extension.cc
View file @
14e74f6a
...
...
@@ -85,7 +85,7 @@ void ExtensionGenerator::GenerateStaticVariablesInitialization(
if
(
descriptor_
->
containing_type
()
->
options
().
message_set_wire_format
())
options
.
push_back
(
"GPBExtensionSetWireFormat"
);
vars
[
"options"
]
=
BuildFlagsString
(
options
);
vars
[
"options"
]
=
BuildFlagsString
(
FLAGTYPE_EXTENSION
,
options
);
ObjectiveCType
objc_type
=
GetObjectiveCType
(
descriptor_
);
string
singular_type
;
...
...
src/google/protobuf/compiler/objectivec/objectivec_field.cc
View file @
14e74f6a
...
...
@@ -93,7 +93,7 @@ void SetCommonFieldVariables(const FieldDescriptor* descriptor,
field_flags
.
push_back
(
"GPBFieldHasEnumDescriptor"
);
}
(
*
variables
)[
"fieldflags"
]
=
BuildFlagsString
(
field_flags
);
(
*
variables
)[
"fieldflags"
]
=
BuildFlagsString
(
FLAGTYPE_FIELD
,
field_flags
);
(
*
variables
)[
"default"
]
=
DefaultValue
(
descriptor
);
(
*
variables
)[
"default_name"
]
=
GPBGenericValueFieldName
(
descriptor
);
...
...
src/google/protobuf/compiler/objectivec/objectivec_helpers.cc
View file @
14e74f6a
...
...
@@ -262,6 +262,34 @@ bool IsSpecialName(const string& name, const string* special_names,
return
false
;
}
string
GetZeroEnumNameForFlagType
(
const
FlagType
flag_type
)
{
switch
(
flag_type
)
{
case
FLAGTYPE_DESCRIPTOR_INITIALIZATION
:
return
"GPBDescriptorInitializationFlag_None"
;
case
FLAGTYPE_EXTENSION
:
return
"GPBExtensionNone"
;
case
FLAGTYPE_FIELD
:
return
"GPBFieldNone"
;
default:
GOOGLE_LOG
(
FATAL
)
<<
"Can't get here."
;
return
"0"
;
}
}
string
GetEnumNameForFlagType
(
const
FlagType
flag_type
)
{
switch
(
flag_type
)
{
case
FLAGTYPE_DESCRIPTOR_INITIALIZATION
:
return
"GPBDescriptorInitializationFlags"
;
case
FLAGTYPE_EXTENSION
:
return
"GPBExtensionOptions"
;
case
FLAGTYPE_FIELD
:
return
"GPBFieldFlags"
;
default:
GOOGLE_LOG
(
FATAL
)
<<
"Can't get here."
;
return
string
();
}
}
}
// namespace
// Escape C++ trigraphs by escaping question marks to \?
...
...
@@ -817,17 +845,21 @@ bool HasNonZeroDefaultValue(const FieldDescriptor* field) {
return
false
;
}
string
BuildFlagsString
(
const
vector
<
string
>&
strings
)
{
string
BuildFlagsString
(
const
FlagType
flag_type
,
const
vector
<
string
>&
strings
)
{
if
(
strings
.
size
()
==
0
)
{
return
"0"
;
return
GetZeroEnumNameForFlagType
(
flag_type
);
}
else
if
(
strings
.
size
()
==
1
)
{
return
strings
[
0
];
}
string
string
;
string
string
(
"("
+
GetEnumNameForFlagType
(
flag_type
)
+
")("
)
;
for
(
size_t
i
=
0
;
i
!=
strings
.
size
();
++
i
)
{
if
(
i
>
0
)
{
string
.
append
(
" | "
);
}
string
.
append
(
strings
[
i
]);
}
string
.
append
(
")"
);
return
string
;
}
...
...
src/google/protobuf/compiler/objectivec/objectivec_helpers.h
View file @
14e74f6a
...
...
@@ -137,6 +137,12 @@ enum ObjectiveCType {
OBJECTIVECTYPE_MESSAGE
};
enum
FlagType
{
FLAGTYPE_DESCRIPTOR_INITIALIZATION
,
FLAGTYPE_EXTENSION
,
FLAGTYPE_FIELD
};
template
<
class
TDescriptor
>
string
GetOptionalDeprecatedAttribute
(
const
TDescriptor
*
descriptor
,
bool
preSpace
=
true
,
bool
postNewline
=
false
)
{
if
(
descriptor
->
options
().
deprecated
())
{
...
...
@@ -168,7 +174,7 @@ string GPBGenericValueFieldName(const FieldDescriptor* field);
string
DefaultValue
(
const
FieldDescriptor
*
field
);
bool
HasNonZeroDefaultValue
(
const
FieldDescriptor
*
field
);
string
BuildFlagsString
(
const
vector
<
string
>&
strings
);
string
BuildFlagsString
(
const
FlagType
type
,
const
vector
<
string
>&
strings
);
// Builds HeaderDoc/appledoc style comments out of the comments in the .proto
// file.
...
...
src/google/protobuf/compiler/objectivec/objectivec_map_field.cc
View file @
14e74f6a
...
...
@@ -115,7 +115,7 @@ MapFieldGenerator::MapFieldGenerator(const FieldDescriptor* descriptor,
if
(
value_field_flags
.
find
(
"GPBFieldHasEnumDescriptor"
)
!=
string
::
npos
)
{
field_flags
.
push_back
(
"GPBFieldHasEnumDescriptor"
);
}
variables_
[
"fieldflags"
]
=
BuildFlagsString
(
field_flags
);
variables_
[
"fieldflags"
]
=
BuildFlagsString
(
FLAGTYPE_FIELD
,
field_flags
);
ObjectiveCType
value_objc_type
=
GetObjectiveCType
(
value_descriptor
);
const
bool
value_is_object_type
=
...
...
src/google/protobuf/compiler/objectivec/objectivec_message.cc
View file @
14e74f6a
...
...
@@ -521,7 +521,8 @@ void MessageGenerator::GenerateSource(io::Printer* printer) {
if
(
descriptor_
->
options
().
message_set_wire_format
())
{
init_flags
.
push_back
(
"GPBDescriptorInitializationFlag_WireFormat"
);
}
vars
[
"init_flags"
]
=
BuildFlagsString
(
init_flags
);
vars
[
"init_flags"
]
=
BuildFlagsString
(
FLAGTYPE_DESCRIPTOR_INITIALIZATION
,
init_flags
);
printer
->
Print
(
vars
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment