AliceVision icon indicating copy to clipboard operation
AliceVision copied to clipboard

Resolve MSVC compiler warnings

Open EwoutH opened this issue 4 years ago • 4 comments

Currently when building with Visual Studio 2019 over 4000 warnings are generated, as can been seen in this AppVeyor run. A little under half is from dependencies, all others are from the AliceVision itself. Here are the logs:

Here are the warnings deduplicated, sorted and categorized:

  • [ ] Other
warning C4018: '<': signed/unsigned mismatch
warning C4018: '>': signed/unsigned mismatch
warning C4065: switch statement contains 'default' but no 'case' labels
warning C4068: unknown pragma
warning C4081: expected 'identifier'; found '#pragma omp atomic'
warning C4101: 'e': unreferenced local variable
warning C4102: 'yyerrorlab': unreferenced label
warning C4146: unary minus operator applied to unsigned type, result still unsigned
warning C4251: 'ceres::GradientProblem::function_': class 'ceres::internal::scoped_ptr<ceres::FirstOrderFunction>' needs to have dll-interface to be used by clients of class 'ceres::GradientProblem'
warning C4251: 'ceres::GradientProblem::parameterization_': class 'ceres::internal::scoped_ptr<ceres::LocalParameterization>' needs to have dll-interface to be used by clients of class 'ceres::GradientProblem'
warning C4251: 'ceres::GradientProblem::scratch_': class 'ceres::internal::scoped_array<double>' needs to have dll-interface to be used by clients of class 'ceres::GradientProblem'
warning C4311: '<function-style-cast>': pointer truncation from 'const Alembic::AbcCoreAbstract::v11::PropertyHeader *' to 'long'
warning C4334: '<<': result of 32-bit shift implicitly converted to 64 bits
  • [ ] Warning C4099: Type names
warning C4099: 'aliceVision::matching::MatchesPerDescType': type name first seen using 'struct' now seen using 'class'
warning C4099: 'aliceVision::rgb': type name first seen using 'class' now seen using 'struct'
warning C4099: 'aliceVision::rgb': type name first seen using 'struct' now seen using 'class'
warning C4099: 'Eigen::EigenBase': type name first seen using 'class' now seen using 'struct'
warning C4099: 'Eigen::EigenBase': type name first seen using 'struct' now seen using 'class'
  • [ ] Warning C4244: Possible loss of data
warning C4244: '*=': conversion from 'double' to 'float', possible loss of data
warning C4244: '+=': conversion from 'double' to 'float', possible loss of data
warning C4244: '+=': conversion from 'double' to 'size_t', possible loss of data
warning C4244: '=': conversion from '__int64' to 'int', possible loss of data
warning C4244: '=': conversion from 'Arg' to 'T', possible loss of data
warning C4244: '=': conversion from 'const _Ty1' to 'double', possible loss of data
warning C4244: '=': conversion from 'const _Ty2' to 'double', possible loss of data
warning C4244: '=': conversion from 'const double' to 'float', possible loss of data
warning C4244: '=': conversion from 'const V' to 'float', possible loss of data
warning C4244: '=': conversion from 'double' to '_Ty', possible loss of data
warning C4244: '=': conversion from 'double' to 'float', possible loss of data
warning C4244: '=': conversion from 'double' to 'int', possible loss of data
warning C4244: '=': conversion from 'double' to 'size_t', possible loss of data
warning C4244: '=': conversion from 'double' to 'T', possible loss of data
warning C4244: '=': conversion from 'double' to 'vl_sift_pix', possible loss of data
warning C4244: '=': conversion from 'double' to 'vl_size', possible loss of data
warning C4244: '=': conversion from 'Eigen::EigenBase<Derived>::Index' to 'int', possible loss of data
warning C4244: '=': conversion from 'float' to 'int', possible loss of data
warning C4244: '=': conversion from 'float' to 'unsigned char', possible loss of data
warning C4244: '=': conversion from 'int' to '_Ty', possible loss of data
warning C4244: '=': conversion from 'int' to 'float', possible loss of data
warning C4244: '=': conversion from 'Right' to 'Left', possible loss of data
warning C4244: '=': conversion from 'size_t' to 'double', possible loss of data
warning C4244: '=': conversion from 'unsigned __int64' to '_Ty2', possible loss of data
warning C4244: '=': conversion from 'vl_size' to 'vl_uint32', possible loss of data
warning C4244: 'argument': conversion from '_Ty' to 'const int', possible loss of data
warning C4244: 'argument': conversion from '_Ty' to 'int', possible loss of data
warning C4244: 'argument': conversion from '_Ty' to 'T', possible loss of data
warning C4244: 'argument': conversion from '_Ty' to 'unsigned int', possible loss of data
warning C4244: 'argument': conversion from 'const _Ty' to 'double', possible loss of data
warning C4244: 'argument': conversion from 'const A0' to 'Left', possible loss of data
warning C4244: 'argument': conversion from 'const A1' to 'Right', possible loss of data
warning C4244: 'argument': conversion from 'const double' to 'const float', possible loss of data
warning C4244: 'argument': conversion from 'const double' to 'float', possible loss of data
warning C4244: 'argument': conversion from 'const double' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'const float' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'const int' to 'float', possible loss of data
warning C4244: 'argument': conversion from 'const size_t' to 'const _Ty', possible loss of data
warning C4244: 'argument': conversion from 'const size_t' to 'const double', possible loss of data
warning C4244: 'argument': conversion from 'double' to '_Ty', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'const _Ty', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'const int', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'const size_t', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'const T', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'const unsigned __int64', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'float', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'double' to 'size_t', possible loss of data
warning C4244: 'argument': conversion from 'Eigen::EigenBase<Derived>::Index' to '_Ty', possible loss of data
warning C4244: 'argument': conversion from 'Eigen::EigenBase<Derived>::Index' to 'aliceVision::IndexT', possible loss of data
warning C4244: 'argument': conversion from 'Eigen::EigenBase<Derived>::Index' to 'const StorageIndex', possible loss of data
warning C4244: 'argument': conversion from 'Eigen::EigenBase<Derived>::Index' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'float' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'float' to 'unsigned char', possible loss of data
warning C4244: 'argument': conversion from 'float' to 'unsigned int', possible loss of data
warning C4244: 'argument': conversion from 'int64_t' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'ptrdiff_t' to 'int', possible loss of data
warning C4244: 'argument': conversion from 'size_t' to 'const double', possible loss of data
warning C4244: 'argument': conversion from 'time_t' to 'unsigned int', possible loss of data
warning C4244: 'argument': conversion from 'Type' to 'const size_t', possible loss of data
warning C4244: 'argument': conversion from 'unsigned __int64' to '_Ty', possible loss of data
warning C4244: 'argument': conversion from 'unsigned int' to '_Ty', possible loss of data
warning C4244: 'function': conversion from 'double' to 'float', possible loss of data
warning C4244: 'function': conversion from 'int' to 'float', possible loss of data
warning C4244: 'initializing': conversion from '__int64' to 'int', possible loss of data
warning C4244: 'initializing': conversion from '__int64' to 'long', possible loss of data
warning C4244: 'initializing': conversion from '_Ty' to '_Ty1', possible loss of data
warning C4244: 'initializing': conversion from '_Ty' to '_Ty2', possible loss of data
warning C4244: 'initializing': conversion from '_Ty' to 'const float', possible loss of data
warning C4244: 'initializing': conversion from '_Ty' to 'const int', possible loss of data
warning C4244: 'initializing': conversion from '_Ty' to 'float', possible loss of data
warning C4244: 'initializing': conversion from '_Ty' to 'int', possible loss of data
warning C4244: 'initializing': conversion from 'const _Ty1' to '_Ty1', possible loss of data
warning C4244: 'initializing': conversion from 'const _Ty' to '_Ty2', possible loss of data
warning C4244: 'initializing': conversion from 'const _Ty' to 'const double', possible loss of data
warning C4244: 'initializing': conversion from 'const _Ty' to 'double', possible loss of data
warning C4244: 'initializing': conversion from 'const double' to '_Objty', possible loss of data
warning C4244: 'initializing': conversion from 'const double' to 'const size_t', possible loss of data
warning C4244: 'initializing': conversion from 'const double' to 'const vl_sift_pix', possible loss of data
warning C4244: 'initializing': conversion from 'const double' to 'float', possible loss of data
warning C4244: 'initializing': conversion from 'const double' to 'size_t', possible loss of data
warning C4244: 'initializing': conversion from 'const double' to 'vl_sift_pix', possible loss of data
warning C4244: 'initializing': conversion from 'const int' to '_Ty2', possible loss of data
warning C4244: 'initializing': conversion from 'double' to '_Objty', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'const float', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'const int', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'const size_t', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'const unsigned int', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'const vl_sift_pix', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'float', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'int', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'size_t', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'unsigned int', possible loss of data
warning C4244: 'initializing': conversion from 'double' to 'vl_sift_pix', possible loss of data
warning C4244: 'initializing': conversion from 'Eigen::EigenBase<Derived>::Index' to 'const int', possible loss of data
warning C4244: 'initializing': conversion from 'Eigen::EigenBase<Derived>::Index' to 'const unsigned int', possible loss of data
warning C4244: 'initializing': conversion from 'Eigen::EigenBase<Derived>::Index' to 'int', possible loss of data
warning C4244: 'initializing': conversion from 'Eigen::EigenBase<Derived>::Index' to 'unsigned int', possible loss of data
warning C4244: 'initializing': conversion from 'float' to 'const int', possible loss of data
warning C4244: 'initializing': conversion from 'float' to 'int', possible loss of data
warning C4244: 'initializing': conversion from 'float' to 'unsigned char', possible loss of data
warning C4244: 'initializing': conversion from 'int' to 'float', possible loss of data
warning C4244: 'initializing': conversion from 'std::streamoff' to 'int', possible loss of data
warning C4244: 'initializing': conversion from 'T2' to 'T', possible loss of data
warning C4244: 'initializing': conversion from 'T' to 'size_t', possible loss of data
warning C4244: 'initializing': conversion from 'unsigned __int64' to 'double', possible loss of data
warning C4244: 'initializing': conversion from 'unsigned int' to 'const float', possible loss of data
warning C4244: 'initializing': conversion from 'unsigned int' to 'float', possible loss of data
warning C4244: 'initializing': conversion from 'vl_uindex' to 'double', possible loss of data
warning C4244: 'initializing': conversion from 'vl_uindex' to 'float', possible loss of data
warning C4244: 'return': conversion from '__int64' to 'int', possible loss of data
warning C4244: 'return': conversion from '_Rep' to 'double', possible loss of data
warning C4244: 'return': conversion from 'double' to 'float', possible loss of data
warning C4244: 'return': conversion from 'double' to 'T', possible loss of data
warning C4244: 'return': conversion from 'float' to 'int', possible loss of data
warning C4244: 'return': conversion from 'int' to 'float', possible loss of data
warning C4244: 'return': conversion from 'unsigned __int64' to 'unsigned int', possible loss of data
  • [ ] Warning C4267 possible loss of data
warning C4267: '+=': conversion from 'size_t' to 'aliceVision::IndexT', possible loss of data
warning C4267: '+=': conversion from 'size_t' to 'int', possible loss of data
warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data
warning C4267: '=': conversion from 'size_t' to '_Ty1', possible loss of data
warning C4267: '=': conversion from 'size_t' to '_Ty2', possible loss of data
warning C4267: '=': conversion from 'size_t' to '_Ty', possible loss of data
warning C4267: '=': conversion from 'size_t' to 'aliceVision::IndexT', possible loss of data
warning C4267: '=': conversion from 'size_t' to 'GEO::index_t', possible loss of data
warning C4267: '=': conversion from 'size_t' to 'int', possible loss of data
warning C4267: '=': conversion from 'size_t' to 'T2', possible loss of data
warning C4267: '=': conversion from 'size_t' to 'T', possible loss of data
warning C4267: '=': conversion from 'size_t' to 'unsigned int', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to '_Ty', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'aliceVision::IndexT', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const _Ty', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const int', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const StorageIndex', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const To', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const uint8_t', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const unsigned int', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'const unsigned short', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'Descriptor', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'EdgeIndex', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'flann::lsh::BucketKey', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'GEO::index_t', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'int', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'IntT', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'stl::dynamic_bitset::BlockType', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'uint32_t', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'unsigned char', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'unsigned int', possible loss of data
warning C4267: 'argument': conversion from 'size_t' to 'unsigned long', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to '_Objty', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to '_Ty1', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to '_Ty2', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to '_Ty', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'aliceVision::IndexT', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'const aliceVision::IndexT', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'const int', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'const unsigned int', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'flann::lsh::BucketKey', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'SDFilter::Timer::EventID', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'uint32_t', possible loss of data
warning C4267: 'initializing': conversion from 'size_t' to 'unsigned int', possible loss of data
warning C4267: 'return': conversion from 'size_t' to 'EdgeIndex', possible loss of data
warning C4267: 'return': conversion from 'size_t' to 'int', possible loss of data
warning C4267: 'return': conversion from 'size_t' to 'Vertex', possible loss of data
  • [ ] Warning C4275 dll-interface class
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::ArgExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::ErrnoExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::InputExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::IoExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::LogicExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::MathExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::NoImplExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::NullExc'
warning C4275: non dll-interface class 'Iex_2_2::BaseExc' used as base for dll-interface class 'Iex_2_2::TypeExc'
warning C4302: '<function-style-cast>': truncation from 'const Alembic::AbcCoreAbstract::v11::PropertyHeader *' to 'long'
  • [ ] Warning C4305: Truncation
warning C4305: '=': truncation from 'double' to 'float'
warning C4305: '=': truncation from 'double' to 'vl_sift_pix'
warning C4305: 'argument': truncation from 'const double' to 'float'
warning C4305: 'argument': truncation from 'double' to 'float'
warning C4305: 'initializing': truncation from 'double' to 'const float'
warning C4305: 'initializing': truncation from 'double' to 'float'
  • [ ] Warning C4477: fprintf/fscanf argument types
warning C4477: 'fprintf' : format string '%i' requires an argument of type 'int', but variadic argument 1 has type 'const size_t'
warning C4477: 'fscanf' : format string '%f' requires an argument of type 'float *', but variadic argument 1 has type 'double *'
warning C4477: 'fscanf' : format string '%f' requires an argument of type 'float *', but variadic argument 2 has type 'double *'
warning C4477: 'fscanf' : format string '%f' requires an argument of type 'float *', but variadic argument 3 has type 'double *'
warning C4477: 'printf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'size_t'
warning C4477: 'printf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 1 has type 'unsigned __int64'
warning C4477: 'printf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 2 has type 'size_t'
warning C4477: 'printf' : format string '%lu' requires an argument of type 'unsigned long', but variadic argument 3 has type 'unsigned __int64'
  • [ ] Warning C4996: Deprecated/unsafe
warning C4996: '_mktemp': This function or variable may be unsafe. Consider using _mktemp_s instead.
warning C4996: 'cudaMemcpyFromArray': was declared deprecated
warning C4996: 'cudaMemcpyToArray': was declared deprecated
warning C4996: 'cudaThreadSynchronize': was declared deprecated
warning C4996: 'fopen': This function or variable may be unsafe. Consider using fopen_s instead.
warning C4996: 'fscanf': This function or variable may be unsafe. Consider using fscanf_s instead.
warning C4996: 'getenv': This function or variable may be unsafe. Consider using _dupenv_s instead.
warning C4996: 'sprintf': This function or variable may be unsafe. Consider using sprintf_s instead.
warning C4996: 'sscanf': This function or variable may be unsafe. Consider using sscanf_s instead.
warning C4996: 'strcat': This function or variable may be unsafe. Consider using strcat_s instead.
warning C4996: 'strcpy': This function or variable may be unsafe. Consider using strcpy_s instead.
warning C4996: 'vsprintf': This function or variable may be unsafe. Consider using vsprintf_s instead.

EwoutH avatar May 14 '20 11:05 EwoutH

we can try to fix those pertaining AV but obviously not the one from the dependencies

simogasp avatar May 14 '20 11:05 simogasp

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 21 '22 00:05 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 17 '23 00:05 github-actions[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar May 12 '24 00:05 github-actions[bot]