compiler warnings, 64 bit MacOS build

Bug #541365 reported by Jeff Hill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Fix Released
Wishlist
Andrew Johnson

Bug Description

Tom Pelaia sent some warnings he saw when building base for 64 bit MacOS.

The warning messages are attached to his mail message in my mail box.

When I stuffed the build output directly into mantis it was truncated,

Original Mantis Bug: mantis-337
    http://www.aps.anl.gov/epics/mantis/view_bug_page.php?f_id=337

Tags: 3.14
Revision history for this message
Andrew Johnson (anj) wrote :

Some of these had already been fixed in R3.14.10, and I just fixed all of the others that were outside of Jeff's code. With the -Wshorten-64-to-32 flag to gcc/g++ added, the warnings produced by a darwin-x86 build of the 3.14 branch are now:

../inetAddrID.h: In member function 'bool udpiiu::beaconAction(const caHdr&, const osiSockAddr&, const epicsTime&)':
../inetAddrID.h:39: warning: 'ina$sin_zero$7' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$6' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$5' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$4' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$3' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$2' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$1' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_zero$0' is used uninitialized in this function
../inetAddrID.h:39: warning: 'ina$sin_len' is used uninitialized in this function
../tcpiiu.cpp: In member function 'virtual void tcpiiu::subscriptionRequest(epicsGuard<epicsMutex>&, nciu&, netSubscription&)':
../tcpiiu.cpp:1558: warning: implicit conversion shortens 64-bit value into a 32-bit value
../tcpiiu.cpp:1559: warning: implicit conversion shortens 64-bit value into a 32-bit value
../tcpiiu.cpp:1560: warning: implicit conversion shortens 64-bit value into a 32-bit value
../comQueRecv.cpp: In member function 'epicsUInt8 comQueRecv::popUInt8()':
../comQueRecv.cpp:181: warning: 'tmp' may be used uninitialized in this function
../comQueRecv.cpp: In member function 'epicsUInt16 comQueRecv::popUInt16()':
../comQueRecv.cpp:200: warning: 'tmp' may be used uninitialized in this function
../comQueRecv.cpp: In member function 'epicsUInt32 comQueRecv::popUInt32()':
../comQueRecv.cpp:219: warning: 'tmp' may be used uninitialized in this function
../comQueRecv.cpp: In member function 'bool comQueRecv::popOldMsgHeader(caHdrLargeArray&)':
../comQueRecv.cpp:241: warning: 'smallPostsize' may be used uninitialized in this function
../comQueRecv.cpp:245: warning: 'smallCount' may be used uninitialized in this function
../acctst.c: In function 'monitorUpdateTest':
../acctst.c:2183: warning: implicit conversion shortens 64-bit value into a 32-bit value
../acctst.c:2238: warning: implicit conversion shortens 64-bit value into a 32-bit value
../dbContextReadNotifyCache.cpp: In member function 'void dbContextReadNotifyCacheAllocator::show(unsigned int) const':
../dbContextReadNotifyCache.cpp:159: warning: format '%u' expects type 'unsigned int', but argument 2 has type 'size_t'
../camessage.c: In function 'read_action':
../camessage.c:653: warning: comparison is always false due to limited range of data type
Cap5.c: In function 'boot_Cap5':
Cap5.c:1811: warning: unused variable 'items'
Cap5.c: In function 'boot_Cap5':
Cap5.c:1811: warning: unused variable 'items'

Revision history for this message
Jeff Hill (johill-lanl) wrote :
Download full text (3.3 KiB)

I committed this fix (for some of the warnings)

Saved settings for C:\hill\R3.14.dll_hell_fix\epics\base successfully...
cvs diff -wb (in directory C:\hill\R3.14.dll_hell_fix\epics\base\src\ca\)
? Edit1.TXT
? RCa01512
? tst.cpp
Index: acctst.c
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/ca/acctst.c,v
retrieving revision 1.170.2.19
diff -u -b -w -b -r1.170.2.19 acctst.c
--- acctst.c 7 Jul 2009 21:39:43 -0000 1.170.2.19
+++ acctst.c 7 Jul 2009 23:33:15 -0000
@@ -2180,7 +2180,7 @@

     for ( i = 0; i < NELEMENTS(test); i++ ) {
         test[i].count = 0;
- test[i].lastValue = -1.0;
+ test[i].lastValue = -1.0f;
         SEVCHK(ca_add_event(DBR_GR_FLOAT, chan, updateTestEvent,
             &test[i], &test[i].id),NULL);
     }
@@ -2235,7 +2235,7 @@
         for ( j = 0; j < NELEMENTS(test); j++ ) {
             SEVCHK ( ca_clear_event ( test[j].id ), NULL );
             test[j].count = 0;
- test[j].lastValue = -1.0;
+ test[j].lastValue = -1.0f;
             SEVCHK ( ca_add_event ( DBR_GR_FLOAT, chan, updateTestEvent,
                 &test[j], &test[j].id ) , NULL );
         }
Index: comQueRecv.cpp
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/ca/comQueRecv.cpp,v
retrieving revision 1.28.2.2
diff -u -b -w -b -r1.28.2.2 comQueRecv.cpp
--- comQueRecv.cpp 27 Apr 2009 18:51:33 -0000 1.28.2.2
+++ comQueRecv.cpp 7 Jul 2009 23:41:27 -0000
@@ -178,7 +178,7 @@
     if ( ! pComBuf ) {
         comBuf::throwInsufficentBytesException ();
     }
- epicsUInt8 tmp = 0;
+ epicsUInt8 tmp = '\0';
     comBuf::popStatus status = pComBuf->pop ( tmp );
     if ( ! status.success ) {
         comBuf::throwInsufficentBytesException ();
@@ -197,7 +197,7 @@
         comBuf::throwInsufficentBytesException ();
     }
     // try first for all in one buffer efficent version
- epicsUInt16 tmp;
+ epicsUInt16 tmp = 0;
     comBuf::popStatus status = pComBuf->pop ( tmp );
     if ( status.success ) {
         this->nBytesPending -= sizeof ( epicsUInt16 );
@@ -216,7 +216,7 @@
         comBuf::throwInsufficentBytesException ();
     }
     // try first for all in one buffer efficent version
- epicsUInt32 tmp;
+ epicsUInt32 tmp = 0;
     comBuf::popStatus status = pComBuf->pop ( tmp );
     if ( status.success ) {
         this->nBytesPending -= sizeof ( epicsUInt32 );
Index: tcpiiu.cpp
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/ca/tcpiiu.cpp,v
retrieving revision 1.154.2.40
diff -u -b -w -b -r1.154.2.40 tcpiiu.cpp
--- tcpiiu.cpp 11 Feb 2009 00:50:28 -0000 1.154.2.40
+++ tcpiiu.cpp 7 Jul 2009 23:24:12 -0000
@@ -1555,9 +1555,9 @@
         CA_V49 ( this->minorProtocolVersion ) );

     // extension
- this->sendQue.pushFloat32 ( 0.0 ); // m_lval
- this->sendQue.pushFloat32 ( 0.0 ); // m_hval
- this->sendQue.pushFloat32 ( 0.0 ); // m_toval
+ this->sendQue.pushFloat32 ( 0.0f ); // m_lval
+ this->sendQue.pushFloat32 ( 0.0f ); // m_hval
+ this->sendQue.pushFloat32 ( 0.0f ); // m_t...

Read more...

Revision history for this message
Jeff Hill (johill-lanl) wrote :

I committed this fix (for some of the warnings)

Saved settings for C:\hill\R3.14.dll_hell_fix\epics\base successfully...
cvs diff -wb (in directory C:\hill\R3.14.dll_hell_fix\epics\base\src\db\)
Index: dbContext.cpp
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/db/dbContext.cpp,v
retrieving revision 1.1.2.7
diff -u -b -w -b -r1.1.2.7 dbContext.cpp
--- dbContext.cpp 28 Apr 2004 22:15:06 -0000 1.1.2.7
+++ dbContext.cpp 10 Feb 2009 23:04:48 -0000
@@ -33,7 +33,6 @@
 #include "caerr.h" // should be eliminated here in the future
 #include "epicsEvent.h"
 #include "epicsThread.h"
-#include "epicsSingleton.h"

 #define epicsExportSharedSymbols
 #include "db_access_routines.h"
Index: dbContextReadNotifyCache.cpp
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/db/dbContextReadNotifyCache.cpp,v
retrieving revision 1.1.2.2
diff -u -b -w -b -r1.1.2.2 dbContextReadNotifyCache.cpp
--- dbContextReadNotifyCache.cpp 12 Apr 2005 22:41:20 -0000 1.1.2.2
+++ dbContextReadNotifyCache.cpp 7 Jul 2009 23:42:49 -0000
@@ -155,8 +155,9 @@
             pNext = _pReadNotifyCache->pNext;
             count++;
         }
- printf ( "\tcount %u and size %lu\n",
- count, _readNotifyCacheSize );
+ printf ( "\tcount %lu and size %lu\n",
+ static_cast < unsigned long > ( count ),
+ _readNotifyCacheSize );
     }
 }

***** CVS exited normally with code 1 *****

Revision history for this message
Andrew Johnson (anj) wrote :

Fixed in R3.14.11.

Revision history for this message
Andrew Johnson (anj) wrote :

R3.14.11 released.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.