Fixed Android build warnings and few warnings in specific cnfigurations

This commit is contained in:
Andrey Kamaev 2012-06-13 13:19:43 +00:00
parent 9dac223039
commit 7cccc93bdf
7 changed files with 87 additions and 81 deletions

View File

@ -25,7 +25,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align)
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow)
set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}

View File

@ -119,11 +119,11 @@ endif()
add_library(tbb STATIC ${lib_srcs} ${lib_hdrs} "${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h" "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
target_link_libraries(tbb c m dl)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include \"${CMAKE_CURRENT_SOURCE_DIR}/android_additional.h\"")
set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"

View File

@ -48,39 +48,49 @@ set(OCV_COMPILER_FAIL_REGEX
)
MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
if("_${LANG}_" MATCHES "_CXX_")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
elseif("_${LANG}_" MATCHES "_C_")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
else()
unset(_fname)
endif()
if(_fname)
MESSAGE(STATUS "Performing Test ${RESULT}")
TRY_COMPILE(${RESULT}
${CMAKE_BINARY_DIR}
"${_fname}"
COMPILE_DEFINITIONS "${FLAG}"
OUTPUT_VARIABLE OUTPUT)
if(NOT DEFINED ${RESULT})
if("_${LANG}_" MATCHES "_CXX_")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
FILE(WRITE "${_fname}" "int main() { return 0; }\n")
else()
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
endif()
elseif("_${LANG}_" MATCHES "_C_")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
if("${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
FILE(WRITE "${_fname}" "int main(void) { return 0; }\n")
else()
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
endif()
else()
unset(_fname)
endif()
if(_fname)
MESSAGE(STATUS "Performing Test ${RESULT}")
TRY_COMPILE(${RESULT}
${CMAKE_BINARY_DIR}
"${_fname}"
COMPILE_DEFINITIONS "${FLAG}"
OUTPUT_VARIABLE OUTPUT)
FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
IF("${OUTPUT}" MATCHES "${_regex}")
SET(${RESULT} 0)
break()
ENDIF()
ENDFOREACH()
FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
IF("${OUTPUT}" MATCHES "${_regex}")
SET(${RESULT} 0)
break()
ENDIF()
ENDFOREACH()
IF(${RESULT})
SET(${RESULT} 1 CACHE INTERNAL "Test ${RESULT}")
MESSAGE(STATUS "Performing Test ${RESULT} - Success")
ELSE(${RESULT})
MESSAGE(STATUS "Performing Test ${RESULT} - Failed")
SET(${RESULT} "" CACHE INTERNAL "Test ${RESULT}")
ENDIF(${RESULT})
else()
SET(${RESULT} 0)
IF(${RESULT})
SET(${RESULT} 1 CACHE INTERNAL "Test ${RESULT}")
MESSAGE(STATUS "Performing Test ${RESULT} - Success")
ELSE(${RESULT})
MESSAGE(STATUS "Performing Test ${RESULT} - Failed")
SET(${RESULT} "" CACHE INTERNAL "Test ${RESULT}")
ENDIF(${RESULT})
else()
SET(${RESULT} 0)
endif()
endif()
ENDMACRO()

View File

@ -666,7 +666,7 @@ CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots );
/* Finds all real and complex roots of a polynomial equation */
CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2,
int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
int maxiter CV_DEFAULT(20), int fig CV_DEFAULT(100));
/****************************************************************************************\
* Matrix operations *
@ -1127,9 +1127,9 @@ CVAPI(void) cvSetRemove( CvSet* set_header, int index );
/* Returns a set element by index. If the element doesn't belong to the set,
NULL is returned */
CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int index )
CV_INLINE CvSetElem* cvGetSetElem( const CvSet* set_header, int idx )
{
CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, index );
CvSetElem* elem = (CvSetElem*)cvGetSeqElem( (CvSeq*)set_header, idx );
return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
}
@ -1283,8 +1283,8 @@ CVAPI(void) cvRectangleR( CvArr* img, CvRect r,
CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8),
int shift CV_DEFAULT(0));
/* Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle */
CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius,
@ -1374,17 +1374,17 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
/* Font structure */
typedef struct CvFont
{
const char* nameFont; //Qt:nameFont
CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
int font_face; //Qt: bool italic /* =CV_FONT_* */
const int* ascii; /* font data and metrics */
const char* nameFont; //Qt:nameFont
CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
int font_face; //Qt: bool italic /* =CV_FONT_* */
const int* ascii; /* font data and metrics */
const int* greek;
const int* cyrillic;
float hscale, vscale;
float shear; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; //Qt: weight /* letters thickness */
float dx; /* horizontal interval between letters */
int line_type; //Qt: PointSize
float shear; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; //Qt: weight /* letters thickness */
float dx; /* horizontal interval between letters */
int line_type; //Qt: PointSize
}
CvFont;
@ -1696,7 +1696,7 @@ CVAPI(double) cvGetTickFrequency( void );
/*********************************** CPU capabilities ***********************************/
#define CV_CPU_NONE 0
#define CV_CPU_NONE 0
#define CV_CPU_MMX 1
#define CV_CPU_SSE 2
#define CV_CPU_SSE2 3
@ -1718,9 +1718,9 @@ CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) );
/* get index of the thread being executed */
CVAPI(int) cvGetThreadNum( void );
/********************************** Error Handling **************************************/
/* Get current OpenCV error status */
CVAPI(int) cvGetErrStatus( void );
@ -1774,37 +1774,37 @@ CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_ms
const char* file_name, int line, void* userdata );
CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg,
const char* file_name, int line, void* userdata );
const char* file_name, int line, void* userdata );
#define OPENCV_ERROR(status,func,context) \
cvError((status),(func),(context),__FILE__,__LINE__)
#define OPENCV_ERRCHK(func,context) \
{if (cvGetErrStatus() >= 0) \
{OPENCV_ERROR(CV_StsBackTrace,(func),(context));}}
#define OPENCV_ASSERT(expr,func,context) \
{if (! (expr)) \
{OPENCV_ERROR(CV_StsInternal,(func),(context));}}
#define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk))
#define OPENCV_CALL( Func ) \
{ \
Func; \
}
}
/* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
#ifdef CV_NO_FUNC_NAMES
#define CV_FUNCNAME( Name )
#define cvFuncName ""
#else
#else
#define CV_FUNCNAME( Name ) \
static char cvFuncName[] = Name
#endif
/*
CV_ERROR macro unconditionally raises error with passed code and message.
After raising error, control will be transferred to the exit label.
@ -1814,11 +1814,11 @@ static char cvFuncName[] = Name
cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
__CV_EXIT__; \
}
/* Simplified form of CV_ERROR */
#define CV_ERROR_FROM_CODE( code ) \
CV_ERROR( code, "" )
/*
CV_CHECK macro checks error status after CV (or IPL)
function call. If error detected, control will be transferred to the exit
@ -1829,8 +1829,8 @@ static char cvFuncName[] = Name
if( cvGetErrStatus() < 0 ) \
CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \
}
/*
CV_CALL macro calls CV (or IPL) function, checks error status and
signals a error if the function failed. Useful in "parent node"
@ -1841,19 +1841,19 @@ static char cvFuncName[] = Name
Func; \
CV_CHECK(); \
}
/* Runtime assertion macro */
#define CV_ASSERT( Condition ) \
{ \
if( !(Condition) ) \
CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
}
#define __CV_BEGIN__ {
#define __CV_END__ goto exit; exit: ; }
#define __CV_EXIT__ goto exit
#define __CV_EXIT__ goto exit
#ifdef __cplusplus
}

View File

@ -225,9 +225,9 @@ void Mat::create(int d, const int* _sizes, int _type)
}catch(...)
{
allocator = 0;
size_t total = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(total + (int)sizeof(*refcount));
refcount = (int*)(data + total);
size_t totalSize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(totalSize + (int)sizeof(*refcount));
refcount = (int*)(data + totalSize);
*refcount = 1;
}
#else

View File

@ -126,8 +126,6 @@ static dc1394error_t adaptBufferStereoLocal(dc1394video_frame_t *in, dc1394video
static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t *in,
dc1394video_frame_t *out, dc1394stereo_method_t method)
{
dc1394error_t err;
if((in->color_coding == DC1394_COLOR_CODING_RAW16) ||
(in->color_coding == DC1394_COLOR_CODING_MONO16) ||
(in->color_coding == DC1394_COLOR_CODING_YUV422))
@ -136,14 +134,14 @@ static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t
{
case DC1394_STEREO_METHOD_INTERLACED:
err = adaptBufferStereoLocal(in, out);
adaptBufferStereoLocal(in, out);
//FIXED by AB:
// dc1394_deinterlace_stereo(in->image, out->image, in->size[0], in->size[1]);
dc1394_deinterlace_stereo(in->image, out->image, out->size[0], out->size[1]);
break;
case DC1394_STEREO_METHOD_FIELD:
err = adaptBufferStereoLocal(in, out);
adaptBufferStereoLocal(in, out);
memcpy(out->image, in->image, out->image_bytes);
break;
}

View File

@ -1396,7 +1396,7 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec
const int threadsNum, int *kLevels, int **processingLevels)
{
int rootFilterDim, sumPartFiltersDim, i, numLevels, dbx, dby, numDotProducts;
int averNumDotProd, j, minValue, argMin, lambda, maxValue, k;
int j, minValue, argMin, lambda, maxValue, k;
int *dotProd, *weights, *disp;
if (H == NULL || all_F == NULL)
{
@ -1430,8 +1430,6 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec
(H->pyramid[i]->sizeY + dby) * sumPartFiltersDim;
numDotProducts += dotProd[i];
}
// Average number of dot products that would be performed at the best
averNumDotProd = numDotProducts / threadsNum;
// Allocation memory for saving dot product number performed by each thread
weights = (int *)malloc(sizeof(int) * threadsNum);
// Allocation memory for saving dispertion