forked from OSchip/llvm-project
[libc++] Add a few missing min/max macro push/pop
Also, improve the test for nasty macros to define min and max, so this will be caught in the future. Differential Revision: https://reviews.llvm.org/D128655
This commit is contained in:
parent
fc7f7260a6
commit
a2c1603206
|
@ -31,6 +31,9 @@
|
|||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
namespace ranges {
|
||||
|
@ -123,6 +126,8 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
|
||||
#endif // _LIBCPP___ALGORITHM_RANGES_MINMAX_H
|
||||
|
|
|
@ -40,6 +40,9 @@
|
|||
# pragma GCC system_header
|
||||
#endif
|
||||
|
||||
_LIBCPP_PUSH_MACROS
|
||||
#include <__undef_macros>
|
||||
|
||||
_LIBCPP_BEGIN_NAMESPACE_STD
|
||||
|
||||
#if _LIBCPP_STD_VER > 17 && !defined(_LIBCPP_HAS_NO_INCOMPLETE_RANGES)
|
||||
|
@ -298,4 +301,6 @@ inline namespace __cpo {
|
|||
|
||||
_LIBCPP_END_NAMESPACE_STD
|
||||
|
||||
_LIBCPP_POP_MACROS
|
||||
|
||||
#endif // _LIBCPP___RANGES_DROP_VIEW_H
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define min THIS IS A NASTY MACRO!
|
||||
#define max THIS IS A NASTY MACRO!
|
||||
|
||||
#include <map>
|
||||
|
||||
int main(int, char**) {
|
||||
std::map<int, int> m;
|
||||
((void)m);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -136,6 +136,10 @@
|
|||
#define Xp NASTY_MACRO
|
||||
#define Xs NASTY_MACRO
|
||||
|
||||
// The classic Windows min/max macros
|
||||
#define min NASTY_MACRO
|
||||
#define max NASTY_MACRO
|
||||
|
||||
/*
|
||||
BEGIN-SCRIPT
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
|
||||
#define min THIS IS A NASTY MACRO!
|
||||
#define max THIS IS A NASTY MACRO!
|
||||
|
||||
#include <cmath>
|
||||
|
||||
int main(int, char**) { return 0; }
|
Loading…
Reference in New Issue