iceberg-cpp
Loading...
Searching...
No Matches
compiler.h
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19
20#pragma once
21
22#include <version>
23
24#include "iceberg/compat/build_config.h"
25
26#if defined(_MSVC_LANG)
27# define ICEBERG_COMPILER_CPLUSPLUS _MSVC_LANG
28#else
29# define ICEBERG_COMPILER_CPLUSPLUS __cplusplus
30#endif
31
32#if ICEBERG_COMPILER_CPLUSPLUS < 202002L
33# error "Iceberg public headers require C++20 or newer"
34#endif
35
36#if !ICEBERG_CXX20_COMPAT
37# if ICEBERG_COMPILER_CPLUSPLUS <= 202002L
38# error \
39 "This Iceberg package requires C++23; rebuild with ICEBERG_CXX20_COMPAT=ON for C++20 consumers"
40# endif
41# if !defined(__cpp_explicit_this_parameter) || __cpp_explicit_this_parameter < 202110L
42# error "The default Iceberg API requires explicit object parameters"
43# endif
44# if !defined(__cpp_lib_byteswap) || __cpp_lib_byteswap < 202110L
45# error "The default Iceberg API requires std::byteswap"
46# endif
47# if !defined(__cpp_lib_unreachable) || __cpp_lib_unreachable < 202202L
48# error "The default Iceberg API requires std::unreachable"
49# endif
50#endif