Fix various lint warnings stemming from hphp/util
Esse commit está contido em:
@@ -868,7 +868,7 @@ ControlFlowGraph *ControlFlowGraph::buildControlFlow(MethodStatementPtr m) {
|
||||
ControlFlowGraph *graph = new ControlFlowGraph;
|
||||
|
||||
graph->m_stmt = m;
|
||||
ControlFlowBuilder cfb(graph, m->getOrigGeneratorFunc());
|
||||
ControlFlowBuilder cfb(graph, !!m->getOrigGeneratorFunc());
|
||||
cfb.run(m->getStmts());
|
||||
graph->m_nextDfn = 1;
|
||||
depth_first_visit(*graph, cfb.head(),
|
||||
|
||||
@@ -14,6 +14,13 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include <util/logger.h>
|
||||
#include <util/util.h>
|
||||
#include <util/job_queue.h>
|
||||
@@ -96,11 +103,6 @@
|
||||
|
||||
#include <system/lib/systemlib.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
namespace HPHP {
|
||||
namespace Compiler {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -3826,7 +3828,7 @@ bool EmitterVisitor::visitImpl(ConstructPtr node) {
|
||||
pce->addMethod(invoke);
|
||||
MethodStatementPtr body(
|
||||
static_pointer_cast<MethodStatement>(ce->getClosureFunction()));
|
||||
invoke->setHasGeneratorAsBody(body->getGeneratorFunc());
|
||||
invoke->setHasGeneratorAsBody(!!body->getGeneratorFunc());
|
||||
postponeMeth(body, invoke, false, new ClosureUseVarVec(useVars));
|
||||
|
||||
return true;
|
||||
@@ -5173,7 +5175,7 @@ void EmitterVisitor::emitPostponedMeths() {
|
||||
fe = new FuncEmitter(m_ue, -1, -1, methName);
|
||||
fe->setIsGenerator(funcScope->isGenerator());
|
||||
fe->setIsGeneratorFromClosure(funcScope->isGeneratorFromClosure());
|
||||
fe->setHasGeneratorAsBody(p.m_meth->getGeneratorFunc());
|
||||
fe->setHasGeneratorAsBody(!!p.m_meth->getGeneratorFunc());
|
||||
p.m_fe = fe;
|
||||
top_fes.push_back(fe);
|
||||
}
|
||||
@@ -7459,7 +7461,7 @@ Unit* hphp_compiler_parse(const char* code, int codeLen, const MD5& md5,
|
||||
filename = "";
|
||||
unitOrigin = UnitOriginEval;
|
||||
}
|
||||
ScopeGuard sg(SymbolTable::Purge);
|
||||
SCOPE_EXIT { SymbolTable::Purge(); };
|
||||
|
||||
// Check if this file contains raw hip hop bytecode instead of php.
|
||||
// For now this is just dictated by file extension, and doesn't ever
|
||||
|
||||
@@ -342,12 +342,12 @@ bool FunctionScope::isGenerator() const {
|
||||
(ParserBase::IsContinuationName(name()) &&
|
||||
m_paramNames.size() == 1 &&
|
||||
m_paramNames[0] == CONTINUATION_OBJECT_NAME));
|
||||
return getOrigGenStmt();
|
||||
return !!getOrigGenStmt();
|
||||
}
|
||||
|
||||
bool FunctionScope::hasGeneratorAsBody() const {
|
||||
MethodStatementPtr stmt = dynamic_pointer_cast<MethodStatement>(getStmt());
|
||||
return stmt ? stmt->getGeneratorFunc() : false;
|
||||
return stmt ? !!stmt->getGeneratorFunc() : false;
|
||||
}
|
||||
|
||||
bool FunctionScope::isGeneratorFromClosure() const {
|
||||
|
||||
@@ -744,7 +744,7 @@ static bool by_location(const VariableTable::StaticGlobalInfoPtr &p1,
|
||||
const VariableTable::StaticGlobalInfoPtr &p2) {
|
||||
ConstructRawPtr d1 = p1->sym->getDeclaration();
|
||||
ConstructRawPtr d2 = p2->sym->getDeclaration();
|
||||
if (!d1) return d2;
|
||||
if (!d1) return !!d2;
|
||||
if (!d2) return false;
|
||||
return d1->getLocation()->compare(d2->getLocation().get()) < 0;
|
||||
}
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "runtime/base/program_functions.h"
|
||||
|
||||
#include "runtime/base/types.h"
|
||||
#include "runtime/base/program_functions.h"
|
||||
#include "runtime/base/type_conversions.h"
|
||||
#include "runtime/base/builtin_functions.h"
|
||||
#include "runtime/base/execution_context.h"
|
||||
@@ -618,7 +618,7 @@ static int start_server(const std::string &username) {
|
||||
Logger::Info("Replaying warmup request %s", file.c_str());
|
||||
try {
|
||||
rt.onRequestStart(start);
|
||||
rt.replayInput(file);
|
||||
rt.replayInput(Hdf(file));
|
||||
handler.handleRequest(&rt);
|
||||
Logger::Info("Finished successfully");
|
||||
} catch (std::exception& e) {
|
||||
|
||||
@@ -45,7 +45,7 @@ SatelliteServerInfo::SatelliteServerInfo(Hdf hdf) {
|
||||
hdf["Passwords"].get(m_passwords);
|
||||
m_alwaysReset = hdf["AlwaysReset"].getBool(false);
|
||||
|
||||
string type = hdf["Type"];
|
||||
string type = hdf["Type"].getString();
|
||||
if (type == "InternalPageServer") {
|
||||
m_type = SatelliteServer::KindOfInternalPageServer;
|
||||
vector<string> urls;
|
||||
@@ -99,7 +99,7 @@ private:
|
||||
|
||||
class InternalPageServer : public SatelliteServer {
|
||||
public:
|
||||
InternalPageServer(SatelliteServerInfoPtr info) {
|
||||
explicit InternalPageServer(SatelliteServerInfoPtr info) {
|
||||
InternalPageServerImplPtr server
|
||||
(new TypedServer<InternalPageServerImpl, HttpRequestHandler>
|
||||
(RuntimeOption::ServerIP, info->getPort(), info->getThreadCount(),
|
||||
@@ -124,7 +124,7 @@ private:
|
||||
|
||||
class DanglingPageServer : public SatelliteServer {
|
||||
public:
|
||||
DanglingPageServer(SatelliteServerInfoPtr info) {
|
||||
explicit DanglingPageServer(SatelliteServerInfoPtr info) {
|
||||
m_server = ServerPtr
|
||||
(new TypedServer<LibEventServer, HttpRequestHandler>
|
||||
(RuntimeOption::ServerIP, info->getPort(), info->getThreadCount(),
|
||||
@@ -185,7 +185,7 @@ private:
|
||||
|
||||
class RPCServer : public SatelliteServer {
|
||||
public:
|
||||
RPCServer(SatelliteServerInfoPtr info) {
|
||||
explicit RPCServer(SatelliteServerInfoPtr info) {
|
||||
m_server = ServerPtr(new RPCServerImpl(RuntimeOption::ServerIP, info));
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
|
||||
#include "folly/ScopeGuard.h"
|
||||
|
||||
#include <runtime/ext/ext_mysql.h>
|
||||
#include <runtime/ext/ext_preg.h>
|
||||
#include <runtime/ext/ext_network.h>
|
||||
@@ -1443,7 +1445,7 @@ Variant f_mysql_async_wait_actionable(CVarRef items, double timeout) {
|
||||
}
|
||||
|
||||
struct pollfd* fds = (struct pollfd*)calloc(count, sizeof(struct pollfd));
|
||||
ScopeGuard fds_free([fds]() { free(fds); });
|
||||
SCOPE_EXIT { free(fds); };
|
||||
|
||||
// Walk our input, determine what kind of poll() operation is
|
||||
// necessary for the descriptor in question, and put an entry into
|
||||
|
||||
@@ -13,15 +13,15 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "util/alloc.h"
|
||||
|
||||
#include <atomic>
|
||||
|
||||
#include "alloc.h"
|
||||
#include <sys/mman.h>
|
||||
#include <stdlib.h>
|
||||
#include <errno.h>
|
||||
#include "util.h"
|
||||
#include "logger.h"
|
||||
#include "util/util.h"
|
||||
#include "util/logger.h"
|
||||
|
||||
namespace HPHP { namespace Util {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
+2
-2
@@ -65,8 +65,8 @@ namespace HPHP {
|
||||
|
||||
class OutOfMemoryException : public Exception {
|
||||
public:
|
||||
OutOfMemoryException(size_t size)
|
||||
: Exception("Unable to allocate %zu bytes of memory", size) {}
|
||||
explicit OutOfMemoryException(size_t size)
|
||||
: Exception("Unable to allocate %zu bytes of memory", size) {}
|
||||
virtual ~OutOfMemoryException() throw() {}
|
||||
EXCEPTION_COMMON_IMPL(OutOfMemoryException);
|
||||
};
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "util/asm-x64.h"
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
@@ -24,7 +26,6 @@
|
||||
#include <sys/types.h>
|
||||
|
||||
#include "util/assertions.h"
|
||||
#include "util/asm-x64.h"
|
||||
#include "util/maphuge.h"
|
||||
#include "runtime/base/runtime_option.h"
|
||||
|
||||
|
||||
+8
-11
@@ -79,7 +79,7 @@ struct Reg64 {
|
||||
|
||||
// Implicit conversion for backward compatability only. This is
|
||||
// needed to keep the store_reg##_disp_reg## style apis working.
|
||||
constexpr operator RegNumber() const { return RegNumber(rn); }
|
||||
constexpr /* implicit */ operator RegNumber() const { return RegNumber(rn); }
|
||||
|
||||
// Integer conversion is allowed but only explicitly. (It's not
|
||||
// unusual to want to printf registers, etc. Just cast it first.)
|
||||
@@ -101,7 +101,7 @@ private:
|
||||
#define SIMPLE_REGTYPE(What) \
|
||||
struct What { \
|
||||
explicit constexpr What(int rn) : rn(rn) {} \
|
||||
explicit constexpr operator RegNumber() const { \
|
||||
explicit constexpr /* implicit */ operator RegNumber() const { \
|
||||
return RegNumber(rn); \
|
||||
} \
|
||||
explicit constexpr operator int() const { return rn; } \
|
||||
@@ -440,14 +440,6 @@ namespace reg {
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
static inline void
|
||||
atomic_store64(volatile uint64_t* dest, uint64_t value) {
|
||||
// gcc on x64 will implement this with a 64-bit store, and
|
||||
// normal 64-bit stores don't tear across instruction boundaries
|
||||
// assuming all 8 bytes of dest are on the same cacheline.
|
||||
*dest = value;
|
||||
}
|
||||
|
||||
/*
|
||||
* Note that CodeAddresses are not const; the whole point is that we intend
|
||||
* to mutate them. uint8_t is as good a type as any: instructions are
|
||||
@@ -574,7 +566,12 @@ struct DataBlock {
|
||||
for (size_t i = 0; i < n; ++i) {
|
||||
u.bytes[i] = bs[i];
|
||||
}
|
||||
atomic_store64((uint64_t*)frontier, u.qword);
|
||||
|
||||
// If this address doesn't span cache lines, on x64 this is an
|
||||
// atomic store. We're not using atomic_release_store() because
|
||||
// this code path occurs even when it may span cache lines, and
|
||||
// that function asserts about this.
|
||||
*reinterpret_cast<uint64_t*>(frontier) = u.qword;
|
||||
} else {
|
||||
memcpy(frontier, bs, n);
|
||||
}
|
||||
|
||||
@@ -39,9 +39,10 @@ class WorkerInfo {
|
||||
template<class TJob, class TWorker>
|
||||
class WorkerWrapper {
|
||||
public:
|
||||
WorkerWrapper(JobDispatcher<TJob, TWorker> &dispatcher)
|
||||
: m_dispatcher(dispatcher),
|
||||
m_func(this, &WorkerWrapper<TJob, TWorker>::doJob) {
|
||||
explicit WorkerWrapper(JobDispatcher<TJob, TWorker> &dispatcher)
|
||||
: m_dispatcher(dispatcher)
|
||||
, m_func(this, &WorkerWrapper<TJob, TWorker>::doJob)
|
||||
{
|
||||
if (!WorkerInfo<TJob>::DoInit) {
|
||||
m_func.setNoInit();
|
||||
}
|
||||
|
||||
+10
-18
@@ -263,14 +263,18 @@ public:
|
||||
hphp_raw_ptr() : px(0) {}
|
||||
explicit hphp_raw_ptr(T *p) : px(p) {}
|
||||
|
||||
hphp_raw_ptr(const boost::weak_ptr<T> &p) : px(p.lock().get()) {}
|
||||
/* implicit */ hphp_raw_ptr(const boost::weak_ptr<T> &p)
|
||||
: px(p.lock().get())
|
||||
{}
|
||||
|
||||
template <class S>
|
||||
hphp_raw_ptr(const boost::shared_ptr<S> &p) : px(p.get()) {}
|
||||
/* implicit */ hphp_raw_ptr(const boost::shared_ptr<S> &p) : px(p.get()) {}
|
||||
template <class S>
|
||||
hphp_raw_ptr(const boost::weak_ptr<S> &p) : px(p.lock().get()) {}
|
||||
/* implicit */ hphp_raw_ptr(const boost::weak_ptr<S> &p)
|
||||
: px(p.lock().get())
|
||||
{}
|
||||
template <class S>
|
||||
hphp_raw_ptr(const hphp_raw_ptr<S> &p) : px(p.get()) {}
|
||||
/* implicit */ hphp_raw_ptr(const hphp_raw_ptr<S> &p) : px(p.get()) {}
|
||||
|
||||
boost::shared_ptr<T> lock() const {
|
||||
return px ? boost::static_pointer_cast<T>(px->shared_from_this()) :
|
||||
@@ -281,7 +285,7 @@ public:
|
||||
}
|
||||
|
||||
template <class S>
|
||||
operator boost::shared_ptr<S>() const {
|
||||
/* implicit */ operator boost::shared_ptr<S>() const {
|
||||
S *s = px; // just to verify the implicit conversion T->S
|
||||
return s ? boost::static_pointer_cast<S>(px->shared_from_this()) :
|
||||
boost::shared_ptr<S>();
|
||||
@@ -289,7 +293,7 @@ public:
|
||||
|
||||
T *operator->() const { assert(px); return px; }
|
||||
T *get() const { return px; }
|
||||
operator bool() const { return !expired(); }
|
||||
explicit operator bool() const { return !expired(); }
|
||||
void reset() { px = 0; }
|
||||
private:
|
||||
T *px;
|
||||
@@ -448,18 +452,6 @@ destroyMapValues(Container& c) {
|
||||
}
|
||||
}
|
||||
|
||||
// Arbitrary callback when a scope exits.
|
||||
struct ScopeGuard {
|
||||
typedef std::tr1::function<void()> Callback;
|
||||
|
||||
ScopeGuard(void(*cbFptr)()) : m_cb(Callback(cbFptr)) { }
|
||||
ScopeGuard(Callback cb) : m_cb(cb) { }
|
||||
~ScopeGuard() { m_cb(); }
|
||||
private:
|
||||
Callback m_cb;
|
||||
};
|
||||
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// boost
|
||||
|
||||
@@ -28,7 +28,10 @@ class BiasedCoin {
|
||||
unsigned m_state;
|
||||
|
||||
public:
|
||||
BiasedCoin(double pct, unsigned seed = -1u) : m_seed(seed), m_pct(pct) {
|
||||
explicit BiasedCoin(double pct, unsigned seed = -1u)
|
||||
: m_seed(seed)
|
||||
, m_pct(pct)
|
||||
{
|
||||
assert(pct <= 100.0);
|
||||
if (seed == -1u) {
|
||||
seed = getpid();
|
||||
|
||||
@@ -71,7 +71,8 @@
|
||||
* NEED_GETOPT_DEFS can be defined and declarations are provided here.
|
||||
*/
|
||||
|
||||
#if !defined(_CRONOUTILS_H_)
|
||||
#ifndef incl_HPHP_CRONOUTILS_H_
|
||||
#define incl_HPHP_CRONOUTILS_H_
|
||||
|
||||
/* Header files */
|
||||
|
||||
|
||||
@@ -110,7 +110,7 @@ class DBConn {
|
||||
static unsigned int DefaultReadTimeout;
|
||||
|
||||
public:
|
||||
DBConn(int maxRetryOpenOnFail = 0, int maxRetryQueryOnFail = 1);
|
||||
explicit DBConn(int maxRetryOpenOnFail = 0, int maxRetryQueryOnFail = 1);
|
||||
~DBConn();
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,7 +57,8 @@ class DBDataSet : public DataSet {
|
||||
virtual int getFieldLength(int field) const;
|
||||
|
||||
private:
|
||||
DBDataSet(DBDataSet &ds) { assert(false);} // no copy constructor
|
||||
DBDataSet(const DBDataSet &ds) = delete;
|
||||
DBDataSet& operator=(const DBDataSet&) = delete;
|
||||
|
||||
typedef std::list<MYSQL_RES*> ResultList;
|
||||
ResultList m_results;
|
||||
|
||||
@@ -91,7 +91,7 @@ class DBInStringFilter : public DBQueryFilter {
|
||||
/**
|
||||
* We need a connection object to escape strings.
|
||||
*/
|
||||
DBInStringFilter(DBConn *conn);
|
||||
explicit DBInStringFilter(DBConn *conn);
|
||||
|
||||
/**
|
||||
* Just keep adding strings to the filter.
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "util/disasm.h"
|
||||
|
||||
#include <iomanip>
|
||||
#include <stdlib.h>
|
||||
@@ -22,7 +23,6 @@
|
||||
#include "folly/Format.h"
|
||||
#include "folly/ScopeGuard.h"
|
||||
|
||||
#include "util/disasm.h"
|
||||
#include "util/base.h"
|
||||
#include "util/text_color.h"
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#ifndef incl_HPHP_UTIL_DISAASM_H_
|
||||
#ifndef incl_HPHP_UTIL_DISASM_H_
|
||||
#define incl_HPHP_UTIL_DISASM_H_
|
||||
|
||||
#ifdef HAVE_LIBXED
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "util/embedded_vfs.h"
|
||||
|
||||
/*
|
||||
* based on test_demovfs.c and test_multiplex.c in sqlite3
|
||||
@@ -28,7 +29,6 @@
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "embedded_vfs.h"
|
||||
|
||||
#ifndef SQLITE_CORE
|
||||
#define SQLITE_CORE 1 /* Disable the API redefinition in sqlite3ext.h */
|
||||
|
||||
@@ -61,7 +61,7 @@ public:
|
||||
struct Deleter {
|
||||
Exception* m_e;
|
||||
Deleter() : m_e(nullptr) {}
|
||||
Deleter(Exception* e) : m_e(e) {}
|
||||
explicit Deleter(Exception* e) : m_e(e) {}
|
||||
~Deleter() { delete m_e; }
|
||||
};
|
||||
|
||||
@@ -82,7 +82,7 @@ protected:
|
||||
|
||||
class FileOpenException : public Exception {
|
||||
public:
|
||||
FileOpenException(const char *filename)
|
||||
explicit FileOpenException(const char *filename)
|
||||
: Exception("Unable to open file %s", filename) {
|
||||
}
|
||||
|
||||
@@ -95,8 +95,8 @@ class VMSwitchModeException : public Exception {
|
||||
private:
|
||||
bool m_unwindBuiltin;
|
||||
public:
|
||||
VMSwitchModeException(bool m_unwindBuiltin)
|
||||
: m_unwindBuiltin(m_unwindBuiltin) {}
|
||||
explicit VMSwitchModeException(bool unwindBuiltin)
|
||||
: m_unwindBuiltin(unwindBuiltin) {}
|
||||
bool unwindBuiltin() const { return m_unwindBuiltin; }
|
||||
|
||||
EXCEPTION_COMMON_IMPL(VMSwitchModeException);
|
||||
|
||||
+8
-21
@@ -46,12 +46,12 @@ public:
|
||||
/**
|
||||
* Constructors.
|
||||
*/
|
||||
Hdf(); // create an empty HDF tree
|
||||
Hdf(const char *filename); // open the specified file
|
||||
Hdf(const std::string &filename); // open the specified file
|
||||
Hdf(const Hdf *hdf, const char *name); // constructing a sub-node (internal)
|
||||
Hdf(const Hdf &hdf); // make a copy by reference (internal)
|
||||
Hdf(HDF *hdf); // attaching a raw pointer (internal)
|
||||
Hdf(); // create an empty HDF tree
|
||||
explicit Hdf(const char *filename); // open the specified file
|
||||
explicit Hdf(const std::string &filename); // open the specified file
|
||||
explicit Hdf(const Hdf *hdf, const char *name); // constructing a sub-node
|
||||
Hdf(const Hdf &hdf); // make a copy by reference
|
||||
explicit Hdf(HDF *hdf); // attaching a raw pointer
|
||||
~Hdf();
|
||||
|
||||
/**
|
||||
@@ -135,19 +135,6 @@ public:
|
||||
void get(std::map<std::string, std::string> &values) const;
|
||||
void get(hphp_string_imap<std::string> &values) const;
|
||||
|
||||
operator const char *() const { return get();}
|
||||
operator std::string() const { return getString();}
|
||||
operator bool () const { return getBool() ;}
|
||||
operator char () const { return getByte() ;}
|
||||
operator uchar () const { return getUByte() ;}
|
||||
operator int16_t () const { return getInt16() ;}
|
||||
operator uint16_t () const { return getUInt16();}
|
||||
operator int32_t () const { return getInt32() ;}
|
||||
operator uint32_t () const { return getUInt32();}
|
||||
operator int64_t () const { return getInt64() ;}
|
||||
operator uint64_t () const { return getUInt64();}
|
||||
operator double () const { return getDouble();}
|
||||
|
||||
/**
|
||||
* Set this node's value.
|
||||
*/
|
||||
@@ -396,7 +383,7 @@ public:
|
||||
*/
|
||||
class HdfDataValueException : public HdfException {
|
||||
public:
|
||||
HdfDataValueException(const Hdf *hdf, const char *expected = "")
|
||||
explicit HdfDataValueException(const Hdf *hdf, const char *expected = "")
|
||||
: HdfException("HDF node [%s]'s value \"%s\" is not expected %s",
|
||||
hdf->getFullPath().c_str(), hdf->get(""), expected) {
|
||||
}
|
||||
@@ -408,7 +395,7 @@ public:
|
||||
*/
|
||||
class HdfInvalidOperation : public HdfException {
|
||||
public:
|
||||
HdfInvalidOperation(const char *operation)
|
||||
explicit HdfInvalidOperation(const char *operation)
|
||||
: HdfException("Invalid operation: %s", operation) {
|
||||
}
|
||||
EXCEPTION_COMMON_IMPL(HdfInvalidOperation);
|
||||
|
||||
+4
-4
@@ -55,11 +55,11 @@ public:
|
||||
|
||||
class Name {
|
||||
public:
|
||||
Name(const char *name) {
|
||||
explicit Name(const char *name) {
|
||||
assert(name && *name);
|
||||
m_name = name;
|
||||
}
|
||||
Name(const std::string &name) {
|
||||
explicit Name(const std::string &name) {
|
||||
assert(!name.empty());
|
||||
m_name = name;
|
||||
}
|
||||
@@ -193,7 +193,7 @@ private:
|
||||
template <typename Type>
|
||||
class _MapStream {
|
||||
public:
|
||||
_MapStream(_OutputStream<Type> &jout)
|
||||
explicit _MapStream(_OutputStream<Type> &jout)
|
||||
: m_out(jout.raw()), m_jout(jout), m_first(true) {}
|
||||
|
||||
template<typename T>
|
||||
@@ -234,7 +234,7 @@ private:
|
||||
template <typename Type>
|
||||
class _ListStream {
|
||||
public:
|
||||
_ListStream(_OutputStream<Type> &jout)
|
||||
explicit _ListStream(_OutputStream<Type> &jout)
|
||||
: m_out(jout.raw()), m_jout(jout), m_first(true) {}
|
||||
|
||||
void next() {
|
||||
|
||||
@@ -26,7 +26,7 @@ struct KernelVersion {
|
||||
int m_dash;
|
||||
int m_fbk;
|
||||
KernelVersion(); // Use uname
|
||||
KernelVersion(const char*); // A known kernel version for cmp.
|
||||
explicit KernelVersion(const char*); // A known kernel version for cmp.
|
||||
static int cmp(const KernelVersion& l, const KernelVersion& r) {
|
||||
#define C(field) if (l.field != r.field) return l.field - r.field;
|
||||
C(m_major);
|
||||
|
||||
+10
-10
@@ -34,7 +34,7 @@ public:
|
||||
static bool s_profile;
|
||||
static int s_profile_sampling;
|
||||
|
||||
LockProfiler(bool profile);
|
||||
explicit LockProfiler(bool profile);
|
||||
~LockProfiler();
|
||||
|
||||
private:
|
||||
@@ -96,23 +96,23 @@ public:
|
||||
*/
|
||||
class Lock : public ConditionalLock {
|
||||
public:
|
||||
Lock(Mutex &mutex, bool profile = true)
|
||||
explicit Lock(Mutex &mutex, bool profile = true)
|
||||
: ConditionalLock(mutex, true, profile) {}
|
||||
Lock(Synchronizable *obj, bool profile = true)
|
||||
explicit Lock(Synchronizable *obj, bool profile = true)
|
||||
: ConditionalLock(obj, true, profile) {}
|
||||
Lock(SynchronizableMulti *obj, bool profile = true)
|
||||
explicit Lock(SynchronizableMulti *obj, bool profile = true)
|
||||
: ConditionalLock(obj, true, profile) {}
|
||||
};
|
||||
|
||||
class ScopedUnlock {
|
||||
public:
|
||||
ScopedUnlock(Mutex &mutex) : m_mutex(mutex) {
|
||||
explicit ScopedUnlock(Mutex &mutex) : m_mutex(mutex) {
|
||||
m_mutex.unlock();
|
||||
}
|
||||
ScopedUnlock(Synchronizable *obj) : m_mutex(obj->getMutex()) {
|
||||
explicit ScopedUnlock(Synchronizable *obj) : m_mutex(obj->getMutex()) {
|
||||
m_mutex.unlock();
|
||||
}
|
||||
ScopedUnlock(SynchronizableMulti *obj) : m_mutex(obj->getMutex()) {
|
||||
explicit ScopedUnlock(SynchronizableMulti *obj) : m_mutex(obj->getMutex()) {
|
||||
m_mutex.unlock();
|
||||
}
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
|
||||
class SimpleLock : public SimpleConditionalLock {
|
||||
public:
|
||||
SimpleLock(SimpleMutex &mutex, bool profile = true)
|
||||
explicit SimpleLock(SimpleMutex &mutex, bool profile = true)
|
||||
: SimpleConditionalLock(mutex, true, profile) {}
|
||||
};
|
||||
|
||||
@@ -169,13 +169,13 @@ private:
|
||||
|
||||
class ReadLock : public ConditionalReadLock {
|
||||
public:
|
||||
ReadLock(ReadWriteMutex &mutex, bool profile = true)
|
||||
explicit ReadLock(ReadWriteMutex &mutex, bool profile = true)
|
||||
: ConditionalReadLock(mutex, true, profile) {}
|
||||
};
|
||||
|
||||
class WriteLock {
|
||||
public:
|
||||
WriteLock(ReadWriteMutex &mutex, bool profile = true)
|
||||
explicit WriteLock(ReadWriteMutex &mutex, bool profile = true)
|
||||
: m_profiler(profile), m_mutex(mutex) {
|
||||
m_mutex.acquireWrite();
|
||||
}
|
||||
|
||||
@@ -32,7 +32,11 @@ class Exception;
|
||||
class LogFileData {
|
||||
public:
|
||||
LogFileData() : log(nullptr), bytesWritten(0), prevBytesWritten(0) {}
|
||||
LogFileData(FILE *f) : log(f), bytesWritten(0), prevBytesWritten(0) {}
|
||||
explicit LogFileData(FILE *f)
|
||||
: log(f)
|
||||
, bytesWritten(0)
|
||||
, prevBytesWritten(0)
|
||||
{}
|
||||
LogFileData(const LogFileData& rhs) :
|
||||
log(rhs.log), prevBytesWritten(rhs.prevBytesWritten) {
|
||||
bytesWritten.store(rhs.bytesWritten.load());
|
||||
|
||||
@@ -13,6 +13,11 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#ifndef incl_HPHP_MAPHUGE_H_
|
||||
#define incl_HPHP_MAPHUGE_H_
|
||||
|
||||
namespace HPHP {
|
||||
void hintHuge(void* mem, size_t length);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
+5
-5
@@ -95,7 +95,7 @@ public:
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
BaseMutex(bool recursive = true, Rank r = RankUnranked) {
|
||||
explicit BaseMutex(bool recursive = true, Rank r = RankUnranked) {
|
||||
pthread_mutexattr_init(&m_mutexattr);
|
||||
if (recursive) {
|
||||
pthread_mutexattr_settype(&m_mutexattr, PTHREAD_MUTEX_RECURSIVE);
|
||||
@@ -189,7 +189,7 @@ protected:
|
||||
*/
|
||||
class Mutex : public BaseMutex<false> {
|
||||
public:
|
||||
Mutex(bool recursive = true, Rank rank = RankUnranked) :
|
||||
explicit Mutex(bool recursive = true, Rank rank = RankUnranked) :
|
||||
BaseMutex<false>(recursive, rank) {}
|
||||
pthread_mutex_t &getRaw() { return m_mutex; }
|
||||
};
|
||||
@@ -200,7 +200,7 @@ public:
|
||||
*/
|
||||
class SimpleMutex : public BaseMutex<true> {
|
||||
public:
|
||||
SimpleMutex(bool recursive = true, Rank rank = RankUnranked) :
|
||||
explicit SimpleMutex(bool recursive = true, Rank rank = RankUnranked) :
|
||||
BaseMutex<true>(recursive, rank) {}
|
||||
};
|
||||
|
||||
@@ -211,7 +211,7 @@ class SpinLock {
|
||||
Rank m_rank;
|
||||
#endif
|
||||
public:
|
||||
SpinLock(Rank rank = RankUnranked)
|
||||
explicit SpinLock(Rank rank = RankUnranked)
|
||||
#ifdef DEBUG
|
||||
: m_rank(rank)
|
||||
#endif
|
||||
@@ -283,7 +283,7 @@ class ReadWriteMutex {
|
||||
}
|
||||
|
||||
public:
|
||||
ReadWriteMutex(Rank rank = RankUnranked)
|
||||
explicit ReadWriteMutex(Rank rank = RankUnranked)
|
||||
#ifdef DEBUG
|
||||
: m_rank(rank)
|
||||
#endif
|
||||
|
||||
@@ -13,6 +13,8 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#ifndef incl_HPHP_REPO_SCHEMA_H_
|
||||
#define incl_HPHP_REPO_SCHEMA_H_
|
||||
|
||||
namespace HPHP {
|
||||
|
||||
@@ -25,3 +27,5 @@ extern const char* kRepoSchemaId;
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -220,7 +220,7 @@ public:
|
||||
return boost::interprocess::named_mutex::remove(name);
|
||||
}
|
||||
|
||||
SharedMemoryLock(const char *name) {
|
||||
explicit SharedMemoryLock(const char *name) {
|
||||
assert(name && *name);
|
||||
m_mutex = new boost::interprocess::named_mutex
|
||||
(boost::interprocess::open_or_create, name);
|
||||
|
||||
@@ -32,7 +32,7 @@ namespace HPHP {
|
||||
class ShmCounter {
|
||||
public:
|
||||
ShmCounter() {}
|
||||
ShmCounter(const char *n) : count(0) {
|
||||
explicit ShmCounter(const char *n) : count(0) {
|
||||
size_t size = sizeof(name);
|
||||
strncpy(name, n, size);
|
||||
name[size - 1] = '\0';
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
DECLARE_BOOST_TYPES(Frame);
|
||||
class Frame {
|
||||
public:
|
||||
Frame(void *_bt) : bt(_bt), lineno(0), offset(0) {}
|
||||
explicit Frame(void *_bt) : bt(_bt), lineno(0), offset(0) {}
|
||||
|
||||
void *bt;
|
||||
int lineno;
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
DECLARE_BOOST_TYPES(Frame);
|
||||
class Frame : public StackTraceBase::Frame {
|
||||
public:
|
||||
Frame(void *_bt) : StackTraceBase::Frame(_bt) {}
|
||||
explicit Frame(void *_bt) : StackTraceBase::Frame(_bt) {}
|
||||
std::string filename;
|
||||
std::string funcname;
|
||||
std::string toString() const;
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
|
||||
public:
|
||||
|
||||
StackTrace(bool trace = true) ;
|
||||
explicit StackTrace(bool trace = true) ;
|
||||
|
||||
/**
|
||||
* Translate a frame pointer to file name and line number pair.
|
||||
@@ -100,9 +100,8 @@ public:
|
||||
/**
|
||||
* Constructing from hexEncode() results.
|
||||
*/
|
||||
StackTrace(const std::string &hexEncoded);
|
||||
|
||||
StackTrace(const char *hexEncoded);
|
||||
explicit StackTrace(const std::string &hexEncoded);
|
||||
explicit StackTrace(const char *hexEncoded);
|
||||
|
||||
/**
|
||||
* Generate an output of the written stack trace.
|
||||
@@ -138,7 +137,7 @@ public:
|
||||
* Constructor, and this will save current stack trace if trace is true.
|
||||
* It can be false for an empty stacktrace.
|
||||
*/
|
||||
StackTraceNoHeap(bool trace = true) ;
|
||||
explicit StackTraceNoHeap(bool trace = true);
|
||||
|
||||
/**
|
||||
* Log stacktrace into a file under /tmp. If "out" is not null,
|
||||
|
||||
@@ -28,7 +28,7 @@ namespace HPHP {
|
||||
*/
|
||||
class StringBag {
|
||||
public:
|
||||
StringBag(int reserve_count = 0);
|
||||
explicit StringBag(int reserve_count = 0);
|
||||
~StringBag();
|
||||
|
||||
const char *add(const char *s);
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
| license@php.net so we can mail you a copy immediately. |
|
||||
+----------------------------------------------------------------------+
|
||||
*/
|
||||
#include "util/synchronizable.h"
|
||||
|
||||
#include "compatibility.h"
|
||||
#include "rank.h"
|
||||
#include "synchronizable.h"
|
||||
#include "util/compatibility.h"
|
||||
#include "util/rank.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -17,9 +17,9 @@
|
||||
#ifndef incl_HPHP_SYNCHRONIZABLE_MULTI_H_
|
||||
#define incl_HPHP_SYNCHRONIZABLE_MULTI_H_
|
||||
|
||||
#include "base.h"
|
||||
#include "mutex.h"
|
||||
#include "rank.h"
|
||||
#include "util/base.h"
|
||||
#include "util/mutex.h"
|
||||
#include "util/rank.h"
|
||||
|
||||
namespace HPHP {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
@@ -32,7 +32,7 @@ namespace HPHP {
|
||||
*/
|
||||
class SynchronizableMulti {
|
||||
public:
|
||||
SynchronizableMulti(int size);
|
||||
explicit SynchronizableMulti(int size);
|
||||
virtual ~SynchronizableMulti();
|
||||
|
||||
/**
|
||||
|
||||
Referência em uma Nova Issue
Bloquear um usuário