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

[win-pv-devel] [PATCH] Work around bug in VS2017 SDV



It appears that the new SDV cannot handle the quoted __MODULE__ definitions
on compailer command lines and will thus crash out with some obscure error.
Increasing the logging level shows output of the form:

slamcl {
.
.
.
cl : Command line warning D9024 : unrecognized source file type 'XENBUS" /D 
POOL_NX_OPTIN=1 /D NT_PROCESSOR_GROUPS /D _WIN64 /D _AMD64_ /D AMD64 /D 
_WIN32_WINNT=0x0A00 /D WINVER=0x0A00 /D WINNT=1 /D NTDDI_VERSION=0x0A000005 /GF 
/Gm- /Zp8 /GS /guard:cf /Gy /fp:precise /Zc:wchar_t- /Zc:forScope /Zc:inline 
/GR- /Fox64\Windows10Release\ /Fdx64\Windows10Release\vc141.pdb /Gz /wd4464 
/wd4711 /wd4548 /wd4770 /wd4820 /wd4668 /wd4255 /wd5045 /wd6001 /wd6054 
/wd28160 /wd30030 /wd30029 /wd4603 /wd4627 /wd4986 /wd4987 /wd4996 
/FIC:\Program', object file assumed
cl : Command line warning D9027 : source file 'XENBUS" /D POOL_NX_OPTIN=1 /D 
NT_PROCESSOR_GROUPS /D _WIN64 /D _AMD64_ /D AMD64 /D _WIN32_WINNT=0x0A00 /D 
WINVER=0x0A00 /D WINNT=1 /D NTDDI_VERSION=0x0A000005 /GF /Gm- /Zp8 /GS 
/guard:cf /Gy /fp:precise /Zc:wchar_t- /Zc:forScope /Zc:inline /GR- 
/Fox64\Windows10Release\ /Fdx64\Windows10Release\vc141.pdb /Gz /wd4464 /wd4711 
/wd4548 /wd4770 /wd4820 /wd4668 /wd4255 /wd5045 /wd6001 /wd6054 /wd28160 
/wd30030 /wd30029 /wd4603 /wd4627 /wd4986 /wd4987 /wd4996 /FIC:\Program' ignored
cl : Command line warning D9024 : unrecognized source file type 'Files', object 
file assumed
cl : Command line warning D9027 : source file 'Files' ignored
cl : Command line warning D9024 : unrecognized source file type 
'(x86)\Windows', object file assumed
cl : Command line warning D9027 : source file '(x86)\Windows' ignored
cl : Command line warning D9024 : unrecognized source file type 
'Kits\10\Include\10.0.17134.0\shared\warning.h /analyze /analyze:quiet 
/analyze:stacksize1024 /analyze:pluginC:\Program', object file assumed
cl : Command line warning D9027 : source file 
'Kits\10\Include\10.0.17134.0\shared\warning.h /analyze /analyze:quiet 
/analyze:stacksize1024 /analyze:pluginC:\Program' ignored
cl : Command line warning D9024 : unrecognized source file type 'Files', object 
file assumed
cl : Command line warning D9027 : source file 'Files' ignored
.
.

(Notice the mismatched ' and " quotes around XENBUS).

This patch pulls the definition of __MODULE__ into dbg_print.h (as well as
the coinstaller and monitor sources) as follows:

    #define stringify_literal(_text) #_text
    #define stringify(_text) stringify_literal(_text)
    #define __MODULE__ stringify(PROJECT)

PROJECT is then defined on the compiler command line as the simple,
unquoted, value of $(ProjectName) which is a Visual Studio intrinsic.
This seems to keep SDV happy while still providing a reasonable definition
of __MODULE__ for use in debug output.

NOTE: This patch also turns on SDV debugging by default to aid future
      diagnosis of issues.

Reported-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
Signed-off-by: Paul Durrant <paul.durrant@xxxxxxxxxx>
---
 build.py                                     | 2 +-
 src/coinst/coinst.c                          | 4 ++++
 src/common/dbg_print.h                       | 6 +++---
 src/monitor/monitor.c                        | 4 ++++
 vs2015/xen/xen.vcxproj                       | 2 +-
 vs2015/xenbus/xenbus.vcxproj                 | 2 +-
 vs2015/xenbus_coinst/xenbus_coinst.vcxproj   | 2 +-
 vs2015/xenbus_monitor/xenbus_monitor.vcxproj | 2 +-
 vs2015/xenfilt/xenfilt.vcxproj               | 2 +-
 vs2017/xen/xen.vcxproj                       | 2 +-
 vs2017/xenbus/xenbus.vcxproj                 | 2 +-
 vs2017/xenbus_coinst/xenbus_coinst.vcxproj   | 2 +-
 vs2017/xenbus_monitor/xenbus_monitor.vcxproj | 2 +-
 vs2017/xenfilt/xenfilt.vcxproj               | 2 +-
 14 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/build.py b/build.py
index da70499..35fc9bb 100755
--- a/build.py
+++ b/build.py
@@ -267,7 +267,7 @@ def run_sdv(name, dir, vs):
             '/p:Inputs="/clean"', os.path.join(vs, name))
 
     msbuild(platform, configuration, 'sdv', name + '.vcxproj',
-            '/p:Inputs="/check:default.sdv"', os.path.join(vs, name))
+            '/p:Inputs="/check:default.sdv /debug"', os.path.join(vs, name))
 
     path = [vs, name, 'sdv', 'SDV.DVL.xml']
     remove_timestamps(os.path.join(*path))
diff --git a/src/coinst/coinst.c b/src/coinst/coinst.c
index fa899f3..a5b7a0b 100644
--- a/src/coinst/coinst.c
+++ b/src/coinst/coinst.c
@@ -43,6 +43,10 @@
 #include <version.h>
 #include <revision.h>
 
+#define stringify_literal(_text) #_text
+#define stringify(_text) stringify_literal(_text)
+#define __MODULE__ stringify(PROJECT)
+
 __user_code;
 
 #define MAXIMUM_BUFFER_SIZE 1024
diff --git a/src/common/dbg_print.h b/src/common/dbg_print.h
index 0c21785..baf5831 100644
--- a/src/common/dbg_print.h
+++ b/src/common/dbg_print.h
@@ -35,9 +35,9 @@
 #include <ntddk.h>
 #include <stdarg.h>
 
-#ifdef  _SDV_
-#define __MODULE__ ""
-#endif
+#define stringify_literal(_text) #_text
+#define stringify(_text) stringify_literal(_text)
+#define __MODULE__ stringify(PROJECT)
 
 #pragma warning(disable:4127)   // conditional expression is constant
 
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 2c6a2aa..3cf33ce 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -42,6 +42,10 @@
 
 #include "messages.h"
 
+#define stringify_literal(_text) #_text
+#define stringify(_text) stringify_literal(_text)
+#define __MODULE__ stringify(PROJECT)
+
 #define MONITOR_NAME        __MODULE__
 #define MONITOR_DISPLAYNAME MONITOR_NAME
 
diff --git a/vs2015/xen/xen.vcxproj b/vs2015/xen/xen.vcxproj
index de215c0..19c4cd1 100644
--- a/vs2015/xen/xen.vcxproj
+++ b/vs2015/xen/xen.vcxproj
@@ -21,7 +21,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>__MODULE__="XEN";POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4464;4711;4548;4820;4668;4255;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/vs2015/xenbus/xenbus.vcxproj b/vs2015/xenbus/xenbus.vcxproj
index 65e416c..afd1a0e 100644
--- a/vs2015/xenbus/xenbus.vcxproj
+++ b/vs2015/xenbus/xenbus.vcxproj
@@ -20,7 +20,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      
<PreprocessorDefinitions>__MODULE__="XENBUS";POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;</AdditionalIncludeDirectories>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4146;4464;4711;4548;4820;4668;4255;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
diff --git a/vs2015/xenbus_coinst/xenbus_coinst.vcxproj 
b/vs2015/xenbus_coinst/xenbus_coinst.vcxproj
index c88b8c9..3cdbaf3 100644
--- a/vs2015/xenbus_coinst/xenbus_coinst.vcxproj
+++ b/vs2015/xenbus_coinst/xenbus_coinst.vcxproj
@@ -19,7 +19,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>__MODULE__="XENBUS_COINST";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4127;4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/vs2015/xenbus_monitor/xenbus_monitor.vcxproj 
b/vs2015/xenbus_monitor/xenbus_monitor.vcxproj
index 3da9061..3a015a2 100644
--- a/vs2015/xenbus_monitor/xenbus_monitor.vcxproj
+++ b/vs2015/xenbus_monitor/xenbus_monitor.vcxproj
@@ -23,7 +23,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;__MODULE__="XENBUS_MONITOR";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4127;4711;4548;4820;4668;4255;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/vs2015/xenfilt/xenfilt.vcxproj b/vs2015/xenfilt/xenfilt.vcxproj
index fe6ba38..cd7db99 100644
--- a/vs2015/xenfilt/xenfilt.vcxproj
+++ b/vs2015/xenfilt/xenfilt.vcxproj
@@ -20,7 +20,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      
<PreprocessorDefinitions>__MODULE__="XENFILT";POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;</AdditionalIncludeDirectories>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4464;4711;4548;4820;4668;4255;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
diff --git a/vs2017/xen/xen.vcxproj b/vs2017/xen/xen.vcxproj
index 87acb6f..eebac3a 100644
--- a/vs2017/xen/xen.vcxproj
+++ b/vs2017/xen/xen.vcxproj
@@ -21,7 +21,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>__MODULE__="XEN";POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
diff --git a/vs2017/xenbus/xenbus.vcxproj b/vs2017/xenbus/xenbus.vcxproj
index 8dc2651..062df34 100644
--- a/vs2017/xenbus/xenbus.vcxproj
+++ b/vs2017/xenbus/xenbus.vcxproj
@@ -20,7 +20,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      
<PreprocessorDefinitions>__MODULE__="XENBUS";POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;</AdditionalIncludeDirectories>
       <WarningLevel>EnableAllWarnings</WarningLevel>
diff --git a/vs2017/xenbus_coinst/xenbus_coinst.vcxproj 
b/vs2017/xenbus_coinst/xenbus_coinst.vcxproj
index 258d421..df3cc04 100644
--- a/vs2017/xenbus_coinst/xenbus_coinst.vcxproj
+++ b/vs2017/xenbus_coinst/xenbus_coinst.vcxproj
@@ -19,7 +19,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>__MODULE__="XENBUS_COINST";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4127;4711;4548;4820;4668;4255;5045;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/vs2017/xenbus_monitor/xenbus_monitor.vcxproj 
b/vs2017/xenbus_monitor/xenbus_monitor.vcxproj
index 475937b..8703bb5 100644
--- a/vs2017/xenbus_monitor/xenbus_monitor.vcxproj
+++ b/vs2017/xenbus_monitor/xenbus_monitor.vcxproj
@@ -23,7 +23,7 @@
   <ItemDefinitionGroup>
     <ClCompile>
       
<AdditionalIncludeDirectories>$(SolutionDir)..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      
<PreprocessorDefinitions>WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;__MODULE__="XENBUS_MONITOR";%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);WIN32;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <WarningLevel>EnableAllWarnings</WarningLevel>
       
<DisableSpecificWarnings>4127;4711;4548;4820;4668;4255;5045;6001;6054;28196;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
diff --git a/vs2017/xenfilt/xenfilt.vcxproj b/vs2017/xenfilt/xenfilt.vcxproj
index 8a64fef..961fa27 100644
--- a/vs2017/xenfilt/xenfilt.vcxproj
+++ b/vs2017/xenfilt/xenfilt.vcxproj
@@ -20,7 +20,7 @@
   </PropertyGroup>
   <ItemDefinitionGroup>
     <ClCompile>
-      
<PreprocessorDefinitions>__MODULE__="XENFILT";POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      
<PreprocessorDefinitions>PROJECT=$(ProjectName);POOL_NX_OPTIN=1;NT_PROCESSOR_GROUPS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       
<AdditionalIncludeDirectories>$(WindowsSdkDir)\include\km;..\..\include;..\..\include\xen;..\..\src\common;</AdditionalIncludeDirectories>
       <WarningLevel>EnableAllWarnings</WarningLevel>
-- 
2.5.3


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

 


Rackspace

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