summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Mesnier <mesnier_p@ociweb.com>2014-01-23 19:25:49 +0000
committerPhil Mesnier <mesnier_p@ociweb.com>2014-01-23 19:25:49 +0000
commita8dd667129f79918617dc6eb3098d68fac08520d (patch)
treed01349d3b5d2c4f3923b87038edbe493b9d928ab
parentcee89a7ac47fb0fa68c08b404080d48574d42b71 (diff)
downloadATCD-a8dd667129f79918617dc6eb3098d68fac08520d.tar.gz
Thu Jan 23 19:02:29 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
* TAO_IDL/be/be_visitor_argument/arglist.cpp: The initializer for forward defined valuetypes used as members of other values added a "const " to the type definition whereas the initializer for fully defined valuetypes did not. This syntax seems to have existed since support for object by value was first added to TAO. A bug in name scope resolution actually hid this bug, causing the compiler to treat forward defined valuetypes the same as regular valutypes and getting the proper code generated. When the scoping bug was fixed, forward defined valuetypes were distinguished and got the bad implementation. Thanks to Colin Shen <cshen AT manh DOT com> for reporting this age-old bug. * TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp: The marshalling code for forwarded valuetypes was similarly whacky and uncompilable. * tests/IDL_Test/fwd.idl: Add a regression test for the above. * tao/Valuetype/Valuetype.mpc: * tests/IDL_Test/IDL_Test.mpc: * tests/IDL_Test/string_value.idl: Generate StringValueA.* so that IDL code that includes StringValue.pidl will be able to compile. Also added a test for this case too. Thanks again to Colin Shen for reporting this bug.
-rw-r--r--TAO/ChangeLog28
-rw-r--r--TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp2
-rw-r--r--TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp4
-rw-r--r--TAO/tao/Valuetype/Valuetype.mpc6
-rw-r--r--TAO/tests/IDL_Test/IDL_Test.mpc3
-rw-r--r--TAO/tests/IDL_Test/fwd.idl24
-rw-r--r--TAO/tests/IDL_Test/string_value.idl36
7 files changed, 98 insertions, 5 deletions
diff --git a/TAO/ChangeLog b/TAO/ChangeLog
index 02c8036f621..0b68d1d7582 100644
--- a/TAO/ChangeLog
+++ b/TAO/ChangeLog
@@ -1,3 +1,31 @@
+Thu Jan 23 19:02:29 UTC 2014 Phil Mesnier <mesnier_p@ociweb.com>
+
+ * TAO_IDL/be/be_visitor_argument/arglist.cpp:
+ The initializer for forward defined valuetypes used as members of
+ other values added a "const " to the type definition whereas the
+ initializer for fully defined valuetypes did not. This syntax seems
+ to have existed since support for object by value was first added
+ to TAO. A bug in name scope resolution actually hid this bug,
+ causing the compiler to treat forward defined valuetypes the same as
+ regular valutypes and getting the proper code generated. When the
+ scoping bug was fixed, forward defined valuetypes were distinguished
+ and got the bad implementation. Thanks to Colin Shen <cshen AT manh
+ DOT com> for reporting this age-old bug.
+
+ * TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp:
+ The marshalling code for forwarded valuetypes was similarly
+ whacky and uncompilable.
+
+ * tests/IDL_Test/fwd.idl:
+ Add a regression test for the above.
+
+ * tao/Valuetype/Valuetype.mpc:
+ * tests/IDL_Test/IDL_Test.mpc:
+ * tests/IDL_Test/string_value.idl:
+ Generate StringValueA.* so that IDL code that includes
+ StringValue.pidl will be able to compile. Also added a test for
+ this case too. Thanks again to Colin Shen for reporting this bug.
+
Sat Jan 18 19:30:18 UTC 2014 Johnny Willemsen <jwillemsen@remedy.nl>
* TAO_IDL/be/be_visitor_operation/operation.cpp:
diff --git a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
index f579b6a4de7..8426d0b27f2 100644
--- a/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_argument/arglist.cpp
@@ -437,7 +437,7 @@ int be_visitor_args_arglist::visit_valuetype_fwd (be_valuetype_fwd *node)
switch (this->direction ())
{
case AST_Argument::dir_IN:
- *os << "const " << this->type_name (node) << " *";
+ *os << this->type_name (node) << " *";
break;
case AST_Argument::dir_INOUT:
*os << this->type_name (node) << " *&";
diff --git a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp
index 51df7b708a5..a0ca7c51c37 100644
--- a/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp
+++ b/TAO/TAO_IDL/be/be_visitor_valuetype/field_cdr_cs.cpp
@@ -408,11 +408,11 @@ be_visitor_valuetype_field_cdr_cs::visit_valuetype_fwd (be_valuetype_fwd *)
{
case TAO_CodeGen::TAO_CDR_INPUT:
*os << "(strm >> " << this->pre_ << f->local_name ()
- << this->post_ << ").out ()";
+ << this->post_ << ".out ())";
break;
case TAO_CodeGen::TAO_CDR_OUTPUT:
*os << "(strm << " << this->pre_ << f->local_name ()
- << this->post_ << ").in ()";
+ << this->post_ << ".in ())";
break;
case TAO_CodeGen::TAO_CDR_SCOPE:
// Nothing to be done because a valuetype cannot be declared inside a
diff --git a/TAO/tao/Valuetype/Valuetype.mpc b/TAO/tao/Valuetype/Valuetype.mpc
index e8414c2477e..a84d2524660 100644
--- a/TAO/tao/Valuetype/Valuetype.mpc
+++ b/TAO/tao/Valuetype/Valuetype.mpc
@@ -2,11 +2,11 @@
project(*idl) : tao_versioning_idl_defaults, gen_ostream, install {
custom_only = 1
IDL_Files {
- idlflags += -SS -Sorb \
+ idlflags += -SS -Sorb -GA \
-Wb,export_macro=TAO_Valuetype_Export \
-Wb,export_include=tao/Valuetype/valuetype_export.h \
-iC tao/Valuetype
- idlflags -= -St
+ idlflags -= -Sa -St
StringValue.pidl
}
@@ -22,11 +22,13 @@ project(Valuetype) : taolib, tao_output, install, anytypecode, avoids_corba_e_mi
Source_Files {
*.cpp
+ StringValueA.cpp
StringValueC.cpp
}
Header_Files {
*.h
+ StringValueA.h
StringValueC.h
StringValueS.h
}
diff --git a/TAO/tests/IDL_Test/IDL_Test.mpc b/TAO/tests/IDL_Test/IDL_Test.mpc
index d23f339a4e9..dc063f9f1e1 100644
--- a/TAO/tests/IDL_Test/IDL_Test.mpc
+++ b/TAO/tests/IDL_Test/IDL_Test.mpc
@@ -44,6 +44,7 @@ project(*IDL): taoserver, messaging, gen_ostream {
params.idl
reopened_modules.idl
struct.idl
+ string_value.idl
reopen_include1.idl
reopen_include2.idl
typeprefix.idl
@@ -208,6 +209,8 @@ project(*DLL): taoidldefaults, taolib, messaging {
simple2S.cpp
simpleC.cpp
simpleS.cpp
+ string_valueC.cpp
+ string_valueS.cpp
structC.cpp
structS.cpp
typecodeA.cpp
diff --git a/TAO/tests/IDL_Test/fwd.idl b/TAO/tests/IDL_Test/fwd.idl
index 888679f83e4..7bed3c823cf 100644
--- a/TAO/tests/IDL_Test/fwd.idl
+++ b/TAO/tests/IDL_Test/fwd.idl
@@ -80,3 +80,27 @@ module fwd_mixed_intf
interface mixed_conc_first : concrete_parent, abstract_parent {};
};
+// Tests a bug found when the scope traversal was fixed. Forwarded valuetypes
+// have some different syntax supplied when used as initialization arguments
+// or in marshaling. This generated code did not compile.
+module obv_fwd
+{
+ valuetype ForwardedType;
+};
+
+module obv_fwd
+{
+ valuetype EnclosingType
+ {
+ public ::obv_fwd::ForwardedType forwarded;
+ };
+};
+
+module obv_fwd
+{
+ valuetype ForwardedType
+ {
+ public long number;
+ };
+
+};
diff --git a/TAO/tests/IDL_Test/string_value.idl b/TAO/tests/IDL_Test/string_value.idl
new file mode 100644
index 00000000000..32d951d2f2d
--- /dev/null
+++ b/TAO/tests/IDL_Test/string_value.idl
@@ -0,0 +1,36 @@
+//=============================================================================
+
+/**
+ * @file string_value.idl
+ *
+ * $Id$
+ *
+ * This file contains depends on the TAO supplied StringValue type. Generated
+ * code based on such IDL failed to compile since the IDL compiler inserted a
+ * #include of a non-existent StringValueA.h.
+ *
+ * Note that the include must be relative to $TAO_ROOT. If included as
+ * "Valuetype/StringValue.pidl" The compiler assumes the generated A.h file
+ * is in the tao/AnyTypeCode directory. This cannot work because it sets up a
+ * circular dependency between libTAO_AnyTypeCode and libTAO_ValueType. It
+ * also requires an additional -I$TAO_ROOT/tao which is non traditional.
+ *
+ */
+
+//=============================================================================
+
+
+#ifndef IDL_TEST_STRING_VALUE_IDL
+#define IDL_TEST_STRING_VALUE_IDL
+
+#include "tao/Valuetype/StringValue.pidl"
+
+module include_test
+{
+ valuetype StringTest
+ {
+ public ::CORBA::StringValue my_string_value;
+ };
+};
+
+#endif /* IDL_TEST_STRING_VALUE_IDL */