Browse Source

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

pre-master-46
rlar 10 years ago
parent
commit
f826ff82f8
  1. 2
      src/frontend/error.c
  2. 2
      src/frontend/inpcom.c
  3. 14
      src/include/ngspice/ngspice.h
  4. 5
      src/main.c
  5. 1
      src/spicelib/devices/cpl/cplload.c

2
src/frontend/error.c

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

2
src/frontend/inpcom.c

@ -3489,7 +3489,6 @@ get_param_name(char *line)
if (!equal_ptr) { if (!equal_ptr) {
fprintf(stderr, "ERROR: could not find '=' on parameter line '%s'!\n", line); fprintf(stderr, "ERROR: could not find '=' on parameter line '%s'!\n", line);
controlled_exit(EXIT_FAILURE); controlled_exit(EXIT_FAILURE);
return NULL;
} }
equal_ptr = skip_back_ws_(equal_ptr, line); 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 */ /* the terminating `.ends' deck wasn't found */
controlled_exit(EXIT_FAILURE); controlled_exit(EXIT_FAILURE);
return NULL;
} }

14
src/include/ngspice/ngspice.h

@ -213,6 +213,14 @@ extern double x_atanh(double);
#define NAN (0.0/0.0) #define NAN (0.0/0.0)
#endif #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 */ /* Fast random number generator */
//#define FastRand //#define FastRand
#define WaGauss #define WaGauss
@ -308,11 +316,7 @@ extern void SetAnalyse(char *analyse, int percent);
void soa_printf(CKTcircuit *ckt, GENinstance *instance, const char *fmt, ...); 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 */ /* macro to ignore unused variables and parameters */

5
src/main.c

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

1
src/spicelib/devices/cpl/cplload.c

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

Loading…
Cancel
Save