diff --git a/bin/taox11_tests.lst b/bin/taox11_tests.lst index 8fa39564..d3795e51 100644 --- a/bin/taox11_tests.lst +++ b/bin/taox11_tests.lst @@ -82,6 +82,8 @@ tests/idl4/explicit_ints/run_test.pl: tests/idl4/explicit_ints/run_illegal_idl3_test.pl: tests/idl4/map/run_test.pl: tests/idl4/map/run_illegal_idl3_test.pl: +tests/idl4/struct_inheritance/run_test.pl: +tests/idl4/struct_inheritance/run_illegal_idl3_test.pl: tests/idl4/union/run_test.pl: tests/idl4/union/run_illegal_idl3_test.pl: tests/illegal_idl/run_test.pl: !CROSS diff --git a/ridlbe/c++11/templates/cli/inl/struct_inl.erb b/ridlbe/c++11/templates/cli/inl/struct_inl.erb index 3a088136..b8989896 100644 --- a/ridlbe/c++11/templates/cli/inl/struct_inl.erb +++ b/ridlbe/c++11/templates/cli/inl/struct_inl.erb @@ -26,7 +26,7 @@ inline <%= scoped_cxxtype %>::<%= cxxname %> ( } % end -inline void <%= scoped_cxxtype %>::swap (<%= scoped_cxx_out_type %> s) +inline void <%= scoped_cxxtype %>::swap (<%= scoped_cxx_out_type %><% if member_count > 0 %> s<% end %>) { % members.each do |_m| std::swap (this-><%= _m.cxxname %>_, s.<%= _m.cxxname %>_); diff --git a/ridlbe/c++11/templates/cli/src/struct_cdr.erb b/ridlbe/c++11/templates/cli/src/struct_cdr.erb index 1375740f..bcd98b85 100644 --- a/ridlbe/c++11/templates/cli/src/struct_cdr.erb +++ b/ridlbe/c++11/templates/cli/src/struct_cdr.erb @@ -1,8 +1,8 @@ // generated from <%= ridl_template_path %> TAO_CORBA::Boolean operator<< ( - TAO_OutputCDR &strm, - const <%= scoped_cxxname %> &_tao_aggregate) + TAO_OutputCDR &<% if member_count > 0 %>strm<% end %>, + const <%= scoped_cxxname %> &<% if member_count > 0 %>_tao_aggregate<% end %>) { % if member_count > 0 return @@ -16,8 +16,8 @@ TAO_CORBA::Boolean operator<< ( } TAO_CORBA::Boolean operator>> ( - TAO_InputCDR &strm, - <%= scoped_cxxname %> &_tao_aggregate) + TAO_InputCDR &<% if member_count > 0 %>strm<% end %>, + <%= scoped_cxxname %> &<% if member_count > 0 %>_tao_aggregate<% end %>) { % if member_count > 0 return diff --git a/tests/idl4/struct_inheritance/client.cpp b/tests/idl4/struct_inheritance/client.cpp new file mode 100644 index 00000000..b4078058 --- /dev/null +++ b/tests/idl4/struct_inheritance/client.cpp @@ -0,0 +1,22 @@ +/** + * @file client.cpp + * @author Johnny Willemsen + * + * @brief CORBA C++11 client application + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +#include "testC.h" + +int main (int /*argc*/, char* /*argv*/[]) +{ + // Just compilation test + EmptyStruct es; + X11_UNUSED_ARG(es); + Point2D p2d; + X11_UNUSED_ARG(p2d); + Point3D p3d; + X11_UNUSED_ARG(p3d); + return 0; +} diff --git a/tests/idl4/struct_inheritance/run_illegal_idl3_test.pl b/tests/idl4/struct_inheritance/run_illegal_idl3_test.pl new file mode 100755 index 00000000..4dfd3f02 --- /dev/null +++ b/tests/idl4/struct_inheritance/run_illegal_idl3_test.pl @@ -0,0 +1,69 @@ +#--------------------------------------------------------------------- +# @file run_illegal_idl3_test.pl +# @author Mark Drijver +# +# @copyright Copyright (c) Remedy IT Expertise BV +#--------------------------------------------------------------------- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +print "IDL test\n"; + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; +use File::Spec; + +my $status =0; +my $server = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; + +# The location of the ridl utility +my $ridl = "$ENV{X11_BASE_ROOT}/bin/ridlc"; + +unless (-e $ridl) { + die "ERROR: Cannot find " . $ridl; +} + +opendir(DIRH, ".") or die "Could not open dir. $!"; +@files = grep(/\.idl$/,readdir(DIRH)); +foreach (sort(@files)){ + print "Testing ", $_, ": "; + my $input_file = $_; + + #Redirect the screen output to the null device. + open (OLDOUT, ">&STDOUT"); +# open (STDOUT, ">" . File::Spec->devnull()); + open (STDOUT, ">" . output); + open (OLDERR, ">&STDERR"); + open (STDERR, ">&STDOUT"); + + # Compile the IDL + system ("$ridl", "$input_file"); + + #Redirect the null device output back to the screen + open (STDOUT, ">&OLDOUT"); + open (STDERR, ">&OLDERR"); + + $found = 0; + open FILE, ") + { + #print $line; + if ($line =~ "IDL::Parse") + { + $found = 1; + close FILE; + last; + } + } + #print "\nFound: " . $found; + if ($found>0) { + print "parsing failed as expected.\n"; + } else { + print STDERR "ERROR: Unable to detect expected ridlc error.\n"; + $status = 1; + } + +} + +exit $status; diff --git a/tests/idl4/struct_inheritance/run_test.pl b/tests/idl4/struct_inheritance/run_test.pl new file mode 100755 index 00000000..82d03efe --- /dev/null +++ b/tests/idl4/struct_inheritance/run_test.pl @@ -0,0 +1,31 @@ +#--------------------------------------------------------------------- +# @file run_test.pl +# @author Marcel Smit +# +# @copyright Copyright (c) Remedy IT Expertise BV +#--------------------------------------------------------------------- +eval '(exit $?0)' && eval 'exec perl -S $0 ${1+"$@"}' + & eval 'exec perl -S $0 $argv:q' + if 0; + +# -*- perl -*- + +use lib "$ENV{ACE_ROOT}/bin"; +use PerlACE::TestTarget; + +my $target = PerlACE::TestTarget::create_target(2) || die "Create target 2 failed\n"; + +$status = 0; + +$SV = $target->CreateProcess ("client"); + +$server = $SV->SpawnWaitKill ($target->ProcessStartWaitInterval()); + +if ($server != 0) { + print STDERR "ERROR: const returned $server\n"; + $status = 1; +} + +$target->GetStderrLog(); + +exit $status; diff --git a/tests/idl4/struct_inheritance/test.idl b/tests/idl4/struct_inheritance/test.idl new file mode 100644 index 00000000..e16bc9bb --- /dev/null +++ b/tests/idl4/struct_inheritance/test.idl @@ -0,0 +1,21 @@ +/** + * @file test.idl + * @author Johnny Willemsen + * + * @copyright Copyright (c) Remedy IT Expertise BV + */ + +struct Point2D +{ + long x; + long y; +}; + +struct Point3D : Point2D +{ + long z; +}; + +struct EmptyStruct +{ +}; diff --git a/tests/idl4/struct_inheritance/test.mpc b/tests/idl4/struct_inheritance/test.mpc new file mode 100644 index 00000000..1fd0631a --- /dev/null +++ b/tests/idl4/struct_inheritance/test.mpc @@ -0,0 +1,21 @@ +// -*- MPC -*- + +// No ostream ridl_ostream_defaults +project(*struct_inheritance_gen_idl): ridl_defaults { + IDL_Files { + test.idl + idlflags += --idl-version=4 + } + custom_only = 1 +} + +project(*struct_inheritance_client): taox11_client { + after += *struct_inheritance_gen_idl + Source_Files { + client.cpp + } + Source_Files { + testC.cpp + } +} +