mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: bootstrap for backtrace functions cleanup
This commit is contained in:
parent
0701c9f204
commit
2c93deb884
@ -27,12 +27,9 @@ fn C.popen(c byteptr, t byteptr) voidptr
|
||||
|
||||
// <execinfo.h>
|
||||
// backtrace functions are not #included, that's why they have to be defined without C.
|
||||
fn backtrace(a voidptr, b int) int
|
||||
|
||||
fn backtrace_symbols(voidptr, int) &byteptr
|
||||
|
||||
|
||||
fn backtrace_symbols_fd(voidptr, int, int)
|
||||
fn backtrace(a &voidptr, b int) int
|
||||
fn backtrace_symbols(a &voidptr, size int) &charptr
|
||||
fn backtrace_symbols_fd(a &voidptr, size int, fd int) void
|
||||
// <libproc.h>
|
||||
fn proc_pidpath(int, voidptr, int) int
|
||||
|
||||
|
@ -69,7 +69,20 @@ typedef int (*qsort_callback_func)(const void*, const void*);
|
||||
#ifdef __cplusplus
|
||||
#include <utility>
|
||||
#define _MOV std::move
|
||||
#include <execinfo.h>
|
||||
#endif
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
int backtrace (void **__array, int __size) { return 0; }
|
||||
char **backtrace_symbols (void *const *__array, int __size){ return 0; }
|
||||
void backtrace_symbols_fd (void *const *__array, int __size, int __fd){}
|
||||
#else
|
||||
#ifndef _WIN32
|
||||
#if defined __has_include
|
||||
#if __has_include (<execinfo.h>)
|
||||
# include <execinfo.h>
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//#include "fns.h"
|
||||
|
@ -22,6 +22,12 @@ fn (mut g Gen) gen_fn_decl(it ast.FnDecl) {
|
||||
if g.attr == 'inline' {
|
||||
g.write('inline ')
|
||||
}
|
||||
if it.name in ['backtrace', 'backtrace_symbols', 'backtrace_symbols_fd'] {
|
||||
// these are actually defined as C functions in execinfo.h
|
||||
// TODO: remove this check, *after* they are defined as C. in cfns.c.v
|
||||
// in bootstrap phase 2
|
||||
return
|
||||
}
|
||||
//
|
||||
is_livefn := g.attr == 'live'
|
||||
is_livemain := g.pref.is_livemain && is_livefn
|
||||
|
Loading…
Reference in New Issue
Block a user