sahrk / DGGRID

A command-line application that generates and manipulates icosahedral discrete global grids.
GNU Affero General Public License v3.0
78 stars 26 forks source link

Fix fall-thru #47

Closed r-barnes closed 2 years ago

r-barnes commented 2 years ago

This fixes the fall-thru warning

    Fixes:
/home/rick/projects/dggridR/src/src/DgProjGnomonicRF.cpp:104:14: warning: this statement may fall through [-Wimplicit-fallthrough=]
  104 |       coslam = - coslam;
      |       ~~~~~~~^~~~~~~~~~
/home/rick/projects/dggridR/src/src/DgProjGnomonicRF.cpp:105:4: note: here
  105 |    case S_POLE:
      |    ^~~~
```

by simply duplicating the line. Execution speed is probably unaffected but the code is now easier to understand and doesn't give a compilation warning.
sahrk commented 2 years ago

Sorry, just saw this. I just pushed a macro fix (with comment on the other pull request). I think that is preferable to duplicating code.

r-barnes commented 2 years ago

@sahrk : This looks like it compiles locally, but CRAN will try compiling on a number of machines where this may not work. I'll close this for now since it's easy enough to make another if the issue persists.

sahrk commented 2 years ago

@r-barnes I re-ordered the cases in my FALLTHROUGH macro, to avoid a warning in clang (clang implements the attribute but warns that it's a C++ 11 feature). Hopefully that won't lead to a different warning on another compiler...