Branch: Tag:

2013-11-08

2013-11-08 18:07:07 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Compiler: Warn about case values that are not enumerable.

Constant objects and the like are not a good idea to have in
case statements, since their ordering will depend on (among
other things) compilation order, which means that they will
currently likely break for dumped programs.

99:   PMOD_EXPORT struct pike_type *mixed_type_string;   PMOD_EXPORT struct pike_type *void_type_string;   PMOD_EXPORT struct pike_type *zero_type_string; + PMOD_EXPORT struct pike_type *enumerable_type_string;   PMOD_EXPORT struct pike_type *any_type_string;   PMOD_EXPORT struct pike_type *weak_type_string; /* array|mapping|multiset|function */   struct pike_type *sscanf_type_string;
8584:    type_type_string = CONSTTYPE(tType(tMix));    void_type_string = CONSTTYPE(tVoid);    zero_type_string = CONSTTYPE(tZero); +  enumerable_type_string = CONSTTYPE(tOr3(tString,tInt,tFloat));    any_type_string = CONSTTYPE(tOr(tVoid,tMix));    weak_type_string = CONSTTYPE(tOr4(tArray,tMultiset,tMapping,    tFuncV(tNone,tZero,tOr(tMix,tVoid))));
8637:    void_type_string = NULL;    free_type(zero_type_string);    zero_type_string = NULL; +  free_type(enumerable_type_string); +  enumerable_type_string = NULL;    free_type(any_type_string);    any_type_string = NULL;    free_type(weak_type_string);
8880: Inside #if defined (PIKE_DEBUG) || defined (DO_PIKE_CLEANUP) and #if defined(PIKE_DEBUG)
   gc_mark_external(void_type_string, " as void_type_string");    if (zero_type_string)    gc_mark_external(zero_type_string, " as zero_type_string"); +  if (enumerable_type_string) +  gc_mark_external(enumerable_type_string, " as enumerable_type_string");    if (any_type_string)    gc_mark_external(any_type_string, " as any_type_string");    if (weak_type_string)