Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions config/check_attribute_init_priority.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// Copyright (c) 2021 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

class Foo
{};

Foo foo __attribute__((init_priority(101)));

int main()
{
return 0;
}
29 changes: 29 additions & 0 deletions config/check_lfs_support.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
//
// Copyright (c) 2020 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#define _LARGEFILE_SOURCE
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif

#include <stdio.h>

void check(FILE* f)
{
#if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
(void)_fseeki64(f, 0, SEEK_CUR);
(void)_ftelli64(f);
#else
// Check that those functions and off_t are available
(void)fseeko(f, off_t(0), SEEK_CUR);
(void)ftello(f);
#endif
}

int main()
{
check(nullptr);
}
17 changes: 17 additions & 0 deletions config/check_movable_fstreams.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
//
// Copyright (c) 2020 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#include <fstream>
#include <utility>

/// Check that the stdlib supports swapping and moving fstreams
/// (and by extension all other streams and streambufs)
void check()
{
std::fstream s1, s2;
s1.swap(s2);
s2 = std::move(s1);
}
25 changes: 12 additions & 13 deletions extern/boost/nowide/cmake/NowideAddWarnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,26 @@ function(nowide_add_warnings target level)
if(NOT level IN_LIST allowed_levels)
message(FATAL_ERROR "${level} is not a valid warning level (${allowed_levels})")
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(supression -Wno-long-long)
if(MSVC)
set(warn_off /W0)
set(warn_on /W3)
foreach(_lvl IN ITEMS all extra pedantic)
set(warn_${_lvl} /W4)
endforeach()
set(werror /WX)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(warn_off -w)
set(warn_on -Wall ${supression})
set(warn_all -Wall ${supression})
set(warn_extra -Wall -Wextra ${supression})
set(warn_pedantic -Wall -Wextra -pedantic ${supression})
set(warn_on -Wall)
set(warn_all -Wall)
set(warn_extra -Wall -Wextra)
set(warn_pedantic -Wall -Wextra -pedantic)
set(werror -Werror)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(warn_off -w0)
foreach(_lvl IN ITEMS on all extra pedantic)
set(warn_${_lvl} -w1)
endforeach()
set(werror "")
elseif(MSVC)
set(warn_off /W0)
set(warn_on /W3)
foreach(_lvl IN ITEMS all extra pedantic)
set(warn_${_lvl} /W4)
endforeach()
set(werror /WX)
endif()
target_compile_options(${target} PRIVATE ${warn_${level}})
if(warningsAsErrors)
Expand Down
11 changes: 5 additions & 6 deletions extern/boost/nowide/include/nowide/args.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#ifndef NOWIDE_ARGS_HPP_INCLUDED
#define NOWIDE_ARGS_HPP_INCLUDED

Expand Down Expand Up @@ -112,7 +111,7 @@ namespace nowide {
}
operator bool() const
{
return p != NULL;
return p != nullptr;
}
const wchar_t* operator[](size_t i) const
{
Expand Down
107 changes: 77 additions & 30 deletions extern/boost/nowide/include/nowide/config.hpp
Original file line number Diff line number Diff line change
@@ -1,38 +1,26 @@
//
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
// Copyright (c) 2020 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE or copy at
// http://www.boost.org/LICENSE_1_0.txt)
// Copyright (c) 2012 Artyom Beilis (Tonkikh)
// Copyright (c) 2019 - 2022 Alexander Grund
//
// Distributed under the Boost Software License, Version 1.0.
// https://www.boost.org/LICENSE_1_0.txt

#ifndef NOWIDE_CONFIG_HPP_INCLUDED
#define NOWIDE_CONFIG_HPP_INCLUDED

/// @file

#include <nowide/replacement.hpp>

#if(defined(__WIN32) || defined(_WIN32) || defined(WIN32)) && !defined(__CYGWIN__)
//! @cond Doxygen_Suppress
#if(defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) && !defined(__CYGWIN__)
#define NOWIDE_WINDOWS
#endif

#ifdef _MSC_VER
#define NOWIDE_MSVC _MSC_VER
#endif

#if defined(__MINGW64__)
#define NOWIDE_FTELL64 ftello64
#define NOWIDE_FSEEK64 fseeko64
#elif defined(__APPLE__)
#define NOWIDE_FTELL64 ftello
#define NOWIDE_FSEEK64 fseeko
#elif defined(_MSC_VER)
#define NOWIDE_FTELL64 _ftelli64
#define NOWIDE_FSEEK64 _fseeki64
#else
#define NOWIDE_FTELL64 ftell
#define NOWIDE_FSEEK64 fseek
#endif

#ifdef __GNUC__
#define NOWIDE_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
#endif
Expand All @@ -44,11 +32,26 @@
#ifdef NOWIDE_WINDOWS
#define NOWIDE_SYMBOL_EXPORT __declspec(dllexport)
#define NOWIDE_SYMBOL_IMPORT __declspec(dllimport)
#elif defined(__CYGWIN__) && defined(__GNUC__) && (__GNUC__ >= 4)
#define NOWIDE_SYMBOL_EXPORT __attribute__((__dllexport__))
#define NOWIDE_SYMBOL_IMPORT __attribute__((__dllimport__))
#else
#define NOWIDE_SYMBOL_EXPORT NOWIDE_SYMBOL_VISIBLE
#define NOWIDE_SYMBOL_IMPORT
#endif

#if defined __GNUC__
#define NOWIDE_LIKELY(x) __builtin_expect(x, 1)
#define NOWIDE_UNLIKELY(x) __builtin_expect(x, 0)
#else
#if !defined(NOWIDE_LIKELY)
#define NOWIDE_LIKELY(x) x
#endif
#if !defined(NOWIDE_UNLIKELY)
#define NOWIDE_UNLIKELY(x) x
#endif
#endif

#if defined(NOWIDE_DYN_LINK)
#ifdef NOWIDE_SOURCE
#define NOWIDE_DECL NOWIDE_SYMBOL_EXPORT
Expand All @@ -59,30 +62,74 @@
#define NOWIDE_DECL
#endif // NOWIDE_DYN_LINK

#ifndef NOWIDE_DECL
#define NOWIDE_DECL

//! @endcond

/// @def NOWIDE_USE_WCHAR_OVERLOADS
/// @brief Whether to use the wchar_t* overloads in fstream-classes.
///
/// Enabled by default on Windows and Cygwin as the latter may use wchar_t in filesystem::path.
#ifndef NOWIDE_USE_WCHAR_OVERLOADS
#if defined(NOWIDE_WINDOWS) || defined(__CYGWIN__) || defined(NOWIDE_DOXYGEN)
#define NOWIDE_USE_WCHAR_OVERLOADS 1
#else
#define NOWIDE_USE_WCHAR_OVERLOADS 0
#endif
#endif

#if defined(NOWIDE_WINDOWS)
/// @def NOWIDE_USE_FILEBUF_REPLACEMENT
/// @brief Define to 1 to use the class from <filebuf.hpp> that is used on Windows.
///
/// - On Windows: No effect, always overwritten to 1
/// - Others (including Cygwin): Defaults to the value of #NOWIDE_USE_WCHAR_OVERLOADS if not set.
///
/// When set to 0 nowide::basic_filebuf will be an alias for std::basic_filebuf.
///
/// Affects nowide::basic_filebuf,
/// nowide::basic_ofstream, nowide::basic_ifstream, nowide::basic_fstream
#if defined(NOWIDE_WINDOWS) || defined(NOWIDE_DOXYGEN)
#ifdef NOWIDE_USE_FILEBUF_REPLACEMENT
#undef NOWIDE_USE_FILEBUF_REPLACEMENT
#endif
#define NOWIDE_USE_FILEBUF_REPLACEMENT 1
#elif !defined(NOWIDE_USE_FILEBUF_REPLACEMENT)
#define NOWIDE_USE_FILEBUF_REPLACEMENT 0
#define NOWIDE_USE_FILEBUF_REPLACEMENT NOWIDE_USE_WCHAR_OVERLOADS
#endif

//! @cond Doxygen_Suppress

#if defined(__GNUC__) && __GNUC__ >= 7
#define NOWIDE_FALLTHROUGH __attribute__((fallthrough))
#else
#define NOWIDE_FALLTHROUGH
#endif

#if !defined(NOWIDE_LIKELY)
#define NOWIDE_LIKELY(x) x
#endif
#if !defined(NOWIDE_UNLIKELY)
#define NOWIDE_UNLIKELY(x) x
// The std::codecvt<char16/32_t, char, std::mbstate_t> are deprecated in C++20
// These macros can suppress this warning
#if defined(_MSC_VER)
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN __pragma(warning(push)) __pragma(warning(disable : 4996))
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END __pragma(warning(pop))
#elif(__cplusplus >= 202002L) && defined(__clang__)
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN \
_Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END _Pragma("clang diagnostic pop")
#elif(__cplusplus >= 202002L) && defined(__GNUC__)
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN \
_Pragma("GCC diagnostic push") _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END _Pragma("GCC diagnostic pop")
#else
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_BEGIN
#define NOWIDE_SUPPRESS_UTF_CODECVT_DEPRECATION_END
#endif

//! @endcond

///
/// \brief This namespace includes implementations of the standard library functions and
/// classes such that they accept UTF-8 strings on Windows.
/// On other platforms (i.e. not on Windows) those functions and classes are just aliases
/// of the corresponding ones from the std namespace or behave like them.
///
namespace nowide {}

#endif
Loading
Loading