|
|
Home » U++ Library support » U++ Core » How to mark a class of function is deprecated
How to mark a class of function is deprecated [message #36574] |
Sun, 10 June 2012 21:18 |
|
Hello,
Reading more deeply C++ functionality I want to propose to implement a precompiled directive to mark for deprecated methods, properties, classes.
My code is:
#if defined(COMPILER_MSC)
#define UPP_DEPRECATED __declspec(deprecated)
#define UPP_DEPRECATED_T(text) __declspec(deprecated(#text))
#elif defined(COMPILER_GCC)||defined(COMPILER_MINGW)
#define UPP_DEPRECATED __attribute__ ((deprecated))
#define UPP_DEPRECATED_T(text) __attribute__ ((deprecated(#text)))
#else
#define UPP_DEPRECATED
#define UPP_DEPRECATED_T(text)
#endif
How it works:
- for a class:
class UPP_DEPRECATED_T("will be removed in 10.0 release") TempClass{...}
or
class UPP_DEPRECATED TempClass{...}
- for a class method:
class TempClass{
int dep_method UPP_DEPRECATED_T("will be removed in 10.0 release");
}
or
class TempClass{
int dep_method UPP_DEPRECATED;
}
- for a function:
UPP_DEPRECATED_T("will be removed in 10.0 release") void dep_function(){...}
or
UPP_DEPRECATED void dep_function(){...}
I'm proposing this solution because exist a lot of objects deprecated in U++ and we realize about this when it is completely removed.
/home/ilupascu/upp/uppsrc/Core/Vcont.h(82): int GetIndex(const T& item) const; //deprecated
/home/ilupascu/upp/uppsrc/Core/Vcont.h(136)://deprecated
/home/ilupascu/upp/uppsrc/Core/Stream.h(231)://* deprecated
/home/ilupascu/upp/uppsrc/Core/Stream.h(353): DELETESHARE = 0x20, // deprecated
/home/ilupascu/upp/uppsrc/Core/Stream.h(354): NOREADSHARE = 0x40, // deprecated
/home/ilupascu/upp/uppsrc/Core/Win32Util.h(48)://deprecated
/home/ilupascu/upp/uppsrc/Core/Win32Util.h(63)://deprecated
/home/ilupascu/upp/uppsrc/Core/Value.h(170): static void Register(dword w, Void* (*c)(), const char *name = NULL) init_; // Direct use deprecated
/home/ilupascu/upp/uppsrc/Core/Lang.h(16):#define LNG_CZECH 0xF1CC7A // Deprecated, corresponds to CS-CZ windows-1250
/home/ilupascu/upp/uppsrc/Core/Value.hpp(307):template <class T> // Deprecated, use Value::Is
/home/ilupascu/upp/uppsrc/Core/Value.hpp(310):template <class T> // deprecated, use Value::Is
/home/ilupascu/upp/uppsrc/Core/Value.hpp(314):struct RawValue : public Value { // Deprecated, use RawToValue and Value::To
/home/ilupascu/upp/uppsrc/Core/Value.hpp(321):struct RichValue : public Value { // Deprecated, use RichToValue and Value::To
/home/ilupascu/upp/uppsrc/Core/Value.hpp(328):template <class T> // Deprecated, use Value::To
/home/ilupascu/upp/uppsrc/Core/Value.hpp(331):template <class T> // Deprecated, use Value::To
/home/ilupascu/upp/uppsrc/Core/Value.hpp(335):template <class T> // Deprecated (?)
/home/ilupascu/upp/uppsrc/Core/Value.hpp(344):Ref RawAsRef(T& x) { // Deprecated (?)
/home/ilupascu/upp/uppsrc/Core/Value.hpp(348):template <class T> // Deprecated
/home/ilupascu/upp/uppsrc/Core/Value.hpp(356):template <class T> // Deprecated
/home/ilupascu/upp/uppsrc/Core/Defs.h(178):// deprecated, use INITBLOCK
/home/ilupascu/upp/uppsrc/Core/Defs.h(192):// deprecated, use EXITBLOCK
/home/ilupascu/upp/uppsrc/Core/Mt.h(556):typedef Mutex CriticalSection; // deprecated
/home/ilupascu/upp/uppsrc/Core/Mt.h(557):typedef StaticMutex StaticCriticalSection; // deprecated
/home/ilupascu/upp/uppsrc/Core/Global.h(29):// DEPRECATED! (USE ONCELOCK_)
/home/ilupascu/upp/uppsrc/Core/Global.h(40):// DEPRECATED! (USE ONCELOCK)
Also this can be used for custom packages to take in account the impact to other packages.
Any hints and advices are welcome.
[Updated on: Sun, 10 June 2012 21:21] Report message to a moderator
|
|
|
|
|
|
|
Re: How to mark a class of function is deprecated [message #36583 is a reply to message #36578] |
Mon, 11 June 2012 15:06 |
|
koldo wrote on Mon, 11 June 2012 09:46 | Hello Ion
It works for MinGW but not for MSC.
The reason is that for MSC in Defs.h we have a:
#pragma warning(disable : 4996)
|
Thank you very much Koldo for testing this one.
Mirek, Could you help me in this:
- #pragma warning(disable : 4996) was introduced intentionally?
I would appreciate to have the majority opinion.
Ion.
[Updated on: Mon, 11 June 2012 15:07] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Sat Sep 21 00:41:34 CEST 2024
Total time taken to generate the page: 0.03780 seconds
|
|
|