Skip to content

Commit

Permalink
libast/features/sfio: remove unused feature tests
Browse files Browse the repository at this point in the history
The results of these feature tests are not used anywhere. Research
in the open-ast-archive repo shows that some of them (like vax_asm)
became unused between 1995 and 1998.
  • Loading branch information
McDutchie committed Jan 6, 2025
1 parent 848c181 commit 330a90f
Showing 1 changed file with 0 additions and 83 deletions.
83 changes: 0 additions & 83 deletions src/lib/libast/features/sfio
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
ref -D_def_map_ast=1
hdr float,floatingpoint,math,values
sys filio,ioctl
lib qfrexp,qldexp
key signed

tst - note{ number of bits in pointer }end output{
Expand Down Expand Up @@ -87,83 +84,3 @@ more long_int note{ long is larger than int }end execute{
return sizeof(long) > sizeof(int) ? 0 : 1;
}
}end

tst vax_asm note{ layout ok for vax string operations }end execute{
int
main(void)
{
#ifndef vax
return absurd = -1;
#else
int r11, r10, r9, r8, r7, r6;
r11 = r10 = r9 = r8 = r7 = r6 = -1;
asm("clrw r11");
asm("clrw r10");
asm("clrw r9");
asm("clrw r8");
asm("clrw r7");
asm("clrw r6");
if(sizeof(int) != sizeof(char*) || r11 || r10 || r9 || r8 || r7 || r6 )
return -1;
return 0;
#endif
}
}end

tst lib_cvt note{ native floating point conversions ok }end link{
extern char* ecvt(double, int, int*, int*);
extern char* fcvt(double, int, int*, int*);
extern double strtod(const char*, char**);
int
main(void)
{
ecvt(0.0, 0, 0, 0);
fcvt(0.0, 0, 0, 0);
strtod(0, 0);
return 0;
}
}end

tst xopen_stdio note{ Stdio fseek/fflush are X/Open-compliant }end execute{
#include <fcntl.h>
#include <unistd.h>
#define Failed(file) (unlink(file),1)
int
main(int argc, char **argv)
{ FILE *f1, *f2;
char file[1024], buf[1024], *f, *t;
int i, fd;

/* create file */
for(f = argv[0], t = file; (*t = *f++) != 0; )
t++;
*t++ = '.'; *t++ = 'D'; *t++ = 0;
if((fd = creat(file,0666)) < 0)
return 1;

for (i = 0; i < sizeof(buf); ++i)
buf[i] = '0' + (i%10);
for (i = 0; i < 16; ++i)
if (write(fd,buf,sizeof(buf)) != sizeof(buf))
return Failed(file);
close(fd);

if(!(f1 = fopen(file,"r+")) ||
(fd = dup(fileno(f1))) < 0 ||
!(f2 = fdopen(fd,"r+")) )
return Failed(file);

if(fread(buf, 1, 7, f2) != 7 || ftell(f2) != 7)
return Failed(file);

if(fseek(f1, 1010, 0) < 0 || ftell(f1) != 1010)
return Failed(file);

fflush(f2); /* this should set the seek location to 1010 */
if(ftell(f2) != 1010)
return Failed(file);

unlink(file);
return 0;
}
}end

0 comments on commit 330a90f

Please sign in to comment.