From ac4b0a2740153d424bd0ee5bd0e39800aa55d800 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sat, 4 Mar 2023 19:34:47 +0800 Subject: [PATCH] set clang as default --- .github/workflows/main.yml | 5 +++++ .gitignore | 1 + build_cpp.sh | 2 +- build_linux.sh | 2 +- compile_flags.txt | 4 ++++ src/common.h | 2 +- src/parser.h | 1 + 7 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 compile_flags.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 673f0c52..836b668b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,6 +50,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 + - name: Set up Clang + uses: egor-tensin/setup-clang@v1 + with: + version: 15 + platform: x64 - name: Compiling run: | bash build_cpp.sh diff --git a/.gitignore b/.gitignore index d2b3cd85..410b3d99 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ __pycache__/ .vscode .ipynb_checkpoints .DS_Store +.hidden src/main gmon.out diff --git a/build_cpp.sh b/build_cpp.sh index 974a6df7..920b10a9 100644 --- a/build_cpp.sh +++ b/build_cpp.sh @@ -1 +1 @@ -g++ -o pocketpy src/main.cpp -Wfatal-errors --std=c++17 -O2 -Wall -Wno-sign-compare -Wno-unused-variable -fno-rtti \ No newline at end of file +clang++ -o pocketpy src/main.cpp -Wfatal-errors --std=c++17 -O2 -Wall -Wno-sign-compare -Wno-unused-variable -fno-rtti \ No newline at end of file diff --git a/build_linux.sh b/build_linux.sh index df8d7aea..6b7e2560 100644 --- a/build_linux.sh +++ b/build_linux.sh @@ -1,3 +1,3 @@ echo '#include "pocketpy.h"' > src/tmp.cpp -g++ -fPIC -shared -o pocketpy.so src/tmp.cpp --std=c++17 -O2 -Wall -Wno-sign-compare -Wno-unused-variable -fno-rtti +clang++ -fPIC -shared -o pocketpy.so src/tmp.cpp --std=c++17 -O2 -Wall -Wno-sign-compare -Wno-unused-variable -fno-rtti rm src/tmp.cpp \ No newline at end of file diff --git a/compile_flags.txt b/compile_flags.txt new file mode 100644 index 00000000..8667be6c --- /dev/null +++ b/compile_flags.txt @@ -0,0 +1,4 @@ +-xc++ +-Wall +-W* +-std=c++17 \ No newline at end of file diff --git a/src/common.h b/src/common.h index d5c2547b..a8ec0df0 100644 --- a/src/common.h +++ b/src/common.h @@ -81,6 +81,6 @@ const float kInstAttrLoadFactor = 0.67; const float kTypeAttrLoadFactor = 0.5; // do extra check for debug -#define PK_EXTRA_CHECK +// #define PK_EXTRA_CHECK } // namespace pkpy \ No newline at end of file diff --git a/src/parser.h b/src/parser.h index 7f98fc8d..9f9197e9 100644 --- a/src/parser.h +++ b/src/parser.h @@ -1,5 +1,6 @@ #pragma once +#include "error.h" #include "obj.h" namespace pkpy{