Skip to content

Commit 23ac7f9

Browse files
Clang tidy cleanups (#722)
* Committing clang-format changes * IOSS: Use enum class for Property Origin * Committing clang-format changes * IOSS: Eliminate ostringstream use in most IOSS_ERROR calls * IOSS: Verify assumption with assert * IOSS: Add clarifying comment about unreachable code * Committing clang-format changes * IOSS: Fix bad use of fmt * Committing clang-format changes * IOSS: More IOSS_ERROR refactors * IOSS: Clean up includes * Committing clang-format changes * IOSS: Clean up includes * IOSS: improve const correctness * IOSS: modernize-return-braced-init-list fixes * IOSS: Clang-tidy use contains * IOSS: Add back include * IOSS: Remove old code * Committing clang-format changes * IOSS: Clean up bad edit * IOSS: Replace missing include file * Committing clang-format changes * SLICE: Fix missed email help change * IOSS: Fix bad IOSS_ERROR conversion * Committing clang-format changes --------- Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 4998cfc commit 23ac7f9

File tree

119 files changed

+493
-801
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+493
-801
lines changed

packages/seacas/applications/slice/SL_SystemInterface.C

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,8 @@ bool SystemInterface::parse_options(int argc, char **argv)
250250
fmt::print(stderr, "\n\t Can also set options via SLICE_OPTIONS environment variable.\n");
251251
fmt::print(stderr, "\n\tDocumentation: "
252252
"https://sandialabs.github.io/seacas-docs/sphinx/html/index.html#slice\n");
253-
fmt::print(stderr, "\n\t->->-> Send email to gsjaardema@gmail.com for slice support.<-<-<-\n");
253+
fmt::print(stderr,
254+
"\n\t->->-> Send email to sierra-help@sandia.gov for slice support.<-<-<-\n");
254255
exit(EXIT_SUCCESS);
255256
}
256257

packages/seacas/libraries/ioss/src/Ioss_Assembly.C

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 1999-2021, 2023 National Technology & Engineering Solutions
1+
// Copyright(C) 1999-2021, 2023, 2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -27,40 +27,33 @@ namespace {
2727

2828
// Don't add an assembly to itself...
2929
if (assem == member) {
30-
std::ostringstream errmsg;
31-
fmt::print(errmsg,
32-
"\nERROR: Attempting to add assembly '{}' to itself. This is not allowed.", name);
33-
IOSS_ERROR(errmsg);
30+
IOSS_ERROR(fmt::format(
31+
"\nERROR: Attempting to add assembly '{}' to itself. This is not allowed.", name));
3432
}
3533

3634
// See if there is a member with this name...
3735
const Ioss::GroupingEntity *old_ge = assem->get_member(name);
3836

3937
if (old_ge != nullptr) {
40-
std::string filename = assem->get_database()->get_filename();
41-
int64_t id1 = member->get_optional_property(id_str(), 0);
42-
int64_t id2 = old_ge->get_optional_property(id_str(), 0);
43-
std::ostringstream errmsg;
44-
fmt::print(errmsg,
45-
"\nERROR: There are multiple assembly members named '{}' "
46-
"defined in assembly '{}' in the database file '{}'.\n"
47-
"\tBoth {} {} and {} {} are named '{}'. All names must be unique.",
48-
name, assem->name(), filename, member->type_string(), id1, old_ge->type_string(),
49-
id2, name);
50-
IOSS_ERROR(errmsg);
38+
std::string filename = assem->get_database()->get_filename();
39+
int64_t id1 = member->get_optional_property(id_str(), 0);
40+
int64_t id2 = old_ge->get_optional_property(id_str(), 0);
41+
IOSS_ERROR(fmt::format("\nERROR: There are multiple assembly members named '{}' "
42+
"defined in assembly '{}' in the database file '{}'.\n"
43+
"\tBoth {} {} and {} {} are named '{}'. All names must be unique.",
44+
name, assem->name(), filename, member->type_string(), id1,
45+
old_ge->type_string(), id2, name));
5146
}
5247

5348
if (assem->member_count() > 0) {
5449
if (member->type() != assem->get_member_type()) {
55-
std::ostringstream errmsg;
56-
std::string filename = assem->get_database()->get_filename();
57-
fmt::print(errmsg,
58-
"\nERROR: The entity type of '{}' ({}) does not match the entity type of "
59-
"assembly '{}' ({}).\n\tAn assembly's member entities must be "
60-
"homogeneous. In the database file '{}'.\n",
61-
member->name(), member->type_string(), assem->name(), assem->contains_string(),
62-
filename);
63-
IOSS_ERROR(errmsg);
50+
std::string filename = assem->get_database()->get_filename();
51+
IOSS_ERROR(
52+
fmt::format("\nERROR: The entity type of '{}' ({}) does not match the entity type of "
53+
"assembly '{}' ({}).\n\tAn assembly's member entities must be "
54+
"homogeneous. In the database file '{}'.\n",
55+
member->name(), member->type_string(), assem->name(),
56+
assem->contains_string(), filename));
6457
}
6558
}
6659
}

packages/seacas/libraries/ioss/src/Ioss_ChainGenerator.C

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ namespace {
149149
{
150150
for (const auto &face : faces) {
151151
for (int i = 0; i < face.element_count(); i++) {
152-
auto element = face.element[i] / 10 - offset;
153-
auto side = face.element[i] % 10; // 0-based side
152+
auto element = face.element[i] / 10 - offset;
153+
auto side = face.element[i] % 10; // 0-based side
154+
assert(side < 6);
154155
face_connectivity[element][side] = &face;
155156
}
156157
}

packages/seacas/libraries/ioss/src/Ioss_ChangeSet.C

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,13 @@
66

77
#include "Ioss_ChangeSet.h"
88

9-
#include "Ioss_CodeTypes.h"
109
#include "Ioss_DBUsage.h"
1110

12-
#include "Ioss_DynamicTopology.h"
1311
#include "Ioss_EntityBlock.h"
14-
#include "Ioss_EntityType.h"
15-
#include "Ioss_Field.h"
1612
#include "Ioss_FileInfo.h"
17-
#include "Ioss_GroupingEntity.h"
1813
#include "Ioss_IOFactory.h"
1914

2015
#include <fmt/format.h>
21-
#include <fmt/ostream.h>
2216

2317
#include <assert.h>
2418
#include <iomanip>

packages/seacas/libraries/ioss/src/Ioss_ChangeSetFactory.C

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,11 @@
77
#include "Ioss_ChangeSet.h"
88
#include "Ioss_ChangeSetFactory.h"
99
#include "Ioss_Utils.h" // for IOSS_ERROR
10-
#include "Ioss_Version.h"
11-
#include <fmt/format.h>
1210
#include <fmt/ostream.h>
13-
#include <fmt/ranges.h>
14-
#include <map> // for _Rb_tree_iterator, etc
15-
#include <ostream> // for basic_ostream, etc
16-
#include <set>
11+
#include <map> // for _Rb_tree_iterator, etc
1712
#include <string> // for char_traits, string, etc
1813

1914
#include "Ioss_CodeTypes.h"
20-
#include "Ioss_DBUsage.h" // for DatabaseUsage
21-
#include "Ioss_PropertyManager.h"
2215
#include "Ioss_Region.h"
2316

2417
namespace {

packages/seacas/libraries/ioss/src/Ioss_Compare.C

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 1999-2024 National Technology & Engineering Solutions
1+
// Copyright(C) 1999-2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -7,7 +7,6 @@
77
#include <assert.h>
88
#include <cmath>
99
#include <fmt/ostream.h>
10-
#include <fmt/ranges.h>
1110
#include <iosfwd>
1211
#include <stdint.h>
1312
#include <stdlib.h>

packages/seacas/libraries/ioss/src/Ioss_ConcreteVariableType.C

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 1999-2020, 2022, 2023, 2024 National Technology & Engineering Solutions
1+
// Copyright(C) 1999-2020, 2022, 2023, 2024, 2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -457,48 +457,48 @@ std::string Ioss::TestOnly::label(int which, const char /*suffix_sep*/) const
457457
}
458458

459459
// Define all factories here:
460-
void Ioss::Invalid_Storage::factory() { static Ioss::Invalid_Storage registerThis; }
460+
void Ioss::Invalid_Storage::factory() { static Ioss::Invalid_Storage const registerThis; }
461461

462-
void Ioss::Scalar::factory() { static Ioss::Scalar registerThis; }
462+
void Ioss::Scalar::factory() { static Ioss::Scalar const registerThis; }
463463

464-
void Ioss::Vector_2D::factory() { static Ioss::Vector_2D registerThis; }
464+
void Ioss::Vector_2D::factory() { static Ioss::Vector_2D const registerThis; }
465465

466-
void Ioss::Vector_3D::factory() { static Ioss::Vector_3D registerThis; }
466+
void Ioss::Vector_3D::factory() { static Ioss::Vector_3D const registerThis; }
467467

468-
void Ioss::Quaternion_2D::factory() { static Ioss::Quaternion_2D registerThis; }
468+
void Ioss::Quaternion_2D::factory() { static Ioss::Quaternion_2D const registerThis; }
469469

470-
void Ioss::Quaternion_3D::factory() { static Ioss::Quaternion_3D registerThis; }
470+
void Ioss::Quaternion_3D::factory() { static Ioss::Quaternion_3D const registerThis; }
471471

472-
void Ioss::Full_Tensor_36::factory() { static Ioss::Full_Tensor_36 registerThis; }
472+
void Ioss::Full_Tensor_36::factory() { static Ioss::Full_Tensor_36 const registerThis; }
473473

474-
void Ioss::Full_Tensor_32::factory() { static Ioss::Full_Tensor_32 registerThis; }
474+
void Ioss::Full_Tensor_32::factory() { static Ioss::Full_Tensor_32 const registerThis; }
475475

476-
void Ioss::Full_Tensor_22::factory() { static Ioss::Full_Tensor_22 registerThis; }
476+
void Ioss::Full_Tensor_22::factory() { static Ioss::Full_Tensor_22 const registerThis; }
477477

478-
void Ioss::Full_Tensor_16::factory() { static Ioss::Full_Tensor_16 registerThis; }
478+
void Ioss::Full_Tensor_16::factory() { static Ioss::Full_Tensor_16 const registerThis; }
479479

480-
void Ioss::Full_Tensor_12::factory() { static Ioss::Full_Tensor_12 registerThis; }
480+
void Ioss::Full_Tensor_12::factory() { static Ioss::Full_Tensor_12 const registerThis; }
481481

482-
void Ioss::Sym_Tensor_33::factory() { static Ioss::Sym_Tensor_33 registerThis; }
482+
void Ioss::Sym_Tensor_33::factory() { static Ioss::Sym_Tensor_33 const registerThis; }
483483

484-
void Ioss::Sym_Tensor_31::factory() { static Ioss::Sym_Tensor_31 registerThis; }
484+
void Ioss::Sym_Tensor_31::factory() { static Ioss::Sym_Tensor_31 const registerThis; }
485485

486-
void Ioss::Sym_Tensor_21::factory() { static Ioss::Sym_Tensor_21 registerThis; }
486+
void Ioss::Sym_Tensor_21::factory() { static Ioss::Sym_Tensor_21 const registerThis; }
487487

488-
void Ioss::Sym_Tensor_13::factory() { static Ioss::Sym_Tensor_13 registerThis; }
488+
void Ioss::Sym_Tensor_13::factory() { static Ioss::Sym_Tensor_13 const registerThis; }
489489

490-
void Ioss::Sym_Tensor_11::factory() { static Ioss::Sym_Tensor_11 registerThis; }
490+
void Ioss::Sym_Tensor_11::factory() { static Ioss::Sym_Tensor_11 const registerThis; }
491491

492-
void Ioss::Sym_Tensor_10::factory() { static Ioss::Sym_Tensor_10 registerThis; }
492+
void Ioss::Sym_Tensor_10::factory() { static Ioss::Sym_Tensor_10 const registerThis; }
493493

494-
void Ioss::Asym_Tensor_03::factory() { static Ioss::Asym_Tensor_03 registerThis; }
494+
void Ioss::Asym_Tensor_03::factory() { static Ioss::Asym_Tensor_03 const registerThis; }
495495

496-
void Ioss::Asym_Tensor_02::factory() { static Ioss::Asym_Tensor_02 registerThis; }
496+
void Ioss::Asym_Tensor_02::factory() { static Ioss::Asym_Tensor_02 const registerThis; }
497497

498-
void Ioss::Asym_Tensor_01::factory() { static Ioss::Asym_Tensor_01 registerThis; }
498+
void Ioss::Asym_Tensor_01::factory() { static Ioss::Asym_Tensor_01 const registerThis; }
499499

500-
void Ioss::Matrix_22::factory() { static Ioss::Matrix_22 registerThis; }
500+
void Ioss::Matrix_22::factory() { static Ioss::Matrix_22 const registerThis; }
501501

502-
void Ioss::Matrix_33::factory() { static Ioss::Matrix_33 registerThis; }
502+
void Ioss::Matrix_33::factory() { static Ioss::Matrix_33 const registerThis; }
503503

504-
void Ioss::TestOnly::factory() { static Ioss::TestOnly registerThis; }
504+
void Ioss::TestOnly::factory() { static Ioss::TestOnly const registerThis; }

packages/seacas/libraries/ioss/src/Ioss_CopyDatabase.C

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -317,11 +317,9 @@ void Ioss::copy_database(Ioss::Region &region, Ioss::Region &output_region,
317317
int min_step_count = dbi->util().global_minmax(step_count, Ioss::ParallelUtils::DO_MIN);
318318
int max_step_count = dbi->util().global_minmax(step_count, Ioss::ParallelUtils::DO_MAX);
319319
if (min_step_count != max_step_count) {
320-
std::ostringstream errmsg;
321-
fmt::print(errmsg,
322-
"ERROR: Number of timesteps does not match on all ranks. Range from {} to {}.\n",
323-
min_step_count, max_step_count);
324-
IOSS_ERROR(errmsg);
320+
IOSS_ERROR(fmt::format(
321+
"ERROR: Number of timesteps does not match on all ranks. Range from {} to {}.\n",
322+
min_step_count, max_step_count));
325323
}
326324
#endif
327325
for (int istep = 1; istep <= step_count; istep++) {
@@ -475,9 +473,7 @@ namespace {
475473
dbi->progress("DEFINING MODEL");
476474
if (!output_region.begin_mode(Ioss::STATE_DEFINE_MODEL)) {
477475
if (options.verbose) {
478-
std::ostringstream errmsg;
479-
fmt::print(errmsg, "ERROR: Could not put output region into define model state\n");
480-
IOSS_ERROR(errmsg);
476+
IOSS_ERROR("ERROR: Could not put output region into define model state\n");
481477
}
482478
else {
483479
std::exit(EXIT_FAILURE);

packages/seacas/libraries/ioss/src/Ioss_DatabaseIO.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,15 +846,15 @@ namespace Ioss {
846846
virtual int num_internal_change_set_nl() { return 0; }
847847
virtual Ioss::NameList internal_change_set_describe_nl(bool /* return_full_names */)
848848
{
849-
return Ioss::NameList();
849+
return {};
850850
}
851851

852852
virtual bool begin_nl(Ioss::State state) = 0;
853853
virtual bool end_nl(Ioss::State state) = 0;
854854

855855
virtual void read_meta_data_nl() = 0;
856856
virtual void get_step_times_nl() {}
857-
virtual std::vector<double> get_db_step_times_nl() { return std::vector<double>(); }
857+
virtual std::vector<double> get_db_step_times_nl() { return {}; }
858858

859859
virtual bool begin_state_nl(int state, double time);
860860
virtual bool end_state_nl(int state, double time);

packages/seacas/libraries/ioss/src/Ioss_DynamicTopologyNotifier.C

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright(C) 2024 National Technology & Engineering Solutions
1+
// Copyright(C) 2024, 2025 National Technology & Engineering Solutions
22
// of Sandia, LLC (NTESS). Under the terms of Contract DE-NA0003525 with
33
// NTESS, the U.S. Government retains certain rights in this software.
44
//
@@ -8,9 +8,7 @@
88

99
#include <algorithm>
1010
#include <assert.h>
11-
#include <climits>
1211
#include <cstddef>
13-
#include <functional>
1412

1513
namespace Ioss {
1614

0 commit comments

Comments
 (0)