Compare commits

..

No commits in common. "10c53e0621c95ba9aa255bbf4258ef6b0686ffbf" and "ef9b4779f44cd63d05a471c0b7bea4feb14e4db0" have entirely different histories.

8 changed files with 6 additions and 34 deletions

View File

@ -64,10 +64,6 @@ jobs:
bash build_g.sh
bash run_tests.sh
rm -rf ./main
- name: Run Script Check
run: |
python scripts/check_pragma_once.py include
python scripts/check_undef.py src
- name: Unit Test with Coverage
run: bash run_tests.sh
- name: Upload coverage reports to Codecov

View File

@ -4,7 +4,7 @@ python prebuild.py
SRC=$(find src/ -name "*.c")
clang -std=c11 --coverage -O1 -Wfatal-errors -o main src2/main.c $SRC -Iinclude -DPK_ENABLE_OS=1 -lm -ldl -DNDEBUG
clang -std=c11 --coverage -O1 -Wfatal-errors -o main src2/main.c $SRC -Iinclude -DPK_ENABLE_OS=1 -DPK_ENABLE_PROFILER=1 -lm -ldl -DNDEBUG
python scripts/run_tests.py
@ -17,17 +17,8 @@ rm -rf .coverage
mkdir .coverage
UNITS=$(find ./ -name "*.gcno")
llvm-cov-17 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
llvm-cov-15 gcov ${UNITS} -r -s include/ -r -s src/ >> .coverage/coverage.txt
mv *.gcov .coverage
rm *.gcda
rm *.gcno
# remove .gcno files if the 1st line contains "Source:src/debugger/"
find .coverage/ -type f -name "*.gcov" | while read -r file; do
first_line=$(head -n 1 "$file")
if [[ "$first_line" == *"Source:src/debugger/"* ]]; then
echo "Removing: $file"
rm "$file"
fi
done

View File

@ -1,7 +1,5 @@
import re
whitelist = {'K', 'equal', 'V', 'less', 'NAME'}
def check_define_undef_pairs(code):
# 使用正则表达式匹配#define和#undef指令
define_pattern = re.compile(r'#define\s+(\w+)')
@ -11,9 +9,6 @@ def check_define_undef_pairs(code):
defines = define_pattern.findall(code)
undefs = undef_pattern.findall(code)
defines = [x for x in defines if x not in whitelist]
undefs = [x for x in undefs if x not in whitelist]
# 使用集合计算差集,找出不匹配的部分
define_set = set(defines)
undef_set = set(undefs)
@ -26,13 +21,11 @@ def check_define_undef_pairs(code):
print("mismatched #define")
for define in unmatched_defines:
print(f"- {define}")
exit(1)
if unmatched_undefs:
print("mismatched #undef")
for undef in unmatched_undefs:
print(f"- {undef}")
exit(1)
# iterate over all the files in `path` directory

View File

@ -220,10 +220,4 @@ void c11_thrdpool__join(c11_thrdpool *pool) {
c11_thrdpool_debug_log(-1, "All %d tasks completed, `sync_val` was reset.", num_tasks);
}
#undef C11_THRDPOOL_DEBUG
#ifdef c11_thrdpool_debug_log
#undef c11_thrdpool_debug_log
#endif
#endif // PK_ENABLE_THREADS

View File

@ -28,8 +28,7 @@
#define DECLARE_HANDLE_FN(name) void c11_dap_handle_##name(py_Ref arguments, c11_sbuf*);
DAP_COMMAND_LIST(DECLARE_HANDLE_FN)
#undef DECLARE_HANDLE_FN
#undef DECLARE_ARG_FN
typedef void (*c11_dap_arg_parser_fn)(py_Ref, c11_sbuf*);
@ -44,7 +43,6 @@ static dap_command_entry dap_command_table[] = {
};
#undef DAP_ENTRY
#undef DAP_COMMAND_LIST
static struct c11_dap_server {
int dap_next_seq;
@ -131,11 +129,12 @@ void c11_dap_handle_setBreakpoints(py_Ref arguments, c11_sbuf* buffer) {
PK_FREE((void*)sourcename);
}
static void c11_dap_build_ExceptionInfo(const char* exc_type, const char* exc_message, c11_sbuf* buffer) {
inline static void c11_dap_build_ExceptionInfo(const char* exc_type, const char* exc_message, c11_sbuf* buffer) {
const char* safe_type = exc_type ? exc_type : "UnknownException";
const char* safe_message = exc_message ? exc_message : "No additional details available";
c11_sv type_sv = {.data = safe_type, .size = strlen(safe_type)};
c11_sv message_sv = {.data = safe_message, .size = strlen(safe_message)};
c11_sbuf combined_buffer;
c11_sbuf__ctor(&combined_buffer);

View File

@ -1445,6 +1445,7 @@ bool pk_format_object(VM* self, py_Ref val, c11_sv spec) {
return true;
}
#undef CHECK_RETURN_FROM_EXCEPT_OR_FINALLY
#undef DISPATCH
#undef DISPATCH_JUMP
#undef DISPATCH_JUMP_ABSOLUTE

View File

@ -6,7 +6,6 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef WIN32_LEAN_AND_MEAN
#else
#include <dlfcn.h>

View File

@ -5,7 +5,6 @@
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <conio.h>
#undef WIN32_LEAN_AND_MEAN
#elif PY_SYS_PLATFORM == 3 || PY_SYS_PLATFORM == 5