diff mbox

Use INCLUDE_xxx macros in gcov.c for pulling in standard C++ headers

Message ID alpine.LSU.2.20.1701212314150.3033@anthias.pfeifer.com
State New
Headers show

Commit Message

Gerald Pfeifer Jan. 21, 2017, 10:52 p.m. UTC
Honza, Nathan,

On Sat, 21 Jan 2017, Dimitry Andric wrote:
> As discussed with the FreeBSD gcc ports maintainer [1], building trunk
> gcc with libc++ requires standard C++ headers to be included *before*
> gcc/system.h, otherwise the redefinition of abort() to fancy_abort()
> will cause trouble.
> 
> In r235362, most gcc C++ sources were updated to define INCLUDE_xxx
> macros before including gcc/system.h, which fixes the incompatibility
> with libc++.  However, gcc/gcov.c was apparently missed.  Attached is a
> patch to update it.

can you approve this as gcov maintainers?

Without this, GCC 7 will fail to build with newer versions of 
Clang/libc++.

Below you find Dimitry's patch with a ChangeLog I created.  Bootstrapped 
on x86_64-unknown-freebsd11.0, and I can take care of committing.

Gerald

2017-01-21  Dimitry Andric <dim@FreeBSD.org>

	* gcov.c (INCLUDE_ALGORITHM): Define.
	(INCLUDE_VECTOR): Define.
	No longer include <vector> and <algorithm>.

Comments

Jan Hubicka Jan. 22, 2017, 10:01 a.m. UTC | #1
> Honza, Nathan,
> 
> On Sat, 21 Jan 2017, Dimitry Andric wrote:
> > As discussed with the FreeBSD gcc ports maintainer [1], building trunk
> > gcc with libc++ requires standard C++ headers to be included *before*
> > gcc/system.h, otherwise the redefinition of abort() to fancy_abort()
> > will cause trouble.
> > 
> > In r235362, most gcc C++ sources were updated to define INCLUDE_xxx
> > macros before including gcc/system.h, which fixes the incompatibility
> > with libc++.  However, gcc/gcov.c was apparently missed.  Attached is a
> > patch to update it.
> 
> can you approve this as gcov maintainers?
> 
> Without this, GCC 7 will fail to build with newer versions of 
> Clang/libc++.
> 
> Below you find Dimitry's patch with a ChangeLog I created.  Bootstrapped 
> on x86_64-unknown-freebsd11.0, and I can take care of committing.
> 
> Gerald
> 
> 2017-01-21  Dimitry Andric <dim@FreeBSD.org>
> 
> 	* gcov.c (INCLUDE_ALGORITHM): Define.
> 	(INCLUDE_VECTOR): Define.
> 	No longer include <vector> and <algorithm>.

OK

Honza
Gerald Pfeifer Jan. 22, 2017, 3:50 p.m. UTC | #2
On Sun, 22 Jan 2017, Jan Hubicka wrote:
>> Below you find Dimitry's patch with a ChangeLog I created.  Bootstrapped 
>> on x86_64-unknown-freebsd11.0, and I can take care of committing.

>> 2017-01-21  Dimitry Andric <dim@FreeBSD.org>
>> 
>> 	* gcov.c (INCLUDE_ALGORITHM): Define.
>> 	(INCLUDE_VECTOR): Define.
>> 	No longer include <vector> and <algorithm>.
> OK

Thanks!  To be on the safe side, I also did another bootstrap on
x86_64-pc-linux-gnu, and committed this now.

Thanks, Dimitry!

Gerald
diff mbox

Patch

Index: gcov.c
===================================================================
--- gcov.c	(revision 244750)
+++ gcov.c	(working copy)
@@ -31,6 +31,8 @@ 
    probabilities of fall through arcs.  */
 
 #include "config.h"
+#define INCLUDE_ALGORITHM
+#define INCLUDE_VECTOR
 #include "system.h"
 #include "coretypes.h"
 #include "tm.h"
@@ -41,8 +43,6 @@ 
 
 #include <getopt.h>
 
-#include <vector>
-#include <algorithm>
 #include "md5.h"
 
 using namespace std;