mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
cgen: improve generated source compatibility with latest Alpine (lacking libexecinfo-dev and execinfo.h) and the prebuilt tcc (#16743)
This commit is contained in:
parent
e519bdf0eb
commit
3da4f37b01
@ -75,7 +75,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
|
||||
$if tinyc {
|
||||
C.tcc_backtrace(c'Backtrace')
|
||||
return false
|
||||
}
|
||||
} $else {
|
||||
buffer := [100]voidptr{}
|
||||
nr_ptrs := C.backtrace(&buffer[0], 100)
|
||||
if nr_ptrs < 2 {
|
||||
@ -124,6 +124,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
@ -318,6 +318,17 @@ const c_common_macros = '
|
||||
#define EMPTY_STRUCT_INITIALIZATION 0
|
||||
#endif
|
||||
|
||||
#ifndef _WIN32
|
||||
#if defined __has_include
|
||||
#if __has_include (<execinfo.h>)
|
||||
#include <execinfo.h>
|
||||
#else
|
||||
// On linux: int backtrace(void **__array, int __size);
|
||||
// On BSD: size_t backtrace(void **, size_t);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef __TINYC__
|
||||
#define _Atomic volatile
|
||||
#undef EMPTY_STRUCT_DECLARATION
|
||||
@ -333,7 +344,6 @@ const c_common_macros = '
|
||||
#define TCCSKIP(x)
|
||||
// #include <byteswap.h>
|
||||
#ifndef _WIN32
|
||||
#include <execinfo.h>
|
||||
int tcc_backtrace(const char *fmt, ...);
|
||||
#endif
|
||||
#endif
|
||||
@ -501,14 +511,6 @@ typedef int (*qsort_callback_func)(const void*, const void*);
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifndef _WIN32
|
||||
#if defined __has_include
|
||||
#if __has_include (<execinfo.h>)
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <stdarg.h> // for va_list
|
||||
|
||||
//================================== GLOBALS =================================*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user