forked from bminor/bash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbashtypes.hh
94 lines (77 loc) · 2.32 KB
/
bashtypes.hh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/* bashtypes.h -- Bash system types. */
/* Copyright (C) 1993-2009 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
Bash is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Bash is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Bash. If not, see <http://www.gnu.org/licenses/>.
*/
#if !defined(_BASHTYPES_H_)
#define _BASHTYPES_H_
#include "config-bot.hh"
#include "config-top.hh"
#include <sys/types.h>
// First, include common C++ wrappers for standard C headers.
#include <cerrno>
#include <climits>
#include <csignal>
#include <cstdarg>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cwctype>
// Now, include either Gnulib overrides or system headers.
#include <stdint.h>
#include <string.h>
#include <unistd.h> /* for _POSIX_VERSION */
// Include Gnulib versions of C type functions.
#include "c-ctype.h"
// Next, include some common C++ library headers.
#include <algorithm>
#include <exception>
#include <string>
#include <vector>
// Use C++17 std::string_view or our own lite version.
#if __cplusplus >= 201703L
#include <nonstd/string_view.hpp>
#include <string_view>
namespace bash
{
using nonstd::to_string;
using nonstd::to_string_view;
using std::string_view;
}
#else
#include <nonstd/string_view.hpp>
namespace bash
{
using nonstd::string_view;
using nonstd::to_string;
using nonstd::to_string_view;
}
#endif
// Prefer unlocked I/O where available (include after other files).
#include "unlocked-io.h"
// Fake C++11 keywords for older C++ compilers.
#if !defined(nullptr) && __cplusplus < 201103L
#define noexcept throw ()
#define override
#define nullptr NULL
#define constexpr const
#define CONSTEXPR
#else
#define CONSTEXPR constexpr
#endif
// Remove __attribute__ if we're not using GCC or Clang.
#ifndef __attribute__
#if !defined(__clang__) && !defined(__GNUC__)
#define __attribute__(x)
#endif
#endif
#endif /* _BASHTYPES_H_ */