From b3a853436d1ebdbef7d5721d45fe9fdb5d85c8def54e8a560de0988f5ccffd86 Mon Sep 17 00:00:00 2001 From: Martin Pluskal Date: Thu, 18 May 2017 09:48:38 +0000 Subject: [PATCH] Accepting request 495828 from home:marxin:branches:Base:System Fix last warning spotted by GCC7. OBS-URL: https://build.opensuse.org/request/show/495828 OBS-URL: https://build.opensuse.org/package/show/Base:System/libstoragemgmt?expand=0&rev=37 --- ...ix-gcc-warning-on-fallthrough-switch.patch | 83 +++++++++++++++++++ libstoragemgmt.changes | 6 ++ libstoragemgmt.spec | 3 + 3 files changed, 92 insertions(+) create mode 100644 0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch diff --git a/0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch b/0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch new file mode 100644 index 0000000..5179a32 --- /dev/null +++ b/0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch @@ -0,0 +1,83 @@ +From fa8e9e94c6d06ac135d4363293b00b1a42ebf5c4 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Thu, 23 Feb 2017 22:06:26 +0800 +Subject: [PATCH] Simc plugin: Fix gcc warning on fallthrough switch. + +Issue: + + GCC(gcc-7.0.1-0.9.fc26.x86_64) is warning on fallthrough switch. + +Fix: + Use if and else if check instead. + +Misc: + Don't want to mess with GCC and CLANG on this trivial issue by + using GCC extention: `__attribute__((fallthrough))`. + +Signed-off-by: Gris Ge +--- + plugin/simc/ops_v1_2.c | 38 ++++++++++++++++++-------------------- + 1 file changed, 18 insertions(+), 20 deletions(-) + +diff --git a/plugin/simc/ops_v1_2.c b/plugin/simc/ops_v1_2.c +index 3703161..3bdc2ba 100644 +--- a/plugin/simc/ops_v1_2.c ++++ b/plugin/simc/ops_v1_2.c +@@ -63,36 +63,34 @@ int volume_raid_info(lsm_plugin_ptr c, lsm_volume *volume, + _good(_str_to_int(err_msg, lsm_hash_string_get(sim_p, "member_type"), + (int *) &member_type), rc, out); + +- switch(member_type) { +- case LSM_POOL_MEMBER_TYPE_POOL: ++ if (member_type == LSM_POOL_MEMBER_TYPE_POOL) { + _good(_str_to_uint64(err_msg, lsm_hash_string_get(sim_p, + "parent_pool_id"), + &sim_p_id), rc, out); + _good(_db_sim_pool_of_sim_id(err_msg, db, sim_p_id, &sim_p), rc, out); +- case LSM_POOL_MEMBER_TYPE_DISK: +- _good(_str_to_int(err_msg, lsm_hash_string_get(sim_p, "raid_type"), +- (int *) raid_type), rc, out); +- _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "strip_size"), +- strip_size), rc, out); +- *min_io_size = *strip_size; +- _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "disk_count"), +- disk_count), rc, out); +- _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, +- "data_disk_count"), +- &data_disk_count), rc, out); +- if ((*raid_type == LSM_VOLUME_RAID_TYPE_RAID1) || +- (*raid_type == LSM_VOLUME_RAID_TYPE_JBOD)) +- *opt_io_size = _BLOCK_SIZE; +- else +- *opt_io_size = *strip_size * data_disk_count; +- break; +- default: ++ } else if (member_type != LSM_POOL_MEMBER_TYPE_DISK) { + rc = LSM_ERR_PLUGIN_BUG; + _lsm_err_msg_set(err_msg, "BUG: Got unknown pool member type %d", + member_type); + goto out; + } + ++ _good(_str_to_int(err_msg, lsm_hash_string_get(sim_p, "raid_type"), ++ (int *) raid_type), rc, out); ++ _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "strip_size"), ++ strip_size), rc, out); ++ *min_io_size = *strip_size; ++ _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, "disk_count"), ++ disk_count), rc, out); ++ _good(_str_to_uint32(err_msg, lsm_hash_string_get(sim_p, ++ "data_disk_count"), ++ &data_disk_count), rc, out); ++ if ((*raid_type == LSM_VOLUME_RAID_TYPE_RAID1) || ++ (*raid_type == LSM_VOLUME_RAID_TYPE_JBOD)) ++ *opt_io_size = _BLOCK_SIZE; ++ else ++ *opt_io_size = *strip_size * data_disk_count; ++ + out: + _db_sql_trans_rollback(db); + if (sim_vol != NULL) +-- +2.12.2 + diff --git a/libstoragemgmt.changes b/libstoragemgmt.changes index a8bb6ee..9a9470d 100644 --- a/libstoragemgmt.changes +++ b/libstoragemgmt.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Thu May 18 09:43:43 UTC 2017 - mliska@suse.cz + +- Add 0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch to + fix build with GCC 7. + ------------------------------------------------------------------- Tue May 16 10:30:33 UTC 2017 - mpluskal@suse.com diff --git a/libstoragemgmt.spec b/libstoragemgmt.spec index 08cccca..2f29e8c 100644 --- a/libstoragemgmt.spec +++ b/libstoragemgmt.spec @@ -30,6 +30,8 @@ Source0: https://github.com/libstorage/libstoragemgmt/releases/download/% Patch0: 0001-Fix-gcc-warning-on-non-x86-platform.patch # PATCH-FIX-UPSTREAM 0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch Patch1: 0002-C-library-Bug-fix-for-incorrect-use-of-sizeof.patch +# PATCH-FIX-UPSTREAM 0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch +Patch2: 0001-Simc-plugin-Fix-gcc-warning-on-fallthrough-switch.patch BuildRequires: fdupes BuildRequires: gcc-c++ BuildRequires: libconfig-devel @@ -198,6 +200,7 @@ management via hpssacli. %setup -q %patch0 %patch1 +%patch2 -p1 %build %configure \