Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve compatibility with Dinkumware C++ headers #1008

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
ae1c8fd
Fix compilation with Dinkumware headers older than version 601 on Fre…
matthargett Oct 3, 2018
9b1b034
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Oct 3, 2018
2174a0e
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Oct 18, 2018
c842407
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Nov 7, 2018
119e83c
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Nov 8, 2018
947134e
Resolve merge conflicts.
matthargett Jan 28, 2019
bc9205e
Fix botched merge.
matthargett Jan 28, 2019
87d1135
Fall back to stdint.h is cstdint (and friends) aren't available. Use …
matthargett Jan 30, 2019
6f3cc60
Fix Linux build and test linkage errors.
matthargett Jan 31, 2019
3bdecf5
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Jan 31, 2019
ced6175
Remove folly-config.h
matthargett Jan 31, 2019
12b5b37
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Feb 8, 2019
4faea92
After upgrading to newer Dinkumare, was able to remove many header-le…
matthargett Feb 25, 2019
0f0dfab
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Feb 25, 2019
c3dbbfb
Cleanup based on feedback and newer Dinkumware/FreeBSD headers.
matthargett Feb 27, 2019
6025757
Minor changes based on feedback for consistency.
matthargett Feb 28, 2019
2431427
Add explicit header check and error out if no platform checks are true.
matthargett Mar 26, 2019
fa548ad
Merge branch 'master' of github.com:facebook/folly into dinkumware_build
matthargett Mar 26, 2019
b560eb6
Master added some DCHECK macros without adding explicit includes wher…
matthargett Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions folly/FBString.h
Original file line number Diff line number Diff line change
Expand Up @@ -2796,9 +2796,9 @@ operator<<(
os.setstate(_ostream_type::badbit | _ostream_type::failbit);
}
}
#elif defined(_MSC_VER)
#elif defined(_MSC_VER) || defined(_CPPLIB_VER)
// MSVC nor Dinkumware headers define __ostream_insert
typedef decltype(os.precision()) streamsize;
// MSVC doesn't define __ostream_insert
os.write(str.data(), static_cast<streamsize>(str.size()));
#else
std::__ostream_insert(os, str.data(), str.size());
Expand Down
8 changes: 4 additions & 4 deletions folly/Traits.h
Original file line number Diff line number Diff line change
Expand Up @@ -428,16 +428,16 @@ struct IsLessThanComparable
IsLessThanComparable;

namespace traits_detail_IsNothrowSwappable {
#if defined(__cpp_lib_is_swappable) || (_CPPLIB_VER && _HAS_CXX17)
#if defined(__cpp_lib_is_swappable) || (_CPPLIB_VER && (_HAS_CPP17 || _HAS_CXX17))
// MSVC already implements the C++17 P0185R1 proposal which adds
// std::is_nothrow_swappable, so use it instead if C++17 mode is
// enabled.
template <typename T>
using IsNothrowSwappable = std::is_nothrow_swappable<T>;
#elif _CPPLIB_VER
#elif _MSC_VER
// MSVC defines the base even if C++17 is disabled, and MSVC has
// issues with our fallback implementation due to over-eager
// evaluation of noexcept.
// issues with our fallback implementation due to
// over-eager evaluation of noexcept.
template <typename T>
using IsNothrowSwappable = std::_Is_nothrow_swappable<T>;
#else
Expand Down
2 changes: 0 additions & 2 deletions folly/detail/ThreadLocalDetail.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
#include <string>
#include <vector>

#include <glog/logging.h>

#include <folly/Exception.h>
#include <folly/Function.h>
#include <folly/Portability.h>
Expand Down
4 changes: 2 additions & 2 deletions folly/memory/Malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ mallctlbymib(const size_t*, size_t, void*, size_t*, void*, size_t)

// for malloc_usable_size
// NOTE: FreeBSD 9 doesn't have malloc.h. Its definitions
// are found in stdlib.h.
#if __has_include(<malloc.h>)
// are found in stdlib.h and it errors when including malloc.h.
#if __has_include(<malloc.h>) && (!defined(__STDC__) || !__STDC__)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This (or the change to the portability malloc below) is causing malloc.h to no longer get included in our internal builds :(

If these two changes are dropped, the rest should be safe to land :)

#include <malloc.h>
#else
#include <stdlib.h>
Expand Down
2 changes: 1 addition & 1 deletion folly/portability/Malloc.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// malloc_usable_size, and that's what we should be using.
#include <jemalloc/jemalloc.h>
#else
#ifndef __APPLE__
#if !defined(__APPLE__) && (!defined(__STDC__) || !__STDC__)
#include <malloc.h>
#endif

Expand Down
8 changes: 7 additions & 1 deletion folly/system/ThreadId.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@
#include <folly/portability/Unistd.h>
#include <folly/portability/Windows.h>

#if __has_include(<pthread_np.h>)
#include <pthread_np.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Orvid Do we want this include here or in the portability header?

#endif

namespace folly {

/**
Expand Down Expand Up @@ -84,8 +88,10 @@ inline uint64_t getOSThreadID() {
return tid;
#elif _WIN32
return uint64_t(GetCurrentThreadId());
#else
#elif __linux__
return uint64_t(syscall(FOLLY_SYS_gettid));
#else
matthargett marked this conversation as resolved.
Show resolved Hide resolved
return uint64_t(pthread_getthreadid_np());
#endif
}
} // namespace folly