From: G.Filippi Date: 31 Jul 1999 ******** PRELIMINARY ********** VLT-SW-OCT99 - EGCS 2.91 PORTABILITY GUIDELINES =============================================== Egcs 2.91 presents a lot of differences to the previously used version gcc2.7.2.2, expecially in the C++ area. Please refer to the egcs Release Notes for more. In the VLTSW code, the following differences have been noticed: - new warnings - (HP implementation) all the methods must be in the same file Modules oslx, book, acc restructured in such a way that the source files (one for each method) are included in the main. - to replace in ic0SERVER.h evhCB_COMPL_STAT GeneralCmdCB(msgMESSAGE &msg, void *udata); with virtual evhCB_COMPL_STAT GeneralCmdCB(msgMESSAGE &msg, void *udata); to avoid linker problems. - the constructs '()0' or '()NULL' have to be replaced with just 'NULL' - (HP only) -ldce is required (vltMakefile takes care of it) - As of 2.8.0, libg++ has been split into libstdc++ and libg++, the latter not provide in 2.9*. Only libstdc++ should be used instead. VLT-SW-OCT99 - GCC 2.95 PORTABILITY GUIDELINES =============================================== From: P.Sivera Date: 1 Dec 1999 - Each time the following compilation error appears (here an example with acc module) : accServer.C:91: no matches converting function `accDatabaseQueryCB' to type `evhCB_COMPL_STAT (fndOBJECT::*)(const msgRAW_MESSAGE &, void *)' ../include/accServer.h:40: candidates are: evhCB_COMPL_STAT accSERVER::accDatabaseQueryCB(msgMESSAGE &, void *) to fix the error it is enough to transform line 91 from: cb.Proc((evhCB_METHOD)accDatabaseQueryCB)); to: cb.Proc((evhCB_METHOD)&accSERVER::accDatabaseQueryCB)); - the same for the following error (here an example with evh module) : ../include/evhCOMMAND.icc:166: taking the address of a non-static member function ../include/evhCOMMAND.icc:166: to form a pointer to member function, say `&evhCOMMAND::_TimeoutCB' In this case, transform line 166 from: .Proc((evhCB_METHOD)&_TimeoutCB); to: .Proc((evhCB_METHOD)&evhCOMMAND::_TimeoutCB); REMARK: The second type of error becomes a warning when the flag -fpermissive is used in the vltMakefile. - Some warnings have been turned on at vltMakefile level. Here follows a list of this warnings: REMARK: for the external distribution, the vltMakefile has still NO warnings. -Wall -Wundef -W -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations and for LCU code: -Wall -W -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Wmissing-prototypes -Wmissing-declarations REMARK: if you want to turn these warnings off, you have to set the environment varable MAKE_NO_WARNINGS to ON Here there are some suggestions to help you fix these warnings, as well as some practical examples: 1) docExPc.c:58: warning: initialization discards qualifiers from pointer target type Substitute the two following lines: static char *rcsId="@(#) $Id: OCT99_RelNotes.GNU.port,v 1.139 2000/06/20 17:59:49 vltsccm Exp $"; static void *use_rcsId = ((void)&use_rcsId,(void *) &rcsId); with the following (note the "const" declaration): static const char *rcsId="@(#) $Id: OCT99_RelNotes.GNU.port,v 1.139 2000/06/20 17:59:49 vltsccm Exp $"; static const void *use_rcsId = ((const void)&use_rcsId,(const void *) &rcsId); 2) ../include/alrmClassdef.h:31: warning: function declaration isn't a prototype unsigned short ((*usf)()); Must now have void argument: unsigned short ((*usf)(void)); 3) ibacLog.c:296: warning: passing arg 2 of `logData' with different width due to prototype ibacLog.c:382: warning: passing arg 7 of `dbWriteSymbolic' with different width due to prototype ibacLog.c:382: warning: passing arg 8 of `dbWriteSymbolic' with different width due to prototype ibacErr.c:216: warning: passing arg 3 of `errAdd_v' with different width due to prototype In this case, substitute all the following parameter types: vltINT8 vltINT16 with: vltINT32 4) Two similar warnings: oslxALIAS.C:168: warning: declaration of `merge' shadows global declaration and oslxALIAS.C:176: warning: declaration of `i' shadows a member of `this' In the first case, rename the "merge" variable. In the second case, rename either the member of the class, or the parameter. Suggestion: as using the same name for both the member and the parameter is often clearer and to avoid finding out a lot of different names, it could be a good compromise to add an "underscore" (_) at the end of the name of each class member. 5) /vlt/OCT99/include/eccsErr.icc: In method `const class eccsERROR_CLASS & eccsERROR_CLASS::ErrReset() const': /vlt/OCT99/include/eccsErr.icc:37: warning: cast discards qualifiers from pointer target type In general, this occurs when you cast a constant pointer into a non-constant pointer type. You have to replace with the right cast, as shown in the following example: Replace : inline const eccsERROR_CLASS &eccsERROR_CLASS::ErrStatus(const ccsCOMPL_STAT s) const { ((eccsERROR_CLASS*)this)->status = s; return *this; } With: inline const eccsERROR_CLASS &eccsERROR_CLASS::ErrStatus(const ccsCOMPL_STAT s) const { ((const eccsERROR_CLASS*)this)->status = s; return *this; } ___oOo___