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
e0afc002
Commit
e0afc002
authored
May 01, 2015
by
Jie Luo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #330 from anandolee/csharp
Remove ClsCompliant declarations from C# code (fix #318)
parents
447de3ad
d9e3063e
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
1 addition
and
38 deletions
+1
-38
csharp_extension.cc
src/google/protobuf/compiler/csharp/csharp_extension.cc
+0
-8
csharp_field_base.cc
src/google/protobuf/compiler/csharp/csharp_field_base.cc
+0
-13
csharp_field_base.h
src/google/protobuf/compiler/csharp/csharp_field_base.h
+0
-2
csharp_generator.cc
src/google/protobuf/compiler/csharp/csharp_generator.cc
+1
-4
csharp_message.cc
src/google/protobuf/compiler/csharp/csharp_message.cc
+0
-5
csharp_source_generator_base.cc
.../protobuf/compiler/csharp/csharp_source_generator_base.cc
+0
-5
csharp_source_generator_base.h
...e/protobuf/compiler/csharp/csharp_source_generator_base.h
+0
-1
No files found.
src/google/protobuf/compiler/csharp/csharp_extension.cc
View file @
e0afc002
...
...
@@ -63,11 +63,6 @@ ExtensionGenerator::~ExtensionGenerator() {
}
void
ExtensionGenerator
::
Generate
(
Writer
*
writer
)
{
if
(
cls_compliance
()
&&
(
GetFieldConstantName
(
descriptor_
).
substr
(
0
,
1
)
==
"_"
))
{
writer
->
WriteLine
(
"[global::System.CLSCompliant(false)]"
);
}
writer
->
WriteLine
(
"public const int $0$ = $1$;"
,
GetFieldConstantName
(
descriptor_
),
SimpleItoa
(
descriptor_
->
number
()));
...
...
@@ -80,7 +75,6 @@ void ExtensionGenerator::Generate(Writer* writer) {
// "option message_set_wire_format = true; is not supported in Lite runtime extensions.");
//}
AddClsComplianceCheck
(
writer
);
writer
->
Write
(
"$0$ "
,
class_access_level
());
writer
->
WriteLine
(
"static pb::$3$<$0$, $1$> $2$;"
,
...
...
@@ -90,12 +84,10 @@ void ExtensionGenerator::Generate(Writer* writer) {
descriptor_
->
is_repeated
()
?
"GeneratedRepeatExtensionLite"
:
"GeneratedExtensionLite"
);
}
else
if
(
descriptor_
->
is_repeated
())
{
AddClsComplianceCheck
(
writer
);
writer
->
WriteLine
(
"$0$ static pb::GeneratedExtensionBase<scg::IList<$1$>> $2$;"
,
class_access_level
(),
type_name
(),
property_name
());
}
else
{
AddClsComplianceCheck
(
writer
);
writer
->
WriteLine
(
"$0$ static pb::GeneratedExtensionBase<$1$> $2$;"
,
class_access_level
(),
type_name
(),
property_name
());
}
...
...
src/google/protobuf/compiler/csharp/csharp_field_base.cc
View file @
e0afc002
...
...
@@ -79,13 +79,6 @@ void FieldGeneratorBase::AddNullCheck(Writer* writer, const std::string& name) {
void
FieldGeneratorBase
::
AddPublicMemberAttributes
(
Writer
*
writer
)
{
AddDeprecatedFlag
(
writer
);
AddClsComplianceCheck
(
writer
);
}
void
FieldGeneratorBase
::
AddClsComplianceCheck
(
Writer
*
writer
)
{
if
(
cls_compliance
()
&&
!
is_cls_compliant
())
{
writer
->
WriteLine
(
"[global::System.CLSCompliant(false)]"
);
}
}
std
::
string
FieldGeneratorBase
::
property_name
()
{
...
...
@@ -211,12 +204,6 @@ bool FieldGeneratorBase::is_nullable_type() {
}
}
bool
FieldGeneratorBase
::
is_cls_compliant
()
{
CSharpType
type
=
GetCSharpType
(
descriptor_
->
type
());
return
(
type
!=
CSHARPTYPE_UINT32
)
&&
(
type
!=
CSHARPTYPE_UINT64
)
&&
(
UnderscoresToPascalCase
(
name
()).
substr
(
0
,
1
)
!=
"_"
);
}
inline
bool
IsNaN
(
double
value
)
{
// NaN is never equal to anything, even itself.
return
value
!=
value
;
...
...
src/google/protobuf/compiler/csharp/csharp_field_base.h
View file @
e0afc002
...
...
@@ -70,14 +70,12 @@ class FieldGeneratorBase : public SourceGeneratorBase {
void
AddNullCheck
(
Writer
*
writer
,
const
std
::
string
&
name
);
void
AddPublicMemberAttributes
(
Writer
*
writer
);
void
AddClsComplianceCheck
(
Writer
*
writer
);
std
::
string
property_name
();
std
::
string
name
();
std
::
string
type_name
();
bool
has_default_value
();
bool
is_nullable_type
();
bool
is_cls_compliant
();
std
::
string
default_value
();
std
::
string
number
();
std
::
string
message_or_group
();
...
...
src/google/protobuf/compiler/csharp/csharp_generator.cc
View file @
e0afc002
...
...
@@ -71,10 +71,7 @@ bool Generator::Generate(
std
::
string
file_extension
=
".cs"
;
for
(
int
i
=
0
;
i
<
options
.
size
();
i
++
)
{
if
(
options
[
i
].
first
==
"no_cls_compliance"
)
{
*
error
=
"Turning off CLS compliance is not implemented yet."
;
return
false
;
}
else
if
(
options
[
i
].
first
==
"file_extension"
)
{
if
(
options
[
i
].
first
==
"file_extension"
)
{
file_extension
=
options
[
i
].
second
;
}
else
{
*
error
=
"Unknown generator option: "
+
options
[
i
].
first
;
...
...
src/google/protobuf/compiler/csharp/csharp_message.cc
View file @
e0afc002
...
...
@@ -262,11 +262,6 @@ void MessageGenerator::Generate(Writer* writer) {
for
(
int
i
=
0
;
i
<
descriptor_
->
field_count
();
i
++
)
{
const
FieldDescriptor
*
fieldDescriptor
=
descriptor_
->
field
(
i
);
// TODO(jtattermusch): same code for cls compliance is in csharp_extension
if
(
cls_compliance
()
&&
GetFieldConstantName
(
fieldDescriptor
)[
0
]
==
'_'
)
{
writer
->
WriteLine
(
"[global::System.CLSCompliant(false)]"
);
}
// Rats: we lose the debug comment here :(
writer
->
WriteLine
(
"public const int $0$ = $1$;"
,
...
...
src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
View file @
e0afc002
...
...
@@ -69,11 +69,6 @@ std::string SourceGeneratorBase::class_access_level() {
return
"public"
;
// public_classes is always on.
}
bool
SourceGeneratorBase
::
cls_compliance
()
{
// TODO(jtattermusch): implement this based on "cls_compliance" cmdline param.
return
true
;
}
}
// namespace csharp
}
// namespace compiler
}
// namespace protobuf
...
...
src/google/protobuf/compiler/csharp/csharp_source_generator_base.h
View file @
e0afc002
...
...
@@ -48,7 +48,6 @@ class SourceGeneratorBase {
virtual
~
SourceGeneratorBase
();
std
::
string
class_access_level
();
bool
cls_compliance
();
bool
optimize_size
()
{
return
optimizeSize_
;
...
...
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