-
Notifications
You must be signed in to change notification settings - Fork 606
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
Make project compile with clang 11.0.1-2 in Mac #3795
Changes from 1 commit
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 |
---|---|---|
|
@@ -670,13 +670,15 @@ template<> inline double from_string<double> (string_view s) { | |
|
||
template<> inline int64_t from_string<int64_t>(string_view s) { | ||
// For conversion of string_view to unsigned int, fall back on strtoll. | ||
auto r = strtoll(std::string(s).c_str(), nullptr, 10); | ||
std::string s2 = std::string(s); | ||
auto r = strtoll(s2.c_str(), nullptr, 10); | ||
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 change is fine, I guess, but I don't understand why it is necessary. What error message did you get with the old code? |
||
return static_cast<int64_t>(r); | ||
} | ||
|
||
template<> inline uint64_t from_string<uint64_t>(string_view s) { | ||
// For conversion of string_view to unsigned int, fall back on strtoull. | ||
auto r = strtoull(std::string(s).c_str(), nullptr, 10); | ||
std::string s2 = std::string(s); | ||
auto r = strtoull(s2.c_str(), nullptr, 10); | ||
return static_cast<uint64_t>(r); | ||
} | ||
#endif | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,9 @@ | |
# include <sys/stat.h> | ||
# include <sys/types.h> | ||
# include <unistd.h> | ||
#ifdef __APPLE__ | ||
# include <utime.h> | ||
#endif | ||
#endif | ||
|
||
#if defined(USE_STD_FILESYSTEM) | ||
|
@@ -778,12 +781,19 @@ Filesystem::last_write_time(string_view path, std::time_t time) noexcept | |
times.modtime = time; | ||
_wutime(u8path(path).c_str(), ×); | ||
#else | ||
#ifndef __APPLE__ | ||
struct timespec times[2]; | ||
times[0].tv_sec = 0; | ||
times[0].tv_nsec = UTIME_OMIT; | ||
times[1].tv_sec = time; | ||
times[1].tv_nsec = 0; | ||
utimensat((int)AT_FDCWD, u8path(path).c_str(), times, AT_SYMLINK_NOFOLLOW); | ||
utimensat((int)AT_FDCWD, u8path(path).c_str(), times, AT_SYMLINK_NOFOLLOW); | ||
#else | ||
struct utimbuf times; | ||
times.actime = time; | ||
times.modtime = time; | ||
utime(u8path(path).c_str(), ×); | ||
#endif | ||
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. That's a bit of an awkward construction. Let's reverse the sense of this, so it's
I'm confused about why this is necessary. utimensat is POSIX, should be fine on Apple, and indeed on the Mac laptop I'm using this very moment, "man utimensat" shows me the right thing. On the other hand,
will that work for both Apple and Linux just fine? |
||
#endif | ||
} | ||
|
||
|
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 omit this change. We don't alter formatting or whitespace in code unrelated to the subject of a PR.