pcb

2 * Opposite conditions in nested 'if' blocks lead to a dead code block

Bug #1308929 reported by dcb on 2014-04-17
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gEDA project
Low
Unassigned
pcb
Low
Unassigned

Bug Description

1.
[surface.c:246] -> [surface.c:247]: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.

Source code is

  if (f->type == GTS_STRING) {
    if (f->type != GTS_STRING) {

2.

[split.c:1399] -> [split.c:1400]: (warning) Opposite conditions in nested 'if' blocks lead to a dead code block.

  if (f->type == GTS_STRING) {
    if (f->type != GTS_STRING) {

Changed in pcb:
status: New → Confirmed
Bert Timmerman (bert-timmerman) wrote :

Hi,

I prepared a patch which may result in a solution, it does compile and removes the opposite and conflicting conditions.

I haven't tested this patch in depth, as I have no (full) knowledge of the gts internals and formats.

I like to here comments and ideas as to tweak this patch some more into a patch which can be committed.

Kind regards,

Bert Timmerman.

Changed in pcb:
importance: Undecided → Low
Traumflug (mah-jump-ing) wrote :

Looking at the code, I don't think removing the outer condition is the right choice. There are several inner conditions and some code without additional condition, which all gets executed unconditionally, then.

A few additional points:

- I've looked up GTS (http://gts.sourceforge.net/), the last release was in 2006, while it was imported to pcb in 2009. Upgrading to the latest GTS is obviously not an option, it is the latest version already.

- As far as I can see, GTS was imported for the Toporouter, and only to get Delaunay triangulations. Toporouter is 2D, while GTS has 3D in mind. It's a rather heavyweight choice.

- Not sure how @dcb made it, but here GTS compiles warning free, with or without the patch.

- It should be an option to remove GTS from pcb entirely and rely on the external package instead. Package name in Debian/Ubuntu is 'libgts-0.7' (runtime) or 'libgts-dev' (build time).

Traumflug (mah-jump-ing) wrote :

Solved by removing GTS sources from the repo. GTS is now a dependency.

Changed in pcb:
status: Confirmed → Fix Committed
Traumflug (mah-jump-ing) on 2015-09-27
Changed in geda-project:
importance: Undecided → Low
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers