Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 885551 - media-libs/alsa-lib-1.2.8-r1 fails test - /.../oldapi.c: error: incompatible function pointer types assigning to myfcn (aka void (
Summary: media-libs/alsa-lib-1.2.8-r1 fails test - /.../oldapi.c: error: incompatible ...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo ALSA team
URL:
Whiteboard:
Keywords: TESTFAILURE
Depends on:
Blocks: c99-porting
  Show dependency tree
 
Reported: 2022-12-12 10:04 UTC by Toralf Förster
Modified: 2023-09-02 07:58 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emerge-info.txt (emerge-info.txt,18.03 KB, text/plain)
2022-12-12 10:04 UTC, Toralf Förster
Details
emerge-history.txt (emerge-history.txt,74.53 KB, text/plain)
2022-12-12 10:04 UTC, Toralf Förster
Details
environment (environment,147.03 KB, text/plain)
2022-12-12 10:04 UTC, Toralf Förster
Details
etc.clang.tar.bz2 (etc.clang.tar.bz2,702 bytes, application/x-bzip)
2022-12-12 10:04 UTC, Toralf Förster
Details
etc.portage.tar.bz2 (etc.portage.tar.bz2,33.41 KB, application/x-bzip)
2022-12-12 10:04 UTC, Toralf Förster
Details
logs.tar.bz2 (logs.tar.bz2,9.52 KB, application/x-bzip)
2022-12-12 10:04 UTC, Toralf Förster
Details
media-libs:alsa-lib-1.2.8-r1:20221212-031709.log (media-libs:alsa-lib-1.2.8-r1:20221212-031709.log,187.56 KB, text/plain)
2022-12-12 10:04 UTC, Toralf Förster
Details
temp.tar.bz2 (temp.tar.bz2,716.73 KB, application/x-bzip)
2022-12-12 10:04 UTC, Toralf Förster
Details
var.tmp.clang.tar.bz2 (var.tmp.clang.tar.bz2,1.24 KB, application/x-bzip)
2022-12-12 10:04 UTC, Toralf Förster
Details
Fix test/oldapi.c function declaration (fix-oldapi-test.patch,376 bytes, patch)
2023-05-02 21:27 UTC, Fabio Scaccabarozzi
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Toralf Förster gentoo-dev 2022-12-12 10:04:02 UTC
too long lines were shrinked:

^
clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/test -I../include  -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/include  -Wall -pipe -g -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=im
clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/test -I../include  -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/include  -Wall -pipe -g -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=im
1 warning generated.
clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/test -I../include  -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/include  -Wall -pipe -g -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=im
clang -DHAVE_CONFIG_H -I. -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/test -I../include  -I/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/include  -Wall -pipe -g -pipe -march=native -fno-diagnostics-color -O2 -Werror=implicit-function-declaration -Werror=im
/var/tmp/portage/media-libs/alsa-lib-1.2.8-r1/work/alsa-lib-1.2.8/test/oldapi.c:40:6: error: incompatible function pointer types assigning to 'myfcn *' (aka 'void (*)(void *)') from 'int (*)(const snd_pcm_hw_params_t *)' (aka 'int (*)(const struct _snd_pcm_hw_params *)') [-Werror,-Wincompatible-func
        fcn = &snd_pcm_hw_params_get_access;
            ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  -------------------------------------------------------------------

  This is an unstable amd64 chroot image at a tinderbox (==build bot)
  name: 17.1_systemd-j4_test-20221211-060004

  -------------------------------------------------------------------

GNUMAKEFLAGS="$GNUMAKEFLAGS --jobserver-style=pipe"
CC=clang
CXX=clang++
gcc-config -l:
 [1] x86_64-pc-linux-gnu-12 *
clang/llvm (if any):
clang version 15.0.6
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/15/bin
Configuration file: /etc/clang/clang.cfg
/usr/lib/llvm/15
15.0.6
Python 3.10.9
Available Rust versions:
  [1]   rust-bin-1.65.0 *
The following VMs are available for generation-2:
*)	Eclipse Temurin JDK 11.0.17_p8 [openjdk-bin-11]
Available Java Virtual Machines:
  [1]   openjdk-bin-11  system-vm

The Glorious Glasgow Haskell Compilation System, version 9.0.2
php cli (if any):

  HEAD of ::gentoo
commit dba3ac2621dcdb758f0499819af058e643d15d88
Author: Repository mirror & CI <repomirrorci@gentoo.org>
Date:   Mon Dec 12 03:01:53 2022 +0000

    2022-12-12 03:01:52 UTC

emerge -qpvO media-libs/alsa-lib
[ebuild  N    ] media-libs/alsa-lib-1.2.8-r1  USE="-alisp -debug -doc -python" ABI_X86="(64) -32 (-x32)" PYTHON_SINGLE_TARGET="python3_10 -python3_8 -python3_9 -python3_11"
Comment 1 Toralf Förster gentoo-dev 2022-12-12 10:04:04 UTC
Created attachment 841737 [details]
emerge-info.txt
Comment 2 Toralf Förster gentoo-dev 2022-12-12 10:04:05 UTC
Created attachment 841739 [details]
emerge-history.txt
Comment 3 Toralf Förster gentoo-dev 2022-12-12 10:04:07 UTC
Created attachment 841741 [details]
environment
Comment 4 Toralf Förster gentoo-dev 2022-12-12 10:04:08 UTC
Created attachment 841743 [details]
etc.clang.tar.bz2
Comment 5 Toralf Förster gentoo-dev 2022-12-12 10:04:09 UTC
Created attachment 841745 [details]
etc.portage.tar.bz2
Comment 6 Toralf Förster gentoo-dev 2022-12-12 10:04:10 UTC
Created attachment 841747 [details]
logs.tar.bz2
Comment 7 Toralf Förster gentoo-dev 2022-12-12 10:04:12 UTC
Created attachment 841749 [details]
media-libs:alsa-lib-1.2.8-r1:20221212-031709.log
Comment 8 Toralf Förster gentoo-dev 2022-12-12 10:04:14 UTC
Created attachment 841751 [details]
temp.tar.bz2
Comment 9 Toralf Förster gentoo-dev 2022-12-12 10:04:14 UTC
Created attachment 841753 [details]
var.tmp.clang.tar.bz2
Comment 10 Fabio Scaccabarozzi 2023-05-02 21:27:31 UTC
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.
Comment 11 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-02 21:52:01 UTC
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!
Comment 12 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2023-05-02 21:54:20 UTC
(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.
Comment 13 Fabio Scaccabarozzi 2023-05-02 23:17:40 UTC
(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 :) )
Comment 14 Larry the Git Cow gentoo-dev 2023-09-02 07:58:17 UTC
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(+)