In code, structs that happened to have a '(' somewhere in their body would cause the parser to go wrong. This change fixes that and updates the comments on a number of structs. Change-Id: Ia76ead266615a3d5875b64a0857a0177fec2bd00 Reviewed-on: https://boringssl-review.googlesource.com/6970 Reviewed-by: Adam Langley <agl@google.com>kris/onging/CECPQ3_patch15
@@ -67,7 +67,7 @@ extern "C" { | |||||
/* Memory and string functions, see also mem.h. */ | /* Memory and string functions, see also mem.h. */ | ||||
/* BUF_MEM is a generic buffer object used by OpenSSL. */ | |||||
/* buf_mem_st (aka |BUF_MEM|) is a generic buffer object used by OpenSSL. */ | |||||
struct buf_mem_st { | struct buf_mem_st { | ||||
size_t length; /* current number of bytes */ | size_t length; /* current number of bytes */ | ||||
char *data; | char *data; | ||||
@@ -128,7 +128,7 @@ OPENSSL_EXPORT int DSA_generate_key(DSA *dsa); | |||||
/* Signatures. */ | /* Signatures. */ | ||||
/* DSA_SIG contains a DSA signature as a pair of integers. */ | |||||
/* DSA_SIG_st (aka |DSA_SIG|) contains a DSA signature as a pair of integers. */ | |||||
typedef struct DSA_SIG_st { | typedef struct DSA_SIG_st { | ||||
BIGNUM *r, *s; | BIGNUM *r, *s; | ||||
} DSA_SIG; | } DSA_SIG; | ||||
@@ -368,7 +368,7 @@ struct err_error_st { | |||||
/* ERR_NUM_ERRORS is the limit of the number of errors in the queue. */ | /* ERR_NUM_ERRORS is the limit of the number of errors in the queue. */ | ||||
#define ERR_NUM_ERRORS 16 | #define ERR_NUM_ERRORS 16 | ||||
/* ERR_STATE contains the per-thread, error queue. */ | |||||
/* err_state_st (aka |ERR_STATE|) contains the per-thread, error queue. */ | |||||
typedef struct err_state_st { | typedef struct err_state_st { | ||||
/* errors contains the ERR_NUM_ERRORS most recent errors, organised as a ring | /* errors contains the ERR_NUM_ERRORS most recent errors, organised as a ring | ||||
* buffer. */ | * buffer. */ | ||||
@@ -2359,8 +2359,8 @@ OPENSSL_EXPORT void (*SSL_CTX_get_channel_id_cb(SSL_CTX *ctx))( | |||||
* | * | ||||
* See RFC 5764. */ | * See RFC 5764. */ | ||||
/* An SRTP_PROTECTION_PROFILE is an SRTP profile for use with the use_srtp | |||||
* extension. */ | |||||
/* srtp_protection_profile_st (aka |SRTP_PROTECTION_PROFILE|) is an SRTP | |||||
* profile for use with the use_srtp extension. */ | |||||
struct srtp_protection_profile_st { | struct srtp_protection_profile_st { | ||||
const char *name; | const char *name; | ||||
unsigned long id; | unsigned long id; | ||||
@@ -3487,6 +3487,8 @@ struct ssl_cipher_preference_list_st { | |||||
uint8_t *in_group_flags; | uint8_t *in_group_flags; | ||||
}; | }; | ||||
/* ssl_ctx_st (aka |SSL_CTX|) contains configuration common to several SSL | |||||
* connections. */ | |||||
struct ssl_ctx_st { | struct ssl_ctx_st { | ||||
const SSL_PROTOCOL_METHOD *method; | const SSL_PROTOCOL_METHOD *method; | ||||
@@ -203,15 +203,28 @@ func getNameFromDecl(decl string) (string, bool) { | |||||
for strings.HasPrefix(decl, "#if") || strings.HasPrefix(decl, "#elif") { | for strings.HasPrefix(decl, "#if") || strings.HasPrefix(decl, "#elif") { | ||||
decl = skipLine(decl) | decl = skipLine(decl) | ||||
} | } | ||||
if strings.HasPrefix(decl, "struct ") { | |||||
if strings.HasPrefix(decl, "typedef ") { | |||||
return "", false | return "", false | ||||
} | } | ||||
if strings.HasPrefix(decl, "#define ") { | |||||
// This is a preprocessor #define. The name is the next symbol. | |||||
decl = strings.TrimPrefix(decl, "#define ") | |||||
for _, prefix := range []string{"struct ", "enum ", "#define "} { | |||||
if !strings.HasPrefix(decl, prefix) { | |||||
continue | |||||
} | |||||
decl = strings.TrimPrefix(decl, prefix) | |||||
for len(decl) > 0 && decl[0] == ' ' { | for len(decl) > 0 && decl[0] == ' ' { | ||||
decl = decl[1:] | decl = decl[1:] | ||||
} | } | ||||
// struct and enum types can be the return type of a | |||||
// function. | |||||
if prefix[0] != '#' && strings.Index(decl, "{") == -1 { | |||||
break | |||||
} | |||||
i := strings.IndexAny(decl, "( ") | i := strings.IndexAny(decl, "( ") | ||||
if i < 0 { | if i < 0 { | ||||
return "", false | return "", false | ||||