Commit 82d151e
committed
Require C99
This commit is a compilation of many old patches of mine.
It removes obsolete code and enforces C99 as a build
requirement.
Changes:
- Remove many unused tests and useless feature tests.
(This was a bit more involved for <sys/types.h>, which
had annoying special casing.) This included the
'check for global headers' in the iffe script.
- Assume fchmod is present and use it instead of chmod in
shcomp for slightly better performance.
- dotpaths_lib(): Use fstat rather than stat for the PWD
for better performance.
- Scrap pre-C99 fallbacks for iswblank(3).
- Replaced usage of the obsolescent timeofday() macro with the
more portable tvgettime() function in libast, which itself uses
the modern clock_gettime internally.
- Replaced usage of strcopy with either strcpy or stpcpy in
cases where no buffer overlap occurs. There are perhaps
more places where replacement is possible (ksh93v- and ksh2020
do this far more liberally), but I'm trying to be conservative
with these changes to avoid accidentally introducing bugs.
- Replaced an instance of strncopy with strlcpy in keytrap()
because the buffers don't overlap.
- Also replaced some instances of strncpy with strlcpy
(vide att#266 and f63ebd0).
- Add pertinent documentation as it relates to str*copy's
usage with overlapping buffers.
- Backported a modified version of ksh93v-'s stpcpy fallback.
- Introduced usage of C99 restrict, primarily for standards
compliance in compatibility functions (though some regular
functions like sfopen() do also use restrict now).
- Assume C99 __func__ is available and drop now unneeded
C90 feature tests.
- Added a few casts to fix some compiler warnings.
- Remove basic iffe probes for various C99 multibyte functions
(excluding those that still need tests due to platform-specific
bugs). Also removed other unnecessary probes for C99 and POSIX
functionality.
- Remove unnecessary mktime.c, wc.c and wordexp.c compat files
(the operating system should provide these functions).
- Switched to using C99-style struct init throughout the codebase.
- Removed usage of bzero, bcopy, memclear and memzero in favor
of ISO C memset and memcpy.
- make.probe: Automatically use the latest C standard available
(i.e. C23) because GCC/Clang may use something older by default
whilst having support for newer standards.
I have additional changes for using C99-style for loops and bools,
but those have been excluded because this patch is big enough as it is.
Progresses #777
(This commit doesn't include or fix the removed _c99_in_the_wild code.)1 parent 8d24508 commit 82d151e
129 files changed
Lines changed: 641 additions & 1680 deletions
File tree
- src
- cmd
- INIT
- builtin
- ksh93
- bltins
- data
- edit
- features
- include
- sh
- lib
- libast
- cdt
- comp
- disc
- features
- include
- man
- misc
- port
- regex
- sfio
- stdio
- std
- string
- tm
- libcmd
- features
- libdll
- libsum
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
| 33 | + | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
| |||
689 | 689 | | |
690 | 690 | | |
691 | 691 | | |
692 | | - | |
| 692 | + | |
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
| |||
1162 | 1162 | | |
1163 | 1163 | | |
1164 | 1164 | | |
1165 | | - | |
1166 | 1165 | | |
1167 | 1166 | | |
1168 | 1167 | | |
| |||
2263 | 2262 | | |
2264 | 2263 | | |
2265 | 2264 | | |
2266 | | - | |
2267 | | - | |
2268 | | - | |
2269 | | - | |
2270 | | - | |
2271 | | - | |
2272 | | - | |
2273 | | - | |
2274 | | - | |
2275 | | - | |
2276 | | - | |
2277 | | - | |
2278 | | - | |
2279 | | - | |
2280 | | - | |
2281 | | - | |
2282 | | - | |
2283 | | - | |
2284 | | - | |
2285 | | - | |
2286 | | - | |
2287 | | - | |
2288 | | - | |
2289 | | - | |
2290 | | - | |
2291 | | - | |
2292 | | - | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
2302 | | - | |
2303 | | - | |
2304 | | - | |
2305 | | - | |
2306 | | - | |
2307 | | - | |
2308 | | - | |
2309 | | - | |
2310 | | - | |
2311 | 2265 | | |
2312 | 2266 | | |
2313 | 2267 | | |
| |||
0 commit comments