2 * Copyright 2007-2019 The OpenSSL Project Authors. All Rights Reserved.
3 * Copyright Nokia 2007-2019
4 * Copyright Siemens AG 2015-2019
6 * Licensed under the Apache License 2.0 (the "License"). You may not use
7 * this file except in compliance with the License. You can obtain a copy
8 * in the file LICENSE in the source distribution or at
9 * https://www.openssl.org/source/license.html
13 * A collection of test cases where check-format.pl should not report issues.
14 * There are some known false positives, though, which are marked below.
18 * allow double space in format-tagged multi-line comment
21 * trailing multi-line comment
24 if (ctx == NULL) { /* non-leading intra-line comment */
26 /* entire-line comment indent usually like for the following line */
27 return NULL; /* hanging indent also for this line after comment */
28 /* leading comment has same indentation as normal code */ stmt;
29 /* entire-line comment may have same indent as normal code */
33 if (1) /* bad style: just part of control structure depends on #if */
35 if (2) /*@ resulting false positive */
37 c; /*@ resulting false positive */
55 1; while (2); /*@ more than one stmt just to construct case */
64 else do /*@ (non-brace) code before 'do' just to construct case */
68 b); do /*@ (non-brace) code before 'do' just to construct case */
73 b); do /*@ (non-brace) code before 'do' just to construct case */
79 do f(c, c); /*@ (non-brace) code after 'do' just to construct case */
88 b); else /*@ (non-brace) code before 'else' just to construct case */
94 { /*@ brace after 'if' not on same line just to construct case */
98 /* this comment is correctly indented if it refers to the following line */
103 } else /*@ no brace after 'else' just to construct case */
125 typedef OSSL_CMP_MSG *(*cmp_srv_process_cb_t)
126 (OSSL_CMP_SRV_CTX *ctx, OSSL_CMP_MSG *msg)
137 { /*@ brace after 'if' not on same line just to construct case */
155 const unsigned char trans_id[OSSL_CMP_TRANSACTIONID_LENGTH] = {
158 const unsigned char trans_id[OSSL_CMP_TRANSACTIONID_LENGTH] =
198 #define Y /* .. */ 2 + 2
201 static varref cmp_vars[] = { /* comment */
202 {&opt_config}, {&opt_section},
204 {&opt_server}, {&opt_proxy}, {&opt_path},
215 #define DEFINE_SET_GET_BASE_TEST(PREFIX, SETN, GETN, DUP, FIELD, TYPE, ERR, \
216 DEFAULT, NEW, FREE) \
217 static int execute_CTX_##SETN##_##GETN##_##FIELD( \
218 TEST_FIXTURE *fixture) \
220 CTX *ctx = fixture->ctx; \
221 int (*set_fn)(CTX *ctx, TYPE) = \
222 (int (*)(CTX *ctx, TYPE))PREFIX##_##SETN##_##FIELD; \
226 /* 'struct' in function header */
227 static int f(struct pem_pass_data *pass_data)
229 if (pass_data == NULL)
233 static void *fun(void)
235 if (pem_name != NULL)
240 size_t available_len, data_len;
241 const char *curr = txt, *next = txt;
245 char *intraline_string_with_comment_delimiters_and_dbl_space = "1 /*1";
246 char *multiline_string_with_comment_delimiters_and_dbl_space = "1 /*1\
247 2222222\'22222222222222222\"222222222" "33333 /*3333333333" "44 /*44444444444\
252 ASN1_CHOICE(OSSL_CRMF_POPO) = {
253 ASN1_IMP(OSSL_CRMF_POPO, value.raVerified, ASN1_NULL, 0),
254 ASN1_EXP(OSSL_CRMF_POPO, value.keyAgreement, OSSL_CRMF_POPOPRIVKEY, 3)
255 } ASN1_CHOICE_END(OSSL_CRMF_POPO)
256 IMPLEMENT_ASN1_FUNCTIONS(OSSL_CRMF_POPO)
258 ASN1_ADB(OSSL_CRMF_ATTRIBUTETYPEANDVALUE) = {
259 ADB_ENTRY(NID_id_regCtrl_regToken,
260 ASN1_SIMPLE(OSSL_CRMF_ATTRIBUTETYPEANDVALUE,
261 value.regToken, ASN1_UTF8STRING)),
262 } ASN1_ADB_END(OSSL_CRMF_ATTRIBUTETYPEANDVALUE, 0, type, 0,
263 &attributetypeandvalue_default_tt, NULL);
265 ASN1_ITEM_TEMPLATE(OSSL_CRMF_MSGS) =
266 ASN1_EX_TEMPLATE_TYPE(ASN1_TFLG_SEQUENCE_OF, 0,
267 OSSL_CRMF_MSGS, OSSL_CRMF_MSG)
268 ASN1_ITEM_TEMPLATE_END(OSSL_CRMF_MSGS)
270 void f_looong_body_200()
271 { /* function body length up to 200 lines accepted */
474 void f_looong_body_201()
475 { /* function body length > 200 lines, but LONG BODY marker present */