switch: fix label sorting

This commit is contained in:
Pavlas, Zdenek 2016-10-03 00:40:37 -07:00
parent c2ad11ac70
commit da63695cf3
2 changed files with 9 additions and 2 deletions

View File

@ -4881,8 +4881,12 @@ static void label_or_decl(int l)
decl(l); decl(l);
} }
static int case_cmp(const void *a, const void *b) static int case_cmp(const void *pa, const void *pb)
{ return (*(struct case_t**) a)->v1 - (*(struct case_t**) b)->v1; } {
int a = (*(struct case_t**) pa)->v1;
int b = (*(struct case_t**) pb)->v1;
return a < b ? -1 : a > b;
}
static void block(int *bsym, int *csym, int is_expr) static void block(int *bsym, int *csym, int is_expr)
{ {

View File

@ -1554,6 +1554,9 @@ void switch_test()
case 3: case 3:
printf("b"); printf("b");
break; break;
case 0xc33c6b9fU:
case 0x7c9eeeb9U:
break;
} }
} }
printf("\n"); printf("\n");