ソースを参照

Merge topic 'vsnasm-quoting'

cb694f8cd6 VS: Properly quote arguments in nasm.xml

Acked-by: Kitware Robot <[email protected]>
Merge-request: !2179
Brad King 7 年 前
コミット
b74962d898

+ 3 - 3
Templates/MSBuild/nasm.xml

@@ -36,7 +36,7 @@
         <DataSource Persistence="ProjectFile" ItemType="NASM" SourceType="Item"/>
       </StringProperty.DataSource>
     </StringProperty>
-    <StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o [value]"/>
+    <StringProperty Name="OutputFormat" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output File Name" Description="Specify Output Filename.-o [value]" Switch="-o &quot;[value]&quot;"/>
     <BoolProperty Name="tasmmode" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="SciTech TASM compatible mode" Description="assemble in SciTech TASM compatible mode" Switch="-t"/>
     <EnumProperty Name="Outputswitch" Category="Assembler Options" HelpUrl="http://www.nasm.us/doc/" DisplayName="Output Switch" Description="Select the type of output format required. Linking Should be disabled for ELF and Binary ,else error will popup">
       <EnumValue Name="0" DisplayName="Object File win32" Switch="-fwin32"/>
@@ -48,8 +48,8 @@
     <BoolProperty Name="GenerateDebugInformation" Category="Assembler Options" DisplayName="Generate Debug Information" Description="Generates Debug Information.     (-g)" HelpUrl="http://www.nasm.us/doc/" Switch="-g"/>
     <StringListProperty Name="ErrorReporting" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Redirect Error Messages to File" Description="Drops the error Message on specified device" Switch="-Z &quot;[value]&quot;"/>
     <StringListProperty Name="IncludePaths" Category="General" DisplayName="Include Paths" Description="Sets path for include file.     (-I[path])" HelpUrl="http://www.nasm.us/doc/" Switch="-I&quot;[value]&quot;"/>
-    <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name.     (-D[symbol])" Switch="-D[value]"/>
-    <StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name.     (-U[symbol])" Switch="-U[value]"/>
+    <StringListProperty Name="PreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Preprocessor Definitions" Description="Defines a text macro with the given name.     (-D[symbol])" Switch="-D&quot;[value]&quot;"/>
+    <StringListProperty Name="UndefinePreprocessorDefinitions" Category="Preprocessor" HelpUrl="http://www.nasm.us/doc/" DisplayName="Undefine Preprocessor Definitions" Description="Undefines a text macro with the given name.     (-U[symbol])" Switch="-U&quot;[value]&quot;"/>
     <EnumProperty Name="ErrorReportingFormat" Category="Advanced" HelpUrl="http://www.nasm.us/doc/" DisplayName="Error Reporting Format" Description="Select the error reporting format ie. GNU or VC">
       <EnumValue Name="0" DisplayName="-Xgnu GNU format: Default format" Switch="-Xgnu"/>
       <EnumValue Name="1" DisplayName="-Xvc Style used by Microsoft Visual C++" Switch="-Xvc"/>

+ 11 - 1
Tests/VSNASM/CMakeLists.txt

@@ -1,10 +1,20 @@
 cmake_minimum_required(VERSION 2.8.12)
 project(VSNASM C ASM_NASM)
+
 if(CMAKE_SIZEOF_VOID_P EQUAL 8)
   add_definitions(-DTESTx64)
   string(APPEND CMAKE_ASM_NASM_FLAGS " -DTEST2x64")
 else()
   add_definitions(-DTESTi386)
 endif()
+
+# Test quoting for definitions with spaces.
+add_definitions("-DEAX_COMMA_SPACE_ZERO=eax, 0")
+
+# Test quoting for file names with spaces. The file is generated because CMake
+# itself cannot have files with spaces.
+file(READ bar.asm BAR_ASM_CONTENTS)
+file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm" "${BAR_ASM_CONTENTS}")
+
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
-add_executable(VSNASM main.c foo.asm)
+add_executable(VSNASM main.c foo.asm "${CMAKE_CURRENT_BINARY_DIR}/bar baz.asm")

+ 13 - 0
Tests/VSNASM/bar.asm

@@ -0,0 +1,13 @@
+section .text
+%ifdef TEST2x64
+global bar
+%else
+global _bar
+%endif
+%ifdef TESTx64
+bar:
+%else
+_bar:
+%endif
+    mov  	EAX_COMMA_SPACE_ZERO
+    ret

+ 1 - 1
Tests/VSNASM/include/foo-proc.asm

@@ -3,5 +3,5 @@ foo:
 %else
 _foo:
 %endif
-    mov  	eax, 0
+    mov  	EAX_COMMA_SPACE_ZERO
     ret

+ 2 - 1
Tests/VSNASM/main.c

@@ -1,5 +1,6 @@
 extern int foo(void);
+extern int bar(void);
 int main(void)
 {
-  return foo();
+  return foo() + bar();
 }