Merge "Bring lldb testsuite up to date with codeplay internal"
diff --git a/cpp/Android.mk b/cpp/Android.mk
index f2934f6..3d3995d 100644
--- a/cpp/Android.mk
+++ b/cpp/Android.mk
@@ -82,7 +82,6 @@
LOCAL_SRC_FILES += ../rsCompatibilityLib.cpp
LOCAL_WHOLE_STATIC_LIBRARIES := \
- libutils \
libRSDispatch
LOCAL_MODULE:= libRScpp_static
diff --git a/cpp/rsCppInternal.h b/cpp/rsCppInternal.h
index 69857d7..c51f7a0 100644
--- a/cpp/rsCppInternal.h
+++ b/cpp/rsCppInternal.h
@@ -24,12 +24,12 @@
#include "rsDispatch.h"
#define tryDispatch(rs, dispatch) \
- if (rs->getError() == RS_SUCCESS) { \
+ if ((rs)->getError() == RS_SUCCESS) { \
dispatch; \
}
#define createDispatch(rs, dispatch) \
- rs->getError() == RS_SUCCESS ? dispatch : nullptr
+ rs->getError() == RS_SUCCESS ? (dispatch) : nullptr
#undef LOG_TAG
#undef LOG_NDEBUG
diff --git a/cpp/rsCppStructs.h b/cpp/rsCppStructs.h
index 1802386..a3e65ab 100644
--- a/cpp/rsCppStructs.h
+++ b/cpp/rsCppStructs.h
@@ -1412,7 +1412,7 @@
bool mSkipPadding;
public:
- Builder(sp<RS> rs);
+ explicit Builder(sp<RS> rs);
~Builder();
void add(sp<const Element> e, const char * name, uint32_t arraySize = 1);
sp<const Element> create();
@@ -1428,7 +1428,7 @@
uint32_t * arraySizes);
Element(void *id, sp<RS> rs, RsDataType dt, RsDataKind dk, bool norm, uint32_t size);
Element(void *id, sp<RS> rs);
- Element(sp<RS> rs);
+ explicit Element(sp<RS> rs);
virtual ~Element();
private:
@@ -1458,7 +1458,7 @@
size_t mLen;
public:
- FieldPacker(size_t len)
+ explicit FieldPacker(size_t len)
: mPos(0), mLen(len) {
mData = new unsigned char[len];
}
diff --git a/cpp/util/RefBase.h b/cpp/util/RefBase.h
index 01c0b5f..40bb7bc 100644
--- a/cpp/util/RefBase.h
+++ b/cpp/util/RefBase.h
@@ -202,12 +202,12 @@
inline wp() : m_ptr(0) { }
- wp(T* other);
+ explicit wp(T* other);
wp(const wp<T>& other);
- wp(const sp<T>& other);
- template<typename U> wp(U* other);
- template<typename U> wp(const sp<U>& other);
- template<typename U> wp(const wp<U>& other);
+ explicit wp(const sp<T>& other);
+ template<typename U> explicit wp(U* other);
+ template<typename U> explicit wp(const sp<U>& other);
+ template<typename U> explicit wp(const wp<U>& other);
~wp();
diff --git a/cpp/util/StrongPointer.h b/cpp/util/StrongPointer.h
index 0f68615..a9995ba 100644
--- a/cpp/util/StrongPointer.h
+++ b/cpp/util/StrongPointer.h
@@ -65,10 +65,10 @@
public:
inline sp() : m_ptr(0) { }
- sp(T* other);
+ sp(T* other); // NOLINT, implicit
sp(const sp<T>& other);
- template<typename U> sp(U* other);
- template<typename U> sp(const sp<U>& other);
+ template<typename U> sp(U* other); // NOLINT, implicit
+ template<typename U> sp(const sp<U>& other); // NOLINT, implicit
~sp();
diff --git a/cpp/util/TypeHelpers.h b/cpp/util/TypeHelpers.h
index 33a5201..e738cd3 100644
--- a/cpp/util/TypeHelpers.h
+++ b/cpp/util/TypeHelpers.h
@@ -233,7 +233,7 @@
key_value_pair_t() { }
key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { }
key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { }
- key_value_pair_t(const KEY& k) : key(k) { }
+ explicit key_value_pair_t(const KEY& k) : key(k) { }
inline bool operator < (const key_value_pair_t& o) const {
return strictly_order_type(key, o.key);
}
diff --git a/cpu_ref/rsCpuBLASDispatch.h b/cpu_ref/rsCpuBLASDispatch.h
index 4602135..40da346 100644
--- a/cpu_ref/rsCpuBLASDispatch.h
+++ b/cpu_ref/rsCpuBLASDispatch.h
@@ -457,7 +457,7 @@
// Macros to help load the function pointers.
#define RS_APPLY_MACRO_TO(x) \
x = (FnPtr_##x)dlsym(handle, #x); \
- if (x == nullptr) { \
+ if ((x) == nullptr) { \
ALOGE("Failed to load " #x " for RS BLAS implementation."); \
return false; \
}
diff --git a/cpu_ref/rsCpuCore.h b/cpu_ref/rsCpuCore.h
index 1515b77..e33ea10 100644
--- a/cpu_ref/rsCpuCore.h
+++ b/cpu_ref/rsCpuCore.h
@@ -145,7 +145,7 @@
class RsdCpuReferenceImpl : public RsdCpuReference {
public:
~RsdCpuReferenceImpl() override;
- RsdCpuReferenceImpl(Context *);
+ explicit RsdCpuReferenceImpl(Context *);
void lockMutex();
void unlockMutex();
diff --git a/cpu_ref/rsCpuScript.cpp b/cpu_ref/rsCpuScript.cpp
index 582b342..d9f9412 100644
--- a/cpu_ref/rsCpuScript.cpp
+++ b/cpu_ref/rsCpuScript.cpp
@@ -382,7 +382,8 @@
compileArguments.push_back("-build-checksum");
std::stringstream ss;
ss << std::hex << mBuildChecksum;
- compileArguments.push_back(ss.str().c_str());
+ std::string checksumStr(ss.str());
+ compileArguments.push_back(checksumStr.c_str());
compileArguments.push_back(nullptr);
if (!is_force_recompile() && !useRSDebugContext) {
diff --git a/cpu_ref/rsCpuScriptGroup2.cpp b/cpu_ref/rsCpuScriptGroup2.cpp
index c784ce3..2382cd6 100644
--- a/cpu_ref/rsCpuScriptGroup2.cpp
+++ b/cpu_ref/rsCpuScriptGroup2.cpp
@@ -181,7 +181,8 @@
mBatches.push_back(batch);
std::stringstream ss;
ss << "Batch" << ++i;
- batch = new Batch(this, ss.str().c_str());
+ std::string batchStr(ss.str());
+ batch = new Batch(this, batchStr.c_str());
}
batch->mClosures.push_back(cc);
@@ -416,7 +417,7 @@
std::stringstream ss;
ss << std::hex << checksum;
- const char* checksumStr = ss.str().c_str();
+ std::string checksumStr(ss.str());
//===--------------------------------------------------------------------===//
// Try to load a shared lib from code cache matching filename and checksum
@@ -466,7 +467,7 @@
//===--------------------------------------------------------------------===//
arguments.push_back("-build-checksum");
- arguments.push_back(checksumStr);
+ arguments.push_back(checksumStr.c_str());
arguments.push_back(nullptr);
bool compiled = rsuExecuteCommand(RsdCpuScriptImpl::BCC_EXE_PATH,
diff --git a/driver/rsdShader.h b/driver/rsdShader.h
index caccc09..dc31c24 100644
--- a/driver/rsdShader.h
+++ b/driver/rsdShader.h
@@ -70,7 +70,7 @@
class StateBasedKey {
public:
- StateBasedKey(uint32_t texCount) : mShaderID(0) {
+ explicit StateBasedKey(uint32_t texCount) : mShaderID(0) {
mTextureTargets = new uint32_t[texCount];
}
~StateBasedKey() {
diff --git a/driver/rsdShaderCache.h b/driver/rsdShaderCache.h
index 29f91bb..884b1c8 100644
--- a/driver/rsdShaderCache.h
+++ b/driver/rsdShaderCache.h
@@ -78,7 +78,7 @@
int32_t writtenLength;
int32_t arraySize;
uint32_t type;
- UniformQueryData(uint32_t maxName) {
+ explicit UniformQueryData(uint32_t maxName) {
name = nullptr;
nameLength = maxName;
if (nameLength > 0 ) {
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce.rs b/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce.rs
index 6554937..24af2de 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce.rs
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce.rs
@@ -41,17 +41,17 @@
me.val = in;
me.idx = x;
- if (me.val < accum->min.val)
+ if (me.val <= accum->min.val)
accum->min = me;
- if (me.val > accum->max.val)
+ if (me.val >= accum->max.val)
accum->max = me;
}
static void fMMCombiner(MinAndMax *accum,
const MinAndMax *val) {
- if (val->min.val < accum->min.val)
+ if ((accum->min.idx < 0) || (val->min.val < accum->min.val))
accum->min = val->min;
- if (val->max.val > accum->max.val)
+ if ((accum->max.idx < 0) || (val->max.val > accum->max.val))
accum->max = val->max;
}
diff --git a/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce_backward.rs b/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce_backward.rs
index 0a4d1f9..cb292ee 100644
--- a/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce_backward.rs
+++ b/java/tests/RSTest_CompatLib/src/com/android/rs/test/reduce_backward.rs
@@ -36,17 +36,17 @@
me.val = in;
me.idx = x;
- if (me.val < accum->min.val)
+ if (me.val <= accum->min.val)
accum->min = me;
- if (me.val > accum->max.val)
+ if (me.val >= accum->max.val)
accum->max = me;
}
static void fMMCombiner(MinAndMax *accum,
const MinAndMax *val) {
- if (val->min.val < accum->min.val)
+ if ((accum->min.idx < 0) || (val->min.val < accum->min.val))
accum->min = val->min;
- if (val->max.val > accum->max.val)
+ if ((accum->max.idx < 0) || (val->max.val > accum->max.val))
accum->max = val->max;
}
diff --git a/java/tests/RsTest/src/com/android/rs/test/UT_reduce.java b/java/tests/RsTest/src/com/android/rs/test/UT_reduce.java
index ed9a7f1..88a6c3f 100644
--- a/java/tests/RsTest/src/com/android/rs/test/UT_reduce.java
+++ b/java/tests/RsTest/src/com/android/rs/test/UT_reduce.java
@@ -506,11 +506,11 @@
int maxIdx = -1;
for (int idx = 0; idx < input.length; ++idx) {
- if (input[idx] < minVal) {
+ if ((minIdx < 0) || (input[idx] < minVal)) {
minVal = input[idx];
minIdx = idx;
}
- if (input[idx] > maxVal) {
+ if ((maxIdx < 0) || (input[idx] > maxVal)) {
maxVal = input[idx];
maxIdx = idx;
}
@@ -568,6 +568,26 @@
return success;
}
+ //-----------------------------------------------------------------
+
+ private boolean patternFindMinAndMaxInf(RenderScript RS, ScriptC_reduce s) {
+ // Run this kernel on an input consisting solely of a single infinity.
+
+ final float[] input = new float[1];
+ input[0] = Float.POSITIVE_INFINITY;
+
+ final Int2 javaResult = findMinAndMax(input);
+ final Int2 rsResult = s.reduce_findMinAndMax(input).get();
+
+ // Note that the Java and RenderScript algorithms are not
+ // guaranteed to find the same cells -- but they should
+ // find cells of the same value.
+ final Float2 javaVal = new Float2(input[javaResult.x], input[javaResult.y]);
+ final Float2 rsVal = new Float2(input[rsResult.x], input[rsResult.y]);
+
+ return result("patternFindMinAndMaxInf", new timing(1), javaVal, rsVal);
+ }
+
///////////////////////////////////////////////////////////////////
// Both the input and the result are linearized representations of matSize*matSize matrices.
@@ -1421,6 +1441,7 @@
boolean pass = true;
pass &= patternDuplicateAnonymousResult(RS, s);
+ pass &= patternFindMinAndMaxInf(RS, s);
pass &= patternInterleavedReduce(RS, s);
pass &= patternRedundantGet(RS, s);
diff --git a/java/tests/RsTest/src/com/android/rs/test/reduce.rs b/java/tests/RsTest/src/com/android/rs/test/reduce.rs
index 704f5d8..c599707 100644
--- a/java/tests/RsTest/src/com/android/rs/test/reduce.rs
+++ b/java/tests/RsTest/src/com/android/rs/test/reduce.rs
@@ -120,17 +120,17 @@
me.val = in;
me.idx = x;
- if (me.val < accum->min.val)
+ if (me.val <= accum->min.val)
accum->min = me;
- if (me.val > accum->max.val)
+ if (me.val >= accum->max.val)
accum->max = me;
}
static void fMMCombiner(MinAndMax *accum,
const MinAndMax *val) {
- if (val->min.val < accum->min.val)
+ if ((accum->min.idx < 0) || (val->min.val < accum->min.val))
accum->min = val->min;
- if (val->max.val > accum->max.val)
+ if ((accum->max.idx < 0) || (val->max.val > accum->max.val))
accum->max = val->max;
}
diff --git a/java/tests/RsTest/src/com/android/rs/test/reduce_backward.rs b/java/tests/RsTest/src/com/android/rs/test/reduce_backward.rs
index a32c4d9..0e8be5e 100644
--- a/java/tests/RsTest/src/com/android/rs/test/reduce_backward.rs
+++ b/java/tests/RsTest/src/com/android/rs/test/reduce_backward.rs
@@ -38,17 +38,17 @@
me.val = in;
me.idx = x;
- if (me.val < accum->min.val)
+ if (me.val <= accum->min.val)
accum->min = me;
- if (me.val > accum->max.val)
+ if (me.val >= accum->max.val)
accum->max = me;
}
static void fMMCombiner(MinAndMax *accum,
const MinAndMax *val) {
- if (val->min.val < accum->min.val)
+ if ((accum->min.idx < 0) || (val->min.val < accum->min.val))
accum->min = val->min;
- if (val->max.val > accum->max.val)
+ if ((accum->max.idx < 0) || (val->max.val > accum->max.val))
accum->max = val->max;
}
diff --git a/rsAllocation.h b/rsAllocation.h
index 4d09679..0f60150 100644
--- a/rsAllocation.h
+++ b/rsAllocation.h
@@ -223,7 +223,7 @@
#if !defined(RS_SERVER) && !defined(RS_COMPATIBILITY_LIB)
class NewBufferListener : public android::ConsumerBase::FrameAvailableListener {
public:
- NewBufferListener(uint32_t numAlloc);
+ explicit NewBufferListener(uint32_t numAlloc);
virtual ~NewBufferListener();
const android::renderscript::Context *rsc;
const android::renderscript::Allocation **alloc;
diff --git a/rsAnimation.h b/rsAnimation.h
index de4957e..f77d3cb 100644
--- a/rsAnimation.h
+++ b/rsAnimation.h
@@ -41,7 +41,7 @@
static Animation *createFromStream(Context *rsc, IStream *stream);
protected:
- Animation(Context *rsc);
+ explicit Animation(Context *rsc);
diff --git a/rsContext.h b/rsContext.h
index 4a8cd29..fe771ec 100644
--- a/rsContext.h
+++ b/rsContext.h
@@ -102,7 +102,7 @@
class PushState {
public:
- PushState(Context *);
+ explicit PushState(Context *);
~PushState();
private:
diff --git a/rsCppUtils.h b/rsCppUtils.h
index 606046e..3da0d03 100644
--- a/rsCppUtils.h
+++ b/rsCppUtils.h
@@ -65,7 +65,7 @@
// server has no Vector or String8 classes; implement on top of STL
class String8: public std::string {
public:
- String8(const char *ptr) : std::string(ptr) {
+ explicit String8(const char *ptr) : std::string(ptr) {
}
String8(const char *ptr, size_t len) : std::string(ptr, len) {
diff --git a/rsElement.h b/rsElement.h
index 9374c64..d8f101b 100644
--- a/rsElement.h
+++ b/rsElement.h
@@ -152,7 +152,7 @@
virtual ~Element();
- Element(Context *);
+ explicit Element(Context *);
Component mComponent;
uint32_t mBitsUnpadded;
diff --git a/rsFileA3D.h b/rsFileA3D.h
index 8bf36b9..ae74455 100644
--- a/rsFileA3D.h
+++ b/rsFileA3D.h
@@ -32,7 +32,7 @@
class FileA3D : public ObjectBase {
public:
- FileA3D(Context *rsc);
+ explicit FileA3D(Context *rsc);
~FileA3D();
uint32_t mMajorVersion;
diff --git a/rsFont.h b/rsFont.h
index 0f17340..3be5c3c 100644
--- a/rsFont.h
+++ b/rsFont.h
@@ -116,7 +116,7 @@
float mFontSize;
uint32_t mDpi;
- Font(Context *rsc);
+ explicit Font(Context *rsc);
bool init(const char *name, float fontSize, uint32_t dpi, const void *data = nullptr, uint32_t dataLen = 0);
virtual void preDestroy() const;
diff --git a/rsList.h b/rsList.h
index 24720a2..052ec77 100644
--- a/rsList.h
+++ b/rsList.h
@@ -92,7 +92,7 @@
T* operator->() { return p; }
protected:
- iterator(const List* list_) : list(list_) {}
+ explicit iterator(const List* list_) : list(list_) {}
iterator(const List* list_, LinkedBuffer* buffer_, T* p_) :
p(p_), buffer(buffer_), list(list_) {}
diff --git a/rsMesh.h b/rsMesh.h
index c7ee088..6c60555 100644
--- a/rsMesh.h
+++ b/rsMesh.h
@@ -55,7 +55,7 @@
};
Hal mHal;
- Mesh(Context *);
+ explicit Mesh(Context *);
Mesh(Context *, uint32_t vertexBuffersCount, uint32_t primitivesCount);
~Mesh();
diff --git a/rsObjectBase.h b/rsObjectBase.h
index c51d85c..4f29e57 100644
--- a/rsObjectBase.h
+++ b/rsObjectBase.h
@@ -35,7 +35,7 @@
static const bool gDebugLeaks = false;
static const bool gDebugLifetime = false;
- ObjectBase(Context *rsc);
+ ObjectBase(Context *rsc); // NOLINT, implicit
void incSysRef() const;
bool decSysRef() const;
@@ -111,7 +111,7 @@
}
}
- ObjectBaseRef(T *ref) {
+ ObjectBaseRef(T *ref) { // NOLINT, implicit
mRef = ref;
if (mRef) {
ref->incSysRef();
diff --git a/rsProgramBase.h b/rsProgramBase.h
index 80da453..aeee5c1 100644
--- a/rsProgramBase.h
+++ b/rsProgramBase.h
@@ -26,7 +26,7 @@
class ProgramBase : public ObjectBase {
public:
- ProgramBase(Context *rsc) : ObjectBase(rsc) {
+ explicit ProgramBase(Context *rsc) : ObjectBase(rsc) {
mDirty = true;
}
diff --git a/rsSampler.h b/rsSampler.h
index 2fdf707..c63a4a8 100644
--- a/rsSampler.h
+++ b/rsSampler.h
@@ -74,7 +74,7 @@
virtual ~Sampler();
private:
- Sampler(Context *);
+ explicit Sampler(Context *);
Sampler(Context *,
RsSamplerValue magFilter,
RsSamplerValue minFilter,
diff --git a/rsScript.h b/rsScript.h
index e336f07..39620c1 100644
--- a/rsScript.h
+++ b/rsScript.h
@@ -98,7 +98,7 @@
};
Hal mHal;
- Script(Context *);
+ explicit Script(Context *);
virtual ~Script();
struct Enviroment_t {
diff --git a/rsScriptC.cpp b/rsScriptC.cpp
index fb808a6..b4d364f 100644
--- a/rsScriptC.cpp
+++ b/rsScriptC.cpp
@@ -197,7 +197,8 @@
if (ATRACE_ENABLED()) {
ss << "runForEach slot[" << slot << "]";
}
- ATRACE_NAME(ss.str().c_str());
+ std::string msgStr(ss.str());
+ ATRACE_NAME(msgStr.c_str());
if (mRSC->hadFatalError()) return;
diff --git a/rsScriptC.h b/rsScriptC.h
index 6c34215..3c342d4 100644
--- a/rsScriptC.h
+++ b/rsScriptC.h
@@ -31,7 +31,7 @@
typedef int (*RunScript_t)();
typedef void (*VoidFunc_t)();
- ScriptC(Context *);
+ explicit ScriptC(Context *);
virtual ~ScriptC();
void Invoke(Context *rsc, uint32_t slot, const void *data, size_t len) override;
diff --git a/rsScriptGroup.h b/rsScriptGroup.h
index 68783f3..835d8c0 100644
--- a/rsScriptGroup.h
+++ b/rsScriptGroup.h
@@ -56,7 +56,7 @@
class Node {
public:
- Node(Script *);
+ explicit Node(Script *);
Vector<const ScriptKernelID *> mKernels;
Vector<Link *> mOutputs;
@@ -68,7 +68,7 @@
class IO {
public:
- IO(const ScriptKernelID *);
+ explicit IO(const ScriptKernelID *);
const ScriptKernelID *mKernel;
ObjectBaseRef<Allocation> mAlloc;
@@ -103,7 +103,7 @@
// executes. Skips the exeuction if validation fails.
bool validateInputAndOutput(Context *);
- ScriptGroup(Context *);
+ explicit ScriptGroup(Context *);
};
diff --git a/rsScriptGroupBase.h b/rsScriptGroupBase.h
index 00ae6c6..f79f08f 100644
--- a/rsScriptGroupBase.h
+++ b/rsScriptGroupBase.h
@@ -8,7 +8,7 @@
class ScriptGroupBase : public ObjectBase {
public:
- ScriptGroupBase(Context* rsc) : ObjectBase(rsc) {}
+ explicit ScriptGroupBase(Context* rsc) : ObjectBase(rsc) {}
virtual ~ScriptGroupBase() {}
virtual void serialize(Context *rsc, OStream *stream) const {}
diff --git a/rsScriptIntrinsic.h b/rsScriptIntrinsic.h
index 9b4f9d3..cd8253d 100644
--- a/rsScriptIntrinsic.h
+++ b/rsScriptIntrinsic.h
@@ -30,7 +30,7 @@
ObjectBaseRef<const Element> mElement;
- ScriptIntrinsic(Context *);
+ explicit ScriptIntrinsic(Context *);
~ScriptIntrinsic() override;
bool init(Context *rsc, RsScriptIntrinsicID iid, Element *e);
diff --git a/rsType.h b/rsType.h
index 6ae8446..6e260fa 100644
--- a/rsType.h
+++ b/rsType.h
@@ -150,7 +150,7 @@
virtual ~Type();
private:
- Type(Context *);
+ explicit Type(Context *);
Type(const Type &);
};