andmarti1424 / sc-im

sc-im - Spreadsheet Calculator Improvised -- An ncurses spreadsheet program for terminal
Other
4.77k stars 201 forks source link

Include string.h where needed #830

Closed sjmulder closed 1 year ago

sjmulder commented 1 year ago

This came up before and fizzled out but unfortunately

I believe its included where needed.

it is not:

$ uname -a
SunOS hipster 5.11 illumos-9ffcdb10b6 i86pc i386 i86pc

$ gcc --version
gcc (OpenIndiana 10.5.0-oi-0) 10.5.0
...

$ gmake 2>&1 | grep "implicit declaration"
file.c:199:10: warning: implicit declaration of function 'strcasecmp' [-Wimplicit-function-declaration]
file.c:249:16: warning: implicit declaration of function 'strlen' [-Wimplicit-function-declaration]
file.c:249:16: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:266:28: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:271:31: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:283:9: warning: implicit declaration of function 'strcpy' [-Wimplicit-function-declaration]
file.c:283:9: warning: incompatible implicit declaration of built-in function 'strcpy'
file.c:288:27: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:291:16: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:358:12: warning: incompatible implicit declaration of built-in function 'strcpy'
file.c:529:52: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:532:52: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:536:74: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:537:74: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:538:74: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:539:74: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:540:74: warning: incompatible implicit declaration of built-in function 'strlen'
file.c:541:74: warning: incompatible implicit declaration of built-in function 'strlen'
...

Not including string.h in these files may happen to work on one platform or another because other headers happen to include it, but that shouldn't be relied on - if functions from a certain header are used, the header should be included.

sjmulder commented 1 year ago

Here's the full set of "implicit declaration" warnings: implicit-declarations.txt

andmarti1424 commented 1 year ago

@sjmulder merged. thank you!