Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bed8036 authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

libutils: turn on -Werror

- Deal with some -Wunused issues
- Override PRI macros (windows)
- Revert use of PRI macros on off64_t (linux)
- Deal with a gnu++11 complaince issue

Change-Id: Ie66751293bd84477a5a6dfd8a57e700a16e36964
parent bf0f2590
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -43,7 +43,7 @@ commonSources:= \
	VectorImpl.cpp \
	misc.cpp

host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)
host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) -Werror

ifeq ($(HOST_OS),windows)
ifeq ($(strip $(USE_CYGWIN),),)
@@ -99,6 +99,7 @@ LOCAL_SRC_FILES:= \
ifeq ($(TARGET_ARCH),mips)
LOCAL_CFLAGS += -DALIGN_DOUBLE
endif
LOCAL_CFLAGS += -Werror

LOCAL_C_INCLUDES += \
		bionic/libc/private \
@@ -126,7 +127,8 @@ LOCAL_SHARED_LIBRARIES := \
        libbacktrace \
        libcutils \
        libdl \
        liblog \
        liblog
LOCAL_CFLAGS := -Werror

include external/stlport/libstlport.mk

+2 −2
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
namespace android {

// BlobCache::Header::mMagicNumber value
static const uint32_t blobCacheMagic = '_Bb$';
static const uint32_t blobCacheMagic = ('_' << 24) + ('B' << 16) + ('b' << 8) + '$';

// BlobCache::Header::mBlobCacheVersion value
static const uint32_t blobCacheVersion = 1;
@@ -49,7 +49,7 @@ BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize
    mRandState[1] = (now >> 16) & 0xFFFF;
    mRandState[2] = (now >> 32) & 0xFFFF;
#endif
    ALOGV("initializing random seed using %lld", now);
    ALOGV("initializing random seed using %lld", (unsigned long long)now);
}

void BlobCache::set(const void* key, size_t keySize, const void* value,
+8 −2
Original line number Diff line number Diff line
@@ -23,7 +23,13 @@
#include <utils/FileMap.h>
#include <utils/Log.h>

#if defined(HAVE_WIN32_FILEMAP) && !defined(__USE_MINGW_ANSI_STDIO)
# define PRId32 "I32d"
# define PRIx32 "I32x"
# define PRId64 "I64d"
#else
#include <inttypes.h>
#endif
#include <stdio.h>
#include <stdlib.h>

@@ -169,8 +175,8 @@ try_again:
            goto try_again;
        }

        ALOGE("mmap(%" PRId64 ",%zu) failed: %s\n",
            adjOffset, adjLength, strerror(errno));
        ALOGE("mmap(%lld,%zu) failed: %s\n",
            (long long)adjOffset, adjLength, strerror(errno));
        return false;
    }
    mBasePtr = ptr;
+2 −2
Original line number Diff line number Diff line
@@ -92,7 +92,7 @@ public:
        : mNextPage(0)
    {}

    void* operator new(size_t size, void* buf) { return buf; }
    void* operator new(size_t /*size*/, void* buf) { return buf; }

    void* start() {
        return (void*) (((size_t)this) + sizeof(Page));
@@ -103,7 +103,7 @@ public:
    }

private:
    Page(const Page& other) {}
    Page(const Page& /*other*/) {}
    Page* mNextPage;
};

+17 −11
Original line number Diff line number Diff line
@@ -17,6 +17,14 @@
#define LOG_TAG "RefBase"
// #define LOG_NDEBUG 0

#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <typeinfo>
#include <unistd.h>

#include <utils/RefBase.h>

#include <utils/Atomic.h>
@@ -24,13 +32,9 @@
#include <utils/Log.h>
#include <utils/threads.h>

#include <stdlib.h>
#include <stdio.h>
#include <typeinfo>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#ifndef __unused
#define __unused __attribute__((__unused__))
#endif

// compile with refcounting debugging enabled
#define DEBUG_REFS                      0
@@ -388,7 +392,7 @@ void RefBase::weakref_type::incWeak(const void* id)
{
    weakref_impl* const impl = static_cast<weakref_impl*>(this);
    impl->addWeakRef(id);
    const int32_t c = android_atomic_inc(&impl->mWeak);
    const int32_t c __unused = android_atomic_inc(&impl->mWeak);
    ALOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this);
}

@@ -615,7 +619,7 @@ void RefBase::onLastStrongRef(const void* /*id*/)
{
}

bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id)
bool RefBase::onIncStrongAttempted(uint32_t flags, const void* /*id*/)
{
    return (flags&FIRST_INC_STRONG) ? true : false;
}
@@ -626,13 +630,15 @@ void RefBase::onLastWeakRef(const void* /*id*/)

// ---------------------------------------------------------------------------

void RefBase::renameRefs(size_t n, const ReferenceRenamer& renamer) {
#if DEBUG_REFS
void RefBase::renameRefs(size_t n, const ReferenceRenamer& renamer) {
    for (size_t i=0 ; i<n ; i++) {
        renamer(i);
    }
#endif
}
#else
void RefBase::renameRefs(size_t /*n*/, const ReferenceRenamer& /*renamer*/) { }
#endif

void RefBase::renameRefId(weakref_type* ref,
        const void* old_id, const void* new_id) {
Loading