Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Assume compiler support for explicit keyword

Since we require a fairly recent clang for other features, there is no reason to test for this one.
  • Loading branch information...
commit cbe91ff8312b768d6e7a8de4e2383e28c7f15049 1 parent 7cfc9c3
@sorbits sorbits authored
View
2  Applications/PrivilegedTool/src/CFxx.h
@@ -21,7 +21,7 @@ namespace cf
}
}
- EXPLICIT operator bool () const { return cf_value != NULL; }
+ explicit operator bool () const { return cf_value != NULL; }
operator T () const { return cf_value; }
operator T () { return cf_value; }
View
2  Frameworks/OakAppKit/src/OakLayoutView.mm
@@ -12,7 +12,7 @@
edge_t edge;
int distance;
- EXPLICIT operator bool () const { return box; }
+ explicit operator bool () const { return box; }
};
static void add_cursors (box_t* box, NSView* view)
View
2  Frameworks/authorization/src/connection.h
@@ -12,7 +12,7 @@ struct PUBLIC connection_t
connection_t (int socket = -1);
connection_t (std::string const& socketPath);
- EXPLICIT operator bool () const { return _socket; }
+ explicit operator bool () const { return _socket; }
connection_t& operator<< (bool value);
connection_t& operator<< (int value);
View
2  Frameworks/cf/src/image.h
@@ -10,7 +10,7 @@ namespace cf
image_t (std::string const& path, std::string const& bundleId = NULL_STR);
image_t () { }
operator CGImageRef () const { return _value.get(); }
- EXPLICIT operator bool () const { return _value.get() ? true : false; }
+ explicit operator bool () const { return _value.get() ? true : false; }
private:
typedef std::shared_ptr<struct CGImage> CGImagePtr;
CGImagePtr _value;
View
2  Frameworks/io/src/events.cc
@@ -112,7 +112,7 @@ namespace
}
}
- EXPLICIT operator bool () const { return _stream; }
+ explicit operator bool () const { return _stream; }
operator FSEventStreamRef () const { return _stream; }
std::string _mount_point;
View
2  Frameworks/io/src/path.h
@@ -37,7 +37,7 @@ namespace path
bool operator< (identifier_t const& rhs) const;
bool operator== (identifier_t const& rhs) const;
bool operator!= (identifier_t const& rhs) const;
- EXPLICIT operator bool () const { return exists || path != NULL_STR; }
+ explicit operator bool () const { return exists || path != NULL_STR; }
private:
bool exists;
dev_t device;
View
2  Frameworks/io/src/socket.h
@@ -10,7 +10,7 @@ struct socket_t
socket_t () { }
socket_t (int fd) { helper.reset(new helper_t(fd)); }
operator int () const { ASSERT(helper); return helper->fd; }
- EXPLICIT operator bool () const { return helper ? helper->fd != -1 : false; }
+ explicit operator bool () const { return helper ? helper->fd != -1 : false; }
private:
struct helper_t
View
2  Frameworks/network/src/proxy.h
@@ -6,7 +6,7 @@
struct proxy_settings_t
{
proxy_settings_t (bool enabled = false, std::string const& server = NULL_STR, long port = 0, std::string const& user = NULL_STR, std::string const& password = NULL_STR) : enabled(enabled), server(server), port(port), user(user), password(password) { }
- EXPLICIT operator bool () const { return enabled; }
+ explicit operator bool () const { return enabled; }
bool enabled;
std::string server;
View
2  Frameworks/ns/src/attr_string.h
@@ -215,7 +215,7 @@ namespace ns
operator NSAttributedString* () const { return get(); }
operator CFAttributedStringRef () const { return (CFAttributedStringRef)get(); }
- EXPLICIT operator bool () const { return !is_empty(); };
+ explicit operator bool () const { return !is_empty(); };
bool is_empty () const { return _string.size() == 0; };
};
View
2  Frameworks/plist/src/date.h
@@ -12,7 +12,7 @@ namespace oak
date_t (std::string const& str);
date_t (CFAbsoluteTime at = 0) : at(at) { }
- EXPLICIT operator bool () const { return at != 0; }
+ explicit operator bool () const { return at != 0; }
bool operator== (date_t const& rhs) const { return at == rhs.at; }
bool operator!= (date_t const& rhs) const { return at != rhs.at; }
bool operator< (date_t const& rhs) const { return at < rhs.at; }
View
2  Frameworks/plist/src/uuid.h
@@ -20,7 +20,7 @@ namespace oak
bool operator== (uuid_t const& rhs) const;
bool operator!= (uuid_t const& rhs) const;
- EXPLICIT operator bool () const;
+ explicit operator bool () const;
operator std::string () const;
static bool is_valid (std::string const& str);
View
4 Frameworks/regexp/src/regexp.h
@@ -34,7 +34,7 @@ namespace regexp
bool did_match (int i = 0) const { return i < size() && region->beg[i] != -1; }
- EXPLICIT operator bool () const { return did_match(); }
+ explicit operator bool () const { return did_match(); }
char const* buffer () const { return buf; }
@@ -62,7 +62,7 @@ namespace regexp
pattern_t (char const* pattern, OnigOptionType options = ONIG_OPTION_NONE);
pattern_t (std::string const& pattern, OnigOptionType options = ONIG_OPTION_NONE);
pattern_t (std::string const& pattern, std::string const& str_options);
- EXPLICIT operator bool () const { return compiled_pattern ? true : false; }
+ explicit operator bool () const { return compiled_pattern ? true : false; }
bool operator== (pattern_t const& rhs) const { return pattern_string == rhs.pattern_string; }
bool operator!= (pattern_t const& rhs) const { return !(*this == rhs); }
View
2  Frameworks/scope/src/scope.h
@@ -32,7 +32,7 @@ namespace scope
bool operator!= (scope_t const& rhs) const;
bool operator< (scope_t const& rhs) const;
- EXPLICIT operator bool () const;
+ explicit operator bool () const;
private:
void setup (std::string const& str);
View
2  Frameworks/selection/src/selection.cc
@@ -155,7 +155,7 @@ namespace ng
{
character_pair_t () { }
character_pair_t (std::string const& first, std::string const& second, bool matchedFirst) : first(first), second(second), matched_first(matchedFirst), initialized(true) { }
- EXPLICIT operator bool () const { return initialized; }
+ explicit operator bool () const { return initialized; }
std::string first, second;
bool matched_first, initialized = false;
View
6 Frameworks/selection/src/types.h
@@ -11,7 +11,7 @@ namespace ng
index_t () : index(SIZE_T_MAX), carry(SIZE_T_MAX) { }
index_t (size_t index, size_t carry = 0) : index(index), carry(carry) { }
- EXPLICIT operator bool () const { return index != SIZE_T_MAX; }
+ explicit operator bool () const { return index != SIZE_T_MAX; }
bool operator== (index_t const& rhs) const { return index == rhs.index && carry == rhs.carry; }
bool operator!= (index_t const& rhs) const { return !(*this == rhs); }
bool operator< (index_t const& rhs) const { return index < rhs.index || index == rhs.index && carry < rhs.carry; }
@@ -33,7 +33,7 @@ namespace ng
index_t const& max () const { return first < last ? last : first; }
range_t sorted () const { return range_t(min(), max(), columnar, freehanded); }
bool empty () const { return freehanded ? first == last : first.index == last.index; }
- EXPLICIT operator bool () const { return first ? true : false; }
+ explicit operator bool () const { return first ? true : false; }
bool operator== (range_t const& tmp) const { auto lhs = normalized(), rhs = tmp.normalized(); return lhs.first == rhs.first && lhs.last == rhs.last && lhs.columnar == rhs.columnar && lhs.freehanded == rhs.freehanded; }
bool operator!= (range_t const& tmp) const { auto lhs = normalized(), rhs = tmp.normalized(); return lhs.first != rhs.first || lhs.last != rhs.last || lhs.columnar != rhs.columnar || lhs.freehanded != rhs.freehanded; }
bool operator< (range_t const& tmp) const { auto lhs = normalized(), rhs = tmp.normalized(); return lhs.first < rhs.first || lhs.first == rhs.first && lhs.last < rhs.last; }
@@ -67,7 +67,7 @@ namespace ng
bool empty () const { return ranges.empty(); }
size_t size () const { return ranges.size(); }
- EXPLICIT operator bool () const { return !empty(); }
+ explicit operator bool () const { return !empty(); }
void push_back (range_t const& r) { ranges.push_back(r); }
void push_back (index_t const& index) { push_back(range_t(index, index)); }
View
2  Frameworks/text/src/types.h
@@ -35,7 +35,7 @@ namespace text
pos_t operator- (ssize_t dist) const { ASSERT(column >= dist); return pos_t(line, column - dist); }
operator std::string () const { return text::format("%zu", line+1) + column_str() + offset_str(); }
- EXPLICIT operator bool () const { return *this != undefined; }
+ explicit operator bool () const { return *this != undefined; }
static pos_t zero;
static pos_t undefined;
View
11 Shared/PCH/prelude.cc
@@ -1,17 +1,6 @@
#ifndef PRELUDE_CC_PCH_U5CKEP2N
#define PRELUDE_CC_PCH_U5CKEP2N
-#ifndef __has_feature
- #define __has_feature(x) 0 // Compatibility with non-clang compilers.
-#endif
-
-#if __has_feature(cxx_explicit_conversions) // Constant was introduced in clang r138741, actual feature has been there longer.
- #define EXPLICIT explicit
-#else
- #define EXPLICIT
- #warning "No explicit conversion operators."
-#endif
-
#define __STDC_LIMIT_MACROS
#include "prelude.c"
Please sign in to comment.
Something went wrong with that request. Please try again.