[llvm-commits] [llvm-gcc-4.2] r54586 - in /llvm-gcc-4.2/trunk/gcc/cp: cp-tree.h decl2.c lex.c pt.c

Nick Lewycky nicholas at mxc.ca
Sat Aug 9 10:08:49 PDT 2008


Author: nicholas
Date: Sat Aug  9 12:08:49 2008
New Revision: 54586

URL: http://llvm.org/viewvc/llvm-project?rev=54586&view=rev
Log:
Reinstate clobbered r53456, this time with LLVM LOCAL notices.
Note that it's not really llvm local, since it's a backport of FSF GCC changes.

Modified:
    llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
    llvm-gcc-4.2/trunk/gcc/cp/decl2.c
    llvm-gcc-4.2/trunk/gcc/cp/lex.c
    llvm-gcc-4.2/trunk/gcc/cp/pt.c

Modified: llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h?rev=54586&r1=54585&r2=54586&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/cp-tree.h Sat Aug  9 12:08:49 2008
@@ -4155,6 +4155,9 @@
 extern void yyhook				(int);
 extern bool cxx_init				(void);
 extern void cxx_finish				(void);
+/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
+extern bool in_main_input_context		(void);
+/* LLVM LOCAL end */
 
 /* in method.c */
 extern void init_method				(void);
@@ -4237,6 +4240,9 @@
 extern bool reregister_specialization		(tree, tree, tree);
 extern tree fold_non_dependent_expr		(tree);
 extern bool explicit_class_specialization_p     (tree);
+/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
+extern tree outermost_tinst_level		(void);
+/* LLVM LOCAL end */
 
 /* in repo.c */
 extern void init_repo				(void);

Modified: llvm-gcc-4.2/trunk/gcc/cp/decl2.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/decl2.c?rev=54586&r1=54585&r2=54586&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/decl2.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/decl2.c Sat Aug  9 12:08:49 2008
@@ -1893,9 +1893,14 @@
 	int subvis = type_visibility (ftype);
 
 	if (subvis == VISIBILITY_ANON)
-	  warning (0, "\
+          /* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
+	  {
+	    if (!in_main_input_context ())
+	      warning (0, "\
 %qT has a field %qD whose type uses the anonymous namespace",
 		   type, t);
+	  }
+	  /* LLVM LOCAL end */
 	else if (IS_AGGR_TYPE (ftype)
 		 && vis < VISIBILITY_HIDDEN
 		 && subvis >= VISIBILITY_HIDDEN)
@@ -1910,9 +1915,14 @@
       int subvis = type_visibility (TREE_TYPE (t));
 
       if (subvis == VISIBILITY_ANON)
-	warning (0, "\
+        /* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
+        {
+	  if (!in_main_input_context())
+	    warning (0, "\
 %qT has a base %qT whose type uses the anonymous namespace",
 		 type, TREE_TYPE (t));
+	}
+      /* LLVM LOCAL end */
       else if (vis < VISIBILITY_HIDDEN
 	       && subvis >= VISIBILITY_HIDDEN)
 	warning (OPT_Wattributes, "\

Modified: llvm-gcc-4.2/trunk/gcc/cp/lex.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/lex.c?rev=54586&r1=54585&r2=54586&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/lex.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/lex.c Sat Aug  9 12:08:49 2008
@@ -877,3 +877,20 @@
 
   return t;
 }
+
+/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
+/* Returns true if we are currently in the main source file, or in a
+   template instantiation started from the main source file.  */
+
+bool
+in_main_input_context (void)
+{
+  tree tl = outermost_tinst_level();
+
+  if (tl)
+    return strcmp (main_input_filename,
+		   LOCATION_FILE (TINST_LOCATION (tl))) == 0;
+  else
+    return strcmp (main_input_filename, input_filename) == 0;
+}
+/* LLVM LOCAL end */

Modified: llvm-gcc-4.2/trunk/gcc/cp/pt.c
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/cp/pt.c?rev=54586&r1=54585&r2=54586&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/cp/pt.c (original)
+++ llvm-gcc-4.2/trunk/gcc/cp/pt.c Sat Aug  9 12:08:49 2008
@@ -5288,6 +5288,17 @@
   pop_tinst_level ();
 }
 
+/* LLVM LOCAL begin - Fix for GCC PR c++/29365 */
+/* Returns the TINST_LEVEL which gives the original instantiation
+   context.  */
+
+tree
+outermost_tinst_level (void)
+{
+  return tree_last (current_tinst_level);
+}
+/* LLVM LOCAL end */
+
 /* DECL is a friend FUNCTION_DECL or TEMPLATE_DECL.  ARGS is the
    vector of template arguments, as for tsubst.
 





More information about the llvm-commits mailing list