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
001e82a7
Commit
001e82a7
authored
Dec 12, 2014
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #113 from nsuke/oneof-c++11
Make C++ code generation of string oneof field compatible with C++11
parents
78c82006
2413cb57
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
40 additions
and
41 deletions
+40
-41
command_line_interface_unittest.cc
...ogle/protobuf/compiler/command_line_interface_unittest.cc
+1
-1
cpp_string_field.cc
src/google/protobuf/compiler/cpp/cpp_string_field.cc
+1
-2
parser_unittest.cc
src/google/protobuf/compiler/parser_unittest.cc
+29
-29
descriptor_unittest.cc
src/google/protobuf/descriptor_unittest.cc
+2
-2
common_unittest.cc
src/google/protobuf/stubs/common_unittest.cc
+7
-7
No files found.
src/google/protobuf/compiler/command_line_interface_unittest.cc
View file @
001e82a7
...
...
@@ -725,7 +725,7 @@ TEST_F(CommandLineInterfaceTest, ColonDelimitedPath) {
#endif
Run
(
"protocol_compiler --test_out=$tmpdir "
"--proto_path=$tmpdir/a"
PATH_SEPARATOR
"$tmpdir/b foo.proto"
);
"--proto_path=$tmpdir/a"
PATH_SEPARATOR
"$tmpdir/b foo.proto"
);
#undef PATH_SEPARATOR
...
...
src/google/protobuf/compiler/cpp/cpp_string_field.cc
View file @
001e82a7
...
...
@@ -613,8 +613,7 @@ GenerateSwappingCode(io::Printer* printer) const {
void
StringOneofFieldGenerator
::
GenerateConstructorCode
(
io
::
Printer
*
printer
)
const
{
printer
->
Print
(
variables_
,
" const_cast< ::google::protobuf::internal::ArenaStringPtr*>("
"&$classname$_default_oneof_instance_->$name$_)->UnsafeSetDefault("
" $classname$_default_oneof_instance_->$name$_.UnsafeSetDefault("
"$default_variable$);
\n
"
);
}
...
...
src/google/protobuf/compiler/parser_unittest.cc
View file @
001e82a7
...
...
@@ -379,35 +379,35 @@ TEST_F(ParseMessageTest, FieldDefaults) {
#define ETC "name:\"foo\" label:LABEL_REQUIRED number:1"
"message_type {"
" name:
\"
TestMessage
\"
"
" field { type:TYPE_INT32 default_value:
\"
1
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
-2
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
3
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
-4
\"
"
ETC
" }"
" field { type:TYPE_UINT32 default_value:
\"
5
\"
"
ETC
" }"
" field { type:TYPE_UINT64 default_value:
\"
6
\"
"
ETC
" }"
" field { type:TYPE_FLOAT default_value:
\"
7.5
\"
"
ETC
" }"
" field { type:TYPE_FLOAT default_value:
\"
-8.5
\"
"
ETC
" }"
" field { type:TYPE_FLOAT default_value:
\"
9
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
10.5
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
-11.5
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
12
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
inf
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
-inf
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
nan
\"
"
ETC
" }"
" field { type:TYPE_STRING default_value:
\"
13
\\
001
\"
"
ETC
" }"
" field { type:TYPE_STRING default_value:
\"
abc
\"
"
ETC
" }"
" field { type:TYPE_BYTES default_value:
\"
14
\\\\
002
\"
"
ETC
" }"
" field { type:TYPE_BYTES default_value:
\"
abc
\"
"
ETC
" }"
" field { type:TYPE_BOOL default_value:
\"
true
\"
"
ETC
" }"
" field { type_name:
\"
Foo
\"
default_value:
\"
FOO
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
2147483647
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
-2147483648
\"
"
ETC
" }"
" field { type:TYPE_UINT32 default_value:
\"
4294967295
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
9223372036854775807
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
-9223372036854775808
\"
"
ETC
" }"
" field { type:TYPE_UINT64 default_value:
\"
18446744073709551615
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
43981
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
1
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
-2
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
3
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
-4
\"
"
ETC
" }"
" field { type:TYPE_UINT32 default_value:
\"
5
\"
"
ETC
" }"
" field { type:TYPE_UINT64 default_value:
\"
6
\"
"
ETC
" }"
" field { type:TYPE_FLOAT default_value:
\"
7.5
\"
"
ETC
" }"
" field { type:TYPE_FLOAT default_value:
\"
-8.5
\"
"
ETC
" }"
" field { type:TYPE_FLOAT default_value:
\"
9
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
10.5
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
-11.5
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
12
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
inf
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
-inf
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
nan
\"
"
ETC
" }"
" field { type:TYPE_STRING default_value:
\"
13
\\
001
\"
"
ETC
" }"
" field { type:TYPE_STRING default_value:
\"
abc
\"
"
ETC
" }"
" field { type:TYPE_BYTES default_value:
\"
14
\\\\
002
\"
"
ETC
" }"
" field { type:TYPE_BYTES default_value:
\"
abc
\"
"
ETC
" }"
" field { type:TYPE_BOOL default_value:
\"
true
\"
"
ETC
" }"
" field { type_name:
\"
Foo
\"
default_value:
\"
FOO
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
2147483647
\"
"
ETC
" }"
" field { type:TYPE_INT32 default_value:
\"
-2147483648
\"
"
ETC
" }"
" field { type:TYPE_UINT32 default_value:
\"
4294967295
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
9223372036854775807
\"
"
ETC
" }"
" field { type:TYPE_INT64 default_value:
\"
-9223372036854775808
\"
"
ETC
" }"
" field { type:TYPE_UINT64 default_value:
\"
18446744073709551615
\"
"
ETC
" }"
" field { type:TYPE_DOUBLE default_value:
\"
43981
\"
"
ETC
" }"
"}"
);
#undef ETC
}
...
...
src/google/protobuf/descriptor_unittest.cc
View file @
001e82a7
...
...
@@ -5883,8 +5883,8 @@ class AbortingErrorCollector : public DescriptorPool::ErrorCollector {
const
Message
*
message
,
ErrorLocation
location
,
const
string
&
error_message
)
{
GOOGLE_LOG
(
FATAL
)
<<
"AddError() called unexpectedly: "
<<
filename
<<
"
:
"
<<
error_message
;
GOOGLE_LOG
(
FATAL
)
<<
"AddError() called unexpectedly: "
<<
filename
<<
"
[
"
<<
e
lement_name
<<
"]: "
<<
e
rror_message
;
}
private
:
GOOGLE_DISALLOW_EVIL_CONSTRUCTORS
(
AbortingErrorCollector
);
...
...
src/google/protobuf/stubs/common_unittest.cc
View file @
001e82a7
...
...
@@ -95,9 +95,9 @@ TEST(LoggingTest, DefaultLogging) {
string
text
=
GetCapturedTestStderr
();
EXPECT_EQ
(
"[libprotobuf INFO "
__FILE__
":"
+
SimpleItoa
(
line
+
1
)
+
"] A message.
\n
"
"[libprotobuf WARNING "
__FILE__
":"
+
SimpleItoa
(
line
+
2
)
+
"] A warning.
\n
"
"[libprotobuf ERROR "
__FILE__
":"
+
SimpleItoa
(
line
+
3
)
+
"] An error.
\n
"
,
"[libprotobuf INFO "
__FILE__
":"
+
SimpleItoa
(
line
+
1
)
+
"] A message.
\n
"
"[libprotobuf WARNING "
__FILE__
":"
+
SimpleItoa
(
line
+
2
)
+
"] A warning.
\n
"
"[libprotobuf ERROR "
__FILE__
":"
+
SimpleItoa
(
line
+
3
)
+
"] An error.
\n
"
,
text
);
}
...
...
@@ -128,10 +128,10 @@ TEST(LoggingTest, CaptureLogging) {
ASSERT_EQ
(
2
,
captured_messages_
.
size
());
EXPECT_EQ
(
"2 "
__FILE__
":"
+
SimpleItoa
(
start_line
+
1
)
+
": An error."
,
"2 "
__FILE__
":"
+
SimpleItoa
(
start_line
+
1
)
+
": An error."
,
captured_messages_
[
0
]);
EXPECT_EQ
(
"1 "
__FILE__
":"
+
SimpleItoa
(
start_line
+
2
)
+
": A warning."
,
"1 "
__FILE__
":"
+
SimpleItoa
(
start_line
+
2
)
+
": A warning."
,
captured_messages_
[
1
]);
}
...
...
@@ -154,10 +154,10 @@ TEST(LoggingTest, SilenceLogging) {
ASSERT_EQ
(
2
,
captured_messages_
.
size
());
EXPECT_EQ
(
"0 "
__FILE__
":"
+
SimpleItoa
(
line1
)
+
": Visible1"
,
"0 "
__FILE__
":"
+
SimpleItoa
(
line1
)
+
": Visible1"
,
captured_messages_
[
0
]);
EXPECT_EQ
(
"0 "
__FILE__
":"
+
SimpleItoa
(
line2
)
+
": Visible2"
,
"0 "
__FILE__
":"
+
SimpleItoa
(
line2
)
+
": Visible2"
,
captured_messages_
[
1
]);
}
...
...
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