Bug #2461
closedINT64_MAX,INT64_MIN long long definition conflicts on x86_64 with firefox 17.0esr build
0%
Description
On current pkgsrc master, 3.3-DEVELOPMENT x86_64, building devel/xulrunner, associated with firefox 17.0esr, fails processing a C++ header file with an error message:
In file included from ../../dist/include/mozilla/FunctionTimer.h:11,
from /usr/pkgsrc/devel/xulrunner/work/mozilla-esr17/xpcom/glue/FileUtils.cpp:20:
../../dist/include/mozilla/TimeStamp.h: In static member function 'static mozilla::TimeDuration mozilla::TimeDuration::FromTicks(double)':
../../dist/include/mozilla/TimeStamp.h:137: error: call of overloaded 'FromTicks(long long int)' is ambiguous
../../dist/include/mozilla/TimeStamp.h:123: note: candidates are: static mozilla::TimeDuration mozilla::TimeDuration::FromTicks(int64_t)
../../dist/include/mozilla/TimeStamp.h:129: note: static mozilla::TimeDuration mozilla::TimeDuration::FromTicks(double)
gmake4: *** [FileUtils.o] Error 1
The relevant lines from the original TimeStamp.h located under devel/xulrunner/work/mozilla-esr17/xpcom/ds appear to be:
static TimeDuration FromTicks(int64_t aTicks) {
TimeDuration t;
t.mValue = aTicks;
return t;
}
static TimeDuration FromTicks(double aTicks) {
// NOTE: this MUST be a >= test, because int64_t(double(INT64_MAX))
// overflows and gives LL_MININT.
if (aTicks >= double(INT64_MAX))
return TimeDuration::FromTicks(INT64_MAX);
// This MUST be a <= test.
if (aTicks <= double(INT64_MIN))
return TimeDuration::FromTicks(INT64_MIN);
return TimeDuration::FromTicks(int64_t(aTicks));
}
// Duration in PRIntervalTime units
int64_t mValue;
A patch explictly casting in the above header file TimeStamp.h both INT64_MAX and INT64_MIN to int64_t allows building to at least proceed past the previous error.
Grepping for INT64_MAX and INT64_MIN under /usr/include reveals definitions:
#define INT64_MAX 0x7fffffffffffffffLL
#define INT64_MIN (-0x7fffffffffffffffLL-1)
The compiler being used is:
$ cc --version
cc (DragonFly) 4.4.7 2012.03.13
Files