Interesting GCC 9 warnings

Hi, Matthias!

I tried to compile KLayout with GCC 9 with as much warnings enables as possible.

I found next interesting occurrences:

src/db/db/dbDeepEdges.cc:594:67: warning: this condition has identical branches [-Wduplicated-branches]

const db::Shapes &s = c->shapes (filter.requires_raw_input () ? edges.layer () : edges.layer ());

src/tl/tl/tlUri.cc:123:40: warning: this condition has identical branches [-Wduplicated-branches]

if (ex.test ("//") || (ex.test ("/") ? prefer_authority : prefer_authority))

src/tl/tl/tlUri.cc:44:23: warning: logical ‘or’ of collectively exhaustive tests is always true [-Wlogical-op]

else if (c >= 'a' || c < = 'f')

Comments

  • Overall warnings by type statistics, but warnings may be duplicated because of different headers search paths:

    cast-function-type             1
    cast-qual                      14239
    catch-value=                   25
    deprecated-copy                1046
    deprecated-declarations        1654
    duplicated-branches            4
    extra                          6
    format-security                10
    logical-op                     1
    parentheses                    28
    pedantic                       1
    shift-negative-value           1
    sign-compare                   2
    suggest-override               163888
    unused-but-set-variable        3
    unused-parameter               1
    
  • -Wcatch-value warnings. Such exceptions should be caught by const reference.

    src/db/db/dbLayoutDiff.cc:1259:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1269:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1279:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1290:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1300:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1310:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1320:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1330:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1346:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1369:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1382:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1404:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1414:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1427:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1442:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1455:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1470:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1483:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1498:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1511:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1526:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/db/db/dbLayoutDiff.cc:1539:16: warning: catching polymorphic type ‘struct tl::CancelException’ by value [-Wcatch-value=]
    src/tl/unit_tests/tlExpression.cc:936:16: warning: catching polymorphic type ‘class tl::EvalError’ by value [-Wcatch-value=]
    src/tl/unit_tests/tlExpression.cc:944:16: warning: catching polymorphic type ‘class tl::EvalError’ by value [-Wcatch-value=]
    src/tl/unit_tests/tlExpression.cc:956:16: warning: catching polymorphic type ‘class tl::EvalError’ by value [-Wcatch-value=]
    
Sign In or Register to comment.