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 build with clang 16 #43

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

listout
Copy link

@listout listout commented Jul 29, 2023

Clang 16 (and likely GCC 13) enables -Wimplicit-function-declaration by default. This results in errors such as:

signify.c:144:6: error: call to undeclared function 'b64_pton'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (b64_pton(commentend + 1, buf, buflen) != buflen)
^
signify.c:231:6: error: call to undeclared function 'b64_ntop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if (b64_ntop(buf, buflen, b64, sizeof(b64)) == -1)
^
signify.c:624:12: error: call to undeclared function 'b64_pton'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
if ((rv = b64_pton(hash, data, sizeof(data))) == -1)

A simple fix is to create a base64.h file containing the headers of the b64_* functions.

Bug: https://bugs.gentoo.org/894354

Clang 16 (and likely GCC 13) enables -Wimplicit-function-declaration by
default. This results in errors such as:

signify.c:144:6: error: call to undeclared function 'b64_pton'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if (b64_pton(commentend + 1, buf, buflen) != buflen)
            ^
signify.c:231:6: error: call to undeclared function 'b64_ntop'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if (b64_ntop(buf, buflen, b64, sizeof(b64)) == -1)
            ^
signify.c:624:12: error: call to undeclared function 'b64_pton'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
        if ((rv = b64_pton(hash, data, sizeof(data))) == -1)

A simple fix is to create a base64.h file containing the headers of the
b64_* functions.

Bug: https://bugs.gentoo.org/894354
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
listout added a commit to listout/gentoo that referenced this pull request Jul 29, 2023
Upstream PR: aperezdc/signify#43

Closes: https://bugs.gentoo.org/894354
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
gentoo-bot pushed a commit to gentoo/gentoo that referenced this pull request Jul 30, 2023
Upstream PR: aperezdc/signify#43

Closes: https://bugs.gentoo.org/894354
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Closes: #32097
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Copy link
Owner

@aperezdc aperezdc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be easier to add the function prototypes to compat.h, which would avoid needing to carry modifications of the original source files.

@listout Could you update the PR with this suggestion? Thanks in advance.

@@ -34,6 +34,7 @@
#include "sha2.h"

#include "crypto_api.h"
#include "base64.h"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding a new header, wouldn't it be enough to add the function prototypes to compat.h?

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 this pull request may close these issues.

2 participants