`mozglue/misc/NativeNt.h` contains e.g. our code for parsing PE headers (`mozilla::nt::PEHeaders`). It lives in `mozglue/misc/` but it depends on code that lives in other folders. If we actually include `NativeNt.h` in a `.cpp` file that lives in `mozglue/misc/` (which I'd like to do in bug 1897479), that results in SpiderMonkey build failures for the following reasons. First reason: `NativeNt.h` depends on `widget/windows/WinHeaderOnlyUtils.h`, which cannot be found in that case. If we move `WinHeaderOnlyUtils.h` to `mozglue/misc/`, that's still not enough because it itself depends on `xpcom/base/nsWindowsHelpers.h` which itself depends on `xpcom/base/nsAutoRef.h`, and both are not available. Second reason: `NativeNt.h` depends on `toolkit/xre/dllservices/mozglue/interceptor/MMPolicies.h` and `toolkit/xre/dllservices/mozglue/interceptor/TargetFunction.h` which are not available in this case. These dependencies are only required for the definition of a single class in `NativeNt.h` (`template <typename MMPolicy> class MOZ_RAII PEExportSection`) so it looks like maybe this definition does not belong here and we could move it somewhere else. If I move `nsAutoRef.h`, `nsWindowsHelpers.h` and `WinHeaderOnlyUtils.h` to `mozglue/misc/`, remove the dependency on `MMPolicies.h` and `TargetFunction.h` as well as the class definition that needs it, and add a `#include "mozilla/Unused.h"`, then I can finally build SpiderMonkey. But I don't know if that would be the correct way to solve this problem.
Bug 1898761 Comment 0 Edit History
Note: The actual edited comment in the bug view page will always show the original commenter’s name and original timestamp.
`mozglue/misc/NativeNt.h` contains e.g. our code for parsing PE headers (`mozilla::nt::PEHeaders`). It lives in `mozglue/misc/` but it depends on code that lives in other folders. If we actually include `NativeNt.h` in a `.cpp` file that lives in `mozglue/misc/` (which I'd like to do in bug 1897479), that results in SpiderMonkey build failures for the following reasons. First reason: `NativeNt.h` depends on `widget/windows/WinHeaderOnlyUtils.h`, which cannot be found in that case. If we move `WinHeaderOnlyUtils.h` to `mozglue/misc/`, that's still not enough because it itself depends on `xpcom/base/nsWindowsHelpers.h` which itself depends on `xpcom/base/nsAutoRef.h`, and both are not available. Note that the top of `WinHeaderOnlyUtils.h` claims the following: ```c++ /** * This header is intended for self-contained, header-only, utility code for * Win32. It may be used outside of xul.dll, in places such as firefox.exe or * mozglue.dll. If your code creates dependencies on Mozilla libraries, you * should put it elsewhere. */ ``` Second reason: `NativeNt.h` depends on `toolkit/xre/dllservices/mozglue/interceptor/MMPolicies.h` and `toolkit/xre/dllservices/mozglue/interceptor/TargetFunction.h` which are not available in this case. These dependencies are only required for the definition of a single class in `NativeNt.h` (`template <typename MMPolicy> class MOZ_RAII PEExportSection`) so it looks like maybe this definition does not belong here and we could move it somewhere else. If I move `nsAutoRef.h`, `nsWindowsHelpers.h` and `WinHeaderOnlyUtils.h` to `mozglue/misc/`, remove the dependency on `MMPolicies.h` and `TargetFunction.h` as well as the class definition that needs it, and add a `#include "mozilla/Unused.h"`, then I can finally build SpiderMonkey. But I don't know if that would be the correct way to solve this problem.