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

Fails to build with GCC on FreeBSD #71

Open
jbeich opened this issue May 21, 2020 · 2 comments
Open

Fails to build with GCC on FreeBSD #71

jbeich opened this issue May 21, 2020 · 2 comments

Comments

@jbeich
Copy link

jbeich commented May 21, 2020

Affects at least FreeBSD 11.3-RELEASE, 12.1-RELEASE, 13.0-RELEASE.

$ pkg install automake libtool gmake gcc9
$ sh bin/setup.sh
$ cd build
$ export MAKE=gmake CC=gcc9
$ ../configure --enable-warnings
$ gmake
[...]
../../libxo/xo_encoder.c: In function 'xo_encoder_discover':
../../libxo/xo_encoder.c:237:9: error: cast between incompatible function types from 'dlfunc_t' {aka 'void (*)(struct __dlfunc_arg)'} to 'int (*)(xo_encoder_init_args_t *)' {aka 'int (*)(struct xo_encoder_init_args_s *)'} [-Werror=cast-function-type]
  237 |  func = (xo_encoder_init_func_t) dlfunc(dlp, XO_ENCODER_INIT_NAME);
      |         ^
@philshafer
Copy link
Contributor

Very strange, considering that dlfunc is meant to be cast:

 The dlfunc() function implements all of the behavior of dlsym(), but has
 a return type which can be cast to a function pointer without triggering
 compiler diagnostics.  (The dlsym() function returns a data pointer; in
 the C standard, conversions between data and function pointer types are
 undefined.  Some compilers and lint(1) utilities warn about such casts.)
 The precise return type of dlfunc() is unspecified; applications must
 cast it to an appropriate function pointer type.

I guess the fix would involve "#pragma GCC diagnostic push/ignore/pop".

Thanks,
Phil

@philshafer
Copy link
Contributor

Sorry to be so insanely slow; Fixed in "develop".

Thanks,
Phil

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