File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -321,8 +321,9 @@ def _normalize_define(define_string):
321321 define_string = define_string .strip ()
322322 if "=" in define_string :
323323 define , value = define_string .split ("=" , maxsplit = 1 )
324- if '"' in value and not value .startswith ("\\ " ):
325- # Escape only raw values
324+ if any (char in value for char in (' ' , '<' , '>' )):
325+ value = f'"{ value } "'
326+ elif '"' in value and not value .startswith ("\\ " ):
326327 value = value .replace ('"' , '\\ "' )
327328 return (define , value )
328329 return define_string
@@ -333,8 +334,11 @@ def _normalize_define(define_string):
333334 ]
334335
335336 for f in compile_group .get ("compileCommandFragments" , []):
336- if f .get ("fragment" , "" ).startswith ("-D" ):
337- result .append (_normalize_define (f ["fragment" ][2 :]))
337+ fragment = f .get ("fragment" , "" ).strip ()
338+ if fragment .startswith ('"' ):
339+ fragment = fragment .strip ('"' )
340+ if fragment .startswith ("-D" ):
341+ result .append (_normalize_define (fragment [2 :]))
338342
339343 return result
340344
You can’t perform that action at this time.
0 commit comments