[tao-bugs] [compiler] CORBA::Any insertion and extraction operators

Melton, Jim jim.melton at lmco.com
Mon Oct 30 19:25:45 CDT 2017


Thomas,

Try adding to your config
#define ACE_ANY_OPS_USE_NAMESPACE

And see if that helps
--
Jim Melton
Software Architect, Fusion Programs
Lockheed Martin RMS
(720) 922-5584


> -----Original Message-----
> From: tao-bugs [mailto:tao-bugs-bounces at list.isis.vanderbilt.edu] On Behalf
> Of Lockhart, Thomas G (398I)
> Sent: Monday, October 30, 2017 5:05 PM
> To: TAO Developers <tao-bugs at list.isis.vanderbilt.edu>
> Subject: EXTERNAL: [tao-bugs] [compiler] CORBA::Any insertion and
> extraction operators
> 
> (PRF is below)
> 
> Hi all. I’m upgrading software to new versions and am running into trouble
> with CORBA::Any insertion and extraction operators on g++ (on Linux) and
> llvm (on the Mac). Pretty sure this is an issue with new compilers, not with
> code generated by TAO.
> 
> My templates which use the CORBA::Any extraction operator generated in
> IDL is throwing a compiler error:
> 
> /proj/rtc/build/rtc/master/macosx/../rtc/rtcore/config/entry_T.cc:39:11:
> error: no viable overloaded '>>='
>   if (!(V >>= Temp)) {
> 
> And simplifying the code gives something similar:
> 
> /proj/rtc/build/rtc/master/macosx/../rtc/rtcore/config/entry_T.cc:46:5:
> error: invalid operands to binary expression
>       ('const CORBA::Any' and 'RTC::Configuration::LogType *')
>   V >> Temp;
>   ~ ^  ~~~~
> 
> On Linux there is something similar:
> 
> /proj/rtc/build/rtc/2.6.x/linux-x86_64-
> centos7/../rtc/rtcore/config/entry_T.cc:39:11: error: no match for
> ‘operator>>=’ (operand types are ‘const CORBA::Any’ and
> ‘RTC::Configuration::LogType*’)
>    if (!(V >>= Temp)) {
> 
> The corresponding insertion operators fail also. The code in question is
> defined in a template. An old post on the llvm developer’s email list (can’t
> find it now) indicates that this is expected behavior for llvm when faced with
> operators defined in global namespace, and that all other compilers are
> wrong for continuing to accept the syntax (*sigh*).
> 
> Any hints on getting these operators to work with recent compilers? It
> worked up until the last few years…
> 
> PRF including example snippets are below.
> 
> Hopefully this rings a bell with someone and they have a fix for my code.
> Thanks!
> 
> - Tom
> 
> 
>     TAO VERSION: 2.4.5
>     ACE VERSION: 6.4.5
> 
>     HOST MACHINE and OPERATING SYSTEM: Linux, Mac OS Sierra
>     COMPILER NAME AND VERSION (AND PATCHLEVEL):
> Apple LLVM version 9.0.0 (clang-900.0.38)
> 
> g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-11)
> 
>     THE $ACE_ROOT/ace/config.h FILE [if you use a link to a platform-
>     specific file, simply state which one]:
> 
> config.h:
> #include “ace/config-macosx-sierra.h”
> 
> config-macosx-sierra.h:
> #ifndef ACE_CONFIG_MACOSX_SIERRA_H
> #define ACE_CONFIG_MACOSX_SIERRA_H
> #include "ace/config-macosx-elcapitan.h"
> #undef ACE_LACKS_CLOCKID_T
> #undef ACE_LACKS_CLOCK_MONOTONIC
> #undef ACE_LACKS_CLOCK_REALTIME
> #endif // ACE_CONFIG_MACOSX_SIERRA_H
> 
>     THE $ACE_ROOT/include/makeinclude/platform_macros.GNU FILE:
> buildbits=64
> universal=0
> install_rpath=0
> inline=1
> shared_libs_only=1
> ec_typed_events=0
> ssl=0
> LDFLAGS+= -Wl,-rpath,$(INSTALL_PREFIX)/$(INSTALL_LIB)
> SOFLAGS+= -Wl,-install_name,\@rpath/$@
> include $(ACE_ROOT)/include/makeinclude/platform_macosx_sierra.GNU
> 
>     AREA/CLASS/EXAMPLE AFFECTED:
> CORBA::Any insertion and extraction operators generated by tao_idl.
> 
>     DOES THE PROBLEM AFFECT:
>         COMPILATION?
> Yes
> 
>     SYNOPSIS:
> Insertion and extraction operators (and probably others) from generated IDL
> code when used in templates.
> 
>     DESCRIPTION:
> We use CORBA::Any to carry data in our telemetry system based on CORBA
> event channels. The actual implementation is fairly deeply nested to support
> configurable objects. But the failing functionality is in trying to insert or
> extract structured values from a CORBA::Any.
> 
>     REPEAT BY:
> IDL definitions:
> module RTC {
>   module Configuration {
>     struct LogElement {
>       any Value;  ///< Value of the entry
>       long long llTime;  ///< Time that the entry was changed
>     };
>     typedef sequence<LogElement> LogType;
>     typedef sequence<LogType> LogSequenceType;
>   };
> };
> 
> template<class T>
> bool
> RTC::Configuration::StructuredEntryModifier<T>::
> SetValue(const CORBA::Any& V, T& ValueToSet) {
>   T* Temp;
>   if (!(V >>= Temp)) {
>     return false;
>   } else {
>     ValueToSet = *Temp;
>   }
>   return true;
> }
> 
>     SAMPLE FIX/WORKAROUND:
> None yet but this is a known issue.
> _______________________________________________
> tao-bugs mailing list
> tao-bugs at list.isis.vanderbilt.edu
> http://list.isis.vanderbilt.edu/cgi-bin/mailman/listinfo/tao-bugs


More information about the tao-bugs mailing list