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
base: main
Are you sure you want to change the base?
Conversation
…CPPLIB version to avoid using things that aren't available in Dinkumware C++ headers.
@mhorowitz this is the folly side of facebook/react-native#21764 |
Looks like the build is failing for unrelated reasons (can't persist the ccache after the build finished successfully). |
To give some perspective, overall, we are not planning to support older versions of compilers. This includes clang 3.9 and msvc 2015. As one particular, clang 3.9 has no support for C++17, so that compiler will definitely not work once we decide to jump to C++17. We also want to avoid all the extra complexity, preprocessor conditionals, restrictions on coding patterns, etc., that arise from supporting older compilers. |
@yfeldblum sorry, my title was misleading. This is with clang 6 and 7, but using Dinkumware headers. I was able to bump the Dinkumware headers and eliminate a bunch of the __has_include noise. Take another look and let me know what you think. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify which versions of cpplib you are intending compatibility with?
Note that when PRs are imported into the internal code review tool or landed into the repo, the PR commits are squashed into a single commit. |
@@ -23,6 +23,10 @@ | |||
#include <folly/portability/Unistd.h> | |||
#include <folly/portability/Windows.h> | |||
|
|||
#if __has_include(<pthread_np.h>) | |||
#include <pthread_np.h> |
There was a problem hiding this comment.
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?
…e they were used. Added explicit glog/logging.h include to the top of the relevant files, to match the style in folly/detail/IPAddressSource.h
Looks like the build failure is an unrelated regression caused by a different commit?
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yfeldblum has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.
Note that I will internally reorder the glog includes to match our style. |
any issues landing it in phabricator? let me know if there's anything else I can do to get it merged. |
// 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__) |
There was a problem hiding this comment.
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 :)
Summary:
These are a set of minor changes to allow building and linking on older clang and toolchains that use Dinkumware headers. I adjusted and tested only the subset of folly used by React Native's CxxReact, Fabric, and TurboModules C++ sources.
Test plan:
I ran the build on my Ubuntu 18.x using both clang 3.9, clang 6.x, and GCC 8.x. I couldn't find a way to build and run the unit tests in cmake, so I spot checked several unit tests with a manual CLI build:
g++-8 -I ../vcpkg/installed/x64-linux/include/ -L../vcpkg/installed/x64-linux/lib -I. -I_build folly/test/DynamicConverterTest.cpp folly/test/common/TestMain.cpp -lgtest -lpthread -lglog -lgflags -ldouble-conversion -lssl -lboost_filesystem -lboost_program_options -lboost_regex -lboost_system -ldl -lstdc++ -liberty _build/libfolly.a ../vcpkg/installed/x64-linux/lib/libdouble-conversion.a