[omniORB] Visual Studio 2008 level 4 compiler warnings
Richard Pitts
Richard.Pitts at cdl.co.uk
Fri May 4 11:08:02 BST 2012
Hi
I've created a patch for cdrStream.h on trunk to resolve the C4127
warnings. The patch removes the CdrMarshal and CdrUnMarshal macros and
place the definitions in macro intMarshalFns.
Any suggestions welcome and feel free to make any changes. I'm hoping
this can be in the 4.1.7 release.
Index: cdrStream.h
===================================================================
--- cdrStream.h (revision 6094)
+++ cdrStream.h (working copy)
@@ -56,51 +56,6 @@
virtual ~cdrStream();
//
- // Marshalling macros
-
-#ifndef CdrMarshal
-#define CdrMarshal(type,align,reserveAndMarshal,arg) do { \
- omni::ptr_arith_t p1 =
omni::align_to((omni::ptr_arith_t)pd_outb_mkr,align);\
- omni::ptr_arith_t p2 = p1 + sizeof(type);\
- if ((void*)p2 <= pd_outb_end) {\
- pd_outb_mkr = (void*) p2;\
- if (!pd_marshal_byte_swap) {\
- *((type*)p1) = arg;\
- }\
- else {\
- *((type*)p1) = byteSwap(arg);\
- }\
- }\
- else {\
- reserveAndMarshal(arg);\
- }\
-} while(0)
-#else
-#error "CdrMarshal has already been defined"
-#endif
-
-#ifndef CdrUnMarshal
-#define CdrUnMarshal(type,align,fetchAndUnmarshal,arg) do { \
- omni::ptr_arith_t p1 =
omni::align_to((omni::ptr_arith_t)pd_inb_mkr,align);\
- omni::ptr_arith_t p2 = p1 + sizeof(type);\
- if ((void*)p2 <= pd_inb_end) {\
- pd_inb_mkr = (void*) p2;\
- if (!pd_unmarshal_byte_swap) {\
- arg = *((type*)p1);\
- }\
- else {\
- arg = byteSwap(*((type*)p1));\
- }\
- }\
- else {\
- arg = fetchAndUnmarshal();\
- }\
-} while(0)
-#else
-#error "CdrUnMarshal has already been defined"
-#endif
-
- //
// Byte swapping functions
static inline _CORBA_Short byteSwap(_CORBA_Short s) {
@@ -213,12 +168,38 @@
// Marshalling methods : integer types
#define intMarshalFns(type,align) \
- inline void marshal ## type(_CORBA_ ## type a) { \
- CdrMarshal(_CORBA_ ## type, omni::align, reserveAndMarshal ## type,
a); \
- } \
+ inline void marshal ## type(_CORBA_ ## type arg) { \
+ omni::ptr_arith_t p1 =
omni::align_to((omni::ptr_arith_t)pd_outb_mkr,omni::align); \
+ omni::ptr_arith_t p2 = p1 + sizeof(_CORBA_ ## type);\
+ if ((void*)p2 <= pd_outb_end) {\
+ pd_outb_mkr = (void*) p2;\
+ if (!pd_marshal_byte_swap) {\
+ *((_CORBA_ ## type*)p1) = arg;\
+ }\
+ else {\
+ *((_CORBA_ ## type*)p1) = byteSwap(arg);\
+ }\
+ }\
+ else {\
+ reserveAndMarshal ## type(arg);\
+ }\
+ }\
inline _CORBA_ ## type unmarshal ## type() { \
_CORBA_ ## type a; \
- CdrUnMarshal(_CORBA_ ## type, omni::align, fetchAndUnmarshal ##
type , a); \
+ omni::ptr_arith_t p1 =
omni::align_to((omni::ptr_arith_t)pd_inb_mkr,omni::align); \
+ omni::ptr_arith_t p2 = p1 + sizeof(_CORBA_ ## type);\
+ if ((void*)p2 <= pd_inb_end) {\
+ pd_inb_mkr = (void*) p2;\
+ if (!pd_unmarshal_byte_swap) {\
+ a = *((_CORBA_ ## type*)p1);\
+ }\
+ else {\
+ a = byteSwap(*((_CORBA_ ## type*)p1));\
+ }\
+ }\
+ else {\
+ a = fetchAndUnmarshal ## type();\
+ }\
return a; \
}
Kind Regards
Richard Pitts
Windows Developer
CDL
From: omniorb-list-bounces at omniorb-support.com
[mailto:omniorb-list-bounces at omniorb-support.com] On Behalf Of Richard
Pitts
Sent: 02 May 2012 12:12
To: omniorb-list at omniorb-support.com
Subject: [omniORB] Visual Studio 2008 level 4 compiler warnings
Hi
We are using OmniORB 4.1.5 for Visual Studio 2008 and have recently
changed our compiler warning level to 4 (highest). Unfortunately the
compiler is reporting a lot of C4127 and C4512 warnings for OmniORB. We
appreciate these are not important but it would be nice to compile
against OmniORB warning free.
The following warnings are because of the do { } while(0); loops in the
marshalling methods. Most are because of the CdrMarshal and CdrUnMarshal
macros (line 236 and 256).
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(331)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(346)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(352)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(357)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(589)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(606)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(975)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(979)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(991)
: warning C4127: conditional expression is constant
3>C:\Program Files (x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(995)
: warning C4127: conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1007) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1011) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1023) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1027) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1040) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1044) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1056) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1060) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1075) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1080) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1103) : warning C4127:
conditional expression is constant
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1108) : warning C4127:
conditional expression is constant
These warnings are because of the reference member variable within each
of the classes/structs.
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1404) : warning C4512:
'cdrStreamAdapter' : assignment operator could not be generated
3> C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1328) : see declaration
of 'cdrStreamAdapter'
3>C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1562) : warning C4512:
'cdrValueChunkStream' : assignment operator could not be generated
3> C:\Program Files
(x86)\omniORB-4.1.5\include\omniORB4/cdrStream.h(1416) : see declaration
of 'cdrValueChunkStream'
3>c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Object_vartypes.h(313) :
warning C4512: 'CORBA::Object_INOUT_arg' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Object_vartypes.h(290) : see
declaration of 'CORBA::Object_INOUT_arg'
3>c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_LocalObject_vartypes.h(295) :
warning C4512: 'CORBA::LocalObject_INOUT_arg' : assignment operator
could not be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_LocalObject_vartypes.h(272) :
see declaration of 'CORBA::LocalObject_INOUT_arg'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(152)
: warning C4512: 'CORBA::Any::from_fixed' : assignment operator could
not be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(145) : see declaration
of 'CORBA::Any::from_fixed'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(189)
: warning C4512: 'CORBA::Any::to_boolean' : assignment operator could
not be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(186) : see declaration
of 'CORBA::Any::to_boolean'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(193)
: warning C4512: 'CORBA::Any::to_char' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(190) : see declaration
of 'CORBA::Any::to_char'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(197)
: warning C4512: 'CORBA::Any::to_wchar' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(194) : see declaration
of 'CORBA::Any::to_wchar'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(201)
: warning C4512: 'CORBA::Any::to_octet' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(198) : see declaration
of 'CORBA::Any::to_octet'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(210)
: warning C4512: 'CORBA::Any::to_string' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(202) : see declaration
of 'CORBA::Any::to_string'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(219)
: warning C4512: 'CORBA::Any::to_wstring' : assignment operator could
not be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(211) : see declaration
of 'CORBA::Any::to_wstring'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(227)
: warning C4512: 'CORBA::Any::to_fixed' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(220) : see declaration
of 'CORBA::Any::to_fixed'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(231)
: warning C4512: 'CORBA::Any::to_object' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(228) : see declaration
of 'CORBA::Any::to_object'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(235)
: warning C4512: 'CORBA::Any::to_abstract_base' : assignment operator
could not be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(232) : see declaration
of 'CORBA::Any::to_abstract_base'
3>c:\program files (x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(239)
: warning C4512: 'CORBA::Any::to_value' : assignment operator could not
be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_Any.h(236) : see declaration
of 'CORBA::Any::to_value'
3>c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_ValueBase_vartypes.h(314) :
warning C4512: 'CORBA::ValueBase_INOUT_arg' : assignment operator could
not be generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_ValueBase_vartypes.h(290) :
see declaration of 'CORBA::ValueBase_INOUT_arg'
3>c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_vartypes.h(148) : warning
C4512: 'CORBA::TypeCode_INOUT_arg' : assignment operator could not be
generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_vartypes.h(135) : see
declaration of 'CORBA::TypeCode_INOUT_arg'
3>c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_vartypes.h(182) : warning
C4512: 'CORBA::TypeCode_OUT_arg' : assignment operator could not be
generated
3> c:\program files
(x86)\omniorb-4.1.5\include\omniorb4\CORBA_vartypes.h(154) : see
declaration of 'CORBA::TypeCode_OUT_arg'
Kind Regards
Richard Pitts
Windows Developer
CDL
**********************************************************************
Please consider the environment - do you really need to print this
email?
This email is intended only for the person(s) named above and may
contain private and confidential information. If it has come to you in
error, please destroy and permanently delete any copy in your possession
and contact us on +44 (0) 161 480 4420. The information in this email is
copyright (c) CDL Group Holdings Limited. We cannot accept any liability
for any loss or damage sustained as a result of software viruses. It is
your responsibility to carry out such virus checking as is necessary
before opening any attachment.
Cheshire Datasystems Limited uses software which automatically screens
incoming emails for inappropriate content and attachments. If the
software identifies such content or attachment, the email will be
forwarded to our Technology Department for checking. You should be aware
that any email which you send to Cheshire Datasystems Limited is subject
to this procedure.
Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport
SK4 2HD
Registered in England and Wales with Company Number 3991057
VAT registration: 727 1188 33
</PRE>
<p style="font-family:'Arial';font-size:8pt">
**********************************************************************<br>
Please consider the environment - do you really need to print this email?<br>
<br>
This email is intended only for the person(s) named above and may contain private and confidential information. If it has come to you in error, please destroy and permanently delete any copy in your possession and contact us on +44 (0) 161 480 4420. The information in this email is copyright © CDL Group Holdings Limited. We cannot accept any liability for any loss or damage sustained as a result of software viruses. It is your responsibility to carry out such virus checking as is necessary before opening any attachment.<br>
Cheshire Datasystems Limited uses software which automatically screens incoming emails for inappropriate content and attachments. If the software identifies such content or attachment, the email will be forwarded to our Technology Department for checking. You should be aware that any email which you send to Cheshire Datasystems Limited is subject to this procedure. <br>
Cheshire Datasystems Limited, Strata House, Kings Reach Road, Stockport SK4 2HD<br>
Registered in England and Wales with Company Number 3991057<br>
VAT registration: 727 1188 33</p>
<PRE>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20120504/bb9f8ba0/attachment-0001.htm
More information about the omniORB-list
mailing list