Patchwork Updated: RFA: Fix microblaze ada --enable-werror-always build

login
register
mail settings
Submitter Joern Rennecke
Date Dec. 2, 2010, 5:04 a.m.
Message ID <20101202000411.af5fdi6hxsc888ks-nzlynne@webmail.spamcop.net>
Download mbox | patch
Permalink /patch/73933/
State New
Headers show

Comments

Joern Rennecke - Dec. 2, 2010, 5:04 a.m.
Oops, I forgot, we can use documentation from
svn://gcc.gnu.org/svn/gcc/trunk/gcc/tm.texi@41699 - that text was both
licensed under GPL and GFDL.

I've included documentation based on that and retested all-gcc build for
x86_64-pc-linux-gnu X microblaze-elf .
2010-12-02  Joern Rennecke  <amylaar@spamcop.net>

	PR46738
gcc:
	* targhooks.c (legacy_asm_output_ident): New function.
	* targhooks.h (legacy_asm_output_ident): Declare.
	* target.def (asm_out): New hook output_ident.
	* doc/tm.texi.in (TARGET_ASM_OUTPUT_IDENT): Indicate place for new
	hook.
	* doc/tm.texi: Regenerate.
gcc/c-family:
	* c-lex.c (cb_ident): Use targetm.asm_out.output_ident.
gcc/ada:
	* gcc-interface/Make-lang.in (ada/trans.o): Depend on $(TARGET_H).
	* gcc-interface/trans.c: Include target.h .
	(gigi): Use targetm.asm_out.output_ident .
Joseph S. Myers - Dec. 2, 2010, 1:29 p.m.
On Thu, 2 Dec 2010, Joern Rennecke wrote:

> Oops, I forgot, we can use documentation from
> svn://gcc.gnu.org/svn/gcc/trunk/gcc/tm.texi@41699 - that text was both
> licensed under GPL and GFDL.

Why do you think that?  It appears to me that it was under

Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
1999, 2000, 2001 Free Software Foundation, Inc.
@sp 1
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
@sp 1
@ignore
Permission is granted to process this file through Tex and print the
results, provided the printed document carries copying permission
notice identical to this one except for the removal of this paragraph
(this paragraph not being relevant to the printed manual).

@end ignore
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided also that the
sections entitled ``GNU General Public License'' and ``Funding for Free
Software'' are included exactly as in the original, and provided that 
the entire resulting derived work is distributed under the terms of a 
permission notice identical to this one.
@sp 1
Permission is granted to copy and distribute translations of this manual
into another language, under the above conditions for modified versions,
except that the sections entitled ``GNU General Public License'' and
``Funding for Free Software'', and this permission notice, may be 
included in translations approved by the Free Software Foundation 
instead of in the original English.

which is a copyleft (with invariant sections) that is neither GPL nor 
GFDL, and so incompatible with both.
Joern Rennecke - Dec. 2, 2010, 6:38 p.m.
Quoting "Joseph S. Myers" <joseph@codesourcery.com>:

> On Thu, 2 Dec 2010, Joern Rennecke wrote:
>
>> Oops, I forgot, we can use documentation from
>> svn://gcc.gnu.org/svn/gcc/trunk/gcc/tm.texi@41699 - that text was both
>> licensed under GPL and GFDL.
>
> Why do you think that?  It appears to me that it was under
...
> which is a copyleft (with invariant sections) that is neither GPL nor
> GFDL, and so incompatible with both.

The info files indeed were only put under RCS/CVS control in 1998, so I had
to dig in release tarballs.
Looking at gcc 1.21, I've found that the gcc info files were already under
this license before gcc.info was included.

However, I found another FSF source for this documentation under GPLv2+
licensing: In gcc-3.0/gcc/config/d30v/d30v.h

/* A C statement to output something to the assembler file to handle a  
`#ident'
    directive containing the text STRING.  If this macro is not  
defined, nothing
    is output for a `#ident' directive.

    Defined in svr4.h.  */
/* #define ASM_OUTPUT_IDENT(STREAM, STRING) */


For GFDL, we can use svn://gcc.gnu.org/svn/gcc/trunk/gcc/tm.texi@41700 or
later as source.

Patch

Index: doc/tm.texi
===================================================================
--- doc/tm.texi	(revision 167318)
+++ doc/tm.texi	(working copy)
@@ -7323,6 +7323,10 @@ 
 macro is not defined, nothing is output for a @samp{#ident} directive.
 @end defmac
 
+@deftypefn {Target Hook} void TARGET_ASM_OUTPUT_IDENT (FILE *@var{stream}, const char *@var{string})
+A hook to output something to the assembler file to handle a @samp{#ident} directive containing the text @var{string}.  The default uses ASM_OUTPUT_IDENT.
+@end deftypefn
+
 @deftypefn {Target Hook} void TARGET_ASM_NAMED_SECTION (const char *@var{name}, unsigned int @var{flags}, tree @var{decl})
 Output assembly directives to switch to section @var{name}.  The section
 should have attributes as specified by @var{flags}, which is a bit mask
Index: doc/tm.texi.in
===================================================================
--- doc/tm.texi.in	(revision 167318)
+++ doc/tm.texi.in	(working copy)
@@ -7298,6 +7298,8 @@ 
 macro is not defined, nothing is output for a @samp{#ident} directive.
 @end defmac
 
+@hook TARGET_ASM_OUTPUT_IDENT
+
 @hook TARGET_ASM_NAMED_SECTION
 Output assembly directives to switch to section @var{name}.  The section
 should have attributes as specified by @var{flags}, which is a bit mask
Index: targhooks.c
===================================================================
--- targhooks.c	(revision 167318)
+++ targhooks.c	(working copy)
@@ -371,6 +371,16 @@ 
   return false;
 }
 
+/* Implementation of TARGET_ASM_OUTPUT_IDENT using the old macro.  */
+void
+legacy_asm_output_ident (FILE *stream ATTRIBUTE_UNUSED,
+			 const char *string ATTRIBUTE_UNUSED)
+{
+#ifdef ASM_OUTPUT_IDENT
+  ASM_OUTPUT_IDENT (stream, string);
+#endif
+}
+
 /* True if MODE is valid for the target.  By "valid", we mean able to
    be manipulated in non-trivial ways.  In particular, this means all
    the arithmetic is supported.
Index: targhooks.h
===================================================================
--- targhooks.h	(revision 167318)
+++ targhooks.h	(working copy)
@@ -66,6 +66,7 @@ 
 extern void default_print_operand_address (FILE *, rtx);
 extern bool default_print_operand_punct_valid_p (unsigned char);
 extern bool default_asm_output_addr_const_extra (FILE *, rtx);
+extern void legacy_asm_output_ident (FILE *stream, const char *);
 
 extern bool default_scalar_mode_supported_p (enum machine_mode);
 extern bool targhook_words_big_endian (void);
Index: c-family/c-lex.c
===================================================================
--- c-family/c-lex.c	(revision 167318)
+++ c-family/c-lex.c	(working copy)
@@ -165,18 +165,16 @@ 
 	  unsigned int ARG_UNUSED (line),
 	  const cpp_string * ARG_UNUSED (str))
 {
-#ifdef ASM_OUTPUT_IDENT
   if (!flag_no_ident)
     {
       /* Convert escapes in the string.  */
       cpp_string cstr = { 0, 0 };
       if (cpp_interpret_string (pfile, str, 1, &cstr, CPP_STRING))
 	{
-	  ASM_OUTPUT_IDENT (asm_out_file, (const char *) cstr.text);
+	  targetm.asm_out.output_ident (asm_out_file, (const char *) cstr.text);
 	  free (CONST_CAST (unsigned char *, cstr.text));
 	}
     }
-#endif
 }
 
 /* Called at the start of every non-empty line.  TOKEN is the first
Index: target.def
===================================================================
--- target.def	(revision 167318)
+++ target.def	(working copy)
@@ -1,5 +1,6 @@ 
 /* Target hook definitions.
-   Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
+   Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+   2000,  2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
@@ -490,6 +491,18 @@ 
  bool, (FILE *file, rtx x),
  default_asm_output_addr_const_extra)
 
+/* Wrapper for ASM_OUTPUT_IDENT.  When the macro is eventually compiletely
+   eliminated, the default should be changed to hook_void_FILEptr_constcharptr,
+   and the last sentence of the documentation should read:
+   The default is to output nothing for a @samp{#ident} directive.  */
+DEFHOOK
+(output_ident,
+"A hook to output something to the assembler file to handle a\
+ @samp{#ident} directive containing the text @var{string}. \
+ The default uses ASM_OUTPUT_IDENT.",
+ void, (FILE *stream, const char *string),
+ legacy_asm_output_ident)
+
 /* ??? The TARGET_PRINT_OPERAND* hooks are part of the asm_out struct,
    even though that is not reflected in the macro name to override their
    initializers.  */
Index: ada/gcc-interface/Make-lang.in
===================================================================
--- ada/gcc-interface/Make-lang.in	(revision 167318)
+++ ada/gcc-interface/Make-lang.in	(working copy)
@@ -1246,7 +1246,7 @@ 
 	$(COMPILER) -c $(ALL_COMPILERFLAGS) -I.. $(ALL_CPPFLAGS) $< -o $@
 
 ada/trans.o : ada/gcc-interface/trans.c $(CONFIG_H) $(SYSTEM_H) coretypes.h \
-   $(TM_H) $(TREE_H) $(FLAGS_H) output.h tree-iterator.h  \
+   $(TM_H) $(TREE_H) $(FLAGS_H) output.h tree-iterator.h  $(TARGET_H) \
    $(GIMPLE_H) ada/gcc-interface/ada.h ada/adadecode.h ada/types.h \
    ada/atree.h ada/elists.h ada/namet.h ada/nlists.h ada/snames.h \
    ada/stringt.h ada/uintp.h ada/urealp.h ada/fe.h ada/sinfo.h ada/einfo.h \
Index: ada/gcc-interface/trans.c
===================================================================
--- ada/gcc-interface/trans.c	(revision 167318)
+++ ada/gcc-interface/trans.c	(working copy)
@@ -34,6 +34,7 @@ 
 #include "libfuncs.h"	/* For set_stack_check_libfunc.  */
 #include "tree-iterator.h"
 #include "gimple.h"
+#include "target.h"
 
 #include "ada.h"
 #include "adadecode.h"
@@ -591,12 +592,10 @@ 
   VEC_safe_push (tree, gc, gnu_program_error_label_stack, NULL_TREE);
 
   /* Process any Pragma Ident for the main unit.  */
-#ifdef ASM_OUTPUT_IDENT
   if (Present (Ident_String (Main_Unit)))
-    ASM_OUTPUT_IDENT
+    targetm.asm_out.output_ident
       (asm_out_file,
        TREE_STRING_POINTER (gnat_to_gnu (Ident_String (Main_Unit))));
-#endif
 
   /* If we are using the GCC exception mechanism, let GCC know.  */
   if (Exception_Mechanism == Back_End_Exceptions)