X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ferror.h;h=ab38af6234631099cb19a46f8b4a1901c4a9bf0f;hb=1339492699ce7e12c9bf9fa17f9d60a66024cbd1;hp=6eb77a14b12bd1a7aa3905a421f51072ba080304;hpb=4944c86a9318bc5b5578ab145a95c116ffd2c9fd;p=pspp diff --git a/src/error.h b/src/error.h index 6eb77a14b1..ab38af6234 100644 --- a/src/error.h +++ b/src/error.h @@ -14,8 +14,8 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA - 02111-1307, USA. */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. */ #if !error_h #define error_h 1 @@ -33,7 +33,7 @@ enum ERR_CLASS_COUNT, /* Number of message classes. */ ERR_CLASS_MASK = 0xf, /* Bitmask for class. */ ERR_VERBOSITY_SHIFT = 4, /* Shift count for verbosity. */ - ERR_VERBOSITY_MASK = 0xf, /* Bitmask for verbosity. */ + ERR_VERBOSITY_MASK = 0xf /* Bitmask for verbosity. */ }; /* If passed to msg() as CLASS, the return value will cause the message @@ -53,7 +53,6 @@ struct error int class; /* One of the classes above. */ struct file_locator where; /* File location, or (NULL, -1). */ const char *title; /* Special text inserted if not null. */ - const char *text; /* Error text. */ }; /* Number of errors, warnings reported. */ @@ -70,9 +69,9 @@ extern int err_verbosity; /* Functions. */ void msg (int class, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); + PRINTF_FORMAT (2, 3); void tmsg (int class, const char *title, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); + PRINTF_FORMAT (3, 4); void err_failure (void); void err_cond_fail (void); @@ -84,7 +83,21 @@ void err_location (struct file_locator *); /* Obscure functions. */ void err_break (void); void err_check_count (void); -void err_hcf (int exit_code) __attribute__ ((noreturn)); -void err_vmsg (const struct error *); +void err_hcf (int exit_code) NO_RETURN; +void err_vmsg (const struct error *, const char *, va_list); + +/* Used in panic situations only */ +void request_bug_report_and_abort(const char *msg ); + +void err_assert_fail(const char *expr, const char *file, int line); + +#undef __STRING +#define __STRING(x) #x +#undef assert + + +#define assert(expr) ( (void) ( expr ? (void) 0 : \ + err_assert_fail(__STRING(expr), __FILE__, __LINE__)) ) + #endif /* error.h */