toolMacros.h
上传用户:luoyougen
上传日期:2008-05-12
资源大小:23136k
文件大小:1k
源码类别:

VxWorks

开发平台:

C/C++

  1. /* toolMacros.h - compile time macros for Diab C compiler */
  2. /* Copyright 2001 Wind River Systems, Alameda, CA */
  3. /*
  4. modification history
  5. --------------------
  6. 01d,26nov01,dat  New macros for alignment checking and unaligned copies
  7. 01c,14nov01,dat  Adding underscores to macro names
  8. 01b,18oct01,jab  fixed WRS_ASM macro
  9. 01a,04sep01,dat  written (assumes Diab 4.4b or later)
  10. */
  11. #ifndef __INCtoolMacrosh
  12. #define __INCtoolMacrosh
  13. #define _WRS_PACK_ALIGN(x) __attribute__((packed, aligned(x)))
  14. #define _WRS_ASM(x) __asm volatile (x)
  15. #define _WRS_DATA_ALIGN_BYTES(x) __attribute__((aligned(x)))
  16. /* This tool uses the ANSI variadic macro style */
  17. #undef _WRS_GNU_VAR_MACROS
  18. /* New macros for alignment issues */
  19. #define _WRS_ALIGNOF(x)  sizeof(x,1)
  20. #define _WRS_UNALIGNED_COPY(pSrc, pDest, size) 
  21. (memcpy ((pDest), (pSrc), (size)))
  22. #define _WRS_ALIGN_CHECK(ptr, type) 
  23. (((int)(ptr) & ( _WRS_ALIGNOF(type) - 1)) == 0 ? TRUE : FALSE)
  24. /*
  25.  * For backward compatibility with v5 of portable C coding guide.
  26.  *
  27.  * These are now obsolete, please don't use them.
  28.  */
  29. #define WRS_PACK_ALIGN(x) _WRS_PACK_ALIGN(x)
  30. #define WRS_ASM(x)  _WRS_ASM(x)
  31. #define WRS_DATA_ALIGN_BYTES(x) _WRS_DATA_ALIGN_BYTES(x)
  32. #undef WRS_GNU_VAR_MACROS
  33. #endif /* __INCtoolMacrosh */