EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: RE: osiWireFormat.h problems
From: "Jeff Hill" <[email protected]>
To: "'Eric Norum'" <[email protected]>
Cc: "'Core talk list'" <[email protected]>
Date: Mon, 4 Dec 2006 11:52:01 -0700
Eric,

It would easier from my end if I could see the compiler errors before
changes were made.

Are you providing a new RTEMS specific osdWireFormat.h instead of just using
the one found in osi/os/default? It is also possible that you are seeing a
warning that the osdWireFormat.h header file couldn't be found? That might
be because the RTEMS specific gnu make "vpath" configuration for the libCom
build does not allow osdWireFormat.h to be installed from the osi/os/default
directory? It seems that that one of the above circumstances would be
necessary for you to see these errors. 

Another possibility might be that your woes are specific to GCC 4.0 which is
difficult to test as they have not installed it on any Linux system here and
you can't get gcc 4.0 at this time for cygwin. It doesn't seem to be
particularly likely that there would be problems with gcc 4.0 however
because the code involved looks quite standard and has compiled on many
compilers. 

The gory details go like this. The WireAlias template is only needed for the
primitive types where the byte swap can be done as an alias of an unsigned
type {epicsInt8, epicsInt16, epicsInt32, epicsFloat32}. Closer inspection
reveals that the WireAlias template is used only by the following template
functions which assume that the byte swap can be done as an unsigned alias.
Where that default assumption does not work, explicit versions of these
template functions (ordinary functions with the same callable interface as
the template functions) are provided in osdWireFormat.h for the appropriate
types where there might be architecture specific issues {epicsUInt16,
epicsUInt32, epicsFloat64, epicsOldString}. Because the explicit versions of
these functions do not use the WireAlias template then the explicitly
implemented types need not be supplied for the WireAlias template. 

template < class T >
inline void WireGet ( const epicsUInt8 * pWireSrc, T & dst );

template < class T >
inline void WireSet ( const T & src, epicsUInt8 * pWireDst )

template < class T >
inline void AlignedWireGet ( const T & src, T & dst );

template < class T >
inline void AlignedWireSet ( const T & src, T & dst );

Furthermore, note that if the explicit function definitions are properly
provided in osdWireFormat.h then it does not hurt to define the additional
WireAlias types, but this shouldn't be done because it certainly adds unused
source code and it also makes catching explicit function definitions missing
from an OS specific osdWireFormat.h less likely at compile time.

I will give you a call later today.

Jeff

> -----Original Message-----
> From: Eric Norum [mailto:[email protected]]
> Sent: Monday, December 04, 2006 8:53 AM
> To: Jeff Hill
> Cc: Core talk list
> Subject: osiWireFormat.h problems
> 
> With Andrew's assistance I made the following change to
> osiWireFormatl.h:
> Index: src/libCom/osi/osiWireFormat.h
> ===================================================================
> RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/libCom/osi/
> osiWireFormat.h,v
> retrieving revision 1.1.2.1
> diff -u -r1.1.2.1 osiWireFormat.h
> --- src/libCom/osi/osiWireFormat.h      30 Nov 2006 22:03:39
> -0000      1.1.2.1
> +++ src/libCom/osi/osiWireFormat.h      4 Dec 2006 15:36:57 -0000
> @@ -141,12 +141,24 @@
> };
> template <>
> +union WireAlias < epicsUInt16 > {
> +    epicsUInt16 _u;
> +    epicsInt16 _o;
> +};
> +
> +template <>
> union WireAlias < epicsInt32 > {
>       epicsUInt32 _u;
>       epicsInt32 _o;
> };
> template <>
> +union WireAlias < epicsUInt32 > {
> +    epicsUInt32 _u;
> +    epicsInt32 _o;
> +};
> +
> +template <>
> union WireAlias < epicsFloat32 > {
>       epicsUInt32 _u;
>       epicsFloat32 _o;
> 
> 
> 
> make -C O.RTEMS-uC5282 -f ../Makefile TOP=../../.. T_A=RTEMS-uC5282
> install
> /usr/local/rtems/rtems-4.7/bin/m68k-rtems4.7-g++ -B/usr/local/rtems/
> rtems-4.7/m68k-rtems4.7/uC5282/lib/ -specs bsp_specs -qrtems   -c   -
> m528x               -DUNIX    -ansi  -O4 -g -g  -Wall      -
> DMY_DO_BOOTP=NULL    -
> DRTEMS_NETWORK_CONFIG_DNS_DOMAINNAME=aps.anl.gov -
> DRTEMS_NETWORK_CONFIG_DNS_DOMAINNAME=aps.anl.gov  -I. -I.. -I../../../
> include/os/RTEMS -I../../../include         ../cac.cpp
> ../nciu.h:124: warning: 'class privateInterfaceForIO' has virtual
> functions but non-virtual destructor
> ../comBuf.h:47: warning: 'class wireSendAdapter' has virtual
> functions but non-virtual destructor
> ../comBuf.h:66: warning: 'class wireRecvAdapter' has virtual
> functions but non-virtual destructor
> ../cac.h:60: warning: 'class cacRecycle' has virtual functions but
> non-virtual destructor
> ../../../include/osiWireFormat.h: In function 'void AlignedWireGet
> (const T&, T&) [with T = double]':
> ../../../include/osiWireFormat.h:88:   instantiated from
> 'AlignedWireRef<T>::operator T() const [with T = double]'
> ../comQueRecv.h:108:   instantiated from here
> ../../../include/osiWireFormat.h:242: error: 'tmp' has incomplete type
> ../../../include/osiWireFormat.h:242: error: storage size of 'tmp'
> isn't known
> make[3]: *** [cac.o] Error 1
> 
> 
> 
> 1) What to do now for doubles?
> 2) The signed/unsigned unions in osiWireFormat.h to avoid overzealous
> aliasing optimizations are not necessary since the the strict
> aliasing rules say that types which differ only in signed-ness can
> not be assumed to be non-overlapping.
> 
> --
> Eric Norum <[email protected]>
> Advanced Photon Source
> Argonne National Laboratory
> (630) 252-4793



Replies:
Re: osiWireFormat.h problems Eric Norum
References:
osiWireFormat.h problems Eric Norum

Navigate by Date:
Prev: osiWireFormat.h problems Eric Norum
Next: RE: osiWireFormat.h problems Jeff Hill
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: osiWireFormat.h problems Eric Norum
Next: Re: osiWireFormat.h problems Eric Norum
Index: 2002  2003  2004  2005  <20062007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 02 Feb 2012 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·