Remove two GCC (tested on 13.2.0) warnings from code.
I believe if accepted would be good also to put to the pregenerated ones (in include/flatcc/reflection/), but I didn't do that as I supposed maintainer takes usually care of that :-) (can add to PR if needed!)
Example output I see:
/home/foo/bar/generated/flatbuffers_common_builder.h: In function 'flatbuffers_char_array_copy_from_pe':
/home/foo/bar/generated/flatbuffers_common_builder.h:341:3: error: this 'for' clause does not guard... [-Werror=misleading-indentation]
341 | for (i = 0; i < n; ++i) N ## _copy_from_pe(&p[i], &p2[i]); return p; }\
| ^~~
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:341:62: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
341 | for (i = 0; i < n; ++i) N ## _copy_from_pe(&p[i], &p2[i]); return p; }\
| ^~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:340:69: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
340 | { size_t i; if (NS ## is_native_pe()) memcpy(p, p2, n * sizeof(T)); else\
| ^~~~~
341 | for (i = 0; i < n; ++i) N ## _copy_from_pe(&p[i], &p2[i]); return p; }\
|
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:341:62: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
341 | for (i = 0; i < n; ++i) N ## _copy_from_pe(&p[i], &p2[i]); return p; }\
| ^~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h: In function 'flatbuffers_char_array_copy_to_pe':
/home/foo/bar/generated/flatbuffers_common_builder.h:344:3: error: this 'for' clause does not guard... [-Werror=misleading-indentation]
344 | for (i = 0; i < n; ++i) N ## _copy_to_pe(&p[i], &p2[i]); return p; }
| ^~~
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:344:60: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
344 | for (i = 0; i < n; ++i) N ## _copy_to_pe(&p[i], &p2[i]); return p; }
| ^~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:343:69: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
343 | { size_t i; if (NS ## is_native_pe()) memcpy(p, p2, n * sizeof(T)); else\
| ^~~~~
344 | for (i = 0; i < n; ++i) N ## _copy_to_pe(&p[i], &p2[i]); return p; }
|
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:344:60: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
344 | for (i = 0; i < n; ++i) N ## _copy_to_pe(&p[i], &p2[i]); return p; }
| ^~~~~~
/home/foo/bar/generated/flatbuffers_common_builder.h:360:1: note: in expansion of macro '__flatbuffers_define_fixed_array_primitives'
360 | __ ## NS ## define_fixed_array_primitives(NS, N, T)\
| ^~
/home/foo/bar/generated/flatbuffers_common_builder.h:668:1: note: in expansion of macro '__flatbuffers_build_scalar'
668 | __flatbuffers_build_scalar(flatbuffers_, flatbuffers_char, char)
Remove two GCC (tested on 13.2.0) warnings from code.
I believe if accepted would be good also to put to the pregenerated ones (in
include/flatcc/reflection/
), but I didn't do that as I supposed maintainer takes usually care of that :-) (can add to PR if needed!)Example output I see: