Code review comment for lp:~ralph-lange/epics-base/ca-over-tcp

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

Hi Ralph,

I started trying to merge branch this today. I added a default value ("") for EPICS_CA_NAME_SERVERS to configure/CONFIG_ENV to remove build warnings.

I'm getting a compile errors from my vxWorks builds, both 5.5.2 and 6.8. VxWorks 5.5.2 complains about line 613 in cac.cpp:

    bool newIIU = findOrCreateVirtCircuit (
        guard, addr,
        pChan->getPriority(guard), piiu, minorVersionNumber, false );

The last argument 'false' should be deleted as the prototype expects a pointer that defaults to 0. I don't know why the other arch's don't object to this, I guess they manage to convert the false into a NULL pointer.

5.5.2 also complains about udpiiu.cpp:

../udpiiu.cpp: In method `void udpiiu::SearchDestUDP::searchRequest(epicsGuard<epicsMutex> &, const char *, unsigned int)':
../udpiiu.h:153: `class epicsMutex & udpiiu::cacMutex' is private
../udpiiu.cpp:919: within this context
../udpiiu.h:160: `SOCKET udpiiu::sock' is private
../udpiiu.cpp:923: within this context
../udpiiu.h:164: `bool udpiiu::shutdownCmd' is private
../udpiiu.cpp:936: within this context
../udpiiu.cpp: In method `void udpiiu::SearchDestUDP::show(epicsGuard<epicsMutex> &, unsigned int) const':
../udpiiu.h:153: `class epicsMutex & udpiiu::cacMutex' is private
../udpiiu.cpp:970: within this context
../udpiiu.cpp: In method `void udpiiu::SearchRespCallback::notify(const caHdr &, const void *, const osiSockAddr &, const epicsTime &)':
../udpiiu.h:162: `ca_uint16_t udpiiu::serverPort' is private
../udpiiu.cpp:1033: within this context
../udpiiu.h:151: `class cac & udpiiu::cacRef' is private
../udpiiu.cpp:1038: within this context
../udpiiu.h:151: `class cac & udpiiu::cacRef' is private
../udpiiu.cpp:1043: within this context
../udpiiu.cpp: In method `void udpiiu::SearchRespCallback::show(epicsGuard<epicsMutex> &, unsigned int) const':
../udpiiu.h:153: `class epicsMutex & udpiiu::cacMutex' is private
../udpiiu.cpp:1052: within this context

It isn't giving member functions of nested classes access to their parent class private data members, which I can fix by adding a couple of friend definitions to class udpiiu in udpiiu.h:
    friend class udpiiu::SearchDestUDP;
    friend class udpiiu::SearchRespCallback;
With that change, vxWorks 5.5.2 builds OK.

VxWorks 6.8 also complains about udpiiu.cpp:

../udpiiu.cpp: In member function 'virtual void udpiiu::SearchDestUDP::searchRequest(epicsGuard<epicsMutex>&, const char*, size_t)':
../udpiiu.cpp:924: error: invalid conversion from 'const char*' to 'char*'
../udpiiu.cpp:924: error: initializing argument 2 of 'int sendto(int, char*, int, int, sockaddr*, int)'

The relevant code is:

void udpiiu :: SearchDestUDP :: searchRequest (
            epicsGuard < epicsMutex > & guard, const char * pBuf, size_t bufSize )
{
...
        int status = sendto ( _udpiiu.sock, pBuf, bufSizeAsInt, 0,
                & _destAddr.sa, sizeof ( _destAddr.sa ) );

In vxWorks the second argument to sendto() is not marked as const. Adding a const_cast<char *> around the argument is ugly, but the alternative was requiring changes to too many other files for me to finish exploring it. With that change vxWorks 6.8 finished building OK.

I'm happy to commit these changes as part of the merge, or allow you to re-do them yourself. I'm not sure how to test the result yet though...

Has anyone tried to build this on Windows yet?

- Andrew

review: Needs Fixing

« Back to merge proposal