fixed gnu warnings

This commit is contained in:
Jeff Hill
2004-02-05 01:16:02 +00:00
parent a5fd9c839e
commit 0a93c81e2c
2 changed files with 18 additions and 27 deletions

View File

@@ -27,20 +27,9 @@ gdd_NEWDEL_NEW(gdd)
gdd_NEWDEL_DEL(gdd) gdd_NEWDEL_DEL(gdd)
gdd_NEWDEL_STAT(gdd) gdd_NEWDEL_STAT(gdd)
epicsMutex * gdd::pGlobalMutex = 0; epicsMutex * gdd::pGlobalMutex;
epicsThreadOnceId gdd::staticInitOnce = EPICS_THREAD_ONCE_INIT;
// Can't pass C++ linkage static member function gdd::staticInit static epicsThreadOnceId gddOnce = EPICS_THREAD_ONCE_INIT;
// into epicsThreadOnce(); we need a C linkage function for that:
extern "C" {
static void gdd_staticInit(void *) { gdd::staticInit(); }
}
void gdd::staticInit (void)
{
gdd::pGlobalMutex = new epicsMutex;
assert ( gdd::pGlobalMutex );
}
class gddFlattenDestructor : public gddDestructor class gddFlattenDestructor : public gddDestructor
{ {
@@ -87,22 +76,31 @@ class gddAitStringDestructor: public gddDestructor {
// --------------------------The gdd functions------------------------- // --------------------------The gdd functions-------------------------
static void gddStaticInit ( void * p )
{
epicsMutex * * pMutex = static_cast < epicsMutex * * > ( p );
*pMutex = new epicsMutex ();
}
gdd::staticInit ()
{
epicsThreadOnce ( & gddOnce, gddStaticInit, & gdd::pGlobalMutex );
}
gdd::gdd(int app, aitEnum prim, int dimen) gdd::gdd(int app, aitEnum prim, int dimen)
{ {
init(app,prim,dimen); init(app,prim,dimen);
} }
gdd::gdd(int app, aitEnum prim, int dimen, aitUint32* val) gdd::gdd(int app, aitEnum prim, int dimen, aitUint32* val)
{ {
int i;
init(app,prim,dimen); init(app,prim,dimen);
for(i=0;i<dimen;i++) bounds[i].set(0,val[i]); for(int i=0;i<dimen;i++) bounds[i].set(0,val[i]);
} }
void gdd::init(int app, aitEnum prim, int dimen) void gdd::init(int app, aitEnum prim, int dimen)
{ {
epicsThreadOnce ( & gdd::staticInitOnce, gdd_staticInit, 0 ); gdd::staticInit ();
setApplType(app); setApplType(app);
// //
// joh - we intentionally dont call setPrimType() // joh - we intentionally dont call setPrimType()

View File

@@ -56,10 +56,6 @@ class gddScalar;
struct epicsTimeStamp; struct epicsTimeStamp;
struct timespec; struct timespec;
extern "C" {
static void gdd_staticInit(void *);
}
// Not Complete in this prototype: // Not Complete in this prototype:
// - Read only DD. // - Read only DD.
// - Small array management using free lists // - Small array management using free lists
@@ -501,19 +497,16 @@ protected:
aitUint8 dim; // 0=scaler, >0=array aitUint8 dim; // 0=scaler, >0=array
gdd_NEWDEL_DATA // required for using generic new and remove gdd_NEWDEL_DATA // required for using generic new and remove
private: private:
mutable aitUint32 ref_cnt; mutable aitUint32 ref_cnt;
aitUint8 flags; aitUint8 flags;
static epicsMutex * pGlobalMutex; static epicsMutex * pGlobalMutex;
static epicsThreadOnceId staticInitOnce; static staticInit ();
static void staticInit (void);
friend void gdd_staticInit(void *);
const gdd* indexDD (aitIndex index) const; const gdd* indexDD (aitIndex index) const;
}; };
// include these to be backward compatible with first gdd library version // include these to be backward compatible with first gdd library version
#include "gddArray.h" #include "gddArray.h"
#include "gddScalar.h" #include "gddScalar.h"