* Defend public headers against inclusion of Windows.h ... which defines some nasty function-like macros `min` and `max` when `_NOMINMAX` isn't defined. We prevent expansion as a function-like macro by inserting some token(s) between `min`/`max` and the following `(`. Most commonly that means wrapping the entire qualified-name in `()` a la `(std::min)(x, y)`, but an explicit template argument list (`std::min<int>(x, y)`) works as well. * clang-format all the things * Test coverage I assume that the `azure-meow-common` headers are fully covered by the tests for the `azure-meow-woof` SDKs.
16 lines
675 B
C++
16 lines
675 B
C++
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
// Define `min` and `max` as function-like macros before including all public
|
|
// headers to ensure that uses of those identifiers are defended against
|
|
// expansion as function-like macros. Define `small` as an object-like macro to
|
|
// ensure that identifier isn't used at all. Windows.h is badly behaved and
|
|
// defines similar macros with these names and we want to ensure the SDK headers
|
|
// function even when a naive user includes Windows.h first.
|
|
//
|
|
#define small FAIL><TO][COMPILE)(VERY{{{LOUDLY!!!
|
|
#define max(x, y) small
|
|
#define min(x, y) small
|
|
|
|
#include <azure/template.hpp>
|