pike.git / src / pike_error.h

version» Context lines:

pike.git/src/pike_error.h:1:   /*   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: pike_error.h,v 1.45 2008/05/27 15:59:17 mast Exp $ + || $Id: pike_error.h,v 1.46 2008/05/27 17:35:34 grubba Exp $   */      #ifndef PIKE_ERROR_H   #define PIKE_ERROR_H      #include <stdarg.h>      #ifdef CONFIGURE_TEST      #include <stdio.h>
pike.git/src/pike_error.h:102: Inside #if defined(PIKE_DEBUG)
   void *arg;   #ifdef PIKE_DEBUG    const char *file;    int line;   #endif /* PIKE_DEBUG */   } ONERROR;      typedef struct JMP_BUF   {    struct JMP_BUF *previous; -  LOW_JMP_BUF recovery; +  volatile LOW_JMP_BUF recovery;    struct pike_frame *frame_pointer;    ptrdiff_t stack_pointer;    ptrdiff_t mark_sp;    INT32 severity;    ONERROR *onerror;   #ifdef PIKE_DEBUG    int line;    char *file;    int on_stack;   #endif   } JMP_BUF;      PMOD_EXPORT extern struct svalue throw_value;   extern int throw_severity;      #ifdef PIKE_DEBUG   PMOD_EXPORT extern const char msg_unsetjmp_nosync_1[];   PMOD_EXPORT extern const char msg_unsetjmp_nosync_2[]; - #define UNSETJMP(X) do{ \ -  check_recovery_context(); \ -  OED_FPRINTF((stderr, "unsetjmp(%p) %s:%d\n", \ -  &(X), __FILE__, __LINE__)); \ -  if(Pike_interpreter.recoveries != &X) { \ -  if(Pike_interpreter.recoveries) \ -  Pike_fatal(msg_unsetjmp_nosync_1,Pike_interpreter.recoveries->file); \ -  else \ -  Pike_fatal(msg_unsetjmp_nosync_2); \ -  } \ -  Pike_interpreter.recoveries=X.previous; \ -  check_recovery_context(); \ + #define UNSETJMP(X) do{ \ +  check_recovery_context(); \ +  OED_FPRINTF((stderr, "unsetjmp(%p) %s:%d\n", \ +  &(X), __FILE__, __LINE__)); \ +  if(Pike_interpreter.recoveries != &X) { \ +  if(Pike_interpreter.recoveries) \ +  Pike_fatal(msg_unsetjmp_nosync_1, \ +  Pike_interpreter.recoveries->file); \ +  else \ +  Pike_fatal(msg_unsetjmp_nosync_2); \ +  } \ +  Pike_interpreter.recoveries=X.previous; \ +  check_recovery_context(); \    }while (0)      #ifdef DMALLOC_LOCATION   #define PERR_LOCATION() DMALLOC_LOCATION()   #else   #define PERR_LOCATION() ( __FILE__ ":" DEFINETOSTR(__LINE__) )   #endif      #define DEBUG_INIT_REC_ARGS , int on_stack, char *location   #define SETJMP(X) LOW_SETJMP((init_recovery(&X, 0, 1, PERR_LOCATION())->recovery))
pike.git/src/pike_error.h:155:   #else /* !PIKE_DEBUG */   #define DEBUG_INIT_REC_ARGS   #define SETJMP(X) LOW_SETJMP((init_recovery(&X, 0)->recovery))   #define SETJMP_SP(jmp, stack_pop_levels) \    LOW_SETJMP((init_recovery(&jmp, stack_pop_levels)->recovery))   #define UNSETJMP(X) Pike_interpreter.recoveries=X.previous   #endif /* !PIKE_DEBUG */         #ifdef PIKE_DEBUG - #define SET_ONERROR(X,Y,Z) \ -  do{ \ -  check_recovery_context(); \ -  OED_FPRINTF((stderr, "SET_ONERROR(%p, %p, %p) %s:%d\n", \ -  &(X), (Y), (void *)(Z), __FILE__, __LINE__)); \ -  X.frame_pointer = Pike_interpreter.frame_pointer; \ -  X.func=(error_call)(Y); \ -  DO_IF_DMALLOC( if( X.func == free ) X.func=dmalloc_free;) \ -  X.arg=(void *)(Z); \ -  if(!Pike_interpreter.recoveries) break; \ -  X.previous=Pike_interpreter.recoveries->onerror; \ -  X.file = __FILE__; \ -  X.line = __LINE__; \ -  Pike_interpreter.recoveries->onerror=&X; \ + #define SET_ONERROR(X,Y,Z) \ +  do{ \ +  check_recovery_context(); \ +  OED_FPRINTF((stderr, "SET_ONERROR(%p, %p, %p) %s:%d\n", \ +  &(X), (Y), (void *)(Z), __FILE__, __LINE__)); \ +  X.frame_pointer = Pike_interpreter.frame_pointer; \ +  X.func=(error_call)(Y); \ +  DO_IF_DMALLOC( if( X.func == free ) X.func=dmalloc_free); \ +  X.arg=(void *)(Z); \ +  if(!Pike_interpreter.recoveries) break; \ +  X.previous=Pike_interpreter.recoveries->onerror; \ +  X.file = __FILE__; \ +  X.line = __LINE__; \ +  Pike_interpreter.recoveries->onerror=&X; \    }while(0)      PMOD_EXPORT extern const char msg_last_setjmp[];   PMOD_EXPORT extern const char msg_unset_onerr_nosync_1[];   PMOD_EXPORT extern const char msg_unset_onerr_nosync_2[]; - #define UNSET_ONERROR(X) do {\ -  check_recovery_context(); \ -  OED_FPRINTF((stderr, "UNSET_ONERROR(%p) %s:%d\n", \ -  &(X), __FILE__, __LINE__)); \ -  if(!Pike_interpreter.recoveries) break; \ -  if(Pike_interpreter.recoveries->onerror != &(X)) { \ -  fprintf(stderr,msg_last_setjmp,Pike_interpreter.recoveries->file); \ -  if (Pike_interpreter.recoveries->onerror) { \ -  Pike_fatal(msg_unset_onerr_nosync_1,\ -  Pike_interpreter.recoveries->onerror, &(X), \ + #define UNSET_ONERROR(X) do { \ +  check_recovery_context(); \ +  OED_FPRINTF((stderr, "UNSET_ONERROR(%p) %s:%d\n", \ +  &(X), __FILE__, __LINE__)); \ +  if(!Pike_interpreter.recoveries) break; \ +  if(Pike_interpreter.recoveries->onerror != &(X)) { \ +  fprintf(stderr,msg_last_setjmp, \ +  Pike_interpreter.recoveries->file); \ +  if (Pike_interpreter.recoveries->onerror) { \ +  Pike_fatal(msg_unset_onerr_nosync_1, \ +  Pike_interpreter.recoveries->onerror, &(X), \    Pike_interpreter.recoveries->onerror->file); \ -  } else { \ -  Pike_fatal(msg_unset_onerr_nosync_2); \ -  } \ -  } \ -  Pike_interpreter.recoveries->onerror=(X).previous; \ +  } else { \ +  Pike_fatal(msg_unset_onerr_nosync_2); \ +  } \ +  } \ +  Pike_interpreter.recoveries->onerror=(X).previous; \    } while(0)      PMOD_EXPORT extern const char msg_assert_onerr[];   #define ASSERT_ONERROR(X) \    do{ \    if (!Pike_interpreter.recoveries) break; \    if (Pike_interpreter.recoveries->onerror != &X) { \    Pike_fatal(msg_assert_onerr, \    __FILE__, __LINE__, &(X)); \    } \
pike.git/src/pike_error.h:248:   PMOD_EXPORT void Pike_vsnprintf(char *str, size_t size, const char *fmt, va_list ap);   void DECLSPEC(noreturn) va_error(const char *fmt, va_list args) ATTRIBUTE((noreturn));   PMOD_EXPORT DECLSPEC(noreturn) void new_error(const char *name, const char *text, struct svalue *oldsp,    INT32 args, const char *file, int line) ATTRIBUTE((noreturn));   PMOD_EXPORT void exit_on_error(const void *msg);   PMOD_EXPORT void fatal_on_error(const void *msg);   PMOD_EXPORT DECLSPEC(noreturn) void Pike_error(const char *fmt,...) ATTRIBUTE((noreturn));   PMOD_EXPORT DECLSPEC(noreturn) void debug_fatal(const char *fmt, ...) ATTRIBUTE((noreturn));   PMOD_EXPORT DECLSPEC(noreturn) void generic_error_va(    struct object *o, const char *func, const struct svalue *base_sp, int args, -  const char *fmt, va_list *fmt_args) +  const char *fmt, va_list fmt_args)    ATTRIBUTE((noreturn));   PMOD_EXPORT DECLSPEC(noreturn) void throw_error_object(    struct object *o,    const char *func,    struct svalue *base_sp, int args,    const char *desc, ...) ATTRIBUTE((noreturn));   PMOD_EXPORT void DECLSPEC(noreturn) generic_error(    const char *func,    struct svalue *base_sp, int args,    const char *desc, ...) ATTRIBUTE((noreturn));
pike.git/src/pike_error.h:324:      #define SIMPLE_WRONG_NUM_ARGS_ERROR(FUNC, ARG) \    wrong_number_of_args_error (FUNC, args, ARG)   /* The following is for compatibility. */   #define SIMPLE_TOO_FEW_ARGS_ERROR(FUNC, ARG) \    wrong_number_of_args_error (FUNC, args, ARG)      PMOD_EXPORT extern const char msg_out_of_mem[];   PMOD_EXPORT extern const char msg_out_of_mem_2[];    + #if 1   static INLINE void DECLSPEC(noreturn) out_of_memory_error (    const char *func,    struct svalue *base_sp, int args,    size_t amount) ATTRIBUTE((noreturn));   static INLINE void DECLSPEC(noreturn) out_of_memory_error (    const char *func,    struct svalue *base_sp, int args,    size_t amount)   {    resource_error (func, base_sp, args, "memory", amount,    amount ? msg_out_of_mem_2 : msg_out_of_mem, amount);   } -  + #else + #define out_of_memory_error(FUNC, BASE_SP, ARGS, AMOUNT) \ +  do { \ +  size_t amount_ = (AMOUNT); \ +  int args_ = (ARGS); \ +  resource_error((FUNC), (BASE_SP), args_, "memory", amount_, \ +  msg_out_of_mem_2, amount_); \ +  } while(0) + #endif      #define SIMPLE_OUT_OF_MEMORY_ERROR(FUNC, AMOUNT) \    out_of_memory_error(FUNC, Pike_sp-args, args, AMOUNT)      PMOD_EXPORT extern const char msg_div_by_zero[];   #define SIMPLE_DIVISION_BY_ZERO_ERROR(FUNC) \    math_error(FUNC, Pike_sp-args, args, 0, msg_div_by_zero)      #ifndef PIKE_DEBUG   #define check_recovery_context() ((void)0)