This is the mail archive of the gcc@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: Projects for beginners


 > From: "Zack Weinberg" <zackw@Stanford.EDU>
 > 
 > The sentence beginning "this is useful..." is really awkward.  Something
 > like
 > 
 > 	This means that if you poison an identifier, you need not worry
 > 	about system headers defining macros that use it.  For instance,
 > 	if your system headers define @code{memcpy} in terms of the BSD
 > 	@code{bcopy} function, it is still safe to poison @code{bcopy}.
 > 
 > would be clearer, IMO - it needs a bit of work to tie it into the
 > surrounding text.
 > zw

IMHO, your example text regarding memcpy/bcopy simply repeated what I
showed in the rindex/strrchr example.  So I rearranged it a bit and
merged the two.  Here's what I've got now.

OK for head and branch?

		--Kaveh


2001-03-10  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>

	* cpp.texi (poison): Explain the macro expansion exception.

diff -rup orig/egcs-CVS20010312/gcc/cpp.texi egcs-CVS20010312/gcc/cpp.texi
--- orig/egcs-CVS20010312/gcc/cpp.texi	Sat Mar  3 06:32:32 2001
+++ egcs-CVS20010312/gcc/cpp.texi	Mon Mar 12 22:42:21 2001
@@ -1601,6 +1601,22 @@ sprintf(some_string, "hello");
 @noindent
 will produce an error.
 
+Note, if the poisoned identifier appears through the result of macro
+expansion it @emph{won't} cause an error.  So if you poison an
+identifier you need not worry about system headers defining macros that
+use it.
+
+For example,
+
+@example
+#define strrchr rindex
+#pragma GCC poison rindex
+strrchr(some_string, 'h');
+@end example
+
+@noindent
+will not produce an error.
+
 @node Macro Pitfalls,, Poisoning, Macros
 @subsection Pitfalls and Subtleties of Macros
 @cindex problems with macros


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