From 2be225c17aee3d66f628d0a80c9d1182a1905bcc Mon Sep 17 00:00:00 2001 From: Vitor Santos Costa Date: Tue, 25 Nov 2014 16:42:35 +0000 Subject: [PATCH] small warnings. --- packages/ProbLog/simplecudd_lfi/Makefile.in | 2 +- packages/ProbLog/simplecudd_lfi/adterror.c | 4 ++-- packages/ProbLog/simplecudd_lfi/adterror.h | 4 ++-- packages/ProbLog/simplecudd_lfi/apt.h | 5 ++++- packages/ProbLog/simplecudd_lfi/iqueue.c | 6 ++++-- packages/ProbLog/simplecudd_lfi/problogbdd_lfi.c | 11 +++++++---- packages/ProbLog/simplecudd_lfi/simplecudd.h | 1 + packages/myddas/myddas_odbc.c | 4 ++-- packages/myddas/myddas_shared.c | 2 ++ packages/prism/src/c/core/fputil.h | 4 ++++ packages/prism/src/c/up/graph.c | 5 +++-- packages/swi-minisat2/C/Solver.C | 4 ++-- 12 files changed, 34 insertions(+), 18 deletions(-) diff --git a/packages/ProbLog/simplecudd_lfi/Makefile.in b/packages/ProbLog/simplecudd_lfi/Makefile.in index 51dc924d7..feae4c977 100755 --- a/packages/ProbLog/simplecudd_lfi/Makefile.in +++ b/packages/ProbLog/simplecudd_lfi/Makefile.in @@ -39,7 +39,7 @@ CWD=$(PWD) # DYNAMIC = -CFLAGS = @CFLAGS@ +CFLAGS = @CFLAGS@ -D__ANSI_C__=1 INCLUDE = -I@abs_top_builddir@ @CUDD_CPPFLAGS@ LINKFLAGS = -lm LINKLIBS = @CUDD_LIBS@ diff --git a/packages/ProbLog/simplecudd_lfi/adterror.c b/packages/ProbLog/simplecudd_lfi/adterror.c index 0dbde6162..59a9e06d0 100644 --- a/packages/ProbLog/simplecudd_lfi/adterror.c +++ b/packages/ProbLog/simplecudd_lfi/adterror.c @@ -25,7 +25,7 @@ void ADTError(char *name, ADTErrorCodes error, char *proc) fprintf(stderr,"ADT Error: "); fprintf(stderr," Module: %s\n",name); fprintf(stderr," Procedure: %s\n",proc); - fprintf(stderr," Error Code: %s\n",error); + fprintf(stderr," Error Code: %u\n",error); exit(1); } @@ -43,5 +43,5 @@ void ADTWarning(char *name, ADTWarningCodes warning, char *proc) fprintf(stderr,"ADT Warning: "); fprintf(stderr," Module: %s\n",name); fprintf(stderr," Procedure: %s\n",proc); - fprintf(stderr," Warning Code: %s\n",warning); + fprintf(stderr," Warning Code: %u\n",warning); } diff --git a/packages/ProbLog/simplecudd_lfi/adterror.h b/packages/ProbLog/simplecudd_lfi/adterror.h index 852f34326..10472f533 100644 --- a/packages/ProbLog/simplecudd_lfi/adterror.h +++ b/packages/ProbLog/simplecudd_lfi/adterror.h @@ -67,8 +67,8 @@ void ADTWarning(char *name, ADTWarningCodes warning, char *proc); #else -void ADTError(); -void ADTWarning(); +void ADTError(void); +void ADTWarning(void); #endif diff --git a/packages/ProbLog/simplecudd_lfi/apt.h b/packages/ProbLog/simplecudd_lfi/apt.h index dfda5a561..aff12cf6c 100644 --- a/packages/ProbLog/simplecudd_lfi/apt.h +++ b/packages/ProbLog/simplecudd_lfi/apt.h @@ -13,6 +13,8 @@ #ifndef APT_H #define APT_H +#include + /* ---------- Defines */ #ifndef ERROR @@ -52,8 +54,9 @@ #endif /* ---------- Types */ - +#ifndef __ANSI_C__ #define __ANSI_C__ +#endif typedef void (*ApplyFunction)(void*); typedef void (*ApplyFunction1)(void*,void*); diff --git a/packages/ProbLog/simplecudd_lfi/iqueue.c b/packages/ProbLog/simplecudd_lfi/iqueue.c index e2e948c09..3878cfa83 100644 --- a/packages/ProbLog/simplecudd_lfi/iqueue.c +++ b/packages/ProbLog/simplecudd_lfi/iqueue.c @@ -64,8 +64,10 @@ int start; if (q) qi = ((QueueIterator)Allocate(sizeof(_QueueIterator))); - else - ADTError(ADT_QueueIter, E_NullQueue, "QueueIteratorNew"); + else { + ADTError(ADT_QueueIter, E_NullQueue, "QueueIteratorNew"); + return NULL; + } if (qi) { qi->queue = q; QueueIteratorAbsoluteSeek(qi, start); diff --git a/packages/ProbLog/simplecudd_lfi/problogbdd_lfi.c b/packages/ProbLog/simplecudd_lfi/problogbdd_lfi.c index dfdae88e1..f0903ef01 100644 --- a/packages/ProbLog/simplecudd_lfi/problogbdd_lfi.c +++ b/packages/ProbLog/simplecudd_lfi/problogbdd_lfi.c @@ -725,13 +725,16 @@ void myexpand(extmanager MyManager, DdNode *Current) { double CalcProbability(extmanager MyManager, DdNode *Current) { DdNode *h, *l; - hisnode *Found; - char *curnode, *dynvalue; + hisnode *Found = NULL; + char *curnode; //, *dynvalue; double lvalue, hvalue, tvalue; - density_integral dynvalue_parsed; + // density_integral dynvalue_parsed; if (params.debug) { curnode = GetNodeVarNameDisp(MyManager.manager, MyManager.varmap, Current); fprintf(stderr, "%s\n", curnode); + } else { + // gcc stupidly complains. + curnode = NULL; } if (Current == MyManager.t) return 1.0; if (Current == MyManager.f) return 0.0; @@ -811,7 +814,7 @@ static void PrintNodeQueue(Queue q , extmanager MyManager){ QueueIterator qiter = QueueIteratorNew(q, 1); - fprintf(stderr,"Queue %p is [", *q); + fprintf(stderr,"Queue %p is [", q); while (qiter->currentItem != NULL) { DdNode* val = (DdNode*) qiter->currentItem->element; diff --git a/packages/ProbLog/simplecudd_lfi/simplecudd.h b/packages/ProbLog/simplecudd_lfi/simplecudd.h index b8bcff70d..fe8f07f6f 100644 --- a/packages/ProbLog/simplecudd_lfi/simplecudd.h +++ b/packages/ProbLog/simplecudd_lfi/simplecudd.h @@ -320,6 +320,7 @@ int RepairVarcnt(namedvars *varmap); char* GetNodeVarName(DdManager *manager, namedvars varmap, DdNode *node); char* GetNodeVarNameDisp(DdManager *manager, namedvars varmap, DdNode *node); int all_loaded(namedvars varmap, int disp); +int all_loaded_for_deterministic_variables(namedvars varmap, int disp); /* Traversal */ diff --git a/packages/myddas/myddas_odbc.c b/packages/myddas/myddas_odbc.c index be02e3fd5..3f8e393bf 100644 --- a/packages/myddas/myddas_odbc.c +++ b/packages/myddas/myddas_odbc.c @@ -455,7 +455,7 @@ c_db_odbc_number_of_fields( USES_REGS1 ) { char sql[256]; SQLSMALLINT number_fields; - sprintf(sql,"SELECT column_name from INFORMATION_SCHEMA.COLUMNS where table_name = \'%s\' group by column_name order by min(dtd_identifier)",relation); + sprintf(sql,"SELECT column_name from INFORMATION_SCHEMA.COLUMNS where table_name = \'%s\' GROUP BY column_name, dtd_identifier ORDER BY CAST(dtd_identifier AS INTEGER)",relation); if (!SQLALLOCHANDLE(SQL_HANDLE_STMT, hdbc, &hstmt, "db_number_of_fields")) return FALSE; @@ -495,7 +495,7 @@ c_db_odbc_get_attributes_types( USES_REGS1 ) { Term head, list; list = arg_types_list; - sprintf(sql,"SELECT column_name,data_type FROM INFORMATION_SCHEMA.COLUMNS where table_name = \'%s\' group by column_name,data_type order by min(dtd_identifier)",relation); + sprintf(sql,"SELECT column_name,data_type from INFORMATION_SCHEMA.COLUMNS WHERE table_name = \'%s\' GROUP BY column_name, dtd_identifier ORDER BY CAST(dtd_identifier AS INTEGER)",relation); if (!SQLALLOCHANDLE(SQL_HANDLE_STMT, hdbc, &hstmt, "db_get_attributes_types")) return FALSE; diff --git a/packages/myddas/myddas_shared.c b/packages/myddas/myddas_shared.c index 41bfa02e6..3041a4061 100644 --- a/packages/myddas/myddas_shared.c +++ b/packages/myddas/myddas_shared.c @@ -27,6 +27,8 @@ #include "myddas_statistics.h" #endif +void init_myddas(void); + static Int c_db_initialize_myddas( USES_REGS1 ); static Int c_db_connection_type( USES_REGS1 ); static Int c_db_add_preds( USES_REGS1 ); diff --git a/packages/prism/src/c/core/fputil.h b/packages/prism/src/c/core/fputil.h index 2d8c1e4bb..0a3f200e0 100644 --- a/packages/prism/src/c/core/fputil.h +++ b/packages/prism/src/c/core/fputil.h @@ -33,8 +33,12 @@ #elif defined DARWIN /* (empty) */ #else +#ifndef isfinite #define isfinite(x) (0.0 * (x) != 0.0) +#endif +#ifndef isnan #define isnan(x) ((x) != (x)) +#endif #define INFINITY HUGE_VAL #endif diff --git a/packages/prism/src/c/up/graph.c b/packages/prism/src/c/up/graph.c index 7d0f90812..3ee24f32c 100644 --- a/packages/prism/src/c/up/graph.c +++ b/packages/prism/src/c/up/graph.c @@ -562,7 +562,8 @@ int pc_clean_external_tables_0(void) */ int pc_export_sw_info_1(void) { - int sw_id,instance_id,fixed,fixed_h; + // int sw_id; + int instance_id,fixed,fixed_h; double prob,smooth; TERM p_switches, p_switch; TERM p_instance_list,p_prob_list,p_smooth_list; @@ -574,7 +575,7 @@ int pc_export_sw_info_1(void) /* p_switch: sw(Id,InstList,ProbList,SmoothCList,FixedP,FixedH) */ p_switch = bpx_get_car(p_switches); - sw_id = bpx_get_integer(bpx_get_arg(1,p_switch)); + // sw_id = bpx_get_integer(bpx_get_arg(1,p_switch)); p_instance_list = bpx_get_arg(2,p_switch); p_prob_list = bpx_get_arg(3,p_switch); p_smooth_list = bpx_get_arg(4,p_switch); diff --git a/packages/swi-minisat2/C/Solver.C b/packages/swi-minisat2/C/Solver.C index 2de3e6d9a..795c26b24 100644 --- a/packages/swi-minisat2/C/Solver.C +++ b/packages/swi-minisat2/C/Solver.C @@ -580,7 +580,7 @@ lbool Solver::search(int nof_conflicts, int nof_learnts) starts++; - bool first = true; + // bool first = true; for (;;){ Clause* confl = propagate(); @@ -589,7 +589,7 @@ lbool Solver::search(int nof_conflicts, int nof_learnts) conflicts++; conflictC++; if (decisionLevel() == 0) return l_False; - first = false; + // first = false; learnt_clause.clear(); analyze(confl, learnt_clause, backtrack_level);