Skip to content

vala: work around clang 16 function pointer errors#252484

Merged
vcunat merged 1 commit intoNixOS:stagingfrom
reckenrode:vala-fix
Sep 28, 2023
Merged

vala: work around clang 16 function pointer errors#252484
vcunat merged 1 commit intoNixOS:stagingfrom
reckenrode:vala-fix

Conversation

@reckenrode
Copy link
Copy Markdown
Contributor

Description of changes

Clang 16 makes casting function pointers between incompatible types an error, which causes Vala to fail to build things using glib-2.0.vapi.

See https://gitlab.gnome.org/GNOME/vala/-/issues/1413.

I tested that libsecret built using Vala with this patch and a clang 16 stdenv from #241692.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 23.11 Release Notes (or backporting 23.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

@ofborg ofborg bot added 10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches. labels Aug 31, 2023
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to have this globally for all compilers instead of constraining it to clang.

Copy link
Copy Markdown
Contributor Author

@reckenrode reckenrode Sep 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this flag is supported by all clang and GCC versions available in nixpkgs. I’ll rework to make it apply unconditionally.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I pushed an update that adds the flag unconditionally and contains the changes to the setup hook.

Clang 16 makes casting function pointers between incompatible types an
error, which causes Vala to fail to build things using glib-2.0.vapi.

`-Wno-incompatible-function-pointer-types` is set unconditionally
because it is supported by all versions of clang and GCC in nixpkgs.

See https://gitlab.gnome.org/GNOME/vala/-/issues/1413.
@vcunat vcunat merged commit b53e748 into NixOS:staging Sep 28, 2023
@jtojnar
Copy link
Copy Markdown
Member

jtojnar commented May 1, 2024

This appears to spam GIMP build with:

cc1: note: unrecognized command-line option '-Wno-incompatible-function-pointer-types' may have been intended to silence earlier diagnostics

Also, -Wno-incompatible-function-pointer-types is repeated 744 times in NIX_CFLAGS_COMPILE.

@fabianhjr
Copy link
Copy Markdown
Member

Seems like upstream added its own meassure to silence those warnings. I think these hook could be removed now.

Could you help with testing @reckenrode?

#330015

fabianhjr added a commit that referenced this pull request Aug 2, 2024
…errors

Hook accumulates the flag over sereval executions as observed in:

- #301592
- #252484 (comment)

Since this has been committed, gcc started emitting a warning on
`-Wno-incompatible-function-poniter-types` being an unrecognized flag
and additionally upstream vala added its own meassure to reduce these
new pointer errors to warnings in its generated sources.

https://gitlab.gnome.org/GNOME/vala/-/commit/23ec71b1a5c4cead3d1bdac82e184d0a63fa7b79

Which is part of the current release
branch (https://gitlab.gnome.org/GNOME/vala/-/commits/0.56?ref_type=heads)
and released on 0.56.15

```
Vala 0.56.15
============
 * Various improvements and bug fixes:
  - codegen:
...
    + Emit diagnostic pragmas for GCC 14, Clang 16 compatibility [#1408]
```

https://gitlab.gnome.org/GNOME/vala/-/merge_requests/369
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 501+ This PR causes many rebuilds on Darwin and should normally target the staging branches. 10.rebuild-darwin: 5001+ This PR causes many rebuilds on Darwin and must target the staging branches. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 5001+ This PR causes many rebuilds on Linux and must target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants