Sync error.c completely and create a custom error printer
Make sure the custom error printer never ends with fatal errors terminating the application.
This commit is contained in:
parent
c56047be5a
commit
f82218ab07
@ -40,7 +40,7 @@ extern bool stderrDefaultErrorPrinter (const errorSelection selection,
|
||||
#endif
|
||||
fputs ("\n", stderr);
|
||||
|
||||
return false;
|
||||
return (selected (selection, FATAL) || Option.fatalWarnings)? true: false;
|
||||
}
|
||||
|
||||
extern void error (const errorSelection selection,
|
||||
@ -50,7 +50,7 @@ extern void error (const errorSelection selection,
|
||||
bool shouldExit;
|
||||
|
||||
va_start (ap, format);
|
||||
shouldExit = false;
|
||||
shouldExit = (* errorPrinter) (selection, format, ap, errorPrinterData);
|
||||
va_end (ap);
|
||||
|
||||
if (shouldExit)
|
||||
|
@ -29,16 +29,35 @@
|
||||
#include "output.h"
|
||||
#include "options.h"
|
||||
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
typedef struct {
|
||||
TMCtagsNewTagCallback tag_callback;
|
||||
TMCtagsPassStartCallback pass_callback;
|
||||
gpointer user_data;
|
||||
} CallbackUserData;
|
||||
|
||||
extern bool nofatalErrorPrinter (const errorSelection selection,
|
||||
const char *const format,
|
||||
va_list ap, void *data CTAGS_ATTR_UNUSED)
|
||||
{
|
||||
fprintf (stderr, "%s: ", (selection & WARNING) ? "Warning: " : "Error");
|
||||
vfprintf (stderr, format, ap);
|
||||
if (selection & PERROR)
|
||||
#ifdef HAVE_STRERROR
|
||||
fprintf (stderr, " : %s", strerror (errno));
|
||||
#else
|
||||
perror (" ");
|
||||
#endif
|
||||
fputs ("\n", stderr);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void tm_ctags_init(void)
|
||||
{
|
||||
setErrorPrinter (stderrDefaultErrorPrinter, NULL);
|
||||
setErrorPrinter (nofatalErrorPrinter, NULL);
|
||||
setTagWriter (&ctagsWriter);
|
||||
|
||||
checkRegex ();
|
||||
|
Loading…
x
Reference in New Issue
Block a user