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: ppc-eabi: interaction betwen section name attributes and -msdata


On 06-Jul-2001, J.T. Conklin <jtc@redback.com> wrote:
> 2001-07-06  J.T. Conklin  <jtc@redback.com>
> 
> 	* config/rs6000/rs6000.c (rs6000_encode_section_info): ...
> 	Fixed off by one errors comparing section attributes
> 	and small data section names.
>
	len = TREE_STRING_LENGTH (section_name);        
...
> - 	      && ((len == sizeof (".sdata") - 1
> + 	      && ((len == sizeof (".sdata")

It would be nice to document that TREE_STRING_LENGTH is supposed
to include the trailing null character, if any, to help avoid
such off-by-one errors in the future.
Oh, now that I look for it, I see that this is documented in c-tree.texi.
But is it worth documenting in tree.h too?

2000-07-07  Fergus Henderson  <fjh@cs.mu.oz.au>

	* tree.h (struct tree_string): Document that length includes
	  trailing NUL.

Index: tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.h,v
retrieving revision 1.251
diff -u -d -u -r1.251 tree.h
--- tree.h	2001/06/29 17:21:12	1.251
+++ tree.h	2001/07/07 06:19:32
@@ -712,7 +712,7 @@
   struct tree_common common;
   struct rtx_def *rtl;	/* acts as link to register transfer language
 				   (rtl) info */
-  int length;
+  int length; /* in bytes; includes trailing NUL, if any */
   const char *pointer;
 };
 
-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
The University of Melbourne         |  of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh>  |     -- the last words of T. S. Garp.


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