Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

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 #36575 is a reply to message #36574] Sun, 10 June 2012 21:24 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

I want to notice that I've tested on my linux only.

Windows version and mingw version I extracted from MSDN and GCC documentation.
Re: How to mark a class of function is deprecated [message #36576 is a reply to message #36575] Sun, 10 June 2012 22:39 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
Hello Ion

It seems a good idea.


Best regards
Iñaki
Re: How to mark a class of function is deprecated [message #36577 is a reply to message #36576] Sun, 10 June 2012 23:27 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

koldo wrote on Sun, 10 June 2012 23:39

Hello Ion

It seems a good idea.

Thank you Koldo,

Could you test on windows OS?
Re: How to mark a class of function is deprecated [message #36578 is a reply to message #36577] Mon, 11 June 2012 08:46 Go to previous messageGo to next message
koldo is currently offline  koldo
Messages: 3354
Registered: August 2008
Senior Veteran
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)


Best regards
Iñaki
Re: How to mark a class of function is deprecated [message #36583 is a reply to message #36578] Mon, 11 June 2012 15:06 Go to previous messageGo to next message
tojocky is currently offline  tojocky
Messages: 607
Registered: April 2008
Location: UK
Contributor

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

Re: How to mark a class of function is deprecated [message #36587 is a reply to message #36583] Tue, 12 June 2012 09:08 Go to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
tojocky wrote on Mon, 11 June 2012 09: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?



Yes. Microsoft has deprecated half of ANSI C library. The result is that with this warning on, all other more important warnings are lost in thousands of 'deprecated' warnings.

Which I believe might be sort of problem with your proposal too... If we want to introduce something like this, perhaps we should rather introduce "on demand" method, like adding flag "NODEPRECATED" to main package config would expose use of all deprecated features.

Mirek
Previous Topic: String isn't pickable?
Next Topic: What`s the corect way to use TimingInspector?
Goto Forum:
  


Current Time: Thu Mar 28 12:05:37 CET 2024

Total time taken to generate the page: 0.01692 seconds