summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2013-07-19 17:28:11 +0200
committerJose <jose@zeroc.com>2013-07-19 17:28:11 +0200
commitb953f942a12fd452d8ed0c20599b32ee8ddcd457 (patch)
treead1ad18401f1fda99d405b4e75bd58e3b963d22b /cpp
parentExpand tabs in distribution/makedist.py & remove references to nonexistent fi... (diff)
downloadice-b953f942a12fd452d8ed0c20599b32ee8ddcd457.tar.bz2
ice-b953f942a12fd452d8ed0c20599b32ee8ddcd457.tar.xz
ice-b953f942a12fd452d8ed0c20599b32ee8ddcd457.zip
Fixed ICE-5313 - slice checksums to pay attention to the class compact ID
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Slice/Checksum.cpp14
-rw-r--r--cpp/test/Ice/checksum/Types.ice32
-rw-r--r--cpp/test/Ice/checksum/server/Types.ice32
3 files changed, 78 insertions, 0 deletions
diff --git a/cpp/src/Slice/Checksum.cpp b/cpp/src/Slice/Checksum.cpp
index e6f19cecd3c..94fa3bf3f6c 100644
--- a/cpp/src/Slice/Checksum.cpp
+++ b/cpp/src/Slice/Checksum.cpp
@@ -65,6 +65,12 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
{
ostr << "class ";
}
+
+ if(p->compactId() >= 0)
+ {
+ ostr << "(" << p->compactId() << ") ";
+ }
+
ostr << p->name();
if(!bases.empty())
@@ -72,6 +78,10 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
if(!bases.front()->isInterface())
{
ostr << " extends " << bases.front()->scoped();
+ if(bases.front()->compactId() >= 0)
+ {
+ ostr << "(" << bases.front()->compactId() << ") ";
+ }
bases.erase(bases.begin());
}
if(!bases.empty())
@@ -91,6 +101,10 @@ Slice::ChecksumVisitor::visitClassDefStart(const ClassDefPtr& p)
ostr << ", ";
}
ostr << (*q)->scoped();
+ if((*q)->compactId() >= 0)
+ {
+ ostr << "(" << (*q)->compactId() << ") ";
+ }
}
}
}
diff --git a/cpp/test/Ice/checksum/Types.ice b/cpp/test/Ice/checksum/Types.ice
index c7b665618e6..070f3800684 100644
--- a/cpp/test/Ice/checksum/Types.ice
+++ b/cpp/test/Ice/checksum/Types.ice
@@ -405,6 +405,38 @@ class BaseClass11
};
//
+// TEST: Class with compact id
+//
+class Compact1(1)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Derived from class with compact id
+//
+class Derived1 extends Compact1
+{
+};
+
+//
+// TEST: Same class names but different compact id
+//
+class Compact2(2)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Derived from class with compact, where parent ids doesn't match.
+//
+class Derived2 extends Compact2
+{
+};
+
+//
// TEST: Local
//
local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 };
diff --git a/cpp/test/Ice/checksum/server/Types.ice b/cpp/test/Ice/checksum/server/Types.ice
index a23ee94166b..9c08dd6a047 100644
--- a/cpp/test/Ice/checksum/server/Types.ice
+++ b/cpp/test/Ice/checksum/server/Types.ice
@@ -400,6 +400,38 @@ class BaseClass11 extends EmptyClass1 implements Interface1
};
//
+// TEST: Class with compact id
+//
+class Compact1(1)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Derived from class with compact id
+//
+class Derived1 extends Compact1
+{
+};
+
+//
+// TEST: Same class names but different compact id
+//
+class Compact2(3)
+{
+ void baseOp();
+ void baseOp2(int i, out string s) throws Exception1;
+};
+
+//
+// TEST: Derived from class with compact, where parent ids doesn't match.
+//
+class Derived2 extends Compact2
+{
+};
+
+//
// TEST: Local
//
local enum LocalEnum { LocalEnum1, LocalEnum2, LocalEnum3 };