fallback for not handled enumeration values in switch

This commit is contained in:
dwarning 2010-08-06 07:50:20 +00:00
parent 2991e1a5b9
commit 586acbe45c
4 changed files with 30 additions and 0 deletions

View File

@ -17,6 +17,8 @@
#include "dotcards.h"
#include "com_measure2.h"
#include "error.h" /* controlled_exit() */
typedef enum {
MEASUREMENT_OK = 0,
MEASUREMENT_FAILURE = 1
@ -1686,6 +1688,12 @@ get_measure2(
printf("\tfunction '%s' currently not supported\n", mFunction);
break;
}
default:
{
fprintf(stderr, "ERROR: enumeration value `AT_UNKNOWN' not handled in get_measure2\nAborting...\n" );
controlled_exit(EXIT_FAILURE);
}
}
return MEASUREMENT_FAILURE;
}

View File

@ -34,6 +34,7 @@ $Id$
#include "variable.h"
#include "breakp2.h"
#include "../misc/util.h" /* dirname() */
#include "error.h" /* controlled_exit() */
#ifdef XSPICE
/* include new stuff */
@ -757,6 +758,11 @@ inp_dodeck(
break;
case CP_STRING:
break;
default:
{
fprintf(stderr, "ERROR: enumeration value `CP_LIST' not handled in inp_dodeck\nAborting...\n" );
controlled_exit(EXIT_FAILURE);
}
} /* switch . . . */
}
options = opt_beg; // back to the beginning
@ -899,6 +905,11 @@ inp_dodeck(
if_option(ct->ci_ckt, eev->va_name,
eev->va_type, eev->va_string);
break;
default:
{
fprintf(stderr, "ERROR: enumeration value `CP_LIST' not handled in inp_dodeck\nAborting...\n" );
controlled_exit(EXIT_FAILURE);
}
} // switch . . .
}
} // if (!noparse) . . .

View File

@ -220,6 +220,11 @@ inp_pathopen(char *name, char *mode)
case CP_REAL: /* This is foolish */
(void) sprintf(buf, "%g%s%s", v->va_real, DIR_PATHSEP, name);
break;
default:
{
fprintf(stderr, "ERROR: enumeration value `CP_BOOL' or `CP_LIST' not handled in inp_pathopen\nAborting...\n" );
controlled_exit(EXIT_FAILURE);
}
}
if ((fp = fopen(buf, mode)))
return (fp);

View File

@ -19,6 +19,7 @@ $Id$
#include "variable.h"
#include "vectors.h"
#include "plotting/plotting.h"
#include "error.h" /* controlled_exit() */
#ifdef XSPICE
/* gtri - begin - add function prototype for EVTfindvec */
@ -519,6 +520,11 @@ vec_get(const char *vec_name)
case CP_NUM:
fprintf(stdout,"%s=%d\n",nv->va_name,nv->va_num);
break;
default:
{
fprintf(stderr, "ERROR: enumeration value `CP_BOOL' or `CP_LIST' not handled in vec_get\nAborting...\n" );
controlled_exit(EXIT_FAILURE);
}
}
nv = nv->va_next;