[Bug other/80719] New: gcc build fails on libiberty conflicting types: CP_STATIC_IF_GLIBCPP_V3

2017-05-11 Thread joriswu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80719

Bug ID: 80719
   Summary: gcc build fails on libiberty conflicting types:
CP_STATIC_IF_GLIBCPP_V3
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: other
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joriswu at gmail dot com
  Target Milestone: ---

When building gcc release 7.1.0 according to https://gcc.gnu.org/install, a
type conflict in building libiberty causes an error.

When building without binutils added to the source tree, buid stops at a
missing libiberty.aq
When building binutils libiberty in a separate dir and copying linbiberty.a, an
error about incorrect relacation type shows.

When unpacking binutils 2.28 into the gcc source dir, the type conflict shows :

if [ x"-fpic" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -g  -I. -I../../gcc-7.1.0/libiberty/../include
 -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic 
-D_GNU_SOURCE -fpic ../../gcc-7.1.0/libiberty/cp-demangle.c -o
pic/cp-demangle.o; \
else true; fi
../../gcc-7.1.0/libiberty/cp-demangle.c:4248:1: error: conflicting types for
‘cplus_demangle_print_callback’
 cplus_demangle_print_callback (int options,
 ^
In file included from ../../gcc-7.1.0/libiberty/cp-demangle.c:140:0:
../../gcc-7.1.0/libiberty/../include/demangle.h:715:1: note: previous
declaration of ‘cplus_demangle_print_callback’ was here
 cplus_demangle_print_callback (int options,
 ^
../../gcc-7.1.0/libiberty/cp-demangle.c:4292:1: error: conflicting types for
‘cplus_demangle_print’
 cplus_demangle_print (int options, const struct demangle_component *dc,
 ^
In file included from ../../gcc-7.1.0/libiberty/cp-demangle.c:140:0:
../../gcc-7.1.0/libiberty/../include/demangle.h:695:1: note: previous
declaration of ‘cplus_demangle_print’ was here
 cplus_demangle_print (int options,
 ^
make[3]: *** [cp-demangle.o] Error 1
make[3]: Leaving directory `/home/joris/pkg/gccbld/libiberty'

configured as :
../gcc-7.1.0/configure --prefix=/home/joris --enable-languages=c
--enable-checking=release --disable-nls --disable-multilib

Looking into the conflicting decls the difference is that the source function
has CP_STATIC_IF_GLIBCPP_V3 translating into static whilst demangle.h has it as
extern

[Bug other/80720] New: gcc build fails on libiberty conflicting types: CP_STATIC_IF_GLIBCPP_V3

2017-05-11 Thread joriswu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80720

Bug ID: 80720
   Summary: gcc build fails on libiberty conflicting types:
CP_STATIC_IF_GLIBCPP_V3
   Product: gcc
   Version: 7.1.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: other
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joriswu at gmail dot com
  Target Milestone: ---

When building gcc release 7.1.0 according to https://gcc.gnu.org/install, a
type conflict in building libiberty causes an error.

When building without binutils added to the source tree, buid stops at a
missing libiberty.aq
When building binutils libiberty in a separate dir and copying linbiberty.a, an
error about incorrect relacation type shows.

When unpacking binutils 2.28 into the gcc source dir, the type conflict shows :

if [ x"-fpic" != x ]; then \
  gcc -c -DHAVE_CONFIG_H -g  -I. -I../../gcc-7.1.0/libiberty/../include
 -W -Wall -Wwrite-strings -Wc++-compat -Wstrict-prototypes -pedantic 
-D_GNU_SOURCE -fpic ../../gcc-7.1.0/libiberty/cp-demangle.c -o
pic/cp-demangle.o; \
else true; fi
../../gcc-7.1.0/libiberty/cp-demangle.c:4248:1: error: conflicting types for
‘cplus_demangle_print_callback’
 cplus_demangle_print_callback (int options,
 ^
In file included from ../../gcc-7.1.0/libiberty/cp-demangle.c:140:0:
../../gcc-7.1.0/libiberty/../include/demangle.h:715:1: note: previous
declaration of ‘cplus_demangle_print_callback’ was here
 cplus_demangle_print_callback (int options,
 ^
../../gcc-7.1.0/libiberty/cp-demangle.c:4292:1: error: conflicting types for
‘cplus_demangle_print’
 cplus_demangle_print (int options, const struct demangle_component *dc,
 ^
In file included from ../../gcc-7.1.0/libiberty/cp-demangle.c:140:0:
../../gcc-7.1.0/libiberty/../include/demangle.h:695:1: note: previous
declaration of ‘cplus_demangle_print’ was here
 cplus_demangle_print (int options,
 ^
make[3]: *** [cp-demangle.o] Error 1
make[3]: Leaving directory `/home/joris/pkg/gccbld/libiberty'

configured as :
../gcc-7.1.0/configure --prefix=/home/joris --enable-languages=c
--enable-checking=release --disable-nls --disable-multilib

Looking into the conflicting decls the difference is that the source function
has CP_STATIC_IF_GLIBCPP_V3 translating into static whilst demangle.h has it as
extern

[Bug other/80720] gcc build fails on libiberty conflicting types: CP_STATIC_IF_GLIBCPP_V3

2017-05-11 Thread joriswu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80720

joris  changed:

   What|Removed |Added

  Build||linux Mint

--- Comment #1 from joris  ---
Further analysis shows the conflict is that the source has 'const' yet the
header has no 'const' qualifier for struct demangle_component

[Bug other/80719] gcc build fails on libiberty conflicting types: CP_STATIC_IF_GLIBCPP_V3

2017-05-12 Thread joriswu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80719

--- Comment #3 from joris  ---
Further analysis shows the conflict is that the source has 'const' yet the
header has no 'const' qualifier for struct demangle_component

Unpacking binutils into the gcc source tree is what the install guide at
https://gcc.gnu.org/install/download.html suggests.

If building binutils separately, the resulting libiberty.a is not compatible
with gcc's expectations, likely related to relocatability.

P.S. the duplicate bug is because bugzilla showed a gateway timeout at submit.

[Bug c/80036] New: Source line not printed for diagnostic if expanded from a macro

2017-03-13 Thread joriswu at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80036

Bug ID: 80036
   Summary: Source line not printed for diagnostic if expanded
from a macro
   Product: gcc
   Version: 7.0.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c
  Assignee: unassigned at gcc dot gnu.org
  Reporter: joriswu at gmail dot com
  Target Milestone: ---

If a diagnostic is printed for code that expands from a macro, and the macro is
defined in a header file, the source line is not shown. Only the include stack
is :

macros.h:

extern void print_it(const char *fmt, int i);
#define print_int(x) print_it("%d",(x))


code.c:

#include "macros.h"


void test(void)

{

  int unint;

  print_int(uninit);

}

gcc  -c -Wall test.c

In file included from test.c:1:0:
test.c: In function 'test':
macros.h:1:22: warning: 'uninit' is used uninitialized in this function
[-Wuninitialized]
 #define print_int(x) print_it("%d",(x))
  ^~~~
test.c:7:7: note: 'uninit' was declared here
   int uninit;
   ^~

so the offending line print_int() is not shown.