pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:8:   #include "error.h"   #include "interpret.h"   #include "stralloc.h"   #include "builtin_functions.h"   #include "array.h"   #include "object.h"      #undef ATTRIBUTE   #define ATTRIBUTE(X)    - char *automatic_fatal, *exit_on_error; +    JMP_BUF *recoveries=0;      JMP_BUF *init_recovery(JMP_BUF *r)   {    r->fp=fp;    r->sp=sp-evaluator_stack;    r->mark_sp=mark_sp - mark_stack;    r->previous=recoveries;    r->onerror=0;    recoveries=r;
pike.git/src/error.c:73:    {    char *tmp=in_error;    in_error=0;    fatal("Recursive error() calls, original error: %s",tmp);    }       in_error=buf;       VSPRINTF(buf, fmt, args);    -  if(automatic_fatal) +  if(!recoveries)    { -  fprintf(stderr,"%s %s",automatic_fatal,buf); -  abort(); -  } -  -  if(exit_on_error || !recoveries) -  { -  if(!exit_on_error) -  exit_on_error="No error recovery context: "; -  +    #ifdef DEBUG    dump_backlog();   #endif    -  fprintf(stderr,"%s %s",exit_on_error,buf); +  fprintf(stderr,"No error recovery context!\n%s",buf);    exit(99);    }       if((long)strlen(buf) >= (long)sizeof(buf))    fatal("Buffer overflow in error()\n");       push_string(make_shared_string(buf));    f_backtrace(0);    f_aggregate(2);    free_svalue(& throw_value);    sp--;    throw_value = *sp;       in_error=0;    throw(); /* Hope someone is catching, or we will be out of balls. */   }    -  + void exit_on_error(void *msg) + { + #ifdef DEBUG +  dump_backlog(); + #endif +  fprintf(stderr,"%s\n",(char *)msg); +  exit(1); + } +  + void fatal_on_error(void *msg) + { + #ifdef DEBUG +  dump_backlog(); + #endif +  fprintf(stderr,"%s\n",(char *)msg); +  abort(); + } +    void error(char *fmt,...) ATTRIBUTE((noreturn,format (printf, 1, 2)))   {    va_list args;    va_start(args,fmt);    va_error(fmt,args);    va_end(args);   }         void fatal(char *fmt, ...) ATTRIBUTE((noreturn,format (printf, 1, 2)))