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
91218afc
Commit
91218afc
authored
Dec 18, 2009
by
kenton@google.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Cygwin build.
parent
5e744ff9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
8 deletions
+27
-8
command_line_interface_unittest.cc
...ogle/protobuf/compiler/command_line_interface_unittest.cc
+13
-5
subprocess.cc
src/google/protobuf/compiler/subprocess.cc
+4
-1
extension_set.cc
src/google/protobuf/extension_set.cc
+10
-2
No files found.
src/google/protobuf/compiler/command_line_interface_unittest.cc
View file @
91218afc
...
...
@@ -146,6 +146,8 @@ class CommandLineInterfaceTest : public testing::Test {
const
string
&
proto_name
,
const
string
&
message_name
);
void
ExpectNullCodeGeneratorCalled
(
const
string
&
parameter
);
void
ReadDescriptorSet
(
const
string
&
filename
,
FileDescriptorSet
*
descriptor_set
);
...
...
@@ -170,6 +172,8 @@ class CommandLineInterfaceTest : public testing::Test {
// Pointers which need to be deleted later.
vector
<
CodeGenerator
*>
mock_generators_to_delete_
;
NullCodeGenerator
*
null_generator_
;
};
class
CommandLineInterfaceTest
::
NullCodeGenerator
:
public
CodeGenerator
{
...
...
@@ -220,7 +224,7 @@ void CommandLineInterfaceTest::SetUp() {
mock_generators_to_delete_
.
push_back
(
generator
);
cli_
.
RegisterGenerator
(
"--alt_out"
,
generator
,
"Alt output."
);
generator
=
new
NullCodeGenerator
();
generator
=
n
ull_generator_
=
n
ew
NullCodeGenerator
();
mock_generators_to_delete_
.
push_back
(
generator
);
cli_
.
RegisterGenerator
(
"--null_out"
,
generator
,
"Null output."
);
...
...
@@ -338,6 +342,12 @@ void CommandLineInterfaceTest::ExpectGeneratedWithInsertions(
temp_directory_
);
}
void
CommandLineInterfaceTest
::
ExpectNullCodeGeneratorCalled
(
const
string
&
parameter
)
{
EXPECT_TRUE
(
null_generator_
->
called_
);
EXPECT_EQ
(
parameter
,
null_generator_
->
parameter_
);
}
void
CommandLineInterfaceTest
::
ReadDescriptorSet
(
const
string
&
filename
,
FileDescriptorSet
*
descriptor_set
)
{
string
path
=
temp_directory_
+
"/"
+
filename
;
...
...
@@ -481,8 +491,7 @@ TEST_F(CommandLineInterfaceTest, WindowsOutputPath) {
"--proto_path=$tmpdir foo.proto"
);
ExpectNoErrors
();
EXPECT_TRUE
(
generator
->
called_
);
EXPECT_EQ
(
""
,
generator
->
parameter_
);
ExpectNullCodeGeneratorCalled
(
""
);
}
TEST_F
(
CommandLineInterfaceTest
,
WindowsOutputPathAndParameter
)
{
...
...
@@ -495,8 +504,7 @@ TEST_F(CommandLineInterfaceTest, WindowsOutputPathAndParameter) {
"--proto_path=$tmpdir foo.proto"
);
ExpectNoErrors
();
EXPECT_TRUE
(
generator
->
called_
);
EXPECT_EQ
(
"bar"
,
generator
->
parameter_
);
ExpectNullCodeGeneratorCalled
(
"bar"
);
}
TEST_F
(
CommandLineInterfaceTest
,
TrailingBackslash
)
{
...
...
src/google/protobuf/compiler/subprocess.cc
View file @
91218afc
...
...
@@ -115,8 +115,11 @@ bool Subprocess::Communicate(const Message& input, Message* output,
GOOGLE_CHECK_NE
(
child_stdin_
,
-
1
)
<<
"Must call Start() first."
;
// The "sighandler_t" typedef is GNU-specific, so define our own.
typedef
void
SignalHandler
(
int
);
// Make sure SIGPIPE is disabled so that if the child dies it doesn't kill us.
sighandler_t
old_pipe_handler
=
signal
(
SIGPIPE
,
SIG_IGN
);
SignalHandler
*
old_pipe_handler
=
signal
(
SIGPIPE
,
SIG_IGN
);
string
input_data
=
input
.
SerializeAsString
();
string
output_data
;
...
...
src/google/protobuf/extension_set.cc
View file @
91218afc
...
...
@@ -120,7 +120,14 @@ void ExtensionSet::RegisterExtension(const MessageLite* containing_type,
}
static
bool
CallNoArgValidityFunc
(
const
void
*
arg
,
int
number
)
{
return
reinterpret_cast
<
const
EnumValidityFunc
*>
(
arg
)(
number
);
// Note: Must use C-style cast here rather than reinterpret_cast because
// the C++ standard at one point did not allow casts between function and
// data pointers and some compilers enforce this for C++-style casts. No
// compiler enforces it for C-style casts since lots of C-style code has
// relied on these kinds of casts for a long time, despite being
// technically undefined. See:
// http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#195
return
((
const
EnumValidityFunc
*
)
arg
)(
number
);
}
void
ExtensionSet
::
RegisterEnumExtension
(
const
MessageLite
*
containing_type
,
...
...
@@ -130,7 +137,8 @@ void ExtensionSet::RegisterEnumExtension(const MessageLite* containing_type,
GOOGLE_CHECK_EQ
(
type
,
WireFormatLite
::
TYPE_ENUM
);
ExtensionInfo
info
(
type
,
is_repeated
,
is_packed
);
info
.
enum_is_valid
=
CallNoArgValidityFunc
;
info
.
enum_is_valid_arg
=
reinterpret_cast
<
void
*>
(
is_valid
);
// See comment in CallNoArgValidityFunc() about why we use a c-style cast.
info
.
enum_is_valid_arg
=
(
void
*
)
is_valid
;
Register
(
containing_type
,
number
,
info
);
}
...
...
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