[F] Fix compilation for tcc

This commit is contained in:
seleznevae 2019-11-29 23:40:06 +03:00
parent 5731d45ae1
commit c3f9f302a3
4 changed files with 16 additions and 6 deletions

View File

@ -4,6 +4,10 @@
- Fix undefined behavior due to incorrect usage of `isprint` function. - Fix undefined behavior due to incorrect usage of `isprint` function.
### Internal
- Fix compilation for compilers other than gcc, clang, msvc.
## v0.3.1 ## v0.3.1
### Bug fixes ### Bug fixes

View File

@ -436,7 +436,10 @@ extern "C" {
#define utf8_restrict __restrict #define utf8_restrict __restrict
#define utf8_weak __inline #define utf8_weak __inline
#else #else
#error Non clang, non gcc, non MSVC compiler found! #define utf8_nonnull
#define utf8_pure
#define utf8_restrict
#define utf8_weak
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus
@ -3566,7 +3569,7 @@ char g_col_separator = FORT_DEFAULT_COL_SEPARATOR;
* LIBFORT helpers * LIBFORT helpers
*****************************************************************************/ *****************************************************************************/
#ifndef FT_MICROSOFT_COMPILER #if defined(FT_GCC_COMPILER) || defined(FT_CLANG_COMPILER)
void *(*fort_malloc)(size_t size) = &malloc; void *(*fort_malloc)(size_t size) = &malloc;
void (*fort_free)(void *ptr) = &free; void (*fort_free)(void *ptr) = &free;
void *(*fort_calloc)(size_t nmemb, size_t size) = &calloc; void *(*fort_calloc)(size_t nmemb, size_t size) = &calloc;
@ -3637,7 +3640,7 @@ void set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void *ptr))
|| (f_malloc != NULL && f_free != NULL) /* Use custom functions */); || (f_malloc != NULL && f_free != NULL) /* Use custom functions */);
if (f_malloc == NULL && f_free == NULL) { if (f_malloc == NULL && f_free == NULL) {
#ifndef FT_MICROSOFT_COMPILER #if defined(FT_GCC_COMPILER) || defined(FT_CLANG_COMPILER)
fort_malloc = &malloc; fort_malloc = &malloc;
fort_free = &free; fort_free = &free;
fort_calloc = &calloc; fort_calloc = &calloc;

View File

@ -14,7 +14,7 @@ char g_col_separator = FORT_DEFAULT_COL_SEPARATOR;
* LIBFORT helpers * LIBFORT helpers
*****************************************************************************/ *****************************************************************************/
#ifndef FT_MICROSOFT_COMPILER #if defined(FT_GCC_COMPILER) || defined(FT_CLANG_COMPILER)
void *(*fort_malloc)(size_t size) = &malloc; void *(*fort_malloc)(size_t size) = &malloc;
void (*fort_free)(void *ptr) = &free; void (*fort_free)(void *ptr) = &free;
void *(*fort_calloc)(size_t nmemb, size_t size) = &calloc; void *(*fort_calloc)(size_t nmemb, size_t size) = &calloc;
@ -85,7 +85,7 @@ void set_memory_funcs(void *(*f_malloc)(size_t size), void (*f_free)(void *ptr))
|| (f_malloc != NULL && f_free != NULL) /* Use custom functions */); || (f_malloc != NULL && f_free != NULL) /* Use custom functions */);
if (f_malloc == NULL && f_free == NULL) { if (f_malloc == NULL && f_free == NULL) {
#ifndef FT_MICROSOFT_COMPILER #if defined(FT_GCC_COMPILER) || defined(FT_CLANG_COMPILER)
fort_malloc = &malloc; fort_malloc = &malloc;
fort_free = &free; fort_free = &free;
fort_calloc = &calloc; fort_calloc = &calloc;

View File

@ -71,7 +71,10 @@ extern "C" {
#define utf8_restrict __restrict #define utf8_restrict __restrict
#define utf8_weak __inline #define utf8_weak __inline
#else #else
#error Non clang, non gcc, non MSVC compiler found! #define utf8_nonnull
#define utf8_pure
#define utf8_restrict
#define utf8_weak
#endif #endif
#ifdef __cplusplus #ifdef __cplusplus