diff options
author | Pete Batard <pete@akeo.ie> | 2012-06-25 19:13:42 +0100 |
---|---|---|
committer | Pete Batard <pete@akeo.ie> | 2012-07-02 18:28:37 +0100 |
commit | 0e0cbb6c27efa5a2ae58c30267a4be9486c766cc (patch) | |
tree | bb5a0fef2387ff49547595c58d4a90439e1b9460 /msvc | |
parent | 89b43a6929305eab8aad297a0ecb58b478857a10 (diff) | |
download | libusb-0e0cbb6c27efa5a2ae58c30267a4be9486c766cc.tar.gz |
Windows: Address MSVC Level 4 & WDK's OACR/Prefast warnings
* The library is now compiled with warning level 4 for VS2010
* Move silencing of 4200, 28125 and 28719 to msvc/config.h
* Add fixes in core to silence unused variables warnings
* Ensure that spinlock is always set interlocked in poll_windows
* Add missing check for calloc return value
* Fix data assignation in conditionals warnings
* Fix an OACR/Prefast error related to the use of strncpy in xusb.c
* Also fixes whitespace inconsistencies in core
* Issues reported by Orin Eman and Xiaofan Chen. See:
https://sourceforge.net/mailarchive/message.php?msg_id=29412656
Diffstat (limited to 'msvc')
-rw-r--r-- | msvc/config.h | 9 | ||||
-rw-r--r-- | msvc/libusb_dll.vcxproj | 8 | ||||
-rw-r--r-- | msvc/libusb_static.vcxproj | 8 |
3 files changed, 17 insertions, 8 deletions
diff --git a/msvc/config.h b/msvc/config.h index e14d91d..e221bab 100644 --- a/msvc/config.h +++ b/msvc/config.h @@ -5,6 +5,15 @@ #error "Please make sure the msvc/ directory is removed from your build path." #endif +/* Disable: warning C4200: nonstandard extension used : zero-sized array in struct/union */ +#pragma warning(disable:4200) +#if defined(_PREFAST_) +/* Disable "Banned API" errors when using the MS's WDK OACR/Prefast */ +#pragma warning(disable:28719) +/* Disable "The function 'InitializeCriticalSection' must be called from within a try/except block" */ +#pragma warning(disable:28125) +#endif + /* Default visibility */ #define DEFAULT_VISIBILITY /**/ diff --git a/msvc/libusb_dll.vcxproj b/msvc/libusb_dll.vcxproj index 521c613..f1881fe 100644 --- a/msvc/libusb_dll.vcxproj +++ b/msvc/libusb_dll.vcxproj @@ -79,7 +79,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> @@ -98,7 +98,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Link> @@ -113,7 +113,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> </ClCompile> <Link> <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile> @@ -129,7 +129,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> </ClCompile> <Link> <OutputFile>$(OutDir)libusb-1.0.dll</OutputFile> diff --git a/msvc/libusb_static.vcxproj b/msvc/libusb_static.vcxproj index 9cb482d..57254be 100644 --- a/msvc/libusb_static.vcxproj +++ b/msvc/libusb_static.vcxproj @@ -79,7 +79,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Lib> @@ -95,7 +95,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_WIN64;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> <DebugInformationFormat>ProgramDatabase</DebugInformationFormat> </ClCompile> <Lib> @@ -107,7 +107,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> </ClCompile> <Lib> <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile> @@ -121,7 +121,7 @@ <AdditionalIncludeDirectories>.;..\libusb;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> <PreprocessorDefinitions>_WIN32;_WIN64;_LIB;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions> <RuntimeLibrary>MultiThreaded</RuntimeLibrary> - <WarningLevel>Level3</WarningLevel> + <WarningLevel>Level4</WarningLevel> </ClCompile> <Lib> <OutputFile>$(OutDir)libusb-1.0.lib</OutputFile> |