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

Commit 052c5130 authored by Tomasz Wasilczyk's avatar Tomasz Wasilczyk
Browse files

Binder: enable/fix some warnings

Bug: 341997808
Test: mma
Change-Id: Ibd44eda768a714e85399a15f3c8e534d715f87ce
parent 90946c74
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -285,7 +285,9 @@ static const void* printCommand(std::ostream& out, const void* _cmd) {
    return cmd;
    return cmd;
}
}


LIBBINDER_IGNORE("-Wzero-as-null-pointer-constant")
static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER;
LIBBINDER_IGNORE_END()
static std::atomic<bool> gHaveTLS(false);
static std::atomic<bool> gHaveTLS(false);
static pthread_key_t gTLS = 0;
static pthread_key_t gTLS = 0;
static std::atomic<bool> gShutdown = false;
static std::atomic<bool> gShutdown = false;
+2 −2
Original line number Original line Diff line number Diff line
@@ -113,7 +113,7 @@ status_t PersistableBundle::writeToParcel(Parcel* parcel) const {
    // Backpatch length. This length value includes the length header.
    // Backpatch length. This length value includes the length header.
    parcel->setDataPosition(length_pos);
    parcel->setDataPosition(length_pos);
    size_t length = end_pos - start_pos;
    size_t length = end_pos - start_pos;
    if (length > std::numeric_limits<int32_t>::max()) {
    if (length > static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
        ALOGE("Parcel length (%zu) too large to store in 32-bit signed int", length);
        ALOGE("Parcel length (%zu) too large to store in 32-bit signed int", length);
        return BAD_VALUE;
        return BAD_VALUE;
    }
    }
@@ -319,7 +319,7 @@ status_t PersistableBundle::writeToParcelInner(Parcel* parcel) const {
     * pairs themselves.
     * pairs themselves.
     */
     */
    size_t num_entries = size();
    size_t num_entries = size();
    if (num_entries > std::numeric_limits<int32_t>::max()) {
    if (num_entries > static_cast<size_t>(std::numeric_limits<int32_t>::max())) {
        ALOGE("The size of this PersistableBundle (%zu) too large to store in 32-bit signed int",
        ALOGE("The size of this PersistableBundle (%zu) too large to store in 32-bit signed int",
              num_entries);
              num_entries);
        return BAD_VALUE;
        return BAD_VALUE;
+13 −0
Original line number Original line Diff line number Diff line
@@ -58,6 +58,19 @@
        }                                       \
        }                                       \
    } while (0)
    } while (0)


#define LIBBINDER_PRAGMA(arg) _Pragma(#arg)
#if defined(__clang__)
#define LIBBINDER_PRAGMA_FOR_COMPILER(arg) LIBBINDER_PRAGMA(clang arg)
#elif defined(__GNUC__)
#define LIBBINDER_PRAGMA_FOR_COMPILER(arg) LIBBINDER_PRAGMA(GCC arg)
#else
#define LIBBINDER_PRAGMA_FOR_COMPILER(arg)
#endif
#define LIBBINDER_IGNORE(warning_flag)             \
    LIBBINDER_PRAGMA_FOR_COMPILER(diagnostic push) \
    LIBBINDER_PRAGMA_FOR_COMPILER(diagnostic ignored warning_flag)
#define LIBBINDER_IGNORE_END() LIBBINDER_PRAGMA_FOR_COMPILER(diagnostic pop)

namespace android {
namespace android {


/**
/**
+5 −0
Original line number Original line Diff line number Diff line
@@ -29,6 +29,11 @@
#include <sys/cdefs.h>
#include <sys/cdefs.h>
#include <sys/types.h>
#include <sys/types.h>


#ifndef __clang__
#define _Nullable
#define _Nonnull
#endif

__BEGIN_DECLS
__BEGIN_DECLS


/*
/*
+3 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@
#include <binder/IServiceManager.h>
#include <binder/IServiceManager.h>
#include <binder/LazyServiceRegistrar.h>
#include <binder/LazyServiceRegistrar.h>


#include "../Utils.h"
#include "ibinder_internal.h"
#include "ibinder_internal.h"
#include "status_internal.h"
#include "status_internal.h"


@@ -89,7 +90,9 @@ AIBinder* AServiceManager_getService(const char* instance) {
    }
    }


    sp<IServiceManager> sm = defaultServiceManager();
    sp<IServiceManager> sm = defaultServiceManager();
    LIBBINDER_IGNORE("-Wdeprecated-declarations")
    sp<IBinder> binder = sm->getService(String16(instance));
    sp<IBinder> binder = sm->getService(String16(instance));
    LIBBINDER_IGNORE_END()


    sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(binder);
    sp<AIBinder> ret = ABpBinder::lookupOrCreateFromBinder(binder);
    AIBinder_incStrong(ret.get());
    AIBinder_incStrong(ret.get());
Loading