[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[win-pv-devel] [PATCH] xenagent: enable all warnings



Instead of using warning level 3 (which misses quite a lot), enable all
build warnings and disable only selected warnings that we don't want.

Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 src/xenagent/devicelist.cpp      |  2 ++
 src/xenagent/service.cpp         | 17 +++++++++++++----
 src/xenagent/service.h           |  2 +-
 vs2012/xenagent/xenagent.vcxproj |  3 ++-
 vs2013/xenagent/xenagent.vcxproj |  3 ++-
 5 files changed, 20 insertions(+), 7 deletions(-)

diff --git a/src/xenagent/devicelist.cpp b/src/xenagent/devicelist.cpp
index 7053a96..4e86ce2 100644
--- a/src/xenagent/devicelist.cpp
+++ b/src/xenagent/devicelist.cpp
@@ -239,6 +239,8 @@ void CDeviceList::OnDeviceEvent(DWORD evt, LPVOID data)
 
 void CDeviceList::OnPowerEvent(DWORD evt, LPVOID data)
 {
+    UNREFERENCED_PARAMETER(data);
+
     switch (evt) {
     case PBT_APMRESUMESUSPEND:
     for (DeviceMap::iterator it = m_devs.begin();
diff --git a/src/xenagent/service.cpp b/src/xenagent/service.cpp
index 2d06008..d105bc4 100644
--- a/src/xenagent/service.cpp
+++ b/src/xenagent/service.cpp
@@ -60,10 +60,14 @@ CCritSec::~CCritSec()
 
 int CALLBACK WinMain(
     _In_     HINSTANCE hInstance,
-    _In_opt_ HINSTANCE ignore,
+    _In_opt_ HINSTANCE hPrevious,
     _In_     LPSTR     lpCmdLine,
     _In_     int       nCmdShow)
 {
+    UNREFERENCED_PARAMETER(hInstance);
+    UNREFERENCED_PARAMETER(hPrevious);
+    UNREFERENCED_PARAMETER(nCmdShow);
+
     if (strlen(lpCmdLine) != 0) {
         if (!strcmp(lpCmdLine, "-i") || !strcmp(lpCmdLine, "\"-i\""))
             return CXenAgent::ServiceInstall();
@@ -104,7 +108,7 @@ static CXenAgent s_service;
 
     if (GetModuleFileNameA(NULL, path, MAX_PATH) == 0) {
         CloseServiceHandle(mgr);
-        return GetLastError();
+        return -1;
     }
     path[MAX_PATH] = 0;
 
@@ -166,7 +170,7 @@ static CXenAgent s_service;
 
     if (!StartServiceCtrlDispatcher(ServiceTable)) {
         CXenAgent::Log("Failed to start dispatcher\n");
-        return GetLastError();
+        return -1;
     }
     return 0;
 }
@@ -419,7 +423,7 @@ bool CXenAgent::RegCheckIsUTC(const char* rootpath)
     if (lr != ERROR_SUCCESS)
         goto fail1;
 
-    long size = 32;
+    DWORD size = 32;
     DWORD length;
     char* buffer = NULL;
 
@@ -572,6 +576,9 @@ void CXenAgent::SetServiceStatus(DWORD state, DWORD exit 
/*= 0*/, DWORD hint /*=
 
 void WINAPI CXenAgent::__ServiceMain(int argc, char** argv)
 {
+    UNREFERENCED_PARAMETER(argc);
+    UNREFERENCED_PARAMETER(argv);
+
     m_handle = RegisterServiceCtrlHandlerEx(SVC_NAME, ServiceControlHandlerEx, 
NULL);
     if (m_handle == NULL)
         return;
@@ -591,6 +598,8 @@ void WINAPI CXenAgent::__ServiceMain(int argc, char** argv)
 
 DWORD WINAPI CXenAgent::__ServiceControlHandlerEx(DWORD req, DWORD evt, LPVOID 
data, LPVOID ctxt)
 {
+    UNREFERENCED_PARAMETER(ctxt);
+
     switch (req)
     {
     case SERVICE_CONTROL_STOP:
diff --git a/src/xenagent/service.h b/src/xenagent/service.h
index 77a11d7..ad9821a 100644
--- a/src/xenagent/service.h
+++ b/src/xenagent/service.h
@@ -54,7 +54,7 @@ public: // statics
 
 public: // ctor/dtor
     CXenAgent();
-    ~CXenAgent();
+    virtual ~CXenAgent();
 
 public: // IDeviceCreator
     virtual CDevice* Create(const wchar_t* path);
diff --git a/vs2012/xenagent/xenagent.vcxproj b/vs2012/xenagent/xenagent.vcxproj
index 67df832..7ae655e 100644
--- a/vs2012/xenagent/xenagent.vcxproj
+++ b/vs2012/xenagent/xenagent.vcxproj
@@ -29,7 +29,8 @@
     <ClCompile>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;__MODULE__="XENAGENT";%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <WarningLevel>Level3</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
+      
<DisableSpecificWarnings>4127;4350;4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <EnablePREfast>true</EnablePREfast>
       <RuntimeLibrary 
Condition="'$(UseDebugLibraries)'=='true'">MultiThreadedDebug</RuntimeLibrary>
diff --git a/vs2013/xenagent/xenagent.vcxproj b/vs2013/xenagent/xenagent.vcxproj
index fe5761e..a2ad3f8 100644
--- a/vs2013/xenagent/xenagent.vcxproj
+++ b/vs2013/xenagent/xenagent.vcxproj
@@ -29,7 +29,8 @@
     <ClCompile>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;__MODULE__="XENAGENT";%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <WarningLevel>Level3</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
+      
<DisableSpecificWarnings>4127;4350;4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <EnablePREfast>true</EnablePREfast>
       <RuntimeLibrary 
Condition="'$(UseDebugLibraries)'=='true'">MultiThreadedDebug</RuntimeLibrary>
-- 
2.1.1


_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.