Skip to content

Commit

Permalink
droplet: address future warnings (clang 15)
Browse files Browse the repository at this point in the history
  • Loading branch information
arogge committed Nov 3, 2022
1 parent e84cc4e commit 5921d13
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 6 deletions.
39 changes: 39 additions & 0 deletions cmake/BareosDisableWarnings.cmake
@@ -0,0 +1,39 @@
# BAREOS® - Backup Archiving REcovery Open Sourced
#
# Copyright (C) 2022-2022 Bareos GmbH & Co. KG
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of version three of the GNU Affero General Public
# License as published by the Free Software Foundation and included
# in the file LICENSE.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
# 02110-1301, USA.

function(bareos_target_disable_warnings)
list(POP_FRONT ARGV target)
if(NOT TARGET ${target})
message(FATAL_ERROR "No such target ${target}")
endif()
foreach(warning ${ARGV})
string(REGEX REPLACE "^-W" "" plain_warning ${warning})
string(REGEX REPLACE "-" "_" plain_warning_sym ${plain_warning})
check_c_compiler_flag(
"-W${plain_warning}" "CC_SUPPORTS_W${plain_warning_sym}"
)
check_cxx_compiler_flag(
"-W${plain_warning}" "CXX_SUPPORTS_W${plain_warning_sym}"
)
if(CC_SUPPORTS_W${plain_warning_sym} AND CXX_SUPPORTS_W${plain_warning_sym})
target_compile_options("${target}" PRIVATE "-Wno-${plain_warning}")
target_link_options("${target}" PRIVATE "-Wno-${plain_warning}")
endif()
endforeach()
endfunction()
8 changes: 6 additions & 2 deletions core/src/droplet/libdroplet/CMakeLists.txt
Expand Up @@ -98,8 +98,12 @@ add_library(
src/backend/posix/replyparser.c
)

target_compile_options(droplet PRIVATE -Wno-deprecated-declarations -Wno-extra)
target_link_options(droplet PRIVATE -Wno-deprecated-declarations -Wno-extra)
include(BareosDisableWarnings)
bareos_target_disable_warnings(
droplet -Wdeprecated-declarations -Wunused-but-set-variable
-Wnon-literal-null-conversion -Wsign-compare -Wunused-parameter
-Wdeprecated-non-prototype
)

target_include_directories(
droplet PUBLIC include ${LIBXML2_INCLUDE_DIR} ${JSONC_INCLUDE_DIRS}
Expand Down
5 changes: 4 additions & 1 deletion core/src/droplet/libdroplet/include/droplet.h
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Bareos GmbH & Co. KG
* Copyright (C) 2020-2022 Bareos GmbH & Co. KG
* Copyright (C) 2010 SCALITY SA. All rights reserved.
* http://www.scality.com
*
Expand Down Expand Up @@ -175,6 +175,7 @@ enum dpl_data_type

typedef enum
{
DPL_LOCATION_CONSTRAINT_ERROR = -1,
DPL_LOCATION_CONSTRAINT_UNDEF,
DPL_LOCATION_CONSTRAINT_EU_WEST_1,
DPL_LOCATION_CONSTRAINT_EU_CENTRAL_1,
Expand All @@ -195,6 +196,7 @@ typedef enum

typedef enum
{
DPL_CANNED_ACL_ERROR = -1,
DPL_CANNED_ACL_UNDEF,
DPL_CANNED_ACL_PRIVATE,
DPL_CANNED_ACL_PUBLIC_READ,
Expand Down Expand Up @@ -292,6 +294,7 @@ typedef struct {

typedef enum
{
DPL_STORAGE_CLASS_ERROR = -1,
DPL_STORAGE_CLASS_UNDEF,
DPL_STORAGE_CLASS_STANDARD,
DPL_STORAGE_CLASS_REDUCED_REDUNDANCY,
Expand Down
3 changes: 2 additions & 1 deletion core/src/droplet/libdroplet/src/backend/cdmi/reqbuilder.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Bareos GmbH & Co. KG
* Copyright (C) 2020-2022 Bareos GmbH & Co. KG
* Copyright (C) 2010 SCALITY SA. All rights reserved.
* http://www.scality.com
*
Expand Down Expand Up @@ -153,6 +153,7 @@ dpl_status_t dpl_cdmi_add_sysmd_to_req(const dpl_sysmd_t* sysmd, dpl_req_t* req)

if (sysmd->mask & DPL_SYSMD_MASK_CANNED_ACL) {
switch (sysmd->canned_acl) {
case DPL_CANNED_ACL_ERROR:
case DPL_CANNED_ACL_UNDEF:
n_aces = 0;
break;
Expand Down
5 changes: 4 additions & 1 deletion core/src/droplet/libdroplet/src/converters.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Bareos GmbH & Co. KG
* Copyright (C) 2020-2022 Bareos GmbH & Co. KG
* Copyright (C) 2010 SCALITY SA. All rights reserved.
* http://www.scality.com
*
Expand Down Expand Up @@ -107,6 +107,7 @@ char* dpl_location_constraint_str(dpl_location_constraint_t location_constraint)
{
switch (location_constraint) {
case DPL_LOCATION_CONSTRAINT_UNDEF:
case DPL_LOCATION_CONSTRAINT_ERROR:
return NULL;
/* case DPL_LOCATION_CONSTRAINT_US_STANDARD: */
case DPL_LOCATION_CONSTRAINT_US_EAST_1:
Expand Down Expand Up @@ -156,6 +157,7 @@ dpl_canned_acl_t dpl_canned_acl(char* str)
char* dpl_canned_acl_str(dpl_canned_acl_t canned_acl)
{
switch (canned_acl) {
case DPL_CANNED_ACL_ERROR:
case DPL_CANNED_ACL_UNDEF:
return "undef";
case DPL_CANNED_ACL_PRIVATE:
Expand Down Expand Up @@ -194,6 +196,7 @@ dpl_storage_class_t dpl_storage_class(char* str)
char* dpl_storage_class_str(dpl_storage_class_t storage_class)
{
switch (storage_class) {
case DPL_STORAGE_CLASS_ERROR:
case DPL_STORAGE_CLASS_UNDEF:
return NULL;
case DPL_STORAGE_CLASS_STANDARD:
Expand Down
3 changes: 2 additions & 1 deletion core/src/droplet/libdroplet/src/uks.c
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2020-2021 Bareos GmbH & Co. KG
* Copyright (C) 2020-2022 Bareos GmbH & Co. KG
* Copyright (C) 2010 SCALITY SA. All rights reserved.
* http://www.scality.com
*
Expand Down Expand Up @@ -465,6 +465,7 @@ dpl_status_t dpl_uks_gen_random_key(dpl_ctx_t* ctx,
}

switch (storage_class) {
case DPL_STORAGE_CLASS_ERROR:
case DPL_STORAGE_CLASS_UNDEF:
case DPL_STORAGE_CLASS_STANDARD:
case DPL_STORAGE_CLASS_STANDARD_IA:
Expand Down

0 comments on commit 5921d13

Please sign in to comment.