diff --git a/C/cdmgr.c b/C/cdmgr.c index 28882d41e..190378a47 100644 --- a/C/cdmgr.c +++ b/C/cdmgr.c @@ -1485,11 +1485,21 @@ bool Yap_discontiguous(PredEntry *ap, Term mode USES_REGS) { return false; } if (ap == LOCAL_LastAssertedPred) - return FALSE; + return false; if (ap->cs.p_code.NOfClauses) { + Term repeat = AbsPair((CELL *)AbsPredProp(ap)); for (fp = LOCAL_ConsultSp; fp < LOCAL_ConsultBase; ++fp) - if (fp->p == AbsPredProp(ap)) + if (fp->p == AbsPredProp(ap)) { + // detect repeated warnings + if (LOCAL_ConsultSp == LOCAL_ConsultLow + 1) { + expand_consult(); + } + --LOCAL_ConsultSp; + LOCAL_ConsultSp->r = repeat; return true; + } else if (fp->r == repeat && ap->cs.p_code.NOfClauses > 4) { + return false; + } } return false; } diff --git a/H/YapGFlagInfo.h b/H/YapGFlagInfo.h index 23804f551..73f5f9f43 100644 --- a/H/YapGFlagInfo.h +++ b/H/YapGFlagInfo.h @@ -156,7 +156,10 @@ debugger uses to write terms. If unbound, show the current options. If `true` (default `true`) YAP checks for definitions of the same predicate that are separated by clauses for other predicates. This may indicate that different -procedures have the sam*e name. +procedures have the same name. + +The declaration discontiguous/1 disables this warning for user-specified predicates. + */ YAP_FLAG(DOLLAR_AS_LOWER_CASE_FLAG, "dollar_as_lower_case", true, booleanFlag, "false", NULL), /**< `dollar_as_lower_case ` diff --git a/H/clause.h b/H/clause.h index db1ede4cd..6ab20dd17 100644 --- a/H/clause.h +++ b/H/clause.h @@ -28,6 +28,7 @@ typedef union CONSULT_OBJ { int mode; Prop p; UInt c; + Term r; } consult_obj; /* Either we are assembling clauses or indexing code */