pcb

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

Bug #1308929 reported by dcb
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
pcb
Won't Fix
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
Revision history for this message
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
Revision history for this message
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).

Revision history for this message
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)
Changed in geda-project:
importance: Undecided → Low
status: New → Fix Released
Revision history for this message
Chad Parker (parker-charles) wrote :

No longer relevant.

Changed in pcb:
status: Fix Committed → Won't Fix
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.