wryun / es-shell

es: a shell with higher-order functions
http://wryun.github.io/es-shell/
Other
307 stars 25 forks source link

Compilation fixes #106

Closed memreflect closed 1 month ago

memreflect commented 1 month ago

Some declarations appeared after executable code in both #59 and #36, which caused issues for compilers that don't support that C99 feature.

Newer compilers on modern systems may complain about the K&R-style getenv replacement code when it's enabled, mainly because of the lack of const-correctness since K&R lacked a const keyword. Nobody uses K&R anymore, and K&R-style function declarations and definitions have been dropped entirely as of C23 as well, so everything gets proper prototypes and function definitions, including gcisblocked() in es.h. Also, implicit function declarations were removed in C99, so a prototype for initgetenv() has been added to es.h for compatibility.

jpco commented 1 month ago

great! does it make sense to change CFLAGS to help enforce these?