Skip to content

Commit

Permalink
Workaround for MCST-LCC compiler < 1.28 version
Browse files Browse the repository at this point in the history
mcst-lcc < 1.28 does not support __builtin_alloca_with_align()
Ref: http://mcst.ru/lcc
  • Loading branch information
r-a-sattarov committed Feb 2, 2024
1 parent 94a208e commit 784bf42
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions neo/sys/platform.h
Expand Up @@ -185,12 +185,14 @@ If you have questions concerning this license or the applicable additional terms
// Unix
#ifdef __unix__

#ifdef __GNUC__
#define _alloca16( x ) ( ({assert((x)<ID_MAX_ALLOCA_SIZE);}), __builtin_alloca_with_align( (x), 16*8 ) )
#define _alloca( x ) ( ({assert((x)<ID_MAX_ALLOCA_SIZE);}), __builtin_alloca( (x) ) )
#else
#if !defined(__GNUC__) || (defined(__MCST__) && __LCC__ < 128)
// MCST-LCC < 1.28 does not support __builtin_alloca_with_align()
#define _alloca( x ) (({assert( (x)<ID_MAX_ALLOCA_SIZE );}), alloca( (x) ))
#define _alloca16( x ) (({assert( (x)<ID_MAX_ALLOCA_SIZE );}),((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15)))
#else
// GCC, CLANG, MCST-LCC >= 1.28
#define _alloca16( x ) ( ({assert((x)<ID_MAX_ALLOCA_SIZE);}), __builtin_alloca_with_align( (x), 16*8 ) )
#define _alloca( x ) ( ({assert((x)<ID_MAX_ALLOCA_SIZE);}), __builtin_alloca( (x) ) )
#endif

#ifdef GAME_DLL
Expand Down

0 comments on commit 784bf42

Please sign in to comment.