From a026396cb7e2792289e208b8b08e287f1cd982e3 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 24 Oct 2024 17:05:40 -0400 Subject: [PATCH] static checker: Make static checker opt-out rather than opt-in Users must explicitly define SIDE_STATIC_CHECK_DISABLE to opt-out from the libside static checker. Change-Id: I517303e03d124a94000c2f974c9e55ab646bc87e Signed-off-by: Mathieu Desnoyers --- include/side/api.h | 9 +++++---- tests/static-checker/prologue.c | 1 - tests/unit/test-sc-cxx.cpp | 1 - tests/unit/test-sc.c | 1 - 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/include/side/api.h b/include/side/api.h index 0fb3d91..53ea790 100644 --- a/include/side/api.h +++ b/include/side/api.h @@ -581,11 +581,12 @@ #define side_declare_event _side_declare_event /* - * Static checking is opt-in because it might not work on specific - * compilers and it slows down the preprocessor. + * Define SIDE_STATIC_CHECK_DISABLE to opt-out from static checking, + * in case it does not work on your specific compiler or slows down + * the preprocessor too much. */ -#ifdef SIDE_STATIC_CHECK_ENABLE +#ifndef SIDE_STATIC_CHECK_DISABLE # include -#endif /* SIDE_STATIC_CHECK_ENABLE */ +#endif /* SIDE_STATIC_CHECK_DISABLE */ #endif /* _SIDE_API_H */ diff --git a/tests/static-checker/prologue.c b/tests/static-checker/prologue.c index 412b89c..70ecd12 100644 --- a/tests/static-checker/prologue.c +++ b/tests/static-checker/prologue.c @@ -1,2 +1 @@ -#define SIDE_STATIC_CHECK_ENABLE #include diff --git a/tests/unit/test-sc-cxx.cpp b/tests/unit/test-sc-cxx.cpp index c5eacf0..2f5a469 100644 --- a/tests/unit/test-sc-cxx.cpp +++ b/tests/unit/test-sc-cxx.cpp @@ -1,2 +1 @@ -#define SIDE_STATIC_CHECK_ENABLE #include "test-cxx.cpp" diff --git a/tests/unit/test-sc.c b/tests/unit/test-sc.c index 547e6bc..1873518 100644 --- a/tests/unit/test-sc.c +++ b/tests/unit/test-sc.c @@ -1,2 +1 @@ -#define SIDE_STATIC_CHECK_ENABLE #include "test.c" -- 2.34.1