Skip to content

Commit

Permalink
Add support for XPG7 testing.
Browse files Browse the repository at this point in the history
The header conformance testing code needed extending for XPG7.  This
exposed a few bugs in the headers.  There are more changes to come.
  • Loading branch information
Ulrich Drepper committed Jan 9, 2010
1 parent 44dcc00 commit f095bb7
Show file tree
Hide file tree
Showing 115 changed files with 1,243 additions and 391 deletions.
132 changes: 132 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,135 @@
2010-01-09 Ulrich Drepper <drepper@redhat.com>

* conform/conformtest.pl: Update for XPG7 and some bug fixes.
* conform/data/ctype.h-data: Likewise.
* conform/data/dirent.h-data: Likewise.
* conform/data/errno.h-data: Likewise.
* conform/data/fcntl.h-data: Likewise.
* conform/data/fmtmsg.h-data: Likewise.
* conform/data/fnmatch.h-data: Likewise.
* conform/data/ftw.h-data: Likewise.
* conform/data/glob.h-data: Likewise.
* conform/data/grp.h-data: Likewise.
* conform/data/iconv.h-data: Likewise.
* conform/data/langinfo.h-data: Likewise.
* conform/data/libgen.h-data: Likewise.
* conform/data/limits.h-data: Likewise.
* conform/data/locale.h-data: Likewise.
* conform/data/math.h-data: Likewise.
* conform/data/monetary.h-data: Likewise.
* conform/data/mqueue.h-data: Likewise.
* conform/data/ndbm.h-data: Likewise.
* conform/data/netdb.h-data: Likewise.
* conform/data/pthread.h-data: Likewise.
* conform/data/pwd.h-data: Likewise.
* conform/data/regex.h-data: Likewise.
* conform/data/sched.h-data: Likewise.
* conform/data/search.h-data: Likewise.
* conform/data/semaphore.h-data: Likewise.
* conform/data/setjmp.h-data: Likewise.
* conform/data/signal.h-data: Likewise.
* conform/data/spawn.h-data: Likewise.
* conform/data/stdio.h-data: Likewise.
* conform/data/stdlib.h-data: Likewise.
* conform/data/string.h-data: Likewise.
* conform/data/strings.h-data: Likewise.
* conform/data/sys/ipc.h-data: Likewise.
* conform/data/sys/msg.h-data: Likewise.
* conform/data/sys/resource.h-data: Likewise.
* conform/data/sys/sem.h-data: Likewise.
* conform/data/sys/shm.h-data: Likewise.
* conform/data/sys/socket.h-data: Likewise.
* conform/data/sys/stat.h-data: Likewise.
* conform/data/sys/time.h-data: Likewise.
* conform/data/sys/types.h-data: Likewise.
* conform/data/sys/uio.h-data: Likewise.
* conform/data/sys/wait.h-data: Likewise.
* conform/data/syslog.h-data: Likewise.
* conform/data/tar.h-data: Likewise.
* conform/data/termios.h-data: Likewise.
* conform/data/time.h-data: Likewise.
* conform/data/ulimit.h-data: Likewise.
* conform/data/unistd.h-data: Likewise.
* conform/data/utmpx.h-data: Likewise.
* conform/data/wchar.h-data: Likewise.
* conform/data/wctype.h-data: Likewise.
* conform/data/wordexp.h-data: Likewise.

* io/fcntl.h: Define mode_t macros instead of including sys/stat.h.
* sysdeps/unix/bsd/bits/stat.h: Enable using from fcntl.h.
* sysdeps/unix/sysv/linux/powerpc/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/bits/stat.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/stat.h: Likewise.
* sysdeps/unix/sysv/bits/stat.h: Likewise.
* sysdeps/mach/hurd/bits/stat.h: Likewise.

* stdlib/stdlib.h: Define wait-related bits for XPG7.
Don't declare valloc, mktemp, ecvt, fcvt, gcvt for XPG6 and up.
Declare mkstemp and getsubopt for XPG7.
Declare posix_openpt for XPG6 XSI.

* include/features.h: Define __USE_XOPEN2KXSI for _XOPEN_SOURCE >= 600
and __USE_XOPEN2K8XSI for _XOPEN_SOURCE >= 700.

* string/string.h: Declare strdup for XPG7.

2010-01-08 Ulrich Drepper <drepper@redhat.com>

* bits/confname.h: Define _CS_V6_ENV and _CS_V7_ENV.
* posix/confstr.c: Implement _CS_V6_ENV and _CS_V7_ENV.

* dirent/dirent.h: Really fix feature selection.

* locale/localeinfo.h: Rename struct locale_data to __locale_data.
Fix all users.
* locale/C-address.c: Fix all users.
* locale/C-collate.c: Likewise.
* locale/C-ctype.c: Likewise.
* locale/C-identification.c: Likewise.
* locale/C-measurement.c: Likewise.
* locale/C-messages.c: Likewise.
* locale/C-monetary.c: Likewise.
* locale/C-name.c: Likewise.
* locale/C-numeric.c: Likewise.
* locale/C-paper.c: Likewise.
* locale/C-telephone.c: Likewise.
* locale/C-time.c: Likewise.
* locale/findlocale.c: Likewise.
* locale/global-locale.c: Likewise.
* locale/loadarchive.c: Likewise.
* locale/loadlocale.c: Likewise.
* locale/nl_langinfo_l.c: Likewise.
* locale/setlocale.c: Likewise.
* locale/xlocale.c: Likewise.
* locale/xlocale.h: Likewise.
* stdio-common/vfscanf.c: Likewise.
* stdlib/strfmon_l.c: Likewise.
* stdlib/strtod_l.c: Likewise.
* stdlib/strtol_l.c: Likewise.
* string/strcoll_l.c: Likewise.
* string/strxfrm_l.c: Likewise.
* time/alt_digit.c: Likewise.
* time/asctime.c: Likewise.
* time/era.c: Likewise.
* time/lc-time-cleanup.c: Likewise.
* time/strftime_l.c: Likewise.
* time/strptime_l.c: Likewise.
* wcsmbs/wcsmbsload.c: Likewise.
* wcsmbs/wcsmbsload.h: Likewise.

* sysdeps/unix/sysv/linux/sh/bits/fcntl.h: Define O_DIRECTORY,
O_NOFOLLOW, O_CLOEXEC, F_DUPFD_CLOEXEC, F_SETOWN, and F_GETOWN
for XPG7.
* sysdeps/unix/sysv/linux/powerpc/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/x86_64/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/sparc/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/ia64/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/i386/bits/fcntl.h: Likewise.
* sysdeps/unix/sysv/linux/s390/bits/fcntl.h: Likewise.

2010-01-06 Ulrich Drepper <drepper@redhat.com>

* dirent/dirent.h: Fix typo in feature selection macro use.
Expand Down
7 changes: 6 additions & 1 deletion bits/confname.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* `sysconf', `pathconf', and `confstr' NAME values. Generic version.
Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2009
Copyright (C) 1993,1995-1998,2000,2001,2003,2004,2007,2009,2010
Free Software Foundation, Inc.
This file is part of the GNU C Library.
Expand Down Expand Up @@ -669,4 +669,9 @@ enum
#define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS
_CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS
#define _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LINTFLAGS

_CS_V6_ENV,
#define _CS_V6_ENV _CS_V6_ENV
_CS_V7_ENV,
#define _CS_V7_ENV _CS_V7_ENV
};
38 changes: 30 additions & 8 deletions conform/conformtest.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#! /usr/bin/perl

use Getopt::Long;
use POSIX;

$CC = "gcc";

Expand Down Expand Up @@ -30,7 +31,8 @@
}

if ($dialect ne "ISO" && $dialect ne "POSIX" && $dialect ne "XPG3"
&& $dialect ne "XPG4" && $dialect ne "UNIX98" && $dialect ne "XOPEN2K") {
&& $dialect ne "XPG4" && $dialect ne "UNIX98" && $dialect ne "XOPEN2K"
&& $dialect ne "XOPEN2K8" && $dialect ne "POSIX2008") {
die "unknown dialect \"$dialect\"";
}

Expand All @@ -40,6 +42,8 @@
$CFLAGS{"XPG4"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE_EXTENDED";
$CFLAGS{"UNIX98"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=500";
$CFLAGS{"XOPEN2K"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=600";
$CFLAGS{"XOPEN2K8"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_XOPEN_SOURCE=700";
$CFLAGS{"POSIX2008"} = "-I. -fno-builtin '-D__attribute__(x)=' -D_POSIX_C_SOURCE=200809L";


# These are the ISO C99 keywords.
Expand Down Expand Up @@ -71,7 +75,10 @@
$isknown{pop (@knownproblems)} = 1;
}

$tmpdir = "/tmp";
$uid = getuid();
($pwname,$pwpasswd,$pwuid,$pwgid,
$pwquota,$pwcomment,$pwgcos,$pwdir,$pwshell,$pwexpire) = getpwuid($uid);
$tmpdir = "$pwdir";

$verbose = 1;

Expand Down Expand Up @@ -660,9 +667,6 @@ sub checknamespace {
$maybe_opaque = 1;
}

# Remember that this name is allowed.
push @allow, $type;

# Generate a program to test for the availability of this constant.
open (TESTFILE, ">$fnamebase.c");
print TESTFILE "$prepend";
Expand Down Expand Up @@ -690,9 +694,6 @@ sub checknamespace {
$maybe_opaque = 1;
}

# Remember that this name is allowed.
push @allow, $type;

# Generate a program to test for the availability of this type.
open (TESTFILE, ">$fnamebase.c");
print TESTFILE "$prepend";
Expand All @@ -704,6 +705,27 @@ sub checknamespace {
}
close (TESTFILE);

compiletest ($fnamebase, "Testing for type $type",
"Type \"$type\" not available.", $missing, 0);
} elsif (/^tag *({([^}]*)|([a-zA-Z0-9_]*))/) {
my($type) = "$2$3";

# Remember that this name is allowed.
if ($type =~ /^struct *(.*)/) {
push @allow, $1;
} elsif ($type =~ /^union *(.*)/) {
push @allow, $1;
} else {
push @allow, $type;
}

# Generate a program to test for the availability of this type.
open (TESTFILE, ">$fnamebase.c");
print TESTFILE "$prepend";
print TESTFILE "#include <$h>\n";
print TESTFILE "$type;\n";
close (TESTFILE);

compiletest ($fnamebase, "Testing for type $type",
"Type \"$type\" not available.", $missing, 0);
} elsif (/^optional-function *({([^}]*)}|([a-zA-Z0-9_]*)) [(][*]([a-zA-Z0-9_]*) ([(].*[)])/) {
Expand Down
20 changes: 19 additions & 1 deletion conform/data/ctype.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function int isxdigit (int)
function int tolower (int)
function int toupper (int)

#ifndef ISO
#if !defined ISO && !defined POSIX && !defined POSIX2008
function int isascii (int)
function int toascii (int)

Expand All @@ -26,4 +26,22 @@ allow is*
allow to*

allow *_t

# if defined XOPEN2K8 || defined XOPEN2K8 || defined POSIX2008
type locale_t

function int isalnum_l (int, locale_t)
function int isalpha_l (int, locale_t)
function int iscntrl_l (int, locale_t)
function int isdigit_l (int, locale_t)
function int isgraph_l (int, locale_t)
function int islower_l (int, locale_t)
function int isprint_l (int, locale_t)
function int ispunct_l (int, locale_t)
function int isspace_l (int, locale_t)
function int isupper_l (int, locale_t)
function int isxdigit_l (int, locale_t)
function int tolower_l (int, locale_t)
function int toupper_l (int, locale_t)
# endif
#endif
11 changes: 11 additions & 0 deletions conform/data/dirent.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ type DIR

type {struct dirent}

# if !defined POSIX && !defined POSIX2008
element {struct dirent} ino_t d_ino
# endif
element {struct dirent} char d_name []

type ino_t
Expand All @@ -13,9 +15,18 @@ function {DIR*} opendir (const char*)
function {struct dirent*} readdir (DIR*)
function int readdir_r (DIR*, struct dirent*, struct dirent**)
function void rewinddir (DIR*)
# if !defined POSIX && !defined POSIX2008
function void seekdir (DIR*, long int)
function {long int} telldir (DIR*)
# endif

allow d_*
allow *_t

# if defined XOPEN2K8 || defined POSIX2008
function int alphasort (const struct dirent**, const struct dirent**)
function int dirfd (DIR*)
function int scandir (const char*, struct dirent***, int(*)(const struct dirent*), int(*)(const struct dirent**,const struct dirent **))
function {DIR*} fdopendir (int)
# endif
#endif
5 changes: 5 additions & 0 deletions conform/data/errno.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ constant ETXTBSY
constant EWOULDBLOCK
constant EXDEV

# if defined XOPEN2K8 || defined POSIX2008
constant ENOTRECOVERABLE
constant EOWNERDEAD
# endif

// variable int errno
allow errno

Expand Down
31 changes: 29 additions & 2 deletions conform/data/fcntl.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ constant S_IWOTH
constant S_IXOTH
constant S_ISUID
constant S_ISGID
#if !defined POSIX && !defined POSIX2008
constant S_ISVTX
#endif

#ifdef XOPEN2K
#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
constant POSIX_FADV_NORMAL
constant POSIX_FADV_SEQUENTIAL
constant POSIX_FADV_RANDOM
Expand All @@ -86,11 +88,32 @@ type pid_t
function int creat (const char*, mode_t)
function int fcntl (int, int, ...)
function int open (const char*, int, ...)
#ifdef XOPEN2K
#if defined XOPEN2K8 || defined POSIX2008
function int openat (int, const char*, int, ...)
#endif
#if defined XOPEN2K || defined XOPEN2K8 || defined POSIX2008
function int posix_fadvise (int, off_t, off_t, int)
function int posix_fallocate (int, off_t, off_t)
#endif

#if defined XOPEN2K8 || defined POSIX2008
constant O_TTY_INIT
constant O_CLOEXEC
constant O_EXEC
constant O_SEARCH
constant O_DIRECTORY
constant O_NOFOLLOW
constant FD_CLOEXEC
constant F_DUPFD_CLOEXEC
constant AT_FDCWD
constant AT_EACCESS
constant AT_SYMLINK_NOFOLLOW
constant AT_SYMLINK_FOLLOW
constant AT_REMOVEDIR

function int openat(int, const char*, int, ...)
#endif

allow-header sys/stat.h
allow-header unistd.h

Expand All @@ -99,4 +122,8 @@ allow F_*
allow O_*
allow S_*
allow *_t

allow timespec
allow tv_nsec
allow tv_sec
#endif
2 changes: 1 addition & 1 deletion conform/data/fmtmsg.h-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined ISO && !defined POSIX
#if !defined ISO && !defined POSIX && !defined POSIX2008
macro MM_HARD
constant MM_HARD

Expand Down
2 changes: 2 additions & 0 deletions conform/data/fnmatch.h-data
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ constant FNM_NOMATCH
constant FNM_PATHNAME
constant FNM_PERIOD
constant FNM_NOESCAPE
#if !defined XOPEN2K8 && !defined POSIX2008
constant FNM_NOSYS
#endif

function int fnmatch (const char*, const char*, int)

Expand Down
2 changes: 1 addition & 1 deletion conform/data/ftw.h-data
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#if !defined ISO && !defined POSIX
#if !defined ISO && !defined POSIX && !defined POSIX2008
type {struct FTW}
element {struct FTW} int base
element {struct FTW} int level
Expand Down
Loading

0 comments on commit f095bb7

Please sign in to comment.