[presubmit] Enable runtime/threadsafe_fn linter checking.
This enables linter checking for "runtime/threadsafe_fn" violations during presubmit and instead marks the few known exceptions that we allow explicitly. R=jochen@chromium.org Review URL: https://codereview.chromium.org/1369673003 Cr-Commit-Position: refs/heads/master@{#30933}
This commit is contained in:
parent
145a2f45f3
commit
6ec34c7cb3
@ -46,7 +46,7 @@ static inline void* mmapHelper(size_t len, int prot, int flags, int fildes,
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(floor(time / msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return tzname[0]; // The location of the timezone string on AIX.
|
||||
}
|
||||
@ -56,7 +56,7 @@ double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
// On AIX, struct tm does not contain a tm_gmtoff field.
|
||||
time_t utc = time(NULL);
|
||||
DCHECK(utc != -1);
|
||||
struct tm* loc = localtime(&utc);
|
||||
struct tm* loc = localtime(&utc); // NOLINT(runtime/threadsafe_fn)
|
||||
DCHECK(loc != NULL);
|
||||
return static_cast<double>((mktime(loc) - utc) * msPerSecond);
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace base {
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return tzname[0]; // The location of the timezone string on Cygwin.
|
||||
}
|
||||
@ -39,7 +39,7 @@ double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
// On Cygwin, struct tm does not contain a tm_gmtoff field.
|
||||
time_t utc = time(NULL);
|
||||
DCHECK(utc != -1);
|
||||
struct tm* loc = localtime(&utc);
|
||||
struct tm* loc = localtime(&utc); // NOLINT(runtime/threadsafe_fn)
|
||||
DCHECK(loc != NULL);
|
||||
// time - localtime includes any daylight savings offset, so subtract it.
|
||||
return static_cast<double>((mktime(loc) - utc) * msPerSecond -
|
||||
|
@ -39,7 +39,7 @@ namespace base {
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
}
|
||||
@ -47,7 +47,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
|
||||
double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
time_t tv = time(NULL);
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
// tm_gmtoff includes any daylight savings offset, so subtract it.
|
||||
return static_cast<double>(t->tm_gmtoff * msPerSecond -
|
||||
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
|
||||
|
@ -108,7 +108,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
#else
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (!t || !t->tm_zone) return "";
|
||||
return t->tm_zone;
|
||||
#endif
|
||||
@ -121,7 +121,7 @@ double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
return 0;
|
||||
#else
|
||||
time_t tv = time(NULL);
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
// tm_gmtoff includes any daylight savings offset, so subtract it.
|
||||
return static_cast<double>(t->tm_gmtoff * msPerSecond -
|
||||
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
|
||||
|
@ -102,7 +102,7 @@ void OS::SignalCodeMovingGC() {
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
}
|
||||
@ -110,7 +110,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
|
||||
double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
time_t tv = time(NULL);
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
// tm_gmtoff includes any daylight savings offset, so subtract it.
|
||||
return static_cast<double>(t->tm_gmtoff * msPerSecond -
|
||||
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
|
||||
|
@ -37,7 +37,7 @@ namespace base {
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
}
|
||||
@ -45,7 +45,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
|
||||
double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
time_t tv = time(NULL);
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
// tm_gmtoff includes any daylight savings offset, so subtract it.
|
||||
return static_cast<double>(t->tm_gmtoff * msPerSecond -
|
||||
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
|
||||
|
@ -384,7 +384,7 @@ void OS::ClearTimezoneCache(TimezoneCache* cache) {
|
||||
double OS::DaylightSavingsOffset(double time, TimezoneCache*) {
|
||||
if (std::isnan(time)) return std::numeric_limits<double>::quiet_NaN();
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return std::numeric_limits<double>::quiet_NaN();
|
||||
return t->tm_isdst > 0 ? 3600 * msPerSecond : 0;
|
||||
}
|
||||
|
@ -88,7 +88,7 @@ bool OS::ArmUsingHardFloat() {
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return t->tm_zone;
|
||||
}
|
||||
@ -96,7 +96,7 @@ const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
|
||||
double OS::LocalTimeOffset(TimezoneCache* cache) {
|
||||
time_t tv = time(NULL);
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
// tm_gmtoff includes any daylight savings offset, so subtract it.
|
||||
return static_cast<double>(t->tm_gmtoff * msPerSecond -
|
||||
(t->tm_isdst > 0 ? 3600 * msPerSecond : 0));
|
||||
|
@ -38,7 +38,7 @@ namespace base {
|
||||
const char* OS::LocalTimezone(double time, TimezoneCache* cache) {
|
||||
if (std::isnan(time)) return "";
|
||||
time_t tv = static_cast<time_t>(std::floor(time/msPerSecond));
|
||||
struct tm* t = localtime(&tv);
|
||||
struct tm* t = localtime(&tv); // NOLINT(runtime/threadsafe_fn)
|
||||
if (NULL == t) return "";
|
||||
return tzname[0]; // The location of the timezone string on Solaris.
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ inline void MemoryBarrier() {
|
||||
|
||||
|
||||
int localtime_s(tm* out_tm, const time_t* time) {
|
||||
tm* posix_local_time_struct = localtime(time);
|
||||
tm* posix_local_time_struct = localtime(time); // NOLINT
|
||||
if (posix_local_time_struct == NULL) return 1;
|
||||
*out_tm = *posix_local_time_struct;
|
||||
return 0;
|
||||
|
@ -63,7 +63,6 @@ LINT_RULES = """
|
||||
-readability/nolint
|
||||
+readability/streams
|
||||
-runtime/references
|
||||
-runtime/threadsafe_fn
|
||||
-whitespace/semicolon
|
||||
""".split()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user