Add -Werror -Wall -Wextra to compiler option.

- To suppress noisy unused parameter warnings, comment out unused
  arguments.
- Add -Werror for suppressing further warning.
- Add -Wall -Wextra for safety.

Change-Id: I30a0914a4633bd93eb60957cdf378770f04d8428
This commit is contained in:
Seigo Nonaka
2015-10-27 14:56:12 +09:00
parent 9a4c3535be
commit a816dfb3fa
8 changed files with 26 additions and 25 deletions

View File

@@ -59,7 +59,7 @@ struct LayoutGlyph {
};
// Internal state used during layout operation
class LayoutContext;
struct LayoutContext;
enum {
kBidi_LTR = 0,

View File

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

View File

@@ -26,7 +26,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);
@@ -50,11 +50,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 +57,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);
}

View File

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

View File

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

View File

@@ -54,4 +54,6 @@ LOCAL_C_INCLUDES := \
external/libxml2/include \
external/skia/src/core
LOCAL_CPPFLAGS += -Werror -Wall -Wextra
include $(BUILD_NATIVE_TEST)

View File

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

View File

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