{"thread":{"id":"28233","subject":"obstack fails to compile on OS X 10.7","startedAt":"2011-08-27T06:21:40Z","lastAt":"2011-09-01T17:30:50Z","messageCount":7,"participants":["Brian Gernhardt","David Aguilar","Fredrik Kuivinen","Junio C Hamano","Ramsay Jones"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"174372","messageId":"4A1A024F-C5D5-4E5F-8474-DA3D87412C8A@gernhardtsoftware.com","threadId":"28233","inReplyTo":null,"subject":"obstack fails to compile on OS X 10.7","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2011-08-27T06:21:40Z","receivedAt":"2011-08-27T06:21:40Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"Some of the errors look like things I could track down, but some just confuse me.  If anyone else could take a look into this, it would be much appreciated.\n\n~~ Brian G.\n\ngcc -o compat/obstack.o -c -MF compat/.depend/obstack.o.d -MMD -MP  -Wall -Wdeclaration-after-statement -Werror -Wno-deprecated-declarations -I. -DUSE_ST_TIMESPEC  -DSHA1_HEADER='\"block-sha1/sha1.h\"'  -DNO_MEMMEM  compat/obstack.c\nIn file included from compat/obstack.c:30:\ncompat/obstack.h:190: error: __block attribute can be specified on variables only\ncompat/obstack.c:70: error: expected specifier-qualifier-list before ‘uintmax_t’\ncompat/obstack.c:111:24: error: exitfail.h: No such file or directory\ncc1: warnings being treated as errors\ncompat/obstack.c: In function ‘print_and_abort’:\ncompat/obstack.c:436: warning: implicit declaration of function ‘gettext’\ncompat/obstack.c:436: warning: incompatible implicit declaration of built-in function ‘gettext’\ncompat/obstack.c:438: error: ‘exit_failure’ undeclared (first use in this function)\ncompat/obstack.c:438: error: (Each undeclared identifier is reported only once\ncompat/obstack.c:438: error: for each function it appears in.)\ncompat/obstack.c:439: warning: ‘noreturn’ function does return\nmake: *** [compat/obstack.o] Error 1\n\n$ gcc --version\ni686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)\n"},{"id":"174375","messageId":"20110827101418.GA8074@gmail.com","threadId":"28233","inReplyTo":"4A1A024F-C5D5-4E5F-8474-DA3D87412C8A@gernhardtsoftware.com","subject":"Re: obstack fails to compile on OS X 10.7","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-08-27T10:14:43Z","receivedAt":"2011-08-27T10:14:43Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Sat, Aug 27, 2011 at 02:21:40AM -0400, Brian Gernhardt wrote:\n> Some of the errors look like things I could track down, but some just confuse me.  If anyone else could take a look into this, it would be much appreciated.\n> \n> ~~ Brian G.\n> \n> gcc -o compat/obstack.o -c -MF compat/.depend/obstack.o.d -MMD -MP  -Wall -Wdeclaration-after-statement -Werror -Wno-deprecated-declarations -I. -DUSE_ST_TIMESPEC  -DSHA1_HEADER='\"block-sha1/sha1.h\"'  -DNO_MEMMEM  compat/obstack.c\n> In file included from compat/obstack.c:30:\n> compat/obstack.h:190: error: __block attribute can be specified on variables only\n> compat/obstack.c:70: error: expected specifier-qualifier-list before ‘uintmax_t’\n> compat/obstack.c:111:24: error: exitfail.h: No such file or directory\n> cc1: warnings being treated as errors\n> compat/obstack.c: In function ‘print_and_abort’:\n> compat/obstack.c:436: warning: implicit declaration of function ‘gettext’\n> compat/obstack.c:436: warning: incompatible implicit declaration of built-in function ‘gettext’\n> compat/obstack.c:438: error: ‘exit_failure’ undeclared (first use in this function)\n> compat/obstack.c:438: error: (Each undeclared identifier is reported only once\n> compat/obstack.c:438: error: for each function it appears in.)\n> compat/obstack.c:439: warning: ‘noreturn’ function does return\n> make: *** [compat/obstack.o] Error 1\n> \n> $ gcc --version\n> i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)\n\nI ran into the same thing.\n\nThis fixes it for me, but we might want to rearrange the\n#includes a bit.  I think this needs more work.. including\ncompat/obstack.h from kwset.c seems wrong.\nShould we just include obstack.h in git-compat-util instead?\n\nI suspect that more exotic platforms may have problems\nwith obstack.h as well.  This probably needs some testing\non SunOS, AIX, IRIX, etc.\n\n-- 8< --\nSubject: [RFC PATCH] obstack: Fix portability issues\n\ni686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1 and possibly others\ndo not have exit.h, exitfail.h, or obstack.h.  Add compat\nversions of these headers as well as exitfail.c from glibc.\n\nThe ELIDE_CODE check in obstack.c is not sufficient so add a\nseparate NEEDS_OBSTACK variable to allow platforms to opt into\nusing the compatibility versions of these files.\n\nThe __block variable was renamed to __blk to avoid a gcc error:\n\ncompat/obstack.h:190: error: __block attribute can be specified on variables only\n\nSigned-off-by: David Aguilar <davvid@gmail.com>\nReported-by: Brian Gernhardt <brian@gernhardtsoftware.com>\n---\n Makefile          |   11 +++++++++++\n compat/exit.h     |   32 ++++++++++++++++++++++++++++++++\n compat/exitfail.c |   24 ++++++++++++++++++++++++\n compat/exitfail.h |   20 ++++++++++++++++++++\n compat/obstack.c  |   19 +++----------------\n compat/obstack.h  |    2 +-\n kwset.c           |    3 ++-\n 7 files changed, 93 insertions(+), 18 deletions(-)\n create mode 100644 compat/exit.h\n create mode 100644 compat/exitfail.c\n create mode 100644 compat/exitfail.h\n\ndiff --git a/Makefile b/Makefile\nindex 30f3812..87ad4a2 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -517,6 +517,8 @@ LIB_H += compat/bswap.h\n LIB_H += compat/cygwin.h\n LIB_H += compat/mingw.h\n LIB_H += compat/obstack.h\n+LIB_H += compat/exitfail.h\n+LIB_H += compat/exit.h\n LIB_H += compat/win32/pthread.h\n LIB_H += compat/win32/syslog.h\n LIB_H += compat/win32/sys/poll.h\n@@ -599,6 +601,7 @@ LIB_OBJS += cache-tree.o\n LIB_OBJS += color.o\n LIB_OBJS += combine-diff.o\n LIB_OBJS += commit.o\n+LIB_OBJS += compat/exitfail.o\n LIB_OBJS += compat/obstack.o\n LIB_OBJS += config.o\n LIB_OBJS += connect.o\n@@ -872,6 +875,8 @@ ifeq ($(uname_S),Darwin)\n \tNEEDS_CRYPTO_WITH_SSL = YesPlease\n \tNEEDS_SSL_WITH_CRYPTO = YesPlease\n \tNEEDS_LIBICONV = YesPlease\n+\tNEEDS_OBSTACK = YesPlease\n+\tNEEDS_EXITFAIL = YesPlease\n \tifeq ($(shell expr \"$(uname_R)\" : '[15678]\\.'),2)\n \t\tOLD_ICONV = UnfortunatelyYes\n \tendif\n@@ -1416,6 +1421,12 @@ endif\n ifdef NEEDS_RESOLV\n \tEXTLIBS += -lresolv\n endif\n+ifdef NEEDS_OBSTACK\n+\tBASIC_CFLAGS += -DNEEDS_OBSTACK\n+endif\n+ifdef NEEDS_EXITFAIL\n+\tBASIC_CFLAGS += -DNEEDS_EXITFAIL\n+endif\n ifdef NO_D_TYPE_IN_DIRENT\n \tBASIC_CFLAGS += -DNO_D_TYPE_IN_DIRENT\n endif\ndiff --git a/compat/exit.h b/compat/exit.h\nnew file mode 100644\nindex 0000000..9dbfb7c\n--- /dev/null\n+++ b/compat/exit.h\n@@ -0,0 +1,32 @@\n+/* exit() function.\n+   Copyright (C) 1995, 2001 Free Software Foundation, Inc.\n+\n+   This program is free software; you can redistribute it and/or modify\n+   it under the terms of the GNU General Public License as published by\n+   the Free Software Foundation; either version 2, or (at your option)\n+   any later version.\n+\n+   This program is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+   GNU General Public License for more details.\n+\n+   You should have received a copy of the GNU General Public License\n+   along with this program; if not, write to the Free Software Foundation,\n+   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */\n+\n+#ifndef _EXIT_H\n+#define _EXIT_H\n+\n+/* Get exit() declaration.  */\n+#include <stdlib.h>\n+\n+/* Some systems do not define EXIT_*, even with STDC_HEADERS.  */\n+#ifndef EXIT_SUCCESS\n+# define EXIT_SUCCESS 0\n+#endif\n+#ifndef EXIT_FAILURE\n+# define EXIT_FAILURE 1\n+#endif\n+\n+#endif /* _EXIT_H */\ndiff --git a/compat/exitfail.c b/compat/exitfail.c\nnew file mode 100644\nindex 0000000..a2dd5dd\n--- /dev/null\n+++ b/compat/exitfail.c\n@@ -0,0 +1,24 @@\n+/* Failure exit status\n+\n+   Copyright (C) 2002, 2003 Free Software Foundation, Inc.\n+\n+   This program is free software; you can redistribute it and/or modify\n+   it under the terms of the GNU General Public License as published by\n+   the Free Software Foundation; either version 2, or (at your option)\n+   any later version.\n+\n+   This program is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+   GNU General Public License for more details.\n+\n+   You should have received a copy of the GNU General Public License\n+   along with this program; see the file COPYING.\n+   If not, write to the Free Software Foundation,\n+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */\n+#ifdef NEEDS_EXITFAIL\n+#include \"exitfail.h\"\n+#include \"exit.h\"\n+\n+int volatile exit_failure = EXIT_FAILURE;\n+#endif\ndiff --git a/compat/exitfail.h b/compat/exitfail.h\nnew file mode 100644\nindex 0000000..e46cf9c\n--- /dev/null\n+++ b/compat/exitfail.h\n@@ -0,0 +1,20 @@\n+/* Failure exit status\n+\n+   Copyright (C) 2002 Free Software Foundation, Inc.\n+\n+   This program is free software; you can redistribute it and/or modify\n+   it under the terms of the GNU General Public License as published by\n+   the Free Software Foundation; either version 2, or (at your option)\n+   any later version.\n+\n+   This program is distributed in the hope that it will be useful,\n+   but WITHOUT ANY WARRANTY; without even the implied warranty of\n+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+   GNU General Public License for more details.\n+\n+   You should have received a copy of the GNU General Public License\n+   along with this program; see the file COPYING.\n+   If not, write to the Free Software Foundation,\n+   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.  */\n+\n+extern int volatile exit_failure;\ndiff --git a/compat/obstack.c b/compat/obstack.c\nindex 75440d9..825658c 100644\n--- a/compat/obstack.c\n+++ b/compat/obstack.c\n@@ -18,15 +18,12 @@\n    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n    Boston, MA 02110-1301, USA.  */\n \n-\n-#ifdef HAVE_CONFIG_H\n-# include <config.h>\n-#endif\n-\n #ifdef _LIBC\n # include <obstack.h>\n # include <shlib-compat.h>\n #else\n+# include <gettext.h>\n+# include \"git-compat-util.h\"\n # include \"obstack.h\"\n #endif\n \n@@ -54,7 +51,7 @@\n \n #include <stddef.h>\n \n-#ifndef ELIDE_CODE\n+#if !defined ELIDE_CODE || defined NEEDS_OBSTACK\n \n \n # if HAVE_INTTYPES_H\n@@ -400,16 +397,6 @@ _obstack_memory_used (struct obstack *h)\n   return nbytes;\n }\n \f\n-/* Define the error handler.  */\n-# ifdef _LIBC\n-#  include <libintl.h>\n-# else\n-#  include \"gettext.h\"\n-# endif\n-# ifndef _\n-#  define _(msgid) gettext (msgid)\n-# endif\n-\n # ifdef _LIBC\n #  include <libio/iolibio.h>\n # endif\ndiff --git a/compat/obstack.h b/compat/obstack.h\nindex 449070e..5636b91 100644\n--- a/compat/obstack.h\n+++ b/compat/obstack.h\n@@ -187,7 +187,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,\n \t\t\t     void (*) (void *, void *), void *);\n extern int _obstack_memory_used (struct obstack *);\n \n-void obstack_free (struct obstack *__obstack, void *__block);\n+void obstack_free (struct obstack *__obstack, void *__blk);\n \n \f\n /* Error handler called when `obstack_chunk_alloc' failed to allocate\ndiff --git a/kwset.c b/kwset.c\nindex fd4515a..d01c562 100644\n--- a/kwset.c\n+++ b/kwset.c\n@@ -37,7 +37,8 @@\n #include \"cache.h\"\n \n #include \"kwset.h\"\n-#include \"obstack.h\"\n+#include \"git-compat-util.h\"\n+#include \"compat/obstack.h\"\n \n #define NCHAR (UCHAR_MAX + 1)\n #define obstack_chunk_alloc xmalloc\n-- \n1.7.6.476.g57292\n"},{"id":"174400","messageId":"D1DD3049-6ADC-45AC-A8B2-BCE95124E6E7@gernhardtsoftware.com","threadId":"28233","inReplyTo":"20110827101418.GA8074@gmail.com","subject":"Re: obstack fails to compile on OS X 10.7","fromName":"Brian Gernhardt","fromEmail":"brian@gernhardtsoftware.com","sentAt":"2011-08-28T03:57:20Z","receivedAt":"2011-08-28T03:57:20Z","isPatch":false,"sender":{"key":"brian@gernhardtsoftware.com","avatar":"https://avatars.githubusercontent.com/u/133455?v=4"},"body":"\nOn Aug 27, 2011, at 6:14 AM, David Aguilar wrote:\n\n> This fixes it for me, but we might want to rearrange the\n> #includes a bit.  I think this needs more work.. including\n> compat/obstack.h from kwset.c seems wrong.\n> Should we just include obstack.h in git-compat-util instead?\n\nIf obstack.h is only used in kwset, I don't see a problem with it.\n\n> -- 8< --\n> Subject: [RFC PATCH] obstack: Fix portability issues\n\nThis patch does solve my compile problem.  Now to track down test failures (unrelated to this issue, I'm very sure).\n\n~~ B"},{"id":"174428","messageId":"20110828200846.GA10754@fredrik-Q430-Q530","threadId":"28233","inReplyTo":"20110827101418.GA8074@gmail.com","subject":"Re: obstack fails to compile on OS X 10.7","fromName":"Fredrik Kuivinen","fromEmail":"frekui@gmail.com","sentAt":"2011-08-28T20:08:46Z","receivedAt":"2011-08-28T20:08:46Z","isPatch":false,"sender":{"key":"frekui@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13770967?v=4"},"body":"On Sat, Aug 27, 2011 at 03:14:43AM -0700, David Aguilar wrote:\n> On Sat, Aug 27, 2011 at 02:21:40AM -0400, Brian Gernhardt wrote:\n> > Some of the errors look like things I could track down, but some just confuse me.  If anyone else could take a look into this, it would be much appreciated.\n> > \n> > ~~ Brian G.\n> > \n> > gcc -o compat/obstack.o -c -MF compat/.depend/obstack.o.d -MMD -MP  -Wall -Wdeclaration-after-statement -Werror -Wno-deprecated-declarations -I. -DUSE_ST_TIMESPEC  -DSHA1_HEADER='\"block-sha1/sha1.h\"'  -DNO_MEMMEM  compat/obstack.c\n> > In file included from compat/obstack.c:30:\n> > compat/obstack.h:190: error: __block attribute can be specified on variables only\n> > compat/obstack.c:70: error: expected specifier-qualifier-list before ‘uintmax_t’\n> > compat/obstack.c:111:24: error: exitfail.h: No such file or directory\n> > cc1: warnings being treated as errors\n> > compat/obstack.c: In function ‘print_and_abort’:\n> > compat/obstack.c:436: warning: implicit declaration of function ‘gettext’\n> > compat/obstack.c:436: warning: incompatible implicit declaration of built-in function ‘gettext’\n> > compat/obstack.c:438: error: ‘exit_failure’ undeclared (first use in this function)\n> > compat/obstack.c:438: error: (Each undeclared identifier is reported only once\n> > compat/obstack.c:438: error: for each function it appears in.)\n> > compat/obstack.c:439: warning: ‘noreturn’ function does return\n> > make: *** [compat/obstack.o] Error 1\n> > \n> > $ gcc --version\n> > i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)\n> \n> I ran into the same thing.\n> \n> This fixes it for me, but we might want to rearrange the\n> #includes a bit.  I think this needs more work.. including\n> compat/obstack.h from kwset.c seems wrong.\n> Should we just include obstack.h in git-compat-util instead?\n> \n> I suspect that more exotic platforms may have problems\n> with obstack.h as well.  This probably needs some testing\n> on SunOS, AIX, IRIX, etc.\n\n\nHow about doing something a bit simpler instead and changing obstack.c\nto not make use of exit.h and exitfail.h? Then we don't have to update\nMakefile for all platforms needing NEEDS_OBSTACK and NEEDS_EXITFAIL.\n\nI don't understand why the ELIDE_CODE check is not sufficient. Care to\nexplain?\n\nSomething like this (tested on Linux and SunOS 5.10):\n\n-- 8< --\n\nSubject: [PATCH RFC] obstack: Fix portability issues\n\ni686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, SunOS 5.10, and possibly\nothers do not have exit.h and exitfail.h. Remove the use of these in\nobstack.c.\n\nThe __block variable was renamed to block to avoid a gcc error:\n\ncompat/obstack.h:190: error: __block attribute can be specified on variables only\n\nInitial-patch-by: David Aguilar <davvid@gmail.com>\nReported-by: Brian Gernhardt <brian@gernhardtsoftware.com>\nSigned-off-by: Fredrik Kuivinen <frekui@gmail.com>\n---\n compat/obstack.c |   35 ++++-------------------------------\n compat/obstack.h |    5 +----\n kwset.c          |    2 +-\n 3 files changed, 6 insertions(+), 36 deletions(-)\n\ndiff --git a/compat/obstack.c b/compat/obstack.c\nindex 75440d9..a89ab5b 100644\n--- a/compat/obstack.c\n+++ b/compat/obstack.c\n@@ -18,17 +18,9 @@\n    Software Foundation, Inc., 51 Franklin Street, Fifth Floor,\n    Boston, MA 02110-1301, USA.  */\n \n-\n-#ifdef HAVE_CONFIG_H\n-# include <config.h>\n-#endif\n-\n-#ifdef _LIBC\n-# include <obstack.h>\n-# include <shlib-compat.h>\n-#else\n-# include \"obstack.h\"\n-#endif\n+#include \"git-compat-util.h\"\n+#include <gettext.h>\n+#include \"obstack.h\"\n \n /* NOTE BEFORE MODIFYING THIS FILE: This version number must be\n    incremented whenever callers compiled using an old obstack.h can no\n@@ -103,15 +95,6 @@ enum\n static void print_and_abort (void);\n void (*obstack_alloc_failed_handler) (void) = print_and_abort;\n \n-/* Exit value used when `print_and_abort' is used.  */\n-# include <stdlib.h>\n-# ifdef _LIBC\n-int obstack_exit_failure = EXIT_FAILURE;\n-# else\n-#  include \"exitfail.h\"\n-#  define obstack_exit_failure exit_failure\n-# endif\n-\n # ifdef _LIBC\n #  if SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)\n /* A looong time ago (before 1994, anyway; we're not sure) this global variable\n@@ -400,16 +383,6 @@ _obstack_memory_used (struct obstack *h)\n   return nbytes;\n }\n \f\n-/* Define the error handler.  */\n-# ifdef _LIBC\n-#  include <libintl.h>\n-# else\n-#  include \"gettext.h\"\n-# endif\n-# ifndef _\n-#  define _(msgid) gettext (msgid)\n-# endif\n-\n # ifdef _LIBC\n #  include <libio/iolibio.h>\n # endif\n@@ -435,7 +408,7 @@ print_and_abort (void)\n # else\n   fprintf (stderr, \"%s\\n\", _(\"memory exhausted\"));\n # endif\n-  exit (obstack_exit_failure);\n+  exit (1);\n }\n \n #endif\t/* !ELIDE_CODE */\ndiff --git a/compat/obstack.h b/compat/obstack.h\nindex 449070e..c3b681f 100644\n--- a/compat/obstack.h\n+++ b/compat/obstack.h\n@@ -187,7 +187,7 @@ extern int _obstack_begin_1 (struct obstack *, int, int,\n \t\t\t     void (*) (void *, void *), void *);\n extern int _obstack_memory_used (struct obstack *);\n \n-void obstack_free (struct obstack *__obstack, void *__block);\n+void obstack_free (struct obstack *obstack, void *block);\n \n \f\n /* Error handler called when `obstack_chunk_alloc' failed to allocate\n@@ -195,9 +195,6 @@ void obstack_free (struct obstack *__obstack, void *__block);\n    should either abort gracefully or use longjump - but shouldn't\n    return.  The default action is to print a message and abort.  */\n extern void (*obstack_alloc_failed_handler) (void);\n-\n-/* Exit value used when `print_and_abort' is used.  */\n-extern int obstack_exit_failure;\n \f\n /* Pointer to beginning of object being allocated or to be allocated next.\n    Note that this might not be the final address of the object\ndiff --git a/kwset.c b/kwset.c\nindex fd4515a..956ae72 100644\n--- a/kwset.c\n+++ b/kwset.c\n@@ -37,7 +37,7 @@\n #include \"cache.h\"\n \n #include \"kwset.h\"\n-#include \"obstack.h\"\n+#include \"compat/obstack.h\"\n \n #define NCHAR (UCHAR_MAX + 1)\n #define obstack_chunk_alloc xmalloc\n-- \n1.7.6.557.gcee4\n"},{"id":"174438","messageId":"20110829031806.GA58338@gmail.com","threadId":"28233","inReplyTo":"20110828200846.GA10754@fredrik-Q430-Q530","subject":"Re: obstack fails to compile on OS X 10.7","fromName":"David Aguilar","fromEmail":"davvid@gmail.com","sentAt":"2011-08-29T03:18:08Z","receivedAt":"2011-08-29T03:18:08Z","isPatch":false,"sender":{"key":"davvid@gmail.com","avatar":"https://avatars.githubusercontent.com/u/13196?v=4"},"body":"On Sun, Aug 28, 2011 at 10:08:46PM +0200, Fredrik Kuivinen wrote:\n> On Sat, Aug 27, 2011 at 03:14:43AM -0700, David Aguilar wrote:\n> > On Sat, Aug 27, 2011 at 02:21:40AM -0400, Brian Gernhardt wrote:\n> > > Some of the errors look like things I could track down, but some just confuse me.  If anyone else could take a look into this, it would be much appreciated.\n> > > \n> > > ~~ Brian G.\n> > > \n> > > gcc -o compat/obstack.o -c -MF compat/.depend/obstack.o.d -MMD -MP  -Wall -Wdeclaration-after-statement -Werror -Wno-deprecated-declarations -I. -DUSE_ST_TIMESPEC  -DSHA1_HEADER='\"block-sha1/sha1.h\"'  -DNO_MEMMEM  compat/obstack.c\n> > > In file included from compat/obstack.c:30:\n> > > compat/obstack.h:190: error: __block attribute can be specified on variables only\n> > > compat/obstack.c:70: error: expected specifier-qualifier-list before ‘uintmax_t’\n> > > compat/obstack.c:111:24: error: exitfail.h: No such file or directory\n> > > cc1: warnings being treated as errors\n> > > compat/obstack.c: In function ‘print_and_abort’:\n> > > compat/obstack.c:436: warning: implicit declaration of function ‘gettext’\n> > > compat/obstack.c:436: warning: incompatible implicit declaration of built-in function ‘gettext’\n> > > compat/obstack.c:438: error: ‘exit_failure’ undeclared (first use in this function)\n> > > compat/obstack.c:438: error: (Each undeclared identifier is reported only once\n> > > compat/obstack.c:438: error: for each function it appears in.)\n> > > compat/obstack.c:439: warning: ‘noreturn’ function does return\n> > > make: *** [compat/obstack.o] Error 1\n> > > \n> > > $ gcc --version\n> > > i686-apple-darwin11-llvm-gcc-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)\n> > \n> > I ran into the same thing.\n> > \n> > This fixes it for me, but we might want to rearrange the\n> > #includes a bit.  I think this needs more work.. including\n> > compat/obstack.h from kwset.c seems wrong.\n> > Should we just include obstack.h in git-compat-util instead?\n> > \n> > I suspect that more exotic platforms may have problems\n> > with obstack.h as well.  This probably needs some testing\n> > on SunOS, AIX, IRIX, etc.\n> \n> \n> How about doing something a bit simpler instead and changing obstack.c\n> to not make use of exit.h and exitfail.h? Then we don't have to update\n> Makefile for all platforms needing NEEDS_OBSTACK and NEEDS_EXITFAIL.\n\nI like this much better.  Less code is better code.\n\n> I don't understand why the ELIDE_CODE check is not sufficient. Care to\n> explain?\n\nI can't say I know.  The intention of the check is to avoid\npulling in that section of code when it is already built-in to\nthe C library.  Maybe that check doesn't quite mean the same\nthing when the file is used alone outside of its original\ncontext?\n\n> -void obstack_free (struct obstack *__obstack, void *__block);\n> +void obstack_free (struct obstack *obstack, void *block);\n\nTiny nit: I know it's just a declaration but would it be\nadvisable to drop the variable names altogether here?\nHaving a pointer and a structure with the same \"obstack\"\nname could be confusing.\n\nThis looks good otherwise.  I was a bit iffy about my patch\nwhen I had to bring in the extra headers.\nDoing without them is much better.\n\nI tried your patch on top of my recent\n\"Improve compiler header dependency check\" and it worked fine.\n\nSo...\nTested-by: David Aguilar <davvid@gmail.com>\n-- \n\t\t\t\t\tDavid\n"},{"id":"174445","messageId":"7vty907nud.fsf@alter.siamese.dyndns.org","threadId":"28233","inReplyTo":"20110829031806.GA58338@gmail.com","subject":"Re: obstack fails to compile on OS X 10.7","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-08-29T06:07:06Z","receivedAt":"2011-08-29T06:07:06Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Aguilar <davvid@gmail.com> writes:\n\n>> -void obstack_free (struct obstack *__obstack, void *__block);\n>> +void obstack_free (struct obstack *obstack, void *block);\n>\n> Tiny nit: I know it's just a declaration but would it be advisable to\n> drop the variable names altogether here?\n\nI agree. In general it is easier to read if parameter names to a function\ndeclaration is omitted, especially if it is clear from their types what\nthey mean [*1*]. And in this case, it is.\n\n> Tested-by: David Aguilar <davvid@gmail.com>\n\nThanks.\n\n[Footnote]\n\n*1* It is Ok to spell them out in a case like this:\n\n    int copy(char *dst, const char *src, size_t);\n\nYou do not have to, as \"char *\" vs \"const char *\" makes it clear which one\nis which.\n"},{"id":"174691","messageId":"4E5FC14A.8040008@ramsay1.demon.co.uk","threadId":"28233","inReplyTo":"20110828200846.GA10754@fredrik-Q430-Q530","subject":"Re: obstack fails to compile on OS X 10.7","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2011-09-01T17:30:50Z","receivedAt":"2011-09-01T17:30:50Z","isPatch":false,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"Fredrik Kuivinen wrote:\n> On Sat, Aug 27, 2011 at 03:14:43AM -0700, David Aguilar wrote:\n>> On Sat, Aug 27, 2011 at 02:21:40AM -0400, Brian Gernhardt wrote:\n[snip]\n>> I suspect that more exotic platforms may have problems\n>> with obstack.h as well.  This probably needs some testing\n>> on SunOS, AIX, IRIX, etc.\n\nJust FYI, my cygwin and mingw builds failed in the same way as OS X ...\n\n> Something like this (tested on Linux and SunOS 5.10):\n> \n> -- 8< --\n> \n> Subject: [PATCH RFC] obstack: Fix portability issues\n> \n> i686-apple-darwin10-gcc-4.2.1 (GCC) 4.2.1, SunOS 5.10, and possibly\n> others do not have exit.h and exitfail.h. Remove the use of these in\n> obstack.c.\n> \n> The __block variable was renamed to block to avoid a gcc error:\n> \n> compat/obstack.h:190: error: __block attribute can be specified on variables only\n> \n> Initial-patch-by: David Aguilar <davvid@gmail.com>\n> Reported-by: Brian Gernhardt <brian@gernhardtsoftware.com>\n> Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>\n> ---\n\n... and this fixes the build(s) just fine[1]. Thanks!\n\nATB,\nRamsay Jones\n\n[1] Well the build is fine on cygwin, but the mingw build fails for\nan unrelated reason; compat/obstack.c compiles just fine.\n"}]}