10018 libkmf: macro expands to multiple statements
Review Request #1304 - Created Nov. 30, 2018 and submitted
../common/openssl_spi.c:1037:13: error: macro expands to multiple statements [-Werror=multistatement-macros] SET_ERROR(kmfh, ERR_get_error()); ^~~~ ../common/openssl_spi.c:134:25: note: in definition of macro 'SET_ERROR' #define SET_ERROR(h, c) h->lasterr.kstype = KMF_KEYSTORE_OPENSSL; \ ^ ../common/openssl_spi.c:1036:2: note: some parts of macro expansion are not guarded by this 'if' clause if (pkey == NULL) ^~ ../common/pkcs11_spi.c: In function 'store_raw_key': ../common/pkcs11_spi.c:3249:11: error: macro expands to multiple statements [-Werror=multistatement-macros] SETATTR(templ, i, CKA_DECRYPT, &cktrue, sizeof (cktrue)); i++; ^~~~~ ../common/pkcs11_spi.c:43:2: note: in definition of macro 'SETATTR' t[n].type = atype; \ ^ ../common/pkcs11_spi.c:3248:2: note: some parts of macro expansion are not guarded by this 'if' clause if (keytype != CKK_EC) ^~ cc1: all warnings being treated as errors
It looks like this fixes the case where the statement is expanded to multiple statements in an if that isn't properly guarded. Does it actually fix the multiple statement warning? Regardless since it does fix one of the cases, seems fine.