1 /******************************************************************************
2 * Copyright (c) 2000-2016 Ericsson Telecom AB
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
14 * Szabo, Janos Zoltan – initial implementation
16 ******************************************************************************/
21 /** If a C compiler other than GCC is used the macro below will substitute all
22 * GCC-specific non-standard attributes with an empty string. */
24 #define __attribute__(arg)
33 * \defgroup error Error reporting functions
34 * \author Roland Gecse <ethrge@eth.ericsson.se>
41 * Verbosity level (bitmask).
44 * 1: "not supported" messages
51 * Debug bits define the debug level in the interval 0..7; 0 means no
52 * debug messages, 7 means very verbose.
54 extern unsigned verb_level
;
57 * The argv[0] of main, i.e. the program name.
59 extern const char *argv0
;
62 * FATAL_ERROR(const char *fmt, ...) macro prints a formatted error message
63 * to stderr and aborts execution. It calls the fatal_error function with
64 * appropriate file name and line number information
66 #if defined(__GNUC__) && __GNUC__ < 3
68 * The preprocessors of GCC versions earlier than 3.0 do not support the
69 * standard notation for variadic macros in C++ mode.
70 * Therefore this proprietary notation is used with those old GCC versions.
72 #define FATAL_ERROR(fmt, args...) \
73 (fatal_error(__FILE__, __LINE__, fmt, ## args))
76 * This is the standard notation.
78 #define FATAL_ERROR(...) \
79 (fatal_error(__FILE__, __LINE__, __VA_ARGS__))
83 * fatal_error function, which is not supposed to be called directly.
85 extern void fatal_error(const char *filename
, int lineno
, const char *fmt
, ...)
86 __attribute__ ((__format__ (__printf__
, 3, 4), __noreturn__
));
89 * Prints a formatted error message to stderr.
90 * Used for reporting system-related errors, e.g. file not found etc.
91 * Compiler errors are reported through Common::Location::error.
93 extern void ERROR(const char *fmt
, ...)
94 __attribute__ ((__format__ (__printf__
, 1, 2)));
97 * Prints a formatted warning message to stderr.
99 extern void WARNING(const char *fmt
, ...)
100 __attribute__ ((__format__ (__printf__
, 1, 2)));
103 * Prints a formatted warning message to stderr: "Warning: Not supported: %s".
105 extern void NOTSUPP(const char *fmt
, ...)
106 __attribute__ ((__format__ (__printf__
, 1, 2)));
109 * Prints a formatted notify message to stderr.
111 extern void NOTIFY(const char *fmt
, ...)
112 __attribute__ ((__format__ (__printf__
, 1, 2)));
115 * Prints a formatted debug message to stderr.
117 extern void DEBUG(unsigned level
, const char *fmt
, ...)
118 __attribute__ ((__format__ (__printf__
, 2, 3)));
121 * Returns the current value of the error counter.
123 extern unsigned int get_error_count(void);
126 * Returns the current value of the warning counter.
128 extern unsigned int get_warning_count(void);
130 /** @} end of error group */
136 #endif /* _ERROR_H */
This page took 0.035426 seconds and 5 git commands to generate.