Group static constructors and destructors in specific subsections, take 2

Dave Korn dave.korn.cygwin@gmail.com
Thu Nov 11 21:41:00 GMT 2010


On 11/11/2010 18:55, Ralf Wildenhues wrote:
> * Jack Howarth wrote on Wed, Nov 10, 2010 at 06:44:42PM CET:
>> Honza,
>>    Isn't part of the problem due to...
>>
> 
>> --- doc/tm.texi	(revision 166490)
>> +++ doc/tm.texi	(working copy)
>> @@ -7335,6 +7335,8 @@ macro is not defined, nothing is output 
>>  @end defmac
>>  
>>  @deftypefn {Target Hook} void TARGET_ASM_NAMED_SECTION (const char *@var{name}, unsigned int @var{flags}, tree @var{decl})
>> +
>> +@deftypefn {Target Hook} {section *} TARGET_ASM_FUNCTION_SECTION (tree @var{decl}, enum node_frequency @var{freq}, bool @var{startup}, bool @var{exit})
>>  Output assembly directives to switch to section @var{name}.  The section
>>  should have attributes as specified by @var{flags}, which is a bit mask
>>  of the @code{SECTION_*} flags defined in @file{output.h}.  If @var{decl}
>>
>> This change adds a new @deftypefn without adding any text or the closing
>> @end deftypefn? There could be other issues as well but that doesn't seem
>> correct.
> 
> If this entry should be there, then it should be a @deftypefnx one,
> and without a preceding empty line.
> 
> You can wrap long @def* lines by ending the line with an @,
> and optional indenting spaces on the following line.

  The change is coming from genhooks, autogenerated based on the addition to
target.def.  It appears that if you add a new hook in target.def, but don't
add an @hook documentation paragraph in tm.texi.in to match, genhooks.c emits
the @deftype{fn,var} start marker along with the function name and parameters,
but then fails to enter this if clause in emit_documentation():

	      if (hook_array[i].doc[0])
		{
		  printf ("\n");
		  /* Print each documentation paragraph in turn.  */
		  for (doc = hook_array[i].doc; *doc; doc = p_end)
		    {
		      /* Find paragraph end.  */
		      p_end = strstr (doc, "\n\n");
		      p_end = (p_end ? p_end + 2 : doc + strlen (doc));
		      /* Print paragraph, emitting @Fcode as @code.  */
		      for (; (fcode = strstr (doc, "@Fcode{")) && fcode < p_end;
			   doc = fcode + 2)
			printf ("%.*s@", (int) (fcode - doc), doc);
		      printf ("%.*s", (int) (p_end - doc), doc);
		      /* Emit function indices for next paragraph.  */
		      emit_findices (p_end, name);
		    }
		  printf ("\n@end %s", deftype);
		}

... which is where the end directive gets emitted.  Genhooks should probably
fail more gracefully, but I imagine it is an error to add a new hook to
target.def without documenting it in tm.texi.in.  (If this isn't attempting to
enforce policy, then moving the final printf() outside the if condition should
do the trick.)


    cheers,
      DaveK



More information about the Gcc-patches mailing list