G++ 6.0 can assert that the this pointer is non-null for member functions. winsup/cygserver/ChangeLog process.cc (submission_loop::request_loop): Remove nonnull check on this. process.cc (sync_wait_array): Ditto. process.cc (check_and_remove_process): Ditto. threaded_queue.cc (add_submission_loop): Ditto. threaded_queue.cc (add): Ditto. threaded_queue.cc (start): Ditto. threaded_queue.cc (stop): Ditto.
winsup/cygwin/ChangeLog fhandler_dsp.cc (Audio_out::buf_info): Remove nonnull check on this. fhandler_dsp.cc (Audio_in::buf_info): Ditto. path.cc (fcwd_access_t::Free): Ditto. pinfo.cc (_pinfo::exists): Ditto. pinfo.cc (_pinfo::commune_request): Ditto. pinfo.cc (_pinfo::pipe_fhandler): Ditto. pinfo.cc (_pinfo::fd): Ditto. pinfo.cc (_pinfo::fds): Ditto. pinfo.cc (_pinfo::root): Ditto. pinfo.cc (_pinfo::cwd): Ditto. pinfo.cc (_pinfo::cmdline): Ditto. signal.cc (_pinfo::kill): Ditto. Signed-off-by: Peter Foley <[email protected]> --- winsup/cygserver/process.cc | 3 --- winsup/cygserver/threaded_queue.cc | 4 ---- winsup/cygwin/fhandler_dsp.cc | 4 ++-- winsup/cygwin/path.cc | 2 +- winsup/cygwin/pinfo.cc | 16 ++++++++-------- winsup/cygwin/signal.cc | 2 +- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc index d78ca37..d8b2bea 100644 --- a/winsup/cygserver/process.cc +++ b/winsup/cygserver/process.cc @@ -174,7 +174,6 @@ process::cleanup () void process_cache::submission_loop::request_loop () { - assert (this); assert (_cache); assert (_interrupt_event); @@ -379,7 +378,6 @@ process_cache::wait_for_processes (const HANDLE interrupt_event) size_t process_cache::sync_wait_array (const HANDLE interrupt_event) { - assert (this); assert (interrupt_event && interrupt_event != INVALID_HANDLE_VALUE); /* Always reset _cache_add_trigger before filling up the array again. */ @@ -426,7 +424,6 @@ process_cache::sync_wait_array (const HANDLE interrupt_event) void process_cache::check_and_remove_process (const size_t index) { - assert (this); assert (index < elements (_wait_array) - SPECIALS_COUNT); class process *const process = _process_array[index]; diff --git a/winsup/cygserver/threaded_queue.cc b/winsup/cygserver/threaded_queue.cc index ba69e1a..4a4e94c 100644 --- a/winsup/cygserver/threaded_queue.cc +++ b/winsup/cygserver/threaded_queue.cc @@ -86,7 +86,6 @@ threaded_queue::~threaded_queue () void threaded_queue::add_submission_loop (queue_submission_loop *const submitter) { - assert (this); assert (submitter); assert (submitter->_queue == this); assert (!submitter->_next); @@ -159,7 +158,6 @@ threaded_queue::stop () void threaded_queue::add (queue_request *const therequest) { - assert (this); assert (therequest); assert (!therequest->_next); @@ -317,7 +315,6 @@ queue_submission_loop::~queue_submission_loop () bool queue_submission_loop::start () { - assert (this); assert (!_hThread); const bool was_running = _running; @@ -341,7 +338,6 @@ queue_submission_loop::start () bool queue_submission_loop::stop () { - assert (this); assert (_hThread && _hThread != INVALID_HANDLE_VALUE); const bool was_running = _running; diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index 9fa2c6e..bfdd4c4 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -502,7 +502,7 @@ fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p, int rate, int bits, int channels) { p->fragstotal = MAX_BLOCKS; - if (this && dev_) + if (dev_) { /* If the device is running we use the internal values, possibly set from the wave file. */ @@ -959,7 +959,7 @@ fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p, { p->fragstotal = MAX_BLOCKS; p->fragsize = blockSize (rate, bits, channels); - if (this && dev_) + if (dev_) { p->fragments = Qisr2app_->query (); if (pHdr_ != NULL) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 20391bf..df09d70 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3937,7 +3937,7 @@ fcwd_access_t::Free (PVOID heap) { /* Decrement the reference count. If it's down to 0, free structure from heap. */ - if (this && InterlockedDecrement (&ReferenceCount ()) == 0) + if (InterlockedDecrement (&ReferenceCount ()) == 0) { /* In contrast to pre-Vista, the handle on init is always a fresh one and not the handle inherited from the parent diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index be32cfd..409a0b7 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -514,7 +514,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags) bool __reg1 _pinfo::exists () { - return this && process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED)); + return process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED)); } bool @@ -685,7 +685,7 @@ _pinfo::commune_request (__uint32_t code, ...) res.s = NULL; res.n = 0; - if (!this || !pid) + if (!pid) { set_errno (ESRCH); goto err; @@ -783,7 +783,7 @@ out: fhandler_pipe * _pinfo::pipe_fhandler (int64_t unique_id, size_t &n) { - if (!this || !pid) + if (!pid) return NULL; if (pid == myself->pid) return NULL; @@ -796,7 +796,7 @@ char * _pinfo::fd (int fd, size_t &n) { char *s; - if (!this || !pid) + if (!pid) return NULL; if (pid != myself->pid) { @@ -820,7 +820,7 @@ char * _pinfo::fds (size_t &n) { char *s; - if (!this || !pid) + if (!pid) return NULL; if (pid != myself->pid) { @@ -848,7 +848,7 @@ char * _pinfo::root (size_t& n) { char *s; - if (!this || !pid) + if (!pid) return NULL; if (pid != myself->pid && !ISSTATE (this, PID_NOTCYGWIN)) { @@ -893,7 +893,7 @@ char * _pinfo::cwd (size_t& n) { char *s = NULL; - if (!this || !pid) + if (!pid) return NULL; if (ISSTATE (this, PID_NOTCYGWIN)) { @@ -939,7 +939,7 @@ char * _pinfo::cmdline (size_t& n) { char *s = NULL; - if (!this || !pid) + if (!pid) return NULL; if (ISSTATE (this, PID_NOTCYGWIN)) { diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 8dfd4ab..c259678 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -263,7 +263,7 @@ _pinfo::kill (siginfo_t& si) } this_pid = pid; } - else if (si.si_signo == 0 && this && process_state == PID_EXITED) + else if (si.si_signo == 0 && process_state == PID_EXITED) { this_process_state = process_state; this_pid = pid; -- 2.7.4
