mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add -Werror -Wall -Wextra to compiler option.
This is 2nd trial of I30a0914a4633bd93eb60957cdf378770f04d8428 - To suppress noisy unused parameter warnings, comment out unused arguments. - Add -Werror for suppressing further warning. - Add -Wall -Wextra for safety. - Use "z" prefix for format string of size_t. Verified that compile succeeded on all arm,arm64,mips,x86,x86_64. Change-Id: I7ad208464486b8a35da53929cb1cfe541ed0052f
This commit is contained in:
parent
07c8ad2b85
commit
ac88812115
@ -59,7 +59,7 @@ struct LayoutGlyph {
|
||||
};
|
||||
|
||||
// Internal state used during layout operation
|
||||
class LayoutContext;
|
||||
struct LayoutContext;
|
||||
|
||||
enum {
|
||||
kBidi_LTR = 0,
|
||||
|
||||
@ -50,6 +50,7 @@ LOCAL_MODULE := libminikin
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := frameworks/minikin/include
|
||||
LOCAL_SRC_FILES := $(minikin_src_files)
|
||||
LOCAL_C_INCLUDES := $(minikin_c_includes)
|
||||
LOCAL_CPPFLAGS += -Werror -Wall -Wextra
|
||||
LOCAL_SHARED_LIBRARIES := $(minikin_shared_libraries)
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
@ -61,6 +62,7 @@ LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := frameworks/minikin/include
|
||||
LOCAL_SRC_FILES := $(minikin_src_files)
|
||||
LOCAL_C_INCLUDES := $(minikin_c_includes)
|
||||
LOCAL_CPPFLAGS += -Werror -Wall -Wextra
|
||||
LOCAL_SHARED_LIBRARIES := $(minikin_shared_libraries)
|
||||
|
||||
include $(BUILD_STATIC_LIBRARY)
|
||||
@ -73,6 +75,7 @@ LOCAL_MODULE := libminikin_host
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS := frameworks/minikin/include
|
||||
LOCAL_C_INCLUDES := $(minikin_c_includes)
|
||||
LOCAL_CPPFLAGS += -Werror -Wall -Wextra
|
||||
LOCAL_SHARED_LIBRARIES := liblog libicuuc-host
|
||||
|
||||
LOCAL_SRC_FILES := Hyphenator.cpp
|
||||
|
||||
@ -43,7 +43,7 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) :
|
||||
vector<uint32_t> lastChar;
|
||||
size_t nTypefaces = typefaces.size();
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("nTypefaces = %d\n", nTypefaces);
|
||||
ALOGD("nTypefaces = %zd\n", nTypefaces);
|
||||
#endif
|
||||
const FontStyle defaultStyle;
|
||||
for (size_t i = 0; i < nTypefaces; i++) {
|
||||
@ -72,7 +72,7 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) :
|
||||
mRanges.push_back(dummy);
|
||||
Range* range = &mRanges.back();
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("i=%d: range start = %d\n", i, offset);
|
||||
ALOGD("i=%zd: range start = %zd\n", i, offset);
|
||||
#endif
|
||||
range->start = offset;
|
||||
for (size_t j = 0; j < nTypefaces; j++) {
|
||||
@ -82,7 +82,7 @@ FontCollection::FontCollection(const vector<FontFamily*>& typefaces) :
|
||||
offset++;
|
||||
uint32_t nextChar = family->getCoverage()->nextSetBit((i + 1) << kLogCharsPerPage);
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("nextChar = %d (j = %d)\n", nextChar, j);
|
||||
ALOGD("nextChar = %d (j = %zd)\n", nextChar, j);
|
||||
#endif
|
||||
lastChar[j] = nextChar;
|
||||
}
|
||||
@ -110,7 +110,7 @@ FontFamily* FontCollection::getFamilyForChar(uint32_t ch, uint32_t vs,
|
||||
}
|
||||
const Range& range = mRanges[ch >> kLogCharsPerPage];
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("querying range %d:%d\n", range.start, range.end);
|
||||
ALOGD("querying range %zd:%zd\n", range.start, range.end);
|
||||
#endif
|
||||
FontFamily* bestFamily = nullptr;
|
||||
int bestScore = -1;
|
||||
|
||||
@ -258,8 +258,8 @@ const SparseBitSet* FontFamily::getCoverage() {
|
||||
}
|
||||
CmapCoverage::getCoverage(mCoverage, cmapData.get(), cmapSize); // TODO: Error check?
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("font coverage length=%d, first ch=%x\n", mCoverage->length(),
|
||||
mCoverage->nextSetBit(0));
|
||||
ALOGD("font coverage length=%d, first ch=%x\n", mCoverage.length(),
|
||||
mCoverage.nextSetBit(0));
|
||||
#endif
|
||||
mCoverageValid = true;
|
||||
}
|
||||
|
||||
@ -18,6 +18,7 @@
|
||||
|
||||
#include "HbFaceCache.h"
|
||||
|
||||
#include <cutils/log.h>
|
||||
#include <hb.h>
|
||||
#include <utils/LruCache.h>
|
||||
|
||||
@ -26,7 +27,7 @@
|
||||
|
||||
namespace android {
|
||||
|
||||
static hb_blob_t* referenceTable(hb_face_t* face, hb_tag_t tag, void* userData) {
|
||||
static hb_blob_t* referenceTable(hb_face_t* /* face */, hb_tag_t tag, void* userData) {
|
||||
MinikinFont* font = reinterpret_cast<MinikinFont*>(userData);
|
||||
size_t length = 0;
|
||||
bool ok = font->GetTable(tag, NULL, &length);
|
||||
@ -39,7 +40,7 @@ static hb_blob_t* referenceTable(hb_face_t* face, hb_tag_t tag, void* userData)
|
||||
}
|
||||
ok = font->GetTable(tag, reinterpret_cast<uint8_t*>(buffer), &length);
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("referenceTable %c%c%c%c length=%d %d",
|
||||
ALOGD("referenceTable %c%c%c%c length=%zd %d",
|
||||
(tag >>24)&0xff, (tag>>16)&0xff, (tag>>8)&0xff, tag&0xff, length, ok);
|
||||
#endif
|
||||
if (!ok) {
|
||||
@ -50,11 +51,6 @@ static hb_blob_t* referenceTable(hb_face_t* face, hb_tag_t tag, void* userData)
|
||||
HB_MEMORY_MODE_WRITABLE, buffer, free);
|
||||
}
|
||||
|
||||
static unsigned int disabledDecomposeCompatibility(
|
||||
hb_unicode_funcs_t*, hb_codepoint_t, hb_codepoint_t*, void*) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
class HbFaceCache : private OnEntryRemoved<int32_t, hb_face_t*> {
|
||||
public:
|
||||
HbFaceCache() : mCache(kMaxEntries) {
|
||||
@ -62,7 +58,7 @@ public:
|
||||
}
|
||||
|
||||
// callback for OnEntryRemoved
|
||||
void operator()(int32_t& key, hb_face_t*& value) {
|
||||
void operator()(int32_t& /* key */, hb_face_t*& value) {
|
||||
hb_face_destroy(value);
|
||||
}
|
||||
|
||||
|
||||
@ -276,16 +276,17 @@ void Layout::setFontCollection(const FontCollection* collection) {
|
||||
mCollection = collection;
|
||||
}
|
||||
|
||||
static hb_position_t harfbuzzGetGlyphHorizontalAdvance(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, void* userData)
|
||||
{
|
||||
static hb_position_t harfbuzzGetGlyphHorizontalAdvance(hb_font_t* /* hbFont */, void* fontData,
|
||||
hb_codepoint_t glyph, void* /* userData */) {
|
||||
MinikinPaint* paint = reinterpret_cast<MinikinPaint*>(fontData);
|
||||
MinikinFont* font = paint->font;
|
||||
float advance = font->GetHorizontalAdvance(glyph, *paint);
|
||||
return 256 * advance + 0.5;
|
||||
}
|
||||
|
||||
static hb_bool_t harfbuzzGetGlyphHorizontalOrigin(hb_font_t* hbFont, void* fontData, hb_codepoint_t glyph, hb_position_t* x, hb_position_t* y, void* userData)
|
||||
{
|
||||
static hb_bool_t harfbuzzGetGlyphHorizontalOrigin(hb_font_t* /* hbFont */, void* /* fontData */,
|
||||
hb_codepoint_t /* glyph */, hb_position_t* /* x */, hb_position_t* /* y */,
|
||||
void* /* userData */) {
|
||||
// Just return true, following the way that Harfbuzz-FreeType
|
||||
// implementation does.
|
||||
return true;
|
||||
@ -709,7 +710,7 @@ void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t
|
||||
ctx->paint.fakery = mFaces[font_ix].fakery;
|
||||
hb_font_t* hbFont = ctx->hbFonts[font_ix];
|
||||
#ifdef VERBOSE_DEBUG
|
||||
ALOGD("Run %u, font %d [%d:%d]", run_ix, font_ix, run.start, run.end);
|
||||
ALOGD("Run %zu, font %d [%d:%d]", run_ix, font_ix, run.start, run.end);
|
||||
#endif
|
||||
|
||||
hb_font_set_ppem(hbFont, size * scaleX, size);
|
||||
@ -804,7 +805,7 @@ void Layout::doLayoutRun(const uint16_t* buf, size_t start, size_t count, size_t
|
||||
if (info[i].cluster - start < count) {
|
||||
mAdvances[info[i].cluster - start] += xAdvance;
|
||||
} else {
|
||||
ALOGE("cluster %d (start %d) out of bounds of count %d",
|
||||
ALOGE("cluster %zu (start %zu) out of bounds of count %zu",
|
||||
info[i].cluster - start, start, count);
|
||||
}
|
||||
x += xAdvance;
|
||||
|
||||
@ -249,7 +249,7 @@ void LineBreaker::addWordBreak(size_t offset, ParaWidth preBreak, ParaWidth post
|
||||
cand.penalty = SCORE_DESPERATE;
|
||||
cand.hyphenEdit = 0;
|
||||
#if VERBOSE_DEBUG
|
||||
ALOGD("desperate cand: %d %g:%g",
|
||||
ALOGD("desperate cand: %zd %g:%g",
|
||||
mCandidates.size(), cand.postBreak, cand.preBreak);
|
||||
#endif
|
||||
addCandidate(cand);
|
||||
@ -264,7 +264,7 @@ void LineBreaker::addWordBreak(size_t offset, ParaWidth preBreak, ParaWidth post
|
||||
cand.penalty = penalty;
|
||||
cand.hyphenEdit = hyph;
|
||||
#if VERBOSE_DEBUG
|
||||
ALOGD("cand: %d %g:%g", mCandidates.size(), cand.postBreak, cand.preBreak);
|
||||
ALOGD("cand: %zd %g:%g", mCandidates.size(), cand.postBreak, cand.preBreak);
|
||||
#endif
|
||||
addCandidate(cand);
|
||||
}
|
||||
@ -409,7 +409,7 @@ void LineBreaker::computeBreaksOptimal(bool isRectangle) {
|
||||
mCandidates[i].prev = bestPrev;
|
||||
mCandidates[i].lineNumber = mCandidates[bestPrev].lineNumber + 1;
|
||||
#if VERBOSE_DEBUG
|
||||
ALOGD("break %d: score=%g, prev=%d", i, mCandidates[i].score, mCandidates[i].prev);
|
||||
ALOGD("break %zd: score=%g, prev=%zd", i, mCandidates[i].score, mCandidates[i].prev);
|
||||
#endif
|
||||
}
|
||||
finishBreaksOptimal();
|
||||
|
||||
@ -47,8 +47,8 @@ float MinikinFontFreeType::GetHorizontalAdvance(uint32_t glyph_id,
|
||||
return advance * (1.0 / 65536);
|
||||
}
|
||||
|
||||
void MinikinFontFreeType::GetBounds(MinikinRect* bounds, uint32_t glyph_id,
|
||||
const MinikinPaint& paint) const {
|
||||
void MinikinFontFreeType::GetBounds(MinikinRect* /* bounds */, uint32_t /* glyph_id*/,
|
||||
const MinikinPaint& /* paint */) const {
|
||||
// TODO: NYI
|
||||
}
|
||||
|
||||
@ -66,8 +66,8 @@ int32_t MinikinFontFreeType::GetUniqueId() const {
|
||||
return mUniqueId;
|
||||
}
|
||||
|
||||
bool MinikinFontFreeType::Render(uint32_t glyph_id,
|
||||
const MinikinPaint &paint, GlyphBitmap *result) {
|
||||
bool MinikinFontFreeType::Render(uint32_t glyph_id, const MinikinPaint& /* paint */,
|
||||
GlyphBitmap *result) {
|
||||
FT_Error error;
|
||||
FT_Int32 load_flags = FT_LOAD_DEFAULT; // TODO: respect hinting settings
|
||||
error = FT_Load_Glyph(mTypeface, glyph_id, load_flags);
|
||||
|
||||
@ -54,4 +54,6 @@ LOCAL_C_INCLUDES := \
|
||||
external/libxml2/include \
|
||||
external/skia/src/core
|
||||
|
||||
LOCAL_CPPFLAGS += -Werror -Wall -Wextra
|
||||
|
||||
include $(BUILD_NATIVE_TEST)
|
||||
|
||||
@ -35,18 +35,18 @@ public:
|
||||
MockMinikinFont(int32_t id) : mId(id) {
|
||||
}
|
||||
|
||||
virtual float GetHorizontalAdvance(
|
||||
uint32_t glyph_id, const MinikinPaint &paint) const {
|
||||
virtual float GetHorizontalAdvance(uint32_t /* glyph_id */,
|
||||
const MinikinPaint& /* paint */) const {
|
||||
LOG_ALWAYS_FATAL("MockMinikinFont::GetHorizontalAdvance is not implemented.");
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
virtual void GetBounds(MinikinRect* bounds, uint32_t glyph_id,
|
||||
const MinikinPaint &paint) const {
|
||||
virtual void GetBounds(MinikinRect* /* bounds */, uint32_t /* glyph_id */,
|
||||
const MinikinPaint& /* paint */) const {
|
||||
LOG_ALWAYS_FATAL("MockMinikinFont::GetBounds is not implemented.");
|
||||
}
|
||||
|
||||
virtual bool GetTable(uint32_t tag, uint8_t *buf, size_t *size) {
|
||||
virtual bool GetTable(uint32_t /* tag */, uint8_t* /* buf */, size_t* /* size */) {
|
||||
LOG_ALWAYS_FATAL("MockMinikinFont::GetTable is not implemented.");
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -29,14 +29,14 @@ MinikinFontForTest::MinikinFontForTest(const std::string& font_path) : mFontPath
|
||||
MinikinFontForTest::~MinikinFontForTest() {
|
||||
}
|
||||
|
||||
float MinikinFontForTest::GetHorizontalAdvance(
|
||||
uint32_t glyph_id, const android::MinikinPaint &paint) const {
|
||||
float MinikinFontForTest::GetHorizontalAdvance(uint32_t /* glyph_id */,
|
||||
const android::MinikinPaint& /* paint */) const {
|
||||
LOG_ALWAYS_FATAL("MinikinFontForTest::GetHorizontalAdvance is not yet implemented");
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
void MinikinFontForTest::GetBounds(android::MinikinRect* bounds, uint32_t glyph_id,
|
||||
const android::MinikinPaint& paint) const {
|
||||
void MinikinFontForTest::GetBounds(android::MinikinRect* /* bounds */, uint32_t /* glyph_id */,
|
||||
const android::MinikinPaint& /* paint */) const {
|
||||
LOG_ALWAYS_FATAL("MinikinFontForTest::GetBounds is not yet implemented");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user