remove C++ std limitation for linux and android

This commit is contained in:
ekibun
2020-08-26 23:38:16 +08:00
parent e0000ac2d6
commit ba35352b2a
22 changed files with 35 additions and 110 deletions

View File

@@ -3,7 +3,7 @@
* @Author: ekibun
* @Date: 2020-08-08 10:30:59
* @LastEditors: ekibun
* @LastEditTime: 2020-08-20 11:11:30
* @LastEditTime: 2020-08-26 23:35:20
*/
#pragma once
@@ -53,7 +53,8 @@ namespace qjs
void handleException(qjs::Value exc)
{
std::cout << getStackTrack(exc) << std::endl;
printf("%s", getStackTrack(exc).c_str());
std::cout << std::endl;
}
public:
@@ -125,7 +126,7 @@ namespace qjs
if (err <= 0)
{
if (err < 0)
std::cout << getStackTrack(ctx.getException()) << std::endl;
handleException(ctx.getException());
break;
}
}

View File

@@ -37,12 +37,6 @@
#include <malloc.h>
#endif
#if defined(__ANDROID__)
#include <android/log.h>
#undef printf
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "qjs", __VA_ARGS__)
#endif
#ifdef _MSC_VER
#include <WinSock2.h>
@@ -1704,7 +1698,7 @@ static inline size_t js_def_malloc_usable_size(void *ptr)
return malloc_size(ptr);
#elif defined(_WIN32)
return _msize(ptr);
#elif defined(EMSCRIPTEN)
#elif defined(EMSCRIPTEN) || defined(__ANDROID__)
return 0;
#elif defined(__linux__)
return malloc_usable_size(ptr);
@@ -1778,7 +1772,7 @@ static const JSMallocFunctions def_malloc_funcs = {
malloc_size,
#elif defined(_WIN32)
(size_t (*)(const void *))_msize,
#elif defined(EMSCRIPTEN)
#elif defined(EMSCRIPTEN) || defined(__ANDROID__)
NULL,
#elif defined(__linux__)
(size_t (*)(const void *))malloc_usable_size,

View File

@@ -28,6 +28,11 @@
#include <stdio.h>
#include <stdint.h>
#if defined(__ANDROID__)
#include <android/log.h>
#define printf(...) __android_log_print(ANDROID_LOG_INFO, "qjs", __VA_ARGS__)
#endif
#ifdef __cplusplus
extern "C" {
#endif