[EMAIL PROTECTED] writes: > ./configure CC=g++ does not work as is done in the > automated tests from beebe, in bison-2.1 logfiles. > But should it work with g++ instead of gcc ?
Personally I don't think it's worth worrying about. People shouldn't tell 'configure' to use a C++ compiler as if it were a C compiler, because the two languages are not compatible. However, if someone really needs this for some reason, I suppose they can send in the patches and we'll take a look. > Did anyone look in those logfiles? Reading it, > saw few more details there to improve bison. > > See also > http://www.math.utah.edu/~beebe/ Thanks for mentioning this. I looked there, but couldn't find the logfiles that you mentioned. Do you have a more-precise URL? > also compiler warnings from MIPSpro Compiler like: > cc-1116 cc: WARNING File = abitset.c, Line = 45 > Non-void function "abitset_resize" (declared at line 37) should return a > value. > cc-1116 cc: WARNING File = state.c, Line = 65 > Non-void function "transitions_to" (declared at line 58) should return a > value. I hope the patch below fixes these. I can't easily test this; nor can I test whether any of the other patches noted below actually fix the problem on these weird compilers. But I think the patch is pretty safe (I have tested it on GNU/Linux) so I have installed it. > cc -DHAVE_CONFIG_H -I. -I. -I.. -I/usr/local/include > -I/usr/local/include -c abitset.c > cc-1185 cc: WARNING File = bitset.h, Line = 165 > An enumerated type is mixed with another type. > > return (bset->b.cdata[offset] >> (bitno % BITSET_WORD_BITS)) & 1; I hope the stdbool patch in <http://lists.gnu.org/archive/html/bug-gnulib/2006-01/msg00199.html> this kind of diagnostic. I haven't installed this yet into gnulib or Bison, but we'll get it into Bison one way or another. > cc-1116 cc: WARNING File = bitset.c, Line = 96 > Non-void function "bitset_init" (declared at line 74) should return a > value. I don't see an easy way to address this warning. The problem is that GCC prefers switch (E) to have a case for all possible values of the enum type for E (assuming E has an enum type), and we use 'default: abort();' to tell GCC that we don't care about missing cases. I don't see any other easy way to tell GCC this. Perhaps someone who has access to this weird compiler can figure out a way that will pacify both it and GCC. > cc -DHAVE_CONFIG_H -DPKGDATADIR=\"/usr/local/share/bison\" > -DLOCALEDIR=\"/usr/local/share/locale\" -I. -I. -I.. -I../lib -I../lib > -I/usr/local/include -I/usr/local/include -c scan-gram.c > cc-1047 cc: WARNING File = /usr/include/inttypes.h, Line = 87 > Macro "INT8_MIN" (declared at line 69 of "scan-gram.c") has an incompatible > redefinition. > > #define INT8_MIN (-127-1) > ^ This is a glitch in flex. I hope the patch below fixes it. > CC -DHAVE_CONFIG_H -I. -I. -I../.. -I/usr/local/include > -I/usr/local/include -LANG:std -c -o calc++-scanner.o calc++-scanner.cc > cc-1005 CC: ERROR File = ./calc++-scanner.ll, Line = 2 > The source file "cstdlib" is unavailable. > > # include <cstdlib> > ^ I hope the patch below fixes this as well. I installed this. Thanks for reporting all these problems. 2006-01-19 Paul Eggert <[EMAIL PROTECTED]> Fix some porting glitches found by Nelson H. F. Beebe. * lib/abitset.c (abitset_resize): Rewrite to avoid warnings from compilers that don't understand that abort () does not return. * src/state.c (transitions_to): Likewise. * m4/cxx.m4 (BISON_TEST_FOR_WORKING_CXX_COMPILER): Check that '#include <cstdlib>' works. * src/system.h (INT8_MIN, INT16_MIN, INT32_MIN, INT8_MAX): (INT16_MAX, UINT8_MAX, INT32_MAX, UINT16_MAX, UINT32_MAX): #undef if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901, for the benefit of some pre-C99 compilers. Index: lib/abitset.c =================================================================== RCS file: /cvsroot/bison/bison/lib/abitset.c,v retrieving revision 1.9 diff -p -u -r1.9 abitset.c --- lib/abitset.c 14 May 2005 06:49:46 -0000 1.9 +++ lib/abitset.c 20 Jan 2006 01:57:01 -0000 @@ -1,5 +1,5 @@ /* Array bitsets. - Copyright (C) 2002, 2003 Free Software Foundation, Inc. + Copyright (C) 2002, 2003, 2006 Free Software Foundation, Inc. Contributed by Michael Hayes ([EMAIL PROTECTED]). This program is free software; you can redistribute it and/or modify @@ -37,11 +37,11 @@ static bitset_bindex abitset_resize (bitset src ATTRIBUTE_UNUSED, bitset_bindex size ATTRIBUTE_UNUSED) { - if (BITSET_SIZE_ (src) == size) - return size; - /* These bitsets have a fixed size. */ - abort (); + if (BITSET_SIZE_ (src) != size) + abort (); + + return size; } /* Find list of up to NUM bits set in BSET starting from and including Index: m4/cxx.m4 =================================================================== RCS file: /cvsroot/bison/bison/m4/cxx.m4,v retrieving revision 1.4 diff -p -u -r1.4 cxx.m4 --- m4/cxx.m4 10 Nov 2005 00:33:04 -0000 1.4 +++ m4/cxx.m4 20 Jan 2006 01:57:01 -0000 @@ -1,7 +1,7 @@ # -*- Autoconf -*- # Sanity-test a C++ compiler. # -# Copyright (C) 2004 Free Software Foundation, Inc. +# Copyright (C) 2004, 2006 Free Software Foundation, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301 USA -# Written by Paul Eggert <[EMAIL PROTECTED]>. +# Written by Paul Eggert. AC_DEFUN([BISON_TEST_FOR_WORKING_CXX_COMPILER], [ @@ -27,7 +27,8 @@ AC_DEFUN([BISON_TEST_FOR_WORKING_CXX_COM [AC_LANG_PUSH([C++]) AC_RUN_IFELSE( [AC_LANG_PROGRAM( - [#include <iostream> + [#include <cstdlib> + #include <iostream> using namespace std;], [std::cerr << ""; cout << "";])], Index: src/state.c =================================================================== RCS file: /cvsroot/bison/bison/src/state.c,v retrieving revision 1.38 diff -p -u -r1.38 state.c --- src/state.c 9 Dec 2005 23:51:26 -0000 1.38 +++ src/state.c 20 Jan 2006 01:57:01 -0000 @@ -1,6 +1,7 @@ /* Type definitions for nondeterministic finite state machine for Bison. - Copyright (C) 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software + Foundation, Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -58,10 +59,13 @@ state * transitions_to (transitions *shifts, symbol_number sym) { int j; - for (j = 0; j < shifts->num; j++) - if (TRANSITION_SYMBOL (shifts, j) == sym) - return shifts->states[j]; - abort (); + for (j = 0; ; j++) + { + if (shifts->num <= j) + abort (); + if (TRANSITION_SYMBOL (shifts, j) == sym) + return shifts->states[j]; + } } Index: src/system.h =================================================================== RCS file: /cvsroot/bison/bison/src/system.h,v retrieving revision 1.73 diff -p -u -r1.73 system.h --- src/system.h 9 Dec 2005 23:51:26 -0000 1.73 +++ src/system.h 20 Jan 2006 01:57:01 -0000 @@ -1,7 +1,7 @@ /* System-dependent definitions for Bison. - Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005 Free Software - Foundation, Inc. + Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free + Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,22 @@ #ifndef BISON_SYSTEM_H #define BISON_SYSTEM_H +/* flex 2.5.31 gratutiously defines macros like INT8_MIN. But this + runs afoul of pre-C99 compilers that have <inttypes.h> or + <stdint.h>, which are included below if available. It also runs + afoul of pre-C99 compilers that define these macros in <limits.h>. */ +#if ! defined __STDC_VERSION__ || __STDC_VERSION__ < 199901 +# undef INT8_MIN +# undef INT16_MIN +# undef INT32_MIN +# undef INT8_MAX +# undef INT16_MAX +# undef UINT8_MAX +# undef INT32_MAX +# undef UINT16_MAX +# undef UINT32_MAX +#endif + #include <limits.h> #include <stddef.h> #include <stdlib.h>
