Enable no-rtti (#2963)

* Enable no-rtti
This commit is contained in:
Victor Vazquez 2021-10-14 18:12:03 -07:00 committed by GitHub
parent 27747b1898
commit f4e6390dff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 576 additions and 5 deletions

View File

@ -13,6 +13,7 @@ option(BUILD_TRANSPORT_CURL "Build an HTTP transport implementation with CURL" O
option(BUILD_TRANSPORT_WINHTTP "Build an HTTP transport implementation with WIN HTTP" OFF)
option(BUILD_TRANSPORT_CUSTOM "Implementation for AzureSdkGetCustomHttpTransport function must be linked to the final application" OFF)
option(BUILD_TESTING "Build test cases" OFF)
option(BUILD_RTTI "Build libraries with run-time type information." ON)
option(BUILD_CODE_COVERAGE "Build gcov targets for HTML and XML reports. Requires debug build and BUILD_TESTING" OFF)
option(BUILD_DOCUMENTATION "Create HTML based API documentation (requires Doxygen)" OFF)
option(RUN_LONG_UNIT_TESTS "Tests that takes more than 5 minutes to complete. No effect if BUILD_TESTING is OFF" OFF)

View File

@ -0,0 +1,36 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# SPDX-License-Identifier: MIT
# The option is added again just like from the main CMakeList
# to enable discovering the option directly from each project.
option(BUILD_RTTI "Build libraries with run-time type information." ON)
macro(az_rtti_setup targetName packagePart rttiHeaderPath)
if (BUILD_RTTI)
target_compile_definitions(${targetName} PUBLIC AZ_RTTI)
# Patch azure_rtti for installation with RTTI enabled.
set(AZ_${packagePart}_RTTI "*/ + 1 /*")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/inc/${rttiHeaderPath}"
"${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${rttiHeaderPath}"
@ONLY
)
unset(AZ_${packagePart}_RTTI)
get_filename_component(rttiHeaderDir ${rttiHeaderPath} DIRECTORY)
install(
FILES "${CMAKE_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/${rttiHeaderPath}"
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${rttiHeaderDir}"
)
unset(rttiHeaderDir)
else()
message(STATUS "Building library ${targetName} without RTTI")
if(MSVC)
target_compile_options(${targetName} PUBLIC /GR-)
else()
target_compile_options(${targetName} PUBLIC -fno-rtti)
endif()
endif()
endmacro()

View File

@ -51,6 +51,15 @@ jobs:
CC: '/usr/bin/gcc-9'
CXX: '/usr/bin/g++-9'
BuildArgs: '-j 10'
Linux_x64_gcc9_no_rtti:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
VcpkgInstall: 'curl[ssl] libxml2 openssl'
VCPKG_DEFAULT_TRIPLET: 'x64-linux'
CC: '/usr/bin/gcc-9'
CXX: '/usr/bin/g++-9'
BuildArgs: '-j 10'
CmakeArgs: ' -DBUILD_RTTI=OFF'
Linux_x64:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
@ -74,6 +83,15 @@ jobs:
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: x64
BuildArgs: '--parallel 8'
Win_x64_no_rtti:
Pool: azsdk-pool-mms-win-2019-general
OSVmImage: MMS2019
VcpkgInstall: 'curl[winssl] libxml2'
VCPKG_DEFAULT_TRIPLET: 'x64-windows-static'
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: x64
BuildArgs: '--parallel 8'
CmakeArgs: ' -DBUILD_RTTI=OFF'
Ubuntu_20_x64_clang:
Pool: azsdk-pool-mms-ubuntu-2004-general
OSVmImage: MMSUbuntu20.04

View File

@ -57,6 +57,13 @@ jobs:
CmakeArgs: ' -DBUILD_TESTING=ON -DBUILD_PERFORMANCE_TESTS=ON -DRUN_LONG_UNIT_TESTS=ON -DCMAKE_BUILD_TYPE=Release'
AZURE_CORE_ENABLE_JSON_TESTS: 1
BuildArgs: '-j 4'
Ubuntu20_x64_no_rtti:
Pool: azsdk-pool-mms-ubuntu-1804-general
OSVmImage: MMSUbuntu18.04
VcpkgInstall: 'curl[ssl] libxml2 openssl'
VCPKG_DEFAULT_TRIPLET: 'x64-linux'
CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release'
BuildArgs: '-j 4'
# Not asking for any transport adapter will default to OS -> windows:winHttp or !windows:libcurl
Win_x86_with_unit_test_winHttp:
Pool: azsdk-pool-mms-win-2019-general
@ -68,6 +75,15 @@ jobs:
CmakeArgs: ' -DBUILD_TESTING=ON -DRUN_LONG_UNIT_TESTS=ON -DBUILD_PERFORMANCE_TESTS=ON '
BuildArgs: '-v --parallel 8'
AZURE_CORE_ENABLE_JSON_TESTS: 1
Win_x86_no_rtti_whit_unit_test:
Pool: azsdk-pool-mms-win-2019-general
OSVmImage: MMS2019
VcpkgInstall: 'libxml2'
VCPKG_DEFAULT_TRIPLET: 'x86-windows-static'
CMAKE_GENERATOR: 'Visual Studio 16 2019'
CMAKE_GENERATOR_PLATFORM: Win32
CmakeArgs: ' -DBUILD_RTTI=OFF -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=ON'
BuildArgs: '-v --parallel 8'
Win_x64_with_unit_test_winHttp:
Pool: azsdk-pool-mms-win-2019-general
OSVmImage: MMS2019

View File

@ -17,6 +17,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -71,6 +72,7 @@ set(
inc/azure/core/internal/strings.hpp
inc/azure/core/io/body_stream.hpp
inc/azure/core/azure_assert.hpp
inc/azure/core/rtti.hpp
inc/azure/core/base64.hpp
inc/azure/core/case_insensitive_containers.hpp
inc/azure/core/context.hpp
@ -163,6 +165,12 @@ az_vcpkg_export(
"azure/core/dll_import_export.hpp"
)
az_rtti_setup(
azure-core
CORE
"azure/core/rtti.hpp"
)
if(BUILD_TESTING)
# define a symbol that enables some test hooks in code
add_compile_definitions(TESTING_BUILD)

View File

@ -11,6 +11,7 @@
#include "azure/core/azure_assert.hpp"
#include "azure/core/datetime.hpp"
#include "azure/core/dll_import_export.hpp"
#include "azure/core/rtti.hpp"
#include <atomic>
#include <chrono>
@ -79,8 +80,9 @@ namespace Azure { namespace Core {
std::atomic<DateTime::rep> Deadline;
Context::Key Key;
std::shared_ptr<void> Value;
#if defined(AZ_CORE_RTTI)
const std::type_info& ValueType;
#endif
static constexpr DateTime::rep ToDateTimeRepresentation(DateTime const& dateTime)
{
return dateTime.time_since_epoch().count();
@ -92,16 +94,22 @@ namespace Azure { namespace Core {
}
explicit ContextSharedState()
: Deadline(ToDateTimeRepresentation((DateTime::max)())), Value(nullptr),
: Deadline(ToDateTimeRepresentation((DateTime::max)())), Value(nullptr)
#if defined(AZ_CORE_RTTI)
,
ValueType(typeid(std::nullptr_t))
#endif
{
}
explicit ContextSharedState(
const std::shared_ptr<ContextSharedState>& parent,
DateTime const& deadline)
: Parent(parent), Deadline(ToDateTimeRepresentation(deadline)), Value(nullptr),
: Parent(parent), Deadline(ToDateTimeRepresentation(deadline)), Value(nullptr)
#if defined(AZ_CORE_RTTI)
,
ValueType(typeid(std::nullptr_t))
#endif
{
}
@ -112,7 +120,11 @@ namespace Azure { namespace Core {
Context::Key const& key,
T value) // NOTE, should this be T&&
: Parent(parent), Deadline(ToDateTimeRepresentation(deadline)), Key(key),
Value(std::make_shared<T>(std::move(value))), ValueType(typeid(T))
Value(std::make_shared<T>(std::move(value)))
#if defined(AZ_CORE_RTTI)
,
ValueType(typeid(T))
#endif
{
}
};
@ -197,8 +209,10 @@ namespace Azure { namespace Core {
{
if (ptr->Key == key)
{
#if defined(AZ_CORE_RTTI)
AZURE_ASSERT_MSG(
typeid(T) == ptr->ValueType, "Type mismatch for Context::TryGetValue().");
#endif
outputValue = *reinterpret_cast<const T*>(ptr->Value.get());
return true;

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details When RTTI is enabled, defines a macro `AZ_CORE_RTTI`. When
* the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_CORE_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_CORE_RTTI@*/)
#define AZ_CORE_RTTI
#endif

View File

@ -6,6 +6,7 @@
#include "http_test.hpp"
#include <azure/core/http/http.hpp>
#include <azure/core/internal/io/null_body_stream.hpp>
#include <azure/core/rtti.hpp>
#include <string>
#include <utility>
@ -155,9 +156,11 @@ namespace Azure { namespace Core { namespace Test {
Url url("http://test.com");
Http::Request req(httpMethod, url);
#if defined(AZ_CORE_RTTI)
Azure::Core::IO::_internal::NullBodyStream* d
= dynamic_cast<Azure::Core::IO::_internal::NullBodyStream*>(req.GetBodyStream());
EXPECT_TRUE(d);
#endif
req.StartTry();
@ -172,8 +175,10 @@ namespace Azure { namespace Core { namespace Test {
EXPECT_FALSE(headers.count("name"));
#if defined(AZ_CORE_RTTI)
d = dynamic_cast<Azure::Core::IO::_internal::NullBodyStream*>(req.GetBodyStream());
EXPECT_TRUE(d);
#endif
}
{
@ -192,14 +197,18 @@ namespace Azure { namespace Core { namespace Test {
Http::Request req(httpMethod, url, &stream);
#if defined(AZ_CORE_RTTI)
Azure::Core::IO::MemoryBodyStream* d
= dynamic_cast<Azure::Core::IO::MemoryBodyStream*>(req.GetBodyStream());
EXPECT_TRUE(d);
#endif
req.StartTry();
#if defined(AZ_CORE_RTTI)
d = dynamic_cast<Azure::Core::IO::MemoryBodyStream*>(req.GetBodyStream());
EXPECT_TRUE(d);
#endif
// Verify that StartTry rewound the stream back.
auto getStream = req.GetBodyStream();

View File

@ -2,6 +2,7 @@
// SPDX-License-Identifier: MIT
#include <azure/core/platform.hpp>
#include <azure/core/rtti.hpp>
#if defined(AZ_PLATFORM_POSIX)
#include <fcntl.h>
@ -472,6 +473,7 @@ namespace Azure { namespace Core { namespace Test {
}
}
#if defined(AZ_CORE_RTTI)
TEST_P(TransportAdapter, dynamicCast)
{
Azure::Core::Url host("http://unresolvedHost.org/get");
@ -490,6 +492,7 @@ namespace Azure { namespace Core { namespace Test {
EXPECT_THROW((void)dynamic_cast<const std::range_error&>(err), std::bad_cast);
}
}
#endif
TEST_P(TransportAdapter, SizePutFromFile)
{

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -76,6 +77,12 @@ az_vcpkg_export(
"azure/identity/dll_import_export.hpp"
)
az_rtti_setup(
azure-identity
IDENTITY
"azure/identity/rtti.hpp"
)
if(BUILD_TESTING)
# tests
if (NOT AZ_ALL_LIBRARIES)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details When RTTI is enabled, defines a macro `AZ_IDENTITY_RTTI`. When
* the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_IDENTITY_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_IDENTITY_RTTI@*/)
#define AZ_IDENTITY_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -94,3 +95,9 @@ az_vcpkg_export(
SECURITY_KEYVAULT_CERTIFICATES
"azure/keyvault/certificates/dll_import_export.hpp"
)
az_rtti_setup(
azure-security-keyvault-certificates
SECURITY_KEYVAULT_CERTIFICATES
"azure/keyvault/certificates/rtti.hpp"
)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details Checks whenever RTTI is enabled and exports the symbol
* `AZ_SECURITY_KEYVAULT_CERTIFICATES_RTTI`. When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_SECURITY_KEYVAULT_CERTIFICATES_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_SECURITY_KEYVAULT_CERTIFICATES_RTTI@*/)
#define AZ_SECURITY_KEYVAULT_CERTIFICATES_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -134,3 +135,9 @@ az_vcpkg_export(
SECURITY_KEYVAULT_KEYS
"azure/keyvault/keys/dll_import_export.hpp"
)
az_rtti_setup(
azure-security-keyvault-keys
SECURITY_KEYVAULT_KEYS
"azure/keyvault/keys/rtti.hpp"
)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details Checks whenever RTTI is enabled and exports the symbol
* `AZ_SECURITY_KEYVAULT_KEYS_RTTI`. When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_SECURITY_KEYVAULT_KEYS_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_SECURITY_KEYVAULT_KEYS_RTTI@*/)
#define AZ_SECURITY_KEYVAULT_KEYS_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -100,6 +101,12 @@ endif()
az_vcpkg_export(
azure-security-keyvault-secrets
SECURITY_KEYVAULT_KEYS
SECURITY_KEYVAULT_SECRETS
"azure/keyvault/secrets/dll_import_export.hpp"
)
az_rtti_setup(
azure-security-keyvault-secrets
SECURITY_KEYVAULT_SECRETS
"azure/keyvault/secrets/rtti.hpp"
)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details Checks whenever RTTI is enabled and exports the symbol
* `AZ_SECURITY_KEYVAULT_SECRETS_RTTI`. When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_SECURITY_KEYVAULT_SECRETS_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_SECURITY_KEYVAULT_SECRETS_RTTI@*/)
#define AZ_SECURITY_KEYVAULT_SECRETS_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -81,6 +82,12 @@ az_vcpkg_export(
"azure/storage/blobs/dll_import_export.hpp"
)
az_rtti_setup(
azure-storage-blobs
STORAGE_BLOBS
"azure/storage/blobs/rtti.hpp"
)
# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF
create_code_coverage(storage azure-storage-blobs azure-storage-test)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details When RTTI is enabled, defines a macro `AZ_STORAGE_BLOBS_RTTI`.
* When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_STORAGE_BLOBS_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_STORAGE_BLOBS_RTTI@*/)
#define AZ_STORAGE_BLOBS_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -99,6 +100,12 @@ az_vcpkg_export(
"azure/storage/common/dll_import_export.hpp"
)
az_rtti_setup(
azure-storage-common
STORAGE_COMMON
"azure/storage/common/rtti.hpp"
)
# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF
# excluding json from coverage report
create_code_coverage(storage azure-storage-common azure-storage-test "inc/azure/storage/common/json*")

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details When RTTI is enabled, defines a macro `AZ_STORAGE_COMMON_RTTI`.
* When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_STORAGE_COMMON_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_STORAGE_COMMON_RTTI@*/)
#define AZ_STORAGE_COMMON_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -82,6 +83,12 @@ az_vcpkg_export(
"azure/storage/files/datalake/dll_import_export.hpp"
)
az_rtti_setup(
azure-storage-files-datalake
STORAGE_FILES_DATALAKE
"azure/storage/files/datalake/rtti.hpp"
)
# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF
create_code_coverage(storage azure-storage-files-datalake azure-storage-test)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details Checks whenever RTTI is enabled and exports the symbol
* `AZ_STORAGE_FILES_DATALAKE_RTTI`. When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_STORAGE_FILES_DATALAKE_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_STORAGE_FILES_DATALAKE_RTTI@*/)
#define AZ_STORAGE_FILES_DATALAKE_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -80,6 +81,12 @@ az_vcpkg_export(
"azure/storage/files/shares/dll_import_export.hpp"
)
az_rtti_setup(
azure-storage-files-shares
STORAGE_FILES_SHARES
"azure/storage/files/shares/rtti.hpp"
)
# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF
create_code_coverage(storage azure-storage-files-shares azure-storage-test)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details Checks whenever RTTI is enabled and exports the symbol
* `AZ_STORAGE_FILES_SHARES_RTTI`. When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_STORAGE_FILES_SHARES_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_STORAGE_FILES_SHARES_RTTI@*/)
#define AZ_STORAGE_FILES_SHARES_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -71,6 +72,12 @@ az_vcpkg_export(
STORAGE_QUEUES
"azure/storage/queues/dll_import_export.hpp"
)
az_rtti_setup(
azure-storage-queues
STORAGE_QUEUES
"azure/storage/queues/rtti.hpp"
)
# coverage. Has no effect if BUILD_CODE_COVERAGE is OFF
create_code_coverage(storage azure-storage-queues azure-storage-test)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details When RTTI is enabled, defines a macro `AZ_STORAGE_QUEUES_RTTI`.
* When the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_STORAGE_QUEUES_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_STORAGE_QUEUES_RTTI@*/)
#define AZ_STORAGE_QUEUES_RTTI
#endif

View File

@ -16,6 +16,7 @@ include(AzureCodeCoverage)
include(AzureTransportAdapters)
include(AzureDoxygen)
include(AzureGlobalCompileOptions)
include(AzureConfigRTTI)
az_vcpkg_integrate()
@ -68,6 +69,12 @@ az_vcpkg_export(
"azure/template/dll_import_export.hpp"
)
az_rtti_setup(
azure-template
TEMPLATE
"azure/template/rtti.hpp"
)
if(BUILD_TESTING)
# tests
add_subdirectory(test)

View File

@ -0,0 +1,36 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// SPDX-License-Identifier: MIT
/**
* @file
* @brief Run-time type info enable or disable.
*
* @details When RTTI is enabled, defines a macro `AZ_TEMPLATE_RTTI`. When
* the macro is not defined, RTTI is disabled.
*
* @details Each library has this header file. These headers are being configured by
* `az_rtti_setup()` CMake macro. CMake install will patch this file during installation, depending
* on the build flags.
*/
#pragma once
/**
* @def AZ_TEMPLATE_RTTI
* @brief A macro indicating whether the code is built with RTTI or not.
*
* @details `AZ_RTTI` could be defined while building the Azure SDK with CMake, however, after
* the build is completed, that information is not preserved for the code that consumes Azure SDK
* headers, unless the code that consumes the SDK is the part of the same build process. To address
* this issue, CMake install would patch the header it places in the installation directory, so that
* condition:
* `#if defined(AZ_RTTI) || (0)`
* becomes, effectively,
* `#if defined(AZ_RTTI) || (0 + 1)`
* when the library was built with RTTI support, and will make no changes to the
* condition when it was not.
*/
#if defined(AZ_RTTI) || (0 /*@AZ_TEMPLATE_RTTI@*/)
#define AZ_TEMPLATE_RTTI
#endif