Make sure to print a stack trace whenever an error signal is delivered
[oota-llvm.git] / utils / Burg / plank.c
index 053304eafc30765b9864668a236c542ed2e79a5f..1ce006dd01996bdb7a931bf761f4df98c6493712 100644 (file)
@@ -2,6 +2,7 @@ char rcsid_plank[] = "$Id$";
 
 #include <stdio.h>
 #include <string.h>
+#include <stdlib.h>
 #include "b.h"
 #include "fe.h"
 
@@ -35,7 +36,7 @@ static void purgePlanks ARGS((List));
 static void inToEx ARGS((void));
 static void makePlankRuleMacros ARGS((void));
 static void makePlankRule ARGS((void));
-static void exceptionSwitch ARGS((List, char *, char *, char *, int, char *));
+static void exceptionSwitch ARGS((List, const char *, const char *, const char *, int, const char *));
 static void doPlankLabel ARGS((Operator));
 static void doPlankLabelSafely ARGS((Operator));
 static void doPlankLabelMacrosSafely ARGS((Operator));
@@ -231,7 +232,7 @@ renumber()
        for (i = 1; i < globalMap->count; i++) {
                sortedStates[i-1] = globalMap->set[i];
        }
-       qsort(sortedStates, globalMap->count-1, sizeof(Item_Set), stateCompare);
+       qsort(sortedStates, globalMap->count-1, sizeof(Item_Set), (int(*)(const void *, const void *))stateCompare);
        previousOp = 0;
        for (i = 0; i < globalMap->count-1; i++) {
                sortedStates[i]->newNum = i;
@@ -245,7 +246,7 @@ renumber()
        sortedRules = (RuleAST*) zalloc(max_ruleAST * sizeof(RuleAST));
        count = 0;
        foreachList((ListFn) assignRules, ruleASTs);
-       qsort(sortedRules, max_ruleAST, sizeof(RuleAST), ruleCompare);
+       qsort(sortedRules, max_ruleAST, sizeof(RuleAST), (int(*)(const void *, const void *))ruleCompare);
        previousLHS = 0;
        base_counter = 0;
        for (i = 0; i < max_ruleAST; i++) {
@@ -602,7 +603,7 @@ makePlankRule()
 }
 
 static void
-exceptionSwitch(es, sw, pre, post, offset, def) List es; char *sw; char *pre; char *post; int offset; char *def;
+exceptionSwitch(es, sw, pre, post, offset, def) List es; const char *sw; const char *pre; const char *post; int offset; const char *def;
 {
        if (es) {
                fprintf(outfile, "\t\tswitch (%s) {\n", sw);