MCPcopy Create free account
hub / github.com/Singular/Singular / omReportError

Function omReportError

omalloc/omError.c:80–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78#endif
79
80omError_t omReportError(omError_t error, omError_t report_error, OM_FLR_DECL,
81 const char* fmt, ...)
82{
83 int max_check, max_track;
84
85 if (report_error == omError_MaxError) return error;
86 /* reset MaxTrack and MaxCheck to prevent infinite loop, in case
87 printf allocates memory */
88 max_check = om_Opts.MaxCheck;
89 max_track = om_Opts.MaxTrack;
90 om_Opts.MaxCheck = 0;
91 om_Opts.MaxTrack = 0;
92
93 om_InternalErrorStatus = error;
94 om_ErrorStatus = (report_error == omError_NoError ? error : report_error);
95
96 if (om_Opts.HowToReportErrors && om_ErrorStatus != omError_NoError)
97 {
98 /* to avoid spurious error msg in 64 bit mode*/
99 if (om_ErrorStatus == omError_StickyBin) return error;
100 fprintf(stderr, "***%s: %s", omError2Serror(om_ErrorStatus), omError2String(om_ErrorStatus));
101
102#ifdef OM_INTERNAL_DEBUG
103 if (om_ErrorStatus != error)
104 fprintf(stderr, "\n___%s: %s", omError2Serror(error), omError2String(error));
105#endif
106
107 if (om_Opts.HowToReportErrors > 2 && fmt != NULL && *fmt != '\0')
108 {
109 va_list ap;
110 va_start(ap, fmt);
111 fputs( ": ",stderr);
112 vfprintf(stderr, fmt, ap);
113 va_end(ap);
114 }
115
116 if (om_Opts.HowToReportErrors > 1)
117 {
118#ifndef OM_NDEBUG
119 fputs("\n occurred at: ",stderr);
120 if (! _omPrintCurrentBackTrace(stderr, OM_FLR_VAL))
121 fputs(" ??",stderr);
122#endif
123 }
124 fputc('\n',stderr);
125 fflush(stderr);
126 }
127 if (om_CallErrorHook)
128 om_Opts.ErrorHook();
129
130 om_Opts.MaxCheck = max_check;
131 om_Opts.MaxTrack = max_track;
132 return error;
133}
134
135
136/* this is a dummy function and used as default for om_Opts.ErrorHook */

Callers 9

_omDebugAllocFunction · 0.85
_omDebugReallocFunction · 0.85
omReportAddrErrorFunction · 0.85
_omCheckListFunction · 0.85
_omCheckSortedListFunction · 0.85
omMergeStickyBinIntoBinFunction · 0.85
omtTestDebugFunction · 0.85
TestAddrContentEqualFunction · 0.85
TestAddrContentFunction · 0.85

Calls 3

omError2SerrorFunction · 0.85
omError2StringFunction · 0.85
_omPrintCurrentBackTraceFunction · 0.85

Tested by 3

omtTestDebugFunction · 0.68
TestAddrContentEqualFunction · 0.68
TestAddrContentFunction · 0.68