ROSE 0.11.145.147
ROSE_DEPRECATED.h
1#ifndef ROSE_DEPRECATED_H
2#define ROSE_DEPRECATED_H
3
4// The ROSE_DEPRECATED marker unconditionally marks a function or variable as deprecated and will produce a warning if
5// whenever a use of that function or variable occurs. Do not disable this macro; see ROSE_DEPRECATED_FUNCTION instead.
6// If you mark a function or variable as deprecated, then BE SURE TO FIX PLACES WHERE IT IS USED IN ROSE!!! The WHY argument
7// should be a string literal (unevaluated) describing why it's deprecated or what to use instead.
8#if defined(__clang__)
9# define ROSE_DEPRECATED(WHY) __attribute__((deprecated(WHY)))
10#elif defined(__GNUC__)
11# define ROSE_DEPRECATED(WHY) __attribute__((deprecated))
12#elif defined(_MSC_VER)
13# define ROSE_DEPRECATED(WHY) /*deprecated*/
14#else
15# define ROSE_DEPRECATED(WHY) /*deprecated*/
16#endif
17
18// The ROSE_DEPRECATED_FUNCTION and ROSE_DEPRECATED_VARIABLE conditionally mark a function or variable as deprecated. At this
19// time, ROSE itself contains hundreds of uses of deprecated functions and variables because the people that marked those
20// functions and variables as deprecated did not also fix ROSE to avoid calling them. The warnings can be suppressed by
21// defining ROSE_SUPPRESS_DEPRECATION_WARNINGS on the compiler command-line during configuration.
22//
23// For the time being we explicitly define ROSE_SUPPRESS_DEPRECATION_WARNINGS because of the problem mentioned above. ROSE
24// authors should only add ROSE_DEPRECATED markers and not use new ROSE_DEPRECATED_FUNCTION or ROSE_DEPRECATED_VARAIBLE since
25// the latter two do nothing. AND BE SURE TO FIX PLACES IN ROSE WHERE THE DEPRECATED THING IS USED!!!!!
26#undef ROSE_SUPPRESS_DEPRECATION_WARNINGS
27#define ROSE_SUPPRESS_DEPRECATION_WARNINGS
28#if !defined(ROSE_SUPPRESS_DEPRECATION_WARNINGS)
29# if !defined(ROSE_DEPRECATED_FUNCTION)
30# define ROSE_DEPRECATED_FUNCTION ROSE_DEPRECATED
31# endif
32# if !defined(ROSE_DEPRECATED_VARIABLE)
33# define ROSE_DEPRECATED_VARIABLE ROSE_DEPRECATED
34# endif
35#else
36# if !defined(ROSE_DEPRECATED_FUNCTION)
37# define ROSE_DEPRECATED_FUNCTION /*deprecated*/
38# endif
39# if !defined(ROSE_DEPRECATED_VARIABLE)
40# define ROSE_DEPRECATED_VARIABLE /*deprecated*/
41# endif
42#endif
43
44// Used to mark deprecated functions and advertise that fact to developers and especially to end users. This is sometimes
45// turned off during development (because it's annoying) by defining ROSE_SUPPRESS_DEPRECATION_WARNINGS when configuring.
46#if !defined(ROSE_SUPPRESS_DEPRECATION_WARNINGS)
47# if defined(__GNUC__)
48 // Put ROSE_DEPRECATED_FUNCTION after the declaration, i.e.: int Foo::bar() const ROSE_DEPRECATED_FUNCTION;
49# define ROSE_DEPRECATED_FUNCTION __attribute__((deprecated))
50# define ROSE_DEPRECATED_VARIABLE __attribute__((deprecated))
51# elif defined(_MSC_VER)
52 // Microsoft Visual C++ needs "__declspec(deprecated)" before the declaration. We don't really want to put
53 // ROSE_DEPRECATED_FUNCTION both before and after functions, so we just don't worry about advertising deprecation when
54 // using Microsoft compilers. Use MinGW instead if you want a real C++ compiler on Windows.
55# define ROSE_DEPRECATED_FUNCTION /*deprecated*/
56# define ROSE_DEPRECATED_VARIABLE /*deprecated*/
57# else
58 // No portable way to mark C++ functions as deprecated.
59# define ROSE_DEPRECATED_FUNCTION /*deprecated*/
60# define ROSE_DEPRECATED_VARIABLE /*deprecated*/
61# endif
62#else
63# define ROSE_DEPRECATED_FUNCTION /*deprecated*/
64# define ROSE_DEPRECATED_VARIABLE /*deprecated*/
65#endif
66
67#endif