diff options
author | Michi Henning <michi@zeroc.com> | 2005-11-18 22:59:46 +0000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2005-11-18 22:59:46 +0000 |
commit | 1995b4af86f8edbb2f12405d05bce2b6e47459b1 (patch) | |
tree | fa5813ff5b05ea5f8d316515b394ee520aacd288 /cpp | |
parent | Added note about iceboxd (diff) | |
download | ice-1995b4af86f8edbb2f12405d05bce2b6e47459b1.tar.bz2 ice-1995b4af86f8edbb2f12405d05bce2b6e47459b1.tar.xz ice-1995b4af86f8edbb2f12405d05bce2b6e47459b1.zip |
Moved VS 8 warning suppression into IceUtil/DisableWarnings.h
Diffstat (limited to 'cpp')
37 files changed, 90 insertions, 66 deletions
diff --git a/cpp/demo/Freeze/library/Parser.cpp b/cpp/demo/Freeze/library/Parser.cpp index 43cc2e107bc..0fa4043987b 100644 --- a/cpp/demo/Freeze/library/Parser.cpp +++ b/cpp/demo/Freeze/library/Parser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Parser.h> #ifdef HAVE_READLINE diff --git a/cpp/demo/Freeze/library/RunParser.cpp b/cpp/demo/Freeze/library/RunParser.cpp index b71a188d852..f8baf3ae83f 100644 --- a/cpp/demo/Freeze/library/RunParser.cpp +++ b/cpp/demo/Freeze/library/RunParser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Parser.h> using namespace std; diff --git a/cpp/demo/Freeze/phonebook/Parser.cpp b/cpp/demo/Freeze/phonebook/Parser.cpp index 60f6be1ad8f..26d0b097e68 100644 --- a/cpp/demo/Freeze/phonebook/Parser.cpp +++ b/cpp/demo/Freeze/phonebook/Parser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Parser.h> #ifdef HAVE_READLINE diff --git a/cpp/demo/Freeze/phonebook/RunParser.cpp b/cpp/demo/Freeze/phonebook/RunParser.cpp index e254e885828..cabed096bd5 100644 --- a/cpp/demo/Freeze/phonebook/RunParser.cpp +++ b/cpp/demo/Freeze/phonebook/RunParser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Parser.h> using namespace std; diff --git a/cpp/include/IceUtil/Config.h b/cpp/include/IceUtil/Config.h index 334438f2c49..7ebccac2cd6 100644 --- a/cpp/include/IceUtil/Config.h +++ b/cpp/include/IceUtil/Config.h @@ -120,13 +120,6 @@ # pragma warning( disable : 4275 ) // ...: decorated name length exceeded, name was truncated # pragma warning( disable : 4503 ) -// -// -// TEMPORARY: move deprecated warning on VC8 to level 4 -# if _MSC_VER==1400 -# pragma warning( 4 : 4996 ) -# endif - # endif #endif diff --git a/cpp/include/IceUtil/DisableWarnings.h b/cpp/include/IceUtil/DisableWarnings.h new file mode 100644 index 00000000000..ee8ecffebdb --- /dev/null +++ b/cpp/include/IceUtil/DisableWarnings.h @@ -0,0 +1,31 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2005 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +#ifndef ICE_UTIL_DISABLEWARNINGS_H +#define ICE_UTIL_DISABLEWARNINGS_H + +// +// This header file disables various annoying compiler warnings that +// we don't want. +// +// IMPORTANT: Do *not* include this header file in another header file! +// Doing this may potentially disable the warnings in the source +// code of our customers, which would be bad. Only include this +// header file in Ice *source* files! +// + +#if _WIN32 && _MSC_VER >= 1400 + +# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/ + +# pragma warning(disable: 4996) // C4996 'std::<function>' was declared deprecated + +#endif + +#endif diff --git a/cpp/src/FreezeScript/Data.cpp b/cpp/src/FreezeScript/Data.cpp index e48e8cd7c72..81dad802b9e 100644 --- a/cpp/src/FreezeScript/Data.cpp +++ b/cpp/src/FreezeScript/Data.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <FreezeScript/Data.h> #include <FreezeScript/Util.h> #include <FreezeScript/Exception.h> diff --git a/cpp/src/Glacier2/Glacier2Router.cpp b/cpp/src/Glacier2/Glacier2Router.cpp index 4877c8cfa4b..831dc9f0d22 100644 --- a/cpp/src/Glacier2/Glacier2Router.cpp +++ b/cpp/src/Glacier2/Glacier2Router.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/UUID.h> #include <IceUtil/Options.h> #include <Ice/Service.h> diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp index 5267f96d7fe..9b3bd735605 100644 --- a/cpp/src/Ice/BasicStream.cpp +++ b/cpp/src/Ice/BasicStream.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/BasicStream.h> #include <Ice/Instance.h> #include <Ice/Object.h> @@ -733,17 +734,6 @@ IceInternal::BasicStream::read(vector<Byte>& v) } } -template<class InputIterator, class OutputIterator> -OutputIterator -copyP(InputIterator first, InputIterator last, OutputIterator dest) -{ -#if _WIN32 && _MSC_VER == 1400 - return ::stdext::unchecked_copy(first, last, dest); -#else - return ::std::copy(first, last, dest); -#endif -} - void IceInternal::BasicStream::write(const vector<bool>& v) { @@ -753,7 +743,7 @@ IceInternal::BasicStream::write(const vector<bool>& v) { Container::size_type pos = b.size(); resize(pos + sz); - copyP(v.begin(), v.end(), b.begin() + pos); + copy(v.begin(), v.end(), b.begin() + pos); } } @@ -857,7 +847,7 @@ IceInternal::BasicStream::read(vector<Short>& v) dest += 2 * sizeof(Short); } #else - copyP(begin, i, reinterpret_cast<Byte*>(&v[0])); + copy(begin, i, reinterpret_cast<Byte*>(&v[0])); #endif } else @@ -960,7 +950,7 @@ IceInternal::BasicStream::read(vector<Int>& v) dest += 2 * sizeof(Int); } #else - copyP(begin, i, reinterpret_cast<Byte*>(&v[0])); + copy(begin, i, reinterpret_cast<Byte*>(&v[0])); #endif } else @@ -1087,7 +1077,7 @@ IceInternal::BasicStream::read(vector<Long>& v) dest += 2 * sizeof(Long); } #else - copyP(begin, i, reinterpret_cast<Byte*>(&v[0])); + copy(begin, i, reinterpret_cast<Byte*>(&v[0])); #endif } else @@ -1190,7 +1180,7 @@ IceInternal::BasicStream::read(vector<Float>& v) dest += 2 * sizeof(Float); } #else - copyP(begin, i, reinterpret_cast<Byte*>(&v[0])); + copy(begin, i, reinterpret_cast<Byte*>(&v[0])); #endif } else @@ -1317,7 +1307,7 @@ IceInternal::BasicStream::read(vector<Double>& v) dest += 2 * sizeof(Double); } #else - copyP(begin, i, reinterpret_cast<Byte*>(&v[0])); + copy(begin, i, reinterpret_cast<Byte*>(&v[0])); #endif } else diff --git a/cpp/src/Ice/ConnectionI.cpp b/cpp/src/Ice/ConnectionI.cpp index 98863f20a16..86da0b44186 100644 --- a/cpp/src/Ice/ConnectionI.cpp +++ b/cpp/src/Ice/ConnectionI.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/ConnectionI.h> #include <Ice/Instance.h> #include <Ice/LoggerUtil.h> diff --git a/cpp/src/Ice/GC.cpp b/cpp/src/Ice/GC.cpp index 1bce890035f..b9b8bf76bfd 100755 --- a/cpp/src/Ice/GC.cpp +++ b/cpp/src/Ice/GC.cpp @@ -35,7 +35,7 @@ recursivelyReachable(GCShared* p, GCObjectSet& o) } -using namespace std;
+using namespace std; using namespace IceUtil; int IceInternal::GC::_numCollectors = 0; diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index 45129677459..b1b276fd985 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Instance.h> #include <Ice/TraceLevels.h> #include <Ice/DefaultsAndOverrides.h> @@ -413,34 +414,6 @@ IceInternal::Instance::getDefaultContext() const return _defaultContext; } -static FILE* -freopenP(const char* path, const char* mode, FILE* stream) -{ - FILE* file; - -#if _WIN32 && _MSC_VER >= 1400 - ::freopen_s(&file, path, mode, stream); - if(file == 0) - { - FileException ex(__FILE__, __LINE__); - ex.path = path; - char buf[1024]; - ex.error = _strerror_s(buf, sizeof(buf), "freopen_s failed"); - throw ex; - } -#else - file = ::freopen(path, mode, stream); - if(file == 0) - { - FileException ex(__FILE__, __LINE__); - ex.path = path; - ex.error = getSystemErrno(); - throw ex; - } -#endif - - return file; -} IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const PropertiesPtr& properties, const LoggerPtr& logger) : @@ -470,12 +443,26 @@ IceInternal::Instance::Instance(const CommunicatorPtr& communicator, const Prope if(stdOutFilename != "") { - freopenP(stdOutFilename.c_str(), "a", stdout); + FILE* file = freopen(stdOutFilename.c_str(), "a", stdout); + if(file == 0) + { + FileException ex(__FILE__, __LINE__); + ex.path = stdOutFilename; + ex.error = getSystemErrno(); + throw ex; + } } if(stdErrFilename != "") { - freopenP(stdErrFilename.c_str(), "a", stderr); + FILE* file = freopen(stdErrFilename.c_str(), "a", stderr); + if(file == 0) + { + FileException ex(__FILE__, __LINE__); + ex.path = stdErrFilename; + ex.error = getSystemErrno(); + throw ex; + } } unsigned int seed = static_cast<unsigned int>(IceUtil::Time::now().toMicroSeconds()); diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 5f3a01970fc..0cf36984de4 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/StringUtil.h> #include <Ice/PropertiesI.h> #include <Ice/Initialize.h> diff --git a/cpp/src/Ice/Service.cpp b/cpp/src/Ice/Service.cpp index ac8b2bb17e4..1b5ec82669d 100755 --- a/cpp/src/Ice/Service.cpp +++ b/cpp/src/Ice/Service.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/CtrlCHandler.h> #include <IceUtil/Thread.h> #include <IceUtil/Monitor.h> @@ -18,7 +19,7 @@ #include <Ice/Properties.h> #ifdef _WIN32 -# include <winsock2.h>
+# include <winsock2.h> # include <Ice/EventLoggerI.h> #else # include <Ice/Logger.h> diff --git a/cpp/src/Ice/ThreadPool.cpp b/cpp/src/Ice/ThreadPool.cpp index 670411f142e..40e132ae4d8 100644 --- a/cpp/src/Ice/ThreadPool.cpp +++ b/cpp/src/Ice/ThreadPool.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/ThreadPool.h> #include <Ice/EventHandler.h> #include <Ice/Network.h> diff --git a/cpp/src/IceGrid/Activator.cpp b/cpp/src/IceGrid/Activator.cpp index c9317f40a6f..36263460338 100644 --- a/cpp/src/IceGrid/Activator.cpp +++ b/cpp/src/IceGrid/Activator.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Ice.h> #include <IceGrid/Activator.h> #include <IceGrid/Admin.h> diff --git a/cpp/src/IceGrid/Client.cpp b/cpp/src/IceGrid/Client.cpp index 693b87f9164..d3646159b18 100644 --- a/cpp/src/IceGrid/Client.cpp +++ b/cpp/src/IceGrid/Client.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Options.h> #include <Ice/Application.h> #include <Ice/SliceChecksums.h> diff --git a/cpp/src/IceGrid/Parser.cpp b/cpp/src/IceGrid/Parser.cpp index dd827ab318d..ff6c5c5e347 100644 --- a/cpp/src/IceGrid/Parser.cpp +++ b/cpp/src/IceGrid/Parser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/OutputUtil.h> #include <IceUtil/Options.h> #include <Ice/Ice.h> diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp index 38e90002910..bb7ef6d203f 100644 --- a/cpp/src/IcePatch2/FileServerI.cpp +++ b/cpp/src/IcePatch2/FileServerI.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IcePatch2/FileServerI.h> #include <sys/types.h> #include <sys/stat.h> diff --git a/cpp/src/IcePatch2/Util.cpp b/cpp/src/IcePatch2/Util.cpp index d3e237eb250..ed7a287b555 100644 --- a/cpp/src/IcePatch2/Util.cpp +++ b/cpp/src/IcePatch2/Util.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/IceUtil.h> #include <IcePatch2/Util.h> #include <openssl/sha.h> diff --git a/cpp/src/IceSSL/Convert.cpp b/cpp/src/IceSSL/Convert.cpp index fe7aa7806bb..830e9d1bdfd 100644 --- a/cpp/src/IceSSL/Convert.cpp +++ b/cpp/src/IceSSL/Convert.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Config.h> #include <IceSSL/Convert.h> #include <iterator> diff --git a/cpp/src/IceSSL/OpenSSLPluginI.cpp b/cpp/src/IceSSL/OpenSSLPluginI.cpp index 8a440184c58..69c1a44c333 100644 --- a/cpp/src/IceSSL/OpenSSLPluginI.cpp +++ b/cpp/src/IceSSL/OpenSSLPluginI.cpp @@ -7,6 +7,8 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> + #include <IceSSL/OpenSSLPluginI.h> #include <Ice/LoggerUtil.h> diff --git a/cpp/src/IceSSL/OpenSSLUtils.cpp b/cpp/src/IceSSL/OpenSSLUtils.cpp index 16e5e11bdca..09c34dfd3c4 100644 --- a/cpp/src/IceSSL/OpenSSLUtils.cpp +++ b/cpp/src/IceSSL/OpenSSLUtils.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/StaticMutex.h> #include <IceSSL/OpenSSLPluginI.h> #include <IceSSL/OpenSSLUtils.h> diff --git a/cpp/src/IceStorm/Admin.cpp b/cpp/src/IceStorm/Admin.cpp index 796714d5fdb..97669039edb 100644 --- a/cpp/src/IceStorm/Admin.cpp +++ b/cpp/src/IceStorm/Admin.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Options.h> #include <Ice/Application.h> #include <Ice/SliceChecksums.h> diff --git a/cpp/src/IceStorm/Parser.cpp b/cpp/src/IceStorm/Parser.cpp index 3d166dab28b..145134b7727 100644 --- a/cpp/src/IceStorm/Parser.cpp +++ b/cpp/src/IceStorm/Parser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Ice.h> #include <IceStorm/Parser.h> #include <IceStorm/WeightedGraph.h> diff --git a/cpp/src/IceUtil/Time.cpp b/cpp/src/IceUtil/Time.cpp index b6ba14ca2e1..aa0f5a3fa85 100644 --- a/cpp/src/IceUtil/Time.cpp +++ b/cpp/src/IceUtil/Time.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Time.h> #ifdef _WIN32 @@ -28,11 +29,7 @@ IceUtil::Time::now() { #ifdef _WIN32 struct _timeb tb; -# if _MSC_VER >= 1400 - _ftime_s(&tb); -# else _ftime(&tb); -# endif return Time(static_cast<Int64>(tb.time) * ICE_INT64(1000000) + tb.millitm * 1000); #else @@ -113,13 +110,7 @@ IceUtil::Time::toString() const struct tm* t; #ifdef _WIN32 -# if _MSC_VER >= 1400 - struct tm tms; - t = &tms; - localtime_s(t, &time); -# else t = localtime(&time); -# endif #else struct tm tr; localtime_r(&time, &tr); diff --git a/cpp/src/slice2cs/Gen.cpp b/cpp/src/slice2cs/Gen.cpp index 7a4c9edd9fd..c41c945421e 100755 --- a/cpp/src/slice2cs/Gen.cpp +++ b/cpp/src/slice2cs/Gen.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Functional.h> #include <Gen.h> #include <limits> diff --git a/cpp/src/slice2docbook/Gen.cpp b/cpp/src/slice2docbook/Gen.cpp index 2d3103b28b8..b0719df9abc 100644 --- a/cpp/src/slice2docbook/Gen.cpp +++ b/cpp/src/slice2docbook/Gen.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Functional.h> #include <Gen.h> diff --git a/cpp/src/slice2freeze/Main.cpp b/cpp/src/slice2freeze/Main.cpp index 650d4636e9b..627569d34cd 100644 --- a/cpp/src/slice2freeze/Main.cpp +++ b/cpp/src/slice2freeze/Main.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Options.h> #include <Slice/Preprocessor.h> #include <Slice/CPlusPlusUtil.h> diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index 8aff75f3b49..593282cf4b7 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Gen.h> #include <Slice/Checksum.h> #include <IceUtil/Functional.h> diff --git a/cpp/src/slice2py/Main.cpp b/cpp/src/slice2py/Main.cpp index 43d64d0ec06..3be82046208 100644 --- a/cpp/src/slice2py/Main.cpp +++ b/cpp/src/slice2py/Main.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Options.h> #include <Slice/Preprocessor.h> #include <Slice/PythonUtil.h> diff --git a/cpp/src/slice2vb/Gen.cpp b/cpp/src/slice2vb/Gen.cpp index 64b2558feea..735c147a328 100755 --- a/cpp/src/slice2vb/Gen.cpp +++ b/cpp/src/slice2vb/Gen.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/Functional.h> #include <Gen.h> #include <limits> diff --git a/cpp/test/Freeze/complex/Parser.cpp b/cpp/test/Freeze/complex/Parser.cpp index 0487e938a94..f9a25dfc4ae 100644 --- a/cpp/test/Freeze/complex/Parser.cpp +++ b/cpp/test/Freeze/complex/Parser.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Parser.h> using namespace std; diff --git a/cpp/test/IceGrid/deployer/Server.cpp b/cpp/test/IceGrid/deployer/Server.cpp index 5d4ce7a465b..6acfa9cf54e 100644 --- a/cpp/test/IceGrid/deployer/Server.cpp +++ b/cpp/test/IceGrid/deployer/Server.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Ice.h> #include <TestI.h> #include <TestCommon.h> diff --git a/cpp/test/IceStorm/federation/Subscriber.cpp b/cpp/test/IceStorm/federation/Subscriber.cpp index b6ba217448b..252f61507ac 100644 --- a/cpp/test/IceStorm/federation/Subscriber.cpp +++ b/cpp/test/IceStorm/federation/Subscriber.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Ice.h> #include <IceStorm/IceStorm.h> #include <Event.h> diff --git a/cpp/test/IceStorm/single/Subscriber.cpp b/cpp/test/IceStorm/single/Subscriber.cpp index fd53c2f722e..b52c70e61c4 100644 --- a/cpp/test/IceStorm/single/Subscriber.cpp +++ b/cpp/test/IceStorm/single/Subscriber.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <Ice/Ice.h> #include <IceStorm/IceStorm.h> #include <Single.h> diff --git a/cpp/test/IceUtil/thread/CreateTest.cpp b/cpp/test/IceUtil/thread/CreateTest.cpp index 865edb845d8..bb86cc4a53d 100644 --- a/cpp/test/IceUtil/thread/CreateTest.cpp +++ b/cpp/test/IceUtil/thread/CreateTest.cpp @@ -7,6 +7,7 @@ // // ********************************************************************** +#include <IceUtil/DisableWarnings.h> #include <IceUtil/IceUtil.h> #include <stdio.h> |