Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8bd7382

Browse files
committed
Patch by Jack Jansen to add with_ifdef option, which places #ifndef
around external decls.
1 parent a856d9f commit 8bd7382

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Tools/freeze/makeconfig.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
never = ['marshal', '__main__', '__builtin__', 'sys']
77

8-
def makeconfig(infp, outfp, modules):
8+
def makeconfig(infp, outfp, modules, with_ifdef=0):
99
m1 = regex.compile('-- ADDMODULE MARKER 1 --')
1010
m2 = regex.compile('-- ADDMODULE MARKER 2 --')
1111
while 1:
@@ -17,7 +17,11 @@ def makeconfig(infp, outfp, modules):
1717
for mod in modules:
1818
if mod in never:
1919
continue
20+
if with_ifdef:
21+
outfp.write("#ifndef init%s\n"%mod)
2022
outfp.write('extern void init%s();\n' % mod)
23+
if with_ifdef:
24+
outfp.write("#endif\n")
2125
elif m2 and m2.search(line) >= 0:
2226
m2 = None
2327
for mod in modules:

0 commit comments

Comments
 (0)