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

Build failure with upcoming Clang 16 (-Wimplicit-function-declaration) #182

Open
polkit-github-migration-bot opened this issue Nov 13, 2022 · 2 comments

Comments

@polkit-github-migration-bot
Copy link
Collaborator

In gitlab.freedesktop.org by thesamesam on Nov 13, 2022, 19:31

Link to the original issue: https://gitlab.freedesktop.org/polkit/polkit/-/issues/181
Clang 16 will make -Wimplicit-function-declaration an error by default.

You can emulate this error using:

  • GCC via -Werror=implicit-function-declaration
  • Clang <16 via -Werror=implicit-function-declaration
FAILED: subprojects/mocklibc-1.0/src/mocklibc-debug-netgroup.p/netgroup-debug.c.o
x86_64-pc-linux-gnu-gcc -Isubprojects/mocklibc-1.0/src/mocklibc-debug-netgroup.p -Isubprojects/mocklibc-1.0/src -I../polkit-122/subprojects/mocklibc-1.0/src -fdiagnostics-color=always -D_FILE_OFFSET_BITS=64 -
Wall -Winvalid-pch -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches -Wreturn-type -ggdb3 -Werror=implicit-function-declaration -Werror=implicit-int -MD -MQ subprojects/mocklibc-1.0/src
/mocklibc-debug-netgroup.p/netgroup-debug.c.o -MF subprojects/mocklibc-1.0/src/mocklibc-debug-netgroup.p/netgroup-debug.c.o.d -o subprojects/mocklibc-1.0/src/mocklibc-debug-netgroup.p/netgroup-debug.c.o -c ..
/polkit-122/subprojects/mocklibc-1.0/src/netgroup-debug.c
../polkit-122/subprojects/mocklibc-1.0/src/netgroup-debug.c: In function ‘netgroup_debug_print_entry’:
../polkit-122/subprojects/mocklibc-1.0/src/netgroup-debug.c:25:3: error: implicit declaration of function ‘print_indent’ [-Werror=implicit-function-declaration]
   25 |   print_indent(stream, indent);
      |   ^~~~~~~~~~~~
cc1: some warnings being treated as errors

The fix is easy:

diff --git a/test/mocklibc/src/netgroup.h b/test/mocklibc/src/netgroup.h
index 11cf7eb..0788efa 100644
--- a/test/mocklibc/src/netgroup.h
+++ b/test/mocklibc/src/netgroup.h
@@ -21,6 +21,8 @@

 #define NETGROUP_MAX_DEPTH 32

+#include <stdio.h>
+
 /**
  * Netgroup with a name and list of entries.
  */
@@ -141,4 +143,6 @@ void netgroup_iter_init(struct netgroup_iter *iter, struct netgroup *group);
  */
 struct entry *netgroup_iter_next(struct netgroup_iter *iter);

+void print_indent(FILE *stream, unsigned int indent);
+
 #endif

The problem is, there's another copy of mocklibc in subprojects/ in a tarball. How do we patch that? mocklibc looks abandoned upstream.

@polkit-github-migration-bot
Copy link
Collaborator Author

In gitlab.freedesktop.org by thesamesam on Apr 14, 2023, 05:14

mentioned in commit accountsservice/accountsservice@da65bee12d9118fe1a49c8718d428fe61d232339

@mbiebl
Copy link
Contributor

mbiebl commented Mar 16, 2024

Will be fixed by #436

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

No branches or pull requests

2 participants