X-Git-Url: http://andersk.mit.edu/gitweb/splint.git/blobdiff_plain/616915ddfdcba888735f45cbd9c26c9b5383ee2c..35b9a1d988c06908076e3a6eeae55b1147879607:/src/flagMarker.c diff --git a/src/flagMarker.c b/src/flagMarker.c index 86b0ca8..b51269b 100644 --- a/src/flagMarker.c +++ b/src/flagMarker.c @@ -1,6 +1,6 @@ /* -** LCLint - annotation-assisted static program checker -** Copyright (C) 1994-2000 University of Virginia, +** Splint - annotation-assisted static program checker +** Copyright (C) 1994-2003 University of Virginia, ** Massachusetts Institute of Technology ** ** This program is free software; you can redistribute it and/or modify it @@ -17,15 +17,15 @@ ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, ** MA 02111-1307, USA. ** -** For information on lclint: lclint-request@cs.virginia.edu -** To report a bug: lclint-bug@cs.virginia.edu -** For more information: http://lclint.cs.virginia.edu +** For information on splint: info@splint.org +** To report a bug: splint-bug@splint.org +** For more information: http://www.splint.org */ /* ** flagMarker.c */ -# include "lclintMacros.nf" +# include "splintMacros.nf" # include "basic.h" flagMarker flagMarker_createLocalSet (flagcode code, ynm set, fileloc loc) @@ -71,6 +71,7 @@ flagMarker flagMarker_createIgnoreCount (int count, fileloc loc) c->info.nerrors = count; c->loc = fileloc_copy (loc); + DPRINTF (("Create ignore count: %s", flagMarker_unparse (c))); return c; } @@ -106,6 +107,35 @@ int flagMarker_getCount (flagMarker f) return f->info.nerrors; } +bool flagMarker_equal (flagMarker f1, flagMarker f2) +{ + if (f1->kind != f2->kind) + { + return FALSE; + } + + if (!fileloc_equal (f1->loc, f2->loc)) + { + return FALSE; + } + + switch (f1->kind) + { + case FMK_LOCALSET: + return (f1->info.set == f2->info.set + && flagcode_equal (f1->code, f2->code)); + case FMK_IGNORECOUNT: + return (f1->info.nerrors == f2->info.nerrors); + case FMK_IGNOREON: + case FMK_IGNOREOFF: + return TRUE; + case FMK_SUPPRESS: + return (flagcode_equal (f1->code, f2->code)); + } + + BADBRANCHRET (FALSE); +} + cstring flagMarker_unparse (flagMarker c) { switch (c->kind) @@ -113,7 +143,7 @@ cstring flagMarker_unparse (flagMarker c) case FMK_LOCALSET: return (message ("%q: %s%s", fileloc_unparse (c->loc), ynm_unparseCode (c->info.set), - flagcode_name (c->code))); + flagcode_unparse (c->code))); case FMK_IGNORECOUNT: return (message ("%q: ignore count %d", fileloc_unparse (c->loc), c->info.nerrors)); @@ -126,14 +156,15 @@ cstring flagMarker_unparse (flagMarker c) case FMK_SUPPRESS: return (message ("%q: suppress %s", fileloc_unparse (c->loc), - flagcode_name (c->code))); + flagcode_unparse (c->code))); } - BADBRANCH; + BADBRANCHRET (cstring_undefined); } void flagMarker_free (/*@only@*/ flagMarker c) { + fileloc_free (c->loc); /* evans 2001-03-24: Splint caught this... */ sfree (c); }