Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix conflicting types true/false #2868

Closed
dlegaultbbry opened this issue Sep 20, 2023 · 0 comments · Fixed by #2869
Closed

Fix conflicting types true/false #2868

dlegaultbbry opened this issue Sep 20, 2023 · 0 comments · Fixed by #2869

Comments

@dlegaultbbry
Copy link
Contributor

Problem Description

Compiling on some platforms can result in this problem because true/false are already defined elsewhere (and C23 promotes them to keywords now):

pkcs11-tool.c: In function 'derive_ec_key':
pkcs11-tool.c:4690:18: error: expected identifier or '(' before numeric constant
 4690 |         CK_BBOOL true = TRUE;
      |                  ^~~~
pkcs11-tool.c:4691:18: error: expected identifier or '(' before numeric constant
 4691 |         CK_BBOOL false = FALSE;
      |                  ^~~~~
pkcs11-tool.c:4694:29: error: lvalue required as unary '&' operand
 4694 |                 {CKA_TOKEN, &false, sizeof(false)}, /* session only object */
      |                             ^
pkcs11-tool.c:4697:33: error: lvalue required as unary '&' operand
 4697 |                 {CKA_SENSITIVE, &false, sizeof(false)},
      |                                 ^
pkcs11-tool.c:4698:35: error: lvalue required as unary '&' operand
 4698 |                 {CKA_EXTRACTABLE, &true, sizeof(true)},
      |                                   ^
pkcs11-tool.c:4699:31: error: lvalue required as unary '&' operand
 4699 |                 {CKA_ENCRYPT, &true, sizeof(true)},
      |                               ^
pkcs11-tool.c:4700:31: error: lvalue required as unary '&' operand
 4700 |                 {CKA_DECRYPT, &true, sizeof(true)},
      |                               ^
pkcs11-tool.c:4701:28: error: lvalue required as unary '&' operand
 4701 |                 {CKA_WRAP, &true, sizeof(true)},
      |                            ^
pkcs11-tool.c:4702:30: error: lvalue required as unary '&' operand
 4702 |                 {CKA_UNWRAP, &true, sizeof(true)}
      |                              ^

Proposed Resolution

Just do as the rest of the code and use _true/_false instead

Steps to reproduce

Logs

Will post a PR to fix this.

dlegaultbbry added a commit to dlegaultbbry/OpenSC that referenced this issue Sep 20, 2023
Jakuje pushed a commit that referenced this issue Sep 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant