Skip to content

Commit

Permalink
Eliminate static analyzer warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsjaar committed Nov 5, 2024
1 parent 10d90f0 commit 9502cc4
Show file tree
Hide file tree
Showing 12 changed files with 39 additions and 39 deletions.
4 changes: 2 additions & 2 deletions packages/seacas/libraries/exodus/src/ex_inquire.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright(C) 1999-2023 National Technology & Engineering Solutions
* Copyright(C) 1999-2024 National Technology & Engineering Solutions
* of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
* NTESS, the U.S. Government retains certain rights in this software.
*
Expand Down Expand Up @@ -980,7 +980,7 @@ static int ex_inquire_internal(int exoid, int req_info, int64_t *ret_int, float
*/
int nc_format = 0;
nc_inq_format(exoid, &nc_format);
*ret_int = (int)nc_format;
*ret_int = nc_format;
} break;

case EX_INQ_THREADSAFE:
Expand Down
6 changes: 3 additions & 3 deletions packages/seacas/libraries/exodus/src/ex_put_field_metadata.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ int ex_put_field_metadata(int exoid, const ex_field field)

exi_persist_redef(exoid, __func__);
int status = 0;
static char *field_template = "Field@%s@%s";
static const char *field_template = "Field@%s@%s";
char attribute_name[NC_MAX_NAME + 1];
snprintf(attribute_name, NC_MAX_NAME + 1, field_template, field.name, "type");
if ((status = ex_put_integer_attribute(exoid, field.entity_type, field.entity_id, attribute_name,
Expand Down Expand Up @@ -136,7 +136,7 @@ int exi_put_type_attribute(int exoid, const char *att_root, const char *name, co
{
int status = EX_NOERR;
if (entry != NULL) {
static char *template = "%s@%s@%s";
static const char *template = "%s@%s@%s";
char attribute_name[NC_MAX_NAME + 1];
snprintf(attribute_name, NC_MAX_NAME + 1, template, att_root, name, type);
if (value_type == EX_INTEGER) {
Expand Down Expand Up @@ -301,7 +301,7 @@ int ex_put_field_suffices(int exoid, const ex_field field, const char *suffices)
char errmsg[MAX_ERR_LENGTH];

char attribute_name[NC_MAX_NAME + 1];
static char *field_template = "Field@%s@%s";
static const char *field_template = "Field@%s@%s";

if (field.type[0] != EX_FIELD_TYPE_USER_DEFINED) {
snprintf(
Expand Down
2 changes: 1 addition & 1 deletion packages/seacas/libraries/ioss/src/Ioss_ChangeSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace Ioss {
class IOSS_EXPORT ChangeSet
{
public:
ChangeSet(Ioss::Region *region);
explicit ChangeSet(Ioss::Region *region);
ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType,
unsigned fileCyclicCount);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ namespace Ioss {
void set_topology_modification(const std::string &model_name, unsigned int type);

private:
DynamicTopologyBroker() {};
DynamicTopologyBroker(DynamicTopologyBroker &);
DynamicTopologyBroker() = default;
DynamicTopologyBroker(DynamicTopologyBroker &) = delete;

std::map<std::string, std::shared_ptr<DynamicTopologyNotifier>> m_notifiers;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Ioss {
class IOSS_EXPORT DynamicTopologyFileControl
{
public:
DynamicTopologyFileControl(Region *region);
explicit DynamicTopologyFileControl(Region *region);

void clone_and_replace_output_database(int steps = 0);
void add_output_database_change_set(int steps = 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ namespace Ioss {
class IOSS_EXPORT DynamicTopologyNotifier
{
public:
DynamicTopologyNotifier(const std::string &model_name) : m_modelName(model_name) {}
explicit DynamicTopologyNotifier(const std::string &model_name) : m_modelName(model_name) {}

virtual ~DynamicTopologyNotifier() = default;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ namespace Ioss {
class IOSS_EXPORT DynamicTopologyObserver
{
public:
DynamicTopologyObserver(Region *region) : m_region(region) {}
explicit DynamicTopologyObserver(Region *region) : m_region(region) {}

virtual ~DynamicTopologyObserver() {}
virtual ~DynamicTopologyObserver() = default;

virtual void reset_topology_modification_all();
virtual void reset_topology_modification();
Expand All @@ -51,7 +51,7 @@ namespace Ioss {
void set_automatic_restart(bool flag) { m_automaticRestart = flag; }
void set_restart_requested(bool flag) { m_restartRequested = flag; }

static const std::string topology_modification_change_name()
static std::string topology_modification_change_name()
{
return std::string("CUMULATIVE_TOPOLOGY_MODIFICATION");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ namespace Ioss {
private:
struct DatabaseState
{
DatabaseState(Ioss::DatabaseIO *db)
explicit DatabaseState(Ioss::DatabaseIO *db)
{
if (!db->supports_internal_change_set()) {
changeSet = db->get_filename();
Expand Down
42 changes: 21 additions & 21 deletions packages/seacas/libraries/ioss/src/Ioss_GroupingEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,20 @@ namespace Ioss {
// ========================================================================
// Property-related information....
// Just forward it through to the property manager...
inline void property_add(const Property &new_prop);
inline void property_erase(const std::string &property_name);
IOSS_NODISCARD inline bool property_exists(const std::string &property_name) const;
IOSS_NODISCARD inline Property get_property(const std::string &property_name) const;
IOSS_NODISCARD inline int64_t get_optional_property(const std::string &property,
void property_add(const Property &new_prop);
void property_erase(const std::string &property_name);
IOSS_NODISCARD bool property_exists(const std::string &property_name) const;
IOSS_NODISCARD Property get_property(const std::string &property_name) const;
IOSS_NODISCARD int64_t get_optional_property(const std::string &property,
int64_t optional_value) const;
IOSS_NODISCARD inline std::string
IOSS_NODISCARD std::string
get_optional_property(const std::string &property_name,
const std::string &optional_value) const;
IOSS_NODISCARD inline NameList property_describe() const;
inline int property_describe(NameList *names) const;
IOSS_NODISCARD inline NameList property_describe(Ioss::Property::Origin origin) const;
inline int property_describe(Ioss::Property::Origin origin, NameList *names) const;
IOSS_NODISCARD inline size_t property_count() const;
IOSS_NODISCARD NameList property_describe() const;
int property_describe(NameList *names) const;
IOSS_NODISCARD NameList property_describe(Ioss::Property::Origin origin) const;
int property_describe(Ioss::Property::Origin origin, NameList *names) const;
IOSS_NODISCARD size_t property_count() const;
/** Add a property, or change its value if it already exists with
a different value */
void property_update(const std::string &property, int64_t value) const;
Expand All @@ -185,16 +185,16 @@ namespace Ioss {
// ========================================================================
// Just forward these through to the field manager...
void field_add(Field new_field);
inline void field_erase(const std::string &field_name);
inline void field_erase(Field::RoleType role);
IOSS_NODISCARD inline bool field_exists(const std::string &field_name) const;
IOSS_NODISCARD inline Field get_field(const std::string &field_name) const;
IOSS_NODISCARD inline const Field &get_fieldref(const std::string &field_name) const;
inline int field_describe(NameList *names) const;
IOSS_NODISCARD inline NameList field_describe() const;
inline int field_describe(Field::RoleType role, NameList *names) const;
IOSS_NODISCARD inline NameList field_describe(Field::RoleType role) const;
IOSS_NODISCARD inline size_t field_count() const;
void field_erase(const std::string &field_name);
void field_erase(Field::RoleType role);
IOSS_NODISCARD bool field_exists(const std::string &field_name) const;
IOSS_NODISCARD Field get_field(const std::string &field_name) const;
IOSS_NODISCARD const Field &get_fieldref(const std::string &field_name) const;
int field_describe(NameList *names) const;
IOSS_NODISCARD NameList field_describe() const;
int field_describe(Field::RoleType role, NameList *names) const;
IOSS_NODISCARD NameList field_describe(Field::RoleType role) const;
IOSS_NODISCARD size_t field_count() const;
IOSS_NODISCARD size_t field_count(Field::RoleType role) const;

IOSS_NODISCARD bool check_for_duplicate(const Ioss::Field &new_field) const;
Expand Down
2 changes: 1 addition & 1 deletion packages/seacas/libraries/ioss/src/exodus/Ioex_ChangeSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Ioex {
class IOEX_EXPORT ChangeSet : public Ioss::ChangeSet
{
public:
ChangeSet(Ioss::Region *region);
explicit ChangeSet(Ioss::Region *region);
ChangeSet(Ioss::DatabaseIO *db, const std::string &dbName, const std::string &dbType,
unsigned fileCyclicCount);

Expand Down
4 changes: 2 additions & 2 deletions packages/seacas/libraries/ioss/src/exonull/Ioexnl_Utils.C
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ namespace Ioexnl {
auto errmsg =
fmt::format("Error: failed to read processor info attribute from file {}", filename);
ex_err_fn(exodusFilePtr, __func__, errmsg.c_str(), status);
return (EX_FATAL) != 0;
return EX_FATAL != 0;
}
}
return matches;
Expand Down Expand Up @@ -488,7 +488,7 @@ namespace Ioexnl {
}
nodes.resize(active);
nodes.shrink_to_fit(); // shrink to fit
return (active != orig_size);
return active != orig_size;
}

void filter_element_list(Ioss::Region *region, Ioss::Int64Vector &elements,
Expand Down
2 changes: 1 addition & 1 deletion packages/seacas/libraries/ioss/src/utest/Utst_sort.C
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ namespace {

TEST_CASE("empty")
{
std::vector<int64_t> x{};
std::vector<int64_t> x;
Ioss::sort(x);
CHECK(verify_sorted(x));
}
Expand Down

0 comments on commit 9502cc4

Please sign in to comment.