IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40019


Ignore:
Timestamp:
Apr 27, 2017, 2:48:35 AM (9 years ago)
Author:
eugene
Message:

latest gcc more strict about implicit casting to floats -- need to prevent sending int type to float argument without explicit casting

Location:
trunk/Ohana
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/Makefile.in

    r39926 r40019  
    5252relastro    \
    5353shell       \
    54 skycalc     \
    5554tools       \
    5655tcl         \
     
    6261fixcat      \
    6362gophot      \
     63skycalc     \
    6464getusno     \
    6565lightcurve  \
  • trunk/Ohana/src/libdvo/src/dbStackMath.c

    r31635 r40019  
    7575  dbStack *OUT;
    7676 
    77 # define S_FUNC(OP,FTYPE) {                                             \
     77# define S_INT_FUNC(OP) {                                               \
     78    if (!(V1->type & DB_STACK_INT)) {                                   \
     79      /* function takes int type but input value is not int -> cast to opihi_int */ \
     80      opihi_int M1 = (V1->type & DB_STACK_FIELD) ? (opihi_int) fields[V1->field].Flt : (opihi_int) V1->FltValue; \
     81      OUT[0].type = DB_STACK_VALUE | DB_STACK_TEMP | DB_STACK_INT;      \
     82      OUT[0].IntValue = OP;                                             \
     83      return (OUT);                                                     \
     84    } else {                                                            \
     85      opihi_int M1 = (V1->type & DB_STACK_FIELD) ? fields[V1->field].Int : V1->IntValue; \
     86      OUT[0].type = DB_STACK_VALUE | DB_STACK_TEMP | DB_STACK_INT;      \
     87      OUT[0].IntValue = OP;                                             \
     88      return (OUT);                                                     \
     89    }                                                                   \
     90  }
     91
     92# define S_FLT_FUNC(OP) {                                               \
    7893    if (!(V1->type & DB_STACK_INT)) {                                   \
    7994      opihi_flt M1 = (V1->type & DB_STACK_FIELD) ? fields[V1->field].Flt : V1->FltValue; \
     
    8196      OUT[0].FltValue = OP;                                             \
    8297      return (OUT);                                                     \
    83     }                                                                   \
    84     if ((FTYPE != DB_STACK_INT) && (V1->type & DB_STACK_INT)) {         \
    85       opihi_int M1 = (V1->type & DB_STACK_FIELD) ? fields[V1->field].Int : V1->IntValue; \
     98    } else {                                                            \
     99      /* function takes non-int type but input value is int -> cast to opihi_flt */ \
     100      opihi_flt M1 = (V1->type & DB_STACK_FIELD) ? (opihi_flt) fields[V1->field].Int : (opihi_flt) V1->IntValue; \
    86101      OUT[0].type = DB_STACK_VALUE | DB_STACK_TEMP;                     \
    87102      OUT[0].FltValue = OP;                                             \
    88       return (OUT);                                                     \
    89     }                                                                   \
    90     if ((FTYPE == DB_STACK_INT) && (V1->type & DB_STACK_INT)) {         \
    91       opihi_int M1 = (V1->type & DB_STACK_FIELD) ? fields[V1->field].Int : V1->IntValue; \
    92       OUT[0].type = DB_STACK_VALUE | DB_STACK_TEMP | DB_STACK_INT;      \
    93       OUT[0].IntValue = OP;                                             \
    94103      return (OUT);                                                     \
    95104    }                                                                   \
     
    100109  OUT->name = NULL;
    101110
    102   if (!strcmp (op, "="))      S_FUNC(M1,0);
    103   if (!strcmp (op, "abs"))    S_FUNC(fabs(M1),0);
    104   if (!strcmp (op, "int"))    S_FUNC((int)(M1),DB_STACK_INT);
    105   if (!strcmp (op, "exp"))    S_FUNC(exp (M1),0);
    106   if (!strcmp (op, "ten"))    S_FUNC(pow (10.0,M1),0);
    107   if (!strcmp (op, "log"))    S_FUNC(log10 (M1),0);
    108   if (!strcmp (op, "ln"))     S_FUNC(log (M1),0);
    109   if (!strcmp (op, "sqrt"))   S_FUNC(sqrt (M1),0);
    110   if (!strcmp (op, "erf"))    S_FUNC(erf (M1),0);
    111 
    112   if (!strcmp (op, "sinh"))   S_FUNC(sinh (M1),0);
    113   if (!strcmp (op, "cosh"))   S_FUNC(cosh (M1),0);
    114   if (!strcmp (op, "asinh"))  S_FUNC(asinh (M1),0);
    115   if (!strcmp (op, "acosh"))  S_FUNC(acosh (M1),0);
    116   if (!strcmp (op, "lgamma")) S_FUNC(lgamma (M1),0);
    117 
    118   if (!strcmp (op, "sin"))    S_FUNC(sin (M1),0);
    119   if (!strcmp (op, "cos"))    S_FUNC(cos (M1),0);
    120   if (!strcmp (op, "tan"))    S_FUNC(tan (M1),0);
    121   if (!strcmp (op, "dsin"))   S_FUNC(sin (M1*RAD_DEG),0);
    122   if (!strcmp (op, "dcos"))   S_FUNC(cos (M1*RAD_DEG),0);
    123   if (!strcmp (op, "dtan"))   S_FUNC(tan (M1*RAD_DEG),0);
    124   if (!strcmp (op, "asin"))   S_FUNC(asin (M1),0);
    125   if (!strcmp (op, "acos"))   S_FUNC(acos (M1),0);
    126   if (!strcmp (op, "atan"))   S_FUNC(atan (M1),0);
    127   if (!strcmp (op, "dasin"))  S_FUNC(asin (M1)*DEG_RAD,0);
    128   if (!strcmp (op, "dacos"))  S_FUNC(acos (M1)*DEG_RAD,0);
    129   if (!strcmp (op, "datan"))  S_FUNC(atan (M1)*DEG_RAD,0);
    130   if (!strcmp (op, "rnd"))    S_FUNC(M1*0.0 + drand48(),0);
    131   if (!strcmp (op, "not"))    S_FUNC(!(M1),DB_STACK_INT);
    132   if (!strcmp (op, "--"))     S_FUNC(- (M1),DB_STACK_INT);
    133   if (!strcmp (op, "isinf"))  S_FUNC(!finite(M1),DB_STACK_INT);
    134   if (!strcmp (op, "isnan"))  S_FUNC(isnan(M1),DB_STACK_INT);
     111  if (!strcmp (op, "="))      S_FLT_FUNC(M1);
     112  if (!strcmp (op, "abs"))    S_FLT_FUNC(fabs(M1));
     113  if (!strcmp (op, "int"))    S_INT_FUNC((int)(M1));
     114  if (!strcmp (op, "exp"))    S_FLT_FUNC(exp (M1));
     115  if (!strcmp (op, "ten"))    S_FLT_FUNC(pow (10.0,M1));
     116  if (!strcmp (op, "log"))    S_FLT_FUNC(log10 (M1));
     117  if (!strcmp (op, "ln"))     S_FLT_FUNC(log (M1));
     118  if (!strcmp (op, "sqrt"))   S_FLT_FUNC(sqrt (M1));
     119  if (!strcmp (op, "erf"))    S_FLT_FUNC(erf (M1));
     120  if (!strcmp (op, "sinh"))   S_FLT_FUNC(sinh (M1));
     121  if (!strcmp (op, "cosh"))   S_FLT_FUNC(cosh (M1));
     122  if (!strcmp (op, "asinh"))  S_FLT_FUNC(asinh (M1));
     123  if (!strcmp (op, "acosh"))  S_FLT_FUNC(acosh (M1));
     124  if (!strcmp (op, "lgamma")) S_FLT_FUNC(lgamma (M1));
     125  if (!strcmp (op, "sin"))    S_FLT_FUNC(sin (M1));
     126  if (!strcmp (op, "cos"))    S_FLT_FUNC(cos (M1));
     127  if (!strcmp (op, "tan"))    S_FLT_FUNC(tan (M1));
     128  if (!strcmp (op, "dsin"))   S_FLT_FUNC(sin (M1*RAD_DEG));
     129  if (!strcmp (op, "dcos"))   S_FLT_FUNC(cos (M1*RAD_DEG));
     130  if (!strcmp (op, "dtan"))   S_FLT_FUNC(tan (M1*RAD_DEG));
     131  if (!strcmp (op, "asin"))   S_FLT_FUNC(asin (M1));
     132  if (!strcmp (op, "acos"))   S_FLT_FUNC(acos (M1));
     133  if (!strcmp (op, "atan"))   S_FLT_FUNC(atan (M1));
     134  if (!strcmp (op, "dasin"))  S_FLT_FUNC(asin (M1)*DEG_RAD);
     135  if (!strcmp (op, "dacos"))  S_FLT_FUNC(acos (M1)*DEG_RAD);
     136  if (!strcmp (op, "datan"))  S_FLT_FUNC(atan (M1)*DEG_RAD);
     137  if (!strcmp (op, "rnd"))    S_FLT_FUNC(M1*0.0 + drand48());
     138  if (!strcmp (op, "not"))    S_INT_FUNC(!(M1));
     139  if (!strcmp (op, "--"))     S_INT_FUNC(- (M1));
     140  if (!strcmp (op, "isinf"))  S_FLT_FUNC(!finite(M1));
     141  if (!strcmp (op, "isnan"))  S_FLT_FUNC(isnan(M1));
    135142
    136143  return (OUT);
  • trunk/Ohana/src/opihi/lib.shell/stack_math.c

    r39558 r40019  
    12261226  if (!strcmp (op, "--"))     S_FUNC(-1*M1, ST_SCALAR_INT); // NOTE: opihi_int is signed,
    12271227  if (!strcmp (op, "isinf"))  S_FUNC(!finite(M1), ST_SCALAR_FLT); // XXX modify in future
    1228   if (!strcmp (op, "isnan"))  S_FUNC(isnan(M1), ST_SCALAR_FLT); // XXX modify in future   
     1228  if (!strcmp (op, "isnan"))  S_FUNC(isnan((opihi_flt)(M1)), ST_SCALAR_FLT); // XXX modify in future   
    12291229
    12301230# undef S_FUNC
     
    13131313  if (!strcmp (op, "--"))     V_FUNC(-1*(*M1), ST_SCALAR_INT); // NOTE: opihi_int is signed
    13141314  if (!strcmp (op, "isinf"))  V_FUNC(!finite(*M1), ST_SCALAR_FLT);
    1315   if (!strcmp (op, "isnan"))  V_FUNC(isnan(*M1), ST_SCALAR_FLT);
     1315  if (!strcmp (op, "isnan"))  V_FUNC(isnan((opihi_flt)(*M1)), ST_SCALAR_FLT);
    13161316  if (!strcmp (op, "xramp"))  V_FUNC(i, ST_SCALAR_INT);
    13171317  if (!strcmp (op, "yramp"))  V_FUNC(0, ST_SCALAR_INT);
  • trunk/Ohana/src/relphot/src/StarOps.c

    r39636 r40019  
    948948        xlist[N] = catalog[i].secfilt[Nsecfilt*j+Nsec].M;
    949949        value    = catalog[i].secfilt[Nsecfilt*j+Nsec].Mchisq;
    950         if (isnan(value)) continue;
     950        if (isnan((double)(value))) continue;
    951951        ylist[N] = value;
    952952        N++;
  • trunk/Ohana/src/uniphot/src/update_catalog_setposangle.c

    r39457 r40019  
    3535      catalog[0].measure[m].posangle = ToShortDegrees(posAngle);
    3636      catalog[0].measure[m].pltscale = pltScale;
    37       myAssert(isfinite(catalog[0].measure[m].posangle), "oops: setposangle made a nan");
     37      // myAssert(isfinite(catalog[0].measure[m].posangle), "oops: setposangle made a nan");
    3838      myAssert(isfinite(catalog[0].measure[m].pltscale), "oops: setposangle made a nan");
    3939      found ++;
Note: See TracChangeset for help on using the changeset viewer.