Skip to content

Commit

Permalink
Removing alloca compat include.
Browse files Browse the repository at this point in the history
  • Loading branch information
bkaradzic committed Dec 22, 2024
1 parent 7dc7dfc commit 61cc316
Show file tree
Hide file tree
Showing 15 changed files with 16 additions and 655 deletions.
1 change: 0 additions & 1 deletion include/bx/bx.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#ifndef BX_H_HEADER_GUARD
#define BX_H_HEADER_GUARD

#include <alloca.h> // alloca
#include <stdarg.h> // va_list
#include <stddef.h> // ptrdiff_t
#include <stdint.h> // uint32_t
Expand Down
2 changes: 1 addition & 1 deletion include/bx/inline/readerwriter.inl
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ namespace bx
const uint32_t tmp0 = uint32_sels(64 - _size, 64, _size);
const uint32_t tmp1 = uint32_sels(256 - _size, 256, tmp0);
const uint32_t blockSize = uint32_sels(1024 - _size, 1024, tmp1);
uint8_t* temp = (uint8_t*)alloca(blockSize);
uint8_t* temp = (uint8_t*)BX_STACK_ALLOC(blockSize);
memSet(temp, _byte, blockSize);

int32_t size = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/bx/inline/string.inl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ namespace bx
int32_t len = vsnprintf(out, sizeof(temp), _format, _argList);
if (int32_t(sizeof(temp) ) < len)
{
out = (char*)alloca(len);
out = (char*)BX_STACK_ALLOC(len);
len = vsnprintf(out, len, _format, _argList);
}
_out.append(out, out+len);
Expand Down
3 changes: 3 additions & 0 deletions include/bx/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
# define BX_PRINTF_ARGS(_format, _args) __attribute__( (format(__printf__, _format, _args) ) )
# define BX_THREAD_LOCAL __thread
# define BX_ATTRIBUTE(_x) __attribute__( (_x) )
# define BX_STACK_ALLOC(_size) __builtin_alloca(_size)

# if BX_CRT_MSVC
# define __stdcall
Expand All @@ -80,6 +81,8 @@
# define BX_PRINTF_ARGS(_format, _args)
# define BX_THREAD_LOCAL __declspec(thread)
# define BX_ATTRIBUTE(_x)
extern "C" void* __cdecl _alloca(size_t _size);
# define BX_STACK_ALLOC(_size) ::_alloca(_size)
#else
# error "Unknown BX_COMPILER_?"
#endif
Expand Down
5 changes: 0 additions & 5 deletions include/compat/freebsd/alloca.h

This file was deleted.

6 changes: 0 additions & 6 deletions include/compat/mingw/alloca.h

This file was deleted.

1 change: 0 additions & 1 deletion include/compat/msvc/alloca.h

This file was deleted.

306 changes: 0 additions & 306 deletions include/compat/msvc/inttypes.h

This file was deleted.

Loading

0 comments on commit 61cc316

Please sign in to comment.