Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
82d151e
Require C99
JohnoKing Mar 31, 2026
1acb77f
Merge upstream/dev
JohnoKing Apr 2, 2026
f2fcfe9
Add restrict
JohnoKing Apr 3, 2026
85ea518
Merge branch 'dev' into require-c99
JohnoKing Apr 3, 2026
30150d3
Slight reverts: only memset after sfsync(); use memset in _dtopen()
JohnoKing Apr 5, 2026
58bda05
Merge upstream/dev
JohnoKing Apr 5, 2026
d3a721b
Revert "long double" strtold for now
JohnoKing Apr 5, 2026
ddf439a
b_cksum(): Move state init to improve vzeroupper placement in asm
JohnoKing Apr 5, 2026
b08dd78
sfstrtof.h: add comment about new S2F_type 3
McDutchie Apr 5, 2026
e94bffd
Merge branch 'dev' into require-c99
McDutchie Apr 5, 2026
1fb7048
housekeeping
McDutchie Apr 5, 2026
975bbeb
Fix stpcpy declaration
JohnoKing Apr 5, 2026
e07c003
Readd _lib_wcwidth test for QNX
JohnoKing Apr 5, 2026
980ac0d
Readd iswblank fallbacks
JohnoKing Apr 5, 2026
d902d19
fix typo in isblank() in lexstates.h
McDutchie Apr 6, 2026
102a16b
features/standards: rm outdated comment on avoiding -std= on solaris
McDutchie Apr 6, 2026
921a0b6
iswalpha() requires wint_t, not wchar_t
JohnoKing Apr 6, 2026
7907c0d
Merge branch 'dev' into require-c99
McDutchie Apr 8, 2026
5a9fbf8
Revert -std= probe
JohnoKing Apr 9, 2026
fcb0ee2
Merge upstream/dev
JohnoKing Apr 14, 2026
4bee8c8
Merge upstream/dev
JohnoKing Apr 15, 2026
7488e8a
Add cast to appease glibc's version of C23 strchr
JohnoKing Apr 15, 2026
b28546d
bump version dates and NEWS item
McDutchie Apr 15, 2026
49964fe
hello.c: rewrite to require C99
McDutchie Apr 15, 2026
5bdf503
package: include CCFLAGS when compiling hello.c
McDutchie Apr 15, 2026
76df84d
Next QNX fix attempt: Move all _FILE_defined hackery into ast_std.h
JohnoKing Apr 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ This documents significant changes in the dev branch of ksh 93u+m.
For full details, see the git log at: https://github.com/ksh93/ksh
Uppercase BUG_* IDs are shell bug IDs as used by the Modernish shell library.

2026-04-15:

- The ksh93 codebase now requires a C99 compiler to build.

2026-04-14:

- Ksh is now capable of allocating memory within a 64-bit address space. This
Expand Down
13 changes: 5 additions & 8 deletions bin/package
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ command=${0##*/}
case $(getopts '[-][123:xyz]' opt --xyz 2>/dev/null; echo 0$opt) in
0123) USAGE=$'
[-?
@(#)$Id: '$command$' (ksh 93u+m) 2026-04-02 $
@(#)$Id: '$command$' (ksh 93u+m) 2026-04-15 $
]
[-author?Glenn Fowler <gsf@research.att.com>]
[-author?Contributors to https://github.com/ksh93/ksh]
Expand Down Expand Up @@ -559,7 +559,7 @@ SEE ALSO
pkgadd(1), pkgmk(1), rpm(1), sh(1), tar(1), optget(3)

IMPLEMENTATION
version package (ksh 93u+m) 2026-04-02
version package (ksh 93u+m) 2026-04-15
author Glenn Fowler <gsf@research.att.com>
author Contributors to https://github.com/ksh93/ksh
copyright (c) 1994-2012 AT&T Intellectual Property
Expand Down Expand Up @@ -2010,12 +2010,9 @@ case $x in
cd "$TMPDIR" || exit
cp $INITROOT/hello.c pkg$$.c || exit
trap "set +o noglob; rm -rf pkg$$.*" 0
if ! $cc -o pkg$$.exe pkg$$.c >pkg$$.e 2>&1
then if $cc -Dnew=old -o pkg$$.exe pkg$$.c >/dev/null 2>&1
then err_out "$CC: must be a C compiler (not C++)"
fi
cat pkg$$.e
err_out "$CC: failed to compile and link $INITROOT/hello.c -- is it a C compiler?"
if ! $cc $CCFLAGS -o pkg$$.exe pkg$$.c >pkg$$.e 2>&1
then cat pkg$$.e
err_out "$CC: failed to compile and link $INITROOT/hello.c -- is it a C99 compiler?"
fi
./pkg$$.exe >/dev/null 2>&1 || err_out \
"Cross-compiling is not supported. $CC seems to be a cross-compiler." \
Expand Down
2 changes: 1 addition & 1 deletion src/cmd/INIT/README-mamake.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ MAM (Make Abstract Machine) is a simple rule-based make language
that is implemented in just ten four-letter commands and four attributes,
yet allows unlimited flexibility as it can execute arbitrary shell code.
The program implementing MAM, `mamake`,
is a portable C90 program written in a single file, `mamake.c`.
is a portable C99 program written in a single file, `mamake.c`.
This allows ksh 93u+m,
or other programs using this build system,
to be built using only a standard C compiler and utilities installation
Expand Down
34 changes: 29 additions & 5 deletions src/cmd/INIT/hello.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* *
* This software is part of the ast package *
* Copyright (c) 1994-2011 AT&T Intellectual Property *
* Copyright (c) 2020-2023 Contributors to ksh 93u+m *
* Copyright (c) 2020-2026 Contributors to ksh 93u+m *
* and is licensed under the *
* Eclipse Public License, Version 2.0 *
* *
Expand All @@ -15,7 +15,31 @@
* Johnothan King <johnothanking@protonmail.com> *
* *
***********************************************************************/
#ifndef printf
#include <stdio.h>
#endif
int main(void) { int new = 0; printf("hello world\n"); return new;}

/*
* Compiler test used by bin/package to enforce C99 and block C++
*/

struct foo
{
char *bar;
/* flexible array member requires C99 */
int baz[];
};

/* restrict requires C99, is an error in C++ */
void r(const char *restrict cp)
{
(void)cp;
}

int main(void)
{
/* designated struct initializer requires C99 */
struct foo s = { .bar = "quux" };
/* variable name 'new' is an error in C++ */
int new = 0;

r(s.bar);
return new;
}
58 changes: 6 additions & 52 deletions src/cmd/INIT/iffe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ esac
set -o noglob

command=iffe
version=2026-02-30
version=2026-04-15

# DEFPATH should be inherited from package(1)
case $DEFPATH in
Expand Down Expand Up @@ -82,10 +82,10 @@ is_hdr() # [ - ] [ file.c ] hdr
esac
is hdr $1
case $1 in
sys/types.h | limits.h | stdio.h | unistd.h)
# These are often tested for repeatedly, especially sys/types.h.
# But POSIX has specified these since issue 1 (1988). It's 2023.
# Skip the compile to save time, but act like a positive test.
sys/types.h | limits.h | stddef.h | stdio.h | stdlib.h | unistd.h)
# These are often tested for repeatedly, but POSIX has specified
# these since issue 1 (1988). It's 2026. Skip the compile to save time,
# but act like a positive test.
: 2>$tmp.e
;;
*) compile $cc -c $_is_hdr_file <&$nullin >&$nullout 2>$tmp.e
Expand Down Expand Up @@ -689,7 +689,7 @@ case $( (getopts '[-][123:xyz]' opt --xyz; echo 0$opt) 2>/dev/null ) in
}
[+?\abegin\a\b{\b ... \b}end\b delimit multiline code blocks that override
or augment the default code provided by \biffe\b. User supplied code
blocks should be compatible with the C89/C90 C language
blocks should be compatible with the C99 C language
standard for maximal portability. Test code may call the function
\bNOTE("...")\b to emit short text in \b--verbose\b output; only one
\bNOTE()\b should be called per test for readability. In addition to
Expand Down Expand Up @@ -1162,7 +1162,6 @@ can=
cansep=
cctest=
file=
hdrtest=
ifelse=NONE
ifstack=
ini=
Expand Down Expand Up @@ -2263,51 +2262,6 @@ int x;

cc="$cc $mac"

# check for global default headers (some cc -E insist on compiling)

case $hdrtest in
'') hdrtest=1
allinc=
for x in types
do case $config in
0) c=_sys_${x}
;;
1) case $shell in
ksh) typeset -u u=$x ;;
*) u=$(echo $x | tr abcdefghijklmnopqrstuvwxyz ABCDEFGHIJKLMNOPQRSTUVWXYZ) ;;
esac
c=HAVE_SYS_${u}_H
;;
esac
x=sys/$x.h
echo "${allinc}#include <$x>" > $tmp.c
if is_hdr $x
then gothdr="$gothdr + $x"
case $explicit in
0) can="$can$cansep#define $c 1 /* #include <$x> ok */"
nan="$nan$cansep$c=1"
cansep=$nl
;;
esac
eval $c=1
allinc="${allinc}#include <$x>$nl"
else gothdr="$gothdr - $x"
case $explicit$all$config$undef in
0?1?|0??1)
can="$can$cansep#undef $c /* #include <$x> not ok */"
nan="$nan$cansep$c="
cansep=$nl
;;
01??) can="$can$cansep#define $c 0 /* #include <$x> not ok */"
nan="$nan$cansep$c=0"
cansep=$nl
;;
esac
fi
done
;;
esac

# add implicit headers/libraries before the checks

case $op in
Expand Down
Loading