From b0b20071a88dc98e28c4d1369c0e266e00bdece1 Mon Sep 17 00:00:00 2001 From: "Matthew \"strager\" Glazar" Date: Fri, 3 Nov 2023 23:28:37 -0400 Subject: [PATCH] feat(build): add QUICK_LINT_JS_FEATURE_EXTRA_DEBUG The QLJS_DEBUG macro is used in a few places but is not set by a build system knob. Add QUICK_LINT_JS_FEATURE_EXTRA_DEBUG which, when enabled, causes QLJS_SLOW_ASSERT and other things to activate. --- .github/workflows/build-and-test.yml | 2 +- CMakeLists.txt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 6babaadcbe..dc40e35c26 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -23,7 +23,7 @@ jobs: - {runs_on: ubuntu-latest, name: "GCC 10 ASAN+UBSAN", container: "ghcr.io/quick-lint/quick-lint-js-github-gcc:v1", CC: gcc-10, CXX: g++-10, CFLAGS: "-fsanitize=address,undefined -fsanitize-address-use-after-scope -fno-sanitize-recover=address,undefined -fuse-ld=gold", CMAKE_BUILD_TYPE: "Debug", WARNINGS: "-Werror;{0}", CMAKE_FLAGS: "-G Ninja", ASAN_OPTIONS: "strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"} - {runs_on: ubuntu-latest, name: "GCC 10 Release", container: "ghcr.io/quick-lint/quick-lint-js-github-gcc:v1", CC: gcc-10, CXX: g++-10, CFLAGS: "", CMAKE_BUILD_TYPE: "Release", WARNINGS: "-Werror;{0}"} # TODO(strager): Enable Ninja for this job. - - {runs_on: ubuntu-latest, name: "GCC 10 dev", container: "ghcr.io/quick-lint/quick-lint-js-github-gcc:v1", CC: gcc-10, CXX: g++-10, CFLAGS: "", CMAKE_BUILD_TYPE: "Debug", WARNINGS: "-Werror;{0}", CMAKE_FLAGS: "-DQUICK_LINT_JS_FEATURE_DEBUG_SERVER=ON -DQUICK_LINT_JS_FEATURE_VECTOR_PROFILING=ON"} + - {runs_on: ubuntu-latest, name: "GCC 10 dev", container: "ghcr.io/quick-lint/quick-lint-js-github-gcc:v1", CC: gcc-10, CXX: g++-10, CFLAGS: "", CMAKE_BUILD_TYPE: "Debug", WARNINGS: "-Werror;{0}", CMAKE_FLAGS: "-DQUICK_LINT_JS_FEATURE_DEBUG_SERVER=ON -DQUICK_LINT_JS_FEATURE_EXTRA_DEBUG=ON -DQUICK_LINT_JS_FEATURE_VECTOR_PROFILING=ON"} # TODO(strager): Also test MinGW-based builds. - {runs_on: windows-latest, name: "MSVC", CFLAGS: "", CMAKE_BUILD_TYPE: "Debug", WARNINGS: ""} - {runs_on: windows-latest, name: "MSVC Release", CFLAGS: "", CMAKE_BUILD_TYPE: "Release", WARNINGS: ""} diff --git a/CMakeLists.txt b/CMakeLists.txt index 711a69c949..c2053cf093 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -125,6 +125,11 @@ option( "Enable the HTTP monitoring server at run-time" FALSE ) +option( + QUICK_LINT_JS_FEATURE_EXTRA_DEBUG + "Enable extra slow debug checking at run-time" + FALSE +) option( QUICK_LINT_JS_FEATURE_VECTOR_PROFILING "Enable the QLJS_DUMP_VECTORS option at run-time" @@ -147,6 +152,9 @@ quick_lint_js_disable_unwanted_warnings() if (WIN32) add_definitions(-D_WIN32_WINNT=0x0602) endif () +if (QUICK_LINT_JS_FEATURE_EXTRA_DEBUG) + add_compile_definitions(QLJS_DEBUG) +endif () # HACK(strager): Work around issues with CI. We should consider using # find_package(Python3) instead.