summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Slice/Parser.h155
-rw-r--r--cpp/src/Slice/Parser.cpp923
-rw-r--r--cpp/test/Slice/errorDetection/CaseInsensitive.err50
-rw-r--r--cpp/test/Slice/errorDetection/CaseInsensitive.ice160
-rw-r--r--cpp/test/Slice/errorDetection/DataMemberRedefinition.err2
-rw-r--r--cpp/test/Slice/errorDetection/DerivedRedefinition.err10
-rw-r--r--cpp/test/Slice/errorDetection/DictionaryRedefinition.err2
-rw-r--r--cpp/test/Slice/errorDetection/EnumRedefinition.err2
-rw-r--r--cpp/test/Slice/errorDetection/EnumeratorRedefinition.err4
-rw-r--r--cpp/test/Slice/errorDetection/IllegalMI.err10
-rw-r--r--cpp/test/Slice/errorDetection/NameCanNotBeUsed.err10
-rw-r--r--cpp/test/Slice/errorDetection/OperationRedefinition.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsClass.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsDictionary.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsEnum.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err4
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsInterface.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsModule.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsOperation.err2
-rw-r--r--cpp/test/Slice/errorDetection/RedefinitionAsSequence.err2
-rw-r--r--cpp/test/Slice/errorDetection/SequenceRedefinition.err2
22 files changed, 900 insertions, 452 deletions
diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
index de7af8f4e6e..d08a739dfe0 100644
--- a/cpp/include/Slice/Parser.h
+++ b/cpp/include/Slice/Parser.h
@@ -170,7 +170,7 @@ class SLICE_API SyntaxTreeBase : public GrammarBase
public:
virtual void destroy();
- UnitPtr unit();
+ UnitPtr unit() const;
virtual void visit(ParserVisitor*);
protected:
@@ -233,17 +233,17 @@ class SLICE_API Contained : virtual public SyntaxTreeBase
{
public:
- ContainerPtr container();
+ ContainerPtr container() const;
std::string name();
std::string scoped();
- std::string scope();
- std::string file();
- std::string comment();
+ std::string scope() const;
+ std::string file() const;
+ std::string comment() const;
int includeLevel();
void updateIncludeLevel();
- std::list<std::string> getMetaData();
+ std::list<std::string> getMetaData() const;
void setMetaData(const std::list<std::string>&);
enum ContainedType
@@ -259,9 +259,10 @@ public:
ContainedTypeOperation,
ContainedTypeDataMember
};
- virtual ContainedType containedType() = 0;
+ virtual ContainedType containedType() const = 0;
- virtual bool uses(const ContainedPtr&) = 0;
+ virtual bool uses(const ContainedPtr&) const = 0;
+ virtual std::string kindOf() const = 0;
bool operator<(const Contained&) const;
bool operator==(const Contained&) const;
@@ -302,17 +303,17 @@ public:
TypeList lookupTypeNoBuiltin(const std::string&, bool = true);
ContainedList lookupContained(const std::string&, bool = true);
ExceptionPtr lookupException(const std::string&, bool = true);
- ModuleList modules();
- ClassList classes();
- ExceptionList exceptions();
- StructList structs();
- SequenceList sequences();
- DictionaryList dictionaries();
- EnumList enums();
- bool hasNonLocalClassDecls();
- bool hasClassDecls();
- bool hasClassDefs();
- bool hasOtherConstructedOrExceptions(); // Exceptions or constructed types other than classes.
+ ModuleList modules() const;
+ ClassList classes() const;
+ ExceptionList exceptions() const;
+ StructList structs() const;
+ SequenceList sequences() const;
+ DictionaryList dictionaries() const;
+ EnumList enums() const;
+ bool hasNonLocalClassDecls() const;
+ bool hasClassDecls() const;
+ bool hasClassDefs() const;
+ bool hasOtherConstructedOrExceptions() const; // Exceptions or constructed types other than classes.
std::string thisScope();
void mergeModules();
void sort();
@@ -346,8 +347,9 @@ class SLICE_API Module : virtual public Container, virtual public Contained
{
public:
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
protected:
@@ -364,7 +366,7 @@ class SLICE_API Constructed : virtual public Type, virtual public Contained
{
public:
- bool isLocal();
+ bool isLocal() const;
ConstructedList dependencies();
virtual void recDependencies(std::set<ConstructedPtr>&) = 0; // Internal operation, don't use directly.
@@ -386,9 +388,10 @@ public:
virtual void destroy();
ClassDefPtr definition();
bool isInterface();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
virtual void visit(ParserVisitor*);
+ virtual std::string kindOf() const;
virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
protected:
@@ -420,19 +423,20 @@ public:
OperationPtr createOperation(const std::string&, const TypePtr&, const TypeStringList&, const TypeStringList&,
const ExceptionList&);
DataMemberPtr createDataMember(const std::string&, const TypePtr&);
- ClassDeclPtr declaration();
- ClassList bases();
- ClassList allBases();
- OperationList operations();
- OperationList allOperations();
- DataMemberList dataMembers();
- DataMemberList allDataMembers();
+ ClassDeclPtr declaration() const;
+ ClassList bases() const;
+ ClassList allBases() const;
+ OperationList operations() const;
+ OperationList allOperations() const;
+ DataMemberList dataMembers() const;
+ DataMemberList allDataMembers() const;
bool isAbstract();
bool isInterface();
- bool isLocal();
- bool hasDataMembers();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ bool isLocal() const;
+ bool hasDataMembers() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
protected:
@@ -475,12 +479,13 @@ public:
virtual void destroy();
DataMemberPtr createDataMember(const std::string&, const TypePtr&);
- DataMemberList dataMembers();
- ExceptionPtr base();
- ExceptionList allBases();
- bool isLocal();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ DataMemberList dataMembers() const;
+ ExceptionPtr base() const;
+ ExceptionList allBases() const;
+ bool isLocal() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
protected:
@@ -502,8 +507,9 @@ public:
DataMemberPtr createDataMember(const std::string&, const TypePtr&);
DataMemberList dataMembers();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
@@ -522,8 +528,9 @@ class SLICE_API Sequence : virtual public Constructed
public:
TypePtr type();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
@@ -545,8 +552,9 @@ public:
TypePtr keyType();
TypePtr valueType();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
@@ -569,8 +577,9 @@ public:
EnumeratorList getEnumerators();
void setEnumerators(const EnumeratorList&);
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
virtual void recDependencies(std::set<ConstructedPtr>&); // Internal operation, don't use directly.
@@ -590,8 +599,9 @@ class SLICE_API Enumerator : virtual public Contained
{
public:
- virtual bool uses(const ContainedPtr&);
- virtual ContainedType containedType();
+ virtual bool uses(const ContainedPtr&) const;
+ virtual ContainedType containedType() const;
+ virtual std::string kindOf() const;
protected:
@@ -607,12 +617,13 @@ class SLICE_API Operation : virtual public Contained
{
public:
- TypePtr returnType();
- TypeStringList inputParameters();
- TypeStringList outputParameters();
- ExceptionList throws();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ TypePtr returnType() const;
+ TypeStringList inputParameters() const;
+ TypeStringList outputParameters() const;
+ ExceptionList throws() const;
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
protected:
@@ -636,8 +647,9 @@ class SLICE_API DataMember : virtual public Contained
public:
TypePtr type();
- virtual ContainedType containedType();
- virtual bool uses(const ContainedPtr&);
+ virtual ContainedType containedType() const;
+ virtual bool uses(const ContainedPtr&) const;
+ virtual std::string kindOf() const;
virtual void visit(ParserVisitor*);
protected:
@@ -660,15 +672,16 @@ public:
static UnitPtr createUnit(bool, bool);
- bool ignRedefs();
+ bool ignRedefs() const;
void setComment(const std::string&);
std::string currentComment();
- std::string currentFile();
+ std::string currentFile() const;
+ int currentLine() const;
void nextLine();
void scanPosition(const char*);
- int currentIncludeLevel();
+ int currentIncludeLevel() const;
void error(const char*);
void error(const std::string&);
@@ -676,21 +689,21 @@ public:
void warning(const char*);
void warning(const std::string&);
- ContainerPtr currentContainer();
+ ContainerPtr currentContainer() const;
void pushContainer(const ContainerPtr&);
void popContainer();
void addContent(const ContainedPtr&);
void removeContent(const ContainedPtr&);
- ContainedList findContents(const std::string&);
- ClassList findDerivedClasses(const ClassDefPtr&);
- ExceptionList findDerivedExceptions(const ExceptionPtr&);
- ContainedList findUsedBy(const ContainedPtr&);
+ ContainedList findContents(const std::string&) const;
+ ClassList findDerivedClasses(const ClassDefPtr&) const;
+ ExceptionList findDerivedExceptions(const ExceptionPtr&) const;
+ ContainedList findUsedBy(const ContainedPtr&) const;
- bool usesProxies();
- bool usesNonLocals();
+ bool usesProxies() const;
+ bool usesNonLocals() const;
- StringList includeFiles();
+ StringList includeFiles() const;
int parse(FILE*, bool);
@@ -714,7 +727,7 @@ private:
StringList _includeFiles;
std::stack<ContainerPtr> _containerStack;
std::map<Builtin::Kind, BuiltinPtr> _builtins;
- std::map<std::string, ContainedList > _contentMap;
+ std::map<std::string, ContainedList> _contentMap;
};
extern SLICE_API Unit* unit; // The current parser for bison/flex
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 32b79a55f0b..65dec9eb126 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -25,6 +25,16 @@ Unit* unit;
}
// ----------------------------------------------------------------------
+// to_lower() helper function
+// ----------------------------------------------------------------------
+
+static void
+to_lower(string& s)
+{
+ transform(s.begin(), s.end(), s.begin(), tolower);
+}
+
+// ----------------------------------------------------------------------
// SyntaxTreeBase
// ----------------------------------------------------------------------
@@ -35,7 +45,7 @@ Slice::SyntaxTreeBase::destroy()
}
UnitPtr
-Slice::SyntaxTreeBase::unit()
+Slice::SyntaxTreeBase::unit() const
{
return _unit;
}
@@ -81,7 +91,7 @@ Slice::Builtin::Builtin(const UnitPtr& unit, Kind kind) :
// ----------------------------------------------------------------------
ContainerPtr
-Slice::Contained::container()
+Slice::Contained::container() const
{
return _container;
}
@@ -99,7 +109,7 @@ Slice::Contained::scoped()
}
string
-Slice::Contained::scope()
+Slice::Contained::scope() const
{
string::size_type idx = _scoped.rfind("::");
assert(idx != string::npos);
@@ -107,13 +117,13 @@ Slice::Contained::scope()
}
string
-Slice::Contained::file()
+Slice::Contained::file() const
{
return _file;
}
string
-Slice::Contained::comment()
+Slice::Contained::comment() const
{
return _comment;
}
@@ -131,7 +141,7 @@ Slice::Contained::updateIncludeLevel()
}
list<string>
-Slice::Contained::getMetaData()
+Slice::Contained::getMetaData() const
{
return _metaData;
}
@@ -190,17 +200,36 @@ Slice::Container::createModule(const string& name)
ContainedList matches = _unit->findContents(thisScope() + name);
for(ContainedList::const_iterator p = matches.begin(); p != matches.end(); ++p)
{
+ string msg;
+ bool differsOnlyInCase = matches.front()->name() != name;
ModulePtr module = ModulePtr::dynamicCast(*p);
if(module)
{
- continue; // Reopening modules is permissible
+ if(!differsOnlyInCase)
+ {
+ continue; // Reopening modules is permissible...
+ }
+ else // ... but only if they are capitalized correctly
+ {
+ msg += "module `" + name + "' is capitalized inconsistently with its previous name: `";
+ msg += module->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
+ }
}
- string msg = "redefinition of `";
- msg += name;
- msg += "' as module";
- _unit->error(msg);
- return 0;
+ if(differsOnlyInCase)
+ {
+ msg = "module `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
+ }
+ else
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as module";
+ _unit->error(msg);
+ return 0;
+ }
}
ModulePtr q = new Module(this, name);
@@ -221,10 +250,11 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
{
continue;
}
-
return 0;
}
+ string msg;
+ bool differsOnlyInCase = matches.front()->name() != name;
ClassDefPtr def = ClassDefPtr::dynamicCast(*p);
if(def)
{
@@ -233,35 +263,38 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
def->updateIncludeLevel();
return def;
}
-
- string msg = "redefinition of ";
- if(intf)
+ if (!differsOnlyInCase)
{
- msg += "interface";
+ string msg = "redefinition of ";
+ msg += intf ? "interface" : "class";
+ msg += " `" + name + "'";
+ _unit->error(msg);
+ return 0;
}
else
{
- msg += "class";
+ msg = intf ? "interface" : "class";
+ msg += " definition `" + name + "' is capitalized inconsistently with its previous name: `";
+ msg += def->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
}
- msg += " `";
- msg += name;
- msg += "'";
- _unit->error(msg);
- return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as ";
- if(intf)
+
+ if(differsOnlyInCase)
{
- msg += "interface";
+ msg = intf ? "interface" : "class";
+ msg = " definition `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
}
else
{
- msg += "class";
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name() + "' as ";
+ msg += intf ? "interface" : "class";
+ _unit->error(msg);
+ return 0;
}
- _unit->error(msg);
+
return 0;
}
@@ -338,118 +371,6 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
return def;
}
-// TODO: ML: The order of declaration in the header should match the
-// order of definition in the .cpp file.
-
-//
-// Return true if the class definition cdp is on one of the class lists in gpl, false otherwise.
-//
-bool
-Slice::Container::isInList(const GraphPartitionList& gpl, const ClassDefPtr cdp) const
-{
- for(GraphPartitionList::const_iterator i = gpl.begin(); i != gpl.end(); ++i)
- {
- // TODO: ML: Why not just i->begin()? (Here and elsewhere.)
- if(find((*i).begin(), (*i).end(), cdp) != (*i).end())
-// TODO: ML: Indentation.
-{
- return true;
-}
- }
- return false;
-}
-
-// TODO: ML: Line length must be <= 119 chars.
-void
-Slice::Container::addPartition(GraphPartitionList& gpl, GraphPartitionList::reverse_iterator tail, const ClassDefPtr base) const
-{
- //
- // If this base is on one of the partition lists already, do nothing.
- //
- if(isInList(gpl, base))
- {
- return;
- }
- //
- // Put the current base at the end of the current partition.
- //
- (*tail).push_back(base);
- //
- // If the base has bases in turn, recurse, adding the first base
- // of base (the left-most "grandbase") to the current partition.
- //
- if(base->_bases.size())
- {
- addPartition(gpl, tail, *(base->_bases.begin()));
- }
- //
- // If the base has multiple bases, each of the "grandbases"
- // except for the left-most (which we just dealt with)
- // adds a new partition.
- //
- if(base->_bases.size() > 1)
- {
- ClassList::const_iterator i = base->_bases.begin();
- while(++i != base->_bases.end())
- {
- ClassList cl;
- gpl.push_back(cl);
- addPartition(gpl, gpl.rbegin(), *i);
- }
- }
-}
-
-//
-// Convert the list of partitions of class definitions into a
-// list of sets, with each set containing the operation and member
-// names defined by the classes in each partition.
-//
-StringSetList
-Slice::Container::toStringSetList(const GraphPartitionList& gpl) const
-{
- StringSetList spl;
- for(GraphPartitionList::const_iterator i = gpl.begin(); i != gpl.end(); ++i)
- {
- StringSet ss;
- spl.push_back(ss);
- for(ClassList::const_iterator j = (*i).begin(); j != (*i).end(); ++j)
- {
- OperationList operations = (*j)->operations();
- DataMemberList members = (*j)->dataMembers();
- for(OperationList::const_iterator l = operations.begin(); l != operations.end(); ++l)
- {
- spl.rbegin()->insert((*l)->name());
- }
- for(DataMemberList::const_iterator m = members.begin(); m != members.end(); ++m)
- {
- spl.rbegin()->insert((*m)->name());
- }
- }
- }
- return spl;
-}
-
-//
-// Return the union of the intersections of all possible pairs of sets of strings.
-//
-StringList
-Slice::Container::unionOfAllPairIntersections(const StringSetList& l) const
-{
- StringList result;
- for(StringSetList::const_iterator i = l.begin(); i != l.end(); ++i)
- {
- StringSetList::const_iterator cursor = i;
- ++cursor;
- for(StringSetList::const_iterator j = cursor; j != l.end(); ++j)
- {
- set_intersection((*i).begin(), (*i).end(), (*j).begin(), (*j).end(), back_inserter(result));
- }
- }
- result.sort();
- result.unique();
- return result;
-}
-
ClassDeclPtr
Slice::Container::createClassDecl(const string& name, bool intf, bool local)
{
@@ -482,19 +403,23 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
return 0;
}
- string msg = "declaration of already defined `";
- msg += name;
- msg += "' as ";
- if(intf)
+ string msg;
+ bool differsOnlyInCase = matches.front()->name() != name;
+ if (differsOnlyInCase)
{
- msg += "interface";
+ msg = "class declaration `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
}
else
- {
- msg += "class";
+ {
+ msg = "declaration of already defined `";
+ msg += name;
+ msg += "' as ";
+ msg += intf ? "interface" : "class";
+ _unit->error(msg);
+ return 0;
}
- _unit->error(msg);
- return 0;
}
//
@@ -541,19 +466,18 @@ Slice::Container::createException(const string& name, const ExceptionPtr& base,
p->updateIncludeLevel();
return p;
}
-
- string msg = "redefinition of exception `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if (matches.front()->name() == name)
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as exception";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as exception";
- _unit->error(msg);
- return 0;
+ msg = "exception `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
}
ExceptionPtr p = new Exception(this, name, base, local);
@@ -575,19 +499,18 @@ Slice::Container::createStruct(const string& name, bool local)
p->updateIncludeLevel();
return p;
}
-
- string msg = "redefinition of struct `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if (matches.front()->name() == name)
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as struct";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as struct";
- _unit->error(msg);
- return 0;
+ msg = "struct `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: Change to error in stable_39
}
StructPtr p = new Struct(this, name, local);
@@ -608,21 +531,20 @@ Slice::Container::createSequence(const string& name, const TypePtr& type, bool l
{
return p;
}
-
- string msg = "redefinition of sequence `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if (matches.front()->name() == name)
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as sequence";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as sequence";
- _unit->error(msg);
- return 0;
+ msg = "sequence `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
}
-
+
SequencePtr p = new Sequence(this, name, type, local);
_contents.push_back(p);
return p;
@@ -641,19 +563,18 @@ Slice::Container::createDictionary(const string& name, const TypePtr& keyType, c
{
return p;
}
-
- string msg = "redefinition of dictionary `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if (matches.front()->name() == name)
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as dictionary";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as dictionary";
- _unit->error(msg);
- return 0;
+ msg = "dictionary `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
}
DictionaryPtr p = new Dictionary(this, name, keyType, valueType, local);
@@ -674,19 +595,18 @@ Slice::Container::createEnum(const string& name, bool local)
{
return p;
}
-
- string msg = "redefinition of enum `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if (matches.front()->name() == name)
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as enumeration";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as enum";
- _unit->error(msg);
- return 0;
+ msg = "enumeration `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
}
EnumPtr p = new Enum(this, name, local);
@@ -707,19 +627,18 @@ Slice::Container::createEnumerator(const string& name)
{
return p;
}
-
- string msg = "redefinition of enumerator `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if (matches.front()->name() == name)
+ {
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as enumerator";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as enumerator";
- _unit->error(msg);
- return 0;
+ msg = "enumerator `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
}
EnumeratorPtr p = new Enumerator(this, name);
@@ -974,7 +893,7 @@ Slice::Container::lookupException(const string& scoped, bool printError)
}
ModuleList
-Slice::Container::modules()
+Slice::Container::modules() const
{
ModuleList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -989,7 +908,7 @@ Slice::Container::modules()
}
ClassList
-Slice::Container::classes()
+Slice::Container::classes() const
{
ClassList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1004,7 +923,7 @@ Slice::Container::classes()
}
ExceptionList
-Slice::Container::exceptions()
+Slice::Container::exceptions() const
{
ExceptionList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1019,7 +938,7 @@ Slice::Container::exceptions()
}
StructList
-Slice::Container::structs()
+Slice::Container::structs() const
{
StructList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1034,7 +953,7 @@ Slice::Container::structs()
}
SequenceList
-Slice::Container::sequences()
+Slice::Container::sequences() const
{
SequenceList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1049,7 +968,7 @@ Slice::Container::sequences()
}
DictionaryList
-Slice::Container::dictionaries()
+Slice::Container::dictionaries() const
{
DictionaryList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1064,7 +983,7 @@ Slice::Container::dictionaries()
}
EnumList
-Slice::Container::enums()
+Slice::Container::enums() const
{
EnumList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1079,7 +998,7 @@ Slice::Container::enums()
}
bool
-Slice::Container::hasNonLocalClassDecls()
+Slice::Container::hasNonLocalClassDecls() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
@@ -1100,7 +1019,7 @@ Slice::Container::hasNonLocalClassDecls()
}
bool
-Slice::Container::hasClassDecls()
+Slice::Container::hasClassDecls() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
@@ -1120,7 +1039,7 @@ Slice::Container::hasClassDecls()
}
bool
-Slice::Container::hasClassDefs()
+Slice::Container::hasClassDefs() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
@@ -1140,7 +1059,7 @@ Slice::Container::hasClassDefs()
}
bool
-Slice::Container::hasOtherConstructedOrExceptions()
+Slice::Container::hasOtherConstructedOrExceptions() const
{
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
{
@@ -1333,22 +1252,136 @@ Slice::Container::checkInterfaceAndLocal(const string& name, bool defined,
return true;
}
+//
+// Return true if the class definition cdp is on one of the class lists in gpl, false otherwise.
+//
+bool
+Slice::Container::isInList(const GraphPartitionList& gpl, const ClassDefPtr cdp) const
+{
+ for(GraphPartitionList::const_iterator i = gpl.begin(); i != gpl.end(); ++i)
+ {
+ if(find(i->begin(), i->end(), cdp) != i->end())
+ {
+ return true;
+ }
+ }
+ return false;
+}
+
+void
+Slice::Container::addPartition(GraphPartitionList& gpl,
+ GraphPartitionList::reverse_iterator tail,
+ const ClassDefPtr base) const
+{
+ //
+ // If this base is on one of the partition lists already, do nothing.
+ //
+ if(isInList(gpl, base))
+ {
+ return;
+ }
+ //
+ // Put the current base at the end of the current partition.
+ //
+ tail->push_back(base);
+ //
+ // If the base has bases in turn, recurse, adding the first base
+ // of base (the left-most "grandbase") to the current partition.
+ //
+ if(base->_bases.size())
+ {
+ addPartition(gpl, tail, *(base->_bases.begin()));
+ }
+ //
+ // If the base has multiple bases, each of the "grandbases"
+ // except for the left-most (which we just dealt with)
+ // adds a new partition.
+ //
+ if(base->_bases.size() > 1)
+ {
+ ClassList::const_iterator i = base->_bases.begin();
+ while(++i != base->_bases.end())
+ {
+ ClassList cl;
+ gpl.push_back(cl);
+ addPartition(gpl, gpl.rbegin(), *i);
+ }
+ }
+}
+
+//
+// Convert the list of partitions of class definitions into a
+// list of sets, with each set containing the operation and member
+// names defined by the classes in each partition.
+//
+StringSetList
+Slice::Container::toStringSetList(const GraphPartitionList& gpl) const
+{
+ StringSetList spl;
+ for(GraphPartitionList::const_iterator i = gpl.begin(); i != gpl.end(); ++i)
+ {
+ StringSet ss;
+ spl.push_back(ss);
+ for(ClassList::const_iterator j = i->begin(); j != i->end(); ++j)
+ {
+ OperationList operations = (*j)->operations();
+ DataMemberList members = (*j)->dataMembers();
+ for(OperationList::const_iterator l = operations.begin(); l != operations.end(); ++l)
+ {
+ spl.rbegin()->insert((*l)->name());
+ }
+ for(DataMemberList::const_iterator m = members.begin(); m != members.end(); ++m)
+ {
+ spl.rbegin()->insert((*m)->name());
+ }
+ }
+ }
+ return spl;
+}
+
+//
+// Return the union of the intersections of all possible pairs of sets of strings.
+//
+StringList
+Slice::Container::unionOfAllPairIntersections(const StringSetList& l) const
+{
+ StringList result;
+ for(StringSetList::const_iterator i = l.begin(); i != l.end(); ++i)
+ {
+ StringSetList::const_iterator cursor = i;
+ ++cursor;
+ for(StringSetList::const_iterator j = cursor; j != l.end(); ++j)
+ {
+ set_intersection(i->begin(), i->end(), j->begin(), j->end(), back_inserter(result));
+ }
+ }
+ result.sort();
+ result.unique();
+ return result;
+}
+
// ----------------------------------------------------------------------
// Module
// ----------------------------------------------------------------------
Contained::ContainedType
-Slice::Module::containedType()
+Slice::Module::containedType() const
{
return ContainedTypeModule;
}
bool
-Slice::Module::uses(const ContainedPtr&)
+Slice::Module::uses(const ContainedPtr&) const
{
return false;
}
+std::string
+Slice::Module::kindOf() const
+{
+ return "module";
+}
+
void
Slice::Module::visit(ParserVisitor* visitor)
{
@@ -1376,7 +1409,7 @@ Slice::Module::Module(const ContainerPtr& container, const string& name) :
// ----------------------------------------------------------------------
bool
-Slice::Constructed::isLocal()
+Slice::Constructed::isLocal() const
{
return _local;
}
@@ -1421,17 +1454,25 @@ Slice::ClassDecl::isInterface()
}
Contained::ContainedType
-Slice::ClassDecl::containedType()
+Slice::ClassDecl::containedType() const
{
return ContainedTypeClass;
}
bool
-Slice::ClassDecl::uses(const ContainedPtr&)
+Slice::ClassDecl::uses(const ContainedPtr&) const
{
return false;
}
+std::string
+Slice::ClassDecl::kindOf() const
+{
+ string s = _interface ? "interface" : "class";
+ s += " declaration";
+ return s;
+}
+
void
Slice::ClassDecl::visit(ParserVisitor* visitor)
{
@@ -1491,17 +1532,16 @@ Slice::ClassDef::createOperation(const string& name,
{
return p;
}
-
- string msg = "redefinition of operation `";
- msg += name;
- msg += "'";
- _unit->error(msg);
- return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as operation";
+ string msg;
+ if(matches.front()->name() != name)
+ {
+ msg = "operation `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as operation `" + name + "'";
_unit->error(msg);
return 0;
}
@@ -1524,6 +1564,10 @@ Slice::ClassDef::createOperation(const string& name,
// signature (but the missing parameters have been reported
// already).
//
+ string plc = p->second;
+ to_lower(plc);
+ string qlc = q->second;
+ to_lower(qlc);
if(p->second == q->second && p->second != "")
{
string msg = "duplicate parameter `";
@@ -1532,44 +1576,74 @@ Slice::ClassDef::createOperation(const string& name,
_unit->error(msg);
return 0;
}
+ if(plc == qlc && plc != "")
+ {
+ string msg = "parameter `" + p->second;
+ msg += "' differs only in capitalization from parameter `" + q->second + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+
++q;
}
++p;
}
}
+ //
+ // Check whether enclosing interface/class has the same name
+ //
if(name == this->name())
{
- string msg;
- if(isInterface())
- {
- msg = "interface name `";
- }
- else
- {
- msg = "class name `";
- }
- msg += name;
- msg += "' cannot be used as operation";
+ string msg = isInterface() ? "interface" : "class";
+ msg += "name `" + name + "' cannot be used as operation name";
_unit->error(msg);
return 0;
}
+ string newName = name;
+ to_lower(newName);
+ string thisName = this->name();
+ to_lower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from enclosing ";
+ msg += isInterface() ? "interface" : "class";
+ msg += " name `" + this->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
//
- // Check whether any bases have defined this operation already
+ // Check whether any bases have defined something with the same name already
//
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
+ ContainedList cl;
OperationList ol = (*p)->allOperations();
- for(OperationList::const_iterator p = ol.begin(); p != ol.end(); ++p)
+ copy(ol.begin(), ol.end(), back_inserter(cl));
+ DataMemberList dml = (*p)->allDataMembers();
+ copy(dml.begin(), dml.end(), back_inserter(cl));
+ // TODO: once we have constants, append constants to this list for checking
+ for(ContainedList::const_iterator p = cl.begin(); p != cl.end(); ++p)
{
if((*p)->name() == name)
{
string msg = "operation `" + name;
- msg += "' is already defined in a base interface or class";
+ msg += "' is already defined as ";
+ string vowels = "aeiou";
+ msg += find(vowels.begin(), vowels.end(), *((*p)->kindOf().begin())) != vowels.end() ? "an " : "a ";
+ msg += (*p)->kindOf() + " in a base interface or class";
_unit->error(msg);
return 0;
}
+ string baseName = (*p)->name();
+ to_lower(baseName);
+ string newName = name;
+ to_lower(newName);
+ if(baseName == newName)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from " + (*p)->kindOf();
+ msg += " `" + (*p)->name() + "', which is defined in a base interface or class";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
}
}
@@ -1592,54 +1666,78 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
{
return p;
}
-
- string msg = "redefinition of data member `";
- msg += name;
- msg += "'";
- _unit->error(msg);
- return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as data member";
- _unit->error(msg);
- return 0;
- }
-
- if(name == this->name())
- {
string msg;
- if(isInterface())
+ if(matches.front()->name() != name)
{
- msg = "interface name `";
+ msg = "data member `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
}
else
{
- msg = "class name `";
+ msg = "redefinition of " + matches.front()->kindOf() + " `" + matches.front()->name();
+ msg += "' as data member `" + name + "'";
+ _unit->error(msg);
+ return 0;
}
+ }
+
+ //
+ // Check whether enclosing class has the same name
+ //
+ if(name == this->name())
+ {
+ string msg = "class name `";
msg += name;
- msg += "' cannot be used as data member";
+ msg += "' cannot be used as data member name";
_unit->error(msg);
return 0;
}
+ string newName = name;
+ to_lower(newName);
+ string thisName = this->name();
+ to_lower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from enclosing class name `";
+ msg += this->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
//
- //
- // Check whether any bases have defined this data member already
+ // Check whether any bases have defined something with the same name already
//
for(ClassList::const_iterator p = _bases.begin(); p != _bases.end(); ++p)
{
+ ContainedList cl;
+ OperationList ol = (*p)->allOperations();
+ copy(ol.begin(), ol.end(), back_inserter(cl));
DataMemberList dml = (*p)->allDataMembers();
- for(DataMemberList::const_iterator p = dml.begin(); p != dml.end(); ++p)
+ copy(dml.begin(), dml.end(), back_inserter(cl));
+ // TODO: once we have constants, append constants to this list for checking
+ for(ContainedList::const_iterator p = cl.begin(); p != cl.end(); ++p)
{
if((*p)->name() == name)
{
string msg = "data member `" + name;
- msg += "' is already defined in a base interface or class";
+ msg += "' is already defined as ";
+ string vowels = "aeiou";
+ msg += find(vowels.begin(), vowels.end(), *((*p)->kindOf().begin())) != vowels.end() ? "an " : "a ";
+ msg += (*p)->kindOf() + " in a base interface or class";
_unit->error(msg);
return 0;
}
+ string baseName = (*p)->name();
+ to_lower(baseName);
+ string newName = name;
+ to_lower(newName);
+ if(baseName == newName)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from " + (*p)->kindOf();
+ msg += " `" + (*p)->name() + "', which is defined in a base interface or class";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
}
}
@@ -1650,19 +1748,19 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
}
ClassDeclPtr
-Slice::ClassDef::declaration()
+Slice::ClassDef::declaration() const
{
return _declaration;
}
ClassList
-Slice::ClassDef::bases()
+Slice::ClassDef::bases() const
{
return _bases;
}
ClassList
-Slice::ClassDef::allBases()
+Slice::ClassDef::allBases() const
{
ClassList result = _bases;
result.sort();
@@ -1677,7 +1775,7 @@ Slice::ClassDef::allBases()
}
OperationList
-Slice::ClassDef::operations()
+Slice::ClassDef::operations() const
{
OperationList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1692,7 +1790,7 @@ Slice::ClassDef::operations()
}
OperationList
-Slice::ClassDef::allOperations()
+Slice::ClassDef::allOperations() const
{
OperationList result = operations();
result.sort();
@@ -1707,7 +1805,7 @@ Slice::ClassDef::allOperations()
}
DataMemberList
-Slice::ClassDef::dataMembers()
+Slice::ClassDef::dataMembers() const
{
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1722,7 +1820,7 @@ Slice::ClassDef::dataMembers()
}
DataMemberList
-Slice::ClassDef::allDataMembers()
+Slice::ClassDef::allDataMembers() const
{
DataMemberList result = dataMembers();
result.sort();
@@ -1767,31 +1865,41 @@ Slice::ClassDef::isInterface()
}
bool
-Slice::ClassDef::isLocal()
+Slice::ClassDef::isLocal() const
{
return _local;
}
bool
-Slice::ClassDef::hasDataMembers()
+Slice::ClassDef::hasDataMembers() const
{
return _hasDataMembers;
}
Contained::ContainedType
-Slice::ClassDef::containedType()
+Slice::ClassDef::containedType() const
{
return ContainedTypeClass;
}
bool
-Slice::ClassDef::uses(const ContainedPtr&)
+Slice::ClassDef::uses(const ContainedPtr&) const
{
// No uses() implementation here. DataMember and Operation have
// their own uses().
return false;
}
+std::string
+Slice::ClassDef::kindOf() const
+{
+ string s;
+ if(isLocal())
+ s += "local ";
+ s += "isInterface()" ? "interface" : "class";
+ return s;
+}
+
void
Slice::ClassDef::visit(ParserVisitor* visitor)
{
@@ -1870,29 +1978,73 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
{
return p;
}
-
- string msg = "redefinition of data member `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if(matches.front()->name() != name)
+ {
+ msg = "exception member `" + name + "' differs only in capitalization from ";
+ msg += "exception member `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+ else
+ {
+ msg = "redefinition of exception member `" + name + "'";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as data member";
- _unit->error(msg);
- return 0;
}
+ //
+ // Check whether enclosing exception has the same name
+ //
if(name == this->name())
{
string msg = "exception name `";
msg += name;
- msg += "' cannot be used as data member";
+ msg += "' cannot be used as exception member name";
_unit->error(msg);
return 0;
}
+ string newName = name;
+ to_lower(newName);
+ string thisName = this->name();
+ to_lower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization from enclosing exception name `";
+ msg += this->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+
+ //
+ // Check whether any bases have defined a member with the same name already
+ //
+ ExceptionList bl = allBases();
+ for(ExceptionList::const_iterator p = bl.begin(); p != bl.end(); ++p)
+ {
+ ContainedList cl;
+ DataMemberList dml = (*p)->dataMembers();
+ copy(dml.begin(), dml.end(), back_inserter(cl));
+ for(ContainedList::const_iterator p = cl.begin(); p != cl.end(); ++p)
+ {
+ if((*p)->name() == name)
+ {
+ string msg = "exception member `" + name + "' is already defined in a base exception";
+ _unit->error(msg);
+ return 0;
+ }
+ string baseName = (*p)->name();
+ to_lower(baseName);
+ string newName = name;
+ to_lower(newName);
+ if(baseName == newName)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization from exception member `";
+ msg += (*p)->name() + "', which is defined in a base exception";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+ }
+ }
DataMemberPtr p = new DataMember(this, name, type);
_contents.push_back(p);
@@ -1900,7 +2052,7 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
}
DataMemberList
-Slice::Exception::dataMembers()
+Slice::Exception::dataMembers() const
{
DataMemberList result;
for(ContainedList::const_iterator p = _contents.begin(); p != _contents.end(); ++p)
@@ -1915,13 +2067,13 @@ Slice::Exception::dataMembers()
}
ExceptionPtr
-Slice::Exception::base()
+Slice::Exception::base() const
{
return _base;
}
ExceptionList
-Slice::Exception::allBases()
+Slice::Exception::allBases() const
{
ExceptionList result;
if(_base)
@@ -1933,24 +2085,30 @@ Slice::Exception::allBases()
}
bool
-Slice::Exception::isLocal()
+Slice::Exception::isLocal() const
{
return _local;
}
Contained::ContainedType
-Slice::Exception::containedType()
+Slice::Exception::containedType() const
{
return ContainedTypeException;
}
bool
-Slice::Exception::uses(const ContainedPtr&)
+Slice::Exception::uses(const ContainedPtr&) const
{
// No uses() implementation here. DataMember has its own uses().
return false;
}
+std::string
+Slice::Exception::kindOf() const
+{
+ return "exception";
+}
+
void
Slice::Exception::visit(ParserVisitor* visitor)
{
@@ -1992,29 +2150,43 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
{
return p;
}
-
- string msg = "redefinition of data member `";
- msg += name;
- msg += "'";
+ }
+ string msg;
+ if(matches.front()->name() != name)
+ {
+ msg = "member `" + name + "' differs only in capitalization from ";
+ msg += "member `" + matches.front()->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+ else
+ {
+ msg = "redefinition of struct member `" + name + "'";
_unit->error(msg);
return 0;
}
-
- string msg = "redefinition of `";
- msg += name;
- msg += "' as data member";
- _unit->error(msg);
- return 0;
}
+ //
+ // Check whether enclosing struct has the same name
+ //
if(name == this->name())
{
string msg = "struct name `";
msg += name;
- msg += "' cannot be used as data member";
+ msg += "' cannot be used as member name";
_unit->error(msg);
return 0;
}
+ string newName = name;
+ to_lower(newName);
+ string thisName = this->name();
+ to_lower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "struct member `" + name + "' differs only in capitalization from enclosing struct name `";
+ msg += this->name() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
if(type.get() == this)
{
@@ -2046,17 +2218,23 @@ Slice::Struct::dataMembers()
}
Contained::ContainedType
-Slice::Struct::containedType()
+Slice::Struct::containedType() const
{
return ContainedTypeStruct;
}
bool
-Slice::Struct::uses(const ContainedPtr&)
+Slice::Struct::uses(const ContainedPtr&) const
{
return false;
}
+std::string
+Slice::Struct::kindOf() const
+{
+ return "struct";
+}
+
void
Slice::Struct::visit(ParserVisitor* visitor)
{
@@ -2098,13 +2276,13 @@ Slice::Sequence::type()
}
Contained::ContainedType
-Slice::Sequence::containedType()
+Slice::Sequence::containedType() const
{
return ContainedTypeSequence;
}
bool
-Slice::Sequence::uses(const ContainedPtr& contained)
+Slice::Sequence::uses(const ContainedPtr& contained) const
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
if(contained2 && contained2 == contained)
@@ -2115,6 +2293,12 @@ Slice::Sequence::uses(const ContainedPtr& contained)
return false;
}
+std::string
+Slice::Sequence::kindOf() const
+{
+ return "sequence";
+}
+
void
Slice::Sequence::visit(ParserVisitor* visitor)
{
@@ -2158,13 +2342,13 @@ Slice::Dictionary::valueType()
}
Contained::ContainedType
-Slice::Dictionary::containedType()
+Slice::Dictionary::containedType() const
{
return ContainedTypeDictionary;
}
bool
-Slice::Dictionary::uses(const ContainedPtr& contained)
+Slice::Dictionary::uses(const ContainedPtr& contained) const
{
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_keyType);
@@ -2185,6 +2369,12 @@ Slice::Dictionary::uses(const ContainedPtr& contained)
return false;
}
+std::string
+Slice::Dictionary::kindOf() const
+{
+ return "dictionary";
+}
+
void
Slice::Dictionary::visit(ParserVisitor* visitor)
{
@@ -2241,17 +2431,23 @@ Slice::Enum::setEnumerators(const EnumeratorList& ens)
}
Contained::ContainedType
-Slice::Enum::containedType()
+Slice::Enum::containedType() const
{
return ContainedTypeEnum;
}
bool
-Slice::Enum::uses(const ContainedPtr&)
+Slice::Enum::uses(const ContainedPtr&) const
{
return false;
}
+std::string
+Slice::Enum::kindOf() const
+{
+ return "enumeration";
+}
+
void
Slice::Enum::visit(ParserVisitor* visitor)
{
@@ -2277,17 +2473,23 @@ Slice::Enum::Enum(const ContainerPtr& container, const string& name, bool local)
// ----------------------------------------------------------------------
Contained::ContainedType
-Slice::Enumerator::containedType()
+Slice::Enumerator::containedType() const
{
return ContainedTypeEnumerator;
}
bool
-Slice::Enumerator::uses(const ContainedPtr&)
+Slice::Enumerator::uses(const ContainedPtr&) const
{
return false;
}
+std::string
+Slice::Enumerator::kindOf() const
+{
+ return "enumerator";
+}
+
Slice::Enumerator::Enumerator(const ContainerPtr& container, const string& name) :
Contained(container, name),
SyntaxTreeBase(container->unit())
@@ -2299,37 +2501,37 @@ Slice::Enumerator::Enumerator(const ContainerPtr& container, const string& name)
// ----------------------------------------------------------------------
TypePtr
-Slice::Operation::returnType()
+Slice::Operation::returnType() const
{
return _returnType;
}
TypeStringList
-Slice::Operation::inputParameters()
+Slice::Operation::inputParameters() const
{
return _inParams;
}
TypeStringList
-Slice::Operation::outputParameters()
+Slice::Operation::outputParameters() const
{
return _outParams;
}
ExceptionList
-Slice::Operation::throws()
+Slice::Operation::throws() const
{
return _throws;
}
Contained::ContainedType
-Slice::Operation::containedType()
+Slice::Operation::containedType() const
{
return ContainedTypeOperation;
}
bool
-Slice::Operation::uses(const ContainedPtr& contained)
+Slice::Operation::uses(const ContainedPtr& contained) const
{
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_returnType);
@@ -2373,6 +2575,12 @@ Slice::Operation::uses(const ContainedPtr& contained)
return false;
}
+std::string
+Slice::Operation::kindOf() const
+{
+ return "operation";
+}
+
void
Slice::Operation::visit(ParserVisitor* visitor)
{
@@ -2402,13 +2610,13 @@ Slice::DataMember::type()
}
Contained::ContainedType
-Slice::DataMember::containedType()
+Slice::DataMember::containedType() const
{
return ContainedTypeDataMember;
}
bool
-Slice::DataMember::uses(const ContainedPtr& contained)
+Slice::DataMember::uses(const ContainedPtr& contained) const
{
ContainedPtr contained2 = ContainedPtr::dynamicCast(_type);
if(contained2 && contained2 == contained)
@@ -2419,6 +2627,12 @@ Slice::DataMember::uses(const ContainedPtr& contained)
return false;
}
+std::string
+Slice::DataMember::kindOf() const
+{
+ return "data member";
+}
+
void
Slice::DataMember::visit(ParserVisitor* visitor)
{
@@ -2443,7 +2657,7 @@ Slice::Unit::createUnit(bool ignRedefs, bool all)
}
bool
-Slice::Unit::ignRedefs()
+Slice::Unit::ignRedefs() const
{
return _ignRedefs;
}
@@ -2494,11 +2708,17 @@ Slice::Unit::currentComment()
}
string
-Slice::Unit::currentFile()
+Slice::Unit::currentFile() const
{
return _currentFile;
}
+int
+Slice::Unit::currentLine() const
+{
+ return _currentLine;
+}
+
void
Slice::Unit::nextLine()
{
@@ -2579,7 +2799,7 @@ Slice::Unit::scanPosition(const char* s)
}
int
-Slice::Unit::currentIncludeLevel()
+Slice::Unit::currentIncludeLevel() const
{
if(_all)
{
@@ -2617,7 +2837,7 @@ Slice::Unit::warning(const string& s)
}
ContainerPtr
-Slice::Unit::currentContainer()
+Slice::Unit::currentContainer() const
{
assert(!_containerStack.empty());
return _containerStack.top();
@@ -2639,14 +2859,17 @@ Slice::Unit::popContainer()
void
Slice::Unit::addContent(const ContainedPtr& contained)
{
- _contentMap[contained->scoped()].push_back(contained);
+ string scopedLowerCase = contained->scoped();
+ to_lower(scopedLowerCase);
+ _contentMap[scopedLowerCase].push_back(contained);
}
void
Slice::Unit::removeContent(const ContainedPtr& contained)
{
- string scoped = contained->scoped();
- map<string, ContainedList>::iterator p = _contentMap.find(scoped);
+ string scopedLowerCase = contained->scoped();
+ to_lower(scopedLowerCase);
+ map<string, ContainedList>::iterator p = _contentMap.find(scopedLowerCase);
assert(p != _contentMap.end());
ContainedList::iterator q;
for(q = p->second.begin(); q != p->second.end(); ++q)
@@ -2661,13 +2884,15 @@ Slice::Unit::removeContent(const ContainedPtr& contained)
}
ContainedList
-Slice::Unit::findContents(const string& scoped)
+Slice::Unit::findContents(const string& scoped) const
{
assert(!scoped.empty());
assert(scoped[0] == ':');
- map<string, ContainedList>::const_iterator p = _contentMap.find(scoped);
+ string scopedLowerCase = scoped;
+ to_lower(scopedLowerCase);
+ map<string, ContainedList>::const_iterator p = _contentMap.find(scopedLowerCase);
if(p != _contentMap.end())
{
return p->second;
@@ -2679,7 +2904,7 @@ Slice::Unit::findContents(const string& scoped)
}
ClassList
-Slice::Unit::findDerivedClasses(const ClassDefPtr& cl)
+Slice::Unit::findDerivedClasses(const ClassDefPtr& cl) const
{
ClassList derived;
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
@@ -2703,7 +2928,7 @@ Slice::Unit::findDerivedClasses(const ClassDefPtr& cl)
}
ExceptionList
-Slice::Unit::findDerivedExceptions(const ExceptionPtr& ex)
+Slice::Unit::findDerivedExceptions(const ExceptionPtr& ex) const
{
ExceptionList derived;
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
@@ -2727,7 +2952,7 @@ Slice::Unit::findDerivedExceptions(const ExceptionPtr& ex)
}
ContainedList
-Slice::Unit::findUsedBy(const ContainedPtr& contained)
+Slice::Unit::findUsedBy(const ContainedPtr& contained) const
{
ContainedList usedBy;
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
@@ -2746,7 +2971,7 @@ Slice::Unit::findUsedBy(const ContainedPtr& contained)
}
bool
-Slice::Unit::usesProxies()
+Slice::Unit::usesProxies() const
{
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
@@ -2769,7 +2994,7 @@ Slice::Unit::usesProxies()
}
bool
-Slice::Unit::usesNonLocals()
+Slice::Unit::usesNonLocals() const
{
for(map<string, ContainedList>::const_iterator p = _contentMap.begin(); p != _contentMap.end(); ++p)
{
@@ -2803,7 +3028,7 @@ Slice::Unit::usesNonLocals()
}
StringList
-Slice::Unit::includeFiles()
+Slice::Unit::includeFiles() const
{
return _includeFiles;
}
diff --git a/cpp/test/Slice/errorDetection/CaseInsensitive.err b/cpp/test/Slice/errorDetection/CaseInsensitive.err
new file mode 100644
index 00000000000..aaa588a0d88
--- /dev/null
+++ b/cpp/test/Slice/errorDetection/CaseInsensitive.err
@@ -0,0 +1,50 @@
+CaseInsensitive.ice:13: redefinition of operation `op' as operation `op'
+CaseInsensitive.ice:18: warning: operation `oP' differs only in capitalization from operation `op'
+CaseInsensitive.ice:18: redefinition of operation `op' as operation `oP'
+CaseInsensitive.ice:23: redefinition of data member `l' as operation `l'
+CaseInsensitive.ice:28: warning: operation `L' differs only in capitalization from data member `l'
+CaseInsensitive.ice:28: redefinition of data member `l' as operation `L'
+CaseInsensitive.ice:33: warning: module `M1' is capitalized inconsistently with its previous name: `m1'
+CaseInsensitive.ice:33: warning: module `M1' differs only in capitalization from module name `m1'
+CaseInsensitive.ice:33: warning: module `M1' is capitalized inconsistently with its previous name: `m1'
+CaseInsensitive.ice:33: warning: module `M1' differs only in capitalization from module name `m1'
+CaseInsensitive.ice:34: redefinition of interface `c1' as module
+CaseInsensitive.ice:35: warning: module `C1' differs only in capitalization from interface name `c1'
+CaseInsensitive.ice:35: warning: module `C1' differs only in capitalization from interface name `c1'
+CaseInsensitive.ice:38: duplicate parameter `aa'
+CaseInsensitive.ice:39: warning: parameter `bb' differs only in capitalization from parameter `BB'
+CaseInsensitive.ice:43: warning: operation `I4' differs only in capitalization from enclosing interface name `i4'
+CaseInsensitive.ice:47: interfacename `i5' cannot be used as operation name
+CaseInsensitive.ice:55: operation `op' is already defined as an operation in a base interface or class
+CaseInsensitive.ice:59: warning: operation `OP' differs only in capitalization from operation `op', which is defined in a base interface or class
+CaseInsensitive.ice:67: operation `l' is already defined as a data member in a base interface or class
+CaseInsensitive.ice:71: warning: operation `L' differs only in capitalization from data member `l', which is defined in a base interface or class
+CaseInsensitive.ice:76: warning: operation `L' differs only in capitalization from data member `l'
+CaseInsensitive.ice:76: redefinition of data member `l' as operation `L'
+CaseInsensitive.ice:80: data member `l' is already defined as a data member in a base interface or class
+CaseInsensitive.ice:84: warning: data member `L' differs only in capitalization from data member `l', which is defined in a base interface or class
+CaseInsensitive.ice:89: warning: data member `l' differs only in capitalization from operation `L'
+CaseInsensitive.ice:94: redefinition of exception member `l'
+CaseInsensitive.ice:99: warning: exception member `L' differs only in capitalization from exception member `l'
+CaseInsensitive.ice:103: exception name `e3' cannot be used as exception member name
+CaseInsensitive.ice:107: warning: exception member `E4' differs only in capitalization from enclosing exception name `e4'
+CaseInsensitive.ice:115: exception member `l' is already defined in a base exception
+CaseInsensitive.ice:119: warning: exception member `L' differs only in capitalization from exception member `l', which is defined in a base exception
+CaseInsensitive.ice:124: redefinition of struct member `l'
+CaseInsensitive.ice:129: warning: member `L' differs only in capitalization from member `l'
+CaseInsensitive.ice:133: struct name `s3' cannot be used as member name
+CaseInsensitive.ice:138: warning: struct member `S4' differs only in capitalization from enclosing struct name `s4'
+CaseInsensitive.ice:143: warning: sequence `LS' differs only in capitalization from sequence `ls'
+CaseInsensitive.ice:144: redefinition of module `m1' as sequence
+CaseInsensitive.ice:145: warning: sequence `M1' differs only in capitalization from module `m1'
+CaseInsensitive.ice:148: warning: dictionary `D' differs only in capitalization from dictionary `d'
+CaseInsensitive.ice:149: redefinition of module `m1' as dictionary
+CaseInsensitive.ice:150: warning: dictionary `M1' differs only in capitalization from module `m1'
+CaseInsensitive.ice:153: warning: enumeration `eN1' differs only in capitalization from enumeration `en1'
+CaseInsensitive.ice:153: redefinition of enumerator `red' as enumerator
+CaseInsensitive.ice:154: redefinition of module `m1' as enumeration
+CaseInsensitive.ice:155: warning: enumeration `M1' differs only in capitalization from module `m1'
+CaseInsensitive.ice:157: redefinition of enumeration `en1' as enumerator
+CaseInsensitive.ice:158: warning: enumerator `EN1' differs only in capitalization from enumeration `en1'
+CaseInsensitive.ice:159: redefinition of module `m1' as enumerator
+CaseInsensitive.ice:160: warning: enumerator `M1' differs only in capitalization from module `m1'
diff --git a/cpp/test/Slice/errorDetection/CaseInsensitive.ice b/cpp/test/Slice/errorDetection/CaseInsensitive.ice
new file mode 100644
index 00000000000..7a0a5069b9a
--- /dev/null
+++ b/cpp/test/Slice/errorDetection/CaseInsensitive.ice
@@ -0,0 +1,160 @@
+// **********************************************************************
+//
+// Copyright (c) 2001
+// MutableRealms, Inc.
+// Huntsville, AL, USA
+//
+// All Rights Reserved
+//
+// **********************************************************************
+
+interface i1 {
+ void op();
+ void op();
+};
+
+interface i2 {
+ void op();
+ void oP();
+};
+
+class c1 {
+ long l;
+ void l();
+};
+
+class c2 {
+ long l;
+ void L();
+};
+
+module m1 {};
+module m1 {};
+module M1 {};
+module c1 {};
+module C1 {};
+
+interface i3 {
+ void op(long aa, int aa);
+ void op2(long bb, out int BB);
+};
+
+interface i4 {
+ void I4();
+};
+
+interface i5 {
+ void i5();
+};
+
+interface i6 {
+ void op();
+};
+
+interface i7 extends i6 {
+ void op();
+};
+
+interface i8 extends i6 {
+ void OP();
+};
+
+class c3 {
+ long l;
+};
+
+class c4 extends c3 {
+ void l();
+};
+
+class c5 extends c3 {
+ void L();
+};
+
+class c6 {
+ long l;
+ void L();
+};
+
+class c7 extends c3 {
+ long l;
+};
+
+class c8 extends c3 {
+ long L;
+};
+
+class c9 {
+ void L();
+ long l;
+};
+
+exception e1 {
+ long l;
+ string l;
+};
+
+exception e2 {
+ long l;
+ string L;
+};
+
+exception e3 {
+ long e3;
+};
+
+exception e4 {
+ long E4;
+};
+
+exception e5 {
+ long l;
+};
+
+exception e6 extends e5 {
+ string l;
+};
+
+exception e7 extends e5 {
+ string L;
+};
+
+struct s1 {
+ long l;
+ string l;
+};
+
+struct s2 {
+ long l;
+ string L;
+};
+
+struct s3 {
+ long s3;
+ string x;
+};
+
+struct s4 {
+ long S4;
+ string x;
+};
+
+sequence<long> ls;
+sequence<long> LS;
+sequence<long> m1;
+sequence<long> M1;
+
+dictionary<long, string> d;
+dictionary<long, string> D;
+dictionary<long, string> m1;
+dictionary<long, string> M1;
+
+enum en1 { red };
+enum eN1 { red };
+enum m1 { green };
+enum M1 { blue };
+
+enum en2 { en1 };
+enum en3 { EN1 };
+enum en4 { m1 };
+enum en5 { M1 };
diff --git a/cpp/test/Slice/errorDetection/DataMemberRedefinition.err b/cpp/test/Slice/errorDetection/DataMemberRedefinition.err
index cf064bf5a10..c5124508493 100644
--- a/cpp/test/Slice/errorDetection/DataMemberRedefinition.err
+++ b/cpp/test/Slice/errorDetection/DataMemberRedefinition.err
@@ -1 +1 @@
-DataMemberRedefinition.ice:14: redefinition of data member `member'
+DataMemberRedefinition.ice:14: redefinition of data member `member' as data member `member'
diff --git a/cpp/test/Slice/errorDetection/DerivedRedefinition.err b/cpp/test/Slice/errorDetection/DerivedRedefinition.err
index 3e5ac161938..7d1ebbb7e61 100644
--- a/cpp/test/Slice/errorDetection/DerivedRedefinition.err
+++ b/cpp/test/Slice/errorDetection/DerivedRedefinition.err
@@ -1,6 +1,6 @@
-DerivedRedefinition.ice:17: operation `op' is already defined in a base interface or class
-DerivedRedefinition.ice:18: operation `op' is already defined in a base interface or class
-DerivedRedefinition.ice:31: operation `op' is already defined in a base interface or class
+DerivedRedefinition.ice:17: operation `op' is already defined as an operation in a base interface or class
+DerivedRedefinition.ice:18: operation `op' is already defined as an operation in a base interface or class
+DerivedRedefinition.ice:31: operation `op' is already defined as an operation in a base interface or class
DerivedRedefinition.ice:34: ambiguous multiple inheritance: `op' is defined in two or more base classes
-DerivedRedefinition.ice:39: data member `l' is already defined in a base interface or class
-DerivedRedefinition.ice:41: data member `l' is already defined in a base interface or class
+DerivedRedefinition.ice:39: data member `l' is already defined as a data member in a base interface or class
+DerivedRedefinition.ice:41: data member `l' is already defined as a data member in a base interface or class
diff --git a/cpp/test/Slice/errorDetection/DictionaryRedefinition.err b/cpp/test/Slice/errorDetection/DictionaryRedefinition.err
index b39dc9e34c9..4ad55495525 100644
--- a/cpp/test/Slice/errorDetection/DictionaryRedefinition.err
+++ b/cpp/test/Slice/errorDetection/DictionaryRedefinition.err
@@ -1 +1 @@
-DictionaryRedefinition.ice:12: redefinition of dictionary `Dictionary'
+DictionaryRedefinition.ice:12: redefinition of dictionary `Dictionary' as dictionary
diff --git a/cpp/test/Slice/errorDetection/EnumRedefinition.err b/cpp/test/Slice/errorDetection/EnumRedefinition.err
index 35c20451551..8c34dfac4e6 100644
--- a/cpp/test/Slice/errorDetection/EnumRedefinition.err
+++ b/cpp/test/Slice/errorDetection/EnumRedefinition.err
@@ -1 +1 @@
-EnumRedefinition.ice:12: redefinition of enum `Enum'
+EnumRedefinition.ice:12: redefinition of enumeration `Enum' as enumeration
diff --git a/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err b/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err
index 85bebe9ff05..30c8a829617 100644
--- a/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err
+++ b/cpp/test/Slice/errorDetection/EnumeratorRedefinition.err
@@ -1,2 +1,2 @@
-EnumeratorRedefinition.ice:12: redefinition of enumerator `A'
-EnumeratorRedefinition.ice:12: redefinition of enumerator `B'
+EnumeratorRedefinition.ice:12: redefinition of enumerator `A' as enumerator
+EnumeratorRedefinition.ice:12: redefinition of enumerator `B' as enumerator
diff --git a/cpp/test/Slice/errorDetection/IllegalMI.err b/cpp/test/Slice/errorDetection/IllegalMI.err
index 9757ff2c20e..1dc9b23f572 100644
--- a/cpp/test/Slice/errorDetection/IllegalMI.err
+++ b/cpp/test/Slice/errorDetection/IllegalMI.err
@@ -1,7 +1,7 @@
IllegalMI.ice:46: ambiguous multiple inheritance: `op' is defined in two or more base classes
-IllegalMI.ice:69: operation `op' is already defined in a base interface or class
-IllegalMI.ice:91: operation `op' is already defined in a base interface or class
-IllegalMI.ice:113: operation `op' is already defined in a base interface or class
+IllegalMI.ice:69: operation `op' is already defined as an operation in a base interface or class
+IllegalMI.ice:91: operation `op' is already defined as an operation in a base interface or class
+IllegalMI.ice:113: operation `op' is already defined as an operation in a base interface or class
IllegalMI.ice:154: ambiguous multiple inheritance: `op' is defined in two or more base classes
IllegalMI.ice:176: ambiguous multiple inheritance: `op' is defined in two or more base classes
IllegalMI.ice:198: ambiguous multiple inheritance: `op' is defined in two or more base classes
@@ -17,8 +17,8 @@ IllegalMI.ice:455: ambiguous multiple inheritance: `op' is defined in two or mor
IllegalMI.ice:482: ambiguous multiple inheritance: `op' is defined in two or more base classes
IllegalMI.ice:509: ambiguous multiple inheritance: `op' is defined in two or more base classes
IllegalMI.ice:537: ambiguous multiple inheritance: `op' is defined in two or more base classes
-IllegalMI.ice:604: operation `op' is already defined in a base interface or class
-IllegalMI.ice:638: operation `op' is already defined in a base interface or class
+IllegalMI.ice:604: operation `op' is already defined as an operation in a base interface or class
+IllegalMI.ice:638: operation `op' is already defined as an operation in a base interface or class
IllegalMI.ice:759: ambiguous multiple inheritance: `op' is defined in two or more base classes
IllegalMI.ice:820: ambiguous multiple inheritance: `op' is defined in two or more base classes
IllegalMI.ice:881: ambiguous multiple inheritance: `op' is defined in two or more base classes
diff --git a/cpp/test/Slice/errorDetection/NameCanNotBeUsed.err b/cpp/test/Slice/errorDetection/NameCanNotBeUsed.err
index 6216280e7bf..bdfc75a909b 100644
--- a/cpp/test/Slice/errorDetection/NameCanNotBeUsed.err
+++ b/cpp/test/Slice/errorDetection/NameCanNotBeUsed.err
@@ -1,6 +1,6 @@
-NameCanNotBeUsed.ice:13: class name `Foo' cannot be used as operation
-NameCanNotBeUsed.ice:19: interface name `IFoo' cannot be used as operation
-NameCanNotBeUsed.ice:24: class name `Bar' cannot be used as data member
-NameCanNotBeUsed.ice:30: exception name `EBar' cannot be used as data member
-NameCanNotBeUsed.ice:35: struct name `SBar' cannot be used as data member
+NameCanNotBeUsed.ice:13: classname `Foo' cannot be used as operation name
+NameCanNotBeUsed.ice:19: interfacename `IFoo' cannot be used as operation name
+NameCanNotBeUsed.ice:24: class name `Bar' cannot be used as data member name
+NameCanNotBeUsed.ice:30: exception name `EBar' cannot be used as exception member name
+NameCanNotBeUsed.ice:35: struct name `SBar' cannot be used as member name
NameCanNotBeUsed.ice:36: structs must have at least one member
diff --git a/cpp/test/Slice/errorDetection/OperationRedefinition.err b/cpp/test/Slice/errorDetection/OperationRedefinition.err
index 07111f1861e..240f23410d6 100644
--- a/cpp/test/Slice/errorDetection/OperationRedefinition.err
+++ b/cpp/test/Slice/errorDetection/OperationRedefinition.err
@@ -1 +1 @@
-OperationRedefinition.ice:14: redefinition of operation `operation'
+OperationRedefinition.ice:14: redefinition of operation `operation' as operation `operation'
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsClass.err b/cpp/test/Slice/errorDetection/RedefinitionAsClass.err
index 7db099191dc..dd46aca7d70 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsClass.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsClass.err
@@ -1,2 +1,2 @@
RedefinitionAsClass.ice:12: declaration of already defined `Sequence1' as class
-RedefinitionAsClass.ice:15: redefinition of `Sequence2' as class
+RedefinitionAsClass.ice:15: redefinition of sequence `Sequence2' as class
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err
index d62560b5a46..502fcc8e523 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsDataMember.err
@@ -1 +1 @@
-RedefinitionAsDataMember.ice:14: redefinition of `operation' as data member
+RedefinitionAsDataMember.ice:14: redefinition of operation `operation' as data member `operation'
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsDictionary.err b/cpp/test/Slice/errorDetection/RedefinitionAsDictionary.err
index 97576b0c140..3cb2a056483 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsDictionary.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsDictionary.err
@@ -1 +1 @@
-RedefinitionAsDictionary.ice:12: redefinition of `Class' as dictionary
+RedefinitionAsDictionary.ice:12: redefinition of interface `Class' as dictionary
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err b/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err
index 5fd5b46c14d..d99f9c6158d 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsEnum.err
@@ -1 +1 @@
-RedefinitionAsEnum.ice:12: redefinition of `Class' as enum
+RedefinitionAsEnum.ice:12: redefinition of interface `Class' as enumeration
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err b/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err
index e7c998c4c56..17bea89bb34 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsEnumerator.err
@@ -1,2 +1,2 @@
-RedefinitionAsEnumerator.ice:13: redefinition of `Class' as enumerator
-RedefinitionAsEnumerator.ice:13: redefinition of `Sequence' as enumerator
+RedefinitionAsEnumerator.ice:13: redefinition of interface `Class' as enumerator
+RedefinitionAsEnumerator.ice:13: redefinition of sequence `Sequence' as enumerator
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err b/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err
index 719e8703e0d..21139424809 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsInterface.err
@@ -1,2 +1,2 @@
RedefinitionAsInterface.ice:12: declaration of already defined `Sequence1' as interface
-RedefinitionAsInterface.ice:15: redefinition of `Sequence2' as interface
+RedefinitionAsInterface.ice:15: redefinition of sequence `Sequence2' as interface
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsModule.err b/cpp/test/Slice/errorDetection/RedefinitionAsModule.err
index bb7e6816ce4..289b360a1b8 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsModule.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsModule.err
@@ -1 +1 @@
-RedefinitionAsModule.ice:12: redefinition of `Sequence' as module
+RedefinitionAsModule.ice:12: redefinition of sequence `Sequence' as module
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err b/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err
index ab40ead2184..ec261129525 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsOperation.err
@@ -1 +1 @@
-RedefinitionAsOperation.ice:14: redefinition of `member' as operation
+RedefinitionAsOperation.ice:14: redefinition of data member `member' as operation `member'
diff --git a/cpp/test/Slice/errorDetection/RedefinitionAsSequence.err b/cpp/test/Slice/errorDetection/RedefinitionAsSequence.err
index 050f79286ea..92923205f84 100644
--- a/cpp/test/Slice/errorDetection/RedefinitionAsSequence.err
+++ b/cpp/test/Slice/errorDetection/RedefinitionAsSequence.err
@@ -1 +1 @@
-RedefinitionAsSequence.ice:12: redefinition of `Class' as sequence
+RedefinitionAsSequence.ice:12: redefinition of interface `Class' as sequence
diff --git a/cpp/test/Slice/errorDetection/SequenceRedefinition.err b/cpp/test/Slice/errorDetection/SequenceRedefinition.err
index 0b134378c73..d42d9c1c14b 100644
--- a/cpp/test/Slice/errorDetection/SequenceRedefinition.err
+++ b/cpp/test/Slice/errorDetection/SequenceRedefinition.err
@@ -1 +1 @@
-SequenceRedefinition.ice:12: redefinition of sequence `Sequence'
+SequenceRedefinition.ice:12: redefinition of sequence `Sequence' as sequence