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

clang-15: incompatible integer to pointer conversion returning 'int' from a function with result type 'pthread_t' #561

Closed
RinCat opened this issue Nov 6, 2022 · 1 comment · Fixed by #610

Comments

@RinCat
Copy link

RinCat commented Nov 6, 2022

Needs type conversion.

../lxcfs-5.0.2/src/proc_loadavg.c:606:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'pthread_t' (aka 'struct __pthread *') [-Wint-conversion]
                return log_error(0, "Initialize hash_table fails in load_daemon!");
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lxcfs-5.0.2/src/cgroups/../macro.h:58:2: note: expanded from macro 'log_error'
        ({                                          \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lxcfs-5.0.2/src/proc_loadavg.c:611:10: error: incompatible integer to pointer conversion returning 'int' from a function with result type 'pthread_t' (aka 'struct __pthread *') [-Wint-conversion]
                return log_error(0, "Create pthread fails in load_daemon!");
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../lxcfs-5.0.2/src/cgroups/../macro.h:58:2: note: expanded from macro 'log_error'
        ({                                          \
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning and 2 errors generated.
@mihalicyn
Copy link
Member

@RinCat I can't reproduce this with clang 15/16. Are you using glibc or something else?

listout added a commit to listout/lxcfs that referenced this issue Sep 5, 2023
Newer compiler like Clang 16 and GCC 14 have certain error enabled by
default, namely -Werror=incompatible-function-pointer-types. Which
resutls in build error such as:

proc_loadavg.c:606:10: error: incompatible integer to pointer conversion returning int from a function with result type pthread_t

My supresses the error for now, but a proper fix would be better. Fist
discovered on Gentoo linux (bug #894348).

Bug: https://bugs.gentoo.org/894348
Closes: lxc#561
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
listout added a commit to listout/lxcfs that referenced this issue Sep 5, 2023
Newer compiler like Clang 16 and GCC 14 have certain error enabled by
default, namely -Werror=incompatible-function-pointer-types. Which
resutls in build error such as:

proc_loadavg.c:606:10: error: incompatible integer to pointer conversion returning int from a function with result type pthread_t

My patch supresses the error for now, but a proper fix would be better.
Fist discovered on Gentoo linux (bug #894348).

Bug: https://bugs.gentoo.org/894348
Closes: lxc#561
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
stgraber pushed a commit that referenced this issue Mar 18, 2024
Newer compiler like Clang 16 and GCC 14 have certain error enabled by
default, namely -Werror=incompatible-function-pointer-types. Which
resutls in build error such as:

proc_loadavg.c:606:10: error: incompatible integer to pointer conversion returning int from a function with result type pthread_t

My patch supresses the error for now, but a proper fix would be better.
Fist discovered on Gentoo linux (bug #894348).

Bug: https://bugs.gentoo.org/894348
Closes: #561
Signed-off-by: Brahmajit Das <brahmajit.xyz@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants