Skip to content

Disable -Wcast-function-type-strict in HarfBuzz port #18119

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

Merged
merged 3 commits into from
Oct 31, 2022

Conversation

kleisauke
Copy link
Collaborator

Corresponds to the fix introduced in commit harfbuzz/harfbuzz@60c6b77. This should fix the LLVM autoroller.

Context: #16126 (comment).

Corresponds to the fix introduced in commit:
harfbuzz/harfbuzz@60c6b77

This should fix the LLVM autoroller.
@kleisauke
Copy link
Collaborator Author

kleisauke commented Oct 30, 2022

error: unknown warning option '-Werror=cast-function-type-strict'; did you mean '-Werror=cast-function-type'? [-Werror,-Wunknown-warning-option]

... a chicken-and-egg situation, commit 2034c20 7ca70d7 should fix that.

@kleisauke kleisauke force-pushed the hb-cast-function-type-strict branch from 2034c20 to 7ca70d7 Compare October 30, 2022 09:27
To ensure the warning is disabled altogether.
@kripken kripken merged commit 0534601 into emscripten-core:main Oct 31, 2022
@kleisauke kleisauke deleted the hb-cast-function-type-strict branch October 31, 2022 19:45
@dschuff
Copy link
Member

dschuff commented Oct 31, 2022

Thanks for this!
I tried it out locally with a fresh LLVM, and for some reason adding these flags it doesn't seem to suppress the warning. I'm getting

/usr/local/google/home/dschuff/s/emr/install/emscripten/cache/ports/harfbuzz/harfbuzz-3.2.0/src/hb-ft.cc:762:73: error: cast from 'void (*)(FT_Face)' (aka 'void (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  if (unlikely (!ft_face->generic.data || ft_face->generic.finalizer != (FT_Generic_Finalizer) hb_ft_face_finalize))
                                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/google/home/dschuff/s/emr/install/emscripten/cache/ports/harfbuzz/harfbuzz-3.2.0/src/hb.hh:248:46: note: expanded from macro 'unlikely'
#define unlikely(expr) (__builtin_expect (!!(expr), 0))
                                             ^~~~
/usr/local/google/home/dschuff/s/emr/install/emscripten/cache/ports/harfbuzz/harfbuzz-3.2.0/src/hb-ft.cc:768:34: error: cast from 'void (*)(FT_Face)' (aka 'void (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
    ft_face->generic.finalizer = (FT_Generic_Finalizer) hb_ft_face_finalize;
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/local/google/home/dschuff/s/emr/install/emscripten/cache/ports/harfbuzz/harfbuzz-3.2.0/src/hb-ft.cc:1032:32: error: cast from 'void (*)(FT_Face)' (aka 'void (*)(FT_FaceRec_ *)') to 'FT_Generic_Finalizer' (aka 'void (*)(void *)') converts to incompatible function type [-Werror,-Wcast-function-type-strict]
  ft_face->generic.finalizer = (FT_Generic_Finalizer) _release_blob;
                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From that output it certainly seems like it ought to be suppressed by the flag you added, but I don't know why it's not. I'll try a few other things; are you able to reproduce this?

@kleisauke
Copy link
Collaborator Author

Ah, I only verified whether this flag was passed to the HarfBuzz port and didn't test it locally with a fresh LLVM. I think this is due to that HarfBuzz enables -Wcast-function-type (which has -Wcast-function-type-strict as a subgroup) via pragmas - see:
https://github.com/harfbuzz/harfbuzz/blob/3.2.0/src/hb.hh#L67

Are you able to test PR #18125? I also defined HB_NO_PRAGMA_GCC_DIAGNOSTIC_WARNING to ensure -Wextra is disabled.

@dschuff
Copy link
Member

dschuff commented Nov 1, 2022

Ah yes, that works, thanks. Also explains why I was confused looking at the warning flags (i.e. I didn't realize the warnings were being enabled by pragmas rather than by flags).

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

Successfully merging this pull request may close these issues.

3 participants