[Lemon-commits] Alpar Juttner: Suppress MSVC warning C4267 (#519)

Lemon HG hg at lemon.cs.elte.hu
Thu Apr 2 13:38:34 CEST 2015


details:   http://lemon.cs.elte.hu/hg/lemon/rev/18c89646185e
changeset: 1327:18c89646185e
user:      Alpar Juttner <alpar [at] cs.elte.hu>
date:      Thu Apr 02 12:57:18 2015 +0200
description:
	Suppress MSVC warning C4267 (#519)

	C4267: conversion from 'size_t' to 'type', possible loss of data

diffstat:

 CMakeLists.txt     |  7 +++++--
 lemon/arg_parser.h |  1 +
 lemon/core.h       |  3 ++-
 lemon/counter.h    |  2 ++
 4 files changed, 10 insertions(+), 3 deletions(-)

diffs (60 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -150,10 +150,13 @@
     SET(CMAKE_C_FLAGS_DEBUG CACHE STRING "-ggdb")
   ELSEIF(MSVC)
     # This part is unnecessary 'casue the same is set by the lemon/core.h.
-    # Still keep it as an example.
-    SET(CXX_WARNING "/wd4250 /wd4355 /wd4503 /wd4800 /wd4996")
+    # Still kept as an example.
+
+    # SET(CXX_WARNING "/wd4250 /wd4267 /wd4355 /wd4503 /wd4800 /wd4996")
+
     # Suppressed warnings:
     # C4250: 'class1' : inherits 'class2::member' via dominance
+    # C4267: conversion from 'size_t' to 'type', possible loss of data
     # C4355: 'this' : used in base member initializer list
     # C4503: 'function' : decorated name length exceeded, name was truncated
     # C4800: 'type' : forcing value to bool 'true' or 'false'
diff --git a/lemon/arg_parser.h b/lemon/arg_parser.h
--- a/lemon/arg_parser.h
+++ b/lemon/arg_parser.h
@@ -26,6 +26,7 @@
 #include <iostream>
 #include <sstream>
 #include <algorithm>
+#include <lemon/core.h>
 #include <lemon/assert.h>
 
 ///\ingroup misc
diff --git a/lemon/core.h b/lemon/core.h
--- a/lemon/core.h
+++ b/lemon/core.h
@@ -29,12 +29,13 @@
 
 // Disable the following warnings when compiling with MSVC:
 // C4250: 'class1' : inherits 'class2::member' via dominance
+// C4267: conversion from 'size_t' to 'type', possible loss of data
 // C4355: 'this' : used in base member initializer list
 // C4503: 'function' : decorated name length exceeded, name was truncated
 // C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
 // C4996: 'function': was declared deprecated
 #ifdef _MSC_VER
-#pragma warning( disable : 4250 4355 4503 4800 4996 )
+#pragma warning( disable : 4250 4267 4355 4503 4800 4996 )
 #endif
 
 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)
diff --git a/lemon/counter.h b/lemon/counter.h
--- a/lemon/counter.h
+++ b/lemon/counter.h
@@ -22,6 +22,8 @@
 #include <string>
 #include <iostream>
 
+#include <lemon/core.h>
+
 ///\ingroup timecount
 ///\file
 ///\brief Tools for counting steps and events


More information about the Lemon-commits mailing list