summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Slice/Parser.cpp29
-rw-r--r--cpp/src/slice2freeze/Main.cpp15
-rw-r--r--cpp/src/slice2freezej/Main.cpp14
3 files changed, 47 insertions, 11 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 98c6582635d..2557a048c1b 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -922,10 +922,18 @@ Slice::Container::createDictionary(const string& name, const TypePtr& keyType, c
checkForGlobalDef(name, "dictionary"); // Don't return here -- we create the dictionary anyway.
}
- if(nt == Real && !Dictionary::legalKeyType(keyType))
+ if(nt == Real)
{
- _unit->error("dictionary `" + name + "' uses an illegal key type");
- return 0;
+ bool containsSequence = false;
+ if(!Dictionary::legalKeyType(keyType, containsSequence))
+ {
+ _unit->error("dictionary `" + name + "' uses an illegal key type");
+ return 0;
+ }
+ if(containsSequence)
+ {
+ _unit->warning("use of sequences in dictionary keys has been deprecated");
+ }
}
if(!local)
@@ -3894,8 +3902,11 @@ Slice::Dictionary::recDependencies(set<ConstructedPtr>& dependencies)
// integral types, string, and sequences and structs containing only
// other legal key types.
//
+// Note: Allowing sequences in dictionary keys has been deprecated as
+// of Ice 3.3.0.
+//
bool
-Slice::Dictionary::legalKeyType(const TypePtr& type)
+Slice::Dictionary::legalKeyType(const TypePtr& type, bool& containsSequence)
{
BuiltinPtr bp = BuiltinPtr::dynamicCast(type);
if(bp)
@@ -3932,9 +3943,13 @@ Slice::Dictionary::legalKeyType(const TypePtr& type)
}
SequencePtr seqp = SequencePtr::dynamicCast(type);
- if(seqp && legalKeyType(seqp->type()))
+ if(seqp)
{
- return true;
+ containsSequence = true;
+ if(legalKeyType(seqp->type(), containsSequence))
+ {
+ return true;
+ }
}
StructPtr strp = StructPtr::dynamicCast(type);
@@ -3943,7 +3958,7 @@ Slice::Dictionary::legalKeyType(const TypePtr& type)
DataMemberList dml = strp->dataMembers();
for(DataMemberList::const_iterator mem = dml.begin(); mem != dml.end(); ++mem)
{
- if(!legalKeyType((*mem)->type()))
+ if(!legalKeyType((*mem)->type(), containsSequence))
{
return false;
}
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index 5136997cc4f..1ecea2fb397 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -1003,11 +1003,16 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c
return false;
}
- if(!Dictionary::legalKeyType(valueType))
+ bool containsSequence;
+ if(!Dictionary::legalKeyType(valueType, containsSequence))
{
cerr << n << ": `" << dict.value << "' is not a valid index type" << endl;
return false;
}
+ if(containsSequence)
+ {
+ cerr << n << ": warning: use of sequences in dictionary keys has been deprecated" << endl;
+ }
if(index.caseSensitive == false)
@@ -1071,11 +1076,17 @@ writeDict(const string& n, UnitPtr& u, const Dict& dict, Output& H, Output& C, c
TypePtr dataMemberType = dataMember->type();
- if(!Dictionary::legalKeyType(dataMemberType))
+ bool containsSequence;
+ if(!Dictionary::legalKeyType(dataMemberType, containsSequence))
{
cerr << n << ": `" << index.member << "' cannot be used as an index" << endl;
return false;
}
+ if(containsSequence)
+ {
+ cerr << n << ": warning: use of sequences in dictionary keys has been deprecated" << endl;
+ }
+
if(index.caseSensitive == false)
{
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index 4494fe94e0e..e2b312d37ad 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -254,11 +254,16 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
return false;
}
- if(!Dictionary::legalKeyType(valueType))
+ bool containsSequence;
+ if(!Dictionary::legalKeyType(valueType, containsSequence))
{
cerr << _prog << ": `" << dict.value << "' is not a valid index type" << endl;
return false;
}
+ if(containsSequence)
+ {
+ cerr << _prog << ": warning: use of sequences in dictionary keys has been deprecated" << endl;
+ }
if(index.caseSensitive == false)
{
@@ -320,11 +325,16 @@ FreezeGenerator::generate(UnitPtr& u, const Dict& dict)
TypePtr dataMemberType = dataMember->type();
- if(!Dictionary::legalKeyType(dataMemberType))
+ bool containsSequence;
+ if(!Dictionary::legalKeyType(dataMemberType, containsSequence))
{
cerr << _prog << ": `" << index.member << "' cannot be used as an index" << endl;
return false;
}
+ if(containsSequence)
+ {
+ cerr << _prog << ": warning: use of sequences in dictionary keys has been deprecated" << endl;
+ }
if(index.caseSensitive == false)
{