summaryrefslogtreecommitdiffstats
path: root/src/util/doc.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/doc.go')
-rw-r--r--src/util/doc.go14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/util/doc.go b/src/util/doc.go
index 20feae5..540d6ca 100644
--- a/src/util/doc.go
+++ b/src/util/doc.go
@@ -209,12 +209,24 @@ func skipLine(s string) string {
}
func getNameFromDecl(decl string) (string, bool) {
- for strings.HasPrefix(decl, "#if") {
+ for strings.HasPrefix(decl, "#if") || strings.HasPrefix(decl, "#elif") {
decl = skipLine(decl)
}
if strings.HasPrefix(decl, "struct ") {
return "", false
}
+ if strings.HasPrefix(decl, "#define ") {
+ // This is a preprocessor #define. The name is the next symbol.
+ decl = strings.TrimPrefix(decl, "#define ")
+ for len(decl) > 0 && decl[0] == ' ' {
+ decl = decl[1:]
+ }
+ i := strings.IndexAny(decl, "( ")
+ if i < 0 {
+ return "", false
+ }
+ return decl[:i], true
+ }
decl = skipPast(decl, "STACK_OF(")
decl = skipPast(decl, "LHASH_OF(")
i := strings.Index(decl, "(")