Deprecated Notation for the Sun C ++ Compiler?

Does the Sun compiler designate functions as deprecated, such as GCC __attribute__ ((deprecated))or MSVC __declspec(deprecated)?

+3
source share
2 answers

It looks like one solution that will work with any compiler supporting #warningit will be:

  • Copy the title in question into a new name with an extended title
  • Remove obsolete functions from the extended header file
  • Add to old header file: #warning "This header is deprecated. Please use {new header name}"
+2
source

"+ w" gcc "-Wall". , ABI ; .

#define DEPRECATED char=function_is_deprecated()

inline char function_is_deprecated()
{
    return 65535;
}

void foo(int x, DEPRECATED)
{
}

int main()
{
    foo(3);
    return 0;
}

:

CC -o test test.cpp +w
"test.cpp", line 7: Warning: Conversion of "int" value to "char" causes truncation.
"test.cpp", line 15:     Where: While instantiating "function_is_deprecated()".
"test.cpp", line 15:     Where: Instantiated from non-template code.
1 Warning(s) detected.

: , DEPRECATED. , , ( , API), .

+1

Source: https://habr.com/ru/post/1708823/


All Articles