muffle some visual-C warnings

This commit is contained in:
rlar 2010-09-07 20:23:07 +00:00
parent d4946a6e81
commit f7c8eb1d2a
4 changed files with 67 additions and 59 deletions

View File

@ -1,3 +1,11 @@
2010-09-07 Robert Larice
* src/frontend/parse.c ,
* src/include/fteparse.h ,
* src/spicelib/parser/inpptree.c :
muffle some visual-C warnings
data pointer -> function pointer conversion
void* versus void(*)(void)
2010-09-07 Robert Larice 2010-09-07 Robert Larice
* ng-spice-rework/src/maths/misc/randnumb.c : * ng-spice-rework/src/maths/misc/randnumb.c :
convert K&R function definitions to ansi style convert K&R function definitions to ansi style

View File

@ -104,31 +104,31 @@ checkvalid(struct pnode *pn)
static static
struct op ops[] = { struct op ops[] = {
{ PLUS, "+", 2, {(void*) op_plus} } , { PLUS, "+", 2, {(void(*)(void)) op_plus} } ,
{ MINUS, "-", 2, {(void*) op_minus} } , { MINUS, "-", 2, {(void(*)(void)) op_minus} } ,
{ TIMES, "*", 2, {(void*) op_times} } , { TIMES, "*", 2, {(void(*)(void)) op_times} } ,
{ MOD, "%", 2, {(void*) op_mod} } , { MOD, "%", 2, {(void(*)(void)) op_mod} } ,
{ DIVIDE, "/", 2, {(void*) op_divide} } , { DIVIDE, "/", 2, {(void(*)(void)) op_divide} } ,
{ COMMA, ",", 2, {(void*) op_comma} } , { COMMA, ",", 2, {(void(*)(void)) op_comma} } ,
{ POWER, "^", 2, {(void*) op_power} } , { POWER, "^", 2, {(void(*)(void)) op_power} } ,
{ EQ, "=", 2, {(void*) op_eq} } , { EQ, "=", 2, {(void(*)(void)) op_eq} } ,
{ GT, ">", 2, {(void*) op_gt} } , { GT, ">", 2, {(void(*)(void)) op_gt} } ,
{ LT, "<", 2, {(void*) op_lt} } , { LT, "<", 2, {(void(*)(void)) op_lt} } ,
{ GE, ">=", 2, {(void*) op_ge} } , { GE, ">=", 2, {(void(*)(void)) op_ge} } ,
{ LE, "<=", 2, {(void*) op_le} } , { LE, "<=", 2, {(void(*)(void)) op_le} } ,
{ NE, "<>", 2, {(void*) op_ne} } , { NE, "<>", 2, {(void(*)(void)) op_ne} } ,
{ AND, "&", 2, {(void*) op_and} } , { AND, "&", 2, {(void(*)(void)) op_and} } ,
{ OR, "|", 2, {(void*) op_or} } , { OR, "|", 2, {(void(*)(void)) op_or} } ,
{ INDX, "[", 2, {(void*) op_ind} } , { INDX, "[", 2, {(void(*)(void)) op_ind} } ,
{ RANGE, "[[", 2, {(void*) op_range} } , { RANGE, "[[", 2, {(void(*)(void)) op_range} } ,
{ TERNARY, "?:", 2, {NULL} } , { TERNARY, "?:", 2, {NULL} } ,
{ 0, NULL, 0, {NULL} } { 0, NULL, 0, {NULL} }
} ; } ;
static static
struct op uops[] = { struct op uops[] = {
{ UMINUS, "-", 1, {(void*) op_uminus} } , { UMINUS, "-", 1, {(void(*)(void)) op_uminus} } ,
{ NOT, "~", 1, {(void*) op_not} } , { NOT, "~", 1, {(void(*)(void)) op_not} } ,
{ 0, NULL, 0, {NULL} } { 0, NULL, 0, {NULL} }
} ; } ;

View File

@ -29,7 +29,7 @@ struct op {
char *op_name; /* Printing name. */ char *op_name; /* Printing name. */
char op_arity; /* One or two. */ char op_arity; /* One or two. */
union { union {
void *anonymous; void (*anonymous)(void);
struct dvec *(*unary)(struct pnode *); struct dvec *(*unary)(struct pnode *);
struct dvec *(*binary)(struct pnode *, struct pnode *); struct dvec *(*binary)(struct pnode *, struct pnode *);
} op_func; /* The function to do the work. */ } op_func; /* The function to do the work. */

View File

@ -45,12 +45,12 @@ static struct op {
void *funcptr; void *funcptr;
} ops[] = { } ops[] = {
{ {
PT_COMMA, ",", NULL}, { PT_COMMA, ",", NULL}, {
PT_PLUS, "+", (void*) PTplus}, { PT_PLUS, "+", (void(*)(void)) PTplus}, {
PT_MINUS, "-", (void*) PTminus}, { PT_MINUS, "-", (void(*)(void)) PTminus}, {
PT_TIMES, "*", (void*) PTtimes}, { PT_TIMES, "*", (void(*)(void)) PTtimes}, {
PT_DIVIDE, "/", (void*) PTdivide}, { PT_DIVIDE, "/", (void(*)(void)) PTdivide}, {
PT_POWER, "^", (void*) PTpower} PT_POWER, "^", (void(*)(void)) PTpower}
}; };
#define NUM_OPS (int)(sizeof (ops) / sizeof (struct op)) #define NUM_OPS (int)(sizeof (ops) / sizeof (struct op))
@ -60,40 +60,40 @@ static struct func {
int number; int number;
void *funcptr; void *funcptr;
} funcs[] = { } funcs[] = {
{ "abs", PTF_ABS, (void*) PTabs } , { "abs", PTF_ABS, (void(*)(void)) PTabs } ,
{ "acos", PTF_ACOS, (void*) PTacos } , { "acos", PTF_ACOS, (void(*)(void)) PTacos } ,
{ "acosh", PTF_ACOSH, (void*) PTacosh } , { "acosh", PTF_ACOSH, (void(*)(void)) PTacosh } ,
{ "asin", PTF_ASIN, (void*) PTasin } , { "asin", PTF_ASIN, (void(*)(void)) PTasin } ,
{ "asinh", PTF_ASINH, (void*) PTasinh } , { "asinh", PTF_ASINH, (void(*)(void)) PTasinh } ,
{ "atan", PTF_ATAN, (void*) PTatan } , { "atan", PTF_ATAN, (void(*)(void)) PTatan } ,
{ "atanh", PTF_ATANH, (void*) PTatanh } , { "atanh", PTF_ATANH, (void(*)(void)) PTatanh } ,
{ "cos", PTF_COS, (void*) PTcos } , { "cos", PTF_COS, (void(*)(void)) PTcos } ,
{ "cosh", PTF_COSH, (void*) PTcosh } , { "cosh", PTF_COSH, (void(*)(void)) PTcosh } ,
{ "exp", PTF_EXP, (void*) PTexp } , { "exp", PTF_EXP, (void(*)(void)) PTexp } ,
{ "ln", PTF_LN, (void*) PTln } , { "ln", PTF_LN, (void(*)(void)) PTln } ,
{ "log", PTF_LOG, (void*) PTlog } , { "log", PTF_LOG, (void(*)(void)) PTlog } ,
{ "sgn", PTF_SGN, (void*) PTsgn } , { "sgn", PTF_SGN, (void(*)(void)) PTsgn } ,
{ "sin", PTF_SIN, (void*) PTsin } , { "sin", PTF_SIN, (void(*)(void)) PTsin } ,
{ "sinh", PTF_SINH, (void*) PTsinh } , { "sinh", PTF_SINH, (void(*)(void)) PTsinh } ,
{ "sqrt", PTF_SQRT, (void*) PTsqrt } , { "sqrt", PTF_SQRT, (void(*)(void)) PTsqrt } ,
{ "tan", PTF_TAN, (void*) PTtan } , { "tan", PTF_TAN, (void(*)(void)) PTtan } ,
{ "tanh", PTF_TANH, (void*) PTtanh } , { "tanh", PTF_TANH, (void(*)(void)) PTtanh } ,
{ "u", PTF_USTEP, (void*) PTustep } , { "u", PTF_USTEP, (void(*)(void)) PTustep } ,
{ "uramp", PTF_URAMP, (void*) PTuramp } , { "uramp", PTF_URAMP, (void(*)(void)) PTuramp } ,
{ "-", PTF_UMINUS, (void*) PTuminus }, { "-", PTF_UMINUS, (void(*)(void)) PTuminus },
/* MW. cif function added */ /* MW. cif function added */
{ "u2", PTF_USTEP2, (void*) PTustep2}, { "u2", PTF_USTEP2, (void(*)(void)) PTustep2},
{ "pwl", PTF_PWL, (void*) PTpwl}, { "pwl", PTF_PWL, (void(*)(void)) PTpwl},
{ "pwl_derivative", PTF_PWL_DERIVATIVE, (void*) PTpwl_derivative}, { "pwl_derivative", PTF_PWL_DERIVATIVE, (void(*)(void)) PTpwl_derivative},
{ "eq0", PTF_EQ0, (void*) PTeq0}, { "eq0", PTF_EQ0, (void(*)(void)) PTeq0},
{ "ne0", PTF_NE0, (void*) PTne0}, { "ne0", PTF_NE0, (void(*)(void)) PTne0},
{ "gt0", PTF_GT0, (void*) PTgt0}, { "gt0", PTF_GT0, (void(*)(void)) PTgt0},
{ "lt0", PTF_LT0, (void*) PTlt0}, { "lt0", PTF_LT0, (void(*)(void)) PTlt0},
{ "ge0", PTF_GE0, (void*) PTge0}, { "ge0", PTF_GE0, (void(*)(void)) PTge0},
{ "le0", PTF_LE0, (void*) PTle0}, { "le0", PTF_LE0, (void(*)(void)) PTle0},
{ "pow", PTF_POW, (void*) PTpower}, { "pow", PTF_POW, (void(*)(void)) PTpower},
{ "min", PTF_MIN, (void*) PTmin}, { "min", PTF_MIN, (void(*)(void)) PTmin},
{ "max", PTF_MAX, (void*) PTmax}, { "max", PTF_MAX, (void(*)(void)) PTmax},
} ; } ;
#define NUM_FUNCS (int)(sizeof (funcs) / sizeof (struct func)) #define NUM_FUNCS (int)(sizeof (funcs) / sizeof (struct func))