Closed
Bug 609188
Opened 14 years ago
Closed 3 years ago
MSVC warnings in mozalloc about C4273: 'std::moz_Xinvalid_argument' : inconsistent dll linkage warnings in msvc_raise_wrappers.h
Categories
(Core :: XPCOM, defect)
Tracking
()
RESOLVED
WORKSFORME
Tracking | Status | |
---|---|---|
firefox33 | --- | wontfix |
People
(Reporter: RyanVM, Unassigned)
References
(Blocks 1 open bug, )
Details
(Whiteboard: [build_warning])
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(3408) : warning C4273: 'std::moz_Xinvalid_argument' : inconsistent dll linkage
c:\mozbuild\mozilla-central\objdir-fx\dist\include\mozilla\msvc_raise_wrappers.h(59) : see previous definition of 'moz_Xinvalid_argument'
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(3409) : warning C4273: 'std::moz_Xlength_error' : inconsistent dll linkage
c:\mozbuild\mozilla-central\objdir-fx\dist\include\mozilla\msvc_raise_wrappers.h(60) : see previous definition of 'moz_Xlength_error'
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(3410) : warning C4273: 'std::moz_Xout_of_range' : inconsistent dll linkage
c:\mozbuild\mozilla-central\objdir-fx\dist\include\mozilla\msvc_raise_wrappers.h(61) : see previous definition of 'moz_Xout_of_range'
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(3411) : warning C4273: 'std::moz_Xoverflow_error' : inconsistent dll linkage
c:\mozbuild\mozilla-central\objdir-fx\dist\include\mozilla\msvc_raise_wrappers.h(62) : see previous definition of 'moz_Xoverflow_error'
c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\xutility(3412) : warning C4273: 'std::moz_Xruntime_error' : inconsistent dll linkage
c:\mozbuild\mozilla-central\objdir-fx\dist\include\mozilla\msvc_raise_wrappers.h(63) : see previous definition of 'moz_Xruntime_error'
This code was added by bug 560723 and generates warning spam with numerous files on MSVC builds due to mozalloc being used throughout the tree.
Reporter | ||
Updated•14 years ago
|
Reporter | ||
Comment 1•14 years ago
|
||
Any insight on this one would be appreciated, Chris.
Whiteboard: [build_warning]
Not sure about this one ... the xutility symbols are declared __declspec(noreturn) along with some other indecipherable gunk. Might be __declspec(noreturn), but a preprocessed version of the decls in xutility would confirm (make -C $objdir/some_file_triggering_warning.i).
Reporter | ||
Comment 3•14 years ago
|
||
Stupid question, but all I see is .obj files, not .i files.
Oh sorry --- I was referring to explicitly making a preprocessed version of a file. To get a preprocessed version of a file foo/bar/Baz.cpp, just run
make -C $objdir/foo/bar/Baz.i
which spits out the preprocessed file as foo/bar/Baz.i. Then we can look for the std::moz_X* decls and compare them.
Reporter | ||
Comment 5•14 years ago
|
||
$ python build/pymake/make.py -C objdir-fx/browser/components/migration/src/nsIEProfileMigrator.i
make.py[0]: Entering directory 'c:\mozbuild\mozilla-central\objdir-fx/browser/components/migration/src/nsIEProfileMigrator.i'
No makefile found
Arrg, sorry:
$ python build/pymake/make.py -C
objdir-fx/browser/components/migration/src nsIEProfileMigrator.i
Note the space between "src" and "ns". (-C is "change to this directory", and nsFoo.i is the target to make.)
Reporter | ||
Comment 7•14 years ago
|
||
Hopefully this is what you are looking for. I have the entire .i file, but it's over 4MB. Let me know if you want other info from it.
#line 3400 "c:\\Program Files (x86)\\Microsoft Visual Studio 10.0\\VC\\INCLUDE\\xutility"
_Myptr = 0;
}
_Elem *_Myptr; // pointer to allocated string
_Elem _Nul; // nul terminator for unallocated string
};
__declspec(noreturn) void __cdecl moz_Xinvalid_argument( const char *);
__declspec(noreturn) void __cdecl moz_Xlength_error( const char *);
__declspec(noreturn) void __cdecl moz_Xout_of_range( const char *);
__declspec(noreturn) void __cdecl moz_Xoverflow_error( const char *);
__declspec(noreturn) void __cdecl moz_Xruntime_error( const char *);
}
#line 52 "c:\\mozbuild\\mozilla-central\\objdir-fx\\dist\\include\\mozilla\\msvc_raise_wrappers.h"
namespace std {
// NB: user code is not supposed to touch the std:: namespace. We're
// doing this after careful review because we want to define our own
// exception throwing semantics. Don't try this at home!
__declspec(dllimport) __declspec(noreturn) void moz_Xinvalid_argument(const char*);
__declspec(dllimport) __declspec(noreturn) void moz_Xlength_error(const char*);
__declspec(dllimport) __declspec(noreturn) void moz_Xout_of_range(const char*);
__declspec(dllimport) __declspec(noreturn) void moz_Xoverflow_error(const char*);
__declspec(dllimport) __declspec(noreturn) void moz_Xruntime_error(const char*);
} // namespace std
OK, it's not __declspec(noreturn); looks like __declspec(dllimport) is the problem. Our code is adding this exactly as I understand it should be added; I don't know why the VS header tries to declare these symbols without dllimport. Next we would want to know why the VS header is lacking this apparently necessary declspec: is the declspec just missing or is the definition of these symbols provided inline somewhere?
Reporter | ||
Comment 9•14 years ago
|
||
xutility defines them as such:
_CRTIMP2_PURE __declspec(noreturn) void __CLRCALL_PURE_OR_CDECL _Xinvalid_argument(_In_z_ const char *);
_CRTIMP2_PURE __declspec(noreturn) void __CLRCALL_PURE_OR_CDECL _Xlength_error(_In_z_ const char *);
_CRTIMP2_PURE __declspec(noreturn) void __CLRCALL_PURE_OR_CDECL _Xout_of_range(_In_z_ const char *);
_CRTIMP2_PURE __declspec(noreturn) void __CLRCALL_PURE_OR_CDECL _Xoverflow_error(_In_z_ const char *);
_CRTIMP2_PURE __declspec(noreturn) void __CLRCALL_PURE_OR_CDECL _Xruntime_error(_In_z_ const char *);
From searching around a bit, the only lead I found says that _CRTIMP2_PURE resolves to __declspec(dllimport) depending on how it's being linked (/MT v. /MD & _STATIC_CPPLIB macro) or to nothing for /clr:pure.
Reporter | ||
Comment 10•14 years ago
|
||
Ben, do you have any suggestions?
Comment 11•14 years ago
|
||
I fiddled with something similar when I was hacking on "link everything into libxul":
http://hg.mozilla.org/users/tmielczarek_mozilla.com/mq/file/73917dc87482/bigger-libxul-win32#l109
I was hitting errors linking against _Throw since it was declared dllimport, but I was linking statically to the definition in mozalloc. Looks like you're actually hitting the opposite here, but it's the same macro that I was dealing with.
Reporter | ||
Comment 12•14 years ago
|
||
Ted, is "link everything into libxul" still being planned for post-Fx4?
Comment 13•14 years ago
|
||
Yeah, bug 561842.
Updated•14 years ago
|
Blocks: buildwarning
Reporter | ||
Comment 14•13 years ago
|
||
It seems that bug 561842 is on the back burner with the Win PGO linker address space issues. Now that m-c builds are using MSVC2010, this is a big source of warning spam on tinderbox builds as well. I'm still willing to work on this bug, but I don't really know where to go from the comments above.
Comment 15•13 years ago
|
||
Are we screwing something up with our wrapper headers that makes _CRTIMP2_PURE not get defined to dllimport? If so, we should fix that.
Does this warning occur everywhere in the tree, or are there particular places? I know we do statically link the CRT in a few places, but I would expect that wouldn't use mozalloc in those cases. Is the problem that we're trying to use a static CRT and mozalloc at the same time?
Reporter | ||
Comment 16•13 years ago
|
||
Looks like it only hits two directories:
xpcom/glue
intl/unicharutil/util
Comment 17•13 years ago
|
||
Which are the only two locations that do:
> ifdef _MSC_VER
> # Don't include directives about which CRT to use
> OS_COMPILE_CXXFLAGS += -Zl
> OS_COMPILE_CFLAGS += -Zl
> DEFINES += -D_USE_ANSI_CPP
> endif
Comment 18•11 years ago
|
||
These dll linkage warnings are still reproducible:
https://tbpl.mozilla.org/php/getParsedLog.php?id=42816626&tree=Mozilla-Central&full=1
c:\\PROGRA~2\\MICROS~2.0\\vc\\include\xutility(3408) : warning C4273: 'std::moz_Xinvalid_argument' : inconsistent dll linkage
c:\builds\moz2_slave\m-cen-w32-d-000000000000000000\build\obj-firefox\dist\include\mozilla\msvc_raise_wrappers.h(26) : see previous definition of 'moz_Xinvalid_argument'
c:\\PROGRA~2\\MICROS~2.0\\vc\\include\xutility(3409) : warning C4273: 'std::moz_Xlength_error' : inconsistent dll linkage
c:\builds\moz2_slave\m-cen-w32-d-000000000000000000\build\obj-firefox\dist\include\mozilla\msvc_raise_wrappers.h(27) : see previous definition of 'moz_Xlength_error'
c:\\PROGRA~2\\MICROS~2.0\\vc\\include\xutility(3410) : warning C4273: 'std::moz_Xout_of_range' : inconsistent dll linkage
c:\builds\moz2_slave\m-cen-w32-d-000000000000000000\build\obj-firefox\dist\include\mozilla\msvc_raise_wrappers.h(28) : see previous definition of 'moz_Xout_of_range'
c:\\PROGRA~2\\MICROS~2.0\\vc\\include\xutility(3411) : warning C4273: 'std::moz_Xoverflow_error' : inconsistent dll linkage
c:\builds\moz2_slave\m-cen-w32-d-000000000000000000\build\obj-firefox\dist\include\mozilla\msvc_raise_wrappers.h(29) : see previous definition of 'moz_Xoverflow_error'
c:\\PROGRA~2\\MICROS~2.0\\vc\\include\xutility(3412) : warning C4273: 'std::moz_Xruntime_error' : inconsistent dll linkage
c:\builds\moz2_slave\m-cen-w32-d-000000000000000000\build\obj-firefox\dist\include\mozilla\msvc_raise_wrappers.h(30) : see previous definition of 'moz_Xruntime_error'
status-firefox33:
--- → affected
Summary: Inconsistent dll linkage warnings in msvc_raise_wrappers.h → MSVC warnings in mozalloc about C4273: 'std::moz_Xinvalid_argument' : inconsistent dll linkage warnings in msvc_raise_wrappers.h
Reporter | ||
Comment 19•3 years ago
|
||
msvc_raise_wrappers.h isn't a thing anymore
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → WORKSFORME
You need to log in
before you can comment on or make changes to this bug.
Description
•