Commits

Anonymous committed d2788f8

Strip parentheses for C function pointer type names.

Comments (0)

Files changed (1)

sphinx/directives.py

         (\( [^()]+ \)) \s* # name in parentheses
         \( (.*) \) $       # arguments
     ''', re.VERBOSE)
+c_funcptr_name_re = re.compile(r'^\(\s*\*\s*(.*?)\s*\)$')
 
 # RE to split at word boundaries
 wsplit_re = re.compile(r'(\W+)')
     signode += addnodes.desc_type("", "")
     parse_c_type(signode[-1], rettype)
     signode += addnodes.desc_name(name, name)
+    # clean up parentheses from canonical name
+    m = c_funcptr_name_re.match(name)
+    if m:
+        name = m.group(1)
     if not arglist:
         if desctype == 'cfunction':
             # for functions, add an empty parameter list
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.