am 8f5f79d7: Merge "Replace assert() with ASSERT() & use -funwind-tables for debug builds"
* commit '8f5f79d7ea824752dcaa4e035e71291e7dd7ddaf': Replace assert() with ASSERT() & use -funwind-tables for debug buildsmain
commit
23c9e9df7b
|
@ -66,11 +66,15 @@ LOCAL_SRC_FILES := \
|
||||||
|
|
||||||
ifeq ($(FLAG_DO_PROFILE), true)
|
ifeq ($(FLAG_DO_PROFILE), true)
|
||||||
$(warning Making profiling version of native library)
|
$(warning Making profiling version of native library)
|
||||||
LOCAL_CFLAGS += -DFLAG_DO_PROFILE
|
LOCAL_CFLAGS += -DFLAG_DO_PROFILE -funwind-tables
|
||||||
else # FLAG_DO_PROFILE
|
else # FLAG_DO_PROFILE
|
||||||
ifeq ($(FLAG_DBG), true)
|
ifeq ($(FLAG_DBG), true)
|
||||||
$(warning Making debug version of native library)
|
$(warning Making debug version of native library)
|
||||||
LOCAL_CFLAGS += -DFLAG_DBG
|
LOCAL_CFLAGS += -DFLAG_DBG -funwind-tables
|
||||||
|
ifeq ($(FLAG_FULL_DBG), true)
|
||||||
|
$(warning Making full debug version of native library)
|
||||||
|
LOCAL_CFLAGS += -DFLAG_FULL_DBG
|
||||||
|
endif # FLAG_FULL_DBG
|
||||||
endif # FLAG_DBG
|
endif # FLAG_DBG
|
||||||
endif # FLAG_DO_PROFILE
|
endif # FLAG_DO_PROFILE
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
|
|
||||||
#define LOG_TAG "LatinIME: jni"
|
#define LOG_TAG "LatinIME: jni"
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
|
|
||||||
#include "com_android_inputmethod_keyboard_ProximityInfo.h"
|
#include "com_android_inputmethod_keyboard_ProximityInfo.h"
|
||||||
#include "com_android_inputmethod_latin_BinaryDictionary.h"
|
#include "com_android_inputmethod_latin_BinaryDictionary.h"
|
||||||
#include "com_android_inputmethod_latin_DicTraverseSession.h"
|
#include "com_android_inputmethod_latin_DicTraverseSession.h"
|
||||||
|
@ -35,7 +33,7 @@ jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||||
AKLOGE("ERROR: GetEnv failed");
|
AKLOGE("ERROR: GetEnv failed");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
assert(env);
|
ASSERT(env);
|
||||||
if (!env) {
|
if (!env) {
|
||||||
AKLOGE("ERROR: JNIEnv is invalid");
|
AKLOGE("ERROR: JNIEnv is invalid");
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -247,7 +247,7 @@ Correction::CorrectionType Correction::processCharAndCalcState(const int c, cons
|
||||||
if (mSkippedCount == 0 && mSkipPos < mOutputIndex) {
|
if (mSkippedCount == 0 && mSkipPos < mOutputIndex) {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
// TODO: Enable this assertion.
|
// TODO: Enable this assertion.
|
||||||
//assert(mSkipPos == mOutputIndex - 1);
|
//ASSERT(mSkipPos == mOutputIndex - 1);
|
||||||
}
|
}
|
||||||
mSkipPos = mOutputIndex;
|
mSkipPos = mOutputIndex;
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
#ifndef LATINIME_CORRECTION_H
|
#ifndef LATINIME_CORRECTION_H
|
||||||
#define LATINIME_CORRECTION_H
|
#define LATINIME_CORRECTION_H
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring> // for memset()
|
#include <cstring> // for memset()
|
||||||
|
|
||||||
#include "correction_state.h"
|
#include "correction_state.h"
|
||||||
|
@ -150,7 +149,7 @@ class Correction {
|
||||||
// Branch if multiplier == 2 for the optimization
|
// Branch if multiplier == 2 for the optimization
|
||||||
if (multiplier < 0) {
|
if (multiplier < 0) {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
AKLOGI("--- Invalid multiplier: %d", multiplier);
|
AKLOGI("--- Invalid multiplier: %d", multiplier);
|
||||||
} else if (multiplier == 0) {
|
} else if (multiplier == 0) {
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#define LOG_TAG "LatinIME: proximity_info.cpp"
|
#define LOG_TAG "LatinIME: proximity_info.cpp"
|
||||||
|
@ -75,7 +74,7 @@ ProximityInfo::ProximityInfo(JNIEnv *env, const jstring localeJStr, const int ma
|
||||||
const jsize localeCStrUtf8Length = env->GetStringUTFLength(localeJStr);
|
const jsize localeCStrUtf8Length = env->GetStringUTFLength(localeJStr);
|
||||||
if (localeCStrUtf8Length >= MAX_LOCALE_STRING_LENGTH) {
|
if (localeCStrUtf8Length >= MAX_LOCALE_STRING_LENGTH) {
|
||||||
AKLOGI("Locale string length too long: length=%d", localeCStrUtf8Length);
|
AKLOGI("Locale string length too long: length=%d", localeCStrUtf8Length);
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
memset(mLocaleStr, 0, sizeof(mLocaleStr));
|
memset(mLocaleStr, 0, sizeof(mLocaleStr));
|
||||||
env->GetStringUTFRegion(localeJStr, 0, env->GetStringLength(localeJStr), mLocaleStr);
|
env->GetStringUTFRegion(localeJStr, 0, env->GetStringLength(localeJStr), mLocaleStr);
|
||||||
|
@ -105,7 +104,7 @@ bool ProximityInfo::hasSpaceProximity(const int x, const int y) const {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
AKLOGI("HasSpaceProximity: Illegal coordinates (%d, %d)", x, y);
|
AKLOGI("HasSpaceProximity: Illegal coordinates (%d, %d)", x, y);
|
||||||
// TODO: Enable this assertion.
|
// TODO: Enable this assertion.
|
||||||
//assert(false);
|
//ASSERT(false);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -180,7 +179,7 @@ void ProximityInfo::calculateNearbyKeyCodes(
|
||||||
inputCodes[insertPos++] = c;
|
inputCodes[insertPos++] = c;
|
||||||
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +191,7 @@ void ProximityInfo::calculateNearbyKeyCodes(
|
||||||
inputCodes[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
|
inputCodes[insertPos++] = ADDITIONAL_PROXIMITY_CHAR_DELIMITER_CODE;
|
||||||
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -213,7 +212,7 @@ void ProximityInfo::calculateNearbyKeyCodes(
|
||||||
inputCodes[insertPos++] = ac;
|
inputCodes[insertPos++] = ac;
|
||||||
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
if (insertPos >= MAX_PROXIMITY_CHARS_SIZE) {
|
||||||
if (DEBUG_DICT) {
|
if (DEBUG_DICT) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <cassert>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
#define LOG_TAG "LatinIME: unigram_dictionary.cpp"
|
#define LOG_TAG "LatinIME: unigram_dictionary.cpp"
|
||||||
|
@ -100,9 +99,9 @@ void UnigramDictionary::getWordWithDigraphSuggestionsRec(ProximityInfo *proximit
|
||||||
const int codesRemain, const int currentDepth, int *codesDest, Correction *correction,
|
const int codesRemain, const int currentDepth, int *codesDest, Correction *correction,
|
||||||
WordsPriorityQueuePool *queuePool,
|
WordsPriorityQueuePool *queuePool,
|
||||||
const digraph_t *const digraphs, const unsigned int digraphsSize) const {
|
const digraph_t *const digraphs, const unsigned int digraphsSize) const {
|
||||||
assert(sizeof(codesDest[0]) == sizeof(codesSrc[0]));
|
ASSERT(sizeof(codesDest[0]) == sizeof(codesSrc[0]));
|
||||||
assert(sizeof(xCoordinatesBuffer[0]) == sizeof(xcoordinates[0]));
|
ASSERT(sizeof(xCoordinatesBuffer[0]) == sizeof(xcoordinates[0]));
|
||||||
assert(sizeof(yCoordinatesBuffer[0]) == sizeof(ycoordinates[0]));
|
ASSERT(sizeof(yCoordinatesBuffer[0]) == sizeof(ycoordinates[0]));
|
||||||
|
|
||||||
const int startIndex = static_cast<int>(codesDest - codesBuffer);
|
const int startIndex = static_cast<int>(codesDest - codesBuffer);
|
||||||
if (currentDepth < MAX_DIGRAPH_SEARCH_DEPTH) {
|
if (currentDepth < MAX_DIGRAPH_SEARCH_DEPTH) {
|
||||||
|
@ -894,7 +893,7 @@ bool UnigramDictionary::processCurrentNode(const int initialPos,
|
||||||
// else if MASK_GROUP_ADDRESS_TYPE is not NONE: the children address
|
// else if MASK_GROUP_ADDRESS_TYPE is not NONE: the children address
|
||||||
// Note that you can't have a node that both is not a terminal and has no children.
|
// Note that you can't have a node that both is not a terminal and has no children.
|
||||||
int c = BinaryFormat::getCodePointAndForwardPointer(DICT_ROOT, &pos);
|
int c = BinaryFormat::getCodePointAndForwardPointer(DICT_ROOT, &pos);
|
||||||
assert(NOT_A_CODE_POINT != c);
|
ASSERT(NOT_A_CODE_POINT != c);
|
||||||
|
|
||||||
// We are going to loop through each character and make it look like it's a different
|
// We are going to loop through each character and make it look like it's a different
|
||||||
// node each time. To do that, we will process characters in this node in order until
|
// node each time. To do that, we will process characters in this node in order until
|
||||||
|
@ -987,7 +986,7 @@ bool UnigramDictionary::processCurrentNode(const int initialPos,
|
||||||
|
|
||||||
// Now we finished processing this node, and we want to traverse children. If there are no
|
// Now we finished processing this node, and we want to traverse children. If there are no
|
||||||
// children, we can't come here.
|
// children, we can't come here.
|
||||||
assert(BinaryFormat::hasChildrenInFlags(flags));
|
ASSERT(BinaryFormat::hasChildrenInFlags(flags));
|
||||||
|
|
||||||
// If this node was a terminal it still has the frequency under the pointer (it may have been
|
// If this node was a terminal it still has the frequency under the pointer (it may have been
|
||||||
// read, but not skipped - see readFrequencyWithoutMovingPointer).
|
// read, but not skipped - see readFrequencyWithoutMovingPointer).
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
#ifndef LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
|
#ifndef LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
|
||||||
#define LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
|
#define LATINIME_WORDS_PRIORITY_QUEUE_POOL_H
|
||||||
|
|
||||||
#include <cassert>
|
#include "defines.h"
|
||||||
#include "words_priority_queue.h"
|
#include "words_priority_queue.h"
|
||||||
|
|
||||||
namespace latinime {
|
namespace latinime {
|
||||||
|
@ -55,7 +55,7 @@ class WordsPriorityQueuePool {
|
||||||
}
|
}
|
||||||
if (inputWordLength < 0 || inputWordLength >= SUB_QUEUE_MAX_COUNT) {
|
if (inputWordLength < 0 || inputWordLength >= SUB_QUEUE_MAX_COUNT) {
|
||||||
if (DEBUG_WORDS_PRIORITY_QUEUE) {
|
if (DEBUG_WORDS_PRIORITY_QUEUE) {
|
||||||
assert(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue