From 6353cc1f83c862910860976411a1157f7ed571bc Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Tue, 2 Oct 2018 21:39:19 +0330 Subject: [PATCH] [circleci] Fix some of warnings from clang-everything bot (#1211) * -Wshift-sign-overflow * -Wmissing-prototypes --- .circleci/config.yml | 4 ++-- src/dump-emoji.cc | 19 ++++++++++--------- src/hb-ucdn.cc | 3 +++ src/test-unicode-ranges.cc | 4 ++-- test/fuzzing/hb-subset-fuzzer.cc | 32 +++++++++++++++++--------------- util/ansi-print.cc | 4 ++-- 6 files changed, 36 insertions(+), 30 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 670efa5ad..3696d2889 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -89,9 +89,9 @@ jobs: - run: echo "deb http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdev.list - run: echo "deb-src http://apt.llvm.org/cosmic/ llvm-toolchain-cosmic main" > /etc/apt/sources.list.d/llvmdevsrc.list - run: apt update || true - - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip + - run: apt install -y clang lld binutils libtool autoconf automake make pkg-config gtk-doc-tools ragel libfreetype6-dev libfontconfig1-dev libglib2.0-dev libcairo2-dev libicu-dev libgraphite2-dev python python-pip - run: pip install fonttools - - run: CFLAGS="-Weverything -Wno-padded -Wno-cast-qual -Wno-sign-conversion -Wno-conversion -Wno-documentation -Wno-documentation-unknown-command -Wno-reserved-id-macro" CXXFLAGS="-Weverything -Wno-undef -Wno-deprecated-declarations -Wno-weak-vtables -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-conversion -Wno-sign-conversion -Wno-c++98-compat -Wno-extra-semi -Wno-c++98-compat-pedantic -Wno-padded -Wno-shift-sign-overflow -Wno-missing-field-initializers -Wno-double-promotion -Wno-reserved-id-macro -Wno-cast-qual -Wno-unused-parameter -Wno-comma -Wno-shadow -Wno-used-but-marked-unused -Wno-format-pedantic -Wno-zero-as-null-pointer-constant -Wno-disabled-macro-expansion -Wno-covered-switch-default -Wno-conditional-uninitialized -Wno-unreachable-code -Wno-unused-macros -Wno-float-equal -Wno-missing-prototypes" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 + - run: CFLAGS="-Weverything -Wno-reserved-id-macro -Wno-conversion -Wno-padded -Wno-sign-conversion -Wno-cast-qual -Wno-documentation -Wno-documentation-unknown-command" CXXFLAGS="-Weverything -Wno-old-style-cast -Wno-documentation -Wno-documentation-unknown-command -Wno-c++98-compat -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-sign-conversion -Wno-padded -Wno-shorten-64-to-32 -Wno-extra-semi -Wno-reserved-id-macro -Wno-float-conversion -Wno-format-pedantic -Wno-shadow -Wno-conversion -Wno-zero-as-null-pointer-constant -Wno-missing-field-initializers -Wno-double-promotion -Wno-used-but-marked-unused -Wno-unused-macros -Wno-comma -Wno-float-equal -Wno-disabled-macro-expansion -Wno-weak-vtables -Wno-unused-parameter -Wno-covered-switch-default -Wno-unreachable-code -Wno-deprecated-declarations" CC=clang CXX=clang++ ./autogen.sh --with-freetype --with-glib --with-cairo --with-icu --with-graphite2 --with-fontconfig - run: make -j32 CPPFLAGS="-Werror" - run: make check CPPFLAGS="-Werror" || .ci/fail.sh diff --git a/src/dump-emoji.cc b/src/dump-emoji.cc index 65214692f..3e0d668fb 100644 --- a/src/dump-emoji.cc +++ b/src/dump-emoji.cc @@ -45,8 +45,8 @@ #include #include -void cbdt_callback (const uint8_t* data, unsigned int length, - unsigned int group, unsigned int gid) +static void cbdt_callback (const uint8_t* data, unsigned int length, + unsigned int group, unsigned int gid) { char output_path[255]; sprintf (output_path, "out/cbdt-%d-%d.png", group, gid); @@ -55,8 +55,8 @@ void cbdt_callback (const uint8_t* data, unsigned int length, fclose (f); } -void sbix_callback (const uint8_t* data, unsigned int length, - unsigned int group, unsigned int gid) +static void sbix_callback (const uint8_t* data, unsigned int length, + unsigned int group, unsigned int gid) { char output_path[255]; sprintf (output_path, "out/sbix-%d-%d.png", group, gid); @@ -65,8 +65,8 @@ void sbix_callback (const uint8_t* data, unsigned int length, fclose (f); } -void svg_callback (const uint8_t* data, unsigned int length, - unsigned int start_glyph, unsigned int end_glyph) +static void svg_callback (const uint8_t* data, unsigned int length, + unsigned int start_glyph, unsigned int end_glyph) { char output_path[255]; if (start_glyph == end_glyph) @@ -83,8 +83,8 @@ void svg_callback (const uint8_t* data, unsigned int length, fclose (f); } -void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs, - const OT::COLR *colr, const OT::CPAL *cpal) +static void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs, + const OT::COLR *colr, const OT::CPAL *cpal) { for (unsigned int i = 0; i < num_glyphs; ++i) { @@ -162,7 +162,8 @@ void colr_cpal_rendering (cairo_font_face_t *cairo_face, unsigned int upem, unsi } } -void dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, unsigned int num_glyphs) +static void dump_glyphs (cairo_font_face_t *cairo_face, unsigned int upem, + unsigned int num_glyphs) { // Dump every glyph available on the font return; // disabled for now diff --git a/src/hb-ucdn.cc b/src/hb-ucdn.cc index fe45e8f92..41be586c8 100644 --- a/src/hb-ucdn.cc +++ b/src/hb-ucdn.cc @@ -274,6 +274,9 @@ void free_static_ucdn_funcs (void) #endif extern "C" HB_INTERNAL +hb_unicode_funcs_t * +hb_ucdn_get_unicode_funcs (void); + hb_unicode_funcs_t * hb_ucdn_get_unicode_funcs (void) { diff --git a/src/test-unicode-ranges.cc b/src/test-unicode-ranges.cc index 1334ea030..02d12710f 100644 --- a/src/test-unicode-ranges.cc +++ b/src/test-unicode-ranges.cc @@ -28,7 +28,7 @@ #include "hb-ot-os2-unicode-ranges.hh" -void +static void test (hb_codepoint_t cp, unsigned int bit) { if (OT::hb_get_unicode_range_bit (cp) != bit) @@ -41,7 +41,7 @@ test (hb_codepoint_t cp, unsigned int bit) } } -void +static void test_get_unicode_range_bit (void) { test (0x0000, 0); diff --git a/test/fuzzing/hb-subset-fuzzer.cc b/test/fuzzing/hb-subset-fuzzer.cc index 9e4aafca7..649722ce6 100644 --- a/test/fuzzing/hb-subset-fuzzer.cc +++ b/test/fuzzing/hb-subset-fuzzer.cc @@ -6,11 +6,12 @@ #include "hb-subset.h" -void trySubset (hb_face_t *face, - const hb_codepoint_t text[], - int text_length, - bool drop_hints, - bool drop_layout) +static void +trySubset (hb_face_t *face, + const hb_codepoint_t text[], + int text_length, + bool drop_hints, + bool drop_layout) { hb_subset_input_t *input = hb_subset_input_create_or_fail (); hb_subset_input_set_drop_hints (input, drop_hints); @@ -28,16 +29,17 @@ void trySubset (hb_face_t *face, hb_subset_input_destroy (input); } -void trySubset (hb_face_t *face, - const hb_codepoint_t text[], - int text_length) +static void +trySubset (hb_face_t *face, + const hb_codepoint_t text[], + int text_length) { for (unsigned int drop_hints = 0; drop_hints < 2; drop_hints++) { for (unsigned int drop_layout = 0; drop_layout < 2; drop_layout++) { trySubset (face, text, text_length, - (bool) drop_hints, (bool) drop_layout); + (bool) drop_hints, (bool) drop_layout); } } } @@ -45,22 +47,22 @@ void trySubset (hb_face_t *face, extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { hb_blob_t *blob = hb_blob_create ((const char *)data, size, - HB_MEMORY_MODE_READONLY, NULL, NULL); + HB_MEMORY_MODE_READONLY, NULL, NULL); hb_face_t *face = hb_face_create (blob, 0); const hb_codepoint_t text[] = { - 'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2', - '3', '@', '_', '%', '&', ')', '*', '$', '!' + 'A', 'B', 'C', 'D', 'E', 'X', 'Y', 'Z', '1', '2', + '3', '@', '_', '%', '&', ')', '*', '$', '!' }; trySubset (face, text, sizeof (text) / sizeof (hb_codepoint_t)); hb_codepoint_t text_from_data[16]; if (size > sizeof(text_from_data)) { - memcpy(text_from_data, - data + size - sizeof(text_from_data), - sizeof(text_from_data)); + memcpy (text_from_data, + data + size - sizeof(text_from_data), + sizeof(text_from_data)); unsigned int text_size = sizeof (text_from_data) / sizeof (hb_codepoint_t); trySubset (face, text_from_data, text_size); } diff --git a/util/ansi-print.cc b/util/ansi-print.cc index 0daee1f02..5e2845cf1 100644 --- a/util/ansi-print.cc +++ b/util/ansi-print.cc @@ -71,7 +71,7 @@ struct color_t { static color_t from_ansi (unsigned int x) { - color_t c = {(0xFF<<24) | ((0xFF*(x&1))<<16) | ((0xFF*((x >> 1)&1))<<8) | (0xFF*((x >> 2)&1))}; + color_t c = {(0xFFu<<24) | ((0xFFu*(x&1))<<16) | ((0xFFu*((x >> 1)&1))<<8) | (0xFFu*((x >> 2)&1))}; return c; } unsigned int to_ansi (void) @@ -223,7 +223,7 @@ struct biimage_t uint8_t * const data; }; -const char * +static const char * block_best (const biimage_t &bi, bool *inverse) { assert (bi.width <= CELL_W);