Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenaligncheck.h
Go to the documentation of this file.
00001 /* 00002 aligncheck: Some insane hacking to ensure stack alignment on library entry. 00003 00004 copyright 2010 by the mpg123 project - free software under the terms of the LGPL 2.1 00005 see COPYING and AUTHORS files in distribution or http://mpg123.org 00006 00007 intially written by Thomas Orgis 00008 00009 Include this header once at the appropriate place. It is not supposed for general use... 00010 */ 00011 00012 00013 #define ALIGNCHECK(mh) 00014 #define ALIGNCHECKK 00015 /* On compilers that support data alignment but not the automatic stack realignment. 00016 We check for properly aligned stack before risking a crash because of badly compiled 00017 client program. */ 00018 #if (defined CCALIGN) && (defined NEED_ALIGNCHECK) && ((defined DEBUG) || (defined CHECK_ALIGN)) 00019 00020 /* Common building block. */ 00021 #define ALIGNMAINPART \ 00022 /* minimum size of 16 bytes, not all compilers would align a smaller piece of data */ \ 00023 double ALIGNED(16) altest[2]; \ 00024 debug2("testing alignment, with %lu %% 16 = %lu", \ 00025 (unsigned long)altest, (unsigned long)((size_t)altest % 16)); \ 00026 if((size_t)altest % 16 != 0) 00027 00028 #undef ALIGNCHECK 00029 #define ALIGNCHECK(mh) \ 00030 ALIGNMAINPART \ 00031 { \ 00032 error("Stack variable is not aligned! Your combination of compiler/library is dangerous!"); \ 00033 if(mh != NULL) mh->err = MPG123_BAD_ALIGN; \ 00034 \ 00035 return MPG123_ERR; \ 00036 } 00037 #undef ALIGNCHECKK 00038 #define ALIGNCHECKK \ 00039 ALIGNMAINPART \ 00040 { \ 00041 error("Stack variable is not aligned! Your combination of compiler/library is dangerous!"); \ 00042 return MPG123_BAD_ALIGN; \ 00043 } 00044 00045 #endif Generated on Sat May 26 2012 04:31:58 for ReactOS by
1.7.6.1
|