| 1 |
/* |
| 2 |
abi_align: ABI and alignment stuff for library builds. |
| 3 |
|
| 4 |
Original use was the definitions for avoiding breakage because of mixing |
| 5 |
compilers with different alignment. Then, the switchery for building |
| 6 |
DLLs got lumped in. |
| 7 |
|
| 8 |
copyright 1995-2023 by the mpg123 project |
| 9 |
free software under the terms of the LGPL 2.1 |
| 10 |
see COPYING and AUTHORS files in distribution or http://mpg123.org |
| 11 |
|
| 12 |
There used to be code that checks alignment, but it did not really |
| 13 |
work anyway. The only straw we have is putting that alignment |
| 14 |
attribute to API functions. |
| 15 |
*/ |
| 16 |
|
| 17 |
#ifndef MPG123_H_ABI_ALIGN |
| 18 |
#define MPG123_H_ABI_ALIGN |
| 19 |
|
| 20 |
#include "config.h" |
| 21 |
|
| 22 |
// Building any of our libs on/for Windows needs this before |
| 23 |
// including the main API header (define MPG123_EXPORT). |
| 24 |
#if defined(WIN32) && defined(DYNAMIC_BUILD) |
| 25 |
#define BUILD_MPG123_DLL |
| 26 |
#endif |
| 27 |
|
| 28 |
/* ABI conformance for other compilers. |
| 29 |
mpg123 needs 16byte-aligned (or more) stack for SSE and friends. |
| 30 |
gcc provides that, but others don't necessarily. */ |
| 31 |
#ifdef ABI_ALIGN_FUN |
| 32 |
|
| 33 |
#ifndef attribute_align_arg |
| 34 |
|
| 35 |
#if defined(__GNUC__) && (__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__>1) |
| 36 |
# define attribute_align_arg __attribute__((force_align_arg_pointer)) |
| 37 |
/* The gcc that can align the stack does not need the check... nor does it work with gcc 4.3+, anyway. */ |
| 38 |
#else |
| 39 |
# define attribute_align_arg |
| 40 |
#endif |
| 41 |
|
| 42 |
#endif /* attribute_align_arg */ |
| 43 |
|
| 44 |
#else /* ABI_ALIGN_FUN */ |
| 45 |
|
| 46 |
#define attribute_align_arg |
| 47 |
|
| 48 |
#endif /* ABI_ALIGN_FUN */ |
| 49 |
|
| 50 |
#endif /* MPG123_H_ABI_ALIGN */ |