chr1shr / voro

Voro++: a three-dimensional Voronoi cell library in C++
Other
154 stars 44 forks source link

Warnings about misleading indention #1

Closed bdice closed 4 years ago

bdice commented 4 years ago

When compiling the freud v2 beta which uses voro++, I get a number of warnings about misleading indentation, pasted below. The for or while loops end on the same line as a separate statement. This is considered "misleading" because users might think that the second statement is also part of the loop. I would like to remove these warnings to prevent confusion for new users compiling freud from source. I will create a PR to add newlines in these locations.

extern/voro++/src/cell.cc: In member function ‘void voro::voronoicell_base::add_memory_vorder(vc_class&)’:
extern/voro++/src/cell.cc:231:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
  for(j=0;j<current_vertex_order;j++) p1[j]=mem[j];while(j<i) p1[j++]=0;
  ^~~
extern/voro++/src/cell.cc:231:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
  for(j=0;j<current_vertex_order;j++) p1[j]=mem[j];while(j<i) p1[j++]=0;
                                                   ^~~~~
extern/voro++/src/cell.cc:237:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
  for(j=0;j<current_vertex_order;j++) p1[j]=mec[j];while(j<i) p1[j++]=0;
  ^~~
extern/voro++/src/cell.cc:237:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
  for(j=0;j<current_vertex_order;j++) p1[j]=mec[j];while(j<i) p1[j++]=0;
                                                   ^~~~~
extern/voro++/src/cell.cc: In member function ‘void voro::voronoicell_base::init_base(double, double, double, double, double, double)’:
extern/voro++/src/cell.cc:293:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
  ^~~
extern/voro++/src/cell.cc:293:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
                                                   ^~
extern/voro++/src/cell.cc: In member function ‘void voro::voronoicell::init_l_shape()’:
extern/voro++/src/cell.cc:320:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
  ^~~
extern/voro++/src/cell.cc:320:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
                                                   ^~
extern/voro++/src/cell.cc: In member function ‘void voro::voronoicell_base::init_octahedron_base(double)’:
extern/voro++/src/cell.cc:359:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
  ^~~
extern/voro++/src/cell.cc:359:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
                                                   ^~
extern/voro++/src/cell.cc: In member function ‘void voro::voronoicell_base::init_tetrahedron_base(double, double, double, double, double, double, double, double, double, double, double, double)’:
extern/voro++/src/cell.cc:385:2: warning: this ‘for’ clause does not guard... [-Wmisleading-indentation]
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
  ^~~
extern/voro++/src/cell.cc:385:51: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the ‘for’
  for(int i=0;i<current_vertex_order;i++) mec[i]=0;up=0;
                                                   ^~