some trivial lint cleanups

This commit is contained in:
Kurtis Rader 2017-02-13 18:48:59 -08:00
parent 22a2098c34
commit 7fc1994339
6 changed files with 12 additions and 15 deletions

View file

@ -637,7 +637,7 @@ class owning_lock {
DATA data;
public:
owning_lock(DATA d) : data(std::move(d)) {}
owning_lock(DATA &&d) : data(std::move(d)) {}
owning_lock() : data() {}
acquired_lock<DATA> acquire() { return {lock, &data}; }
@ -826,9 +826,6 @@ void assert_is_not_forked_child(const char *who);
#define ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(x) assert_is_not_forked_child(x)
#define ASSERT_IS_NOT_FORKED_CHILD() ASSERT_IS_NOT_FORKED_CHILD_TRAMPOLINE(__FUNCTION__)
/// Macro to help suppress potentially unused variable warnings.
#define USE(var) (void)(var)
extern "C" {
__attribute__((noinline)) void debug_thread_error(void);
}

View file

@ -667,7 +667,7 @@ void completer_t::complete_cmd(const wcstring &str_cmd, bool use_function, bool
expand_error_t ignore =
expand_string(str_cmd, &this->completions,
EXPAND_FOR_COMPLETIONS | DIRECTORIES_ONLY | this->expand_flags(), NULL);
USE(ignore);
UNUSED(ignore);
}
if (str_cmd.find(L'/') == wcstring::npos && str_cmd.at(0) != L'~') {

View file

@ -216,9 +216,9 @@ wchar_t *wcsndup(const wchar_t *in, size_t c) {
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
size_t wcslcpy(wchar_t *dst, const wchar_t *src, size_t siz) {
register wchar_t *d = dst;
register const wchar_t *s = src;
register size_t n = siz;
wchar_t *d = dst;
const wchar_t *s = src;
size_t n = siz;
// Copy as many bytes as will fit.
if (n != 0 && --n != 0) {

View file

@ -1136,7 +1136,7 @@ class test_lru_t : public lru_cache_t<test_lru_t, int> {
std::vector<value_type> evicted;
void entry_was_evicted(wcstring key, int val) { evicted.push_back({key, val}); }
void entry_was_evicted(const wcstring &key, int val) { evicted.push_back({key, val}); }
std::vector<value_type> values() const {
std::vector<value_type> result;

View file

@ -40,8 +40,8 @@ struct spawn_request_t {
spawn_request_t() {}
spawn_request_t(void_function_t f, void_function_t comp)
: handler(std::move(f)), completion(std::move(comp)) {}
spawn_request_t(void_function_t &&f, void_function_t &&comp)
: handler(f), completion(comp) {}
// Move-only
spawn_request_t &operator=(const spawn_request_t &) = delete;
@ -54,7 +54,7 @@ struct main_thread_request_t {
volatile bool done = false;
void_function_t func;
main_thread_request_t(void_function_t f) : func(std::move(f)) {}
main_thread_request_t(void_function_t &&f) : func(f) {}
// No moving OR copying
// main_thread_requests are always stack allocated, and we deal in pointers to them
@ -309,7 +309,7 @@ static void iothread_service_result_queue() {
// Perform each completion in order
while (!result_queue.empty()) {
spawn_request_t req = std::move(result_queue.front());
spawn_request_t req(std::move(result_queue.front()));
result_queue.pop();
// ensure we don't invoke empty functions, that raises an exception
if (req.completion != nullptr) {

View file

@ -108,8 +108,8 @@ class lru_cache_t {
// CRTP callback for when a node is evicted.
// Clients can implement this
void entry_was_evicted(wcstring key, CONTENTS value) {
USE(key);
USE(value);
UNUSED(key);
UNUSED(value);
}
// Implementation of merge step for mergesort