Commit 7cccc93b authored by Andrey Kamaev's avatar Andrey Kamaev

Fixed Android build warnings and few warnings in specific cnfigurations

parent 9dac2230
...@@ -25,7 +25,7 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -25,7 +25,7 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1") set_source_files_properties(jcdctmgr.c PROPERTIES COMPILE_FLAGS "-O1")
endif() endif()
ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align) ocv_warnings_disable(CMAKE_C_FLAGS -Wcast-align -Wshadow)
set_target_properties(${JPEG_LIBRARY} set_target_properties(${JPEG_LIBRARY}
PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY} PROPERTIES OUTPUT_NAME ${JPEG_LIBRARY}
......
...@@ -119,11 +119,11 @@ endif() ...@@ -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}") 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) 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) ocv_warnings_disable(CMAKE_CXX_FLAGS -Wundef -Wmissing-declarations)
string(REPLACE "-Werror=non-virtual-dtor" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") 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 set_target_properties(tbb
PROPERTIES OUTPUT_NAME tbb PROPERTIES OUTPUT_NAME tbb
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}" DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
......
...@@ -48,39 +48,49 @@ set(OCV_COMPILER_FAIL_REGEX ...@@ -48,39 +48,49 @@ set(OCV_COMPILER_FAIL_REGEX
) )
MACRO(ocv_check_compiler_flag LANG FLAG RESULT) MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
if("_${LANG}_" MATCHES "_CXX_") if(NOT DEFINED ${RESULT})
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx") if("_${LANG}_" MATCHES "_CXX_")
FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n") set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
elseif("_${LANG}_" MATCHES "_C_") if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c") FILE(WRITE "${_fname}" "int main() { return 0; }\n")
FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n") else()
else() FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
unset(_fname) endif()
endif() elseif("_${LANG}_" MATCHES "_C_")
if(_fname) set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
MESSAGE(STATUS "Performing Test ${RESULT}") if("${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
TRY_COMPILE(${RESULT} FILE(WRITE "${_fname}" "int main(void) { return 0; }\n")
${CMAKE_BINARY_DIR} else()
"${_fname}" FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
COMPILE_DEFINITIONS "${FLAG}" endif()
OUTPUT_VARIABLE OUTPUT) else()
unset(_fname)
FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX}) endif()
IF("${OUTPUT}" MATCHES "${_regex}") if(_fname)
SET(${RESULT} 0) MESSAGE(STATUS "Performing Test ${RESULT}")
break() TRY_COMPILE(${RESULT}
ENDIF() ${CMAKE_BINARY_DIR}
ENDFOREACH() "${_fname}"
COMPILE_DEFINITIONS "${FLAG}"
IF(${RESULT}) OUTPUT_VARIABLE OUTPUT)
SET(${RESULT} 1 CACHE INTERNAL "Test ${RESULT}")
MESSAGE(STATUS "Performing Test ${RESULT} - Success") FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
ELSE(${RESULT}) IF("${OUTPUT}" MATCHES "${_regex}")
MESSAGE(STATUS "Performing Test ${RESULT} - Failed") SET(${RESULT} 0)
SET(${RESULT} "" CACHE INTERNAL "Test ${RESULT}") break()
ENDIF(${RESULT}) ENDIF()
else() ENDFOREACH()
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() endif()
ENDMACRO() ENDMACRO()
......
...@@ -666,7 +666,7 @@ CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots ); ...@@ -666,7 +666,7 @@ CVAPI(int) cvSolveCubic( const CvMat* coeffs, CvMat* roots );
/* Finds all real and complex roots of a polynomial equation */ /* Finds all real and complex roots of a polynomial equation */
CVAPI(void) cvSolvePoly(const CvMat* coeffs, CvMat *roots2, 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 * * Matrix operations *
...@@ -1127,9 +1127,9 @@ CVAPI(void) cvSetRemove( CvSet* set_header, int index ); ...@@ -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, /* Returns a set element by index. If the element doesn't belong to the set,
NULL is returned */ 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; return elem && CV_IS_SET_ELEM( elem ) ? elem : 0;
} }
...@@ -1283,8 +1283,8 @@ CVAPI(void) cvRectangleR( CvArr* img, CvRect r, ...@@ -1283,8 +1283,8 @@ CVAPI(void) cvRectangleR( CvArr* img, CvRect r,
CvScalar color, int thickness CV_DEFAULT(1), CvScalar color, int thickness CV_DEFAULT(1),
int line_type CV_DEFAULT(8), int line_type CV_DEFAULT(8),
int shift CV_DEFAULT(0)); int shift CV_DEFAULT(0));
/* Draws a circle with specified center and radius. /* Draws a circle with specified center and radius.
Thickness works in the same way as with cvRectangle */ Thickness works in the same way as with cvRectangle */
CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius, CVAPI(void) cvCircle( CvArr* img, CvPoint center, int radius,
...@@ -1374,17 +1374,17 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2, ...@@ -1374,17 +1374,17 @@ CVAPI(int) cvInitLineIterator( const CvArr* image, CvPoint pt1, CvPoint pt2,
/* Font structure */ /* Font structure */
typedef struct CvFont typedef struct CvFont
{ {
const char* nameFont; //Qt:nameFont const char* nameFont; //Qt:nameFont
CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component]) CvScalar color; //Qt:ColorFont -> cvScalar(blue_component, green_component, red\_component[, alpha_component])
int font_face; //Qt: bool italic /* =CV_FONT_* */ int font_face; //Qt: bool italic /* =CV_FONT_* */
const int* ascii; /* font data and metrics */ const int* ascii; /* font data and metrics */
const int* greek; const int* greek;
const int* cyrillic; const int* cyrillic;
float hscale, vscale; float hscale, vscale;
float shear; /* slope coefficient: 0 - normal, >0 - italic */ float shear; /* slope coefficient: 0 - normal, >0 - italic */
int thickness; //Qt: weight /* letters thickness */ int thickness; //Qt: weight /* letters thickness */
float dx; /* horizontal interval between letters */ float dx; /* horizontal interval between letters */
int line_type; //Qt: PointSize int line_type; //Qt: PointSize
} }
CvFont; CvFont;
...@@ -1696,7 +1696,7 @@ CVAPI(double) cvGetTickFrequency( void ); ...@@ -1696,7 +1696,7 @@ CVAPI(double) cvGetTickFrequency( void );
/*********************************** CPU capabilities ***********************************/ /*********************************** CPU capabilities ***********************************/
#define CV_CPU_NONE 0 #define CV_CPU_NONE 0
#define CV_CPU_MMX 1 #define CV_CPU_MMX 1
#define CV_CPU_SSE 2 #define CV_CPU_SSE 2
#define CV_CPU_SSE2 3 #define CV_CPU_SSE2 3
...@@ -1718,9 +1718,9 @@ CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) ); ...@@ -1718,9 +1718,9 @@ CVAPI(void) cvSetNumThreads( int threads CV_DEFAULT(0) );
/* get index of the thread being executed */ /* get index of the thread being executed */
CVAPI(int) cvGetThreadNum( void ); CVAPI(int) cvGetThreadNum( void );
/********************************** Error Handling **************************************/ /********************************** Error Handling **************************************/
/* Get current OpenCV error status */ /* Get current OpenCV error status */
CVAPI(int) cvGetErrStatus( void ); CVAPI(int) cvGetErrStatus( void );
...@@ -1774,37 +1774,37 @@ CVAPI(int) cvStdErrReport( int status, const char* func_name, const char* err_ms ...@@ -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 ); const char* file_name, int line, void* userdata );
CVAPI(int) cvGuiBoxReport( int status, const char* func_name, const char* err_msg, 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) \ #define OPENCV_ERROR(status,func,context) \
cvError((status),(func),(context),__FILE__,__LINE__) cvError((status),(func),(context),__FILE__,__LINE__)
#define OPENCV_ERRCHK(func,context) \ #define OPENCV_ERRCHK(func,context) \
{if (cvGetErrStatus() >= 0) \ {if (cvGetErrStatus() >= 0) \
{OPENCV_ERROR(CV_StsBackTrace,(func),(context));}} {OPENCV_ERROR(CV_StsBackTrace,(func),(context));}}
#define OPENCV_ASSERT(expr,func,context) \ #define OPENCV_ASSERT(expr,func,context) \
{if (! (expr)) \ {if (! (expr)) \
{OPENCV_ERROR(CV_StsInternal,(func),(context));}} {OPENCV_ERROR(CV_StsInternal,(func),(context));}}
#define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk)) #define OPENCV_RSTERR() (cvSetErrStatus(CV_StsOk))
#define OPENCV_CALL( Func ) \ #define OPENCV_CALL( Func ) \
{ \ { \
Func; \ Func; \
} }
/* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */ /* CV_FUNCNAME macro defines icvFuncName constant which is used by CV_ERROR macro */
#ifdef CV_NO_FUNC_NAMES #ifdef CV_NO_FUNC_NAMES
#define CV_FUNCNAME( Name ) #define CV_FUNCNAME( Name )
#define cvFuncName "" #define cvFuncName ""
#else #else
#define CV_FUNCNAME( Name ) \ #define CV_FUNCNAME( Name ) \
static char cvFuncName[] = Name static char cvFuncName[] = Name
#endif #endif
/* /*
CV_ERROR macro unconditionally raises error with passed code and message. CV_ERROR macro unconditionally raises error with passed code and message.
After raising error, control will be transferred to the exit label. After raising error, control will be transferred to the exit label.
...@@ -1814,11 +1814,11 @@ static char cvFuncName[] = Name ...@@ -1814,11 +1814,11 @@ static char cvFuncName[] = Name
cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \ cvError( (Code), cvFuncName, Msg, __FILE__, __LINE__ ); \
__CV_EXIT__; \ __CV_EXIT__; \
} }
/* Simplified form of CV_ERROR */ /* Simplified form of CV_ERROR */
#define CV_ERROR_FROM_CODE( code ) \ #define CV_ERROR_FROM_CODE( code ) \
CV_ERROR( code, "" ) CV_ERROR( code, "" )
/* /*
CV_CHECK macro checks error status after CV (or IPL) CV_CHECK macro checks error status after CV (or IPL)
function call. If error detected, control will be transferred to the exit function call. If error detected, control will be transferred to the exit
...@@ -1829,8 +1829,8 @@ static char cvFuncName[] = Name ...@@ -1829,8 +1829,8 @@ static char cvFuncName[] = Name
if( cvGetErrStatus() < 0 ) \ if( cvGetErrStatus() < 0 ) \
CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \ CV_ERROR( CV_StsBackTrace, "Inner function failed." ); \
} }
/* /*
CV_CALL macro calls CV (or IPL) function, checks error status and CV_CALL macro calls CV (or IPL) function, checks error status and
signals a error if the function failed. Useful in "parent node" signals a error if the function failed. Useful in "parent node"
...@@ -1841,19 +1841,19 @@ static char cvFuncName[] = Name ...@@ -1841,19 +1841,19 @@ static char cvFuncName[] = Name
Func; \ Func; \
CV_CHECK(); \ CV_CHECK(); \
} }
/* Runtime assertion macro */ /* Runtime assertion macro */
#define CV_ASSERT( Condition ) \ #define CV_ASSERT( Condition ) \
{ \ { \
if( !(Condition) ) \ if( !(Condition) ) \
CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \ CV_ERROR( CV_StsInternal, "Assertion: " #Condition " failed" ); \
} }
#define __CV_BEGIN__ { #define __CV_BEGIN__ {
#define __CV_END__ goto exit; exit: ; } #define __CV_END__ goto exit; exit: ; }
#define __CV_EXIT__ goto exit #define __CV_EXIT__ goto exit
#ifdef __cplusplus #ifdef __cplusplus
} }
......
...@@ -225,9 +225,9 @@ void Mat::create(int d, const int* _sizes, int _type) ...@@ -225,9 +225,9 @@ void Mat::create(int d, const int* _sizes, int _type)
}catch(...) }catch(...)
{ {
allocator = 0; allocator = 0;
size_t total = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount)); size_t totalSize = alignSize(step.p[0]*size.p[0], (int)sizeof(*refcount));
data = datastart = (uchar*)fastMalloc(total + (int)sizeof(*refcount)); data = datastart = (uchar*)fastMalloc(totalSize + (int)sizeof(*refcount));
refcount = (int*)(data + total); refcount = (int*)(data + totalSize);
*refcount = 1; *refcount = 1;
} }
#else #else
......
...@@ -126,8 +126,6 @@ static dc1394error_t adaptBufferStereoLocal(dc1394video_frame_t *in, dc1394video ...@@ -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, static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t *in,
dc1394video_frame_t *out, dc1394stereo_method_t method) dc1394video_frame_t *out, dc1394stereo_method_t method)
{ {
dc1394error_t err;
if((in->color_coding == DC1394_COLOR_CODING_RAW16) || if((in->color_coding == DC1394_COLOR_CODING_RAW16) ||
(in->color_coding == DC1394_COLOR_CODING_MONO16) || (in->color_coding == DC1394_COLOR_CODING_MONO16) ||
(in->color_coding == DC1394_COLOR_CODING_YUV422)) (in->color_coding == DC1394_COLOR_CODING_YUV422))
...@@ -136,14 +134,14 @@ static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t ...@@ -136,14 +134,14 @@ static dc1394error_t dc1394_deinterlace_stereo_frames_fixed(dc1394video_frame_t
{ {
case DC1394_STEREO_METHOD_INTERLACED: case DC1394_STEREO_METHOD_INTERLACED:
err = adaptBufferStereoLocal(in, out); adaptBufferStereoLocal(in, out);
//FIXED by AB: //FIXED by AB:
// dc1394_deinterlace_stereo(in->image, out->image, in->size[0], in->size[1]); // 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]); dc1394_deinterlace_stereo(in->image, out->image, out->size[0], out->size[1]);
break; break;
case DC1394_STEREO_METHOD_FIELD: case DC1394_STEREO_METHOD_FIELD:
err = adaptBufferStereoLocal(in, out); adaptBufferStereoLocal(in, out);
memcpy(out->image, in->image, out->image_bytes); memcpy(out->image, in->image, out->image_bytes);
break; break;
} }
......
...@@ -1396,7 +1396,7 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec ...@@ -1396,7 +1396,7 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec
const int threadsNum, int *kLevels, int **processingLevels) const int threadsNum, int *kLevels, int **processingLevels)
{ {
int rootFilterDim, sumPartFiltersDim, i, numLevels, dbx, dby, numDotProducts; 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; int *dotProd, *weights, *disp;
if (H == NULL || all_F == NULL) if (H == NULL || all_F == NULL)
{ {
...@@ -1430,8 +1430,6 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec ...@@ -1430,8 +1430,6 @@ static int createSchedule(const CvLSVMFeaturePyramid *H, const CvLSVMFilterObjec
(H->pyramid[i]->sizeY + dby) * sumPartFiltersDim; (H->pyramid[i]->sizeY + dby) * sumPartFiltersDim;
numDotProducts += dotProd[i]; 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 // Allocation memory for saving dot product number performed by each thread
weights = (int *)malloc(sizeof(int) * threadsNum); weights = (int *)malloc(sizeof(int) * threadsNum);
// Allocation memory for saving dispertion // Allocation memory for saving dispertion
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment