Kaydet (Commit) 55ad8153 authored tarafından Mike Kaganski's avatar Mike Kaganski

gbuild-to-ide: handle -U undefs correctly

Previously, defines string like this:

  -DDBG_UTIL -DNOMINMAX -D_DLL -UNOMINMAX

would produce this defines list:

  DBG_UTIL;NOMINMAX;_DLL -UNOMINMAX

where last "define" is incorrect; proper list should be

  DBG_UTIL;_DLL

so that the undef'ed element would be properly eliminated from the
result. This patch takes care of this.

Change-Id: Ia66a1d6d0a6e0bbfd0022b22285b005609871336
Reviewed-on: https://gerrit.libreoffice.org/43923Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
Tested-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst dd35dccd
...@@ -67,10 +67,15 @@ class GbuildParser: ...@@ -67,10 +67,15 @@ class GbuildParser:
defs = {} defs = {}
alldefs = [defswitch.strip() for defswitch in defsline.strip().lstrip('-D').split(' -D') if len(defswitch) > 2] alldefs = [defswitch.strip() for defswitch in defsline.strip().lstrip('-D').split(' -D') if len(defswitch) > 2]
for d in alldefs: for d in alldefs:
defparts = d.split('=') dparts = d.split(' -U')
"""after dparts.pop(0), dparts will contain only undefs"""
defparts = dparts.pop(0).strip().split('=')
if len(defparts) == 1: if len(defparts) == 1:
defparts.append(None) defparts.append(None)
defs[defparts[0]] = defparts[1] defs[defparts[0]] = defparts[1]
"""Drop undefed items (if any) from previous defs"""
for u in dparts:
defs.pop(u.strip(), '')
defs["LIBO_INTERNAL_ONLY"] = None defs["LIBO_INTERNAL_ONLY"] = None
return defs return defs
......
...@@ -106,10 +106,15 @@ class GbuildParser: ...@@ -106,10 +106,15 @@ class GbuildParser:
defs = {} defs = {}
alldefs = [defswitch.strip() for defswitch in defsline.strip().lstrip('-D').split(' -D') if len(defswitch) > 2] alldefs = [defswitch.strip() for defswitch in defsline.strip().lstrip('-D').split(' -D') if len(defswitch) > 2]
for d in alldefs: for d in alldefs:
defparts = d.split('=') dparts = d.split(' -U')
"""after dparts.pop(0), dparts will contain only undefs"""
defparts = dparts.pop(0).strip().split('=')
if len(defparts) == 1: if len(defparts) == 1:
defparts.append(None) defparts.append(None)
defs[defparts[0]] = defparts[1] defs[defparts[0]] = defparts[1]
"""Drop undefed items (if any) from previous defs"""
for u in dparts:
defs.pop(u.strip(), '')
defs["LIBO_INTERNAL_ONLY"] = None defs["LIBO_INTERNAL_ONLY"] = None
return defs return defs
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment