These warnings are harmless, and we've fixed many (maybe not all) of them in our master branch (but not so much in the v2.0 branch).
The cases are usually (maybe always at this point) in the catch() clause of a try/catch exception handling construct, where the author catchs the exception into a variable and then doesn't find anything useful to do with the variable and so doesn't use it. The usual fix is to just remove the variable name from the catch() clause.
For example:
try {
// this might throw an exception
}
catch ( DBException& e ) {
// if we used 'e' here there would be no warning, but we don't use it
}
Changing this to:
try {
// this might throw an exception
}
catch ( DBException& ) {
// no warning
}
makes the warning go away;
You can just ignore the warnings, or fix them (as above) if they get in your way.
On Monday, August 20, 2012 6:42:53 PM UTC-4, Therefore wrote:
Windows 7 64 SP1
MongoDB 2.0.6
Boost 1.42
scons 2.2.0
python 2.7.3
I compiled the C++ driver with:
scons --release --64 mongoclient.lib
in the source directory.
It compiled and linked great but there are two places with warnings about unreferenced local variables:
Here:
cl /Foclient\connpool.obj /c client\connpool.cpp /TP /nologo /EHsc /W3 /wd4355 /wd4800 /wd4267 /wd4244 /O2 /Gy /MT /Zi /TP /errorReport:none /GL /D_SCONS /DMONGO_EXPOSE_M
ACROS /D_UNICODE /DUNICODE /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /DPSAPI_VERSION=1 /DNDEBUG /DXP_WIN /DNOEXECINFO /Ithird_party\js-1.7 /Ithird_party\pcre-7.4 /I. /IC:\boos
t "/IC:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include" /IC:\mongodb\winpcap\Include
connpool.cpp
client\connpool.cpp(153) : warning C4101: 'e' : unreferenced local variable
client\connpool.cpp(167) : warning C4101: 'e' : unreferenced local variable
client\connpool.cpp(187) : warning C4101: 'e' : unreferenced local variable
and here:
cl /Fos\shardconnection.obj /c s\shardconnection.cpp /TP /nologo /EHsc /W3 /wd4355 /wd4800 /wd4267 /wd4244 /O2 /Gy /MT /Zi /TP /errorReport:none /GL /D_SCONS /DMONGO_EXPO
SE_MACROS /D_UNICODE /DUNICODE /D_CONSOLE /D_CRT_SECURE_NO_WARNINGS /DPSAPI_VERSION=1 /DNDEBUG /DXP_WIN /DNOEXECINFO /Ithird_party\js-1.7 /Ithird_party\pcre-7.4 /I. /IC:\
boost "/IC:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Include" /IC:\mongodb\winpcap\Include
shardconnection.cpp
s\shardconnection.cpp(106) : warning C4101: 'e' : unreferenced local variable
Both are the connection components. I'm pointing this out in case it is a symptom of a problem.
Thoughts?