Skip to content
Snippets Groups Projects
Unverified Commit 247ecf1a authored by Stephan Hageboeck's avatar Stephan Hageboeck Committed by GitHub
Browse files

Add R__SUGGEST_ALTERNATIVE macro to flag legacy functions

Functions that are outdated, but will not be removed, can be flagged with `R__SUGGEST_ALTERNATIVE`, a macro expanding to ROOT's `_R__DEPRECATED_LATER`. This can be used to point users to the recommended interfaces.

Flagging a function like this:
TIterator* createIterator() const
R__SUGGEST_ALTERNATIVE("begin(), end() and range-based for loops are faster.") {
   ...
}

and defining `R__SUGGEST_NEW_INTERFACE` in a translation unit will trigger a warning such as:
RooChebychev.cxx:66:34: warning: 'createIterator' is deprecated: There is a superior alternative: begin(), end() and range-based for loops are faster. [-Wdeprecated-declarations]
  TIterator* coefIter = coefList.createIterator();

IMPORTANT:
Theoretically, the macro could be used for classes: Don't!
This will trigger warnings for all uses of the class in the interfaces of ROOT.
parent b7e63795
Branches
Tags
No related merge requests found
...@@ -521,6 +521,15 @@ ...@@ -521,6 +521,15 @@
#define R__DEPRECATED(MAJOR, MINOR, REASON) \ #define R__DEPRECATED(MAJOR, MINOR, REASON) \
_R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON) _R__JOIN3_(_R__DEPRECATED_,MAJOR,MINOR)("will be removed in ROOT v" #MAJOR "." #MINOR ": " REASON)
/* Mechanism to advise users to avoid legacy functions that will not be removed */
#ifdef R__SUGGEST_NEW_INTERFACE
# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE) \
_R__DEPRECATED_LATER("There is a superior alternative: " ALTERNATIVE)
#else
# define R__SUGGEST_ALTERNATIVE(ALTERNATIVE)
#endif
/*---- misc ------------------------------------------------------------------*/ /*---- misc ------------------------------------------------------------------*/
#ifdef R__GNU #ifdef R__GNU
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment