Summary: | media-libs/alsa-lib-1.2.8-r1 fails test - /.../oldapi.c: error: incompatible function pointer types assigning to myfcn (aka void ( | ||
---|---|---|---|
Product: | Gentoo Linux | Reporter: | Toralf Förster <toralf> |
Component: | Current packages | Assignee: | Gentoo ALSA team [DISABLED] <alsa-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | fsvm88, sam |
Priority: | Normal | Keywords: | TESTFAILURE |
Version: | unspecified | ||
Hardware: | All | ||
OS: | Linux | ||
Whiteboard: | fixed in 1.2.10 | ||
Package list: | Runtime testing required: | --- | |
Bug Depends on: | |||
Bug Blocks: | 870412 | ||
Attachments: |
emerge-info.txt
emerge-history.txt environment etc.clang.tar.bz2 etc.portage.tar.bz2 logs.tar.bz2 media-libs:alsa-lib-1.2.8-r1:20221212-031709.log temp.tar.bz2 var.tmp.clang.tar.bz2 Fix test/oldapi.c function declaration |
Description
Toralf Förster
![]() Created attachment 841737 [details]
emerge-info.txt
Created attachment 841739 [details]
emerge-history.txt
Created attachment 841741 [details]
environment
Created attachment 841743 [details]
etc.clang.tar.bz2
Created attachment 841745 [details]
etc.portage.tar.bz2
Created attachment 841747 [details]
logs.tar.bz2
Created attachment 841749 [details]
media-libs:alsa-lib-1.2.8-r1:20221212-031709.log
Created attachment 841751 [details]
temp.tar.bz2
Created attachment 841753 [details]
var.tmp.clang.tar.bz2
Created attachment 861055 [details, diff]
Fix test/oldapi.c function declaration
The patch changes myfcn in test/oldapi.c to properly match the expected type (as reported by the compiler) during the assignment in the main function body.
This patch is enough to make tests build and pass for me (clang-16).
If this is fine, I can upstream it.
This looks ok *if* you've checked the consumers really do pass in a snd_pcm_hw_params_get_access and the callback expects it (i.e. find some backing evidence other than the warning). But this is quite common for old codebases, so I agree it's likely fine. Thank you for looking at it! (In reply to Sam James from comment #11) > This looks ok *if* you've checked the consumers really do pass in a > snd_pcm_hw_params_get_access and the callback expects it (i.e. find some > backing evidence other than the warning). But this is quite common for old > codebases, so I agree it's likely fine. Thank you for looking at it! oh, this is interesting. The test was added in https://github.com/alsa-project/alsa-lib/commit/d4af763f8ae5054ba76915b97fc8b1efec2f7d1d. I'm wondering if the old API is inherently broken. (In reply to Sam James from comment #11) > This looks ok *if* you've checked the consumers really do pass in a > snd_pcm_hw_params_get_access and the callback expects it (i.e. find some > backing evidence other than the warning). But this is quite common for old > codebases, so I agree it's likely fine. Thank you for looking at it! I'm not sure there are any consumers to check - this is a test that executes only for alsa-lib benefit. I would wager that consumers were already ported to the new API since a very long time, or likely fixed if still using the old API. Worst case they should break when updating to >=clang-15 as well, but not due to this patch. > oh, this is interesting. > > The test was added in https://github.com/alsa-project/alsa-lib/commit/d4af763f8ae5054ba76915b97fc8b1efec2f7d1d. > > I'm wondering if the old API is inherently broken. The old API has different signatures vs the new one: https://github.com/alsa-project/alsa-lib/blob/152983f01b0bc1178ea0d461ebf66e2d2a8e2e02/include/pcm_old.h#L14 https://github.com/alsa-project/alsa-lib/blob/a5e11f9a810391777ea7750f04ba66f9c9e624de/include/pcm.h#L771 https://github.com/alsa-project/alsa-lib/blob/10e2490023e937e0a6a524c21f5f82176c94e010/NOTES#L1 If I understand/recall correctly "typedef void (type_name)(void *);" declares a type that returns nothing, and allows as many parameters as required. This was sometimes used in C to allow assigning an unknown pointed type to a generic catch-all pointer type. I believe that due to how the old API worked, using a indirect pointers was intentional (see last link to the NOTES file), but compilers started complaining louder now. ( I'm far from a C expert, I learnt a couple things mostly by patching stuff in Gentoo over the years, feel free to correct me :) ) The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6ef0b470c182bc8c2c07475453ac47297389d258 commit 6ef0b470c182bc8c2c07475453ac47297389d258 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-09-02 07:51:05 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-09-02 07:51:38 +0000 media-libs/alsa-lib: add 1.2.10 Closes: https://bugs.gentoo.org/885551 Signed-off-by: Sam James <sam@gentoo.org> media-libs/alsa-lib/Manifest | 1 + media-libs/alsa-lib/alsa-lib-1.2.10.ebuild | 98 ++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) |