1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

iffe: revert <stdio.h> removal, add different fix (re: 308696ec)

Commit 308696ec caused the build to fail on macOS Catalina.

src/cmd/INIT/iffe.sh:
- Fix a blatantly unportable practice of passing multiple
  "|"-separated 'case' patterns through a variable. This was a way
  of grepping for some headers including stdio.h, but it only works
  this way on ksh93 and possibly the original Bourne shell, and not
  on *any* other shell (not even pdksh or mksh) -- and the fact
  that it works on ksh93 is arguably a bug. Fix by eliminating the
  "noext" variable (which is init'ed once and never changes) and
  using the pattern in the relevant 'case' statement directly.

src/cmd/builtin/features/pty:
- No matter what I try, including <stdio.h> causes the build to
  fail on Gentoo Linux (i386) with mysterious "invalid identifier:
  off64_t" errors -- this is probably some AST preprocessor hackery
  gone awry, but I've no idea where to even begin with that. This
  works around the problem by using AST sfio instead, which is
  built and functional by the time this feature test is run.
- Remove explicit extern declaration for ptsname(2) that was never
  used because it depended on an npt_ptsname feature test that
  doesn't exist (or no longer exists).
- Add missing <fcntl.h>, <stdlib.h>, and <unistd.h> for open(2),
  ptsname(2) and close(2), respectively.

src/lib/libast/features/float,
src/lib/libast/features/sfio,
src/lib/libast/features/stdio:
- Re-include <stdio.h>.

Fixes: https://github.com/ksh93/ksh/issues/164 (I hope)
This commit is contained in:
Martijn Dekker 2021-01-27 15:03:06 +00:00
parent 399886daa9
commit 77ab60a149
5 changed files with 18 additions and 13 deletions

View file

@ -1327,7 +1327,6 @@ std='#if defined(__STDC__) || defined(__cplusplus) || defined(c_plusplus)
#define _NIL_(x) ((x)0)'
tst=
ext="#include <stdio.h>"
noext='*[<"][Ss][Tt][Dd][Ii][Oo].[Hh][">]*|*<ast.h>*|*<sfio.h>*|*/[*]<NOSTDIO>[*]/*'
# loop on op [ arg [ ... ] ] [ : op [ arg [ ... ] ] ]
@ -3376,7 +3375,9 @@ int x;
esac
case $src in
?*) case $src in
$noext) EXT= ;;
*[\<\"][Ss][Tt][Dd][Ii][Oo].[Hh][\"\>]* | *\<ast.h\>* | *\<sfio.h\>* | */[*]\<NOSTDIO\>[*]/*)
EXT=
;;
*) EXT="$tst
$ext"
;;

View file

@ -14,17 +14,14 @@ lib grantpt,unlockpt,posix_openpt stdlib.h
lib cfmakeraw termios.h
tst - output{
#include <sfio.h>
#include <fcntl.h>
#if _lib_ptsname
#include <stdlib.h>
#endif
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#if _lib_ptsname && _npt_ptsname
_BEGIN_EXTERNS_
#if _STD_
extern char* ptsname(int);
#else
extern char* ptsname();
#endif
#endif
_END_EXTERNS_
int main()
{
int i;
@ -39,7 +36,7 @@ tst - output{
{
if (ptsname(fd))
{
printf("#define _pty_clone\t\"%s\"\n", ptc[i]);
sfprintf(sfstdout, "#define _pty_clone\t\"%s\"\n", ptc[i]);
close(fd);
break;
}
@ -49,7 +46,7 @@ tst - output{
for (i = 0;; i++)
if(i >= (sizeof(pty) / sizeof(pty[0]) - 1) || stat(pty[i], &statb)>=0)
{
printf("#define _pty_first\t\"%s\"\n", pty[i]);
sfprintf(sfstdout, "#define _pty_first\t\"%s\"\n", pty[i]);
break;
}
return 0;

View file

@ -245,6 +245,7 @@ macro{
tst - note{ missing floating point limits }end output{
#include "FEATURE/common"
#include <stdio.h>
#if _hdr_float
#include <float.h>
#endif
@ -899,6 +900,7 @@ tst - note{ missing floating point limits }end output{
tst - note{ double exponent bitfoolery }end output{
#include "FEATURE/common"
#include <stdio.h>
typedef union _dbl_exp_u
{
unsigned _ast_int4_t e[sizeof(double) / 4];
@ -934,6 +936,7 @@ tst - note{ double exponent bitfoolery }end output{
tst - note{ long double exponent bitfoolery }end output{
#include "FEATURE/common"
#include <stdio.h>
typedef union _ast_fltmax_exp_u
{
unsigned _ast_int4_t e[sizeof(_ast_fltmax_t) / 4];
@ -968,6 +971,7 @@ tst - note{ long double exponent bitfoolery }end output{
}end
tst - -DN=1 - -DN=2 note{ _ast_fltmax_t maximum integral type }end output{
#include <stdio.h>
int
main()
{
@ -992,6 +996,7 @@ tst - -DSCAN=1 - -lm -DSTRTO=1 - -DMAC=1 - -DDIV=1 - -DEXP=1 - -DADD=1 - -DMPY=1
#define _FP_MODE_VARIABLE 1
#endif
#include "FEATURE/common"
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#include <string.h>

View file

@ -7,6 +7,7 @@ key signed
typ struct.sf_hdtr sys/socket.h
tst - note{ number of bits in pointer }end output{
#include <stdio.h>
int
main()
{

View file

@ -204,6 +204,7 @@ cat{
#endif
}end
output{
#include <stdio.h>
#ifndef FILENAME_MAX
#ifndef NAME_MAX
#ifndef _POSIX_NAME_MAX