hefeix / szl

Automatically exported from code.google.com/p/szl
Other
0 stars 0 forks source link

./public/porting.h:51: error: conflicting declaration 'typedef long unsigned int uintptr_t' #5

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Compiling on Ubuntu 10.4 (32 bit):

    make[3]: Entering directory `/home/carlos/src/szl-svn/protobuf-location/src'
    /bin/bash ../libtool  --tag=CXX   --mode=compile g++ -DHAVE_CONFIG_H -I. -I..   -pthread -I/opt/protobuf/2.3.0/include    -pthread -g -O2 -g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNDEBUG -pthread -O2 -DSZL_BIG_ENDIAN=1 -DSZL_LITTLE_ENDIAN=2 -DSZL_BYTE_ORDER=2 -g -O1 -pthread -g -O2 -g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNDEBUG -MT analyzer.lo -MD -MP -MF .deps/analyzer.Tpo -c -o analyzer.lo `test -f 'engine/analyzer.cc' || echo './'`engine/analyzer.cc
    libtool: compile:  g++ -DHAVE_CONFIG_H -I. -I.. -pthread -I/opt/protobuf/2.3.0/include -pthread -g -O2 -g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNDEBUG -pthread -O2 -DSZL_BIG_ENDIAN=1 -DSZL_LITTLE_ENDIAN=2 -DSZL_BYTE_ORDER=2 -g -O1 -pthread -g -O2 -g -Wall -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare -DNDEBUG -MT analyzer.lo -MD -MP -MF .deps/analyzer.Tpo -c engine/analyzer.cc  -fPIC -DPIC -o .libs/analyzer.o
    In file included from ./engine/globals.h:20,
                     from engine/analyzer.cc:20:
    ./public/porting.h:51: error: conflicting declaration ‘typedef long unsigned int uintptr_t’
    /usr/include/stdint.h:129: error: ‘uintptr_t’ has a previous declaration as ‘typedef unsigned int uintptr_t’
    make[3]: *** [analyzer.lo] Error 1
    make[3]: Leaving directory `/home/carlos/src/szl-svn/protobuf-location/src'
    make[2]: *** [all] Error 2
    make[2]: Leaving directory `/home/carlos/src/szl-svn/protobuf-location/src'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/carlos/src/szl-svn/protobuf-location'
    make: *** [all] Error 2

The attached diff skips the typedef if ``stdint.h`` has been found: It seems 
that C99 specifies that type (http://en.wikipedia.org/wiki/Stdint.h)

Original issue reported on code.google.com by superdup...@gmail.com on 5 Nov 2010 at 7:10

Attachments:

GoogleCodeExporter commented 8 years ago
A similar fix is part of the patch I just attached to issue 11.  This one looks 
good to me, for what it's worth.

 --Adrian.

Original comment by aecolley on 8 Nov 2010 at 3:50

GoogleCodeExporter commented 8 years ago
After commenting a line of code ("typedef unsigned long uintptr_t;") in 
"src/public/porting.h" .it works !

Thanks.

Original comment by xuyi...@gmail.com on 10 Nov 2010 at 7:22

GoogleCodeExporter commented 8 years ago
I just realised that, by including ``config.h`` in ``porting.h``, the resulting 
``porting.h`` cannot be used to compile programs outside ``szl``'s source tree 
(since ``config.h`` does not get installed), so please disregard the first diff.

Alternative solutions would be to:

  1. Assume ``intptr_t`` is defined by ``stdint.h`` (it is an *optional* feature, according to the Wikipedia link above) and remove the typedef, or

  2. Do an explicit check for ``intptr_t`` in ``configure.ac``, and, if ``intptr_t`` is not available, define it accordingly in ``porting.h``.

The attached diff takes the first approach. It is the same as aecolley's patch 
to issue 11.

Original comment by superdup...@gmail.com on 10 Nov 2010 at 9:01

Attachments:

GoogleCodeExporter commented 8 years ago
r39 should fix this.

Original comment by dbh@google.com on 14 Nov 2010 at 10:32

GoogleCodeExporter commented 8 years ago

Original comment by dbh@google.com on 14 Nov 2010 at 11:11

GoogleCodeExporter commented 8 years ago
Yep, just compiled r40 on 32-bit Linux. Thanks, David!

Original comment by superdup...@gmail.com on 15 Nov 2010 at 1:22

GoogleCodeExporter commented 8 years ago

Original comment by dbh@google.com on 16 Nov 2010 at 2:59