Fix #251:Compiling errors on Ubuntu.

On Ubuntu 16.04/18.04, fixed compile error with -Wunused-result
and -Wimplicit-fallthrough.
dev
fengbojiang 2018-07-23 18:22:09 +08:00
parent 141f33b513
commit 63d2acf1c7
4 changed files with 12 additions and 1 deletions

View File

@ -35,8 +35,10 @@ ngx_murmur_hash2(u_char *data, size_t len)
switch (len) { switch (len) {
case 3: case 3:
h ^= data[2] << 16; h ^= data[2] << 16;
/* fall through */
case 2: case 2:
h ^= data[1] << 8; h ^= data[1] << 8;
/* fall through */
case 1: case 1:
h ^= data[0]; h ^= data[0];
h *= 0x5bd1e995; h *= 0x5bd1e995;

View File

@ -1390,6 +1390,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
goto done; goto done;
case '+': case '+':
r->plus_in_uri = 1; r->plus_in_uri = 1;
/* fall through */
default: default:
state = sw_usual; state = sw_usual;
*u++ = ch; *u++ = ch;
@ -1431,6 +1432,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
goto done; goto done;
case '+': case '+':
r->plus_in_uri = 1; r->plus_in_uri = 1;
/* fall through */
default: default:
state = sw_usual; state = sw_usual;
*u++ = ch; *u++ = ch;
@ -1478,6 +1480,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
goto done; goto done;
case '+': case '+':
r->plus_in_uri = 1; r->plus_in_uri = 1;
/* fall through */
default: default:
state = sw_usual; state = sw_usual;
*u++ = ch; *u++ = ch;

View File

@ -405,6 +405,7 @@ ngx_signal_handler(int signo)
break; break;
} }
ngx_debug_quit = 1; ngx_debug_quit = 1;
/* fall through */
case ngx_signal_value(NGX_SHUTDOWN_SIGNAL): case ngx_signal_value(NGX_SHUTDOWN_SIGNAL):
ngx_quit = 1; ngx_quit = 1;
action = ", shutting down"; action = ", shutting down";

View File

@ -385,7 +385,12 @@ ngx_start_worker_processes(ngx_cycle_t *cycle, ngx_int_t n, ngx_int_t type)
"start worker processes shm_open"); "start worker processes shm_open");
exit(2); exit(2);
} }
(void) ftruncate(shm_fd, sizeof(sem_t)); r = ftruncate(shm_fd, sizeof(sem_t));
if (r == -1) {
ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_errno,
"start worker processes ftruncate");
exit(2);
}
ngx_ff_worker_sem = (sem_t *) mmap(NULL, sizeof(sem_t), ngx_ff_worker_sem = (sem_t *) mmap(NULL, sizeof(sem_t),
PROT_READ|PROT_WRITE,MAP_SHARED, shm_fd, 0); PROT_READ|PROT_WRITE,MAP_SHARED, shm_fd, 0);
if (ngx_ff_worker_sem == MAP_FAILED) { if (ngx_ff_worker_sem == MAP_FAILED) {