g++ coplaints (llvm)

This commit is contained in:
Vítor Santos Costa 2014-06-12 01:25:50 +01:00
parent ba6d46578b
commit daae1df152
11 changed files with 71 additions and 50 deletions

View File

@ -804,14 +804,14 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
PredEntry *p = (PredEntry *) Yap_AllocAtomSpace(sizeof(*p));
if (p == NULL) {
FUNC_WRITE_UNLOCK(fe);
WRITE_UNLOCK(fe);
return NULL;
}
if (cur_mod == TermProlog)
p->ModuleOfPred = 0L;
else
p->ModuleOfPred = cur_mod;
TRUE_FUNC_WRITE_LOCK(fe);
//TRUE_FUNC_WRITE_LOCK(fe);
INIT_LOCK(p->PELock);
p->KindOfPE = PEProp;
p->ArityOfPE = fe->ArityOfFE;
@ -861,7 +861,7 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
if (!ExpandPredHash()) {
Yap_FreeCodeSpace((ADDR)p);
WRITE_UNLOCK(PredHashRWLock);
TRUE_FUNC_WRITE_UNLOCK(fe);
FUNC_WRITE_UNLOCK(fe);
return NULL;
}
/* retry hashing */
@ -887,7 +887,7 @@ Yap_NewPredPropByFunctor(FunctorEntry *fe, Term cur_mod)
fe->PropsOfFE = AbsPredProp(p);
p->NextOfPE = NIL;
}
TRUE_FUNC_WRITE_UNLOCK(fe);
FUNC_WRITE_UNLOCK(fe);
{
Yap_inform_profiler_of_clause(&(p->OpcodeOfPred), &(p->OpcodeOfPred)+1, p, GPROF_NEW_PRED_FUNC);
if (!(p->PredFlags & (CPredFlag|AsmPredFlag))) {

View File

@ -2307,7 +2307,7 @@ YAP_EnterGoal(PredEntry *pe, Term *ptr, YAP_dogoalinfo *dgi)
} else {
LOCAL_CurSlot = dgi->CurSlot; // ignore any slots created within the called goal
}
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "EMUL DONE %d", out) ; }
{ __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "EMUL DONE %d", out) ; }
return out;
}

View File

@ -926,12 +926,12 @@ Yap_HandleToString(term_t l, size_t sz, size_t *length, int *encoding, int flags
r = buf;
fd = Sopenmem(&r, &sz, "w");
fd->encoding = ENC_UTF8;
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0+%s=(%p) %p", l, buf, LCL0, &LCL0 ); }
{ __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I %d LCL0+%s=(%p) %p", l, buf, LCL0, &LCL0 ); }
if ( PL_write_term(fd, l, 1200, flags) &&
Sputcode(EOS, fd) >= 0 &&
Sflush(fd) >= 0 )
{
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I LCL0+%s=(%p) %p", buf, LCL0, &LCL0 ); }
{ __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "I LCL0+%s=(%p) %p", buf, LCL0, &LCL0 ); }
size = Stell64(fd);
*length = size-1;
char *bf = malloc(*length+1);

View File

@ -1807,7 +1807,7 @@ Yap_volume_header(char *file)
char * Yap_getcwd(const char *cwd, size_t cwdlen)
{
return PL_cwd(cwd, cwdlen);
return PL_cwd((char *)cwd, cwdlen);
}
/******

View File

@ -277,7 +277,7 @@ char *YAPTerm::text(void) {
if (!(os = Yap_HandleToString(t, sze, &length, &enc, 0))) {
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "IIa LCL0+t=(%p) %x", LCL0, LCL0[-15]) ; }
RECOVER_MACHINE_REGS();
return NULL;
return (char *)NULL;
}
{ CACHE_REGS __android_log_print(ANDROID_LOG_ERROR, __FUNCTION__, "II LCL0+t=(%p) %x", LCL0, LCL0[-15]) ; }
RECOVER_MACHINE_REGS();
@ -403,12 +403,12 @@ PredEntry *YAPPredicate::getPred( Term t, Term **outp ) {
Term m = CurrentModule ;
t = Yap_StripModule(t, &m);
if (IsVarTerm(t) || IsNumTerm(t)) {
ap = NULL;
if (outp) *outp = NULL;
ap = (PredEntry *)NULL;
if (outp) *outp = (Term *)NULL;
}
if (IsAtomTerm(t)) {
ap = RepPredProp(PredPropByAtom(AtomOfTerm(t), m));
if (outp) *outp = NULL;
if (outp) *outp = (Term *)NULL;
} else if (IsPairTerm(t)) {
ap = RepPredProp(PredPropByFunc(FunctorCsult, PROLOG_MODULE));
if (outp) *outp = HR;
@ -418,8 +418,8 @@ PredEntry *YAPPredicate::getPred( Term t, Term **outp ) {
} else {
Functor f = FunctorOfTerm(t);
if (IsExtensionFunctor(f)) {
ap = NULL;
if (outp) *outp = NULL;
ap = (PredEntry *)NULL;
if (outp) *outp = (Term *)NULL;
}
ap = RepPredProp(PredPropByFunc(f, m));
if (outp) *outp = RepAppl(t)+1;
@ -525,7 +525,7 @@ void YAPQuery::close()
CACHE_REGS
if (EX && !(this->q_flags & (PL_Q_CATCH_EXCEPTION))) {
EX = NULL;
EX = (struct DB_TERM *)NULL;
}
/* need to implement backtracking here */
if (this->q_open != 1 || this->q_state == 0) {
@ -599,7 +599,7 @@ YAPEngine::YAPEngine( char *savedState,
YAPCallback *cb): _callback(0)
{ // a single engine can be active
#if __ANDROID__
if (assetManager == NULL)
if (assetManager == (AAssetManager *)NULL)
return;
Yap_DisplayWithJava = displayWithJava;
Yap_AndroidBufp = (char *)malloc(Yap_AndroidMax = 4096);

View File

@ -20,16 +20,20 @@
#include <config.h>
extern "C" {
#ifdef __cplusplus
#define old_cplusplus __cplusplus
#undef __cplusplus
#endif
#ifndef __ANDROID__
#if USE_GMP
#include <gmp.h>
#endif
#endif
extern "C" {
#ifdef __ANDROID__
#define old_cplusplus __cplusplus
#undef __cplusplus
#if USE_GMP
#include <gmp.h>
#endif
#ifdef old_cplusplus
#define __cplusplus old_cplusplus
#undef old_cplusplus
#endif
@ -341,7 +345,7 @@ private:
///
/// It is just a call to getPred
inline YAPPredicate(Term t) {
ap = getPred( t , NULL );
ap = getPred( t , (Term **)NULL );
}
/// Cast constructor for predicates,
@ -397,7 +401,7 @@ public:
inline YAPPredicate(char *s) {
Term t, tp;
t = YAP_ReadBuffer(s,&tp);
ap = getPred( t, NULL );
ap = getPred( t, (Term **)NULL );
}
@ -407,7 +411,7 @@ public:
inline YAPPredicate(char *s, Term **outp) {
Term t, tp;
t = YAP_ReadBuffer(s,&tp);
ap = getPred( t, NULL );
ap = getPred( t, (Term **)NULL );
}
/// meta-call this predicate, with arguments ts[]
@ -516,21 +520,20 @@ public:
class YAPEngine {
private:
YAPCallback *_callback;
char **buf;
YAP_init_args init_args;
public:
YAPEngine(char *savedState = NULL,
YAPEngine(char *savedState = (char *)NULL,
size_t stackSize = 0,
size_t trailSize = 0,
size_t maxStackSize = 0,
size_t maxTrailSize = 0,
char *libDir = NULL,
char *bootFile = NULL,
char *goal = NULL,
char *topLevel = NULL,
char *libDir = (char *)NULL,
char *bootFile = (char *)NULL,
char *goal = (char *)NULL,
char *topLevel = (char *)NULL,
bool script = FALSE,
bool fastBoot = FALSE,
YAPCallback *callback=NULL); /// construct a new engine, including aaccess to callbacks
YAPCallback *callback=(YAPCallback *)NULL); /// construct a new engine, including aaccess to callbacks
~YAPEngine() { delYAPCallback(); } /// kill engine
void delYAPCallback() { _callback = 0; } /// remove current callback
void setYAPCallback(YAPCallback *cb) { delYAPCallback(); _callback = cb; __android_log_print(ANDROID_LOG_INFO, __FILE__, "after loading startup %p",cb); } /// set a new callback

20
H/Yap.h
View File

@ -287,6 +287,12 @@ typedef pthread_rwlock_t rwlock_t;
#include <locks_pthread.h>
#endif
#define FUNC_READ_LOCK(X) READ_LOCK((X)->FRWLock)
#define FUNC_READ_UNLOCK(X) READ_UNLOCK((X)->FRWLock)
#define FUNC_WRITE_LOCK(X) WRITE_LOCK((X)->FRWLock)
#define FUNC_WRITE_UNLOCK(X) WRITE_UNLOCK((X)->FRWLock)
/*************************************************************************************************
use an auxiliary function for ranges
*************************************************************************************************/
@ -453,6 +459,19 @@ extern ADDR Yap_HeapBase;
extern int Yap_output_msg;
#endif
#if __ANDROID__
#include <android/asset_manager.h>
#include <android/asset_manager_jni.h>
#include <android/log.h>
#else
inline void __android_log_print(int i, const char loc[], const char msg[], ...) {}
#define ANDROID_LOG_INFO 0
#define ANDROID_LOG_ERROR 0
#define ANDROID_LOG_DEBUG 0
#endif
/*************************************************************************************************
variables concerned with atoms table
*************************************************************************************************/
@ -690,7 +709,6 @@ typedef struct scratch_block_struct {
#endif /* YAPOR || TABLING */
/*************************************************************************************************
GLOBAL and LOCAL variables
*************************************************************************************************/

View File

@ -370,7 +370,7 @@ Yap_ListOfAtomsToAtom(Term t0 USES_REGS)
inp.type = YAP_STRING_ATOMS;
out.type = YAP_STRING_ATOM;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return NULL;
return (Atom)NULL;
return out.val.a;
}
@ -406,7 +406,7 @@ Yap_ListOfCodesToAtom(Term t0 USES_REGS)
inp.type = YAP_STRING_CODES;
out.type = YAP_STRING_ATOM;
if (!Yap_CVT_Text(&inp, &out PASS_REGS))
return NULL;
return (Atom)NULL;
return out.val.a;
}
@ -870,7 +870,7 @@ Yap_ConcatAtoms(Term t1, Term t2 USES_REGS)
inpv[1].sz = 0;
out.type = YAP_STRING_ATOM;
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
return NULL;
return (Atom)NULL;
return out.val.a;
}
@ -886,7 +886,7 @@ Yap_ConcatAtomics(Term t1, Term t2 USES_REGS)
inpv[1].sz = 0;
out.type = YAP_STRING_ATOM;
if (!Yap_Concat_Text(2, inpv, &out PASS_REGS))
return NULL;
return (Atom)NULL;
return out.val.a;
}
@ -921,8 +921,8 @@ Yap_SpliceAtom(Term t1, Atom ats[], size_t cut, size_t max USES_REGS)
outv[0].sz = 0;
outv[1].type = YAP_STRING_ATOM;
outv[1].sz = 0;
if (!Yap_Splice_Text(2, cuts, &inp, NULL, outv PASS_REGS))
return NULL;
if (!Yap_Splice_Text(2, cuts, &inp, (encoding_t *)NULL, outv PASS_REGS))
return (Atom)NULL;
ats[0] = outv[0].val.a;
ats[1] = outv[1].val.a;
return ats[0];
@ -941,8 +941,8 @@ Yap_SubtractHeadAtom(Term t1, Term th USES_REGS)
outv[1].type = YAP_STRING_ATOM;
outv[1].val.t = 0;
outv[1].sz = 0;
if (!Yap_Splice_Text(2, NULL, &inp, NULL, outv PASS_REGS))
return NULL;
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, (encoding_t *)NULL, outv PASS_REGS))
return (Atom)NULL;
return outv[1].val.a;
}
@ -959,8 +959,8 @@ Yap_SubtractTailAtom(Term t1, Term th USES_REGS)
outv[0].sz = 0;
outv[1].type = YAP_STRING_ATOM;
outv[1].val.t = th;
if (!Yap_Splice_Text(2, NULL, &inp, NULL, outv PASS_REGS))
return NULL;
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, (encoding_t *)NULL, outv PASS_REGS))
return (Atom)NULL;
return outv[0].val.a;
}
@ -977,7 +977,7 @@ Yap_SpliceString(Term t1, Term ts[], size_t cut, size_t max USES_REGS)
outv[1].sz = 0;
cuts[0] = cut;
cuts[1] = max;
if (!Yap_Splice_Text(2, cuts, &inp, NULL, outv PASS_REGS))
if (!Yap_Splice_Text(2, cuts, &inp, (encoding_t *)NULL, outv PASS_REGS))
return 0L;
ts[0] = outv[0].val.t;
ts[1] = outv[1].val.t;
@ -997,7 +997,7 @@ Yap_SubtractHeadString(Term t1, Term th USES_REGS)
outv[1].type = YAP_STRING_STRING;
outv[1].val.t = 0;
outv[1].sz = 0;
if (!Yap_Splice_Text(2, NULL, &inp, NULL, outv PASS_REGS))
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, (encoding_t *)NULL, outv PASS_REGS))
return 0L;
return outv[1].val.t;
}
@ -1014,7 +1014,7 @@ Yap_SubtractTailString(Term t1, Term th USES_REGS)
outv[0].sz = 0;
outv[1].type = YAP_STRING_STRING;
outv[1].val.t = th;
if (!Yap_Splice_Text(2, NULL, &inp, NULL, outv PASS_REGS))
if (!Yap_Splice_Text(2, (size_t *)NULL, &inp, (encoding_t *)NULL, outv PASS_REGS))
return 0L;
return outv[0].val.t;
}

View File

@ -1267,7 +1267,7 @@ Yap_GetTranslationProp(Atom at)
while (p0 && p->KindOfPE != TranslationProperty)
p = RepTranslationProp(p0 = p->NextOfPE);
READ_UNLOCK(ae->ARWLock);
if (p0 == NIL) return NULL;
if (p0 == NIL) return (TranslationEntry *)NULL;
return p;
}

View File

@ -202,7 +202,7 @@ INLINE_ONLY EXTERN inline CELL *
EXO_OFFSET_TO_ADDRESS(struct index_t *it, BITS32 off)
{
if (off == 0L)
return NULL;
return (CELL *)NULL;
return (it->cls)+(off-1)*it->arity;
}

View File

@ -345,7 +345,7 @@ OpenList(int n USES_REGS)
BACKUP_H();
while (HR+2*n > ASP-1024) {
if (!Yap_dogc( 0, NULL PASS_REGS )) {
if (!Yap_dogc( 0, (Term *)NULL PASS_REGS )) {
RECOVER_H();
return FALSE;
}