Patchwork Fix PR42843 to use built compilers

login
register
mail settings
Submitter Jack Howarth
Date July 11, 2010, 4:44 a.m.
Message ID <20100711044416.GA15826@bromo.med.uc.edu>
Download mbox | patch
Permalink /patch/58507/
State New
Headers show

Comments

Jack Howarth - July 11, 2010, 4:44 a.m.
The previous fix for PR testsuite/42843 (r160461) incorrectly
set PLUGINCC and PLUGINCFLAGS to the values for the host
compiler rather than the built compiler. The attached patch
uses ENABLE_BUILD_WITH_CXX to conditionally set PLUGINCC
to either CC or CXX and PLUGINCFLAGS to either CFLAGS or
CXXFLAGS. The patch also adds the missing include of
diagnostic.h for those testcases that require warning() to
be defined. Bootstrapped and regression tested with --enable-build-with-cxx
on x86_64-apple-darwin10. Okay for gcc trunk?
                  Jack

2010-07-10  Jack Howarth  <howarth@bromo.med.uc.edu>

        PR testsuite/42843
        * gcc/Makefile.in: Define PLUGINCC and PLUGINCFLAGS
	conditionally on ENABLE_BUILD_WITH_CXX.
	* gcc.dg/plugin/selfassign.c: Include diagnostic.h.
	* gcc.dg/plugin/ggcplug.c: Likewise.
	* g++.dg/plugin/selfassign.c: Likewise.
	* g++.dg/plugin/attribute_plugin.c: Likewise.
	* g++.dg/plugin/dumb_plugin.c: Likewise.
	* g++.dg/plugin/pragma_plugin.c: Likewise.
Joern Rennecke - July 11, 2010, 12:46 p.m.
Quoting Jack Howarth <howarth@bromo.med.uc.edu>:

>   The previous fix for PR testsuite/42843 (r160461) incorrectly
> set PLUGINCC and PLUGINCFLAGS to the values for the host
> compiler rather than the built compiler.

Actually, it's the build compiler vs. built (target) compiler.
And using the build compiler is right in the non-bootstrap case.
Even in the boostrap case, it only makes a difference if there
is an incompatibly between the build compiler and the stage2/
stage3 AKA target compiler.

> The attached patch
> uses ENABLE_BUILD_WITH_CXX to conditionally set PLUGINCC
> to either CC or CXX and PLUGINCFLAGS to either CFLAGS or
> CXXFLAGS.

As I said before in the PR, this still uses the build compiler even when
you bootstrap.
Rainer Orth - July 12, 2010, 8:56 p.m.
Joern Rennecke <amylaar@spamcop.net> writes:

> Quoting Jack Howarth <howarth@bromo.med.uc.edu>:
>
>>   The previous fix for PR testsuite/42843 (r160461) incorrectly
>> set PLUGINCC and PLUGINCFLAGS to the values for the host
>> compiler rather than the built compiler.
>
> Actually, it's the build compiler vs. built (target) compiler.
> And using the build compiler is right in the non-bootstrap case.
> Even in the boostrap case, it only makes a difference if there
> is an incompatibly between the build compiler and the stage2/
> stage3 AKA target compiler.

... which is likely to be the case.  The problem is biggest if you
bootstrap with some vendor compiler, but I've also observed the problem
when bootstrapping on Solaris 8 and 9 with GCC 4.4: while 4.5 and
mainline provide their own <stdint.h>, GCC 4.4 does not and the host OS
lacks it, so all plugin tests fail.  Even if you add
-I$(objdir)/gcc/include to fetch the mainline-provided file, this
doesn't work because it references macros like __INT_LEAST8_TYPE__ that
aren't defined by pre-4.5 GCCs.  One could instead use the stage1
headers where configure was run with the build compiler, but that breaks
down with make bootstrap-lean.

Your change for PR testsuite/42843 introduced a regression from 4.5.

	Rainer
Joern Rennecke - July 14, 2010, 8:29 p.m.
Quoting Jack Howarth <howarth@bromo.med.uc.edu>:

...
> The patch also adds the missing include of
> diagnostic.h for those testcases that require warning() to
> be defined.

Could you re-submit this bit separately?

Patch

Index: gcc/testsuite/gcc.dg/plugin/selfassign.c
===================================================================
--- gcc/testsuite/gcc.dg/plugin/selfassign.c	(revision 162051)
+++ gcc/testsuite/gcc.dg/plugin/selfassign.c	(working copy)
@@ -14,6 +14,7 @@ 
 #include "tree-pass.h"
 #include "intl.h"
 #include "plugin-version.h"
+#include "diagnostic.h"
 
 int plugin_is_GPL_compatible;
 
Index: gcc/testsuite/gcc.dg/plugin/ggcplug.c
===================================================================
--- gcc/testsuite/gcc.dg/plugin/ggcplug.c	(revision 162051)
+++ gcc/testsuite/gcc.dg/plugin/ggcplug.c	(working copy)
@@ -13,6 +13,7 @@ 
 #include "intl.h"
 #include "gcc-plugin.h"
 #include "plugin-version.h"
+#include "diagnostic.h"
 
 int plugin_is_GPL_compatible;
 
Index: gcc/testsuite/g++.dg/plugin/selfassign.c
===================================================================
--- gcc/testsuite/g++.dg/plugin/selfassign.c	(revision 162051)
+++ gcc/testsuite/g++.dg/plugin/selfassign.c	(working copy)
@@ -14,6 +14,7 @@ 
 #include "tree-pass.h"
 #include "intl.h"
 #include "plugin-version.h"
+#include "diagnostic.h"
 
 int plugin_is_GPL_compatible;
 
Index: gcc/testsuite/g++.dg/plugin/attribute_plugin.c
===================================================================
--- gcc/testsuite/g++.dg/plugin/attribute_plugin.c	(revision 162051)
+++ gcc/testsuite/g++.dg/plugin/attribute_plugin.c	(working copy)
@@ -10,6 +10,7 @@ 
 #include "intl.h"
 #include "toplev.h"
 #include "plugin.h"
+#include "diagnostic.h"
 
 int plugin_is_GPL_compatible;
 
Index: gcc/testsuite/g++.dg/plugin/dumb_plugin.c
===================================================================
--- gcc/testsuite/g++.dg/plugin/dumb_plugin.c	(revision 162051)
+++ gcc/testsuite/g++.dg/plugin/dumb_plugin.c	(working copy)
@@ -10,6 +10,7 @@ 
 #include "tree-pass.h"
 #include "intl.h"
 #include "toplev.h"
+#include "diagnostic.h"
 
 int plugin_is_GPL_compatible;
 
Index: gcc/testsuite/g++.dg/plugin/pragma_plugin.c
===================================================================
--- gcc/testsuite/g++.dg/plugin/pragma_plugin.c	(revision 162051)
+++ gcc/testsuite/g++.dg/plugin/pragma_plugin.c	(working copy)
@@ -14,6 +14,7 @@ 
 #include "tree-pass.h"
 #include "intl.h"
 #include "toplev.h"
+#include "diagnostic.h"
 
 int plugin_is_GPL_compatible;
 
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 162051)
+++ gcc/Makefile.in	(working copy)
@@ -330,12 +330,15 @@ 
 LTO_BINARY_READER = @LTO_BINARY_READER@
 LTO_USE_LIBELF = @LTO_USE_LIBELF@
 
-# Compiler needed for plugin support
-PLUGINCC = $(COMPILER)
+# Compiler and flags needed for plugin support
+ifneq ($(ENABLE_BUILD_WITH_CXX),yes)
+PLUGINCC = $(CC)
+PLUGINCFLAGS = $(CFLAGS)
+else
+PLUGINCC = $(CXX)
+PLUGINCFLAGS = $(CXXFLAGS)
+endif
 
-# Flags needed for plugin support
-PLUGINCFLAGS = $(COMPILER_FLAGS)
-
 # Libs and linker options needed for plugin support
 PLUGINLIBS = @pluginlibs@