diff --git a/Help/release/dev/GenerateExportHeader-deprecated-msg.rst b/Help/release/dev/GenerateExportHeader-deprecated-msg.rst new file mode 100644 index 0000000000..0f6327ec0a --- /dev/null +++ b/Help/release/dev/GenerateExportHeader-deprecated-msg.rst @@ -0,0 +1,9 @@ +GenerateExportHeader-deprecated-msg +----------------------------------- + +* The :module:`GenerateExportHeader` module's + :command:`generate_export_header` command now defines + ``_DEPRECATED_MSG()`` and the corresponding ``_EXPORT_MSG`` + and ``_NO_EXPORT_MSG`` macros, which add a message to the deprecation + warning. With the ``CXX_ATTRIBUTES`` option, deprecation uses the + standard ``[[deprecated]]`` attribute as of C++14. diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index f5d1a9d9f4..d3eb148565 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -96,6 +96,22 @@ Generating Export Header * ``_DEPRECATED_NO_EXPORT``: Marks a deprecated symbol that should not be exported (internal and deprecated). + * ``_DEPRECATED_MSG()``, + ``_DEPRECATED_EXPORT_MSG()`` and + ``_DEPRECATED_NO_EXPORT_MSG()``: + + .. versionadded:: 4.6 + + Act like the three deprecation macros above. The compiler warning also + shows the string literal ````, which typically names the + replacement. Compilers that support deprecation only without a message + ignore ````: + + .. code-block:: c++ + + EXAMPLE_DEPRECATED_EXPORT_MSG("use doSomething() instead") + void legacyPublicFunction(); + * ``_NO_DEPRECATED``: A macro that can be used in source code to conditionally exclude deprecated code parts from the build via preprocessor logic. @@ -143,9 +159,13 @@ Generating Export Header export markers) * ``_NO_EXPORT`` (macro for deprecated symbols with no-export markers) + * ``_MSG``, + ``_EXPORT_MSG`` and + ``_NO_EXPORT_MSG`` (the above macros with a + deprecation message) instead of the default names in format of - ``_DEPRECATED{,_EXPORT,_NO_EXPORT}``. + ``_DEPRECATED{,_EXPORT,_NO_EXPORT}{,_MSG}``. ``DEFINE_NO_DEPRECATED`` If specified, this will define a macro named ``_NO_DEPRECATED``. @@ -196,8 +216,10 @@ Generating Export Header If specified, the export, no-export and deprecation macros expand to C++11 attributes, such as ``[[gnu::visibility("default")]]``, - ``[[gnu::dllexport]]`` and ``[[gnu::deprecated]]``, which can be - combined with other C++11 attributes. The generated header falls back + ``[[gnu::dllexport]]`` and ``[[deprecated]]``, which can be combined + with other C++11 attributes. Deprecation uses the standard + ``[[deprecated]]`` as of C++14 and ``[[gnu::deprecated]]`` in C++11. + The generated header falls back to the compiler-specific spellings, such as ``__attribute__`` and ``__declspec``, if the consumer compiles C, compiles C++ older than C++11, does not support the attribute, or is Qt's ``moc``. The @@ -602,18 +624,51 @@ endmacro() macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) set(DEFINE_DEPRECATED) + set(DEFINE_DEPRECATED_MSG) set(DEFINE_EXPORT) set(DEFINE_IMPORT) set(DEFINE_NO_EXPORT) - set(CXX_ATTRIBUTE_DEPRECATED "gnu::deprecated") + # Values of __cplusplus for the language levels of C++11 attributes + set(cplusplus11 201103L) + set(cplusplus14 201402L) + # Values of __has_cpp_attribute for any support of a vendor attribute and + # for the standard deprecation attribute + set(has_attribute 1) + set(has_deprecated 201309L) + # GCC and Clang report the standard deprecation attribute in C++11 too, but + # Clang rejects it there with -pedantic-errors as a C++14 extension. The + # standard attribute therefore requires C++14, and its GNU spelling covers + # C++11. + set(CXX_ATTRIBUTE_DEPRECATED + "deprecated" ${cplusplus14} ${has_deprecated} + "gnu::deprecated" ${cplusplus11} ${has_attribute} + ) set(CXX_ATTRIBUTE_EXPORT) set(CXX_ATTRIBUTE_IMPORT) set(CXX_ATTRIBUTE_NO_EXPORT) if (COMPILER_HAS_DEPRECATED_ATTR AND NOT WIN32) set(DEFINE_DEPRECATED "__attribute__ ((__deprecated__))") + set(DEFINE_DEPRECATED_MSG "__attribute__ ((__deprecated__(msg)))") elseif(COMPILER_HAS_DEPRECATED) set(DEFINE_DEPRECATED "__declspec(deprecated)") + set(DEFINE_DEPRECATED_MSG "__declspec(deprecated(msg))") + endif() + # Older compilers, such as GCC before 4.5, accept the deprecation attribute + # only without a message. + if(DEFINE_DEPRECATED_MSG) + string(REPLACE "(msg)" "(\"msg\")" deprecated_msg_probe + "${DEFINE_DEPRECATED_MSG}") + if(CMAKE_CXX_COMPILER_LOADED) + _check_cxx_compiler_attribute("${deprecated_msg_probe}" + COMPILER_HAS_DEPRECATED_MSG) + else() + _check_c_compiler_attribute("${deprecated_msg_probe}" + COMPILER_HAS_DEPRECATED_MSG) + endif() + if(NOT COMPILER_HAS_DEPRECATED_MSG) + set(DEFINE_DEPRECATED_MSG "${DEFINE_DEPRECATED}") + endif() endif() get_property(type TARGET ${TARGET_LIBRARY} PROPERTY TYPE) @@ -622,39 +677,72 @@ macro(_DO_SET_MACRO_VALUES TARGET_LIBRARY) if(WIN32 OR CYGWIN) set(DEFINE_EXPORT "__declspec(dllexport)") set(DEFINE_IMPORT "__declspec(dllimport)") - set(CXX_ATTRIBUTE_EXPORT "gnu::dllexport") - set(CXX_ATTRIBUTE_IMPORT "gnu::dllimport") + set(CXX_ATTRIBUTE_EXPORT "gnu::dllexport" + ${cplusplus11} ${has_attribute}) + set(CXX_ATTRIBUTE_IMPORT "gnu::dllimport" + ${cplusplus11} ${has_attribute}) elseif(COMPILER_HAS_HIDDEN_VISIBILITY) set(DEFINE_EXPORT "__attribute__((visibility(\"default\")))") set(DEFINE_IMPORT "__attribute__((visibility(\"default\")))") set(DEFINE_NO_EXPORT "__attribute__((visibility(\"hidden\")))") - set(CXX_ATTRIBUTE_EXPORT "gnu::visibility(\"default\")") - set(CXX_ATTRIBUTE_IMPORT "gnu::visibility(\"default\")") - set(CXX_ATTRIBUTE_NO_EXPORT "gnu::visibility(\"hidden\")") + set(CXX_ATTRIBUTE_EXPORT "gnu::visibility(\"default\")" + ${cplusplus11} ${has_attribute}) + set(CXX_ATTRIBUTE_IMPORT "gnu::visibility(\"default\")" + ${cplusplus11} ${has_attribute}) + set(CXX_ATTRIBUTE_NO_EXPORT "gnu::visibility(\"hidden\")" + ${cplusplus11} ${has_attribute}) endif() endif() endmacro() # Sets to the preprocessor lines indented by that define the -# macro as . Given a C++11 , the lines prefer -# [[]] in consumers that support it and fall back to -# otherwise. Qt's moc always sees because older versions of moc skip -# classes declared with C++11 attributes. -function(_generate_export_header_definition out indent name value attribute) - if(NOT attribute) +# macro , which may include a parameter list, as . The remaining +# arguments are triples of a C++11 attribute, the minimum value of __cplusplus +# it requires and the minimum value of __has_cpp_attribute for it. The lines +# prefer [[]] of the first triple the consumer supports and fall +# back to otherwise. Qt's moc always +# sees because older versions of moc skip classes declared with C++11 +# attributes. +function(_generate_export_header_definition out indent name value) + if(NOT ARGN) set(${out} "#${indent}define ${name} ${value}" PARENT_SCOPE) return() endif() - string(REGEX REPLACE "\\(.*" "" token "${attribute}") - string(JOIN "\n" definition - "#${indent}if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN)" - "#${indent} if __has_cpp_attribute(${token})" - "#${indent} define ${name} [[${attribute}]]" - "#${indent} endif" - "#${indent}endif" - "#${indent}ifndef ${name}" - "#${indent} define ${name} ${value}" + string(REGEX REPLACE "\\(.*" "" macro "${name}") + set(definition "") + set(undefined "") + # Take one candidate triple at a time, keeping each attribute next to its + # requirements instead of in parallel lists. + while(ARGN) + list(POP_FRONT ARGN attribute cplusplus minimum) + string(REGEX REPLACE "\\(.*" "" token "${attribute}") + # Any positive value indicates support, so a minimum of 1 needs no + # comparison. + set(supported "__has_cpp_attribute(${token})") + if(NOT minimum STREQUAL "1") + string(APPEND supported " >= ${minimum}") + endif() + if(token MATCHES "::") + # Intel C++ for Windows reports GNU attributes it ignores, and Oracle + # Developer Studio cannot parse scoped attribute names. + set(language "defined(__cplusplus) && __cplusplus >= ${cplusplus} && !defined(__SUNPRO_CC)") + else() + # MSVC keeps __cplusplus at C++98 by default. + set(language "(defined(__cplusplus) && __cplusplus >= ${cplusplus} || defined(_MSVC_LANG) && _MSVC_LANG >= ${cplusplus})") + endif() + string(APPEND definition + "#${indent}if ${language} && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN)${undefined}\n" + "#${indent} if ${supported}\n" + "#${indent} define ${name} [[${attribute}]]\n" + "#${indent} endif\n" + "#${indent}endif\n" + ) + set(undefined " && !defined(${macro})") + endwhile() + string(APPEND definition + "#${indent}ifndef ${macro}\n" + "#${indent} define ${name} ${value}\n" "#${indent}endif" ) set(${out} "${definition}" PARENT_SCOPE) @@ -756,20 +844,39 @@ function(_DO_GENERATE_EXPORT_HEADER TARGET_LIBRARY) set(CXX_ATTRIBUTE_IMPORT) set(CXX_ATTRIBUTE_NO_EXPORT) endif() + # Append the message parameter to the attributes but not to their minimum + # values, which start with a digit. + list(TRANSFORM CXX_ATTRIBUTE_DEPRECATED APPEND "(msg)" REGEX "^[^0-9]" + OUTPUT_VARIABLE CXX_ATTRIBUTE_DEPRECATED_MSG) _generate_export_header_definition(EXPORT_DEFINITION " " - "${EXPORT_MACRO_NAME}" "${DEFINE_EXPORT}" "${CXX_ATTRIBUTE_EXPORT}") + "${EXPORT_MACRO_NAME}" "${DEFINE_EXPORT}" ${CXX_ATTRIBUTE_EXPORT}) _generate_export_header_definition(IMPORT_DEFINITION " " - "${EXPORT_MACRO_NAME}" "${DEFINE_IMPORT}" "${CXX_ATTRIBUTE_IMPORT}") + "${EXPORT_MACRO_NAME}" "${DEFINE_IMPORT}" ${CXX_ATTRIBUTE_IMPORT}) _generate_export_header_definition(NO_EXPORT_DEFINITION " " "${NO_EXPORT_MACRO_NAME}" "${DEFINE_NO_EXPORT}" - "${CXX_ATTRIBUTE_NO_EXPORT}") - # The GNU spelling of deprecation shares the availability of the export - # attributes, so that the combined macros never mix C++11 attributes with - # the legacy spellings, which Clang rejects after __declspec. + ${CXX_ATTRIBUTE_NO_EXPORT}) _generate_export_header_definition(DEPRECATED_DEFINITION " " "${DEPRECATED_MACRO_NAME}" "${DEFINE_DEPRECATED}" - "${CXX_ATTRIBUTE_DEPRECATED}") + ${CXX_ATTRIBUTE_DEPRECATED}) + _generate_export_header_definition(DEPRECATED_MSG_DEFINITION " " + "${DEPRECATED_MACRO_NAME}_MSG(msg)" "${DEFINE_DEPRECATED_MSG}" + ${CXX_ATTRIBUTE_DEPRECATED_MSG}) + + # A C++11 attribute must precede __declspec in a declaration, so the + # combined macros place the deprecation first if it can expand to one. + foreach(visibility IN ITEMS EXPORT NO_EXPORT) + set(marker "${${visibility}_MACRO_NAME}") + if(_GEH_CXX_ATTRIBUTES) + set(DEPRECATED_${visibility} "${DEPRECATED_MACRO_NAME} ${marker}") + set(DEPRECATED_${visibility}_MSG + "${DEPRECATED_MACRO_NAME}_MSG(msg) ${marker}") + else() + set(DEPRECATED_${visibility} "${marker} ${DEPRECATED_MACRO_NAME}") + set(DEPRECATED_${visibility}_MSG + "${marker} ${DEPRECATED_MACRO_NAME}_MSG(msg)") + endif() + endforeach() configure_file("${CMAKE_CURRENT_FUNCTION_LIST_DIR}/exportheader.cmake.in" "${EXPORT_FILE_NAME}" @ONLY) diff --git a/Modules/exportheader.cmake.in b/Modules/exportheader.cmake.in index f57ee66051..029e7b19a7 100644 --- a/Modules/exportheader.cmake.in +++ b/Modules/exportheader.cmake.in @@ -25,12 +25,24 @@ @DEPRECATED_DEFINITION@ #endif +#ifndef @DEPRECATED_MACRO_NAME@_MSG +@DEPRECATED_MSG_DEFINITION@ +#endif + #ifndef @DEPRECATED_MACRO_NAME@_EXPORT -# define @DEPRECATED_MACRO_NAME@_EXPORT @EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ +# define @DEPRECATED_MACRO_NAME@_EXPORT @DEPRECATED_EXPORT@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_EXPORT_MSG +# define @DEPRECATED_MACRO_NAME@_EXPORT_MSG(msg) @DEPRECATED_EXPORT_MSG@ #endif #ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT -# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @NO_EXPORT_MACRO_NAME@ @DEPRECATED_MACRO_NAME@ +# define @DEPRECATED_MACRO_NAME@_NO_EXPORT @DEPRECATED_NO_EXPORT@ +#endif + +#ifndef @DEPRECATED_MACRO_NAME@_NO_EXPORT_MSG +# define @DEPRECATED_MACRO_NAME@_NO_EXPORT_MSG(msg) @DEPRECATED_NO_EXPORT_MSG@ #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/QtAutogen/Complex/Bdir/libB.cpp b/Tests/QtAutogen/Complex/Bdir/libB.cpp index d3b6753335..6df6106791 100644 --- a/Tests/QtAutogen/Complex/Bdir/libB.cpp +++ b/Tests/QtAutogen/Complex/Bdir/libB.cpp @@ -10,3 +10,8 @@ int LibB::foo() { return a.foo(); } + +DeprecatedLibB::DeprecatedLibB(QObject* parent) + : QObject(parent) +{ +} diff --git a/Tests/QtAutogen/Complex/Bdir/libB.h b/Tests/QtAutogen/Complex/Bdir/libB.h index 38dae87cbd..6c7a4030a7 100644 --- a/Tests/QtAutogen/Complex/Bdir/libB.h +++ b/Tests/QtAutogen/Complex/Bdir/libB.h @@ -19,4 +19,13 @@ private: LibA a; }; +// moc processes a class marked with a deprecation message only if the +// generated export header shows it the compiler-specific spelling. +class LIBB_DEPRECATED_EXPORT_MSG("use LibB") DeprecatedLibB : public QObject +{ + Q_OBJECT +public: + explicit DeprecatedLibB(QObject* parent = 0); +}; + #endif diff --git a/Tests/QtAutogen/Complex/main.cpp b/Tests/QtAutogen/Complex/main.cpp index 12f649f031..d1a7b86f3c 100644 --- a/Tests/QtAutogen/Complex/main.cpp +++ b/Tests/QtAutogen/Complex/main.cpp @@ -80,6 +80,7 @@ int main(int argv, char** args) yaf.doYaf(); LibC lc; + DeprecatedLibB dlb; lc.foo(); ResourceTester rt; diff --git a/Tests/RunCMake/GenerateExportHeader/GEH-deprecated-msg-check.cmake b/Tests/RunCMake/GenerateExportHeader/GEH-deprecated-msg-check.cmake new file mode 100644 index 0000000000..29751334d4 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/GEH-deprecated-msg-check.cmake @@ -0,0 +1,12 @@ +# The build of an object library of the deprecated_msg directory must warn +# with the message of each deprecation macro of the library it uses. +string(REGEX REPLACE "^deprecated_msg_([a-z]+).*" "\\1" library + "${deprecated_msg_target}") +foreach(macro IN ITEMS DEPRECATED_MSG DEPRECATED_EXPORT_MSG + DEPRECATED_NO_EXPORT_MSG) + if(NOT actual_stdout MATCHES "${library} ${macro}") + string(APPEND RunCMake_TEST_FAILED + "Building ${deprecated_msg_target} does not warn with the message " + "\"${library} ${macro}\".\n") + endif() +endforeach() diff --git a/Tests/RunCMake/GenerateExportHeader/GEH.cmake b/Tests/RunCMake/GenerateExportHeader/GEH.cmake index b1da7fd1d5..5d14ffee68 100644 --- a/Tests/RunCMake/GenerateExportHeader/GEH.cmake +++ b/Tests/RunCMake/GenerateExportHeader/GEH.cmake @@ -79,6 +79,7 @@ macro_add_test_library(libstatic) macro_add_test_library(libattributes) add_subdirectory(nodeprecated) +add_subdirectory(deprecated_msg) add_subdirectory(includeguard) if(NOT BORLAND) add_subdirectory(c_identifier) @@ -122,5 +123,8 @@ target_compile_definitions(GenerateExportHeader "SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\"" "BIN_DIR=\"${CMAKE_CURRENT_BINARY_DIR}\"" ) +if(COMPILER_HAS_DEPRECATED AND NOT COMPILER_HAS_DEPRECATED_MSG) + target_compile_definitions(GenerateExportHeader PRIVATE DEPRECATED_WITHOUT_MSG) +endif() include(${CMAKE_CURRENT_LIST_DIR}/GEH-failures.cmake) diff --git a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake index 5a5a7bf9fe..77043fcb84 100644 --- a/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake +++ b/Tests/RunCMake/GenerateExportHeader/RunCMakeTest.cmake @@ -24,6 +24,19 @@ function(run_GEH) --config Debug --target ${failure_test_target}) endforeach() + + file(STRINGS "${RunCMake_TEST_BINARY_DIR}/deprecated_msg_targets" + deprecated_msg_targets) + + # Generators print compiler warnings to either stream. + set(RunCMake_TEST_OUTPUT_MERGE 1) + foreach(deprecated_msg_target ${deprecated_msg_targets}) + run_cmake_command(GEH-deprecated-msg ${CMAKE_COMMAND} + --build . + --config Debug + --target ${deprecated_msg_target}) + endforeach() + unset(RunCMake_TEST_OUTPUT_MERGE) endfunction() # remove these flags from the environment if they have been set @@ -32,6 +45,8 @@ set(env_cxx_flags $ENV{CXXFLAGS}) if(env_cxx_flags) string(REPLACE "-fvisibility=hidden" "" env_cxx_flags "${env_cxx_flags}") string(REPLACE "-fvisibility-inlines-hidden" "" env_cxx_flags "${env_cxx_flags}") + # The deprecation message checks need warnings. + string(REGEX REPLACE "(^| )-w( |$)" " " env_cxx_flags "${env_cxx_flags}") set(ENV{CXXFLAGS} "${env_cxx_flags}") endif() run_GEH() diff --git a/Tests/RunCMake/GenerateExportHeader/deprecated_msg/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/deprecated_msg/CMakeLists.txt new file mode 100644 index 0000000000..69b2501163 --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/deprecated_msg/CMakeLists.txt @@ -0,0 +1,36 @@ +# Show that the compiler warning about a deprecated symbol includes the +# message given to the deprecation macros. The objects are only compiled, so +# the symbols need not be exported, and each is built in a separate step that +# checks the warnings. +add_library(deprecated_msg_libshared OBJECT EXCLUDE_FROM_ALL libshared.cpp) + +add_library(deprecated_msg_libattributes OBJECT EXCLUDE_FROM_ALL + libattributes.cpp) +set_property(TARGET deprecated_msg_libattributes PROPERTY CXX_STANDARD 14) + +set(targets deprecated_msg_libshared deprecated_msg_libattributes) + +# Only GCC and Clang support the GNU spelling that C++11 consumers get. +if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + add_library(deprecated_msg_libattributes_cxx11 OBJECT EXCLUDE_FROM_ALL + libattributes.cpp) + set_property(TARGET deprecated_msg_libattributes_cxx11 + PROPERTY CXX_STANDARD 11) + list(APPEND targets deprecated_msg_libattributes_cxx11) +endif() + +# Undo -Wno-deprecated-declarations from the environment. +if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") + foreach(target IN LISTS targets) + target_compile_options(${target} PRIVATE -Wdeprecated-declarations) + endforeach() +endif() + +# Messages are unsupported by some compilers, ignored by Oracle Developer +# Studio and not shown by OrangeC. +if(NOT COMPILER_HAS_DEPRECATED_MSG + OR CMAKE_CXX_COMPILER_ID MATCHES "^(SunPro|OrangeC)$") + set(targets "") +endif() +list(JOIN targets "\n" targets) +file(WRITE ${CMAKE_BINARY_DIR}/deprecated_msg_targets "${targets}") diff --git a/Tests/RunCMake/GenerateExportHeader/deprecated_msg/libattributes.cpp b/Tests/RunCMake/GenerateExportHeader/deprecated_msg/libattributes.cpp new file mode 100644 index 0000000000..7c28ee3f9a --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/deprecated_msg/libattributes.cpp @@ -0,0 +1,8 @@ +#include "libattributes.h" + +int use_deprecated_msg() +{ + return libattributes::function_deprecated_msg() + + libattributes::function_deprecated_exported_msg() + + libattributes::function_deprecated_excluded_msg(); +} diff --git a/Tests/RunCMake/GenerateExportHeader/deprecated_msg/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/deprecated_msg/libshared.cpp new file mode 100644 index 0000000000..d22d3a9abd --- /dev/null +++ b/Tests/RunCMake/GenerateExportHeader/deprecated_msg/libshared.cpp @@ -0,0 +1,8 @@ +#include "libshared.h" + +int use_deprecated_msg() +{ + return libshared::function_deprecated_msg() + + libshared::function_deprecated_exported_msg() + + libshared::function_deprecated_excluded_msg(); +} diff --git a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp index 7b66b5ea6f..8d3d7b4253 100644 --- a/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp +++ b/Tests/RunCMake/GenerateExportHeader/exportheader_test.cpp @@ -17,6 +17,15 @@ static void rtrim(std::string& str, char byte) } } +static void replace(std::string& str, std::string const& from, + std::string const& to) +{ + std::string::size_type const pos = str.find(from); + if (pos != std::string::npos) { + str.replace(pos, from.size(), to); + } +} + void compare(char const* refName, char const* testName) { std::ifstream ref; @@ -48,6 +57,11 @@ void compare(char const* refName, char const* testName) // on some platforms. rtrim(refLine, '\r'); rtrim(testLine, '\r'); +#ifdef DEPRECATED_WITHOUT_MSG + // Compilers without deprecation messages get the spelling without one. + replace(refLine, "__deprecated__(msg)", "__deprecated__"); + replace(refLine, "__declspec(deprecated(msg))", "__declspec(deprecated)"); +#endif if (refLine != testLine) { std::cout << "Ref and test are not the same:\n Ref: \"" << refLine << "\"\n Test: \"" << testLine << "\"\n"; @@ -110,6 +124,9 @@ int main() libshared::function_exported(); // libshared::function_deprecated(); LINK ERROR libshared::function_deprecated_exported(); + // libshared::function_deprecated_msg(); LINK ERROR + libshared::function_deprecated_exported_msg(); + // libshared::function_deprecated_excluded_msg(); LINK ERROR // libshared::function_excluded(); LINK ERROR // use_int(libshared::data); LINK ERROR @@ -159,6 +176,7 @@ int main() libstatic::function_exported(); libstatic::function_deprecated(); libstatic::function_deprecated_exported(); + libstatic::function_deprecated_exported_msg(); libstatic::function_excluded(); use_int(libstatic::data); @@ -191,6 +209,17 @@ int main() libattributes::function_exported(); libattributes::function_deprecated_exported(); // libattributes::function_excluded(); LINK ERROR + // libattributes::function_deprecated_msg(); LINK ERROR + libattributes::function_deprecated_exported_msg(); + // libattributes::function_deprecated_excluded_msg(); LINK ERROR + + // OrangeC cannot declare the deprecated class. +#ifndef __ORANGEC__ + { + libattributes::DeprecatedClass l; + l.method(); + } +#endif // use_int(libattributes::data); LINK ERROR use_int(libattributes::data_exported); diff --git a/Tests/RunCMake/GenerateExportHeader/libattributes/CMakeLists.txt b/Tests/RunCMake/GenerateExportHeader/libattributes/CMakeLists.txt index 2280034c5b..be399ba881 100644 --- a/Tests/RunCMake/GenerateExportHeader/libattributes/CMakeLists.txt +++ b/Tests/RunCMake/GenerateExportHeader/libattributes/CMakeLists.txt @@ -25,13 +25,17 @@ if(CMAKE_C_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") target_link_libraries(libattributes_c PRIVATE libattributes) endif() +# The C++11 consumer must not get the C++14 deprecation attribute, which +# Clang rejects with -pedantic-errors although __has_cpp_attribute reports it. if(CMAKE_CXX_COMPILER_ID MATCHES "^(GNU|Clang|AppleClang)$") - add_executable(libattributes_cxx98 main.cpp) - set_target_properties(libattributes_cxx98 PROPERTIES - CXX_STANDARD 98 - CXX_EXTENSIONS OFF - ) - target_compile_options(libattributes_cxx98 PRIVATE - -pedantic-errors ${no_line_marker_errors}) - target_link_libraries(libattributes_cxx98 PRIVATE libattributes) + foreach(standard IN ITEMS 98 11) + add_executable(libattributes_cxx${standard} main.cpp) + set_target_properties(libattributes_cxx${standard} PROPERTIES + CXX_STANDARD ${standard} + CXX_EXTENSIONS OFF + ) + target_compile_options(libattributes_cxx${standard} PRIVATE + -pedantic-errors ${no_line_marker_errors}) + target_link_libraries(libattributes_cxx${standard} PRIVATE libattributes) + endforeach() endif() diff --git a/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.cpp b/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.cpp index eefb4328eb..552e876116 100644 --- a/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.cpp @@ -36,6 +36,14 @@ int libattributes::ExportedClass::method_excluded() const return 0; } +// OrangeC cannot declare the deprecated class. +#ifndef __ORANGEC__ +int libattributes::DeprecatedClass::method() const +{ + return 0; +} +#endif + int libattributes::function() { return 0; @@ -56,6 +64,21 @@ int libattributes::function_excluded() return 0; } +int libattributes::function_deprecated_msg() +{ + return 0; +} + +int libattributes::function_deprecated_exported_msg() +{ + return 0; +} + +int libattributes::function_deprecated_excluded_msg() +{ + return 0; +} + int const libattributes::data = 1; int const libattributes::data_exported = 1; diff --git a/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.h b/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.h index 2014553a21..f6d665aeda 100644 --- a/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.h +++ b/Tests/RunCMake/GenerateExportHeader/libattributes/libattributes.h @@ -32,6 +32,15 @@ public: LIBATTRIBUTES_NO_EXPORT int method_excluded() const; }; +// OrangeC fails to parse two __declspec specifiers on a class. +#ifndef __ORANGEC__ +class LIBATTRIBUTES_DEPRECATED_EXPORT_MSG("use ExportedClass") DeprecatedClass +{ +public: + int method() const; +}; +#endif + int function(); LIBATTRIBUTES_EXPORT int function_exported(); @@ -40,6 +49,16 @@ LIBATTRIBUTES_DEPRECATED_EXPORT int function_deprecated_exported(); LIBATTRIBUTES_NO_EXPORT int function_excluded(); +LIBATTRIBUTES_DEPRECATED_MSG("libattributes DEPRECATED_MSG") +int function_deprecated_msg(); + +LIBATTRIBUTES_DEPRECATED_EXPORT_MSG("libattributes DEPRECATED_EXPORT_MSG") +int function_deprecated_exported_msg(); + +LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG( + "libattributes DEPRECATED_NO_EXPORT_MSG") +int function_deprecated_excluded_msg(); + extern int const data; LIBATTRIBUTES_EXPORT extern int const data_exported; diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp index 328ef6ffb1..3342eb1f50 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.cpp @@ -101,6 +101,21 @@ int libshared::function_deprecated_exported() return 0; } +int libshared::function_deprecated_msg() +{ + return 0; +} + +int libshared::function_deprecated_exported_msg() +{ + return 0; +} + +int libshared::function_deprecated_excluded_msg() +{ + return 0; +} + int libshared::function_excluded() { return 0; diff --git a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h index 6574bd547e..cb5c94b9af 100644 --- a/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h +++ b/Tests/RunCMake/GenerateExportHeader/libshared/libshared.h @@ -67,6 +67,15 @@ int LIBSHARED_DEPRECATED function_deprecated(); int LIBSHARED_DEPRECATED_EXPORT function_deprecated_exported(); +int LIBSHARED_DEPRECATED_MSG("libshared DEPRECATED_MSG") + function_deprecated_msg(); + +int LIBSHARED_DEPRECATED_EXPORT_MSG("libshared DEPRECATED_EXPORT_MSG") + function_deprecated_exported_msg(); + +int LIBSHARED_DEPRECATED_NO_EXPORT_MSG("libshared DEPRECATED_NO_EXPORT_MSG") + function_deprecated_excluded_msg(); + int LIBSHARED_NO_EXPORT function_excluded(); extern int const data; diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp index e1d125511d..531b060b0d 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.cpp @@ -113,6 +113,11 @@ int libstatic::function_deprecated_exported() return 0; } +int libstatic::function_deprecated_exported_msg() +{ + return 0; +} + int libstatic::function_excluded() { return 0; diff --git a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h index 1017e1205c..3107d67dbe 100644 --- a/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h +++ b/Tests/RunCMake/GenerateExportHeader/libstatic/libstatic.h @@ -73,6 +73,9 @@ int LIBSTATIC_DEPRECATED function_deprecated(); int LIBSTATIC_DEPRECATED_EXPORT function_deprecated_exported(); +int LIBSTATIC_DEPRECATED_EXPORT_MSG("use function_exported") + function_deprecated_exported_msg(); + int LIBSTATIC_NO_EXPORT function_excluded(); extern int const data; diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libattributes_export.h index 06b766373e..3cf3df73b9 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libattributes_export.h @@ -9,7 +9,7 @@ # ifndef LIBATTRIBUTES_EXPORT # ifdef libattributes_EXPORTS /* We are building this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllexport) # define LIBATTRIBUTES_EXPORT [[gnu::dllexport]] # endif @@ -19,7 +19,7 @@ # endif # else /* We are using this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllimport) # define LIBATTRIBUTES_EXPORT [[gnu::dllimport]] # endif @@ -36,7 +36,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -46,12 +51,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h index e0e423d3e5..539eea8dc5 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h index cfc1187a64..de5250c2c2 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Cygwin/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libattributes_export.h index daddd87ddc..5a3c08deea 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libattributes_export.h @@ -22,7 +22,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -32,12 +37,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h index e2c132d7f6..1f9a9a7df8 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h index b54eef5295..7e98c5976e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Empty/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libattributes_export.h index 91a406e799..0580147b27 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libattributes_export.h @@ -9,7 +9,7 @@ # ifndef LIBATTRIBUTES_EXPORT # ifdef libattributes_EXPORTS /* We are building this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllexport) # define LIBATTRIBUTES_EXPORT [[gnu::dllexport]] # endif @@ -19,7 +19,7 @@ # endif # else /* We are using this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllimport) # define LIBATTRIBUTES_EXPORT [[gnu::dllimport]] # endif @@ -36,7 +36,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -46,12 +51,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h index 6013dcd40a..0311af3b5a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED __declspec(deprecated) #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h index 7a5a573dbd..ebcc3773b9 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/MinGW/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED __declspec(deprecated) #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libattributes_export.h index de090441d1..29aedd6ced 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libattributes_export.h @@ -9,7 +9,7 @@ # ifndef LIBATTRIBUTES_EXPORT # ifdef libattributes_EXPORTS /* We are building this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::visibility) # define LIBATTRIBUTES_EXPORT [[gnu::visibility("default")]] # endif @@ -19,7 +19,7 @@ # endif # else /* We are using this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::visibility) # define LIBATTRIBUTES_EXPORT [[gnu::visibility("default")]] # endif @@ -31,7 +31,7 @@ # endif # ifndef LIBATTRIBUTES_NO_EXPORT -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::visibility) # define LIBATTRIBUTES_NO_EXPORT [[gnu::visibility("hidden")]] # endif @@ -43,7 +43,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -53,12 +58,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h index 388dbc9d91..f48863c0ed 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h index cfc1187a64..de5250c2c2 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libattributes_export.h index 7824f5c8b7..d228f044f8 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libattributes_export.h @@ -22,7 +22,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -32,12 +37,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h index 97b988ddcc..b89f9161a6 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED __attribute__ ((__deprecated__)) #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h index cfc1187a64..de5250c2c2 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/UNIX_DeprecatedOnly/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED __attribute__ ((__deprecated__)) #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) __attribute__ ((__deprecated__(msg))) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libattributes_export.h index 91a406e799..0580147b27 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libattributes_export.h @@ -9,7 +9,7 @@ # ifndef LIBATTRIBUTES_EXPORT # ifdef libattributes_EXPORTS /* We are building this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllexport) # define LIBATTRIBUTES_EXPORT [[gnu::dllexport]] # endif @@ -19,7 +19,7 @@ # endif # else /* We are using this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllimport) # define LIBATTRIBUTES_EXPORT [[gnu::dllimport]] # endif @@ -36,7 +36,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -46,12 +51,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h index 6013dcd40a..0311af3b5a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED __declspec(deprecated) #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h index 7a5a573dbd..ebcc3773b9 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32-Clang/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED __declspec(deprecated) #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libattributes_export.h index 91a406e799..0580147b27 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libattributes_export.h @@ -9,7 +9,7 @@ # ifndef LIBATTRIBUTES_EXPORT # ifdef libattributes_EXPORTS /* We are building this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllexport) # define LIBATTRIBUTES_EXPORT [[gnu::dllexport]] # endif @@ -19,7 +19,7 @@ # endif # else /* We are using this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllimport) # define LIBATTRIBUTES_EXPORT [[gnu::dllimport]] # endif @@ -36,7 +36,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -46,12 +51,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h index 6013dcd40a..0311af3b5a 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED __declspec(deprecated) #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h index 7a5a573dbd..ebcc3773b9 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/Win32/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED __declspec(deprecated) #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) __declspec(deprecated(msg)) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libattributes_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libattributes_export.h index 4c06520738..ccc10939d2 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libattributes_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libattributes_export.h @@ -9,7 +9,7 @@ # ifndef LIBATTRIBUTES_EXPORT # ifdef libattributes_EXPORTS /* We are building this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllexport) # define LIBATTRIBUTES_EXPORT [[gnu::dllexport]] # endif @@ -19,7 +19,7 @@ # endif # else /* We are using this library */ -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) # if __has_cpp_attribute(gnu::dllimport) # define LIBATTRIBUTES_EXPORT [[gnu::dllimport]] # endif @@ -36,7 +36,12 @@ #endif #ifndef LIBATTRIBUTES_DEPRECATED -# if defined(__cplusplus) && __cplusplus >= 201103L && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED [[deprecated]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED) # if __has_cpp_attribute(gnu::deprecated) # define LIBATTRIBUTES_DEPRECATED [[gnu::deprecated]] # endif @@ -46,12 +51,36 @@ # endif #endif +#ifndef LIBATTRIBUTES_DEPRECATED_MSG +# if (defined(__cplusplus) && __cplusplus >= 201402L || defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) +# if __has_cpp_attribute(deprecated) >= 201309L +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[deprecated(msg)]] +# endif +# endif +# if defined(__cplusplus) && __cplusplus >= 201103L && !defined(__SUNPRO_CC) && defined(__has_cpp_attribute) && !defined(Q_MOC_RUN) && !defined(LIBATTRIBUTES_DEPRECATED_MSG) +# if __has_cpp_attribute(gnu::deprecated) +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) [[gnu::deprecated(msg)]] +# endif +# endif +# ifndef LIBATTRIBUTES_DEPRECATED_MSG +# define LIBATTRIBUTES_DEPRECATED_MSG(msg) +# endif +#endif + #ifndef LIBATTRIBUTES_DEPRECATED_EXPORT -# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_EXPORT #endif #ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT -# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_NO_EXPORT LIBATTRIBUTES_DEPRECATED +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT LIBATTRIBUTES_DEPRECATED LIBATTRIBUTES_NO_EXPORT +#endif + +#ifndef LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG +# define LIBATTRIBUTES_DEPRECATED_NO_EXPORT_MSG(msg) LIBATTRIBUTES_DEPRECATED_MSG(msg) LIBATTRIBUTES_NO_EXPORT #endif /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h index e64c45fb97..225119a8fb 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libshared_export.h @@ -25,14 +25,26 @@ # define LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_MSG +# define LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_EXPORT # define LIBSHARED_DEPRECATED_EXPORT LIBSHARED_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_EXPORT_MSG +# define LIBSHARED_DEPRECATED_EXPORT_MSG(msg) LIBSHARED_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSHARED_DEPRECATED_NO_EXPORT # define LIBSHARED_DEPRECATED_NO_EXPORT LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED #endif +#ifndef LIBSHARED_DEPRECATED_NO_EXPORT_MSG +# define LIBSHARED_DEPRECATED_NO_EXPORT_MSG(msg) LIBSHARED_NO_EXPORT LIBSHARED_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSHARED_NO_DEPRECATED diff --git a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h index b54eef5295..7e98c5976e 100644 --- a/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h +++ b/Tests/RunCMake/GenerateExportHeader/reference/WinEmpty/libstatic_export.h @@ -25,14 +25,26 @@ # define LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_MSG +# define LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_EXPORT # define LIBSTATIC_DEPRECATED_EXPORT LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_EXPORT_MSG(msg) LIBSTATIC_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + #ifndef LIBSTATIC_DEPRECATED_NO_EXPORT # define LIBSTATIC_DEPRECATED_NO_EXPORT LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED #endif +#ifndef LIBSTATIC_DEPRECATED_NO_EXPORT_MSG +# define LIBSTATIC_DEPRECATED_NO_EXPORT_MSG(msg) LIBSTATIC_NO_EXPORT LIBSTATIC_DEPRECATED_MSG(msg) +#endif + /* NOLINTNEXTLINE(readability-avoid-unconditional-preprocessor-if) */ #if 0 /* DEFINE_NO_DEPRECATED */ # ifndef LIBSTATIC_NO_DEPRECATED