[circleci] Fix some of warnings from clang-everything bot (#1211)

* -Wshift-sign-overflow
* -Wmissing-prototypes
This commit is contained in:
Ebrahim Byagowi 2018-10-02 21:39:19 +03:30 committed by GitHub
parent 9f1dee32fb
commit 6353cc1f83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 30 deletions

View File

@ -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

View File

@ -45,8 +45,8 @@
#include <stdlib.h>
#include <stdio.h>
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

View File

@ -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)
{

View File

@ -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);

View File

@ -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);
}

View File

@ -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);