Hey all. So FreeBSD is shifting to gcc41 on its development
branch in the near future. As a result we are trying to get
all of the various 3rd party ports to work properly with
gcc41. I'm currently hitting a problem compiling pwlib
(1.10.2 but the code is unchanged in 1.10.3) on an AMD64
using gcc41 (compiles fine on an i386 32 bit machine):
g++ -O1
-I/work/a/ports/devel/pwlib/work/pwlib_v1_10_2/include
-I/usr/local/include -D_REENTRANT -pthread -Wall -g
-D_DEBUG -DNDEBUG
-I/work/a/ports/devel/pwlib/work/pwlib_v1_10_2/include -O2
-fno-strict-aliasing -pipe -fPIC -O1
-I/work/a/ports/devel/pwlib/work/pwlib_v1_10_2/include
-I/usr/local/include -felide-constructors -Wreorder -c
svcproc.cxx -o
/work/a/ports/devel/pwlib/work/pwlib_v1_10_2/lib/obj_d/svcpr
oc.o
svcproc.cxx: In static member function 'static void
PSystemLog::Output(PSystemLog::Level, const char*)':
svcproc.cxx:391: error: cast from 'pthread*' to 'unsigned
int' loses precision
svcproc.cxx: In member function 'virtual void
PServiceProcess::PXOnAsyncSignal(int)':
svcproc.cxx:941: error: cast from 'pthread*' to 'unsigned
int' loses precision
Lines 391 and 941 are the same code:
unsigned tid = (unsigned) pthread_self();
This is incorrect on a 64-bit platform because pointers are
8 bytes and integers only 4 bytes. So... would the more
correct fix be to move this to an 'unsigned long' (8 bytes)
or to compile it as a 32 bit application (using the -m32
flag to g++)?
The cast on line 391 is used in SystemOut:
*out << "ThreadID=0x"
<< setfill('0') << ::hex
<< setw(8) << tid
<< setfill(' ') << ::dec;
Which may just work unchanged as 8 bytes are already being
set as the width of 'tid'. Cosmetically it may want a
larger
number but will work as is.
On line 941 the only time that that variable gets used
is:
sprintf(msg, "nCaught %s, thread_id=%u",
sigmsg, tid);
Would simply change this to %x instead of %u.
Thoughts?
-Steve
------------------------------------------------------------
------------
Check the FAQ before asking! - http://www.
openh323.org/~openh323/fom.cgi
The OpenH323 Project mailing list, using Mailman. To
unsubscribe or
change your subscription options, goto
htt
p://www.openh323.org/mailman/listinfo/openh323
Maintained by Quicknet Technologies, Inc - http://www.quicknet.net
------------------------------------------------------------
------------
|