From 9efcc785aeae98b8d46b9d5727e4e38311f6b9b1 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Tue, 15 Mar 2022 11:11:26 +1300 Subject: [PATCH] Re-enable symbol poisoning in a CI job It seems too brittle to enable by default as we'd have to avoid including any system headers after doh.h, which is hard to enforce, but just having it enabled for one CI job should avoid uses of the poisoned symbols from being accidentally introduced. See #2223 --- .github/workflows/ci.yml | 2 ++ Source/DOH/doh.h | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bd83c3f64..e6a45c941 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,8 @@ jobs: matrix: include: - SWIGLANG: "" + env: + CPPFLAGS: -DDOH_POISON - SWIGLANG: "" GCC: 7 - SWIGLANG: "" diff --git a/Source/DOH/doh.h b/Source/DOH/doh.h index 7b74eac7b..af6b99664 100644 --- a/Source/DOH/doh.h +++ b/Source/DOH/doh.h @@ -488,7 +488,7 @@ extern void DohMemoryDebug(void); #define doh_internal_malloc malloc #define doh_internal_realloc realloc -#ifdef __GNUC__ +#if defined __GNUC__ && defined DOH_POISON /* Use Malloc(), Realloc(), Calloc(), and Free() instead (which will exit with * an error rather than return NULL). */ @@ -496,15 +496,11 @@ extern void DohMemoryDebug(void); /* This works around bison's template checking if malloc and free are defined, * which triggers GCC's poison checks. */ -/* # pragma GCC poison malloc free -# pragma GCC poison realloc calloc -*/ # endif +# pragma GCC poison realloc calloc /* Use Exit() instead (which will remove output files on error). */ -/* # pragma GCC poison abort exit -*/ #endif #endif /* DOH_H */