-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
GCC and Clang compatible on Windows #1056
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
base: master
Are you sure you want to change the base?
Changes from 3 commits
dfc74e9
a6b942d
e98001c
ae1f7ca
c504eb8
b07ac82
32c9a04
5ba7c1b
5b8a0fb
a86369a
7303aa0
070b10e
5ce4d5e
592b90b
906910e
8efc865
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,9 +11,11 @@ | |
| #include <unordered_map> | ||
| #include <zstd.h> | ||
|
|
||
| #ifdef _MSC_VER | ||
| #if defined _MSC_VER || defined __clang__ || defined __GNUC__ | ||
| // all checked compilers contain _stat64 | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This changes behavior on non-win32 platforms.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will fix it. |
||
| # define stat64 _stat64 | ||
| #endif | ||
|
|
||
| #if defined __APPLE__ | ||
| # define stat64 stat | ||
| #endif | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16799,7 +16799,7 @@ class binary_writer | |
|
|
||
| void write_compact_float(const number_float_t n, detail::input_format_t format) | ||
| { | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? % clang -dM -E -x c /dev/null | grep __GNUC__
#define __GNUC__ 4
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just being explicit. I can change it if needed.
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do you want to go to each of the upstream projects with this change (that is not really needed)?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I understand that this would be due to having unified
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, does that mean that if
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang defines a very old version of gcc version macro, which may affect what features are available. This can be problematic in rare circumstances.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But is |
||
| #pragma GCC diagnostic push | ||
| #pragma GCC diagnostic ignored "-Wfloat-equal" | ||
| #endif | ||
|
|
@@ -16819,7 +16819,7 @@ class binary_writer | |
| : get_msgpack_float_prefix(n)); | ||
| write_number(n); | ||
| } | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic pop | ||
| #endif | ||
| } | ||
|
|
@@ -17981,7 +17981,7 @@ char* to_chars(char* first, const char* last, FloatType value) | |
| *first++ = '-'; | ||
| } | ||
|
|
||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic push | ||
| #pragma GCC diagnostic ignored "-Wfloat-equal" | ||
| #endif | ||
|
|
@@ -17993,7 +17993,7 @@ char* to_chars(char* first, const char* last, FloatType value) | |
| *first++ = '0'; | ||
| return first; | ||
| } | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic pop | ||
| #endif | ||
|
|
||
|
|
@@ -21187,7 +21187,7 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec | |
| detail::negation<std::is_same<ValueType, typename string_t::value_type>>, | ||
| detail::negation<detail::is_basic_json<ValueType>>, | ||
| detail::negation<std::is_same<ValueType, std::initializer_list<typename string_t::value_type>>>, | ||
| #if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914)) | ||
| #if defined(JSON_HAS_CPP_17) && (defined(__GNUC__) || defined(__clang__) || (defined(_MSC_VER) && _MSC_VER >= 1910 && _MSC_VER <= 1914)) | ||
| detail::negation<std::is_same<ValueType, std::string_view>>, | ||
| #endif | ||
| #if defined(JSON_HAS_CPP_17) && JSON_HAS_STATIC_RTTI | ||
|
|
@@ -22983,13 +22983,13 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec | |
| /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/ | ||
| bool operator==(const_reference rhs) const noexcept | ||
| { | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic push | ||
| #pragma GCC diagnostic ignored "-Wfloat-equal" | ||
| #endif | ||
| const_reference lhs = *this; | ||
| JSON_IMPLEMENT_OPERATOR( ==, true, false, false) | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic pop | ||
| #endif | ||
| } | ||
|
|
@@ -23087,12 +23087,12 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec | |
| /// @sa https://json.nlohmann.me/api/basic_json/operator_eq/ | ||
| friend bool operator==(const_reference lhs, const_reference rhs) noexcept | ||
| { | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic push | ||
| #pragma GCC diagnostic ignored "-Wfloat-equal" | ||
| #endif | ||
| JSON_IMPLEMENT_OPERATOR( ==, true, false, false) | ||
| #ifdef __GNUC__ | ||
| #if defined __GNUC__ || defined __clang__ | ||
| #pragma GCC diagnostic pop | ||
| #endif | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,14 @@ | |
| # include <windows.h> | ||
| #endif | ||
|
|
||
| #if defined _WIN32 && (defined __GNUC__ && !defined __clang__) | ||
| //_WIN32 - only tested on windows | ||
|
|
||
| // gcc throws error for not present std::pow function, | ||
| // clang does not have that problem | ||
| #include <cmath> | ||
| #endif | ||
|
|
||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed here? [18:59 wolf@oberon:~/tracy]% git grep std::pow
profiler/src/profiler/TracyView_Timeline.cpp: const auto mult = 1 + std::max( 0.0, 0.7 * std::pow( x, 1.6 ) - 0.8 * std::pow( x, 1.4 ) );
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tested, and turns out that using cmake from clang toolchain and gcc compiler created errors. So not needed, will remove. |
||
| #define STB_IMAGE_IMPLEMENTATION | ||
| #define STBI_ONLY_PNG | ||
| #include "stb_image.h" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,14 @@ | |
| #include "TracyTimelineItemThread.hpp" | ||
| #include "TracyView.hpp" | ||
|
|
||
| #if defined _WIN32 && (defined __GNUC__ && !defined __clang__) | ||
| //_WIN32 - only tested on windows | ||
|
|
||
| // gcc throws error for not present std::pow function, | ||
| // clang does not have that problem | ||
| #include <cmath> | ||
| #endif | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The correct solution would be to change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Checks are made only to not include it where it is not needed. Code uses
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No, that solution is wrong and only works due to happenstance.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tested, and turns out that using cmake from clang toolchain and gcc compiler created errors. So not needed, will remove. |
||
|
|
||
| namespace tracy | ||
| { | ||
|
|
||
|
|
||
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.
Please move
WIN32as first condition for better readability.