Last Comment Bug 584680 - nsWindowsDllBlocklist.cpp compilation failure on mingw
: nsWindowsDllBlocklist.cpp compilation failure on mingw
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: x86_64 Linux
: -- normal (vote)
: mozilla7
Assigned To: Jacek Caban
:
: Nathan Froyd [:froydnj]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-08-05 05:50 PDT by Jacek Caban
Modified: 2011-06-21 15:06 PDT (History)
1 user (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
fix v1.0 (2.96 KB, patch)
2010-08-05 05:50 PDT, Jacek Caban
no flags Details | Diff | Splinter Review
fix v1.1 (2.90 KB, patch)
2011-06-20 05:13 PDT, Jacek Caban
ehsan: review+
Details | Diff | Splinter Review

Description Jacek Caban 2010-08-05 05:50:52 PDT
Created attachment 463141 [details] [diff] [review]
fix v1.0

There are a few problems. First:

In file included from /home/jacek/mozilla-build/mozilla-central/browser/app/nsBrowserApp.cpp:60:0:
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsWMain.cpp:12:4: error: missing binary operator before token "!"

nsWindowsWMain.cpp is missing && operator here:

#if defined(_MSC_VER) && defined(_M_IX86) && defined(XRE_WANT_DLL_BLOCKLIST) \
   !defined(MOZ_ENABLE_LIBXUL)


/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp: In function 'NTSTATUS patched_LdrLoadDll(WCHAR*, ULONG*, UNICODE_STRING*, void**)':
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:204:76: error: no matching function for call to 'nsAutoArrayPtr<unsigned char>::nsAutoArrayPtr(nsAutoArrayPtr<unsigned char>)'
../../dist/include/nsAutoPtr.h:554:7: note: candidates are: nsAutoArrayPtr<T>::nsAutoArrayPtr(nsAutoArrayPtr<T>&) [with T = unsigned char]
../../dist/include/nsAutoPtr.h:548:7: note:                 nsAutoArrayPtr<T>::nsAutoArrayPtr(T*) [with T = unsigned char]
../../dist/include/nsAutoPtr.h:542:7: note:                 nsAutoArrayPtr<T>::nsAutoArrayPtr() [with T = unsigned char]

It's a known difference between MSVC and GCC, see bug 505711 comment 8. We need an explicit constructor call here.

/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:231:1: error: jump to label 'continue_loading'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:148:12: error:   from here
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:165:17: error:   crosses initialization of 'DllBlockInfo* info'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:231:1: error: jump to label 'continue_loading'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:138:10: error:   from here
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:165:17: error:   crosses initialization of 'DllBlockInfo* info'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:231:1: error: jump to label 'continue_loading'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:116:10: error:   from here
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:165:17: error:   crosses initialization of 'DllBlockInfo* info'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:119:12: error:   crosses initialization of 'wchar_t* dll_part'

info and dll_part need to be declared before the first goto statement.

/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllBlocklist.cpp:256:95: error: no matching function for call to 'WindowsDllInterceptor::AddHook(const char [11], NTSTATUS (&)(WCHAR*, ULONG*, UNICODE_STRING*, void**), void**)'
/home/jacek/mozilla-build/mozilla-central/toolkit/library/../xre/nsWindowsDllInterceptor.h:112:8: note: candidate is: bool WindowsDllInterceptor::AddHook(const char*, void*, void**) <near match>

We need an explicit cast of the second argument here.


Also I hit PR_STATIC_ASSERT(sizeof(PULONG) == sizeof(ULONG)) on mingw-w64 build. It seems like DLL blocking is not supported on win64 builds, so I've copied defined(_M_IX86) guard from nsWindowsWMain.cpp to nsDllMain.cpp.
Comment 1 Jacek Caban 2011-02-20 12:34:04 PST
This is no longer needed after backout of bug 286382
Comment 2 Jacek Caban 2011-06-20 05:13:02 PDT
The problem is back, with fewer errors:

/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:177:76: error: no matching function for call to 'nsAutoArrayPtr<unsigned char>::nsAutoArrayPtr(nsAutoArrayPtr<unsigned char>)'
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:177:76: note: candidates are:
../../dist/include/nsAutoPtr.h:554:7: note: nsAutoArrayPtr<T>::nsAutoArrayPtr(nsAutoArrayPtr<T>&) [with T = unsigned char]
../../dist/include/nsAutoPtr.h:554:7: note:   no known conversion for argument 1 from 'nsAutoArrayPtr<unsigned char>' to 'nsAutoArrayPtr<unsigned char>&'
../../dist/include/nsAutoPtr.h:548:7: note: nsAutoArrayPtr<T>::nsAutoArrayPtr(T*) [with T = unsigned char]
../../dist/include/nsAutoPtr.h:548:7: note:   no known conversion for argument 1 from 'nsAutoArrayPtr<unsigned char>' to 'unsigned char*'
../../dist/include/nsAutoPtr.h:542:7: note: nsAutoArrayPtr<T>::nsAutoArrayPtr() [with T = unsigned char]
../../dist/include/nsAutoPtr.h:542:7: note:   candidate expects 0 arguments, 1 provided
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:204:1: error: jump to label 'continue_loading' [-fpermissive]
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:121:12: error:   from here [-fpermissive]
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:138:17: error:   crosses initialization of 'DllBlockInfo* info'
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:204:1: error: jump to label 'continue_loading' [-fpermissive]
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:111:10: error:   from here [-fpermissive]
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:138:17: error:   crosses initialization of 'DllBlockInfo* info'
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:204:1: error: jump to label 'continue_loading' [-fpermissive]
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:89:10: error:   from here [-fpermissive]
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:138:17: error:   crosses initialization of 'DllBlockInfo* info'
/home/jacek/mozilla-build/mozilla-central/toolkit/xre/nsWindowsDllBlocklist.cpp:92:12: error:   crosses initialization of 'wchar_t* dll_part'
Comment 3 Jacek Caban 2011-06-20 05:13:54 PDT
Created attachment 540436 [details] [diff] [review]
fix v1.1
Comment 4 :Ehsan Akhgari 2011-06-21 08:46:14 PDT
Landed on mozilla-inbound.

Note You need to log in before you can comment on or make changes to this bug.