Browse Source

bindgen: Remove unnecessary 'comment_multiline'

Alexander Arvidsson 8 months ago
parent
commit
03e12ea7a6
2 changed files with 3 additions and 6 deletions
  1. 0 3
      bindgen/gen_ir.py
  2. 3 3
      bindgen/gen_odin.py

+ 0 - 3
bindgen/gen_ir.py

@@ -45,7 +45,6 @@ def parse_struct(decl, source):
     for item_decl in decl['inner']:
         if item_decl['kind'] == 'FullComment':
             outp['comment'] = extract_comment(item_decl, source)
-            outp['comment_multiline'] = '\n' in outp['comment']
             continue
         if item_decl['kind'] != 'FieldDecl':
             sys.exit(f"ERROR: Structs must only contain simple fields ({decl['name']})")
@@ -69,7 +68,6 @@ def parse_enum(decl, source):
     for item_decl in decl['inner']:
         if item_decl['kind'] == 'FullComment':
             outp['comment'] = extract_comment(item_decl, source)
-            outp['comment_multiline'] = '\n' in outp['comment']
             continue
         if item_decl['kind'] == 'EnumConstantDecl':
             item = {}
@@ -101,7 +99,6 @@ def parse_func(decl, source):
         for param in decl['inner']:
             if param['kind'] == 'FullComment':
                 outp['comment'] = extract_comment(param, source)
-                outp['comment_multiline'] = '\n' in outp['comment']
                 continue
             if param['kind'] != 'ParmVarDecl':
                 print(f"  >> warning: ignoring func {decl['name']} (unsupported parameter type)")

+ 3 - 3
bindgen/gen_odin.py

@@ -428,7 +428,7 @@ def gen_c_imports(inp, c_prefix, prefix):
             res_type = funcdecl_result_c(decl, prefix)
             res_str = '' if res_type == '' else f'-> {res_type}'
             if decl.get('comment'):
-                if decl.get('comment_multiline'):
+                if '\n' in decl["comment"]:
                     l("    /*")
                     l("    " + "    ".join(decl['comment'].splitlines(True)))
                     l("    */")
@@ -453,7 +453,7 @@ def gen_struct(decl, prefix):
     c_struct_name = check_override(decl['name'])
     struct_name = as_struct_or_enum_type(c_struct_name, prefix)
     if decl.get('comment'):
-        if decl.get('comment_multiline'):
+        if '\n' in decl["comment"]:
             l("/*")
             l(decl["comment"])
             l("*/")
@@ -474,7 +474,7 @@ def gen_struct(decl, prefix):
 def gen_enum(decl, prefix):
     enum_name = check_override(decl['name'])
     if decl.get('comment'):
-        if decl.get('comment_multiline'):
+        if '\n' in decl["comment"]:
             l("/*")
             l(decl["comment"])
             l("*/")