On Fri, Aug 01, 2025 at 11:39:34AM -0500, Robert Dubner wrote:
> --- a/gcc/cobol/genutil.cc
> +++ b/gcc/cobol/genutil.cc
> @@ -27,6 +27,9 @@
> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> */
> +
> +// cppcheck-suppress-file duplicateBreak
> +
> #include "cobol-system.h"
> #include "coretypes.h"
> #include "tree.h"
> @@ -1267,7 +1270,7 @@ get_binary_value( tree value,
> cbl_field_type_str(field->type) );
> cbl_internal_error("%s", err);
> abort();
> - // break; // break not needed after abort();
> + break;
Why? Just drop the break. break isn't needed at the end of a switch
anyway. And abort is noreturn.
> @@ -500,13 +502,13 @@ symbol_elem_cmp( const void *K, const void *E )
> }
> return strcasecmp(key.name, elem.name);
> }
> - // break; // This break not needed if all options do a return.
> + break;
> case SymSpecial:
> return special_pair_cmp(k->elem.special, e->elem.special)? 0 : 1;
> - // break; // This break not needed after return.
> + break;
> case SymAlphabet:
> return strcasecmp(k->elem.alphabet.name, e->elem.alphabet.name);
> - // break; // This break not needed after return.
> + break;
> case SymFile:
> // If the key is global, so must be the found element.
> if( (cbl_file_of(k)->attr & global_e) == global_e &&
> @@ -514,7 +516,7 @@ symbol_elem_cmp( const void *K, const void *E )
> return 1;
> }
> return strcasecmp(k->elem.file.name, e->elem.file.name);
> - // break; // This break not needed after return.
> + break;
> }
Similarly for all of these, break after return is just unneeded extra
clutter, plus we have the -Wimplicit-fallthrough warning on, so if one
case would for whatever reason fall through into another one without magic
comment or [[fallthrough]]; attribute etc., we'd get warnings on it.
Jakub