ctdb-daemon: Use ctdb_parse_node_address() in ctdbd
[samba4-gss.git] / third_party / waf / waflib / extras / msvc_pdb.py
blob077656b4f7ea80452bfaf6ab43b1c6fcdc5a36f4
1 #!/usr/bin/env python
2 # encoding: utf-8
3 # Rafaƫl Kooi 2019
5 from waflib import TaskGen
7 @TaskGen.feature('c', 'cxx', 'fc')
8 @TaskGen.after_method('propagate_uselib_vars')
9 def add_pdb_per_object(self):
10 """For msvc/fortran, specify a unique compile pdb per object, to work
11 around LNK4099. Flags are updated with a unique /Fd flag based on the
12 task output name. This is separate from the link pdb.
13 """
14 if not hasattr(self, 'compiled_tasks'):
15 return
17 link_task = getattr(self, 'link_task', None)
19 for task in self.compiled_tasks:
20 if task.inputs and task.inputs[0].name.lower().endswith('.rc'):
21 continue
23 add_pdb = False
24 for flagname in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'):
25 # several languages may be used at once
26 for flag in task.env[flagname]:
27 if flag[1:].lower() == 'zi':
28 add_pdb = True
29 break
31 if add_pdb:
32 node = task.outputs[0].change_ext('.pdb')
33 pdb_flag = '/Fd:' + node.abspath()
35 for flagname in ('CFLAGS', 'CXXFLAGS', 'FCFLAGS'):
36 buf = [pdb_flag]
37 for flag in task.env[flagname]:
38 if flag[1:3] == 'Fd' or flag[1:].lower() == 'fs' or flag[1:].lower() == 'mp':
39 continue
40 buf.append(flag)
41 task.env[flagname] = buf
43 if link_task and not node in link_task.dep_nodes:
44 link_task.dep_nodes.append(node)
45 if not node in task.outputs:
46 task.outputs.append(node)