hdf5 icon indicating copy to clipboard operation
hdf5 copied to clipboard

Make header files sortable.

Open hyoklee opened this issue 2 years ago • 2 comments

Is your feature request related to a problem? Please describe.

H5ES won't compile if SortIncludes: true in .clang-format.

  CC       H5ES.lo
In file included from H5ESdevelop.h:22,
                 from H5ESprivate.h:28,
                 from H5ESpkg.h:29,
                 from H5ES.c:37:
H5ESpublic.h:94:5: error: unknown type name ‘hid_t’
   94 |     hid_t err_stack_id; /**< ID for error stack from failed operation */
      |     ^~~~~
H5ESpublic.h:131:43: error: unknown type name ‘hid_t’; did you mean ‘id_t’?
  131 |                                           hid_t err_stack, void *ctx);
      |                                           ^~~~~
      |                                           id_t
H5ESpublic.h:158:8: error: unknown type name ‘hid_t’; did you mean ‘id_t’?
  158 | H5_DLL hid_t H5EScreate(void);
      |        ^~~~~
      |        id_t

Describe the solution you'd like

Make headers sortable by clang formatter.

hyoklee avatar Apr 21 '23 17:04 hyoklee

This probably won't be fixed for a little while since it's low priority, but the fundamental problem is that we have a LOT of problems with fragile typedef ordering. I have some potential fixes in mind, but they'll take a little while to implement and we'll have to discuss it in an engineering meeting.

derobins avatar Apr 30 '23 20:04 derobins

Nice try but not enough.

Compiling src/H5FDonion_*.c will fail. Compiling test/h5test.c will fail.

Please test with SortIncludes: true in.clang-format. I will leave it open until all headers are truly independent and sortable.

hyoklee avatar May 07 '23 01:05 hyoklee