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
413c614a
Unverified
Commit
413c614a
authored
Feb 05, 2019
by
Thomas Van Lenten
Committed by
GitHub
Feb 05, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Document why no enum_extensibility is needed for Swift. (#5680)
Document why no enum_extensibility is needed for Swift.
parent
6dcd8109
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
objectivec_enum.cc
src/google/protobuf/compiler/objectivec/objectivec_enum.cc
+14
-0
No files found.
src/google/protobuf/compiler/objectivec/objectivec_enum.cc
View file @
413c614a
...
...
@@ -92,6 +92,20 @@ void EnumGenerator::GenerateHeader(io::Printer* printer) {
"
\n
"
,
"name"
,
name_
);
// Swift 5 included SE0192 "Handling Future Enum Cases"
// https://github.com/apple/swift-evolution/blob/master/proposals/0192-non-exhaustive-enums.md
// Since a .proto file can get new values added to an enum at any time, they
// are effectively "non-frozen". Even in a proto3 syntax file where there is
// support for the unknown value, an edit to the file can always add a new
// value moving something from unknown to known. Since Swift is now ABI
// stable, it also means a binary could contain Swift compiled against one
// version of the .pbobjc.h file, but finally linked against an enum with
// more cases. So the Swift code will always have to treat ObjC Proto Enums
// as "non-frozen". The default behavior in SE0192 is for all objc enums to
// be "non-frozen" unless marked as otherwise, so this means this generation
// doesn't have to bother with the `enum_extensibility` attribute, as the
// default will be what is needed.
printer
->
Print
(
"$comments$typedef$deprecated_attribute$ GPB_ENUM($name$) {
\n
"
,
"comments"
,
enum_comments
,
"deprecated_attribute"
,
GetOptionalDeprecatedAttribute
(
descriptor_
,
descriptor_
->
file
()),
...
...
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