From 42f23344502705bc93aabb4a3930fbacadccd4a8 Mon Sep 17 00:00:00 2001 From: Michael Weber Date: Mon, 29 Nov 2010 14:18:10 +0100 Subject: [PATCH] Fixed all warnings --- alternating.c | 5 ++--- buchi.c | 15 +++++++-------- cache.c | 3 ++- generalized.c | 18 ++++++++---------- ltl2ba.h | 1 - rewrt.c | 3 ++- util.c | 4 ++-- 7 files changed, 23 insertions(+), 26 deletions(-) diff --git a/alternating.c b/alternating.c index 2dc947a..bab5536 100644 --- a/alternating.c +++ b/alternating.c @@ -146,7 +146,6 @@ int get_sym_id(char *s) /* finds the id of a predicate, or attributes one */ ATrans *boolean(Node *p) /* computes the transitions to boolean nodes -> next & init */ { ATrans *t1, *t2, *lft, *rgt, *result = (ATrans *)0; - int id; switch(p->ntyp) { case TRUE: result = emalloc_atrans(); @@ -433,8 +432,8 @@ void mk_alternating(Node *p) /* generates an alternating automaton for p */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nBuilding and simplification of the alternating automaton: %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states, %i transitions\n", astate_count, atrans_count); } diff --git a/buchi.c b/buchi.c index fe1f80e..79df8b7 100644 --- a/buchi.c +++ b/buchi.c @@ -110,8 +110,8 @@ int simplify_btrans() /* simplifies the transitions */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the Buchi automaton - transitions: %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nSimplification of the Buchi automaton - transitions: %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i transitions removed\n", changed); } @@ -129,7 +129,6 @@ void remove_btrans(BState *to) { /* redirects transitions before removing a state from the automaton */ BState *s; BTrans *t; - int i; for (s = bstates->nxt; s != bstates; s = s->nxt) for (t = s->trans->nxt; t != s->trans; t = t->nxt) if (t->to == to) { /* transition to a state with no transitions */ @@ -225,8 +224,8 @@ int simplify_bstates() /* eliminates redundant states */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the Buchi automaton - states: %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nSimplification of the Buchi automaton - states: %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states removed\n", changed); } @@ -465,7 +464,7 @@ void print_buchi(BState *s) /* dumps the Buchi automaton */ void print_spin_buchi() { BTrans *t; BState *s; - int accept_all = 0, init_count = 0; + int accept_all = 0; if(bstates->nxt == bstates) { /* empty automaton */ fprintf(tl_out, "never { /* "); put_uform(); @@ -620,8 +619,8 @@ void mk_buchi() if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nBuilding the Buchi automaton : %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nBuilding the Buchi automaton : %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states, %i transitions\n", bstate_count, btrans_count); } diff --git a/cache.c b/cache.c index a71f518..2f64147 100644 --- a/cache.c +++ b/cache.c @@ -78,7 +78,8 @@ cached(Node *n) Node *m; if (!n) return n; - if (m = in_cache(n)) + m = in_cache(n); + if (m) return m; Caches++; diff --git a/generalized.c b/generalized.c index 6a37fe2..1087173 100644 --- a/generalized.c +++ b/generalized.c @@ -151,8 +151,8 @@ int simplify_gtrans() /* simplifies the transitions */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - transitions: %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - transitions: %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i transitions removed\n", changed); } @@ -244,8 +244,8 @@ int simplify_gstates() /* eliminates redundant states */ if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - states: %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nSimplification of the generalized Buchi automaton - states: %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states removed\n", changed); } @@ -389,8 +389,7 @@ GState *find_gstate(int *set, GState *s) void make_gtrans(GState *s) { /* creates all the transitions from a state */ int i, *list, state_trans = 0, trans_exist = 1; GState *s1; - GTrans *t; - ATrans *t1, *free; + ATrans *t1; AProd *prod = (AProd *)tl_emalloc(sizeof(AProd)); /* initialization */ prod->nxt = prod; prod->prv = prod; @@ -570,7 +569,6 @@ void mk_generalized() { /* generates a generalized Buchi automaton from the alternating automaton */ ATrans *t; GState *s; - int i; if(tl_stats) getrusage(RUSAGE_SELF, &tr_debut); @@ -618,13 +616,13 @@ void mk_generalized() if(tl_stats) { getrusage(RUSAGE_SELF, &tr_fin); timeval_subtract (&t_diff, &tr_fin.ru_utime, &tr_debut.ru_utime); - fprintf(tl_out, "\nBuilding the generalized Buchi automaton : %i.%06is", - t_diff.tv_sec, t_diff.tv_usec); + fprintf(tl_out, "\nBuilding the generalized Buchi automaton : %lli.%06is", + (long long int)t_diff.tv_sec, t_diff.tv_usec); fprintf(tl_out, "\n%i states, %i transitions\n", gstate_count, gtrans_count); } tfree(gstack); - /*for(i = 0; i < node_id; i++) /* frees the data from the alternating automaton */ + /*for(i = 0; i < node_id; i++) / * frees the data from the alternating automaton */ /*free_atrans(transition[i], 1);*/ free_all_atrans(); tfree(transition); diff --git a/ltl2ba.h b/ltl2ba.h index 6479d9d..7b1cd1b 100644 --- a/ltl2ba.h +++ b/ltl2ba.h @@ -186,7 +186,6 @@ void a_stats(void); void addtrans(Graph *, char *, Node *, char *); void cache_stats(void); void dump(Node *); -void exit(int); void Fatal(char *, char *); void fatal(char *, char *); void fsm_print(void); diff --git a/rewrt.c b/rewrt.c index 2b69ab7..0d370b2 100644 --- a/rewrt.c +++ b/rewrt.c @@ -60,7 +60,8 @@ canonical(Node *n) { Node *m; /* assumes input is right_linked */ if (!n) return n; - if (m = in_cache(n)) + m = in_cache(n); + if (m) return m; n->rgt = canonical(n->rgt); diff --git a/util.c b/util.c index b846800..871275c 100644 --- a/util.c +++ b/util.c @@ -67,9 +67,9 @@ non_fatal(char *s1, char *s2) printf("ltl2ba: "); if (s2) - printf(s1, s2); + fprintf(stdout, s1, s2); else - printf(s1); + fputs(s1, stdout); if (tl_yychar != -1 && tl_yychar != 0) { printf(", saw '"); tl_explain(tl_yychar);