summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlly Betts <olly@survex.com>2022-03-15 11:11:26 +1300
committerOlly Betts <olly@survex.com>2022-03-15 11:14:23 +1300
commit9efcc785aeae98b8d46b9d5727e4e38311f6b9b1 (patch)
tree0493f25771cea3a99500407ec0a8415c34971af1
parent250afd6dc3b5f3aec2b13fb97655bd4b68b28cc2 (diff)
downloadswig-9efcc785aeae98b8d46b9d5727e4e38311f6b9b1.tar.gz
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
-rw-r--r--.github/workflows/ci.yml2
-rw-r--r--Source/DOH/doh.h8
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 */