mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
Build user-space with different gcc optimization levels
This fix resolves warnings reported during compiling of user-space libraries with different gcc optimization levels. Tested with gcc versions: 4.9.2 (Debian), and 6.1.1 (Fedora). The patch enables use of following opt levels: O0, O1, O2, O3, Og, Os, Ofast. List of warnings: [GCC 4.9.2 -Os] libzfs_sendrecv.c:3726:26: error: 'clp' may be used uninitialized in this function [-Werror=maybe-uninitialized] [GCC 4.9.2 -Og] fs_fletcher.c:323:26: error: 'idx' may be used uninitialized in this function [-Werror=maybe-uninitialized] dsl_dataset.c:1290:12: error: 'atp' may be used uninitialized in this function [-Werror=maybe-uninitialized] [GCC 4.9.2 -Ofast] u8_textprep.c:1310:9: error: 'tc[3ul]' may be used uninitialized in this function [-Werror=maybe-uninitialized] u8_textprep.c:177:23: error: 'u8t[0ul]' may be used uninitialized in this function [-Werror=maybe-uninitialized] dsl_dataset.c:2089:37: error: ‘hds’ may be used uninitialized in this function [-Werror=maybe-uninitialized] dsl_dataset.c:3216:2: error: ‘ds’ may be used uninitialized in this function [-Werror=maybe-uninitialized] dsl_dataset.c:1591:2: error: ‘ds’ may be used uninitialized in this function [-Werror=maybe-uninitialized] dsl_dataset.c:3341:2: error: ‘ds’ may be used uninitialized in this function [-Werror=maybe-uninitialized] vdev_raidz.c:1153:8: error: 'dcount[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized] vdev_raidz.c:1167:17: error: 'dst[2]' may be used uninitialized in this function [-Werror=maybe-uninitialized] kernel.c:1005:2: error: ‘resid’ may be used uninitialized in this function [-Werror=maybe-uninitialized] libzfs_dataset.c:2826:8: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] libzfs_dataset.c:3056:35: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] libzfs_dataset.c:1584:13: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] libzfs_dataset.c:3056:35: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] libzfs_dataset.c:1792:66: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] libzfs_dataset.c:3986:35: error: ‘val’ may be used uninitialized in this function [-Werror=maybe-uninitialized] [GCC 6.1.1] Resolved in PR #4907 Signed-off-by: Gvozden Neskovic <neskovic@gmail.com> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #4937
This commit is contained in:
parent
afb6c031e8
commit
689f093ebc
@ -2625,7 +2625,7 @@ uint64_t
|
|||||||
zfs_prop_get_int(zfs_handle_t *zhp, zfs_prop_t prop)
|
zfs_prop_get_int(zfs_handle_t *zhp, zfs_prop_t prop)
|
||||||
{
|
{
|
||||||
char *source;
|
char *source;
|
||||||
uint64_t val;
|
uint64_t val = 0;
|
||||||
|
|
||||||
(void) get_numeric_property(zhp, prop, NULL, &source, &val);
|
(void) get_numeric_property(zhp, prop, NULL, &source, &val);
|
||||||
|
|
||||||
|
@ -3710,8 +3710,8 @@ zfs_receive(libzfs_handle_t *hdl, const char *tosnap, nvlist_t *props,
|
|||||||
VERIFY(0 == close(cleanup_fd));
|
VERIFY(0 == close(cleanup_fd));
|
||||||
|
|
||||||
if (err == 0 && !flags->nomount && top_zfs) {
|
if (err == 0 && !flags->nomount && top_zfs) {
|
||||||
zfs_handle_t *zhp;
|
zfs_handle_t *zhp = NULL;
|
||||||
prop_changelist_t *clp;
|
prop_changelist_t *clp = NULL;
|
||||||
|
|
||||||
zhp = zfs_open(hdl, top_zfs, ZFS_TYPE_FILESYSTEM);
|
zhp = zfs_open(hdl, top_zfs, ZFS_TYPE_FILESYSTEM);
|
||||||
if (zhp != NULL) {
|
if (zhp != NULL) {
|
||||||
|
@ -996,7 +996,7 @@ kobj_open_file(char *name)
|
|||||||
int
|
int
|
||||||
kobj_read_file(struct _buf *file, char *buf, unsigned size, unsigned off)
|
kobj_read_file(struct _buf *file, char *buf, unsigned size, unsigned off)
|
||||||
{
|
{
|
||||||
ssize_t resid;
|
ssize_t resid = 0;
|
||||||
|
|
||||||
if (vn_rdwr(UIO_READ, (vnode_t *)file->_fd, buf, size, (offset_t)off,
|
if (vn_rdwr(UIO_READ, (vnode_t *)file->_fd, buf, size, (offset_t)off,
|
||||||
UIO_SYSSPACE, 0, 0, 0, &resid) != 0)
|
UIO_SYSSPACE, 0, 0, 0, &resid) != 0)
|
||||||
|
@ -1060,7 +1060,7 @@ do_composition(size_t uv, uchar_t *s, uchar_t *comb_class, uchar_t *start,
|
|||||||
uchar_t *disp, size_t last, uchar_t **os, uchar_t *oslast)
|
uchar_t *disp, size_t last, uchar_t **os, uchar_t *oslast)
|
||||||
{
|
{
|
||||||
uchar_t t[U8_STREAM_SAFE_TEXT_MAX + 1];
|
uchar_t t[U8_STREAM_SAFE_TEXT_MAX + 1];
|
||||||
uchar_t tc[U8_MB_CUR_MAX];
|
uchar_t tc[U8_MB_CUR_MAX] = { '\0' };
|
||||||
uint8_t saved_marks[U8_MAX_CHARS_A_SEQ];
|
uint8_t saved_marks[U8_MAX_CHARS_A_SEQ];
|
||||||
size_t saved_marks_count;
|
size_t saved_marks_count;
|
||||||
uchar_t *p;
|
uchar_t *p;
|
||||||
@ -1396,7 +1396,7 @@ collect_a_seq(size_t uv, uchar_t *u8s, uchar_t **source, uchar_t *slast,
|
|||||||
uchar_t comb_class[U8_MAX_CHARS_A_SEQ];
|
uchar_t comb_class[U8_MAX_CHARS_A_SEQ];
|
||||||
uchar_t disp[U8_MAX_CHARS_A_SEQ];
|
uchar_t disp[U8_MAX_CHARS_A_SEQ];
|
||||||
uchar_t start[U8_MAX_CHARS_A_SEQ];
|
uchar_t start[U8_MAX_CHARS_A_SEQ];
|
||||||
uchar_t u8t[U8_MB_CUR_MAX];
|
uchar_t u8t[U8_MB_CUR_MAX] = { '\0' };
|
||||||
uchar_t uts[U8_STREAM_SAFE_TEXT_MAX + 1];
|
uchar_t uts[U8_STREAM_SAFE_TEXT_MAX + 1];
|
||||||
uchar_t tc;
|
uchar_t tc;
|
||||||
size_t last;
|
size_t last;
|
||||||
|
@ -294,7 +294,7 @@ int
|
|||||||
fletcher_4_impl_set(const char *val)
|
fletcher_4_impl_set(const char *val)
|
||||||
{
|
{
|
||||||
const fletcher_4_ops_t *ops;
|
const fletcher_4_ops_t *ops;
|
||||||
enum fletcher_selector idx;
|
enum fletcher_selector idx = FLETCHER_FASTEST;
|
||||||
size_t val_len;
|
size_t val_len;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
|
@ -1270,7 +1270,7 @@ dsl_dataset_snapshot_check(void *arg, dmu_tx_t *tx)
|
|||||||
pair != NULL; pair = nvlist_next_nvpair(ddsa->ddsa_snaps, pair)) {
|
pair != NULL; pair = nvlist_next_nvpair(ddsa->ddsa_snaps, pair)) {
|
||||||
int error = 0;
|
int error = 0;
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds;
|
||||||
char *name, *atp;
|
char *name, *atp = NULL;
|
||||||
char dsname[ZFS_MAX_DATASET_NAME_LEN];
|
char dsname[ZFS_MAX_DATASET_NAME_LEN];
|
||||||
|
|
||||||
name = nvpair_name(pair);
|
name = nvpair_name(pair);
|
||||||
@ -1584,7 +1584,7 @@ dsl_dataset_snapshot_tmp_sync(void *arg, dmu_tx_t *tx)
|
|||||||
{
|
{
|
||||||
dsl_dataset_snapshot_tmp_arg_t *ddsta = arg;
|
dsl_dataset_snapshot_tmp_arg_t *ddsta = arg;
|
||||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds = NULL;
|
||||||
|
|
||||||
VERIFY0(dsl_dataset_hold(dp, ddsta->ddsta_fsname, FTAG, &ds));
|
VERIFY0(dsl_dataset_hold(dp, ddsta->ddsta_fsname, FTAG, &ds));
|
||||||
|
|
||||||
@ -2081,7 +2081,7 @@ dsl_dataset_rename_snapshot_sync(void *arg, dmu_tx_t *tx)
|
|||||||
{
|
{
|
||||||
dsl_dataset_rename_snapshot_arg_t *ddrsa = arg;
|
dsl_dataset_rename_snapshot_arg_t *ddrsa = arg;
|
||||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||||
dsl_dataset_t *hds;
|
dsl_dataset_t *hds = NULL;
|
||||||
|
|
||||||
VERIFY0(dsl_dataset_hold(dp, ddrsa->ddrsa_fsname, FTAG, &hds));
|
VERIFY0(dsl_dataset_hold(dp, ddrsa->ddrsa_fsname, FTAG, &hds));
|
||||||
ddrsa->ddrsa_tx = tx;
|
ddrsa->ddrsa_tx = tx;
|
||||||
@ -3209,7 +3209,7 @@ dsl_dataset_set_refquota_sync(void *arg, dmu_tx_t *tx)
|
|||||||
{
|
{
|
||||||
dsl_dataset_set_qr_arg_t *ddsqra = arg;
|
dsl_dataset_set_qr_arg_t *ddsqra = arg;
|
||||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds = NULL;
|
||||||
uint64_t newval;
|
uint64_t newval;
|
||||||
|
|
||||||
VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
|
VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
|
||||||
@ -3336,7 +3336,7 @@ dsl_dataset_set_refreservation_sync(void *arg, dmu_tx_t *tx)
|
|||||||
{
|
{
|
||||||
dsl_dataset_set_qr_arg_t *ddsqra = arg;
|
dsl_dataset_set_qr_arg_t *ddsqra = arg;
|
||||||
dsl_pool_t *dp = dmu_tx_pool(tx);
|
dsl_pool_t *dp = dmu_tx_pool(tx);
|
||||||
dsl_dataset_t *ds;
|
dsl_dataset_t *ds = NULL;
|
||||||
|
|
||||||
VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
|
VERIFY0(dsl_dataset_hold(dp, ddsqra->ddsqra_name, FTAG, &ds));
|
||||||
dsl_dataset_set_refreservation_sync_impl(ds,
|
dsl_dataset_set_refreservation_sync_impl(ds,
|
||||||
|
@ -1103,8 +1103,8 @@ vdev_raidz_matrix_reconstruct(raidz_map_t *rm, int n, int nmissing,
|
|||||||
int i, j, x, cc, c;
|
int i, j, x, cc, c;
|
||||||
uint8_t *src;
|
uint8_t *src;
|
||||||
uint64_t ccount;
|
uint64_t ccount;
|
||||||
uint8_t *dst[VDEV_RAIDZ_MAXPARITY];
|
uint8_t *dst[VDEV_RAIDZ_MAXPARITY] = { NULL };
|
||||||
uint64_t dcount[VDEV_RAIDZ_MAXPARITY];
|
uint64_t dcount[VDEV_RAIDZ_MAXPARITY] = { 0 };
|
||||||
uint8_t log = 0;
|
uint8_t log = 0;
|
||||||
uint8_t val;
|
uint8_t val;
|
||||||
int ll;
|
int ll;
|
||||||
|
Loading…
Reference in New Issue
Block a user