diff --git a/builtin.cpp b/builtin.cpp index 8a81648ee..70829acb4 100644 --- a/builtin.cpp +++ b/builtin.cpp @@ -428,7 +428,7 @@ static void builtin_bind_list(const wchar_t *bind_mode) if (input_terminfo_get_name(seq, tname)) { append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", tname.c_str(), mode.c_str(), sets_mode.c_str()); - for (int i = 0; i < ecmds.size(); i++) + for (size_t i = 0; i < ecmds.size(); i++) { wcstring ecmd = ecmds.at(i); append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1)); @@ -439,7 +439,7 @@ static void builtin_bind_list(const wchar_t *bind_mode) { const wcstring eseq = escape_string(seq, 1); append_format(stdout_buffer, L"bind -k %ls -M %ls -m %ls", eseq.c_str(), mode.c_str(), sets_mode.c_str()); - for (int i = 0; i < ecmds.size(); i++) + for (size_t i = 0; i < ecmds.size(); i++) { wcstring ecmd = ecmds.at(i); append_format(stdout_buffer, L" %ls", escape(ecmd.c_str(), 1)); diff --git a/env_universal_common.cpp b/env_universal_common.cpp index 5194e8ff1..eb0e15ae7 100644 --- a/env_universal_common.cpp +++ b/env_universal_common.cpp @@ -464,7 +464,7 @@ static wcstring full_escape(const wchar_t *in) { out.push_back(c); } - else if (c <= ASCII_MAX) + else if (c <= (wchar_t)ASCII_MAX) { // See #1225 for discussion of use of ASCII_MAX here append_format(out, L"\\x%.2x", c); diff --git a/fallback.cpp b/fallback.cpp index d26907e2b..405c499f8 100644 --- a/fallback.cpp +++ b/fallback.cpp @@ -802,6 +802,7 @@ wchar_t *wcstok(wchar_t *wcs, const wchar_t *delim, wchar_t **save_ptr) /* Fallback implementations of wcsdup and wcscasecmp. On systems where these are not needed (e.g. building on Linux) these should end up just being stripped, as they are static functions that are not referenced in this file. */ +__attribute__((unused)) static wchar_t *wcsdup_fallback(const wchar_t *in) { size_t len=wcslen(in); diff --git a/input.cpp b/input.cpp index 41121ab3a..3b135cf19 100644 --- a/input.cpp +++ b/input.cpp @@ -156,7 +156,7 @@ static const wchar_t * const name_arr[] = wcstring describe_char(wint_t c) { - wchar_t initial_cmd_char = R_BEGINNING_OF_LINE; + wint_t initial_cmd_char = R_BEGINNING_OF_LINE; size_t name_count = sizeof name_arr / sizeof *name_arr; if (c >= initial_cmd_char && c < initial_cmd_char + name_count) { diff --git a/iothread.cpp b/iothread.cpp index da2e08903..65bc4144a 100644 --- a/iothread.cpp +++ b/iothread.cpp @@ -114,6 +114,11 @@ static void enqueue_thread_result(SpawnRequest_t *req) s_result_queue.push(req); } +static void *this_thread() +{ + return (void *)(intptr_t)pthread_self(); +} + /* The function that does thread work. */ static void *iothread_worker(void *unused) { @@ -121,7 +126,7 @@ static void *iothread_worker(void *unused) struct SpawnRequest_t *req; while ((req = dequeue_spawn_request()) != NULL) { - IOTHREAD_LOG fprintf(stderr, "pthread %p dequeued %p\n", pthread_self(), req); + IOTHREAD_LOG fprintf(stderr, "pthread %p dequeued %p\n", this_thread(), req); /* Unlock the queue while we execute the request */ locker.unlock(); @@ -150,7 +155,7 @@ static void *iothread_worker(void *unused) assert(s_active_thread_count > 0); s_active_thread_count -= 1; - IOTHREAD_LOG fprintf(stderr, "pthread %p exiting\n", pthread_self()); + IOTHREAD_LOG fprintf(stderr, "pthread %p exiting\n", this_thread()); /* We're done */ return NULL; @@ -165,13 +170,13 @@ static void iothread_spawn() VOMIT_ON_FAILURE(pthread_sigmask(SIG_BLOCK, &new_set, &saved_set)); /* Spawn a thread. If this fails, it means there's already a bunch of threads; it is very unlikely that they are all on the verge of exiting, so one is likely to be ready to handle extant requests. So we can ignore failure with some confidence. */ - pthread_t thread = NULL; + pthread_t thread = 0; pthread_create(&thread, NULL, iothread_worker, NULL); /* We will never join this thread */ VOMIT_ON_FAILURE(pthread_detach(thread)); - IOTHREAD_LOG fprintf(stderr, "pthread %p spawned\n", thread); + IOTHREAD_LOG fprintf(stderr, "pthread %p spawned\n", (void *)(intptr_t)thread); /* Restore our sigmask */ VOMIT_ON_FAILURE(pthread_sigmask(SIG_SETMASK, &saved_set, NULL)); diff --git a/parse_tree.cpp b/parse_tree.cpp index 36c94544d..fe1e2527e 100644 --- a/parse_tree.cpp +++ b/parse_tree.cpp @@ -525,7 +525,7 @@ class parse_ll_t { PARSE_ASSERT(! symbol_stack.empty()); const parse_stack_element_t &top_symbol = symbol_stack.back(); - PARSE_ASSERT(top_symbol.node_idx != -1); + PARSE_ASSERT(top_symbol.node_idx != NODE_OFFSET_INVALID); PARSE_ASSERT(top_symbol.node_idx < nodes.size()); return nodes.at(top_symbol.node_idx); } diff --git a/parser.cpp b/parser.cpp index b75b1ec79..773cde6b7 100644 --- a/parser.cpp +++ b/parser.cpp @@ -866,10 +866,9 @@ int parser_t::eval(const wcstring &cmd, const io_chain_t &io, enum block_type_t execution_contexts.push_back(ctx); /* Execute the first node */ - int result = 1; if (! tree.empty()) { - result = this->eval_block_node(0, io, block_type); + this->eval_block_node(0, io, block_type); } /* Clean up the execution context stack */ diff --git a/proc.cpp b/proc.cpp index 66a258270..8ebcdb01e 100644 --- a/proc.cpp +++ b/proc.cpp @@ -383,7 +383,7 @@ static void mark_process_status(const job_t *j, process_t *p, int status) } else { - ssize_t ignore; + ssize_t ignore __attribute__((unused)); /* This should never be reached */ p->completed = 1; diff --git a/screen.cpp b/screen.cpp index 1fb7ec2f6..27b10a5c2 100644 --- a/screen.cpp +++ b/screen.cpp @@ -48,7 +48,7 @@ efficient way for transforming that to the desired screen content. #include "pager.h" /** The number of characters to indent new blocks */ -#define INDENT_STEP 4 +#define INDENT_STEP 4u /** The initial screen width */ #define SCREEN_WIDTH_UNINITIALIZED -1