Subject: pkg/33322: textproc/dict-{client,server} gcc 3.4 alloca() problem
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <b1ff@fr33.b33r.net>
List: pkgsrc-bugs
Date: 04/20/2006 21:50:00
>Number:         33322
>Category:       pkg
>Synopsis:       textproc/dict-{client,server} gcc 3.4 alloca() problem
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 20 21:50:00 +0000 2006
>Originator:     Mathieu
>Release:        3.0.0_STABLE
>Organization:
>Environment:
NetBSD sal.lan 3.0.0_STABLE NetBSD 3.0.0_STABLE (SPECIFIC) #0: Sat Apr  8 22:19:10 EDT 2006  mathieu@sal.lan:/usr/src/sys/arch/i386/compile/SPECIFIC i386
>Description:
cc -c -Ilibmaa -DHAVE_CONFIG_H -I/usr/pkg/include -I/usr/include -I/usr/pkg/gcc34/include -I. -O2 -march=pentium4 -pipe -I/usr/pkg/include -I/usr/include -I/usr/pkg/gcc34/include -DUSE_DICT_ORG -DUSE_PLUGIN -DDICT_PLUGIN_PATH=\"/usr/pkg/libexec/\" -DDICT_DICTIONARY_PATH=\"/usr/pkg/share/\" -DDICT_VERSION=\"1.9.15\" -DDICT_CONFIG_PATH=\"/usr/pkg/etc/\"  dict.c -o dict.o
In file included from dict.h:27,
                 from dict.c:24:
dictP.h:72: warning: conflicting types for built-in function 'alloca'
In file included from dictP.h:245,
                 from dict.h:27,
                 from dict.c:24:
/pkg/pkg/gcc34/bin/../lib/gcc/i386--netbsdelf3.0.0/3.4.6/include/stdlib.h:259: error: conflicting types for 'alloca'
dictP.h:72: error: previous declaration of 'alloca' was here
/pkg/pkg/gcc34/bin/../lib/gcc/i386--netbsdelf3.0.0/3.4.6/include/stdlib.h:259: error: conflicting types for 'alloca'
dictP.h:72: error: previous declaration of 'alloca' was here
gmake: *** [dict.o] Error 1
*** Error code 2

Similar error with libmaa/maaP.h.

>How-To-Repeat:
GCC_REQD=3.4

>Fix:
Replacement for patch-aa:

--- dictP.h.orig        2004-10-06 10:59:10.000000000 -0400
+++ dictP.h     2006-04-20 17:35:15.000000000 -0400
@@ -61,6 +61,7 @@
 # define HAVE_ALLOCA_H 1
 #endif
 
+#if !HAVE_ALLOCA
 #if HAVE_ALLOCA_H
 # include <alloca.h>
 #else
@@ -68,12 +69,13 @@
 # pragma alloca
 # else
 #  ifndef alloca /* predefined by HP cc +Olibcalls */
-#  if !defined(__svr4__) && !defined(__sgi__)  /* not on IRIX */
+#  if !defined(__svr4__) && !defined(__sgi__) && !defined(__DragonFly__) && !defined(__FreeBSD__)  /* not on IRIX */
     char *alloca ();
 #  endif
 #  endif
 # endif
 #endif
+#endif
 
 /* Get string functions */
 #if STDC_HEADERS

And patch-ab:

--- libmaa/maaP.h.orig  2003-10-26 08:03:24.000000000 -0500
+++ libmaa/maaP.h       2006-04-20 17:35:24.000000000 -0400
@@ -33,6 +33,7 @@
 #define __FUNCTION__ __FILE__
 #endif
 
+#if !HAVE_ALLOCA
 /* AIX requires this to be the first thing in the file.  */
 #if HAVE_ALLOCA_H
 # include <alloca.h>
@@ -41,10 +42,13 @@
 #  pragma alloca
 # else
 #  ifndef alloca /* predefined by HP cc +Olibcalls */
+#  if !defined(__DragonFly__) && !defined(__FreeBSD__)
     char *alloca ();
 #  endif
+#  endif
 # endif
 #endif
+#endif
 
 /* Get string functions */
 #if STDC_HEADERS

Makes it build here. Not sure if checking for HAVE_ALLOCA is the
correct way. But if it is, maybe the middle __whateverOS__ checks
aren't needed?