00001 /* ==================================================================== 00002 * ==================================================================== 00003 * 00004 * Module: opt_error.h 00005 * $Revision: 1.1.1.1 $ 00006 * $Date: 2005/10/21 19:00:00 $ 00007 * $Author: marcel $ 00008 * $Source: /proj/osprey/CVS/open64/osprey1.0/be/opt/opt_error.h,v $ 00009 * 00010 * Revision history: 00011 * 30-AUG-94 - Original Version 00012 * 00013 * ==================================================================== 00014 * 00015 * Copyright (C) 2000, 2001 Silicon Graphics, Inc. All Rights Reserved. 00016 * 00017 * This program is free software; you can redistribute it and/or modify 00018 * it under the terms of version 2 of the GNU General Public License as 00019 * published by the Free Software Foundation. 00020 * 00021 * This program is distributed in the hope that it would be useful, but 00022 * WITHOUT ANY WARRANTY; without even the implied warranty of 00023 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00024 * 00025 * Further, this software is distributed without any warranty that it 00026 * is free of the rightful claim of any third person regarding 00027 * infringement or the like. Any license provided herein, whether 00028 * implied or otherwise, applies only to this software file. Patent 00029 * licenses, if any, provided herein do not apply to combinations of 00030 * this program with other software, or any other product whatsoever. 00031 * 00032 * You should have received a copy of the GNU General Public License 00033 * along with this program; if not, write the Free Software Foundation, 00034 * Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA. 00035 * 00036 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pky, 00037 * Mountain View, CA 94043, or: 00038 * 00039 * http://www.sgi.com 00040 * 00041 * For further information regarding this notice, see: 00042 * 00043 * http://oss.sgi.com/projects/GenInfo/NoticeExplan 00044 * 00045 * ==================================================================== 00046 * 00047 * Description: 00048 * OPT_ERROR(type, errno) 00049 * OPT_ERROR_FMT(type, errno, errmsg_list) 00050 * OPT_ASSERT(cond, message) 00051 * 00052 * ==================================================================== 00053 * ==================================================================== 00054 */ 00055 00056 00057 #ifndef opt_error_INCLUDED 00058 #define opt_error_INCLUDED 00059 #ifdef __cplusplus 00060 extern "C" { 00061 #endif 00062 00063 00064 #ifdef _KEEP_RCS_ID 00065 static char *opt_error_rcs_id = "$Source$ $Revision$"; 00066 #endif /* _KEEP_RCS_ID */ 00067 00068 00069 /************************************************************************* 00070 * 00071 * ER_FATAL: Fatal error. Compilation stops. 00072 * ER_ERROR: Optimizer internal error. Compilation may proceed. 00073 * ER_INFO: Information such as compile-phase, compilation-time, memory-usage, etc. 00074 * ER_VERBOSE: Information such as which PU is being compiled, ... 00075 * 00076 * ASSERT is ER_FATAL. 00077 * 00078 * 00079 *************************************************************************/ 00080 00081 #define ER_FATAL 1 00082 #define ER_ERROR 2 00083 #define ER_INFO 3 00084 #define ER_VERBOSE 4 00085 00086 00087 /* 00088 * Error number for the optimizer 00089 */ 00090 typedef enum { 00091 ERN_IGNORED, 00092 ERN_INTERNAL, 00093 ERN_OUT_OF_MEM, 00094 ERN_BAD_OPTION, 00095 MAX_ERN_NUMBER 00096 } ERROR_NUMBER; 00097 00098 00099 /* Macros */ 00100 00101 00102 /* 00103 * Four ways of reporting error: 00104 * 1. use error number 00105 * 2. use format-string and a variable number of optional arguments 00106 * 3. to assert with one fixed message, use OPT_ASSERT 00107 * 4. to assert with more arguments, use OPT_ASSERT_FMT. 00108 */ 00109 #define OPT_ERROR(type, errno) \ 00110 (opt_Abort_File = __FILE__, opt_Abort_Loc = __LINE__, \ 00111 OPT_Error(type, errno)) 00112 00113 #define OPT_ERROR_FMT(type, errmsg_list) \ 00114 (opt_Abort_File = __FILE__, opt_Abort_Loc = __LINE__,\ 00115 OPT_Error_Fmt (type, errmsg_list)) 00116 00117 #define OPT_ASSERT(cond, message) \ 00118 if (cond) (OPT_ERROR_FMT(ER_FATAL, (message))) 00119 00120 #define OPT_ASSERT_FMT(cond, errmsg_list) \ 00121 if (cond) (OPT_ERROR_FMT(ER_FATAL, errmsg_list)) 00122 00123 00124 /* Global Variables */ 00125 00126 extern char *opt_Abort_File; /* name of the file that asserted */ 00127 extern INT opt_Abort_Loc; /* line number that asserted */ 00128 00129 /* Error routine */ 00130 extern void OPT_Error(INT type, INT errnum, ...); 00131 00132 extern void OPT_Error_Fmt(INT type, const char *fmt_str, ...); 00133 00134 extern void Opt_Catch_Signals (void); 00135 00136 #ifdef __cplusplus 00137 } 00138 #endif 00139 00140 #endif /* opt_error_INCLUDED */
1.5.6