introduce `ATTRIBUTE_NORETURN' for `controlled_exit()' and `sp_shutdown()'

This commit is contained in:
rlar 2015-12-13 21:11:03 +01:00
parent 84e31cae82
commit f826ff82f8
5 changed files with 12 additions and 12 deletions

View File

@ -23,7 +23,7 @@ extern void shared_exit(int status);
char ErrorMessage[1024];
void
ATTRIBUTE_NORETURN void
controlled_exit(int status)
{
#ifdef HAS_WINGUI

View File

@ -3489,7 +3489,6 @@ get_param_name(char *line)
if (!equal_ptr) {
fprintf(stderr, "ERROR: could not find '=' on parameter line '%s'!\n", line);
controlled_exit(EXIT_FAILURE);
return NULL;
}
equal_ptr = skip_back_ws_(equal_ptr, line);
@ -3879,7 +3878,6 @@ inp_reorder_params_subckt(struct names *subckt_w_params, struct line *subckt_car
/* the terminating `.ends' deck wasn't found */
controlled_exit(EXIT_FAILURE);
return NULL;
}

View File

@ -213,6 +213,14 @@ extern double x_atanh(double);
#define NAN (0.0/0.0)
#endif
#if defined(__GNUC__)
#define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
#elif defined(_MSC_VER)
#define ATTRIBUTE_NORETURN __declspec (noreturn)
#else
#define ATTRIBUTE_NORETURN
#endif
/* Fast random number generator */
//#define FastRand
#define WaGauss
@ -308,11 +316,7 @@ extern void SetAnalyse(char *analyse, int percent);
void soa_printf(CKTcircuit *ckt, GENinstance *instance, const char *fmt, ...);
#ifdef __GNUC__
extern void controlled_exit(int status) __attribute__ ((noreturn));
#else
extern void controlled_exit(int status);
#endif
ATTRIBUTE_NORETURN void controlled_exit(int status);
/* macro to ignore unused variables and parameters */

View File

@ -154,7 +154,7 @@ struct variable *(*if_getparam)(CKTcircuit *ckt, char **name, char *param, int i
/* static functions */
int SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator);
static void sp_shutdown(int exitval);
static ATTRIBUTE_NORETURN void sp_shutdown(int exitval);
static void app_rl_readlines(void);
#if defined(HAVE_GNUREADLINE) || defined(HAVE_BSDEDITLINE)
@ -520,7 +520,7 @@ SIMinit(IFfrontEnd *frontEnd, IFsimulator **simulator)
/* -------------------------------------------------------------------------- */
/* Shutdown gracefully. */
static void
static ATTRIBUTE_NORETURN void
sp_shutdown(int exitval)
{
destroy_ivars();
@ -1336,7 +1336,6 @@ main(int argc, char **argv)
}
sp_shutdown(EXIT_NORMAL);
return 0;
} /* --- if (ft_batchmode) --- */

View File

@ -786,7 +786,6 @@ errordetect:
fprintf(stderr, "your maximum time step is too large for tau.\n");
fprintf(stderr, "decrease max time step in .tran card and try again\n");
controlled_exit(0);
return(0);
}