summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp35
1 files changed, 30 insertions, 5 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index b956e983d24..8edd505d628 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -165,7 +165,7 @@ Slice::CsGenerator::typeToString(const TypePtr& type)
}
SequencePtr seq = SequencePtr::dynamicCast(type);
- if(seq && !seq->hasMetaData("cs:collection"))
+ if(seq && !seq->hasMetaData("clr:collection"))
{
return typeToString(seq->type()) + "[]";
}
@@ -205,7 +205,7 @@ Slice::CsGenerator::isValueType(const TypePtr& type)
StructPtr s = StructPtr::dynamicCast(type);
if(s)
{
- return !s->hasMetaData("cs:class");
+ return !s->hasMetaData("clr:class");
}
if(EnumPtr::dynamicCast(type))
{
@@ -533,7 +533,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
TypePtr type = seq->type();
string typeS = typeToString(type);
- bool isArray = !seq->hasMetaData("cs:collection");
+ bool isArray = !seq->hasMetaData("clr:collection");
string limitID = isArray ? "Length" : "Count";
BuiltinPtr builtin = BuiltinPtr::dynamicCast(type);
@@ -777,7 +777,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << sb;
if(isArray)
{
- if(st->hasMetaData("cs:class"))
+ if(st->hasMetaData("clr:class"))
{
out << nl << param << "[__ix] = new " << typeS << "();";
}
@@ -1073,7 +1073,7 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont)
StringList localMetaData = cont->getMetaData();
StringList::const_iterator p;
- static const string prefix = "cs:";
+ static const string prefix = "clr:";
for(p = globalMetaData.begin(); p != globalMetaData.end(); ++p)
{
@@ -1091,6 +1091,31 @@ Slice::CsGenerator::MetaDataVisitor::validate(const ContainedPtr& cont)
for(p = localMetaData.begin(); p != localMetaData.end(); ++p)
{
string s = *p;
+ if(s.find("cs:") == 0) // TODO: remove this statement once "cs:" is a hard error.
+ {
+ if(SequencePtr::dynamicCast(cont))
+ {
+ if(s.substr(3) == "collection")
+ {
+ cout << file << ":" << cont->line() << ": warning: `cs:' metadata prefix is deprecated; "
+ << "use `clr:' instead" << endl;
+ cont->addMetaData("clr:collection");
+ }
+ }
+ else if(StructPtr::dynamicCast(cont))
+ {
+ if(s.substr(3) == "class")
+ {
+ cout << file << ":" << cont->line() << ": warning: `cs:' metadata prefix is deprecated; "
+ << "use `clr:' instead" << endl;
+ }
+ cont->addMetaData("clr:class");
+ }
+ else
+ {
+ cout << file << ":" << cont->line() << ": warning: ignoring invalid metadata `" << s << "'" << endl;
+ }
+ } // End TODO
if(_history.count(s) == 0)
{
if(s.find(prefix) == 0)