Fix modular build on clang

This commit is contained in:
Victor Zverovich
2023-04-10 09:43:56 -07:00
parent 119c6bd16f
commit c98e5a08a4
12 changed files with 99 additions and 117 deletions

View File

@@ -1,9 +1,5 @@
module;
#if !defined(WIN32_LEAN_AND_MEAN) && defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
#endif
// Put all implementation-provided headers into the global module fragment
// to prevent attachment to this module.
#include <algorithm>
@@ -54,22 +50,23 @@ module;
# endif
#endif
#ifdef _WIN32
# define WIN32_LEAN_AND_MEAN
# include <windows.h>
#endif
export module fmt;
#define FMT_MODULE_EXPORT export
#define FMT_EXPORT_BEGIN export {
#define FMT_EXPORT_END }
#define FMT_BEGIN_EXPORT export {
#define FMT_END_EXPORT }
#define FMT_BEGIN_DETAIL_NAMESPACE \
} \
namespace detail {
#define FMT_END_DETAIL_NAMESPACE \
} \
export {
// all library-provided declarations and definitions
// must be in the module purview to be exported
// All library-provided declarations and definitions must be in the module
// purview to be exported.
#include "fmt/args.h"
#include "fmt/chrono.h"
#include "fmt/color.h"

View File

@@ -372,22 +372,22 @@ file file::open_windows_file(wcstring_view path, int oflag) {
}
# endif
#if !defined(__MSDOS__)
# if !defined(__MSDOS__)
long getpagesize() {
# ifdef _WIN32
# ifdef _WIN32
SYSTEM_INFO si;
GetSystemInfo(&si);
return si.dwPageSize;
# else
# else
long size = FMT_POSIX_CALL(sysconf(_SC_PAGESIZE));
if (size < 0)
FMT_THROW(system_error(errno, FMT_STRING("cannot get memory page size")));
return size;
# endif
# endif
}
#endif
# endif
FMT_BEGIN_DETAIL_NAMESPACE
namespace detail {
void file_buffer::grow(size_t) {
if (this->size() == this->capacity()) flush();
@@ -410,8 +410,7 @@ file_buffer::~file_buffer() {
flush();
delete[] data();
}
FMT_END_DETAIL_NAMESPACE
} // namespace detail
ostream::~ostream() = default;
#endif // FMT_USE_FCNTL