Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

obj: add Wswitch-default warning flag #2858

Merged
merged 1 commit into from
Apr 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@ endif
ifeq ($(call check_flag, -Wfloat-equal), y)
DEFAULT_CFLAGS += -Wfloat-equal
endif
ifeq ($(call check_flag, -Wswitch-default), y)
DEFAULT_CFLAGS += -Wswitch-default
endif
endif

ifeq ($(DEBUG),1)
Expand Down
1 change: 1 addition & 0 deletions src/jemalloc/jemalloc.mk
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ CFLAGS_FILTER += -Wshadow
CFLAGS_FILTER += -Wdisabled-macro-expansion
CFLAGS_FILTER += -Wlanguage-extension-token
CFLAGS_FILTER += -Wfloat-equal
CFLAGS_FILTER += -Wswitch-default
JEMALLOC_CFLAGS=$(filter-out $(CFLAGS_FILTER), $(CFLAGS))
ifeq ($(shell uname -s),FreeBSD)
JEMALLOC_CFLAGS += -I/usr/local/include
Expand Down
4 changes: 4 additions & 0 deletions src/libpmemobj/ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,10 @@ ctl_arg_integer(const void *arg, void *dest, size_t dest_size)
return -1;
*(uint8_t *)dest = (uint8_t)val;
break;
default:
ERR("invalid destination size %zu", dest_size);
errno = EINVAL;
return -1;
}

return 0;
Expand Down
4 changes: 4 additions & 0 deletions src/libpmemobj/heap.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,10 @@ heap_reclaim_zone_garbage(struct palloc_heap *heap, struct bucket *bucket,
heap_chunk_write_footer(hdr,
hdr->size_idx);
break;
case CHUNK_TYPE_RUN:
break;
default:
ASSERT(0);
}

i += hdr->size_idx;
Expand Down
2 changes: 1 addition & 1 deletion src/libpmemobj/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1597,7 +1597,7 @@ pmemobj_tx_process(void)
case TX_STAGE_FINALLY:
tx->stage = TX_STAGE_NONE;
break;
case MAX_TX_STAGE:
default:
ASSERT(0);
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/test/tools/ctrld/ctrld.c
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,8 @@ convert_timeout(char *str)
case 'd':
ftimeout *= S_DAY;
break;
default:
break;
}
return (unsigned)ftimeout;
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/tools/pmemobjcli/pmemobjcli.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ parse_stage(void)
case TX_STAGE_FINALLY:
stage = "TX_STAGE_FINALLY";
break;
case MAX_TX_STAGE:
default:
assert(0); /* unreachable */
break;
}
Expand Down
3 changes: 3 additions & 0 deletions src/test/unittest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ endif
ifeq ($(call check_flag, -Wfloat-equal), y)
CFLAGS += -Wfloat-equal
endif
ifeq ($(call check_flag, -Wswitch-default), y)
CFLAGS += -Wswitch-default
endif
endif

ifeq ($(USE_LIBUNWIND),1)
Expand Down
3 changes: 3 additions & 0 deletions src/tools/Makefile.inc
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ endif
ifeq ($(call check_flag, -Wfloat-equal), y)
CFLAGS += -Wfloat-equal
endif
ifeq ($(call check_flag, -Wswitch-default), y)
CFLAGS += -Wswitch-default
endif
endif

ifeq ($(DEBUG),1)
Expand Down
4 changes: 4 additions & 0 deletions src/tools/pmempool/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,10 @@ pmempool_check_func(char *appname, int argc, char *argv[])
outv_err("checking consistency failed\n");
ret = -1;
break;
default:
outv_err("status unknown\n");
ret = -1;
break;
}

return ret;
Expand Down
2 changes: 2 additions & 0 deletions src/tools/pmempool/output.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,8 @@ out_get_arch_machine_str(uint16_t machine)
return "AMD X86-64";
case PMDK_MACHINE_AARCH64:
return "Aarch64";
default:
break;
}

int ret = snprintf(str_buff, STR_MAX, "unknown %u", machine);
Expand Down
6 changes: 6 additions & 0 deletions src/tools/pmempool/rm.c
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,9 @@ rm_file(const char *file)
case ASK_SOMETIMES:
cask = write_protected ? '?' : 'y';
break;
default:
outv_err("unknown state");
return 1;
}

const char *pre_msg = write_protected ? "write-protected " : "";
Expand Down Expand Up @@ -177,6 +180,9 @@ remove_remote(const char *target, const char *pool_set)
case ASK_SOMETIMES:
cask = 'y';
break;
default:
outv_err("unknown state");
return 1;
}

char ans = ask_Yn(cask, "remove remote pool '%s' on '%s'?",
Expand Down
3 changes: 3 additions & 0 deletions utils/check_license/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ endif
ifeq ($(call check_flag, -Wfloat-equal), y)
CFLAGS += -Wfloat-equal
endif
ifeq ($(call check_flag, -Wswitch-default), y)
CFLAGS += -Wswitch-default
endif

TARGET=check-license

Expand Down