- Improved some type of warnings for e.g. empty prec sets andsoforth.

This commit is contained in:
ccremers 2005-12-28 14:25:06 +00:00
parent 72162e82c6
commit bceaca28f0
3 changed files with 37 additions and 5 deletions

View File

@ -472,6 +472,16 @@ claimCreate (const System sys, const Protocol protocol, const Role role,
/* then we should ignore it later */ /* then we should ignore it later */
cl->alwaystrue = true; cl->alwaystrue = true;
cl->warnings = true; cl->warnings = true;
/* show a warning for this */
globalError++;
eprintf ("warning: secrecy claim of role ");
termPrint (cl->rolename);
eprintf (" contains a variable ");
termPrint (claimvars->term);
eprintf
(" which is never read; therefore the claim will be true.\n");
globalError--;
} }
claimvars = claimvars->next; claimvars = claimvars->next;
} }
@ -1579,11 +1589,19 @@ compute_prec_sets (const System sys)
//@todo This is for debugging, mainly. //@todo This is for debugging, mainly.
if (cl->prec == NULL) if (cl->prec == NULL)
{ {
globalError++; if (inTermlist (CLAIMS_dep_prec, cl->type))
eprintf ("warning: claim with empty prec() set at r:%i, ev:%i\n", {
r1, ev1); /* this claim depends on prec, but it is empty! */
globalError--;
cl->warnings = true; cl->warnings = true;
globalError++;
eprintf ("warning: claim with label ");
termPrint (cl->label);
eprintf (" of role ");
termPrint (cl->rolename);
eprintf (" has an empty prec() set.\n");
globalError--;
}
} }
else else
{ {

View File

@ -1,6 +1,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
#include "term.h" #include "term.h"
#include "termlist.h"
#include "compiler.h" #include "compiler.h"
/* /*
@ -28,6 +29,8 @@ Term CLAIM_Niagree;
Term CLAIM_Empty; Term CLAIM_Empty;
Term CLAIM_Reachable; Term CLAIM_Reachable;
Termlist CLAIMS_dep_prec;
//! Init special terms //! Init special terms
/** /**
* This is called by compilerInit * This is called by compilerInit
@ -52,4 +55,10 @@ specialTermInit (const System sys)
langcons (CLAIM_Niagree, "Niagree", TERM_Claim); langcons (CLAIM_Niagree, "Niagree", TERM_Claim);
langcons (CLAIM_Empty, "Empty", TERM_Claim); langcons (CLAIM_Empty, "Empty", TERM_Claim);
langcons (CLAIM_Reachable, "Reachable", TERM_Claim); langcons (CLAIM_Reachable, "Reachable", TERM_Claim);
/* Construct a list of claims that depend on prec being not-empty */
/* basically all authentication claims */
CLAIMS_dep_prec = termlistAdd (NULL, CLAIM_Niagree);
CLAIMS_dep_prec = termlistAdd (CLAIMS_dep_prec, CLAIM_Nisynch);
} }

View File

@ -1,6 +1,9 @@
#ifndef SPECIALTERM #ifndef SPECIALTERM
#define SPECIALTERM #define SPECIALTERM
#include "term.h"
#include "termlist.h"
/* /*
* Some declarations in spercialterm.c * Some declarations in spercialterm.c
*/ */
@ -20,4 +23,6 @@ extern Term CLAIM_Niagree;
extern Term CLAIM_Empty; extern Term CLAIM_Empty;
extern Term CLAIM_Reachable; extern Term CLAIM_Reachable;
extern Termlist CLAIMS_dep_prec;
#endif #endif