This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Patch to "poison" bcmp/bzero/rindex


 > From: Richard Henderson <rth@redhat.com>
 > 
 > On Sun, Nov 12, 2000 at 05:37:52PM -0500, Kaveh R. Ghazi wrote:
 > > +#if GCC_VERSION >= 2097
 > 
 > Why?  Trying to figure out if "GCC poison" exists?


Correct.  (I only need this check in system.h, not tsystem.h.)


 > > +#ifndef memset
 > > + #pragma GCC poison bzero
 > > +#endif
 > 
 > This makes this patch useless on glibc systems, which is probably
 > where the bulk of development is done.  Undefining the symbol is
 > almost better, but frankly I wouldn't worry about it at all.
 > r~


Okay.  I'll start with the "not worry about it at all" approach and if
some platform complains I'll refine it.  How about this?



2000-11-11  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* system.h (bzero, bcmp, rindex): Poison these identifiers.

	* tsystem.h (bzero, bcmp, rindex): Likewise.

diff -rup orig/egcs-CVS20001112/gcc/system.h egcs-CVS20001112/gcc/system.h
--- orig/egcs-CVS20001112/gcc/system.h	Thu Nov  9 10:17:55 2000
+++ egcs-CVS20001112/gcc/system.h	Mon Nov 13 14:30:32 2000
@@ -597,4 +597,14 @@ extern void *alloca (__SIZE_TYPE__);
 #endif /* ! __FUNCTION__ */
 #endif
 
+/* Ensure we don't use the BSD style functions in our source code by
+   poisoning those tokens.  */
+#if GCC_VERSION >= 2097
+/*#pragma GCC poison index*/
+ #pragma GCC poison rindex
+/*#pragma GCC poison bcopy*/
+ #pragma GCC poison bzero
+ #pragma GCC poison bcmp
+#endif /* GCC >= 2.97 */
+
 #endif /* __GCC_SYSTEM_H__ */
diff -rup orig/egcs-CVS20001112/gcc/tsystem.h egcs-CVS20001112/gcc/tsystem.h
--- orig/egcs-CVS20001112/gcc/tsystem.h	Tue Feb  1 16:24:43 2000
+++ egcs-CVS20001112/gcc/tsystem.h	Mon Nov 13 14:30:16 2000
@@ -83,4 +83,12 @@ extern int errno;
 #define NULL 0
 #endif
 
+/* Ensure we don't use the BSD style functions in our source code by
+   poisoning those tokens.  */
+/*#pragma GCC poison index*/
+ #pragma GCC poison rindex
+/*#pragma GCC poison bcopy*/
+ #pragma GCC poison bzero
+ #pragma GCC poison bcmp
+
 #endif /* __GCC_TSYSTEM_H__ */

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]