-
Notifications
You must be signed in to change notification settings - Fork 238
Add a patch in rviz_ogre_vendor to build with clang on macOS #1510
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: rolling
Are you sure you want to change the base?
Changes from all commits
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 |
---|---|---|
@@ -0,0 +1,137 @@ | ||
--- a/Components/Overlay/include/OgreUTFString.h | ||
+++ b/Components/Overlay/include/OgreUTFString.h | ||
@@ -32,6 +32,100 @@ | ||
#include <string> | ||
#include <stdexcept> | ||
|
||
+#if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS) && __clang_major__ >= 15 | ||
+#include <string> | ||
+namespace std { | ||
+ template<> | ||
+ struct char_traits<unsigned short> | ||
+ { | ||
+ using char_type = unsigned short; | ||
+ using int_type = unsigned int; | ||
+ using off_type = streamoff; | ||
+ using pos_type = streampos; | ||
+ using state_type = mbstate_t; | ||
+ | ||
+ static void assign(char_type& r, const char_type& a) { r = a; } | ||
+ static bool eq(const char_type& a, const char_type& b) { return a == b; } | ||
+ static bool lt(const char_type& a, const char_type& b) { return a < b; } | ||
+ | ||
+ static int compare(const char_type* s1, const char_type* s2, size_t n) { | ||
+ for (size_t i = 0; i < n; ++i) { | ||
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. include |
||
+ if (lt(s1[i], s2[i])) return -1; | ||
+ if (lt(s2[i], s1[i])) return 1; | ||
+ } | ||
+ return 0; | ||
+ } | ||
+ | ||
+ static size_t length(const char_type* s) { | ||
+ size_t i = 0; | ||
+ while (!eq(s[i], char_type())) ++i; | ||
+ return i; | ||
+ } | ||
+ | ||
+ static const char_type* find(const char_type* s, size_t n, const char_type& a) { | ||
+ for (size_t i = 0; i < n; ++i) { | ||
+ if (eq(s[i], a)) return s + i; | ||
+ } | ||
+ return nullptr; | ||
+ } | ||
+ | ||
+ static char_type* move(char_type* s1, const char_type* s2, size_t n) { | ||
+ return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type))); | ||
+ } | ||
+ | ||
+ static char_type* copy(char_type* s1, const char_type* s2, size_t n) { | ||
+ return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type))); | ||
+ } | ||
+ | ||
+ static char_type* assign(char_type* s, size_t n, char_type a) { | ||
+ for (size_t i = 0; i < n; ++i) { | ||
+ assign(s[i], a); | ||
+ } | ||
+ return s; | ||
+ } | ||
+ | ||
+ static int_type not_eof(const int_type& c) { | ||
+ return !eq_int_type(c, eof()) ? c : 0; | ||
+ } | ||
+ | ||
+ static char_type to_char_type(const int_type& c) { return static_cast<char_type>(c); } | ||
+ static int_type to_int_type(const char_type& c) { return static_cast<int_type>(c); } | ||
+ static bool eq_int_type(const int_type& c1, const int_type& c2) { return c1 == c2; } | ||
+ static int_type eof() { return static_cast<int_type>(-1); } | ||
+ }; | ||
+} | ||
+#endif | ||
+ | ||
+#if (OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS) && __clang_major__ >= 15 | ||
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 |
||
+#include <string> | ||
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. include already included |
||
+namespace std { | ||
+ template<> | ||
+ struct char_traits<unsigned int> | ||
+ { | ||
+ using char_type = unsigned int; | ||
+ using int_type = unsigned int; | ||
+ using off_type = streamoff; | ||
+ using pos_type = streampos; | ||
+ using state_type = mbstate_t; | ||
+ | ||
+ static void assign(char_type& r, const char_type& a) { r = a; } | ||
+ static bool eq(const char_type& a, const char_type& b) { return a == b; } | ||
+ static bool lt(const char_type& a, const char_type& b) { return a < b; } | ||
+ | ||
+ static int compare(const char_type* s1, const char_type* s2, size_t n) { | ||
+ for (size_t i = 0; i < n; ++i) { | ||
+ if (lt(s1[i], s2[i])) return -1; | ||
+ if (lt(s2[i], s1[i])) return 1; | ||
+ } | ||
+ return 0; | ||
+ } | ||
+ | ||
+ static size_t length(const char_type* s) { | ||
+ size_t i = 0; | ||
+ while (!eq(s[i], char_type())) ++i; | ||
+ return i; | ||
+ } | ||
+ | ||
+ static const char_type* find(const char_type* s, size_t n, const char_type& a) { | ||
+ for (size_t i = 0; i < n; ++i) { | ||
+ if (eq(s[i], a)) return s + i; | ||
+ } | ||
+ return nullptr; | ||
+ } | ||
+ | ||
+ static char_type* move(char_type* s1, const char_type* s2, size_t n) { | ||
+ return static_cast<char_type*>(memmove(s1, s2, n * sizeof(char_type))); | ||
+ } | ||
+ | ||
+ static char_type* copy(char_type* s1, const char_type* s2, size_t n) { | ||
+ return static_cast<char_type*>(memcpy(s1, s2, n * sizeof(char_type))); | ||
+ } | ||
+ | ||
+ static char_type* assign(char_type* s, size_t n, char_type a) { | ||
+ for (size_t i = 0; i < n; ++i) { | ||
+ assign(s[i], a); | ||
+ } | ||
+ return s; | ||
+ } | ||
+ | ||
+ static int_type not_eof(const int_type& c) { | ||
+ return !eq_int_type(c, eof()) ? c : 0; | ||
+ } | ||
+ | ||
+ static char_type to_char_type(const int_type& c) { return static_cast<char_type>(c); } | ||
+ static int_type to_int_type(const char_type& c) { return static_cast<int_type>(c); } | ||
+ static bool eq_int_type(const int_type& c1, const int_type& c2) { return c1 == c2; } | ||
+ static int_type eof() { return static_cast<int_type>(-1); } | ||
+ }; | ||
+} | ||
+#endif | ||
+ | ||
// Workaround for VC7/7.1/8.0/9.0 (2003 - 2008): | ||
// when build with /MD or /MDd, VC have both std::basic_string<unsigned short> and | ||
// basic_string<__wchar_t> instantiated in msvcprt[d].lib/MSVCP71[D].dll, but the header |
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.
string is already included