From: Mathieu Desnoyers Date: Thu, 24 Oct 2024 21:05:40 +0000 (-0400) Subject: static checker: Make static checker opt-out rather than opt-in X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=a026396cb7e2792289e208b8b08e287f1cd982e3;p=libside.git 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 --- 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"