Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading indentation #2034

Merged
merged 2 commits into from
Oct 22, 2017

Conversation

moriarty
Copy link
Contributor

This fixes 2 of the 3 files which cause gcc to warn about misleading-intentation. Small changes, but auxiliary.h is included several times causing duplicate warnings.

Compiling with gcc 7.2.1 gave 159 warnings (only 78 of which were unique).
This pull request fixes 23 warnings.

I've put them into two commits, which I can rebase and squash before merging.

For the file which I didn't fix in this pull request, 3 misleading indentation warnings remain.
I can fix and add to this, but first I just wanted to ask for feedback.

The 3rd is outofcore/src/cJSON.cpp lines 41 & 469 are easy.
line 496 not so straightforward to maintain the style of that file- which seems to like piling lines of code on the same line.

cJSON.cpp: In function ‘int cJSON_strcasecmp(const char*, const char*)’:
cJSON.cpp:41:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
  ^~
cJSON.cpp:41:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
                               ^~
cJSON.cpp: In function ‘char* print_object(cJSON*, int, int)’:
cJSON.cpp:469:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if (fmt) *ptr++='\n';*ptr=0;
   ^~
cJSON.cpp:469:24: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   if (fmt) *ptr++='\n';*ptr=0;
                        ^
cJSON.cpp: In function ‘cJSON* cJSON_DetachItemFromArray(cJSON*, int)’:
cJSON.cpp:496:2: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
  if (c->prev) c->prev->next=c->next;if (c->next) c->next->prev=c->prev;if (c==array->child) array->child=c->next;c->prev=c->next=0;return c;}
  ^~
cJSON.cpp:496:37: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
  if (c->prev) c->prev->next=c->next;if (c->next) c->next->prev=c->prev;if (c==array->child) array->child=c->next;c->prev=c->next=0;return c;}
                                     ^~

```
In member function ‘float* pcl::people::HOG::acosTable() const’:
/pcl-trunk/people/src/hog.cpp:421:3: warning: this ‘if’ clause does not guard... [-Wmisleading-indentation]
   if( init ) return a+n2; ni = 2.02f/(float) n;
   ^~
/pcl-trunk/people/src/hog.cpp:421:27: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘if’
   if( init ) return a+n2; ni = 2.02f/(float) n;
                           ^~
```
```
/auxiliary.h: In function ‘void pcl::recognition::aux::expandBoundingBoxToContainPoint(T*, const T*)’:
/auxiliary.h:100:9: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
         else if ( p[0] > bbox[1] ) bbox[1] = p[0];
         ^~~~
/auxiliary.h:102:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
              if ( p[1] < bbox[2] ) bbox[2] = p[1];
              ^~
/auxiliary.h:103:9: warning: this ‘else’ clause does not guard... [-Wmisleading-indentation]
         else if ( p[1] > bbox[3] ) bbox[3] = p[1];
         ^~~~
/auxiliary.h:105:14: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘else’
              if ( p[2] < bbox[4] ) bbox[4] = p[2];
              ^~
```
@moriarty
Copy link
Contributor Author

Here is a gist of the full compile stderr output, before this branch.

https://gist.github.com/moriarty/94dc432313329cec2870204accf4ff00

@taketwo taketwo merged commit c230159 into PointCloudLibrary:master Oct 22, 2017
@taketwo
Copy link
Member

taketwo commented Oct 22, 2017

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants