aboutsummaryrefslogtreecommitdiff
path: root/gcc/system.h
diff options
context:
space:
mode:
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>2001-03-10 04:20:03 +0000
committerKaveh Ghazi <ghazi@gcc.gnu.org>2001-03-10 04:20:03 +0000
commitf4ce9d906750bad87642454a1cbf8a1b2c2261b0 (patch)
tree9c3fac38ed4b4a8e389d091650ec0193e59385b9 /gcc/system.h
parent0eac29848b3a5bee12b6f8ae6c64c82a9c0f61b1 (diff)
downloadgcc-f4ce9d906750bad87642454a1cbf8a1b2c2261b0.zip
gcc-f4ce9d906750bad87642454a1cbf8a1b2c2261b0.tar.gz
gcc-f4ce9d906750bad87642454a1cbf8a1b2c2261b0.tar.bz2
server.c (load_data, run_shell): Use xmalloc, xrealloc & xcalloc in lieu of malloc, realloc & calloc.
* fixinc/server.c (load_data, run_shell): Use xmalloc, xrealloc & xcalloc in lieu of malloc, realloc & calloc. * gencheck.c (xmalloc): Use really_call_malloc, not malloc. * gengenrtl.c (xmalloc): Likewise. * gensupport.c (xcalloc, xrealloc, xmalloc): Use the really_call_* memory allocation routines. * stmt.c (check_for_full_enumeration_handling): Use really_call_calloc, not calloc. * system.h (really_call_malloc, really_call_calloc, really_call_realloc): Define. (malloc, realloc, calloc, strdup, bzero, bcmp, rindex): Poison. f: * fini.c (main): Use really_call_malloc, not malloc. From-SVN: r40360
Diffstat (limited to 'gcc/system.h')
-rw-r--r--gcc/system.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/system.h b/gcc/system.h
index 8721f7e..0ea6c3f 100644
--- a/gcc/system.h
+++ b/gcc/system.h
@@ -577,4 +577,29 @@ typedef char _Bool;
#define TRUE true
#define FALSE false
+/* As the last action in this file, we poison the identifiers that
+ shouldn't be used. Note, luckily gcc-3.0's token-based integrated
+ preprocessor won't trip on poisoned identifiers that arrive from
+ the expansion of macros. E.g. #define strrchr rindex, won't error
+ if rindex is poisoned after this directive is issued and later on
+ strrchr is called.
+
+ Note: We define bypass macros for the few cases where we really
+ want to use the libc memory allocation routines. Otherwise we
+ insist you use the "x" versions from libiberty. */
+
+#define really_call_malloc malloc
+#define really_call_calloc calloc
+#define really_call_realloc realloc
+
+#if (GCC_VERSION >= 3000)
+
+ #pragma GCC poison malloc realloc calloc strdup
+
+/* Note: not all uses of `bcopy' and `index' (esp. variable names)
+ have been eliminated. */
+ #pragma GCC poison bzero bcmp rindex
+
+#endif /* GCC >= 3.0 */
+
#endif /* __GCC_SYSTEM_H__ */