fix several warnings

Probably fixes a bug in es/CMA, which has been deprecated for a long time in favor of the EDO module anyway.
This commit is contained in:
Johann Dreo 2025-04-07 14:16:37 +02:00
commit 22275e434b
15 changed files with 51 additions and 36 deletions

View file

@ -174,18 +174,18 @@ protected:
// if the flight does not need to be used, use the dummy flight instance
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator () (POT &) {}
}dummyFlight;
public:
eoDummyFlight () {}
void operator() (POT &) override {}
} dummyFlight;
// if the initializer does not need to be used, use the dummy one instead
class eoDummyInitializer:public eoInitializerBase < POT >
{
public:
eoDummyInitializer () {}
void operator () (POT &) {}
}dummyInit;
public:
eoDummyInitializer () {}
void operator() () override {}
} dummyInit;
};
/**

View file

@ -230,27 +230,25 @@ protected:
// if the eval does not need to be used, use the dummy eval instance
class eoDummyEval : public eoEvalFunc<POT>
{
public:
void operator()(POT &)
{}
}
dummyEval;
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator () (POT &) {}
}dummyFlight;
public:
void operator()(POT &) override {}
} dummyEval;
class eoDummyFlight:public eoFlight < POT >
{
public:
eoDummyFlight () {}
void operator() (POT &) override {}
} dummyFlight;
// if the initializer does not need to be used, use the dummy one instead
class eoDummyInitializer:public eoInitializerBase < POT >
{
public:
eoDummyInitializer () {}
void operator () (POT &) {}
}dummyInit;
public:
eoDummyInitializer () {}
void operator() () override {}
} dummyInit;
};
/** @example t-eoSyncEasyPSO.cpp

View file

@ -113,16 +113,19 @@ CMAParams::CMAParams(eoParser& parser, unsigned dimensionality) {
for (unsigned i = 0; i < weights.size(); ++i) {
weights[i] = mu - i;
}
break;
}
case 2:
{
weights = 1.;
break;
}
default :
{
for (unsigned i = 0; i < weights.size(); ++i) {
weights[i] = log(mu+1.)-log(i+1.);
}
break;
}
}

View file

@ -468,8 +468,11 @@ private :
switch(new_arity)
{
case 3 : args[2].copy(s.args[2]); args[2].parent = this; // no break!
[[fallthrough]];
case 2 : args[1].copy(s.args[1]); args[1].parent = this;
[[fallthrough]];
case 1 : args[0].copy(s.args[0]); args[0].parent = this;
[[fallthrough]];
case 0 : break;
default :
{
@ -523,7 +526,9 @@ private :
switch(arity())
{
case 3 : args[2].parent = 0; // no break!
[[fallthrough]];
case 2 : args[1].parent = 0;
[[fallthrough]];
case 1 : args[0].parent = 0; break;
case 0 : break;
default :
@ -542,7 +547,9 @@ private :
switch(arity())
{
case 3 : args[2].parent = this; // no break!
[[fallthrough]];
case 2 : args[1].parent = this;
[[fallthrough]];
case 1 : args[0].parent = this; break;
case 0 : break;
default :

View file

@ -161,7 +161,7 @@ namespace mpi
MPI_Barrier( MPI_COMM_WORLD );
}
void broadcast( communicator & comm, int value, int root )
void broadcast( communicator & /*comm*/, int value, int root )
{
MPI_Bcast( &value, 1, MPI_INT, root, MPI_COMM_WORLD );
}

View file

@ -42,16 +42,16 @@ int Check( PCom *com )
}
PCom * PipeComOpen( char *prog )
PCom * PipeComOpen( const char *prog )
{
char *args[2];
args[0] = prog;
args[0] = strdup( prog );
args[1] = NULL;
return PipeComOpenArgv( prog, args );
}
PCom * PipeComOpenArgv( char *prog, char *argv[] )
PCom * PipeComOpenArgv( const char *prog, char *argv[] )
{
int toFils[2];
int toPere[2];

View file

@ -23,8 +23,8 @@ typedef struct PipeCommunication {
} PCom;
extern PCom *PipeComOpen( char *prog );
extern PCom *PipeComOpenArgv( char *prog, char *argv[] );
extern PCom *PipeComOpen( const char *prog );
extern PCom *PipeComOpenArgv( const char *prog, char *argv[] );
extern int PipeComSend( PCom *to, const char *line );
extern int PipeComSendn( PCom *to, const char *data, int n );