Skip to content

Commit

Permalink
ta: pkcs11: fix build warning on unused arguments
Browse files Browse the repository at this point in the history
Add missing __maybe_unused attribute for function arguments not
used when the pkcs11 TA is built with NDEBUG directive, as shown
by the following build trace message:

ta/pkcs11/src/pkcs11_attributes.c: In function ‘get_default_value’:
ta/pkcs11/src/pkcs11_attributes.c:261:61: warning: unused parameter ‘id’ [-Wunused-parameter]
  261 | static enum pkcs11_rc get_default_value(enum pkcs11_attr_id id, void **value,
      |                                         ~~~~~~~~~~~~~~~~~~~~^~
ta/pkcs11/src/pkcs11_attributes.c: In function ‘check_created_attrs_against_processing’:
ta/pkcs11/src/pkcs11_attributes.c:1647:73: warning: unused parameter ‘head’ [-Wunused-parameter]
 1647 |                                                       struct obj_attrs *head)
      |                                                       ~~~~~~~~~~~~~~~~~~^~~~

Fixes: 63f89ca ("ta: pkcs11: attribute helper functions")
Reviewed-by: Jerome Forissier <[email protected]>
Signed-off-by: Etienne Carriere <[email protected]>
  • Loading branch information
etienne-lms authored and jforissier committed Feb 15, 2024
1 parent d99b271 commit 897aaf1
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions ta/pkcs11/src/pkcs11_attributes.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ static enum pkcs11_rc set_mandatory_attributes(struct obj_attrs **out,
return rc;
}

static enum pkcs11_rc get_default_value(enum pkcs11_attr_id id, void **value,
uint32_t *size)
static enum pkcs11_rc get_default_value(enum pkcs11_attr_id id __maybe_unused,
void **value, uint32_t *size)
{
/* should have been taken care of already */
assert(!pkcs11_attr_is_boolean(id));
Expand Down Expand Up @@ -1643,8 +1643,9 @@ static bool __maybe_unused check_attr_bval(uint32_t proc_id __maybe_unused,
* @proc_id - PKCS11_CKM_xxx
* @head - head of the attributes of the to-be-created object.
*/
enum pkcs11_rc check_created_attrs_against_processing(uint32_t proc_id,
struct obj_attrs *head)
enum pkcs11_rc
check_created_attrs_against_processing(uint32_t proc_id,
struct obj_attrs *head __maybe_unused)
{
/*
* Processings that do not create secrets are not expected to call
Expand Down

0 comments on commit 897aaf1

Please sign in to comment.