Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] chore: fix gcc 13 build errors #56

Merged
merged 7 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: lwnode actions
on: [ push, pull_request ]
jobs:
build_lwnode:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
fail-fast: false
Expand All @@ -24,7 +24,7 @@ jobs:
- name: Install Packages
run: |
sudo apt update
sudo apt install -y ninja-build gcc-multilib g++-multilib sed clang-format-8
sudo apt install -y ninja-build gcc-multilib g++-multilib sed
- name: Build lwnode
run: |
./configure.py ${{ matrix.config }}
Expand All @@ -40,7 +40,7 @@ jobs:
test/parallel test/regression
popd
cctest:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
timeout-minutes: 30
steps:
- name: Checkout source
Expand Down Expand Up @@ -117,17 +117,20 @@ jobs:
name: tizen_std_${{ matrix.profile }}
path: /home/runner/GBS-ROOT/${{ matrix.profile }}/local/repos/${{ matrix.profile }}/armv7l/RPMS/
lint:
runs-on: ubuntu-latest
runs-on: ubuntu-20.04
timeout-minutes: 30
strategy:
fail-fast: false
steps:
- name: Checkout source
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Packages
run: |
sudo apt update
sudo apt install -y ninja-build gcc-multilib g++-multilib sed clang-format-8
- name: Lint CC
run: |
python2 ./tools/check_tidy.py --filter=$(paste -sd, tools/lint-filters.txt)
tools/check_tidy.py --filter=$(paste -sd, tools/lint-filters.txt)
10 changes: 4 additions & 6 deletions src/api-exception.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,16 @@ v8::TryCatch::~TryCatch() {
}

void* v8::TryCatch::operator new(size_t) {
LWNODE_UNIMPLEMENT;
return new TryCatch(nullptr);
std::abort();
}
void* v8::TryCatch::operator new[](size_t) {
LWNODE_UNIMPLEMENT;
return new TryCatch(nullptr);
std::abort();
}
void v8::TryCatch::operator delete(void*, size_t) {
LWNODE_UNIMPLEMENT;
std::abort();
}
void v8::TryCatch::operator delete[](void*, size_t) {
LWNODE_UNIMPLEMENT;
std::abort();
}

bool v8::TryCatch::HasCaught() const {
Expand Down
27 changes: 10 additions & 17 deletions src/api-handles.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,10 @@ HandleScope::~HandleScope() {
}

void* HandleScope::operator new(size_t) {
LWNODE_UNIMPLEMENT;
// TODO: abort : only stack is available
return new HandleScope(nullptr);
std::abort();
}
void* HandleScope::operator new[](size_t) {
LWNODE_UNIMPLEMENT;
return new HandleScope(nullptr);
std::abort();
}
void HandleScope::operator delete(void*, size_t) {
LWNODE_UNIMPLEMENT;
Expand Down Expand Up @@ -120,18 +117,16 @@ i::Address* EscapableHandleScope::Escape(i::Address* escape_value) {
}

void* EscapableHandleScope::operator new(size_t) {
LWNODE_UNIMPLEMENT;
return new EscapableHandleScope(nullptr);
std::abort();
}
void* EscapableHandleScope::operator new[](size_t) {
LWNODE_UNIMPLEMENT;
return new EscapableHandleScope(nullptr);
std::abort();
}
void EscapableHandleScope::operator delete(void*, size_t) {
LWNODE_UNIMPLEMENT;
std::abort();
}
void EscapableHandleScope::operator delete[](void*, size_t) {
LWNODE_UNIMPLEMENT;
std::abort();
}

SealHandleScope::SealHandleScope(Isolate* isolate)
Expand All @@ -147,18 +142,16 @@ SealHandleScope::~SealHandleScope() {
}

void* SealHandleScope::operator new(size_t) {
LWNODE_UNIMPLEMENT;
return new SealHandleScope(nullptr);
std::abort();
}
void* SealHandleScope::operator new[](size_t) {
LWNODE_UNIMPLEMENT;
return new SealHandleScope(nullptr);
std::abort();
}
void SealHandleScope::operator delete(void*, size_t) {
LWNODE_UNIMPLEMENT;
std::abort();
}
void SealHandleScope::operator delete[](void*, size_t) {
LWNODE_UNIMPLEMENT;
std::abort();
}

void Context::Enter() {
Expand Down
2 changes: 1 addition & 1 deletion src/api/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ class GCHeap : public gc {
void* data = nullptr;
};
typedef GC_word GC_heap_pointer;
typedef std::pair<GC_heap_pointer, AddressInfo> HeapSegment;
typedef std::pair<const GC_heap_pointer, AddressInfo> HeapSegment;

void acquire(void* address, Kind kind, void* data);
void release(void* address, Kind kind);
Expand Down
2 changes: 1 addition & 1 deletion src/api/utils/logger/logger-impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ Logger& Logger::flush() {

void StdOut::flush(std::stringstream& stream,
std::shared_ptr<Output::Config> config) {
std::cerr << stream.str();
fprintf(stderr, "%s", stream.str().c_str());
}

// --- Option ---
Expand Down
2 changes: 2 additions & 0 deletions src/api/utils/logger/logger-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

#include <string>

#ifndef __FILE_NAME__
#define __FILE_NAME__ \
(strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
#endif

#define __FUNCTION_NAME__ getPrettyFunctionName(__PRETTY_FUNCTION__)

Expand Down
3 changes: 0 additions & 3 deletions src/api/utils/sf-vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ class Vector {

void erase(size_t start, size_t end) {
if (start == end) return;
assert(start >= 0);
assert(end <= m_size);

size_t howMuch = end - start;
Expand Down Expand Up @@ -351,7 +350,6 @@ class Vector {

size_t end = start + sizeToErase;
assert(start < end);
assert(start >= 0);
assert(end <= m_size);

size_t c = end - start;
Expand Down Expand Up @@ -384,7 +382,6 @@ class Vector {

size_t end = start + sizeToErase;
assert(start < end);
assert(start >= 0);
assert(end <= m_size);

size_t c = end - start;
Expand Down
6 changes: 3 additions & 3 deletions tools/check_tidy.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@

# note: this uses `black` for formatting.

from __future__ import print_function

import os
import subprocess
import sys
Expand Down Expand Up @@ -96,7 +94,9 @@ def report_error(msg, line=None):

with open(file, "r") as f:
original = f.readlines()
formatted = subprocess.check_output([clang_format, "-style=file", file])
formatted = subprocess.check_output(
[clang_format, "-style=file", file], encoding="utf-8"
)

if update:
with open(file, "w") as f:
Expand Down
12 changes: 12 additions & 0 deletions tools/patch/01-escargot-gcc13-build-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
diff --git raw/src/api/EscargotPublic.h fix/src/api/EscargotPublic.h
index 3a8362a9..6fc888d1 100644
--- raw/src/api/EscargotPublic.h
+++ fix/src/api/EscargotPublic.h
@@ -30,6 +30,7 @@

#include <cstdlib>
#include <cstddef>
+#include <cstdint>
#include <cstring>
#include <string>
#include <vector>
4 changes: 4 additions & 0 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ git submodule update --init
pushd deps/escargot
git submodule update --init third_party

# Patch update code for escargot
find ../../tools/patch -type f -name "*escargot*.patch" \
-exec patch -p1 --forward -r /dev/null -i {} \;

# Patch update code for wasm
pushd third_party/wasm/wabt
patch -p0 --forward -r /dev/null -i ../../../tools/test/wasm-js/wabt_patch
Expand Down
Loading