2011-01-24 12:54:57 +00:00
|
|
|
/*
|
|
|
|
diagnostic.h
|
|
|
|
|
|
|
|
Diagnostic messages.
|
|
|
|
|
|
|
|
Copyright (C) 2011 Bill Currie <bill@taniwha.org>
|
|
|
|
|
|
|
|
Author: Bill Currie <bill@taniwha.org>
|
|
|
|
Date: 2011/01/24
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public License
|
|
|
|
as published by the Free Software Foundation; either version 2
|
|
|
|
of the License, or (at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
|
|
|
|
|
|
See the GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to:
|
|
|
|
|
|
|
|
Free Software Foundation, Inc.
|
|
|
|
59 Temple Place - Suite 330
|
|
|
|
Boston, MA 02111-1307, USA
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __diagnostic_h
|
|
|
|
#define __diagnostic_h
|
|
|
|
|
|
|
|
/** \defgroup qfcc_diagnostic Diagnostic Messages
|
|
|
|
\ingroup qfcc
|
|
|
|
*/
|
2020-02-11 06:20:49 +00:00
|
|
|
///@{
|
2011-01-24 12:54:57 +00:00
|
|
|
|
2018-10-09 03:46:13 +00:00
|
|
|
typedef void (*diagnostic_hook)(const char *message);
|
|
|
|
extern diagnostic_hook bug_hook;
|
|
|
|
extern diagnostic_hook error_hook;
|
|
|
|
extern diagnostic_hook warning_hook;
|
|
|
|
extern diagnostic_hook notice_hook;
|
|
|
|
|
2018-10-13 00:31:00 +00:00
|
|
|
struct expr_s *_error (struct expr_s *e, const char *file, int line,
|
|
|
|
const char *fmt, ...)
|
2021-03-27 10:52:59 +00:00
|
|
|
__attribute__ ((format (PRINTF, 4, 5)));
|
2018-10-13 00:31:00 +00:00
|
|
|
#define error(e, fmt...) _error(e, __FILE__, __LINE__, fmt)
|
|
|
|
|
2021-06-27 05:49:16 +00:00
|
|
|
void _internal_error (const struct expr_s *e, const char *file, int line,
|
2018-10-13 00:31:00 +00:00
|
|
|
const char *fmt, ...)
|
2021-03-27 10:52:59 +00:00
|
|
|
__attribute__ ((format (PRINTF, 4, 5), noreturn));
|
2018-10-12 04:57:59 +00:00
|
|
|
#define internal_error(e, fmt...) _internal_error(e, __FILE__, __LINE__, fmt)
|
2018-10-13 00:31:00 +00:00
|
|
|
|
|
|
|
struct expr_s *_warning (struct expr_s *e, const char *file, int line,
|
|
|
|
const char *fmt, ...)
|
2021-03-27 10:52:59 +00:00
|
|
|
__attribute__ ((format (PRINTF, 4, 5)));
|
2018-10-13 00:31:00 +00:00
|
|
|
#define warning(e, fmt...) _warning(e, __FILE__, __LINE__, fmt)
|
|
|
|
|
|
|
|
struct expr_s *_notice (struct expr_s *e, const char *file, int line,
|
|
|
|
const char *fmt, ...)
|
2021-03-27 10:52:59 +00:00
|
|
|
__attribute__ ((format (PRINTF, 4, 5)));
|
2018-10-13 00:31:00 +00:00
|
|
|
#define notice(e, fmt...) _notice(e, __FILE__, __LINE__, fmt)
|
|
|
|
|
2018-10-12 07:01:11 +00:00
|
|
|
void _debug (struct expr_s *e, const char *file, int line,
|
|
|
|
const char *fmt, ...)
|
2021-03-27 10:52:59 +00:00
|
|
|
__attribute__ ((format (PRINTF, 4, 5)));
|
2018-10-12 07:01:11 +00:00
|
|
|
#define debug(e, fmt...) _debug(e, __FILE__, __LINE__, fmt)
|
2018-10-13 00:31:00 +00:00
|
|
|
|
2018-10-12 07:01:11 +00:00
|
|
|
void _bug (struct expr_s *e, const char *file, int line, const char *fmt, ...)
|
2021-03-27 10:52:59 +00:00
|
|
|
__attribute__ ((format (PRINTF, 4, 5)));
|
2018-10-12 07:01:11 +00:00
|
|
|
#define bug(e, fmt...) _bug(e, __FILE__, __LINE__, fmt)
|
2011-01-24 12:54:57 +00:00
|
|
|
|
2023-02-05 11:19:52 +00:00
|
|
|
void print_srcline (int rep, const struct expr_s *e);
|
|
|
|
|
2020-02-11 06:20:49 +00:00
|
|
|
///@}
|
2011-01-24 12:54:57 +00:00
|
|
|
|
|
|
|
#endif//__diagnostic_h
|