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

Clang Wcomma warnings #3656

Closed
rvandermeulen opened this issue Jun 15, 2022 · 4 comments · Fixed by #3658
Closed

Clang Wcomma warnings #3656

rvandermeulen opened this issue Jun 15, 2022 · 4 comments · Fixed by #3658

Comments

@rvandermeulen
Copy link
Contributor

rvandermeulen commented Jun 15, 2022

hb-bit-set-invertible.hh(103,53): warning: possible misuse of comma operator here [-Wcomma]
  { return unlikely (inverted) ? (s.del_range (a, b), true) : s.add_range (a, b); }
                                                    ^
hb-bit-set-invertible.hh(103,35): note: cast expression to void to silence warning
  { return unlikely (inverted) ? (s.del_range (a, b), true) : s.add_range (a, b); }
                                  ^~~~~~~~~~~~~~~~~~
                                  static_cast<void>()


hb-ot-var-fvar-table.hh(216,89): warning: possible misuse of comma operator here [-Wcomma]
    return axes.lfind (tag, axis_index) && (axes[*axis_index].get_axis_deprecated (info), true);
                                                                                        ^
hb-ot-var-fvar-table.hh(216,45): note: cast expression to void to silence warning
    return axes.lfind (tag, axis_index) && (axes[*axis_index].get_axis_deprecated (info), true);
                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                            static_cast<void>(                          )


hb-ot-var-fvar-table.hh(224,68): warning: possible misuse of comma operator here [-Wcomma]
    return axes.lfind (tag, &i) && (axes[i].get_axis_info (i, info), true);
                                                                   ^
hb-ot-var-fvar-table.hh(224,37): note: cast expression to void to silence warning
    return axes.lfind (tag, &i) && (axes[i].get_axis_info (i, info), true);
                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                                    static_cast<void>(             )
@behdad
Copy link
Member

behdad commented Jun 15, 2022

Thanks. Is this a clang-14 option?

behdad added a commit that referenced this issue Jun 15, 2022
behdad added a commit that referenced this issue Jun 15, 2022
behdad added a commit that referenced this issue Jun 15, 2022
behdad added a commit that referenced this issue Jun 15, 2022
behdad added a commit that referenced this issue Jun 15, 2022
behdad added a commit that referenced this issue Jun 15, 2022
@rvandermeulen
Copy link
Contributor Author

Thanks. Is this a clang-14 option?

Wcomma has been around for awhile. Not sure if it got more strict in 14, though. I haven't been looking super-closely at the build logs and we've been suppressing Werror in the HarfBuzz directory for quite awhile. I was looking today because I'd like to remove that suppression 😄

@behdad
Copy link
Member

behdad commented Jun 16, 2022

I added Wcomma to our error list and fixed all occurrences.

@behdad
Copy link
Member

behdad commented Jun 16, 2022

This is the ones we ignore, some need fixing and some intentionally:

/* Ignored currently, but should be fixed at some point. */
#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED
#pragma GCC diagnostic ignored "-Wconversion"                   // TODO fix
#pragma GCC diagnostic ignored "-Wformat-signedness"            // TODO fix
#pragma GCC diagnostic ignored "-Wshadow"                       // TODO fix
#pragma GCC diagnostic ignored "-Wunsafe-loop-optimizations"    // TODO fix
#pragma GCC diagnostic ignored "-Wunused-parameter"             // TODO fix
#if defined(__GNUC__) && !defined(__clang__)
#pragma GCC diagnostic ignored "-Wunused-result"                // TODO fix
#endif
#endif

/* Ignored intentionally. */
#ifndef HB_NO_PRAGMA_GCC_DIAGNOSTIC_IGNORED
#pragma GCC diagnostic ignored "-Wclass-memaccess"
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
#pragma GCC diagnostic ignored "-Wformat-zero-length"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wpacked" // Erratic impl in clang
#pragma GCC diagnostic ignored "-Wrange-loop-analysis" // https://github.com/harfbuzz/harfbuzz/issues/2834
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#pragma GCC diagnostic ignored "-Wtype-limits"
#pragma GCC diagnostic ignored "-Wc++11-compat" // only gcc raises it
#endif

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 a pull request may close this issue.

2 participants