Add "/WX" to the Visual C++ compiler flags if DISABLE_WERROR is off,
similar to config.nmake.
We haven't compiled C++ code with -Wshorten-64-to-32 for quite
some time so there's no need to add -Wno-shorten-64-to-32 in
ui/qt/CMakeLists.txt.
Additionally, squelch
----
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3050) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3065) : see reference to function template instantiation 'void std::_Median<_RanIt,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_RanIt,_Pr)' being compiled
with
[
_RanIt=QList<QString>::iterator
, _Pr=bool (__cdecl *)(const QString &,const QString &)
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3127) : see reference to function template instantiation 'std::pair<_RanIt,_RanIt> std::_Unguarded_partition<_RanIt,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_Pr)' being compiled
with
[
_RanIt=QList<QString>::iterator
, _Pr=bool (__cdecl *)(const QString &,const QString &)
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3157) : see reference to function template instantiation 'void std::_Sort<_Iter,int,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_Diff,_Pr)' being compiled
with
[
_Iter=QList<QString>::iterator
, _RanIt=QList<QString>::iterator
, _Diff=int
, _Pr=bool (__cdecl *)(const QString &,const QString &)
]
.\rpc_service_response_time_dialog.cpp(130) : see reference to function template instantiation 'void std::sort<QList<QString>::iterator,bool(__cdecl *)(const QString &,const QString &)>(_RanIt,_RanIt,_Pr)' being compiled
with
[
_RanIt=QList<QString>::iterator
, _Pr=bool (__cdecl *)(const QString &,const QString &)
]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3051) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3052) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\algorithm(3053) : warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data (.\rpc_service_response_time_dialog.cpp)
----
in both rpc_service_response_time_dialog.cpp and wireshark_application.cpp
so that we'll compile successfully.
Change-Id: I457bcede99dcb1f3c1001f1f559c4901bb000357
Reviewed-on: https://code.wireshark.org/review/10533
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org>
Reviewed-by: Gerald Combs <gerald@wireshark.org>
28 files changed:
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
include(CheckCCompilerFlag)
include(CheckCXXCompilerFlag)
-if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
- check_c_compiler_flag(-Werror WERROR)
-else()
- set(WERROR FALSE)
-endif()
-
# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
foreach(THIS_FLAG ${C_FLAG_TESTS})
string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
# Sigh: Have to use THIS_FLAG instead of ${F} for some reason
foreach(THIS_FLAG ${C_FLAG_TESTS})
string( REGEX REPLACE "[^a-zA-Z0-9_]+" "_" F ${THIS_FLAG} )
endforeach()
set(CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
endforeach()
set(CMAKE_CXX_FLAGS "${ADDED_CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS}")
+if(NOT DISABLE_WERROR AND NOT ENABLE_EXTRA_COMPILER_WARNINGS)
+ if(CMAKE_C_COMPILER_ID MATCHES "MSVC")
+ set(WERROR_COMMON_FLAGS "/WX")
+ set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS)
+ else()
+ check_c_compiler_flag(-Werror WERROR)
+ if (WERROR)
+ set(WERROR_COMMON_FLAGS "-Werror")
+ set(NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS "-Wno-error=deprecated-declarations")
+ endif()
+ endif()
+else()
+ set(WERROR_COMMON_FLAGS FALSE)
+endif()
+
#
# Try to have the compiler default to hiding symbols, so that only
# symbols explicitly exported with WS_DLL_PUBLIC will be visible
#
# Try to have the compiler default to hiding symbols, so that only
# symbols explicitly exported with WS_DLL_PUBLIC will be visible
message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
message(STATUS "C-Flags: ${CMAKE_C_FLAGS}")
message(STATUS "CXX-Flags: ${CMAKE_CXX_FLAGS}")
+message(STATUS "Warnings as errors: ${WERROR_COMMON_FLAGS}")
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
ARCHIVE DESTINATION lib
)
endif()
ARCHIVE DESTINATION lib
)
endif()
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
${DISSECTOR_SUPPORT_CLEAN_SRC}
)
${DISSECTOR_SUPPORT_CLEAN_SRC}
)
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
- COMPILE_FLAGS "-Werror -Wno-error=deprecated-declarations"
+ COMPILE_FLAGS "${WERROR_COMMON_FLAGS} ${NO_ERROR_DEPRECATED_DECLARATIONS_COMPILE_FLAGS}"
# set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
endif()
# set_target_properties(${some-source-files} PROPERTIES AUTOMOC TRUE)
endif()
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${WIRESHARK_QT_FILES}
PROPERTIES
set_source_files_properties(
${WIRESHARK_QT_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
- # The Qt headers generate a ton of shortening errors on 64-bit systems.
- if (CMAKE_SIZEOF_VOID_P EQUAL 8)
- set_source_files_properties(
- ${WIRESHARK_QT_FILES}
- PROPERTIES
- COMPILE_FLAGS -Wno-shorten-64-to-32
- )
- endif()
endif()
add_definitions(${QT_DEFINITIONS})
endif()
add_definitions(${QT_DEFINITIONS})
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4267)
+#endif
+
#include "rpc_service_response_time_dialog.h"
#include <algorithm>
#include "rpc_service_response_time_dialog.h"
#include <algorithm>
#include <QHBoxLayout>
#include <QLabel>
#include <QHBoxLayout>
#include <QLabel>
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
// To do:
// - Don't assume that the user knows what programs+versions are in the
// capture. I.e. combine this dialog with the ONC-RPC Programs dialog,
// To do:
// - Don't assume that the user knows what programs+versions are in the
// capture. I.e. combine this dialog with the ONC-RPC Programs dialog,
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
+// warning C4267: 'argument' : conversion from 'size_t' to 'int', possible loss of data
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4267)
+#endif
+
#include "wireshark_application.h"
#include <algorithm>
#include "wireshark_application.h"
#include <algorithm>
#include <QLibrary>
#endif
#include <QLibrary>
#endif
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
WiresharkApplication *wsApp = NULL;
// XXX - Copied from ui/gtk/file_dlg.c
WiresharkApplication *wsApp = NULL;
// XXX - Copied from ui/gtk/file_dlg.c
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${WIRETAP_FILES}
PROPERTIES
set_source_files_properties(
${WIRETAP_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}
+if (WERROR_COMMON_FLAGS)
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
set_source_files_properties(
${CLEAN_FILES}
PROPERTIES
+ COMPILE_FLAGS ${WERROR_COMMON_FLAGS}