[DragonFlyBSD - Bug #2461] INT64_MAX, INT64_MIN long long definition conflicts on x86_64 with firefox 17.0esr build
David Shao via Redmine
bugtracker-admin at leaf.dragonflybsd.org
Wed Nov 28 22:41:07 PST 2012
Issue #2461 has been updated by David Shao.
File cppint64min.cpp added
On DragonFly x86_64 for test file cppint64min.cpp
$ c++ -DUSECSTDINT -std=c++0x cppint64min.cpp
cppint64min.cpp: In function 'int main()':
cppint64min.cpp:22: error: call of overloaded 'printVal(long long int)' is ambiguous
cppint64min.cpp:10: note: candidates are: void TwoTypes::printVal(double)
cppint64min.cpp:14: note: void TwoTypes::printVal(int64_t)
whereas on NetBSD amd64 and Ubuntu 12.04 LTS
$ c++ -DUSECSTDINT -std=c++0x cppint64min.cpp
int64_t val = -9223372036854775808
(On Mac OS X Lion the same output occurs with command simply c++ cppint64min.cpp.)
#ifdef USECSTDINT
#include <cstdint>
#else
#include <stdint.h>
#endif
#include <iostream>
class TwoTypes {
public:
void printVal(double val) {
std::cout << "double val = " << val << "\n";
}
void printVal(int64_t val) {
std::cout << "int64_t val = " << val << "\n";
}
};
int main() {
TwoTypes t;
t.printVal(INT64_MIN);
return 0;
}
----------------------------------------
Bug #2461: INT64_MAX,INT64_MIN long long definition conflicts on x86_64 with firefox 17.0esr build
http://bugs.dragonflybsd.org/issues/2461
Author: David Shao
Status: New
Priority: Normal
Assignee:
Category:
Target version:
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)
gmake[4]: *** [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
--
You have received this notification because you have either subscribed to it, or are involved in it.
To change your notification preferences, please click here: http://bugs.dragonflybsd.org/my/account
More information about the Bugs
mailing list