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
a74e912a
Commit
a74e912a
authored
Oct 29, 2015
by
Feng Xiao
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #922 from randomascii/master
Get VS 2015 to use const int definitions
parents
86f6f53d
86ba70ec
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
18 additions
and
16 deletions
+18
-16
cpp_enum.cc
src/google/protobuf/compiler/cpp/cpp_enum.cc
+4
-4
cpp_extension.cc
src/google/protobuf/compiler/cpp/cpp_extension.cc
+1
-1
cpp_message.cc
src/google/protobuf/compiler/cpp/cpp_message.cc
+2
-2
plugin.pb.cc
src/google/protobuf/compiler/plugin.pb.cc
+6
-6
descriptor.cc
src/google/protobuf/descriptor.cc
+1
-1
descriptor.pb.cc
src/google/protobuf/descriptor.pb.cc
+0
-0
wire_format_lite.cc
src/google/protobuf/wire_format_lite.cc
+4
-2
No files found.
src/google/protobuf/compiler/cpp/cpp_enum.cc
View file @
a74e912a
...
...
@@ -278,9 +278,9 @@ void EnumGenerator::GenerateMethods(io::Printer* printer) {
if
(
descriptor_
->
containing_type
()
!=
NULL
)
{
// We need to "define" the static constants which were declared in the
// header, to give the linker a place to put them. Or at least the C++
// standard says we have to. MSVC actually insists tha we do _not_ define
// them again in the .cc file.
printer
->
Print
(
"#if
ndef _MSC_VER
\n
"
);
// standard says we have to. MSVC actually insists tha
t
we do _not_ define
// them again in the .cc file
, prior to VC++ 2015
.
printer
->
Print
(
"#if
!defined(_MSC_VER) || _MSC_VER >= 1900
\n
"
);
vars
[
"parent"
]
=
ClassName
(
descriptor_
->
containing_type
(),
false
);
vars
[
"nested_name"
]
=
descriptor_
->
name
();
...
...
@@ -297,7 +297,7 @@ void EnumGenerator::GenerateMethods(io::Printer* printer) {
"const int $parent$::$nested_name$_ARRAYSIZE;
\n
"
);
}
printer
->
Print
(
"#endif //
_MSC_VER
\n
"
);
printer
->
Print
(
"#endif //
!defined(_MSC_VER) || _MSC_VER >= 1900
\n
"
);
}
}
...
...
src/google/protobuf/compiler/cpp/cpp_extension.cc
View file @
a74e912a
...
...
@@ -155,7 +155,7 @@ void ExtensionGenerator::GenerateDefinition(io::Printer* printer) {
// Likewise, class members need to declare the field constant variable.
if
(
descriptor_
->
extension_scope
()
!=
NULL
)
{
printer
->
Print
(
vars
,
"#if
ndef _MSC_VER
\n
"
"#if
!defined(_MSC_VER) || _MSC_VER >= 1900
\n
"
"const int $scope$$constant_name$;
\n
"
"#endif
\n
"
);
}
...
...
src/google/protobuf/compiler/cpp/cpp_message.cc
View file @
a74e912a
...
...
@@ -1807,7 +1807,7 @@ GenerateClassMethods(io::Printer* printer) {
}
// Generate field number constants.
printer
->
Print
(
"#if
ndef _MSC_VER
\n
"
);
printer
->
Print
(
"#if
!defined(_MSC_VER) || _MSC_VER >= 1900
\n
"
);
for
(
int
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
const
FieldDescriptor
*
field
=
descriptor_
->
field
(
i
);
printer
->
Print
(
...
...
@@ -1816,7 +1816,7 @@ GenerateClassMethods(io::Printer* printer) {
"constant_name"
,
FieldConstantName
(
field
));
}
printer
->
Print
(
"#endif // !
_MSC_VER
\n
"
"#endif // !
defined(_MSC_VER) || _MSC_VER >= 1900
\n
"
"
\n
"
);
// Define extension identifiers.
...
...
src/google/protobuf/compiler/plugin.pb.cc
View file @
a74e912a
...
...
@@ -172,11 +172,11 @@ static void MergeFromFail(int line) {
// ===================================================================
#if
ndef _MSC_VER
#if
!defined(_MSC_VER) || _MSC_VER >= 1900
const
int
CodeGeneratorRequest
::
kFileToGenerateFieldNumber
;
const
int
CodeGeneratorRequest
::
kParameterFieldNumber
;
const
int
CodeGeneratorRequest
::
kProtoFileFieldNumber
;
#endif // !
_MSC_VER
#endif // !
defined(_MSC_VER) || _MSC_VER >= 1900
CodeGeneratorRequest
::
CodeGeneratorRequest
()
:
::
google
::
protobuf
::
Message
(),
_internal_metadata_
(
NULL
)
{
...
...
@@ -656,11 +656,11 @@ CodeGeneratorRequest::proto_file() const {
// ===================================================================
#if
ndef _MSC_VER
#if
!defined(_MSC_VER) || _MSC_VER >= 1900
const
int
CodeGeneratorResponse_File
::
kNameFieldNumber
;
const
int
CodeGeneratorResponse_File
::
kInsertionPointFieldNumber
;
const
int
CodeGeneratorResponse_File
::
kContentFieldNumber
;
#endif // !
_MSC_VER
#endif // !
defined(_MSC_VER) || _MSC_VER >= 1900
CodeGeneratorResponse_File
::
CodeGeneratorResponse_File
()
:
::
google
::
protobuf
::
Message
(),
_internal_metadata_
(
NULL
)
{
...
...
@@ -1021,10 +1021,10 @@ void CodeGeneratorResponse_File::InternalSwap(CodeGeneratorResponse_File* other)
// -------------------------------------------------------------------
#if
ndef _MSC_VER
#if
!defined(_MSC_VER) || _MSC_VER >= 1900
const
int
CodeGeneratorResponse
::
kErrorFieldNumber
;
const
int
CodeGeneratorResponse
::
kFileFieldNumber
;
#endif // !
_MSC_VER
#endif // !
defined(_MSC_VER) || _MSC_VER >= 1900
CodeGeneratorResponse
::
CodeGeneratorResponse
()
:
::
google
::
protobuf
::
Message
(),
_internal_metadata_
(
NULL
)
{
...
...
src/google/protobuf/descriptor.cc
View file @
a74e912a
...
...
@@ -156,7 +156,7 @@ const char* FileDescriptor::SyntaxName(FileDescriptor::Syntax syntax) {
static
const
char
*
const
kNonLinkedWeakMessageReplacementName
=
"google.protobuf.Empty"
;
#if
ndef _MSC_VER // MSVC doesn't need these and won't even accept them.
#if
!defined(_MSC_VER) || _MSC_VER >= 1900
const
int
FieldDescriptor
::
kMaxNumber
;
const
int
FieldDescriptor
::
kFirstReservedNumber
;
const
int
FieldDescriptor
::
kLastReservedNumber
;
...
...
src/google/protobuf/descriptor.pb.cc
View file @
a74e912a
This diff is collapsed.
Click to expand it.
src/google/protobuf/wire_format_lite.cc
View file @
a74e912a
...
...
@@ -49,8 +49,10 @@ namespace google {
namespace
protobuf
{
namespace
internal
{
#ifndef _MSC_VER // MSVC doesn't like definitions of inline constants, GCC
// requires them.
#if !defined(_MSC_VER) || _MSC_VER >= 1900
// Old version of MSVC doesn't like definitions of inline constants, GCC
// requires them.
const
int
WireFormatLite
::
kMessageSetItemStartTag
;
const
int
WireFormatLite
::
kMessageSetItemEndTag
;
const
int
WireFormatLite
::
kMessageSetTypeIdTag
;
...
...
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