Skip to content

Conversation

@Lestropie
Copy link
Member

Replacement of #2460. The merge conflicts claimed there were larger in magnitude than the change itself---how much of that was due to #3167 I'm not sure---so I instead re-applied these changes manually.

Would benefit from tests exemplifying the use cases involved to make sure that the warning appears when it should and doesn't when it shouldn't.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions


Header output_header(regrid_filter);
Stride::set_from_command_line(output_header);
if (get_options("template").size() && !get_options("strides").size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'size_type' (aka 'unsigned long') -> bool [readability-implicit-bool-conversion]

Suggested change
if (get_options("template").size() && !get_options("strides").size()) {
if ((get_options("template").size() != 0u) && !get_options("strides").size()) {


Header output_header(regrid_filter);
Stride::set_from_command_line(output_header);
if (get_options("template").size() && !get_options("strides").size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'size_type' (aka 'unsigned long') -> bool [readability-implicit-bool-conversion]

    if (get_options("template").size() && !get_options("strides").size()) {
                                           ^

this fix will not be applied because it overlaps with another fix


Header output_header(regrid_filter);
Stride::set_from_command_line(output_header);
if (get_options("template").size() && !get_options("strides").size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]

Suggested change
if (get_options("template").size() && !get_options("strides").size()) {
if (!get_options("template").empty() && !get_options("strides").size()) {
Additional context

/usr/include/c++/13/bits/stl_vector.h:1087: method 'vector'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^


Header output_header(regrid_filter);
Stride::set_from_command_line(output_header);
if (get_options("template").size() && !get_options("strides").size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]

Suggested change
if (get_options("template").size() && !get_options("strides").size()) {
if (get_options("template").size() && get_options("strides").empty()) {
Additional context

/usr/include/c++/13/bits/stl_vector.h:1087: method 'vector'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^

output_header.transform() = template_header.transform();
}

if (!get_options("strides").size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: implicit conversion 'size_type' (aka 'unsigned long') -> bool [readability-implicit-bool-conversion]

  if (!get_options("strides").size()) {
       ^

this fix will not be applied because it overlaps with another fix

output_header.transform() = template_header.transform();
}

if (!get_options("strides").size()) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: the 'empty' method should be used to check for emptiness instead of 'size' [readability-container-size-empty]

Suggested change
if (!get_options("strides").size()) {
if (get_options("strides").empty()) {
Additional context

/usr/include/c++/13/bits/stl_vector.h:1087: method 'vector'::empty() defined here

      empty() const _GLIBCXX_NOEXCEPT
      ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants