All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Clausen <clausen@gnu.org>
To: reiserfs-list@namesys.com
Subject: aal_assert()
Date: Tue, 31 Dec 2002 11:54:40 +1100	[thread overview]
Message-ID: <20021231005440.GA1573@gnu.org> (raw)

Hi all,

In reiser4progs, aal_assert() has an argument for an assertian
identifier, so calls look like this:

        aal_assert("umka-889", name != NULL, return NULL);

(Where umka == Yura Umanets :)

Isn't file + line number + version number sufficient to identify
the spot in the code?  If all of these are printed out in error
messages, then users' bug reports should give sufficient information
to trace the problem.

So, I think debug.[ch] should be changed like this:

--- debug.h~	2002-12-29 08:18:42.000000000 +1100
+++ debug.h	2002-12-29 08:17:38.000000000 +1100
@@ -20,9 +20,9 @@
 */
 #ifdef __GNUC__
 
-#define aal_assert(hint, cond, action)	\
+#define aal_assert(cond, action)	\
     do {				\
-    	if (!__assert(hint, cond,	\
+    	if (!__assert(cond,		\
 	   #cond,			\
 	    __FILE__,			\
 	    __LINE__,			\
@@ -30,13 +30,13 @@
 	{				\
 	    action;			\
 	}				\
-    } while (0);
+    } while (0)
 
 #else
 
-#define aal_assert(hint, cond, action)	\
+#define aal_assert(cond, action)	\
     do {				\
-	if (!__assert(hint, cond,	\
+	if (!__assert(cond,		\
 	    #cond,			\
 	    "unknown",			\
 	    0,				\
@@ -44,17 +44,17 @@
 	{				\
 	    action;			\
 	}				\
-    } while (0);
+    } while (0)
 
 #endif
 
 #else
 
-#define aal_assert(hint, cond, action) while (0) {}
+#define aal_assert(cond, action) while (0) {}
 
 #endif
 
-extern int __assert(char *hint, int cond, char *text, char *file, 
+extern int __assert(int cond, char *text, char *file, 
 		    int line, char *function);
 
 #endif

--- debug.c~	2002-12-29 08:15:27.000000000 +1100
+++ debug.c	2002-12-29 08:16:41.000000000 +1100
@@ -18,7 +18,6 @@
    aal_assert().
 */
 int __assert(
-	char *hint,	     /* person owner of assert */
 	int cond,	     /* condition of assertion */
 	char *text,	     /* text of the assertion */
 	char *file,	     /* source file assertion was failed in */
@@ -34,8 +33,8 @@
 	   file, line and function assertion was failed in.
 	*/ 
 	return (aal_exception_throw(EXCEPTION_BUG, EXCEPTION_IGNORE | EXCEPTION_CANCEL,
-				    "%s: Assertion (%s) at %s:%d in function %s() failed.",
-				    hint, text, file, line, function) == EXCEPTION_IGNORE);
+				    "Assertion (%s) at %s:%d of version %s in function %s() failed.",
+				    text, file, line, VERSION, function) == EXCEPTION_IGNORE);
 }
 
 #endif

Cheers,
Andrew

             reply	other threads:[~2002-12-31  0:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-31  0:54 Andrew Clausen [this message]
2003-01-10  7:22 ` aal_assert() Yury Umanets
2003-01-10 13:36   ` aal_assert() Andrew Clausen
2003-01-10 14:12     ` aal_assert() Yury Umanets
     [not found] ` <15901.23872.24060.68353@laputa.namesys.com>
2003-01-10 13:26   ` aal_assert() Andrew Clausen
2003-01-10 13:19     ` aal_assert() Yury Umanets

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021231005440.GA1573@gnu.org \
    --to=clausen@gnu.org \
    --cc=reiserfs-list@namesys.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.