From 6deacb389504d63bc9851d0a9498fabc64faf353 Mon Sep 17 00:00:00 2001 From: David Benjamin Date: Sat, 16 May 2015 12:00:51 -0400 Subject: [PATCH] Parse macros in getNameFromDecl. Fleshes out the table of contents more. Change-Id: I8f8f0e43bdf7419f978b4fc66de80922ed1ae425 Reviewed-on: https://boringssl-review.googlesource.com/4785 Reviewed-by: Adam Langley --- util/doc.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/util/doc.go b/util/doc.go index 20feae54..ae89c301 100644 --- a/util/doc.go +++ b/util/doc.go @@ -215,6 +215,18 @@ func getNameFromDecl(decl string) (string, bool) { 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, "(")