Closed Bug 483799 Opened 16 years ago Closed 15 years ago

unable to build ssltunnel.cpp for wince due to no std::max support

Categories

(Testing :: Mochitest, defect)

ARM
Windows CE
defect
Not set
normal

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: jmaher, Assigned: hiro)

References

Details

Attachments

(1 file)

building xulrunner with --enable-tests for wince results in failure. This is due to: http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/ssltunnel/ssltunnel.cpp#862 we don't have a std::max available to use in the wince build. Instead, if we change this to a simple comparison it will work: a>b?a:b This was resolved by doing this: #define PR_MAX(x,y) ((x)>(y)?(x):(y)) threads = PR_CreateThreadPool(PR_MAX(INITIAL_THREADS, servers.size()*2), PR_MAX(MAX_THREADS, servers.size()*2), DEFAULT_STACKSIZE); We should consider doing this for all platforms instead of #ifdef for wince only.
Would adding #ifdef WINCE namespace std { template<typename T> inline const T& max(const T& a, const T& b) { return a < b ? b : a; } } #endif do the trick?
I tried building with this code. I put this at the top (after the #include) in ssltunnel.cpp and it does not build: c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(71) : error C2226: synt ax error : unexpected type 'T' c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(71) : error C2988: unre cognizable template declaration/definition c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(71) : error C2059: synt ax error : '<cv-qualifer>' c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(71) : error C2059: synt ax error : ')' c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(75) : error C2143: synt ax error : missing ';' before '}' c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(96) : error C2143: synt ax error : missing ';' before 'identifier' c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(96) : error C2332: 'str uct' : missing tag name c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(96) : error C3306: '<un named-tag>': unnamed class template is not allowed c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(96) : warning C4094: un tagged 'struct' declared no symbols c:/mozilla/src/testing/mochitest/ssltunnel/ssltunnel.cpp(96) : fatal error C1004 : unexpected end-of-file found make[2]: *** [ssltunnel.obj] Error 2 make[2]: Leaving directory `/c/mozilla/src/objdir-wm6/xulrunner/testing/mochites t/ssltunnel' make[1]: *** [libs] Error 2 make[1]: Leaving directory `/c/mozilla/src/objdir-wm6/xulrunner/testing/mochites t' make: *** [all] Error 2 make: Leaving directory `/c/mozilla/src/objdir-wm6/xulrunner/testing/mochitest' mozilla@MOZILLA-QA /c/mozilla/src $
How about #ifdef WINCE namespace std { template<class T> inline const T& max(const T& a, const T& b) { return a < b ? b : a; } } #endif or #ifdef WINCE namespace std { template<typename T> inline T& max(T& a, T& b) { return a < b ? b : a; } } #endif or #ifdef WINCE namespace std { template<class T> inline T& max(T& a, T& b) { return a < b ? b : a; } } #endif ?
All of the above fail with the same (or very similar) errors. After hunting around, I believe we disable STL in our builds: http://mxr.mozilla.org/mozilla-central/source/build/wince/tools/arm-wince-gcc.c#40 I am not sure if there is a reason for this. If I build with -GR instead of -GR- in the CLI, I get this: cl : Command line warning D9025 : overriding '/GR-' with '/GR' This is misleading, because this warning doesn't show up when I have -GR-. Is there a need for using STL in our code? There is so little used it seems like we could remove it without many headaches.
Attached patch A patch (deleted) — Splinter Review
I agree Joel' suggestion. PR_MAX might be sufficient.
I verified this patch will allow --enable-tests to build on wince
Assignee: nobody → ikezoe
Status: NEW → ASSIGNED
Attachment #376169 - Flags: review?(jwalden+bmo)
Comment on attachment 376169 [details] [diff] [review] A patch I don't really like using a macro where there's a standardized way to do this, but I guess it's the only option here.
Attachment #376169 - Flags: review?(jwalden+bmo) → review+
Keywords: checkin-needed
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
verified with 1.9.2 build and winmo alpha3
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: