Subject: Re: problem compiling egcs cpp
To: None <current-users@netbsd.org>
From: Johnny C. Lam <lamj@stat.cmu.edu>
List: current-users
Date: 09/30/1998 04:34:08
After studying the code, I see the problem is here:

src/gnu/dist/gcc/cexp.y (line 161):

#define MAX_WCHAR_TYPE_MASK (MAX_WCHAR_TYPE_SIZE < HOST_BITS_PER_WIDE_INT \
                             ? ~ (~ (HOST_WIDE_INT) 0 << MAX_WCHAR_TYPE_SIZE) \
                             : ~ (HOST_WIDE_INT) 0)

On i386, HOST_WIDE_INT is long, and MAX_WCHAR_TYPE_SIZE == 32, so when
gcc-2.7.2 evaluates the subexpressions of the macro, the middle piece
performing the bit shifts is faulted for over-shifting.

I assume egcs would also give the same warning, and the compile of cpp
would break if compiled with -Werror.

The following patch fixes things:

*** src/gnu/usr.bin/egcs/cpp/Makefile	Mon Aug 17 07:12:31 1998
--- /ANNOY-U2/lamj/Makefile	Wed Sep 30 04:29:19 1998
***************
*** 6,11 ****
--- 6,12 ----
  SRCS=		cccp.c cexp.y obstack.c prefix.c version.c 
  CPPFLAGS+=	-DGCC_INCLUDE_DIR=\"\" \
  		-DGPLUSPLUS_INCLUDE_DIR=\"/usr/include/g++\"
+ CWARNFLAGS+=	-Wno-error
  
  LINKS=		/usr/bin/cpp /usr/bin/gcpp
  FILES=		usr.bin.cpp.sh

--
   Johnny C. Lam
   Department of Statistics             lamj@stat.cmu.edu
   Carnegie Mellon University           http://www.stat.cmu.edu/~lamj/

                            @>---`---,----