[compiler-rt] [libcxx] [openmp] [clang] [llvm] [libc] [flang] [mlir] [lldb] [clang-tools-extra] [lld] [libc++][streams] P1759R6: Native handles and file streams (PR #76632)

Hristo Hristov via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 3 10:33:07 PST 2024


================
@@ -0,0 +1,101 @@
+//===----------------------------------------------------------------------===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_TEST_HELPERS_H
+#define TEST_STD_INPUT_OUTPUT_FILE_STREAMS_FSTREAMS_TEST_HELPERS_H
+
+#include "test_macros.h"
+
+#if TEST_STD_VER >= 26
+
+#  include <cassert>
+#  include <concepts>
+#  include <cstdio>
+#  include <fstream>
+#  include <filesystem>
+#  include <type_traits>
+#  include <utility>
+
+#  if defined(_WIN32)
+#    define WIN32_LEAN_AND_MEAN
+#    define NOMINMAX
+#    include <io.h>
+#    include <windows.h>
+#  else
+#    include <fcntl.h>
+#  endif
+
+#  include "check_assertion.h"
+#  include "platform_support.h"
+#  include "types.h"
+
+inline bool is_handle_valid(NativeHandleT handle) {
----------------
H-G-Hristov wrote:

I admit this looks ugly :)

Or I could move `if TEST_STD_VER >= 26` right before `#  include "check_assertion.h"`, where it is needed:}

```c++
#else
#    include <fcntl.h>
#endif

#include "test_macros.h"

#if TEST_STD_VER >= 26

#  include "check_assertion.h"
#  include "platform_support.h"
#  include "types.h"

inline bool is_handle_valid(NativeHandleT handle) {
```

https://github.com/llvm/llvm-project/pull/76632


More information about the cfe-commits mailing list