summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2002-09-17 05:06:11 +0000
committerMichi Henning <michi@zeroc.com>2002-09-17 05:06:11 +0000
commitd81ab8b62645973c7dd3868267eac0bb3b10b579 (patch)
tree00a3dbb9dd39c4e7dcc482136643c82d071a3d0f /cpp
parentModified AddUserToAllowCategories usage. (diff)
downloadice-d81ab8b62645973c7dd3868267eac0bb3b10b579.tar.bz2
ice-d81ab8b62645973c7dd3868267eac0bb3b10b579.tar.xz
ice-d81ab8b62645973c7dd3868267eac0bb3b10b579.zip
Added --case-sensitive option.
Diffstat (limited to 'cpp')
-rw-r--r--cpp/include/Slice/Parser.h6
-rw-r--r--cpp/src/Slice/Parser.cpp293
-rw-r--r--cpp/src/slice2cpp/Main.cpp13
-rw-r--r--cpp/src/slice2docbook/Main.cpp13
-rw-r--r--cpp/src/slice2freeze/Main.cpp13
-rw-r--r--cpp/src/slice2freezej/Main.cpp13
-rw-r--r--cpp/src/slice2java/Main.cpp13
-rw-r--r--cpp/src/slice2wsdl/Main.cpp13
-rw-r--r--cpp/src/slice2xsd/Main.cpp13
-rw-r--r--cpp/test/Slice/errorDetection/CaseSensitive.err3
-rw-r--r--cpp/test/Slice/errorDetection/CaseSensitive.ice136
-rwxr-xr-xcpp/test/Slice/errorDetection/run.py5
12 files changed, 408 insertions, 126 deletions
diff --git a/cpp/include/Slice/Parser.h b/cpp/include/Slice/Parser.h
index d40861eea0c..02b52540e45 100644
--- a/cpp/include/Slice/Parser.h
+++ b/cpp/include/Slice/Parser.h
@@ -796,11 +796,12 @@ class SLICE_API Unit : virtual public Container
{
public:
- static UnitPtr createUnit(bool, bool, bool);
+ static UnitPtr createUnit(bool, bool, bool, bool);
bool ignRedefs() const;
bool allowIcePrefix() const;
+ bool caseSensitive() const;
void setComment(const std::string&);
std::string currentComment(); // Not const, as this function removes the current comment.
@@ -843,11 +844,12 @@ public:
private:
- Unit(bool, bool, bool);
+ Unit(bool, bool, bool, bool);
bool _ignRedefs;
bool _all;
bool _allowIcePrefix;
+ bool _caseSensitive;
int _errors;
std::string _currentComment;
int _currentLine;
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index 09994110aca..fc0f1218235 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -242,18 +242,18 @@ Slice::Container::createModule(const string& name)
ModulePtr module = ModulePtr::dynamicCast(*p);
if(module)
{
- if(!differsOnlyInCase)
+ if(_unit->caseSensitive())
{
- continue; // Reopening modules is permissible...
+ continue; // Reopening modules is permissible...
}
- else // ... but only if they are capitalized correctly
+ else if(differsOnlyInCase) // ... but only if they are capitalized correctly
{
msg += "module `" + name + "' is capitalized inconsistently with its previous name: `";
msg += module->name() + "'";
_unit->error(msg);
}
}
- else if(differsOnlyInCase)
+ else if(!_unit->caseSensitive() && differsOnlyInCase)
{
msg = "module `" + name + "' differs only in capitalization from ";
msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
@@ -309,7 +309,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
_unit->error(msg);
return 0;
}
- else
+ else if(!_unit->caseSensitive())
{
msg = intf ? "interface" : "class";
msg += " definition `" + name + "' is capitalized inconsistently with its previous name: `";
@@ -318,7 +318,7 @@ Slice::Container::createClassDef(const string& name, bool intf, const ClassList&
}
}
- if(differsOnlyInCase)
+ if(!_unit->caseSensitive() && differsOnlyInCase)
{
msg = intf ? "interface" : "class";
msg = " definition `" + name + "' differs only in capitalization from ";
@@ -394,7 +394,7 @@ Slice::Container::createClassDecl(const string& name, bool intf, bool local)
string msg;
bool differsOnlyInCase = matches.front()->name() != name;
- if(differsOnlyInCase)
+ if(!_unit->caseSensitive() && differsOnlyInCase)
{
msg = "class declaration `" + name + "' differs only in capitalization from ";
msg += matches.front()->kindOf() + " name `" + matches.front()->name() + "'";
@@ -466,9 +466,12 @@ Slice::Container::createException(const string& name, const ExceptionPtr& base,
_unit->error(msg);
return 0;
}
- msg = "exception `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ else if(!_unit->caseSensitive())
+ {
+ msg = "exception `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -509,9 +512,12 @@ Slice::Container::createStruct(const string& name, bool local)
_unit->error(msg);
return 0;
}
- msg = "struct `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ if(!_unit->caseSensitive())
+ {
+ msg = "struct `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
StructPtr p = new Struct(this, name, local);
@@ -543,9 +549,12 @@ Slice::Container::createSequence(const string& name, const TypePtr& type, bool l
_unit->error(msg);
return 0;
}
- msg = "sequence `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ if(!_unit->caseSensitive())
+ {
+ msg = "sequence `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -586,9 +595,12 @@ Slice::Container::createDictionary(const string& name, const TypePtr& keyType, c
_unit->error(msg);
return 0;
}
- msg = "dictionary `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ if(!_unit->caseSensitive())
+ {
+ msg = "dictionary `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
if(!Dictionary::legalKeyType(keyType))
@@ -640,9 +652,12 @@ Slice::Container::createEnum(const string& name, bool local)
_unit->error(msg);
return 0;
}
- msg = "enumeration `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ if(!_unit->caseSensitive())
+ {
+ msg = "enumeration `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
EnumPtr p = new Enum(this, name, local);
@@ -674,9 +689,12 @@ Slice::Container::createEnumerator(const string& name)
_unit->error(msg);
return 0;
}
- msg = "enumerator `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ if(!_unit->caseSensitive())
+ {
+ msg = "enumerator `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
EnumeratorPtr p = new Enumerator(this, name);
@@ -709,9 +727,12 @@ Slice::Container::createConstDef(const string name, const TypePtr& constType,
_unit->error(msg);
return 0;
}
- msg = "constant `" + name + "' differs only in capitalization from ";
- msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
- _unit->error(msg);
+ if(!_unit->caseSensitive())
+ {
+ msg = "constant `" + name + "' differs only in capitalization from ";
+ msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -811,7 +832,7 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
continue; // Ignore class definitions
}
- if(printError && matches.front()->scoped() != (thisScope() + sc))
+ if(printError && !_unit->caseSensitive() && matches.front()->scoped() != (thisScope() + sc))
{
string msg = (*p)->kindOf() + " name `" + scoped;
msg += "' is capitalized inconsistently with its previous name: `";
@@ -848,7 +869,7 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
continue; // Ignore class definitions
}
- if(printError && matches.front()->scoped() != (thisScope() + sc))
+ if(printError && !_unit->caseSensitive() && matches.front()->scoped() != (thisScope() + sc))
{
string msg = (*p)->kindOf() + " name `" + scoped;
msg += "' is capitalized inconsistently with its previous name: `";
@@ -937,7 +958,7 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
{
results.push_back(*p);
- if(printError && (*p)->scoped() != (thisScope() + sc))
+ if(printError && !_unit->caseSensitive() && (*p)->scoped() != (thisScope() + sc))
{
string msg = (*p)->kindOf() + " name `" + scoped;
msg += "' is capitalized inconsistently with its previous name: `" + (*p)->scoped() + "'";
@@ -1337,7 +1358,7 @@ Slice::Container::checkIntroduced(const string& scoped, ContainedPtr namedThing)
}
else
{
- if(it->second != namedThing)
+ if(!_unit->caseSensitive() && it->second != namedThing)
{
_unit->error("`" + scoped + "' has changed meaning");
return false;
@@ -1738,8 +1759,9 @@ Slice::ClassDecl::checkPairIntersections(const StringPartitionList& l, const str
unit->error(msg);
reported.insert(*s1);
}
- else if(!CICompare()(*s1, *s2) && !CICompare()(*s2, *s1) &&
- reported.find(*s1) == reported.end() && reported.find(*s2) == reported.end())
+ else if(!unit->caseSensitive() &&
+ !CICompare()(*s1, *s2) && !CICompare()(*s2, *s1) &&
+ reported.find(*s1) == reported.end() && reported.find(*s2) == reported.end())
{
string msg = "ambiguous multiple inheritance: `" + name;
msg += "' inherits operations `" + *s1 + "' and `" + *s2;
@@ -1786,7 +1808,7 @@ Slice::ClassDef::createOperation(const string& name,
}
}
string msg;
- if(matches.front()->name() != name)
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
{
msg = "operation `" + name + "' differs only in capitalization from ";
msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
@@ -1809,16 +1831,19 @@ Slice::ClassDef::createOperation(const string& name,
_unit->error(msg);
return 0;
}
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
+ if(!_unit->caseSensitive())
{
- string msg = "operation `" + name + "' differs only in capitalization from enclosing ";
- msg += isInterface() ? "interface" : "class";
- msg += " name `" + this->name() + "'";
- _unit->error(msg);
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from enclosing ";
+ msg += isInterface() ? "interface" : "class";
+ msg += " name `" + this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -1847,15 +1872,18 @@ Slice::ClassDef::createOperation(const string& name,
_unit->error(msg);
return 0;
}
- string baseName = (*q)->name();
- toLower(baseName);
- string newName = name;
- toLower(newName);
- if(baseName == newName)
+ if(!_unit->caseSensitive())
{
- string msg = "operation `" + name + "' differs only in capitalization from " + (*q)->kindOf();
- msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
- _unit->error(msg);
+ string baseName = (*q)->name();
+ toLower(baseName);
+ string newName = name;
+ toLower(newName);
+ if(baseName == newName)
+ {
+ string msg = "operation `" + name + "' differs only in capitalization from " + (*q)->kindOf();
+ msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
+ _unit->error(msg);
+ }
}
}
}
@@ -1893,7 +1921,7 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
}
}
string msg;
- if(matches.front()->name() != name)
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
{
msg = "data member `" + name + "' differs only in capitalization from ";
msg += matches.front()->kindOf() + " `" + matches.front()->name() + "'";
@@ -1919,15 +1947,18 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
_unit->error(msg);
return 0;
}
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
+ if(!_unit->caseSensitive())
{
- string msg = "data member `" + name + "' differs only in capitalization from enclosing class name `";
- msg += this->name() + "'";
- _unit->error(msg);
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from enclosing class name `";
+ msg += this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -1956,15 +1987,18 @@ Slice::ClassDef::createDataMember(const string& name, const TypePtr& type)
_unit->error(msg);
return 0;
}
- string baseName = (*q)->name();
- toLower(baseName);
- string newName = name;
- toLower(newName);
- if(baseName == newName)
+ if(!_unit->caseSensitive())
{
- string msg = "data member `" + name + "' differs only in capitalization from " + (*q)->kindOf();
- msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
- _unit->error(msg);
+ string baseName = (*q)->name();
+ toLower(baseName);
+ string newName = name;
+ toLower(newName);
+ if(baseName == newName)
+ {
+ string msg = "data member `" + name + "' differs only in capitalization from " + (*q)->kindOf();
+ msg += " `" + (*q)->name() + "', which is defined in a base interface or class";
+ _unit->error(msg);
+ }
}
}
}
@@ -2222,7 +2256,7 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
}
}
string msg;
- if(matches.front()->name() != name)
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
{
msg = "exception member `" + name + "' differs only in capitalization from ";
msg += "exception member `" + matches.front()->name() + "'";
@@ -2247,15 +2281,18 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
_unit->error(msg);
return 0;
}
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
+ if(!_unit->caseSensitive())
{
- string msg = "exception member `" + name + "' differs only in capitalization from enclosing exception name `";
- msg += this->name() + "'";
- _unit->error(msg);
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization ";
+ msg += "from enclosing exception name `" + this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -2275,15 +2312,18 @@ Slice::Exception::createDataMember(const string& name, const TypePtr& type)
_unit->error(msg);
return 0;
}
- string baseName = (*r)->name();
- toLower(baseName);
- string newName = name;
- toLower(newName);
- if(baseName == newName)
+ if(!_unit->caseSensitive())
{
- string msg = "exception member `" + name + "' differs only in capitalization from exception member `";
- msg += (*r)->name() + "', which is defined in a base exception";
- _unit->error(msg);
+ string baseName = (*r)->name();
+ toLower(baseName);
+ string newName = name;
+ toLower(newName);
+ if(baseName == newName)
+ {
+ string msg = "exception member `" + name + "' differs only in capitalization from exception member `";
+ msg += (*r)->name() + "', which is defined in a base exception";
+ _unit->error(msg);
+ }
}
}
}
@@ -2400,7 +2440,7 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
}
}
string msg;
- if(matches.front()->name() != name)
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
{
msg = "member `" + name + "' differs only in capitalization from ";
msg += "member `" + matches.front()->name() + "'";
@@ -2425,15 +2465,18 @@ Slice::Struct::createDataMember(const string& name, const TypePtr& type)
_unit->error(msg);
return 0;
}
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
+ if(!_unit->caseSensitive())
{
- string msg = "struct member `" + name + "' differs only in capitalization from enclosing struct name `";
- msg += this->name() + "'";
- _unit->error(msg);
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "struct member `" + name + "' differs only in capitalization from enclosing struct name `";
+ msg += this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -3070,7 +3113,7 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool
}
}
string msg;
- if(matches.front()->name() != name)
+ if(!_unit->caseSensitive() && matches.front()->name() != name)
{
msg = "parameter `" + name + "' differs only in capitalization from ";
msg += "parameter `" + matches.front()->name() + "'";
@@ -3095,15 +3138,18 @@ Slice::Operation::createParamDecl(const string& name, const TypePtr& type, bool
_unit->error(msg);
return 0;
}
- string newName = name;
- toLower(newName);
- string thisName = this->name();
- toLower(thisName);
- if(newName == thisName)
+ if(!_unit->caseSensitive())
{
- string msg = "parameter `" + name + "' differs only in capitalization from operation name `";
- msg += this->name() + "'";
- _unit->error(msg);
+ string newName = name;
+ toLower(newName);
+ string thisName = this->name();
+ toLower(thisName);
+ if(newName == thisName)
+ {
+ string msg = "parameter `" + name + "' differs only in capitalization from operation name `";
+ msg += this->name() + "'";
+ _unit->error(msg);
+ }
}
//
@@ -3380,9 +3426,9 @@ Slice::DataMember::DataMember(const ContainerPtr& container, const string& name,
// ----------------------------------------------------------------------
UnitPtr
-Slice::Unit::createUnit(bool ignRedefs, bool all, bool allowIcePrefix)
+Slice::Unit::createUnit(bool ignRedefs, bool all, bool allowIcePrefix, bool caseSensitive)
{
- return new Unit(ignRedefs, all, allowIcePrefix);
+ return new Unit(ignRedefs, all, allowIcePrefix, caseSensitive);
}
bool
@@ -3397,6 +3443,11 @@ Slice::Unit::allowIcePrefix() const
return _allowIcePrefix;
}
+bool
+Slice::Unit::caseSensitive() const
+{
+ return _caseSensitive;
+}
void
Slice::Unit::setComment(const string& comment)
{
@@ -3594,17 +3645,23 @@ Slice::Unit::popContainer()
void
Slice::Unit::addContent(const ContainedPtr& contained)
{
- string scopedLowerCase = contained->scoped();
- toLower(scopedLowerCase);
- _contentMap[scopedLowerCase].push_back(contained);
+ string scoped = contained->scoped();
+ if(!caseSensitive())
+ {
+ toLower(scoped);
+ }
+ _contentMap[scoped].push_back(contained);
}
void
Slice::Unit::removeContent(const ContainedPtr& contained)
{
- string scopedLowerCase = contained->scoped();
- toLower(scopedLowerCase);
- map<string, ContainedList>::iterator p = _contentMap.find(scopedLowerCase);
+ string scoped = contained->scoped();
+ if(!caseSensitive())
+ {
+ toLower(scoped);
+ }
+ map<string, ContainedList>::iterator p = _contentMap.find(scoped);
assert(p != _contentMap.end());
ContainedList::iterator q;
for(q = p->second.begin(); q != p->second.end(); ++q)
@@ -3624,10 +3681,13 @@ Slice::Unit::findContents(const string& scoped) const
assert(!scoped.empty());
assert(scoped[0] == ':');
- string scopedLowerCase = scoped;
- toLower(scopedLowerCase);
+ string name = scoped;
+ if(!_unit->caseSensitive())
+ {
+ toLower(name);
+ }
- map<string, ContainedList>::const_iterator p = _contentMap.find(scopedLowerCase);
+ map<string, ContainedList>::const_iterator p = _contentMap.find(name);
if(p != _contentMap.end())
{
return p->second;
@@ -3856,12 +3916,13 @@ Slice::Unit::builtin(Builtin::Kind kind)
return builtin;
}
-Slice::Unit::Unit(bool ignRedefs, bool all, bool allowIcePrefix) :
+Slice::Unit::Unit(bool ignRedefs, bool all, bool allowIcePrefix, bool caseSensitive) :
SyntaxTreeBase(0),
Container(0),
_ignRedefs(ignRedefs),
_all(all),
_allowIcePrefix(allowIcePrefix),
+ _caseSensitive(caseSensitive),
_errors(0)
{
_unit = this;
diff --git a/cpp/src/slice2cpp/Main.cpp b/cpp/src/slice2cpp/Main.cpp
index 17f6500b355..078b332c1b4 100644
--- a/cpp/src/slice2cpp/Main.cpp
+++ b/cpp/src/slice2cpp/Main.cpp
@@ -34,6 +34,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
int
@@ -47,6 +48,7 @@ main(int argc, char* argv[])
bool impl = false;
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
bool depend = false;
int idx = 1;
@@ -108,6 +110,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(strcmp(argv[idx], "--include-dir") == 0)
{
if(idx + 1 >= argc)
@@ -257,7 +268,7 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- UnitPtr unit = Unit::createUnit(false, false, ice);
+ UnitPtr unit = Unit::createUnit(false, false, ice, caseSensitive);
int parseStatus = unit->parse(cppHandle, debug);
#ifdef _WIN32
diff --git a/cpp/src/slice2docbook/Main.cpp b/cpp/src/slice2docbook/Main.cpp
index 4d8e2cd6112..02a5b822f41 100644
--- a/cpp/src/slice2docbook/Main.cpp
+++ b/cpp/src/slice2docbook/Main.cpp
@@ -34,6 +34,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
int
@@ -42,6 +43,7 @@ main(int argc, char* argv[])
string cpp("cpp -C");
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
bool standAlone = false;
bool noGlobals = false;
bool chapter = false;
@@ -126,6 +128,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(argv[idx][0] == '-')
{
cerr << argv[0] << ": unknown option `" << argv[idx] << "'" << endl;
@@ -166,7 +177,7 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- UnitPtr unit = Unit::createUnit(true, false, ice);
+ UnitPtr unit = Unit::createUnit(true, false, ice, caseSensitive);
int status = EXIT_SUCCESS;
diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp
index f22fcc97265..631583536d0 100644
--- a/cpp/src/slice2freeze/Main.cpp
+++ b/cpp/src/slice2freeze/Main.cpp
@@ -46,6 +46,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
bool
@@ -236,6 +237,7 @@ main(int argc, char* argv[])
string output;
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
vector<Dict> dicts;
int idx = 1;
@@ -355,6 +357,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(strcmp(argv[idx], "--include-dir") == 0)
{
if(idx + 1 >= argc)
@@ -448,7 +459,7 @@ main(int argc, char* argv[])
fileC = output + '/' + fileC;
}
- UnitPtr unit = Unit::createUnit(true, false, ice);
+ UnitPtr unit = Unit::createUnit(true, false, ice, caseSensitive);
StringList includes;
diff --git a/cpp/src/slice2freezej/Main.cpp b/cpp/src/slice2freezej/Main.cpp
index 58e391d0d9f..27745239763 100644
--- a/cpp/src/slice2freezej/Main.cpp
+++ b/cpp/src/slice2freezej/Main.cpp
@@ -424,6 +424,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
int
@@ -436,6 +437,7 @@ main(int argc, char* argv[])
string output;
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
vector<Dict> dicts;
int idx = 1;
@@ -555,6 +557,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(strcmp(argv[idx], "--include-dir") == 0)
{
if(idx + 1 >= argc)
@@ -615,7 +626,7 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- UnitPtr unit = Unit::createUnit(true, false, ice);
+ UnitPtr unit = Unit::createUnit(true, false, ice, caseSensitive);
StringList includes;
diff --git a/cpp/src/slice2java/Main.cpp b/cpp/src/slice2java/Main.cpp
index de54a37ec0c..fe45e1cc977 100644
--- a/cpp/src/slice2java/Main.cpp
+++ b/cpp/src/slice2java/Main.cpp
@@ -36,6 +36,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
int
@@ -51,6 +52,7 @@ main(int argc, char* argv[])
bool clone = false;
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
bool depend = false;
int idx = 1;
@@ -116,6 +118,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(strcmp(argv[idx], "--output-dir") == 0)
{
if(idx + 1 >= argc)
@@ -282,7 +293,7 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- UnitPtr unit = Unit::createUnit(false, false, ice);
+ UnitPtr unit = Unit::createUnit(false, false, ice, caseSensitive);
int parseStatus = unit->parse(cppHandle, debug);
#ifdef _WIN32
diff --git a/cpp/src/slice2wsdl/Main.cpp b/cpp/src/slice2wsdl/Main.cpp
index 132c429cb45..52674f358bc 100644
--- a/cpp/src/slice2wsdl/Main.cpp
+++ b/cpp/src/slice2wsdl/Main.cpp
@@ -29,6 +29,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
int
@@ -37,6 +38,7 @@ main(int argc, char* argv[])
string cpp("cpp -C");
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
string include;
string output;
vector<string> includePaths;
@@ -100,6 +102,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(strcmp(argv[idx], "--include-dir") == 0)
{
if(idx + 1 >= argc)
@@ -191,7 +202,7 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- UnitPtr unit = Unit::createUnit(false, false, ice);
+ UnitPtr unit = Unit::createUnit(false, false, ice, caseSensitive);
int parseStatus = unit->parse(cppHandle, debug);
#ifdef _WIN32
diff --git a/cpp/src/slice2xsd/Main.cpp b/cpp/src/slice2xsd/Main.cpp
index 82395018af4..faaadfb54ed 100644
--- a/cpp/src/slice2xsd/Main.cpp
+++ b/cpp/src/slice2xsd/Main.cpp
@@ -29,6 +29,7 @@ usage(const char* n)
"-d, --debug Print debug messages.\n"
"--ice Permit `Ice' prefix (for building Ice source code only)\n"
;
+ // Note: --case-sensitive is intentionally not shown here!
}
int
@@ -37,6 +38,7 @@ main(int argc, char* argv[])
string cpp("cpp -C");
bool debug = false;
bool ice = false;
+ bool caseSensitive = false;
string include;
string output;
vector<string> includePaths;
@@ -100,6 +102,15 @@ main(int argc, char* argv[])
}
--argc;
}
+ else if(strcmp(argv[idx], "--case-sensitive") == 0)
+ {
+ caseSensitive = true;
+ for(int i = idx ; i + 1 < argc ; ++i)
+ {
+ argv[i] = argv[i + 1];
+ }
+ --argc;
+ }
else if(strcmp(argv[idx], "--include-dir") == 0)
{
if(idx + 1 >= argc)
@@ -192,7 +203,7 @@ main(int argc, char* argv[])
return EXIT_FAILURE;
}
- UnitPtr unit = Unit::createUnit(false, false, ice);
+ UnitPtr unit = Unit::createUnit(false, false, ice, caseSensitive);
int parseStatus = unit->parse(cppHandle, debug);
#ifdef _WIN32
diff --git a/cpp/test/Slice/errorDetection/CaseSensitive.err b/cpp/test/Slice/errorDetection/CaseSensitive.err
new file mode 100644
index 00000000000..883a78999f8
--- /dev/null
+++ b/cpp/test/Slice/errorDetection/CaseSensitive.err
@@ -0,0 +1,3 @@
+CaseSensitive.ice:16: redefinition of struct `m2' as class
+CaseSensitive.ice:58: `I8' is not defined
+CaseSensitive.ice:64: `I10' is not defined
diff --git a/cpp/test/Slice/errorDetection/CaseSensitive.ice b/cpp/test/Slice/errorDetection/CaseSensitive.ice
new file mode 100644
index 00000000000..c729fdf88d4
--- /dev/null
+++ b/cpp/test/Slice/errorDetection/CaseSensitive.ice
@@ -0,0 +1,136 @@
+module M1
+{
+};
+module m1
+{
+};
+
+struct m2
+{
+ int i;
+};
+module M2
+{
+};
+class m2
+{
+};
+
+interface i1
+{
+};
+interface I1
+{
+};
+interface i1;
+
+exception e1
+{
+};
+exception E1
+{
+};
+
+interface i2;
+struct I2
+{
+ int i;
+};
+
+interface i3;
+sequence<int> I3;
+
+interface i4;
+dictionary<int, int> I4;
+
+interface i5;
+enum I5 { x };
+
+interface i6;
+enum e { I6 };
+
+interface i7;
+const long I7 = 1;
+
+interface i8;
+interface i9
+{
+ I8* op();
+};
+
+interface i10;
+interface i11
+{
+ I10 op();
+};
+
+interface b1
+{
+ void op();
+};
+interface b2
+{
+ void OP();
+};
+interface D extends b1, b2
+{
+};
+
+interface i12
+{
+ void op();
+ void OP();
+};
+
+interface i13
+{
+ void I13();
+};
+
+class c1
+{
+ int i;
+ int I;
+};
+
+class c2
+{
+ int C2;
+};
+
+class c3 extends c2
+{
+ int c2;
+};
+
+exception e2
+{
+ int i;
+ int I;
+};
+
+exception e3
+{
+ int E3;
+};
+
+struct s1
+{
+ int i;
+ int I;
+};
+
+struct s2
+{
+ int S2;
+};
+
+interface i14
+{
+ void op(int i, int I);
+};
+
+interface i15
+{
+ void op(int Op);
+};
diff --git a/cpp/test/Slice/errorDetection/run.py b/cpp/test/Slice/errorDetection/run.py
index b39f45237ba..1e279278c6a 100755
--- a/cpp/test/Slice/errorDetection/run.py
+++ b/cpp/test/Slice/errorDetection/run.py
@@ -32,7 +32,10 @@ for file in files:
print file + "...",
- command = slice2cpp + " -I. " + os.path.join(directory, file);
+ if file == "CaseSensitive.ice":
+ command = slice2cpp + " --case-sensitive -I. " + os.path.join(directory, file);
+ else:
+ command = slice2cpp + " -I. " + os.path.join(directory, file);
stdin, stdout, stderr = os.popen3(command)
lines1 = stdout.readlines()
lines2 = open(os.path.join(directory, regex1.sub(".err", file)), "r").readlines()