diff options
author | Robert Dubner <rdubner@symas.com> | 2025-08-01 10:37:38 -0400 |
---|---|---|
committer | Robert Dubner <rdubner@symas.com> | 2025-08-01 12:34:53 -0400 |
commit | 8b06c58c4ae83d4007510f2d2c74ee979bc2b86a (patch) | |
tree | 48ac56468569521fc95b44496db21f84ae76b006 /gcc | |
parent | 08196f044015737b81a454864684e57fbfc5b1a9 (diff) | |
download | gcc-8b06c58c4ae83d4007510f2d2c74ee979bc2b86a.zip gcc-8b06c58c4ae83d4007510f2d2c74ee979bc2b86a.tar.gz gcc-8b06c58c4ae83d4007510f2d2c74ee979bc2b86a.tar.bz2 |
cobol: Minor changes to quiet cppcheck warnings. [PR119324]
gcc/cobol/ChangeLog:
PR cobol/119324
* cbldiag.h (location_dump): Inline suppression of knownConditionTrueFalse.
* genapi.cc (parser_statement_begin): Combine two if() statements.
* genutil.cc (get_binary_value): File-level suppression of duplicateBreak.
* symbols.cc (symbol_elem_cmp): File-level suppression of duplicateBreak.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cobol/cbldiag.h | 2 | ||||
-rw-r--r-- | gcc/cobol/genapi.cc | 5 | ||||
-rw-r--r-- | gcc/cobol/genutil.cc | 5 | ||||
-rw-r--r-- | gcc/cobol/symbols.cc | 10 |
4 files changed, 12 insertions, 10 deletions
diff --git a/gcc/cobol/cbldiag.h b/gcc/cobol/cbldiag.h index 39f1369..dd16190 100644 --- a/gcc/cobol/cbldiag.h +++ b/gcc/cobol/cbldiag.h @@ -122,7 +122,7 @@ static void location_dump( const char func[], int line, const char tag[], const LOC& loc) { extern int yy_flex_debug; // cppcheck-suppress shadowVariable if( yy_flex_debug ) { - const char *detail = gcobol_getenv("update_location"); + const char *detail = gcobol_getenv("update_location"); // cppcheck-suppress knownConditionTrueFalse if( detail ) { fprintf(stderr, "%s:%d: %s location (%d,%d) to (%d,%d)\n", func, line, tag, diff --git a/gcc/cobol/genapi.cc b/gcc/cobol/genapi.cc index 2034164..c9d2da4 100644 --- a/gcc/cobol/genapi.cc +++ b/gcc/cobol/genapi.cc @@ -1198,12 +1198,9 @@ parser_statement_begin( const cbl_name_t statement_name, if( exception_processing ) { store_location_stuff(statement_name); - } - - if( exception_processing ) - { set_exception_environment(ecs, dcls); } + sv_is_i_o = false; } diff --git a/gcc/cobol/genutil.cc b/gcc/cobol/genutil.cc index 7895ea8..a5f69a0 100644 --- 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; } } diff --git a/gcc/cobol/symbols.cc b/gcc/cobol/symbols.cc index 7d6a955..f2cd1b5 100644 --- a/gcc/cobol/symbols.cc +++ b/gcc/cobol/symbols.cc @@ -28,6 +28,8 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +// cppcheck-suppress-file duplicateBreak + #include "config.h" #include <fstream> // Before cobol-system because it uses poisoned functions #include "cobol-system.h" @@ -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; } assert(k->type == SymField); |