Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 582694

Summary: dev-util/source-highlight-3.1.7-r2: building w/gcc-6: ./stdbool.h:112:70: error: expected ';', identifier or '(' before '_Bool' typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
Product: Gentoo Linux Reporter: Peter Levine <plevine457>
Component: [OLD] GCC PortingAssignee: Tiziano Müller (RETIRED) <dev-zero>
Status: RESOLVED FIXED    
Severity: normal CC: plevine457
Priority: Normal Keywords: PATCH, UPSTREAM
Version: unspecified   
Hardware: All   
OS: Linux   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=632090
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 582084    
Attachments: source-highlight-3.1.7-r2:20160510-232715.log.gz
emerge --info
source-highlight-3.1.7-cpp11-gcc6.patch

Description Peter Levine 2016-05-10 23:38:41 UTC
Compiling dev-util/source-highlight-3.1.7-r2 with gcc-6.1.0 fails with:


./stdbool.h:112:70: error: expected ';', identifier or '(' before '_Bool'  typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool;
Comment 1 Peter Levine 2016-05-10 23:39:56 UTC
Created attachment 433888 [details]
source-highlight-3.1.7-r2:20160510-232715.log.gz
Comment 2 Peter Levine 2016-05-10 23:41:16 UTC
Created attachment 433890 [details]
emerge --info
Comment 3 Peter Levine 2016-05-28 23:57:36 UTC
The problem is either with gcc-6 or with gl/m4/stdbool.m4

In a conftest the equivalent of the following code is used:

> #include <stdbool.h>
> #ifndef bool
> 	"error: bool is not defined"
> #endif
> int main () {
>   return 0;
> }

If one stores this as "conftest.cpp" and executes:

> x86_64-pc-linux-gnu-g++ -c -march=native -O2 -pipe  conftest.cpp

With gcc-5, this compiles fine.  With gcc-6, I get:

> conftest.cpp:3:2: error: expected unqualified-id before string constant

This implies that "bool" exists as a macro in gcc-5 but not gcc-6.
I don't remember seeing anything in the GCC-6 release notes about a change in the behaviour of the "bool" keyword, just some changes in what can be implicitly cast from a boolean type.
Comment 4 Peter Levine 2016-05-30 03:35:24 UTC
Herein lies the problem: https://gcc.gnu.org/ml/gcc-patches/2014-10/msg02594.html

C++ dialects from C++11 onward are not supposed to define bool, false, or true as macros.  This messes up configure into forcing the inclusion of it's own stdbool.h.

Aside from that, the boost ebuild has to be changed to not include the line:
> append-cxxflags -std=gnu++98

There are incompatibilities that break the build otherwise.  I'm not sure if that should even be filed as a separate bug as there are many other packages that appear to break if compiled with different gcc major versions (dev-qt/* built with gcc-6 breaks most kde plasma5 builds if then built with gcc-5). Not sure how Gentoo can/will handle this.
Comment 5 Peter Levine 2016-05-30 04:03:06 UTC
Created attachment 435722 [details, diff]
source-highlight-3.1.7-cpp11-gcc6.patch

Patch for >=source-highlight-3.1.7.
Submitted upstream: https://savannah.gnu.org/bugs/index.php?48053
Comment 6 David Seifert gentoo-dev 2016-10-08 18:46:58 UTC
commit a20f82824bff15ec83702f07697f3b2433a17e5c
Author: David Seifert <soap@gentoo.org>
Date:   Sat Oct 8 20:43:39 2016 +0200

    dev-util/source-highlight: Version bump to 3.1.8
    
    Gentoo-bug: 507112, 579002, 582694, 582696
    * EAPI=6
    * Build using C++14 mode (due to boost-1.62)