Bug 49234 - libgda-1.0.3 fails to compile with gcc 3.4.0
Bug#: 49234 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: eradicator@gentoo.org Reported By: robmoss@gentoo.org
Component: GCC Porting
URL: 
Summary: libgda-1.0.3 fails to compile with gcc 3.4.0
Keywords:  
Status Whiteboard: 
Opened: 2004-04-27 20:46 0000
Description:   Opened: 2004-04-27 20:46 0000
libgda-1.0.3 contains a number of rather silly "default:" rather than
"default:;" lines causing compound statement errors. The attached patch fixes
this.

Reproducible: Always
Steps to Reproduce:

------- Comment #1 From Robert Moss (RETIRED) 2004-04-27 20:46:56 0000 -------
Created an attachment (id=30208) [details]
Patch to fix compilation error

------- Comment #2 From Travis Tilley (RETIRED) 2004-04-28 14:41:21 0000 -------
huh. i got libgda to compile without problems. out of curiousity... do you have
doc in your USE?

------- Comment #3 From Robert Moss (RETIRED) 2004-04-28 15:27:40 0000 -------
No. It's possible that you've got "-fpermissive" in your CXXFLAGS? This I
wouldn't recommend, as this allows many things to compile which will
consequently segfault.

The only differences I can see between the ebuild I use (which contains an
"epatch" line) are the CVS header, my own epatch line, and also a different
inherit line - portage's one has been updated from "inherit gnome2" to "inherit
gnome2 eutils", so we must be using the same source as long as we're using the
same version...

------- Comment #4 From Travis Tilley (RETIRED) 2004-04-28 16:05:05 0000 -------
no, i'm not using any insane flags. but i'm also on a different arch.
CFLAGS="-O2 -ftracer -fweb -march=athlon64 -pipe"
CXXFLAGS="${CFLAGS}"

------- Comment #5 From Robert Moss (RETIRED) 2004-04-28 16:14:10 0000 -------
Well, here's the relevant error (or at least the first one - there be many):

 gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libgda\" -DVERSION=\"1.0.3\" -DBONOBO_EXPLICIT_TRANSLATION_DOMAIN=\"libgda-2\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DYYTEXT_POINTER=1 -DGETTEXT_PACKAGE=\"libgda-2\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -DHAVE_MYSQL=1 -DHAVE_POPT_H=1 -DHAVE_READLINE_READLINE_H=1 -DHAVE_READLINE_HISTORY_H=1 -I. -I. -I.. -I.. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -DLIBGDA_PLUGINDIR=\"/usr/local/lib/libgda/providers\" -DLIBGDA_LOCALEDIR=\"/usr/local/share/locale\" -DLIBGDA_GLOBAL_CONFIG_FILE=\"/usr/local/etc/libgda/config\" -g -O2 -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -MT gda-transaction.lo -MD -MP -MF .deps/gda-transaction.Tpo -c gda-transaction.c -o gda-transaction.o >/dev/null 2>&1
if /bin/sh ../libtool --mode=compile gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libgda\" -DVERSION=\"1.0.3\" -DBONOBO_EXPLICIT_TRANSLATION_DOMAIN=\"libgda-2\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DYYTEXT_POINTER=1 -DGETTEXT_PACKAGE=\"libgda-2\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -DHAVE_MYSQL=1 -DHAVE_POPT_H=1 -DHAVE_READLINE_READLINE_H=1 -DHAVE_READLINE_HISTORY_H=1  -I. -I. -I.. -I.. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2   -DLIBGDA_PLUGINDIR=\""/usr/local/lib/libgda/providers"\" -DLIBGDA_LOCALEDIR=\""/usr/local/share/locale"\" -DLIBGDA_GLOBAL_CONFIG_FILE=\""/usr/local/etc/libgda/config"\"    -g -O2 -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare  -MT gda-util.lo -MD -MP -MF ".deps/gda-util.Tpo" \
  -c -o gda-util.lo `test -f 'gda-util.c' || echo './'`gda-util.c; \
then mv -f ".deps/gda-util.Tpo" ".deps/gda-util.Plo"; \
else rm -f ".deps/gda-util.Tpo"; exit 1; \
fi
 gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"libgda\" -DVERSION=\"1.0.3\" -DBONOBO_EXPLICIT_TRANSLATION_DOMAIN=\"libgda-2\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DYYTEXT_POINTER=1 -DGETTEXT_PACKAGE=\"libgda-2\" -DHAVE_LOCALE_H=1 -DHAVE_LC_MESSAGES=1 -DHAVE_BIND_TEXTDOMAIN_CODESET=1 -DHAVE_GETTEXT=1 -DHAVE_DCGETTEXT=1 -DENABLE_NLS=1 -DHAVE_MYSQL=1 -DHAVE_POPT_H=1 -DHAVE_READLINE_READLINE_H=1 -DHAVE_READLINE_HISTORY_H=1 -I. -I. -I.. -I.. -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/libxml2 -DLIBGDA_PLUGINDIR=\"/usr/local/lib/libgda/providers\" -DLIBGDA_LOCALEDIR=\"/usr/local/share/locale\" -DLIBGDA_GLOBAL_CONFIG_FILE=\"/usr/local/etc/libgda/config\" -g -O2 -Wall -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-sign-compare -MT gda-util.lo -MD -MP -MF .deps/gda-util.Tpo -c gda-util.c  -fPIC -DPIC -o .libs/gda-util.o
gda-util.c: In function `gda_type_to_string':
gda-util.c:64: error: label at end of compound statement
gda-util.c: In function `gda_sql_replace_placeholders':
gda-util.c:152: warning: passing arg 1 of `sql_parse' discards qualifiers from pointer target type
gda-util.c:146: warning: unused variable `str'
make[1]: *** [gda-util.lo] Error 1
make[1]: Leaving directory `/var/tmp/portage/libgda-1.0.3/work/libgda-1.0.3/libgda'
make: *** [all-recursive] Error 1

Do you have "mysql" in your USE flags?

------- Comment #6 From Travis Tilley (RETIRED) 2004-04-28 17:27:02 0000 -------
nope. lemme give you the output of emerge info (kinda ironic for the dev to be
giving this information and not the other way around, heh)

Portage 2.0.50-r6 (default-amd64-2004.0, gcc-3.4.0, glibc-2.3.3_pre20040420-r0,
2.6.6-rc2-love1)
=================================================================
System uname: 2.6.6-rc2-love1 x86_64 4
Gentoo Base System version 1.4.10
Autoconf: sys-devel/autoconf-2.59-r3
Automake: sys-devel/automake-1.8.3
ACCEPT_KEYWORDS="amd64 ~amd64"
AUTOCLEAN="yes"
CFLAGS="-O2 -ftracer -fweb -march=athlon64 -pipe"
CHOST="x86_64-pc-linux-gnu"
COMPILER="gcc3"
CONFIG_PROTECT="/etc /usr/X11R6/lib/X11/xkb /usr/kde/2/share/config
/usr/kde/3.2/share/config /usr/kde/3/share/config
/usr/lib/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -ftracer -fweb -march=athlon64 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs buildpkg ccache cvs sandbox"
GENTOO_MIRRORS="http://gentoo.oregonstate.edu
http://distro.ibiblio.org/pub/Linux/distributions/gentoo"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY=""
SYNC="rsync://localhost/portage"
USE="X X509 aac acl acpi alsa amd64 apm arts avi berkdb bidi bonobo canna cap
caps cddb cdr cjk crypt cscope dga directfb dnd dnsdb dv dvd dvdr encode
escreen esd ethereal etwin evo faad fbcon fbdev ffmpeg fftw freetype fs gd gdbm
geoip ggi gif glut gnome gnomedb gpm gstreamer gtk gtk2 gtkhtml icq idea
ieee1394 imap imlib jabber jack java jpeg kde ladcca lcms libg++ libgda libwww
mad maildir md5sum mikmod motif mozilla moznocompose moznoirc moznomail mozp3p
mozsvg mozxmlterm mpeg mpeg4 msn ncurses nls nogcj nvidia nviz offensive
oggvorbis openal opengl oss pam pcap pcre pdflib perl pic png pnp prelude psyco
pthreads python qt quicktime readline ruby sasl sdl serial skey slang slp snmp
socks5 sox spell src ssl svg tcltk tcpd theora tiff timidity transcode
transparent-proxy truetype type1 uml unicode usb v4l v4l2 videos wxwin
wxwindows xchattext xfs xgetdefault xine xml2 xmms xv xvid yahoo zlib zvbi"

i'm guessing you have mysql in your USE.

------- Comment #7 From Robert Moss (RETIRED) 2004-04-28 18:12:36 0000 -------
I do indeed! This would be why. The relevant bits of broken code are
mysql-related. There may be more besides which cause errors, but I'm not in the
business of setting all the USE flags to on just to check which ones will break
things when enabled!

That said, enabling other USE flags too *will* break things as well. I've just
issued the following command in ${S}:

grep -RiH "default:" * | grep -v "default:;"

Worryingly, I got this:

config.guess:                           default: puts ("hppa2.0"); break;
config.guess:                   default: puts ("hppa1.0"); break;
config.guess:             default: puts ("hppa-hitachi-hiuxwe2"); break;
doc/C/html/installation-configuring.html:                  stored. By default:
/tmp.
doc/C/libgda-docs.sgml:            stored. By default: /tmp.
libgda/gda-util.c:      default:
libgda/gda-value.c:     default:
libgda/gda-value.c:     default:
libsql/lexer.c: default:
libsql/parser.c:      default:
libsql/parser.c:      default:
libsql/parser.c:yydefault:
libsql/sql_parser.c:   default:
libsql/sql_parser.c:   default:
libsql/sql_parser.c:   default:
libsql/sql_parser.c:   default:
libsql/sql_parser.c:   default:
libsql/sql_parser.c:      default:
libsql/sql_parser.c:   default:
libsql/sql_display.c:   default:
providers/xml/gda-xml-provider.c:       default:
providers/msql/gda-msql-recordset.c:      default:
providers/msql/gda-msql-utils.c:    default:
ret=g_strdup_printf("\"%s\"",val_str);
providers/odbc/gda-odbc-provider.c:     default:
providers/odbc/utils.c: default:
providers/mysql/gda-mysql-provider.c:   default:
providers/postgres/gda-postgres-provider.c:     default:
providers/postgres/gda-postgres-provider.c:     default:
providers/freetds/gda-freetds-types.c:          default:
providers/freetds/gda-freetds-types.c:                  default:
providers/ibmdb2/gda-ibmdb2-types.c:            default:
providers/ibmdb2/gda-ibmdb2-types.c:                    default:
providers/ibmdb2/gda-ibmdb2-provider.c:     default:
providers/ibmdb2/gda-ibmdb2-provider.c: default:
providers/oracle/utils.c:               default:
providers/oracle/utils.c:       default:
providers/oracle/utils.c:       default:
providers/oracle/utils.c:       default:
providers/oracle/utils.c:       default:
providers/oracle/gda-oracle-provider.c: default:
providers/oracle/gda-oracle-provider.c: default:
providers/sqlite/gda-sqlite-provider.c: default:
providers/sqlite/gda-sqlite-provider.c: default:
providers/sybase/gda-sybase-recordset.c:                default:
providers/sybase/gda-sybase-types.c:            default:
providers/sybase/gda-sybase-provider.c:                         default:
providers/sybase/gda-sybase-provider.c:         default:
providers/sybase/gda-sybase-provider.c:                         default:
testing/models.c:               default:

Obviously there are a few irrelvances here, but most need fixing. I'll submit a
bigger patch which fixes those that need fixing when I've done it - I'm just
starting now. FWIW, you've not got any of the USE flags libgda uses set, which
is why you're not getting any of the relevant errors.

------- Comment #8 From Robert Moss (RETIRED) 2004-04-28 19:06:06 0000 -------
Created an attachment (id=30289) [details]
Updated patch to fix errors with all USE flag combinations

This patch is a superset of the former patch and will fix all compilation
errors, as far as I'm aware, no matter what the USE flags are.

------- Comment #9 From Robert Moss (RETIRED) 2004-05-03 19:24:10 0000 -------
lv, any news on this? Does it work on your machine? I've had no problems with
it here, nor any problems with it reported in the GCC 3.4 thread on the forums
since I made the patch available a week ago.

------- Comment #10 From Edward Hervey 2004-06-07 09:14:29 0000 -------
Ran through the bug on ~amd64 with gcc34.

Worked though when I applied the above patch, any thoughts on when updating the portage ?

------- Comment #11 From Robert Moss (RETIRED) 2004-06-07 13:07:26 0000 -------
Also, this is fixed in 1.1.3. It compiles and runs fine without patching
(except for the gtk-doc thing). Perhaps we should nick their patch instead?
That said, I suspect it will be fairly similar...

------- Comment #12 From Jeremy Huddleston (RETIRED) 2004-06-12 23:38:46 0000 -------
taking as I got hit by this and it doesn't like anyone's on it.

------- Comment #13 From Jeremy Huddleston (RETIRED) 2004-06-13 00:29:47 0000 -------
fixed in cvs. thanks.

------- Comment #14 From Chris Hoffman 2005-03-27 16:35:11 0000 -------
I stumbled over this bug while emerging gnumeric. Did someone forget to make
libgda-1.0.4 (which seems to have the fix) stable instead of leaving 1.0.3 and
the bug?