Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exit 1 (EXIT_FAILURE) on failure #279

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Src/Array.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ DAMAGE.
#ifdef _WIN32
#define ASSERT( x ) { if( !( x ) ) _asm{ int 0x03 } }
#else // !_WIN32
#define ASSERT( x ) { if( !( x ) ) exit(0); }
#define ASSERT( x ) { if( !( x ) ) exit(1); }
#endif // _WIN32
#endif // _WIN64

Expand Down
18 changes: 9 additions & 9 deletions Src/LinearSolvers.h
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ class EigenSolverCholeskyLLt : public EigenSolver< Real , MatrixRowIterator >
#else // !STORE_EIGEN_MATRIX
_solver.factorize( eigenM );
#endif // STORE_EIGEN_MATRIX
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::EigenSolverCholeskyLLt Failed to factorize matrix\n" ) , exit(0);
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::EigenSolverCholeskyLLt Failed to factorize matrix\n" ) , exit(1);
}
_eigenB.resize( M.rows() );
}
Expand All @@ -309,10 +309,10 @@ class EigenSolverCholeskyLLt : public EigenSolver< Real , MatrixRowIterator >
switch( _solver.info() )
{
case Eigen::Success: break;
case Eigen::NumericalIssue: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (numerical issue)\n" ) , exit(0);
case Eigen::NoConvergence: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (no convergence)\n" ) , exit(0);
case Eigen::InvalidInput: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (invalid input)\n" ) , exit(0);
default: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix\n" ) , exit(0);
case Eigen::NumericalIssue: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (numerical issue)\n" ) , exit(1);
case Eigen::NoConvergence: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (no convergence)\n" ) , exit(1);
case Eigen::InvalidInput: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix (invalid input)\n" ) , exit(1);
default: fprintf( stderr , "[ERROR] EigenSolverCholeskyLLt::update Failed to factorize matrix\n" ) , exit(1);
}
}
void solve( ConstPointer( Real ) b , Pointer( Real ) x )
Expand Down Expand Up @@ -350,7 +350,7 @@ class EigenSolverCholeskyLDLt : public EigenSolver< Real , MatrixRowIterator >
if( !analyzeOnly )
{
_solver.factorize( eigenM );
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::EigenSolverCholeskyLDLt Failed to factorize matrix\n" ) , exit(0);
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::EigenSolverCholeskyLDLt Failed to factorize matrix\n" ) , exit(1);
}
_eigenB.resize( M.rows() );
}
Expand All @@ -362,7 +362,7 @@ class EigenSolverCholeskyLDLt : public EigenSolver< Real , MatrixRowIterator >
for( int i=0 ; i<M.rows() ; i++ ) for( MatrixRowIterator iter=M.begin(i) ; iter!=M.end(i) ; iter++ ) triplets.push_back( Eigen::Triplet< double >( i , iter->N , iter->Value ) );
eigenM.setFromTriplets( triplets.begin() , triplets.end() );
_solver.factorize( eigenM );
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::update Failed to factorize matrix\n" ) , exit(0);
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCholeskyLDLt::update Failed to factorize matrix\n" ) , exit(1);
}
void solve( ConstPointer( Real ) b , Pointer( Real ) x )
{
Expand Down Expand Up @@ -396,7 +396,7 @@ class EigenSolverCG : public EigenSolver< Real , MatrixRowIterator >
_eigenM.setFromTriplets( triplets.begin() , triplets.end() );
_solver.compute( _eigenM );
_solver.analyzePattern( _eigenM );
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::EigenSolverCG Failed to factorize matrix\n" ) , exit(0);
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::EigenSolverCG Failed to factorize matrix\n" ) , exit(1);
_eigenB.resize( M.rows() ) , _eigenX.resize( M.rows() );
_solver.setMaxIterations( iters );
_solver.setTolerance( tolerance );
Expand All @@ -407,7 +407,7 @@ class EigenSolverCG : public EigenSolver< Real , MatrixRowIterator >
for( int i=0 ; i<M.rows() ; i++ ) for( MatrixRowIterator iter=M.begin(i) ; iter!=M.end(i) ; iter++ ) _eigenM.coeffRef( i , iter->N ) = iter->Value;
_solver.compute( _eigenM );
_solver.analyzePattern( _eigenM );
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::update Failed to factorize matrix\n" ) , exit(0);
if( _solver.info()!=Eigen::Success ) fprintf( stderr , "[ERROR] EigenSolverCG::update Failed to factorize matrix\n" ) , exit(1);
}

void setIters( int iters ){ _solver.setMaxIterations( iters ); }
Expand Down
4 changes: 2 additions & 2 deletions Src/MyMiscellany.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ namespace MKExceptions
void ErrorOut( const char *fileName , int line , const char *functionName , const char *format , Args ... args )
{
std::cerr << MakeMessageString( "[ERROR]" , fileName , line , functionName , format , args ... ) << std::endl;
exit( 0 );
exit( 1 );
}
}
#ifndef WARN
Expand Down Expand Up @@ -324,7 +324,7 @@ inline void SignalHandler( int signal )
{
printf( "Signal: %d\n" , signal );
StackTracer::Trace();
exit( 0 );
exit( 1 );
};


Expand Down
4 changes: 2 additions & 2 deletions Src/Socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ int socket_receive( Socket& s , Array< C > destination , size_t len )
{
fprintf( stderr , "Size of socket_receive exceeds destination maximum: %zd > %zd\n" , len , destination.maximum()*sizeof( C ) );
ASSERT( 0 );
exit( 0 );
exit( 1 );
}
return socket_receive( s , (char*)&destination[0] , len );
}
Expand All @@ -102,7 +102,7 @@ int socket_send( Socket s , ConstArray< C > source , size_t len )
{
fprintf( stderr , "Size of socket_send exceeds source maximum: %zd > %zd\n" , len , source.maximum()*sizeof( C ) );
ASSERT( 0 );
exit( 0 );
exit( 1 );
}
return socket_send( s , (char*)&source[0] , len );
}
Expand Down
6 changes: 3 additions & 3 deletions Src/Socket.inl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ void ReceiveOnSocket( Socket& s , Pointer( C ) data , size_t dataSize , const ch
va_end( args );
fprintf( stderr , "\n" );
}
exit(0);
exit(1);
}
rec+=tmp;
}
Expand All @@ -101,7 +101,7 @@ void SendOnSocket( Socket& s , ConstPointer( C ) data , size_t dataSize , const
if( socket_send( s , ( ConstPointer( char ) )data , dataSize )<0 )
{
fprintf( stderr , "socket_send to client failed: %s\n" , LastSocketError());
exit(0);
exit(1);
}
}

Expand All @@ -114,7 +114,7 @@ void SendOnSocket( Socket& s , Pointer( C ) data , size_t dataSize , const char*
if( socket_send( s , ( ConstPointer( char ) )data , dataSize )<0 )
{
fprintf( stderr , "socket_send to client failed: %s\n" , LastSocketError());
exit(0);
exit(1);
}
}

Expand Down