NanoComp / libctl

Guile-based library implementing flexible control files for scientific simulations
GNU General Public License v2.0
19 stars 22 forks source link

Restore some C89 compliance (variable declarations in for loops) #54

Closed thchr closed 4 years ago

thchr commented 4 years ago

Attempt to address https://github.com/NanoComp/libctl/pull/53#issuecomment-585901891 and get CI back for MPB.

There are a lot of variable declarations in utils/test-prism.c that are not at the beginning of blocks; I think that is nominally not C89/90 compliant, but if I understand correctly it should not be a problem under gcc. Thus, I just restricted myself to fixing the declarations inside loop blocks.

I also added an exclusion of .dat files to .gitignore, which are generated when running the libctl checks now.

stevengj commented 4 years ago

The geom.c and main.c, along with the public headers, are compiled directly by external packages using libctl, so we aren't under control of the compiler flags used for these files. Hence we should ensure that they compile under both C90 and C99.

For test programs etcetera we control the compiler flags so we can use C99 features there if we want. If we rely on C99 features for the test programs we should probably have a AC_PROG_CC_C99 line in the configure.ac script, though.