pike.git / src / error.c

version» Context lines:

pike.git/src/error.c:15:   #include "array.h"   #include "object.h"   #include "main.h"   #include "builtin_functions.h"   #include "backend.h"   #include "operators.h"   #include "module_support.h"   #include "threads.h"   #include "gc.h"    - RCSID("$Id: error.c,v 1.78 2001/11/08 23:34:28 nilsson Exp $"); + RCSID("$Id: error.c,v 1.79 2001/11/10 19:43:51 mast Exp $");      #undef ATTRIBUTE   #define ATTRIBUTE(X)    -  + PMOD_EXPORT const char msg_fatal_error[] = +  "%s:%d: Fatal error:\n"; + #ifdef PIKE_DEBUG + PMOD_EXPORT const char msg_unsetjmp_nosync_1[] = +  "UNSETJMP out of sync! (last SETJMP at %s)!\n"; + PMOD_EXPORT const char msg_unsetjmp_nosync_2[] = +  "UNSETJMP out of sync! (Pike_interpreter.recoveries = 0)\n"; + PMOD_EXPORT const char msg_last_setjmp[] = +  "LAST SETJMP: %s\n"; + PMOD_EXPORT const char msg_unset_onerr_nosync_1[] = +  "UNSET_ONERROR out of sync (%p != %p).\n" +  "Last SET_ONERROR is from %s\n"; + PMOD_EXPORT const char msg_unset_onerr_nosync_2[] = +  "UNSET_ONERROR out of sync. No Pike_interpreter.recoveries left.\n"; + PMOD_EXPORT const char msg_assert_onerr[] = +  "%s ASSERT_ONERROR(%p) failed\n"; + #endif + PMOD_EXPORT const char msg_bad_arg[] = +  "Bad argument %d to %s(). Expected %s\n"; + PMOD_EXPORT const char msg_too_few_args[] = +  "Too few arguments to %s().\n"; + PMOD_EXPORT const char msg_out_of_mem[] = +  "Out of memory.\n"; + PMOD_EXPORT const char msg_div_by_zero[] = +  "Division by zero.\n"; +    /*    * Attempt to inhibit throwing of errors if possible.    * Used by exit_on_error() to avoid infinite sprintf() loops.    */   int Pike_inhibit_errors = 0;      /*    * Recoveries handling.    */   
pike.git/src/error.c:250:    f_aggregate(2);       free_svalue(& throw_value);    throw_value = *--Pike_sp;    throw_severity=THROW_ERROR;       in_error=0;    pike_throw(); /* Hope someone is catching, or we will be out of balls. */   }    - PMOD_EXPORT void exit_on_error(void *msg) + PMOD_EXPORT void exit_on_error(const void *msg)   {    ONERROR tmp;    SET_ONERROR(tmp,fatal_on_error,"Fatal in exit_on_error!");    d_flag=0;       /* Tell sprintf(), describe_svalue() et al not to throw errors    * if possible.    */    Pike_inhibit_errors = 1;   
pike.git/src/error.c:294: Inside #if defined(__NT__)
  {    if (!d_flag && !getenv("PIKE_DEBUG")) {    exit(-6); /* -SIGIOT */    }    fnordel=999/fnordel;   }   #else /* !__NT__ */   #define do_abort() abort()   #endif /* __NT__ */    - PMOD_EXPORT void fatal_on_error(void *msg) + PMOD_EXPORT void fatal_on_error(const void *msg)   {   #ifdef PIKE_DEBUG    dump_backlog();   #endif    fprintf(stderr,"%s\n",(char *)msg);    do_abort();   }      PMOD_EXPORT DECLSPEC(noreturn) void Pike_error(const char *fmt,...) ATTRIBUTE((noreturn,format (printf, 1, 2)))   {
pike.git/src/error.c:516:    ERROR_STRUCT(STRUCT, o)->X.u.integer = 0; \    } \    } while (0)         #define ERROR_COPY_REF(STRUCT,X) \    add_ref( ERROR_STRUCT(STRUCT,o)->X=X )         DECLSPEC(noreturn) void generic_error_va(struct object *o, -  char *func, +  const char *func,    struct svalue *base_sp, int args, -  char *fmt, +  const char *fmt,    va_list foo)    ATTRIBUTE((noreturn))   {    char buf[8192];    int i;      #ifdef HAVE_VSNPRINTF    vsnprintf(buf, sizeof(buf)-1, fmt, foo);   #else /* !HAVE_VSNPRINTF */    /* Sentinel that will be overwritten on buffer overflow. */
pike.git/src/error.c:579:    in_error=0;       dmalloc_touch_svalue(& throw_value);       pike_throw(); /* Hope someone is catching, or we will be out of balls. */   }         PMOD_EXPORT DECLSPEC(noreturn) void throw_error_object(    struct object *o, -  char *func, +  const char *func,    struct svalue *base_sp, int args, -  char *desc, ...) ATTRIBUTE((noreturn,format (printf, 5, 6))) +  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 5, 6)))   {    va_list foo;    va_start(foo,desc);    ASSERT_THREAD_SWAPPED_IN();    DWERROR((stderr, "%s(): Throwing an error object\n", func));    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void generic_error( -  char *func, +  const char *func,    struct svalue *base_sp, int args, -  char *desc, ...) ATTRIBUTE((noreturn,format (printf, 4, 5))) +  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 4, 5)))   {    INIT_ERROR(generic);    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void index_error( -  char *func, +  const char *func,    struct svalue *base_sp, int args,    struct svalue *val,    struct svalue *ind, -  char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7))) +  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7)))   {    INIT_ERROR(index);    ERROR_COPY_SVALUE(index, val);    ERROR_COPY_SVALUE(index, ind);    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void bad_arg_error( -  char *func, +  const char *func,    struct svalue *base_sp, int args,    int which_arg, -  char *expected_type, +  const char *expected_type,    struct svalue *got, -  char *desc, ...) ATTRIBUTE((noreturn,format (printf, 7, 8))) +  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 7, 8)))   {    INIT_ERROR(bad_arg);    ERROR_COPY(bad_arg, which_arg);    ERROR_STRUCT(bad_arg,o)->expected_type=make_shared_string(expected_type);    if(got)    {    ERROR_COPY_SVALUE(bad_arg, got);    }else{    ERROR_STRUCT(bad_arg,o)->got.type=PIKE_T_INT;    ERROR_STRUCT(bad_arg,o)->got.subtype=NUMBER_UNDEFINED;    ERROR_STRUCT(bad_arg,o)->got.u.integer=0;    }    DWERROR((stderr, "%s():Bad arg %d (expected %s)\n",    func, which_arg, expected_type));    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void math_error( -  char *func, +  const char *func,    struct svalue *base_sp, int args,    struct svalue *number, -  char *desc, ...) ATTRIBUTE((noreturn,format (printf, 5, 6))) +  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 5, 6)))   {    INIT_ERROR(math);    if(number)    {    ERROR_COPY_SVALUE(math, number);    }else{    ERROR_STRUCT(math,o)->number.type=PIKE_T_INT;    ERROR_STRUCT(math,o)->number.subtype=NUMBER_UNDEFINED;    ERROR_STRUCT(math,o)->number.u.integer=0;    }    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void resource_error( -  char *func, +  const char *func,    struct svalue *base_sp, int args, -  char *resource_type, +  const char *resource_type,    size_t howmuch_, -  char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7))) +  const char *desc, ...) ATTRIBUTE((noreturn,format (printf, 6, 7)))   {    INT_TYPE howmuch = DO_NOT_WARN((INT_TYPE)howmuch_);    INIT_ERROR(resource);    ERROR_COPY(resource, howmuch);    ERROR_STRUCT(resource,o)->resource_type=make_shared_string(resource_type);    ERROR_DONE(generic);   }      PMOD_EXPORT DECLSPEC(noreturn) void permission_error( -  char *func, +  const char *func,    struct svalue *base_sp, int args, -  char *permission_type, -  char *desc, ...) ATTRIBUTE((noreturn, format(printf, 5, 6))) +  const char *permission_type, +  const char *desc, ...) ATTRIBUTE((noreturn, format(printf, 5, 6)))   {    INIT_ERROR(permission);    ERROR_STRUCT(permission,o)->permission_type=    make_shared_string(permission_type);    ERROR_DONE(generic);   }    - PMOD_EXPORT void wrong_number_of_args_error(char *name, int args, int expected) + PMOD_EXPORT void wrong_number_of_args_error(const char *name, int args, int expected)   {    char *msg;    if(expected>args)    {    msg="Too few arguments";    }else{    msg="Too many arguments";    }       new_error(name, msg, Pike_sp-args, args, 0,0);