gupascal / distcc

distcc: a fast, free distributed C/C++ compiler. Automatically exported from code.google.com/p/distcc
GNU General Public License v2.0
0 stars 0 forks source link

distcc 3.2rc1 compiler warnings on Windows/Cygwin #125

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Compiling distcc3.2rc1 on Windows/Cygwin causes some compiler warnings of the 
following form:

cc1: warnings being treated as errors
../src/gcc-id.c: In function ‘strip_bad_chars’:
../src/gcc-id.c:45:13: error: array subscript has type ‘char’
Makefile:448: recipe for target `src/gcc-id.o' failed

The problem with these warnings is that they are treated as errors by default 
(unless --disable-Werror is passed to configure)

The following macros are involved (copied from ctype.h):

#   define tolower(__c) \
  __extension__ ({ __typeof__ (__c) __x = (__c);    \
      isupper (__x) ? (int) __x - 'A' + 'a' : (int) __x;})

#define isupper(__c)    ((__ctype_lookup(__c)&(_U|_L))==_U)

/* These macros are intentionally written in a manner that will trigger
   a gcc -Wall warning if the user mistakenly passes a 'char' instead
   of an int containing an 'unsigned char'.  Note that the sizeof will
   always be 1, which is what we want for mapping EOF to __ctype_ptr__[0];
   the use of a raw index inside the sizeof triggers the gcc warning if
   __c was of type char, and sizeof masks side effects of the extra __c.
   Meanwhile, the real index to __ctype_ptr__+1 must be cast to int,
   since isalpha(0x100000001LL) must equal isalpha(1), rather than being
   an out-of-bounds reference on a 64-bit machine.  */
#define __ctype_lookup(__c) ((__ctype_ptr__+sizeof(""[__c]))[(int)(__c)])

Unfortunately, I don't understand what should be wrong with the distcc source 
code. Maybe someone else has a clue what's wrong (a cygwin/newlib bug?). IMHO 
it would be nice to fix this issue in order to make a "./configure && make && 
make install" work on cygwin.

Original issue reported on code.google.com by zull...@gmail.com on 24 Feb 2013 at 10:32