error.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * GTools C compiler
  3. * =================
  4. * source file :
  5. * error handling
  6. *
  7. * Copyright 2001-2004 Paul Froissart.
  8. * Credits to Christoph van Wuellen and Matthew Brandt.
  9. * All commercial rights reserved.
  10. *
  11. * This compiler may be redistributed as long there is no
  12. * commercial interest. The compiler must not be redistributed
  13. * without its full sources. This notice must stay intact.
  14. */
  15. #define error(x) uerr(x)
  16. #define ierr(f,n) err_int(((FUNC_##f)<<8)+n)
  17. #define uerr err_usr
  18. #define uerrc(m) uerr(ERR_OTH,m)
  19. #define uerrc2(m,a) uerr(ERR_OTH,m,a)
  20. #define uerrc3(m,a,b) uerr(ERR_OTH,m,a,b)
  21. #define uerrsys(m) uerr(ERR_SYS,m)
  22. #define iwarn(f,n) warn_int(((FUNC_##f)<<8)+n)
  23. #define uwarn warn_usr
  24. #ifdef PC
  25. #define _noreturn
  26. #define _err_attr
  27. #else
  28. #define _noreturn __attribute__((noreturn))
  29. #define _err_attr
  30. //#define _err_attr __attribute__((regparm(1)))
  31. #endif
  32. void _noreturn fatal(char *message);
  33. void _noreturn _err_attr err_int(int e);
  34. void _noreturn err_usr(int e,...);
  35. void _err_attr warn_int(int w);
  36. void warn_usr(char *w,...);
  37. // rules for adding new items : add them *ALWAYS* at the end
  38. enum {
  39. FUNC_NONE=0,
  40. /*$01*/ FUNC_ALIGNMENT, FUNC_MK_LEGAL, FUNC_COPY_ADDR, FUNC_G_DEREF, FUNC_G_UNARY,
  41. /*$06*/ FUNC_G_ADDSUB, FUNC_G_DIV, FUNC_G_MOD, FUNC_G_MUL, FUNC_G_HOOK, FUNC_G_ASADD,
  42. /*$0C*/ FUNC_G_ASXOR, FUNC_G_ASSHIFT, FUNC_G_ASMUL, FUNC_G_ASDIV, FUNC_G_ASMOD, FUNC_G_AINCDEC,
  43. /*$12*/ FUNC_G_PARMS, FUNC_REGPARM, FUNC_FUNC_RESULT, FUNC_G_CAST, FUNC_G_EXPR, FUNC_G_COMPARE,
  44. /*$18*/ FUNC_TRUEJP, FUNC_FALSEJP, FUNC_GENLOOP, FUNC_GENRETURN, FUNC_GENSTMT, FUNC_ADD_CODE,
  45. /*$1E*/ FUNC_ASM_GETSYM, FUNC_LISTING, FUNC_OPT0, FUNC_PASS3, FUNC_UNINIT_TEMP, __FUNC_UNUSED1,
  46. /*$24*/ FUNC_G_CODE, FUNC_PEEP_DELETE, FUNC_G_PUSH, FUNC_G_POP, FUNC_CHECKSTACK, FUNC_TEMP_DATA,
  47. /*$2A*/ FUNC_TEMP_ADDR, FUNC_FREEOP, FUNC_DOOPER, FUNC_PEEP_LABEL, FUNC_BBLK_INIT,
  48. /*$2F*/ FUNC_LINK_MISPL, FUNC_TABLE_HASH,
  49. /*$31*/ FUNC_WARN_LC_STK,
  50. };
  51. // vim:ts=4:sw=4