summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/Parser.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2002-07-01 01:48:27 +0000
committerMichi Henning <michi@zeroc.com>2002-07-01 01:48:27 +0000
commit6a5566ac0c91503f37759c2c06fe3b2f86e4ea99 (patch)
tree7c49806d9e55ca00b0d9d2a034e270a1caf630e7 /cpp/src/Slice/Parser.cpp
parentLinux fix (diff)
downloadice-6a5566ac0c91503f37759c2c06fe3b2f86e4ea99.tar.bz2
ice-6a5566ac0c91503f37759c2c06fe3b2f86e4ea99.tar.xz
ice-6a5566ac0c91503f37759c2c06fe3b2f86e4ea99.zip
Added more case-insensitive checks for struct, exception, and class
definitions. Changed parser to write diagnostics to stdout instead of stderr.
Diffstat (limited to 'cpp/src/Slice/Parser.cpp')
-rw-r--r--cpp/src/Slice/Parser.cpp40
1 files changed, 37 insertions, 3 deletions
diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp
index d42a0b000b2..838a56c338e 100644
--- a/cpp/src/Slice/Parser.cpp
+++ b/cpp/src/Slice/Parser.cpp
@@ -731,6 +731,15 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
continue; // Ignore class definitions
}
+ if(printError && matches.front()->name() != sc)
+ {
+ string msg;
+ msg = "type name `" + sc;
+ msg += "' is capitalized inconsistently with its previous name: `";
+ msg += matches.front()->scoped() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+
ClassDeclPtr cl = ClassDeclPtr::dynamicCast(*p);
if(!cl)
{
@@ -760,6 +769,15 @@ Slice::Container::lookupTypeNoBuiltin(const string& scoped, bool printError)
continue; // Ignore class definitions
}
+ if(printError && matches.front()->name() != sc)
+ {
+ string msg;
+ msg = "type name `" + sc + "' is capitalized inconsistently with its previous name: `";
+ msg += matches.front()->scoped() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
+
+
ExceptionPtr ex = ExceptionPtr::dynamicCast(*p);
if(ex)
{
@@ -839,7 +857,16 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
if(!ClassDefPtr::dynamicCast(*p)) // Ignore class definitions
{
results.push_back(*p);
+
+ if(printError && (*p)->name() != sc)
+ {
+ string msg;
+ msg = "`" + sc + "' is capitalized inconsistently with its previous name: `";
+ msg += (*p)->scoped() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
}
+
}
if(results.empty())
@@ -867,7 +894,7 @@ Slice::Container::lookupContained(const string& scoped, bool printError)
ExceptionPtr
Slice::Container::lookupException(const string& scoped, bool printError)
{
- ContainedList contained = lookupContained(scoped, printError);
+ ContainedList contained = lookupContained(scoped, false);
if(contained.empty())
{
return 0;
@@ -888,6 +915,13 @@ Slice::Container::lookupException(const string& scoped, bool printError)
}
return 0;
}
+ if(printError && (*p)->name() != scoped)
+ {
+ string msg;
+ msg = "exception name `" + scoped + "' is capitalized inconsistently with its previous name: `";
+ msg += (*p)->scoped() + "'";
+ _unit->warning(msg); // TODO: change to error in stable_39
+ }
exceptions.push_back(ex);
}
assert(exceptions.size() == 1);
@@ -2819,7 +2853,7 @@ Slice::Unit::currentIncludeLevel() const
void
Slice::Unit::error(const char* s)
{
- cerr << _currentFile << ':' << _currentLine << ": " << s << endl;
+ cout << _currentFile << ':' << _currentLine << ": " << s << endl;
_errors++;
}
@@ -2832,7 +2866,7 @@ Slice::Unit::error(const string& s)
void
Slice::Unit::warning(const char* s) const
{
- cerr << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
+ cout << _currentFile << ':' << _currentLine << ": warning: " << s << endl;
}
void