Bug 12576 - build failure when using non-gcc compiler
Summary: build failure when using non-gcc compiler
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 7.2
: P2 normal
Target Milestone: 7.3
Assignee: Tom Tromey
URL:
Keywords:
: 12904 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-03-13 13:25 UTC by Bruno Haible
Modified: 2011-06-17 09:17 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bruno Haible 2011-03-13 13:25:56 UTC
Building gdb-7.2 on Solaris 2.6 with CC="cc" I get these two compilation
errors:

source='dwarf2loc.c' object='dwarf2loc.o' libtool=no DEPDIR=.deps depmode=dashXmstdout /bin/ksh ./../depcomp cc -O   -I. -I. -I./common -I./config -DLOCALEDIR="\"/home/haible/prefix-solaris6-sparc/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/.. -I./../readline/.. -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber -I./../intl -I./gnulib -Ignulib  -DMI_OUT=1 -DTUI=1 -O    -c -o dwarf2loc.o dwarf2loc.c
"dwarf2loc.c", line 263: void function cannot return value
"dwarf2loc.c", line 1073: void function cannot return value
...
cc: acomp failed for dwarf2loc.c
gmake[2]: *** [dwarf2loc.o] Error 2

The fix is to remove the "return" keyword from dwarf2loc.c:263 and dwarf2loc.c:1073.

GCC is the only compiler that supports 'return' of void values.
Comment 1 Sourceware Commits 2011-03-14 15:54:24 UTC
CVSROOT:	/cvs/src
Module name:	src
Branch: 	gdb_7_2-branch
Changes by:	tromey@sourceware.org	2011-03-14 15:54:16

Modified files:
	gdb            : ChangeLog dwarf2loc.c 

Log message:
	PR gdb/12576:
	* dwarf2loc.c (dwarf_expr_dwarf_call): Remove 'return'.
	(needs_frame_dwarf_call): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.11973.2.70&r2=1.11973.2.71
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2loc.c.diff?cvsroot=src&only_with_tag=gdb_7_2-branch&r1=1.93.2.3&r2=1.93.2.4
Comment 2 Sourceware Commits 2011-03-14 15:59:04 UTC
CVSROOT:	/cvs/src
Module name:	src
Changes by:	tromey@sourceware.org	2011-03-14 15:58:56

Modified files:
	gdb            : ChangeLog dwarf2loc.c 

Log message:
	PR gdb/12576:
	* dwarf2loc.c (dwarf_expr_dwarf_call): Remove 'return'.
	(needs_frame_dwarf_call): Likewise.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/ChangeLog.diff?cvsroot=src&r1=1.12801&r2=1.12802
http://sourceware.org/cgi-bin/cvsweb.cgi/src/gdb/dwarf2loc.c.diff?cvsroot=src&r1=1.111&r2=1.112
Comment 3 Tom Tromey 2011-03-14 16:01:49 UTC
I checked in the fix to the trunk and the 7.2 branch.

-Wreturn-type (implied by -Wall) should have caught this,
so I think there is also a GCC bug here.
Comment 4 Pedro Alves 2011-06-17 09:17:22 UTC
*** Bug 12904 has been marked as a duplicate of this bug. ***