From f665b1cef30f9032877081ac63ea94910825be6a Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Thu, 17 Aug 2017 09:12:15 -0400 Subject: [PATCH 001/649] cygwin: Implement renameat2 Define the RENAME_NOREPLACE flag in as defined on Linux in . The other RENAME_* flags defined on Linux are not supported. --- newlib/libc/include/stdio.h | 3 ++ winsup/cygwin/common.din | 1 + winsup/cygwin/include/cygwin/fs.h | 6 ++++ winsup/cygwin/include/cygwin/version.h | 3 +- winsup/cygwin/syscalls.cc | 48 ++++++++++++++++++++++---- 5 files changed, 54 insertions(+), 7 deletions(-) diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 5d8cb1092..331a1cf07 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -384,6 +384,9 @@ int _EXFUN(vdprintf, (int, const char *__restrict, __VALIST) #endif #if __ATFILE_VISIBLE int _EXFUN(renameat, (int, const char *, int, const char *)); +# ifdef __CYGWIN__ +int _EXFUN(renameat2, (int, const char *, int, const char *, unsigned int)); +# endif #endif /* diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index 8da432b8a..ca6ff3cf9 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -1168,6 +1168,7 @@ remquof NOSIGFE remquol NOSIGFE rename SIGFE renameat SIGFE +renameat2 SIGFE res_close = __res_close SIGFE res_init = __res_init SIGFE res_mkquery = __res_mkquery SIGFE diff --git a/winsup/cygwin/include/cygwin/fs.h b/winsup/cygwin/include/cygwin/fs.h index f606ffc39..48b0cca45 100644 --- a/winsup/cygwin/include/cygwin/fs.h +++ b/winsup/cygwin/include/cygwin/fs.h @@ -19,4 +19,10 @@ details. */ #define BLKPBSZGET 0x0000127b #define BLKGETSIZE64 0x00041268 +/* Flags for renameat2, from /usr/include/linux/fs.h. For now we + support only RENAME_NOREPLACE. */ +#define RENAME_NOREPLACE (1 << 0) +/* #define RENAME_EXCHANGE (1 << 1) */ +/* #define RENAME_WHITEOUT (1 << 2) */ + #endif diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index efd4ac017..7686a6865 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -481,12 +481,13 @@ details. */ 314: Export explicit_bzero. 315: Export pthread_mutex_timedlock. 316: Export pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock. + 317: Export renameat2. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 316 +#define CYGWIN_VERSION_API_MINOR 317 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 885931632..61872fe58 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -60,6 +60,7 @@ details. */ #include "tls_pbuf.h" #include "sync.h" #include "child_info.h" +#include /* needed for RENAME_NOREPLACE */ #undef _close #undef _lseek @@ -2048,14 +2049,19 @@ nt_path_has_executable_suffix (PUNICODE_STRING upath) return false; } -extern "C" int -rename (const char *oldpath, const char *newpath) +/* If newpath names an existing file and the RENAME_NOREPLACE flag is + specified, fail with EEXIST. Exception: Don't fail if the purpose + of the rename is just to change the case of oldpath on a + case-insensitive file system. */ +static int +rename2 (const char *oldpath, const char *newpath, unsigned int flags) { tmp_pathbuf tp; int res = -1; path_conv oldpc, newpc, new2pc, *dstpc, *removepc = NULL; bool old_dir_requested = false, new_dir_requested = false; bool old_explicit_suffix = false, new_explicit_suffix = false; + bool noreplace = flags & RENAME_NOREPLACE; size_t olen, nlen; bool equal_path; NTSTATUS status = STATUS_SUCCESS; @@ -2068,6 +2074,12 @@ rename (const char *oldpath, const char *newpath) __try { + if (flags & ~RENAME_NOREPLACE) + /* RENAME_NOREPLACE is the only flag currently supported. */ + { + set_errno (EINVAL); + __leave; + } if (!*oldpath || !*newpath) { /* Reject rename("","x"), rename("x",""). */ @@ -2337,6 +2349,13 @@ rename (const char *oldpath, const char *newpath) __leave; } + /* Should we replace an existing file? */ + if ((removepc || dstpc->exists ()) && noreplace) + { + set_errno (EEXIST); + __leave; + } + /* Opening the file must be part of the transaction. It's not sufficient to call only NtSetInformationFile under the transaction. Therefore we have to start the transaction here, if necessary. */ @@ -2491,11 +2510,15 @@ rename (const char *oldpath, const char *newpath) __leave; } pfri = (PFILE_RENAME_INFORMATION) tp.w_get (); - pfri->ReplaceIfExists = TRUE; + pfri->ReplaceIfExists = !noreplace; pfri->RootDirectory = NULL; pfri->FileNameLength = dstpc->get_nt_native_path ()->Length; memcpy (&pfri->FileName, dstpc->get_nt_native_path ()->Buffer, pfri->FileNameLength); + /* If dstpc points to an existing file and RENAME_NOREPLACE has + been specified, then we should get NT error + STATUS_OBJECT_NAME_COLLISION ==> Win32 error + ERROR_ALREADY_EXISTS ==> Cygwin error EEXIST. */ status = NtSetInformationFile (fh, &io, pfri, sizeof *pfri + pfri->FileNameLength, FileRenameInformation); @@ -2578,6 +2601,12 @@ rename (const char *oldpath, const char *newpath) return res; } +extern "C" int +rename (const char *oldpath, const char *newpath) +{ + return rename2 (oldpath, newpath, 0); +} + extern "C" int system (const char *cmdstring) { @@ -4719,8 +4748,8 @@ readlinkat (int dirfd, const char *__restrict pathname, char *__restrict buf, } extern "C" int -renameat (int olddirfd, const char *oldpathname, - int newdirfd, const char *newpathname) +renameat2 (int olddirfd, const char *oldpathname, + int newdirfd, const char *newpathname, unsigned int flags) { tmp_pathbuf tp; __try @@ -4731,13 +4760,20 @@ renameat (int olddirfd, const char *oldpathname, char *newpath = tp.c_get (); if (gen_full_path_at (newpath, newdirfd, newpathname)) __leave; - return rename (oldpath, newpath); + return rename2 (oldpath, newpath, flags); } __except (EFAULT) {} __endtry return -1; } +extern "C" int +renameat (int olddirfd, const char *oldpathname, + int newdirfd, const char *newpathname) +{ + return renameat2 (olddirfd, oldpathname, newdirfd, newpathname, 0); +} + extern "C" int scandirat (int dirfd, const char *pathname, struct dirent ***namelist, int (*select) (const struct dirent *), From 3012e251fa3e41dc12b636f2a1280973c587ad6b Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 19 Aug 2017 13:15:04 -0400 Subject: [PATCH 002/649] Document renameat2 --- winsup/cygwin/release/2.9.0 | 2 ++ winsup/doc/new-features.xml | 4 ++++ winsup/doc/posix.xml | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/winsup/cygwin/release/2.9.0 b/winsup/cygwin/release/2.9.0 index 421d6f24f..ac4c64949 100644 --- a/winsup/cygwin/release/2.9.0 +++ b/winsup/cygwin/release/2.9.0 @@ -6,6 +6,8 @@ What's new: - New APIs: pthread_mutex_timedwait, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock. +- New API: renameat2. + What changed: ------------- diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml index 23673d1e0..0aa857730 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -17,6 +17,10 @@ New APIs: pthread_mutex_timedwait, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock. + +New API: renameat2. + + Improved implementation of <elf.h>. diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml index a2fffeebf..6e96272b7 100644 --- a/winsup/doc/posix.xml +++ b/winsup/doc/posix.xml @@ -1356,6 +1356,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). ptsname_r putwc_unlocked putwchar_unlocked + renameat2 (see chapter "Implementation Notes") qsort_r (see chapter "Implementation Notes") quotactl rawmemchr @@ -1671,6 +1672,9 @@ group quotas, no inode quotas, no time constraints. qsort_r is available in both BSD and GNU flavors, depending on whether _BSD_SOURCE or _GNU_SOURCE is defined when compiling. +The Linux-specific function renameat2 only +supports the RENAME_NOREPLACE flag. + basename is available in both POSIX and GNU flavors, depending on whether libgen.h is included or not. From 6864c08b94752d34cca807bd37d54902ddb119a0 Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 21 Aug 2017 10:30:30 +0800 Subject: [PATCH 003/649] Change license to FreeBSD License for RISC-V - For prevent confuse about what BSD license variant we used, 2- or 3-clause license, we change the license to FreeBSD license to make it unambiguously refers to the 2-clause license. --- COPYING.NEWLIB | 2 +- libgloss/riscv/crt0.S | 2 +- libgloss/riscv/machine/syscall.h | 2 +- libgloss/riscv/syscalls.c | 2 +- newlib/libc/machine/riscv/ffs.c | 2 +- newlib/libc/machine/riscv/ieeefp.c | 2 +- newlib/libc/machine/riscv/include/fenv.h | 2 +- newlib/libc/machine/riscv/memcpy.c | 2 +- newlib/libc/machine/riscv/memset.S | 2 +- newlib/libc/machine/riscv/setjmp.S | 2 +- newlib/libc/machine/riscv/strcmp.S | 2 +- newlib/libc/machine/riscv/strcpy.c | 2 +- newlib/libc/machine/riscv/strlen.c | 2 +- newlib/libc/machine/riscv/sys/asm.h | 2 +- newlib/libc/machine/riscv/sys/fenv.h | 2 +- newlib/libc/machine/riscv/sys/string.h | 2 +- 16 files changed, 16 insertions(+), 16 deletions(-) diff --git a/COPYING.NEWLIB b/COPYING.NEWLIB index e0b31f378..2313d3761 100644 --- a/COPYING.NEWLIB +++ b/COPYING.NEWLIB @@ -1140,7 +1140,7 @@ Copyright (c) 2017 SiFive Inc. All rights reserved. This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions -of the BSD License. This program is distributed in the hope that +of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/libgloss/riscv/crt0.S b/libgloss/riscv/crt0.S index 35195690c..3d2a12de5 100644 --- a/libgloss/riscv/crt0.S +++ b/libgloss/riscv/crt0.S @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/libgloss/riscv/machine/syscall.h b/libgloss/riscv/machine/syscall.h index 424bd906a..391dbaa71 100644 --- a/libgloss/riscv/machine/syscall.h +++ b/libgloss/riscv/machine/syscall.h @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/libgloss/riscv/syscalls.c b/libgloss/riscv/syscalls.c index d86bd8980..f9ec25dcd 100644 --- a/libgloss/riscv/syscalls.c +++ b/libgloss/riscv/syscalls.c @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/ffs.c b/newlib/libc/machine/riscv/ffs.c index 652207722..2f2176e68 100644 --- a/newlib/libc/machine/riscv/ffs.c +++ b/newlib/libc/machine/riscv/ffs.c @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/ieeefp.c b/newlib/libc/machine/riscv/ieeefp.c index 5288877a6..9094cc651 100644 --- a/newlib/libc/machine/riscv/ieeefp.c +++ b/newlib/libc/machine/riscv/ieeefp.c @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/include/fenv.h b/newlib/libc/machine/riscv/include/fenv.h index 4709c02cb..4795cc925 100644 --- a/newlib/libc/machine/riscv/include/fenv.h +++ b/newlib/libc/machine/riscv/include/fenv.h @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/memcpy.c b/newlib/libc/machine/riscv/memcpy.c index 1b352b46e..c717f9f4b 100644 --- a/newlib/libc/machine/riscv/memcpy.c +++ b/newlib/libc/machine/riscv/memcpy.c @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/memset.S b/newlib/libc/machine/riscv/memset.S index 96bdddf68..337ed5365 100644 --- a/newlib/libc/machine/riscv/memset.S +++ b/newlib/libc/machine/riscv/memset.S @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/setjmp.S b/newlib/libc/machine/riscv/setjmp.S index b8cb3837f..eef242e02 100644 --- a/newlib/libc/machine/riscv/setjmp.S +++ b/newlib/libc/machine/riscv/setjmp.S @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/strcmp.S b/newlib/libc/machine/riscv/strcmp.S index 2d655ed8e..71c08537e 100644 --- a/newlib/libc/machine/riscv/strcmp.S +++ b/newlib/libc/machine/riscv/strcmp.S @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/strcpy.c b/newlib/libc/machine/riscv/strcpy.c index 905a9b8df..6d802fa8e 100644 --- a/newlib/libc/machine/riscv/strcpy.c +++ b/newlib/libc/machine/riscv/strcpy.c @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/strlen.c b/newlib/libc/machine/riscv/strlen.c index 466fb1f44..3b0406699 100644 --- a/newlib/libc/machine/riscv/strlen.c +++ b/newlib/libc/machine/riscv/strlen.c @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/sys/asm.h b/newlib/libc/machine/riscv/sys/asm.h index 5deec6bcd..8c8aeb3ae 100644 --- a/newlib/libc/machine/riscv/sys/asm.h +++ b/newlib/libc/machine/riscv/sys/asm.h @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/sys/fenv.h b/newlib/libc/machine/riscv/sys/fenv.h index 840165d58..1c4342571 100644 --- a/newlib/libc/machine/riscv/sys/fenv.h +++ b/newlib/libc/machine/riscv/sys/fenv.h @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at diff --git a/newlib/libc/machine/riscv/sys/string.h b/newlib/libc/machine/riscv/sys/string.h index d8ae6f5a7..beebe31f7 100644 --- a/newlib/libc/machine/riscv/sys/string.h +++ b/newlib/libc/machine/riscv/sys/string.h @@ -2,7 +2,7 @@ This copyrighted material is made available to anyone wishing to use, modify, copy, or redistribute it subject to the terms and conditions - of the BSD License. This program is distributed in the hope that + of the FreeBSD License. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. A copy of this license is available at From bd86e9de75cabc635937bb6e4e6af2adb3c9891c Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Mon, 21 Aug 2017 10:56:51 +0800 Subject: [PATCH 004/649] Add myself to RISC-V Port Maintainer --- newlib/MAINTAINERS | 1 + 1 file changed, 1 insertion(+) diff --git a/newlib/MAINTAINERS b/newlib/MAINTAINERS index 1ebf74316..811f3cbd8 100644 --- a/newlib/MAINTAINERS +++ b/newlib/MAINTAINERS @@ -39,6 +39,7 @@ arm Nick Clifton nickc@redhat.com m32c port DJ Delorie dj@redhat.com mn10300 Nick Clifton nickc@redhat.com moxie Anthony Green green@moxielogic.com +risc-v Kito Cheng kito.cheng@gmail.com rl78 DJ Delorie dj@redhat.com aarch64 Richard Earnshaw richard.earnshaw@arm.com Marcus Shawcroft marcus.shawcroft@arm.com From b706c6b479422d31f0124b92c21b4cb536bbddff Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 23 Aug 2017 17:43:41 +0200 Subject: [PATCH 005/649] cygwin: only expose /dev/con{in,out,sole} when started from a Windows console Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 153e3847f..cd73e6e87 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1439,7 +1439,7 @@ private: ssize_t __stdcall write (const void *ptr, size_t len); void doecho (const void *str, DWORD len) { (void) write (str, len); } int close (); - static bool exists () {return !!GetConsoleCP ();} + static bool exists () {return shared_console_info && !!GetConsoleCP ();} int tcflush (int); int tcsetattr (int a, const struct termios *t); From 3ec9892f5dd6240d8b21c8cad7874ea856040626 Mon Sep 17 00:00:00 2001 From: Alexander Fedotov-B55613 Date: Tue, 22 Aug 2017 17:06:54 +0300 Subject: [PATCH 006/649] move ILP32 sanity check on heap base code under ARM_RDI_MONITOR --- libgloss/aarch64/crt0.S | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libgloss/aarch64/crt0.S b/libgloss/aarch64/crt0.S index 4ad435e03..f670e0373 100644 --- a/libgloss/aarch64/crt0.S +++ b/libgloss/aarch64/crt0.S @@ -101,10 +101,7 @@ exposed here in the HeapInfo Angel call. */ ldr x0, .LC0 /* point at returned values */ ldr x1, [x0, #8] /* get heap_limit */ -#else - /* Set up the stack pointer to a fixed value. */ - ldr x1, .Lstack -#endif + #ifdef __ILP32__ /* Sanity check on the heap base. */ ldr x0, [x0] /* get heap_base */ @@ -128,6 +125,10 @@ tst x1, #0xffffffff00000000 csinv w1, w1, wzr, eq #endif +#else + /* Set up the stack pointer to a fixed value. */ + ldr x1, .Lstack +#endif /* Ensure quad-word stack alignment. */ and x0, x1, #~15 From 8324ab5e2a08513cef052070f1e7cb228d28b7c8 Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Thu, 24 Aug 2017 13:24:28 -0600 Subject: [PATCH 007/649] winsup/cygwin/libc/strptime.cc(__strptime) add %s support to strptime --- winsup/cygwin/libc/strptime.cc | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc index 62dca6e5e..7c6cc2024 100644 --- a/winsup/cygwin/libc/strptime.cc +++ b/winsup/cygwin/libc/strptime.cc @@ -573,6 +573,26 @@ literal: bp = conv_num(bp, &tm->tm_sec, 0, 61, ALT_DIGITS); continue; + case 's' : /* The seconds since Unix epoch - GNU extension */ + { + long long sec; + time_t t; + char *end; + save_errno save; + + LEGAL_ALT(0); + sec = strtoll_l ((char *)bp, &end, 10, locale); + t = sec; + if (end == (char *)bp + || errno != 0 + || t != sec + || localtime_r (&t, tm) != tm) + return NULL; + bp = (const unsigned char *)end; + ymd |= SET_YDAY | SET_WDAY | SET_YMD; + break; + } + case 'U': /* The week of year, beginning on sunday. */ case 'W': /* The week of year, beginning on monday. */ /* From 406bd10fb4c92282a340db6a7f725121d675f810 Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Thu, 24 Aug 2017 13:12:17 -0600 Subject: [PATCH 008/649] newlib/libc/time/strptime.c(strptime_l) add %F %s support for strptime --- newlib/libc/time/strptime.c | 34 ++++++++++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c index c0861eb87..2ec001a1e 100644 --- a/newlib/libc/time/strptime.c +++ b/newlib/libc/time/strptime.c @@ -38,6 +38,9 @@ #include #include #include +#include +#include +#include #include "../locale/setlocale.h" #define _ctloc(x) (_CurrentTimeLocale->x) @@ -230,8 +233,15 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr, buf = s; ymd |= SET_MDAY; break; + case 'F' : /* %Y-%m-%d - GNU extension */ + s = strptime_l (buf, "%Y-%m-%d", timeptr, locale); + if (s == NULL || s == buf) + return NULL; + buf = s; + ymd |= SET_YMD; + break; case 'H' : - case 'k' : + case 'k' : /* hour with leading space - GNU extension */ ret = strtol_l (buf, &s, 10, locale); if (s == buf) return NULL; @@ -239,7 +249,7 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr, buf = s; break; case 'I' : - case 'l' : + case 'l' : /* hour with leading space - GNU extension */ ret = strtol_l (buf, &s, 10, locale); if (s == buf) return NULL; @@ -300,6 +310,26 @@ strptime_l (const char *buf, const char *format, struct tm *timeptr, return NULL; buf = s; break; + case 's' : /* seconds since Unix epoch - GNU extension */ + { + long long sec; + time_t t; + int save_errno; + + save_errno = errno; + errno = 0; + sec = strtoll_l (buf, &s, 10, locale); + t = sec; + if (s == buf + || errno != 0 + || t != sec + || localtime_r (&t, timeptr) != timeptr) + return NULL; + errno = save_errno; + buf = s; + ymd |= SET_YDAY | SET_WDAY | SET_YMD; + break; + } case 'S' : ret = strtol_l (buf, &s, 10, locale); if (s == buf) From 7b2c3621901dbb0a3535f8056a2eadb9095a5ad2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 24 Aug 2017 15:26:03 +0200 Subject: [PATCH 009/649] Make _CLOCK_T_ system configurable Let systems optionally provide the _CLOCK_T_ type via . Signed-off-by: Sebastian Huber --- newlib/libc/include/sys/_types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index 98b93ce71..d27979c9d 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -180,7 +180,10 @@ typedef _LOCK_RECURSIVE_T _flock_t; typedef void *_iconv_t; #endif +#ifndef __machine_clock_t_defined #define _CLOCK_T_ unsigned long /* clock() */ +#endif + typedef _CLOCK_T_ __clock_t; #define _TIME_T_ long /* time() */ From 524eb4dc2913e5b8f73b4b450c3c96bb40f5006d Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 24 Aug 2017 15:27:50 +0200 Subject: [PATCH 010/649] RTEMS: Use __uint64_t for _CLOCK_T_ This addresses: https://devel.rtems.org/ticket/2135 Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/machine/_types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newlib/libc/sys/rtems/include/machine/_types.h b/newlib/libc/sys/rtems/include/machine/_types.h index e1b4c6466..a30d5a3c1 100644 --- a/newlib/libc/sys/rtems/include/machine/_types.h +++ b/newlib/libc/sys/rtems/include/machine/_types.h @@ -28,6 +28,9 @@ typedef unsigned long __ino_t; typedef __uint32_t __mode_t; #define __machine_mode_t_defined +typedef __uint64_t _CLOCK_T_; +#define __machine_clock_t_defined + typedef int __accmode_t; /* access permissions */ typedef __uint32_t __fixpt_t; /* fixed point number */ typedef int __lwpid_t; /* Thread ID (a.k.a. LWP) */ From a4961ccd3f0e3513bb32a0e135348ad303e7599d Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Fri, 25 Aug 2017 09:16:23 -0500 Subject: [PATCH 011/649] Revert "headers: avoid bareword attributes" for clang This reverts most of commit 979d467ff6e39ee5c52cf1aac7a6c9c63058141c. We cannot avoid some bareword attributes until clang is fixed to properly support __-decorated attributes; see this bug: https://bugs.llvm.org/show_bug.cgi?id=34319 The macros in question expand to the empty string under gcc, so only compilation under clang is affected, and since clang has the bug, the obvious solution is to roll back the changes, and document the issue. Signed-off-by: Eric Blake --- newlib/libc/include/sys/cdefs.h | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index 9e58ee980..8ce14b68e 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -681,42 +681,44 @@ #endif /* Structure implements a lock. */ -#define __lockable __lock_annotate(__lockable__) +/* FIXME: Use __lockable__, etc. to avoid colliding with user namespace macros, + * once clang is fixed: https://bugs.llvm.org/show_bug.cgi?id=34319 */ +#define __lockable __lock_annotate(lockable) /* Function acquires an exclusive or shared lock. */ #define __locks_exclusive(...) \ - __lock_annotate(__exclusive_lock_function__(__VA_ARGS__)) + __lock_annotate(exclusive_lock_function(__VA_ARGS__)) #define __locks_shared(...) \ - __lock_annotate(__shared_lock_function__(__VA_ARGS__)) + __lock_annotate(shared_lock_function(__VA_ARGS__)) /* Function attempts to acquire an exclusive or shared lock. */ #define __trylocks_exclusive(...) \ - __lock_annotate(__exclusive_trylock_function__(__VA_ARGS__)) + __lock_annotate(exclusive_trylock_function(__VA_ARGS__)) #define __trylocks_shared(...) \ - __lock_annotate(__shared_trylock_function__(__VA_ARGS__)) + __lock_annotate(shared_trylock_function(__VA_ARGS__)) /* Function releases a lock. */ -#define __unlocks(...) __lock_annotate(__unlock_function__(__VA_ARGS__)) +#define __unlocks(...) __lock_annotate(unlock_function(__VA_ARGS__)) /* Function asserts that an exclusive or shared lock is held. */ #define __asserts_exclusive(...) \ - __lock_annotate(__assert_exclusive_lock__(__VA_ARGS__)) + __lock_annotate(assert_exclusive_lock(__VA_ARGS__)) #define __asserts_shared(...) \ - __lock_annotate(__assert_shared_lock__(__VA_ARGS__)) + __lock_annotate(assert_shared_lock(__VA_ARGS__)) /* Function requires that an exclusive or shared lock is or is not held. */ #define __requires_exclusive(...) \ - __lock_annotate(__exclusive_locks_required__(__VA_ARGS__)) + __lock_annotate(exclusive_locks_required(__VA_ARGS__)) #define __requires_shared(...) \ - __lock_annotate(__shared_locks_required__(__VA_ARGS__)) + __lock_annotate(shared_locks_required(__VA_ARGS__)) #define __requires_unlocked(...) \ - __lock_annotate(__locks_excluded__(__VA_ARGS__)) + __lock_annotate(locks_excluded(__VA_ARGS__)) /* Function should not be analyzed. */ -#define __no_lock_analysis __lock_annotate(__no_thread_safety_analysis__) +#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis) /* Guard variables and structure members by lock. */ -#define __guarded_by(x) __lock_annotate(__guarded_by__(x)) -#define __pt_guarded_by(x) __lock_annotate(__pt_guarded_by__(x)) +#define __guarded_by(x) __lock_annotate(guarded_by(x)) +#define __pt_guarded_by(x) __lock_annotate(pt_guarded_by(x)) #endif /* !_SYS_CDEFS_H_ */ From 3437665ac85455c18fbc4cc616fe2aeb373f6552 Mon Sep 17 00:00:00 2001 From: Sichen Zhao <1473996754@qq.com> Date: Fri, 25 Aug 2017 15:35:38 +0800 Subject: [PATCH 012/649] Import strnstr.c from FreeBSD. --- newlib/libc/string/strnstr.c | 65 ++++++++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 newlib/libc/string/strnstr.c diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c new file mode 100644 index 000000000..da5e5bdcb --- /dev/null +++ b/newlib/libc/string/strnstr.c @@ -0,0 +1,65 @@ +/*- + * Copyright (c) 2001 Mike Barcroft + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Chris Torek. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#if defined(LIBC_SCCS) && !defined(lint) +static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93"; +#endif /* LIBC_SCCS and not lint */ +#include +__FBSDID("$FreeBSD: head/lib/libc/string/strnstr.c 251069 2013-05-28 20:57:40Z emaste $"); + +#include + +/* + * Find the first occurrence of find in s, where the search is limited to the + * first slen characters of s. + */ +char * +strnstr(const char *s, const char *find, size_t slen) +{ + char c, sc; + size_t len; + + if ((c = *find++) != '\0') { + len = strlen(find); + do { + do { + if (slen-- < 1 || (sc = *s++) == '\0') + return (NULL); + } while (sc != c); + if (len > slen) + return (NULL); + } while (strncmp(s, find, len) != 0); + s--; + } + return ((char *)s); +} From c206d0442279fb1c0e39f62112ceaae5630d9ef7 Mon Sep 17 00:00:00 2001 From: Sichen Zhao <1473996754@qq.com> Date: Fri, 25 Aug 2017 15:35:39 +0800 Subject: [PATCH 013/649] Port strnstr.c to newlib. --- newlib/libc/include/string.h | 3 +++ newlib/libc/string/Makefile.am | 1 + 2 files changed, 4 insertions(+) diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index 7833aa156..9c536f35f 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -121,6 +121,9 @@ size_t _EXFUN(strnlen,(const char *, size_t)); #if __BSD_VISIBLE char *_EXFUN(strsep,(char **, const char *)); #endif +#if __BSD_VISIBLE +char *strnstr(const char *, const char *, size_t) __pure; +#endif #if __MISC_VISIBLE char *_EXFUN(strlwr,(char *)); diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am index e62f28627..f8bd41e08 100644 --- a/newlib/libc/string/Makefile.am +++ b/newlib/libc/string/Makefile.am @@ -40,6 +40,7 @@ GENERAL_SOURCES = \ strncmp.c \ strncpy.c \ strnlen.c \ + strnstr.c \ strpbrk.c \ strrchr.c \ strsep.c \ From c070326d31af28a0353c855e5a4dceb3b57c6144 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 25 Aug 2017 17:59:05 +0200 Subject: [PATCH 014/649] newlib: rebuild string/Makefile.in Signed-off-by: Corinna Vinschen --- newlib/libc/string/Makefile.in | 76 ++++++++++++++++++++++------------ 1 file changed, 49 insertions(+), 27 deletions(-) diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in index 63681d070..6907eb2d1 100644 --- a/newlib/libc/string/Makefile.in +++ b/newlib/libc/string/Makefile.in @@ -1,9 +1,8 @@ -# Makefile.in generated by automake 1.11.6 from Makefile.am. +# Makefile.in generated by automake 1.12.2 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software -# Foundation, Inc. +# Copyright (C) 1994-2012 Free Software Foundation, Inc. + # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -54,15 +53,11 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am + $(srcdir)/Makefile.am $(top_srcdir)/../../mkinstalldirs subdir = string ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \ - $(top_srcdir)/../../ltoptions.m4 \ - $(top_srcdir)/../../ltsugar.m4 \ - $(top_srcdir)/../../ltversion.m4 \ - $(top_srcdir)/../../lt~obsolete.m4 \ - $(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in +am__aclocal_m4_deps = $(top_srcdir)/../acinclude.m4 \ + $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs @@ -89,12 +84,13 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \ lib_a-strlwr.$(OBJEXT) lib_a-strncasecmp.$(OBJEXT) \ lib_a-strncat.$(OBJEXT) lib_a-strncmp.$(OBJEXT) \ lib_a-strncpy.$(OBJEXT) lib_a-strnlen.$(OBJEXT) \ - lib_a-strpbrk.$(OBJEXT) lib_a-strrchr.$(OBJEXT) \ - lib_a-strsep.$(OBJEXT) lib_a-strsignal.$(OBJEXT) \ - lib_a-strspn.$(OBJEXT) lib_a-strtok.$(OBJEXT) \ - lib_a-strtok_r.$(OBJEXT) lib_a-strupr.$(OBJEXT) \ - lib_a-strxfrm.$(OBJEXT) lib_a-strstr.$(OBJEXT) \ - lib_a-swab.$(OBJEXT) lib_a-timingsafe_bcmp.$(OBJEXT) \ + lib_a-strnstr.$(OBJEXT) lib_a-strpbrk.$(OBJEXT) \ + lib_a-strrchr.$(OBJEXT) lib_a-strsep.$(OBJEXT) \ + lib_a-strsignal.$(OBJEXT) lib_a-strspn.$(OBJEXT) \ + lib_a-strtok.$(OBJEXT) lib_a-strtok_r.$(OBJEXT) \ + lib_a-strupr.$(OBJEXT) lib_a-strxfrm.$(OBJEXT) \ + lib_a-strstr.$(OBJEXT) lib_a-swab.$(OBJEXT) \ + lib_a-timingsafe_bcmp.$(OBJEXT) \ lib_a-timingsafe_memcmp.$(OBJEXT) lib_a-u_strerr.$(OBJEXT) \ lib_a-wcscat.$(OBJEXT) lib_a-wcschr.$(OBJEXT) \ lib_a-wcscmp.$(OBJEXT) lib_a-wcscoll.$(OBJEXT) \ @@ -148,9 +144,9 @@ am__objects_4 = bcopy.lo bzero.lo explicit_bzero.lo ffsl.lo ffsll.lo \ strchr.lo strcmp.lo strcoll.lo strcpy.lo strcspn.lo strdup.lo \ strdup_r.lo strerror.lo strerror_r.lo strlcat.lo strlcpy.lo \ strlen.lo strlwr.lo strncasecmp.lo strncat.lo strncmp.lo \ - strncpy.lo strnlen.lo strpbrk.lo strrchr.lo strsep.lo \ - strsignal.lo strspn.lo strtok.lo strtok_r.lo strupr.lo \ - strxfrm.lo strstr.lo swab.lo timingsafe_bcmp.lo \ + strncpy.lo strnlen.lo strnstr.lo strpbrk.lo strrchr.lo \ + strsep.lo strsignal.lo strspn.lo strtok.lo strtok_r.lo \ + strupr.lo strxfrm.lo strstr.lo swab.lo timingsafe_bcmp.lo \ timingsafe_memcmp.lo u_strerr.lo wcscat.lo wcschr.lo wcscmp.lo \ wcscoll.lo wcscpy.lo wcscspn.lo wcslcat.lo wcslcpy.lo \ wcslen.lo wcsncat.lo wcsncmp.lo wcsncpy.lo wcsnlen.lo \ @@ -262,8 +258,10 @@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ +LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ NM = @NM@ @@ -292,6 +290,7 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ aext = @aext@ @@ -386,6 +385,7 @@ GENERAL_SOURCES = \ strncmp.c \ strncpy.c \ strnlen.c \ + strnstr.c \ strpbrk.c \ strrchr.c \ strsep.c \ @@ -548,12 +548,14 @@ lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES) clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test "$$dir" != "$$p" || dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done + @list='$(noinst_LTLIBRARIES)'; \ + locs=`for p in $$list; do echo $$p; done | \ + sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ + sort -u`; \ + test -z "$$locs" || { \ + echo rm -f $${locs}; \ + rm -f $${locs}; \ + } libstring.la: $(libstring_la_OBJECTS) $(libstring_la_DEPENDENCIES) $(EXTRA_libstring_la_DEPENDENCIES) $(libstring_la_LINK) $(am_libstring_la_rpath) $(libstring_la_OBJECTS) $(libstring_la_LIBADD) $(LIBS) @@ -782,6 +784,12 @@ lib_a-strnlen.o: strnlen.c lib_a-strnlen.obj: strnlen.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strnlen.obj `if test -f 'strnlen.c'; then $(CYGPATH_W) 'strnlen.c'; else $(CYGPATH_W) '$(srcdir)/strnlen.c'; fi` +lib_a-strnstr.o: strnstr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strnstr.o `test -f 'strnstr.c' || echo '$(srcdir)/'`strnstr.c + +lib_a-strnstr.obj: strnstr.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strnstr.obj `if test -f 'strnstr.c'; then $(CYGPATH_W) 'strnstr.c'; else $(CYGPATH_W) '$(srcdir)/strnstr.c'; fi` + lib_a-strpbrk.o: strpbrk.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strpbrk.o `test -f 'strpbrk.c' || echo '$(srcdir)/'`strpbrk.c @@ -1245,6 +1253,20 @@ GTAGS: && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" +cscopelist: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP)'; \ + case "$(srcdir)" in \ + [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ + *) sdir=$(subdir)/$(srcdir) ;; \ + esac; \ + for i in $$list; do \ + if test -f "$$i"; then \ + echo "$(subdir)/$$i"; \ + else \ + echo "$$sdir/$$i"; \ + fi; \ + done >> $(top_builddir)/cscope.files + distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-am: @@ -1355,7 +1377,7 @@ uninstall-am: .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ - ctags distclean distclean-compile distclean-generic \ + cscopelist ctags distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ From cf8bf843f8be1771b8ad2489480cfdbbc42a668d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 25 Aug 2017 17:59:28 +0200 Subject: [PATCH 015/649] cygwin: export strnstr Signed-off-by: Corinna Vinschen --- winsup/cygwin/common.din | 1 + winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/release/2.9.0 | 2 +- winsup/doc/new-features.xml | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index ca6ff3cf9..55fa9b16c 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -1376,6 +1376,7 @@ strncmp NOSIGFE strncpy NOSIGFE strndup SIGFE strnlen NOSIGFE +strnstr NOSIGFE strpbrk NOSIGFE strptime SIGFE strptime_l SIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 7686a6865..e5c9e7fcd 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -482,12 +482,13 @@ details. */ 315: Export pthread_mutex_timedlock. 316: Export pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock. 317: Export renameat2. + 318: Export strnstr. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 317 +#define CYGWIN_VERSION_API_MINOR 318 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/release/2.9.0 b/winsup/cygwin/release/2.9.0 index ac4c64949..0fff76330 100644 --- a/winsup/cygwin/release/2.9.0 +++ b/winsup/cygwin/release/2.9.0 @@ -1,7 +1,7 @@ What's new: ----------- -- New APIs: explicit_bzero. +- New APIs: explicit_bzero, strnstr. - New APIs: pthread_mutex_timedwait, pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock. diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml index 0aa857730..9bdb94c11 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -9,7 +9,7 @@ -New APIs: explicit_bzero. +New APIs: explicit_bzero, strnstr. From f1863582eda80694f77a90ad21d5b2eb2be9b881 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 25 Aug 2017 19:48:42 +0200 Subject: [PATCH 016/649] Fix compile error due to new strnstr() Remove local strnstr() implementation to fix compile error: newlib/libc/iconv/lib/aliasesi.c:53:8: error: conflicting types for 'strnstr' _DEFUN(strnstr, (haystack, needle, length), ^ In file included from newlib/libc/iconv/lib/aliasesi.c:29:0: newlib/libc/include/string.h:125:10: note: previous declaration of 'strnstr' was here char *strnstr(const char *, const char *, size_t) __pure; ^~~~~~~ Signed-off-by: Sebastian Huber --- newlib/libc/iconv/lib/aliasesi.c | 43 -------------------------------- 1 file changed, 43 deletions(-) diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c index f94ac8fb9..41497c608 100644 --- a/newlib/libc/iconv/lib/aliasesi.c +++ b/newlib/libc/iconv/lib/aliasesi.c @@ -33,49 +33,6 @@ #include #include "local.h" -/* - * strnstr - locate a substring in a fixed-size string. - * - * PARAMETERS: - * _CONST char *haystack - the string in which to search. - * _CONST char *needle - the string which to search. - * int length - the maximum 'haystack' string length. - * - * DESCRIPTION: - * The strstr() function finds the first occurrence of the substring - * 'needle' in the string 'haystack'. At most 'length' bytes are searched. - * - * RETURN: - * Returns a pointer to the beginning of substring, or NULL if substring - * was not found. - */ -static char * -_DEFUN(strnstr, (haystack, needle, length), - _CONST char *haystack _AND - _CONST char *needle _AND - int length) -{ - _CONST char *max = haystack + length; - - if (*haystack == '\0') - return *needle == '\0' ? (char *)haystack : (char *)NULL; - - while (haystack < max) - { - int i = 0; - while (1) - { - if (needle[i] == '\0') - return (char *)haystack; - if (needle[i] != haystack[i]) - break; - i += 1; - } - haystack += 1; - } - return (char *)NULL; -} - /* * canonical_form - canonize 'str'. * From 4dfaef81414f006377ed235a995c7b2d8dcdcb95 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 29 Aug 2017 11:16:13 +0200 Subject: [PATCH 017/649] cygwin: document %s support in strptime Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.9.0 | 2 ++ winsup/doc/new-features.xml | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/winsup/cygwin/release/2.9.0 b/winsup/cygwin/release/2.9.0 index 0fff76330..6b1f0f2b9 100644 --- a/winsup/cygwin/release/2.9.0 +++ b/winsup/cygwin/release/2.9.0 @@ -14,6 +14,8 @@ What changed: - Improved implementation of . +- Add %s support for strptime.. + Bug Fixes --------- diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml index 9bdb94c11..4f1ff97dc 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -25,6 +25,10 @@ New API: renameat2. Improved implementation of <elf.h>. + +strptime(3) supports %s (seconds since Epoch) now, analogue to strftime. + + From d8e2463c75d946f30af19705ad922085185784a5 Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Tue, 29 Aug 2017 11:25:43 -0600 Subject: [PATCH 018/649] winsup/cygwin/libc/strptime.cc(__strptime) fix %F width --- winsup/cygwin/libc/strptime.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc index 7c6cc2024..081aca385 100644 --- a/winsup/cygwin/libc/strptime.cc +++ b/winsup/cygwin/libc/strptime.cc @@ -413,13 +413,15 @@ literal: case 'F': /* The date as "%Y-%m-%d". */ { LEGAL_ALT(0); - ymd |= SET_YMD; char *tmp = __strptime ((const char *) bp, "%Y-%m-%d", tm, era_info, alt_digits, locale); - if (tmp && (uint) (tmp - (char *) bp) > width) + /* width max chars converted, default 10, < 6 => 6 */ + if (tmp && (char *) bp + + (!width ? 10 : width < 6 ? 6 : width) < tmp) return NULL; bp = (const unsigned char *) tmp; + ymd |= SET_YMD; continue; } From cdbec10e7914748792371512d4485a9d868fe549 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 29 Aug 2017 21:12:21 +0200 Subject: [PATCH 019/649] cygwin: add strptime %F fix to release notes Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.9.0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/release/2.9.0 b/winsup/cygwin/release/2.9.0 index 6b1f0f2b9..5e105fc07 100644 --- a/winsup/cygwin/release/2.9.0 +++ b/winsup/cygwin/release/2.9.0 @@ -33,3 +33,6 @@ Bug Fixes - Fix a clear screen issue in Windows console when running under codepage 65001. Addresses: https://cygwin.com/ml/cygwin/2017-07/msg00430.html + +- Fix bug in strptime %F field width handling. + Addresses: https://cygwin.com/ml/cygwin-patches/2017-q3/msg00033.html From f22054c94d3f77ba834d55123ffa9fe4aef6f93c Mon Sep 17 00:00:00 2001 From: Sichen Zhao <1473996754@qq.com> Date: Wed, 30 Aug 2017 11:03:56 +0800 Subject: [PATCH 020/649] Modify strnstr.c. --- newlib/libc/string/strnstr.c | 65 ++++++------------------------------ 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c index da5e5bdcb..05d86ee20 100644 --- a/newlib/libc/string/strnstr.c +++ b/newlib/libc/string/strnstr.c @@ -1,42 +1,5 @@ -/*- - * Copyright (c) 2001 Mike Barcroft - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * This code is derived from software contributed to Berkeley by - * Chris Torek. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * 3. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)strstr.c 8.1 (Berkeley) 6/4/93"; -#endif /* LIBC_SCCS and not lint */ -#include -__FBSDID("$FreeBSD: head/lib/libc/string/strnstr.c 251069 2013-05-28 20:57:40Z emaste $"); - +#undef __STRICT_ANSI__ +#include <_ansi.h> #include /* @@ -44,22 +7,14 @@ __FBSDID("$FreeBSD: head/lib/libc/string/strnstr.c 251069 2013-05-28 20:57:40Z e * first slen characters of s. */ char * -strnstr(const char *s, const char *find, size_t slen) +strnstr(const char *haystack, const char *needle, size_t haystack_len) { - char c, sc; - size_t len; + size_t needle_len = strnlen(needle, haystack_len); - if ((c = *find++) != '\0') { - len = strlen(find); - do { - do { - if (slen-- < 1 || (sc = *s++) == '\0') - return (NULL); - } while (sc != c); - if (len > slen) - return (NULL); - } while (strncmp(s, find, len) != 0); - s--; - } - return ((char *)s); + if (needle_len < haystack_len || !needle[needle_len]) { + char *x = memmem(haystack, haystack_len, needle, needle_len); + if (x && !memchr(haystack, 0, x - haystack)) + return x; + } + return NULL; } From 42885ea4b8bfece01cac0a4a4030ff4341454353 Mon Sep 17 00:00:00 2001 From: Sichen Zhao <1473996754@qq.com> Date: Wed, 30 Aug 2017 11:03:57 +0800 Subject: [PATCH 021/649] Add man page entry for strnstr.c. --- newlib/libc/string/strings.tex | 4 ++++ newlib/libc/string/strnstr.c | 39 ++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/newlib/libc/string/strings.tex b/newlib/libc/string/strings.tex index c619886b5..6aec5fe0e 100644 --- a/newlib/libc/string/strings.tex +++ b/newlib/libc/string/strings.tex @@ -40,6 +40,7 @@ managing areas of memory. The corresponding declarations are in * strncat:: Concatenate strings * strncmp:: Character string compare * strncpy:: Counted copy string +* strnstr:: Find string segment * strnlen:: Character string length * strpbrk:: Find chars in string * strrchr:: Reverse search for character in string @@ -158,6 +159,9 @@ managing areas of memory. The corresponding declarations are in @page @include string/strncpy.def +@page +@include string/strnstr.def + @page @include string/strnlen.def diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c index 05d86ee20..fcceebc1f 100644 --- a/newlib/libc/string/strnstr.c +++ b/newlib/libc/string/strnstr.c @@ -1,3 +1,42 @@ +/* +FUNCTION + <>---find string segment + +INDEX + strnstr + +ANSI_SYNOPSIS + #include + size_t strnstr(const char *<[s1]>, const char *<[s2]>, size_t <[n]>); + +TRAD_SYNOPSIS + #include + size_t strnstr(<[s1]>, <[s2]>, <[n]>) + char *<[s1]>; + char *<[s2]>; + size_t <[n]>; + +DESCRIPTION + Locates the first occurrence in the string pointed to by <[s1]> of + the sequence of limited to the <[n]> characters in the string + pointed to by <[s2]> + +RETURNS + Returns a pointer to the located string segment, or a null + pointer if the string <[s2]> is not found. If <[s2]> points to + a string with zero length, <[s1]> is returned. + + +PORTABILITY +<> is ANSI C. + +<> requires no supporting OS subroutines. + +QUICKREF + strnstr ansi pure + +*/ + #undef __STRICT_ANSI__ #include <_ansi.h> #include From 5fc315b597debc918e93aa21d2f23f4f82051904 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 30 Aug 2017 16:45:36 +0200 Subject: [PATCH 022/649] newlib: strnstr: drop traditional synopisis Signed-off-by: Corinna Vinschen --- newlib/libc/string/strnstr.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c index fcceebc1f..ce32d0f73 100644 --- a/newlib/libc/string/strnstr.c +++ b/newlib/libc/string/strnstr.c @@ -9,13 +9,6 @@ ANSI_SYNOPSIS #include size_t strnstr(const char *<[s1]>, const char *<[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - size_t strnstr(<[s1]>, <[s2]>, <[n]>) - char *<[s1]>; - char *<[s2]>; - size_t <[n]>; - DESCRIPTION Locates the first occurrence in the string pointed to by <[s1]> of the sequence of limited to the <[n]> characters in the string From 192986ab032e035d43df909274465b9056e3a818 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 30 Aug 2017 16:48:55 +0200 Subject: [PATCH 023/649] newlib: string/Makefile.am (CHEWOUT_FILES): Add strnstr.def Regenerate strings/Makefile.in Signed-off-by: Corinna Vinschen --- newlib/libc/string/Makefile.am | 2 +- newlib/libc/string/Makefile.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am index f8bd41e08..a21e3d55d 100644 --- a/newlib/libc/string/Makefile.am +++ b/newlib/libc/string/Makefile.am @@ -164,6 +164,6 @@ wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \ memmem.def memrchr.def rawmemchr.def strchrnul.def \ strcasecmp_l.def strcoll_l.def strncasecmp_l.def strxfrm_l.def \ wcscasecmp_l.def wcscoll_l.def wcsncasecmp_l.def wcsxfrm_l.def \ -strverscmp.def +strverscmp.def strnstr.def CHAPTERS = strings.tex wcstrings.tex diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in index 6907eb2d1..13dee83e0 100644 --- a/newlib/libc/string/Makefile.in +++ b/newlib/libc/string/Makefile.in @@ -500,7 +500,7 @@ wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \ memmem.def memrchr.def rawmemchr.def strchrnul.def \ strcasecmp_l.def strcoll_l.def strncasecmp_l.def strxfrm_l.def \ wcscasecmp_l.def wcscoll_l.def wcsncasecmp_l.def wcsxfrm_l.def \ -strverscmp.def +strverscmp.def strnstr.def CHAPTERS = strings.tex wcstrings.tex all: all-am From 51d1fb715db4c1d290bce3d8b4c42a505918f2af Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 29 Aug 2017 12:55:58 -0500 Subject: [PATCH 024/649] include: fix ffs, fls guards Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/strings.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h index 35fcdc092..122f2fcd6 100644 --- a/newlib/libc/include/strings.h +++ b/newlib/libc/include/strings.h @@ -50,12 +50,14 @@ void bzero(void *, size_t); /* LEGACY */ #if __BSD_VISIBLE void explicit_bzero(void *, size_t); #endif -#if __XSI_VISIBLE +#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700 int ffs(int) __pure2; #endif -#if __BSD_VISIBLE +#if __GNU_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; +#endif +#if __BSD_VISIBLE int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; From 5325111d032cd006a02842d3d6ffe6c502e4b3bd Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sat, 2 Sep 2017 16:14:02 +0200 Subject: [PATCH 025/649] Remove some dangerous advice from the FAQ --- winsup/doc/faq-setup.xml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/winsup/doc/faq-setup.xml b/winsup/doc/faq-setup.xml index 3917f2d30..b242fbae4 100644 --- a/winsup/doc/faq-setup.xml +++ b/winsup/doc/faq-setup.xml @@ -610,16 +610,20 @@ folders that are causing the error. For example, sometimes files used by system services end up owned by the SYSTEM account and not writable by regular users. The quickest way to delete the entire tree if you run into this problem -is to change the ownership of all files and folders to your account. To do +is to take ownership of all files and folders to your account. To do this in Windows Explorer, right click on the root Cygwin folder, choose Properties, then the Security tab. If you are using Simple File Sharing, you will need to boot into Safe Mode to access the Security tab. Select Advanced, then go to the Owner tab and make sure your account is listed as the owner. Select the 'Replace owner on subcontainers and objects' checkbox and press Ok. After Explorer applies the changes you should be able to delete the entire tree -in one operation. Note that you can also achieve this in Cygwin by typing -chown -R user / or by using other tools such as -icacls.exe. +in one operation. Note that you can also achieve by using other tools such as +icacls.exe or directly from Cygwin by using +chown. Please note that you shouldn't use the +recursive form of chown on directories that have other file systems +mounted under them (specifically you must avoid +/proc) since you'd change ownership of the files under those +mount points as well. Delete the Cygwin shortcuts on the Desktop and Start Menu, and From ff53f489fa2f7ddf4306fe256de5609ff7a131b0 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 1 Sep 2017 17:26:40 -0500 Subject: [PATCH 026/649] cygwin: Document crypt_r Signed-off-by: Yaakov Selkowitz --- winsup/doc/posix.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml index 6e96272b7..c99e003ba 100644 --- a/winsup/doc/posix.xml +++ b/winsup/doc/posix.xml @@ -1286,6 +1286,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). clog10 clog10f clog10l + crypt_r (available in external "crypt" library) dladdr (see chapter "Implementation Notes") dremf dup3 From e18b7ffa4893aa1011bae52e6e7a8f1bfcc336d5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 4 Sep 2017 10:52:33 +0200 Subject: [PATCH 027/649] stdio.h: Don't define unlocked macros using static inline on C++ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In C++, the usage of static inline functions for getchar_unlocked and putchar_unlocked may result in error messages like error: ‘_putchar_unlocked’ was not declared in this scope Fix this by not using the _getchar_unlocked and _putchar_unlocked macros in C++. Signed-off-by: Corinna Vinschen --- newlib/libc/include/stdio.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 331a1cf07..ee0f612c4 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -762,12 +762,12 @@ _putchar_unlocked(int _c) #define getchar() _getchar_unlocked() #define putchar(_c) _putchar_unlocked(_c) #endif /* __SINGLE_THREAD__ */ -#endif /* __cplusplus */ #if __MISC_VISIBLE || __POSIX_VISIBLE #define getchar_unlocked() _getchar_unlocked() #define putchar_unlocked(_c) _putchar_unlocked(_c) #endif +#endif /* __cplusplus */ #if __MISC_VISIBLE /* fast always-buffered version, true iff error */ From f9205f1d470ed1a214b841b6d2fd60fea14954cb Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 6 Sep 2017 08:43:26 +0200 Subject: [PATCH 028/649] Let RTEMS provide clock() Newlib uses _times_r() in clock(). The problem is that the _times_r() clock frequency is defined by sysconf(_SC_CLK_TCK). The clock frequency of clock() is the constant CLOCKS_PER_SEC. FreeBSD uses getrusage() for clock(). Since RTEMS has only one process, the implementation can be simplified. Signed-off-by: Sebastian Huber --- newlib/configure.host | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/configure.host b/newlib/configure.host index 3d967a11b..ba2d8c6c7 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -605,7 +605,7 @@ case "${host}" in default_newlib_io_long_long="yes" default_newlib_io_c99_formats="yes" newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB" - newlib_cflags="${newlib_cflags} -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" + newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" # turn off unsupported items in posix directory newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN" # turn off using cli/sti in i386 setjmp/longjmp From ad45b86533a47ae33ec99cebc61aee96b57e17a5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 7 Sep 2017 15:01:47 +0200 Subject: [PATCH 029/649] Remove harmful casts in gmtime_r() In case time_t is long, then the cast to long is a nop. In case time_t is __int_least64_t, then the cast to long may truncate the value before the division. Signed-off-by: Sebastian Huber --- newlib/libc/time/gmtime_r.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/time/gmtime_r.c b/newlib/libc/time/gmtime_r.c index 81c7c94b1..6475df3ba 100644 --- a/newlib/libc/time/gmtime_r.c +++ b/newlib/libc/time/gmtime_r.c @@ -56,8 +56,8 @@ _DEFUN (gmtime_r, (tim_p, res), unsigned erayear, yearday, month, day; unsigned long eraday; - days = ((long)lcltime) / SECSPERDAY + EPOCH_ADJUSTMENT_DAYS; - rem = ((long)lcltime) % SECSPERDAY; + days = lcltime / SECSPERDAY + EPOCH_ADJUSTMENT_DAYS; + rem = lcltime % SECSPERDAY; if (rem < 0) { rem += SECSPERDAY; From 4de8754bac676fc7f29082ccf8281b1c73ce629e Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 7 Sep 2017 08:24:22 +0200 Subject: [PATCH 030/649] Change time_t to 64-bit by default In order to avoid the year 2038 problem, define time_t to a signed integer with at least 64-bits. The type for time_t can be forced to long with the --enable-newlib-long-time_t configure option or with the _USE_LONG_TIME_T system configuration define. Signed-off-by: Sebastian Huber --- newlib/README | 6 ++++++ newlib/configure | 26 ++++++++++++++++++++++++-- newlib/configure.in | 15 +++++++++++++++ newlib/libc/include/sys/_types.h | 6 +++++- newlib/libc/include/sys/config.h | 6 ++++++ newlib/newlib.hin | 3 +++ winsup/cygwin/include/cygwin/config.h | 1 + 7 files changed, 60 insertions(+), 3 deletions(-) diff --git a/newlib/README b/newlib/README index 78f4de846..8c97e24aa 100644 --- a/newlib/README +++ b/newlib/README @@ -343,6 +343,12 @@ One feature can be enabled by specifying `--enable-FEATURE=yes' or disables the optimization and saves size of text and stack. Enabled by default. +`--enable-newlib-long-time_t' + Define time_t to long. On platforms with a 32-bit long type, this gives + raise to the year 2038 problem. The default type for time_t is a signed + 64-bit integer on most systems. + Disabled by default. + `--enable-multilib' Build many library versions. Enabled by default. diff --git a/newlib/configure b/newlib/configure index b2f0b3340..eb4b3b275 100755 --- a/newlib/configure +++ b/newlib/configure @@ -804,6 +804,7 @@ enable_newlib_unbuf_stream_opt enable_lite_exit enable_newlib_nano_formatted_io enable_newlib_retargetable_locking +enable_newlib_long_time_t enable_multilib enable_target_optspace enable_malloc_debugging @@ -1477,6 +1478,7 @@ Optional Features: --enable-lite-exit enable light weight exit --enable-newlib-nano-formatted-io Use nano version formatted IO --enable-newlib-retargetable-locking Allow locking routines to be retargeted at link time + --enable-newlib-long-time_t define time_t to long --enable-multilib build many library versions (default) --enable-target-optspace optimize for space --enable-malloc-debugging indicate malloc debugging requested @@ -2501,6 +2503,19 @@ else fi +# Check whether --enable-newlib-long-time_t was given. +if test "${enable_newlib_long_time_t+set}" = set; then : + enableval=$enable_newlib_long_time_t; if test "${newlib_long_time_t+set}" != set; then + case "${enableval}" in + yes) newlib_long_time_t=yes ;; + no) newlib_long_time_t=no ;; + *) as_fn_error $? "bad value ${enableval} for newlib-long-time_t option" "$LINENO" 5 ;; + esac + fi +else + newlib_nano_malloc= +fi + # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || @@ -11807,7 +11822,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11810 "configure" +#line 11825 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11913,7 +11928,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11916 "configure" +#line 11931 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12496,6 +12511,13 @@ _ACEOF fi +if test "${newlib_long_time_t}" = "yes"; then +cat >>confdefs.h <<_ACEOF +#define _WANT_USE_LONG_TIME_T 1 +_ACEOF + +fi + if test "x${iconv_encodings}" != "x" \ || test "x${iconv_to_encodings}" != "x" \ diff --git a/newlib/configure.in b/newlib/configure.in index 5b86ee800..9d304817d 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -238,6 +238,17 @@ AC_ARG_ENABLE(newlib-retargetable-locking, *) AC_MSG_ERROR(bad value ${enableval} for newlib-retargetable-locking) ;; esac],[newlib_retargetable_locking=no]) +dnl Support --enable-newlib-long-time_t +AC_ARG_ENABLE(newlib-long-time_t, +[ --enable-newlib-long-time_t define time_t to long], +[if test "${newlib_long_time_t+set}" != set; then + case "${enableval}" in + yes) newlib_long_time_t=yes ;; + no) newlib_long_time_t=no ;; + *) AC_MSG_ERROR(bad value ${enableval} for newlib-long-time_t option) ;; + esac + fi], [newlib_nano_malloc=])dnl + NEWLIB_CONFIGURE(.) dnl We have to enable libtool after NEWLIB_CONFIGURE because if we try and @@ -486,6 +497,10 @@ if test "${newlib_retargetable_locking}" = "yes"; then AC_DEFINE_UNQUOTED(_RETARGETABLE_LOCKING) fi +if test "${newlib_long_time_t}" = "yes"; then +AC_DEFINE_UNQUOTED(_WANT_USE_LONG_TIME_T) +fi + dnl dnl Parse --enable-newlib-iconv-encodings option argument dnl diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index d27979c9d..72e1dc17a 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -186,7 +186,11 @@ typedef void *_iconv_t; typedef _CLOCK_T_ __clock_t; -#define _TIME_T_ long /* time() */ +#if defined(_USE_LONG_TIME_T) || __LONG_MAX__ > 0x7fffffffL +#define _TIME_T_ long +#else +#define _TIME_T_ __int_least64_t +#endif typedef _TIME_T_ __time_t; #define _CLOCKID_T_ unsigned long diff --git a/newlib/libc/include/sys/config.h b/newlib/libc/include/sys/config.h index 8dc0c5e9d..2082dfdb1 100644 --- a/newlib/libc/include/sys/config.h +++ b/newlib/libc/include/sys/config.h @@ -283,6 +283,12 @@ #endif #endif +#ifdef _WANT_USE_LONG_TIME_T +#ifndef _USE_LONG_TIME_T +#define _USE_LONG_TIME_T +#endif +#endif + /* If _MB_EXTENDED_CHARSETS_ALL is set, we want all of the extended charsets. The extended charsets add a few functions and a couple of tables of a few K each. */ diff --git a/newlib/newlib.hin b/newlib/newlib.hin index 45c683187..18306f293 100644 --- a/newlib/newlib.hin +++ b/newlib/newlib.hin @@ -90,6 +90,9 @@ /* Define if using retargetable functions for default lock routines. */ #undef _RETARGETABLE_LOCKING +/* Define to use type long for time_t. */ +#undef _WANT_USE_LONG_TIME_T + /* * Iconv encodings enabled ("to" direction) */ diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h index aede45f77..282637b67 100644 --- a/winsup/cygwin/include/cygwin/config.h +++ b/winsup/cygwin/include/cygwin/config.h @@ -79,6 +79,7 @@ extern inline struct _reent *__getreent (void) #define _STDIO_BSD_SEMANTICS 1 #define __TM_GMTOFF tm_gmtoff #define __TM_ZONE tm_zone +#define _USE_LONG_TIME_T 1 #if defined(__INSIDE_CYGWIN__) || defined(_COMPILING_NEWLIB) #define __EXPORT __declspec(dllexport) From 21a39b20a53d6c26959296765a7006af377ce37b Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 11 Sep 2017 13:21:46 -0500 Subject: [PATCH 031/649] Revert "cygwin: only expose /dev/con{in,out,sole} when started from a Windows console" This caused serious regressions when running from a cmd window: https://cygwin.com/ml/cygwin/2017-09/msg00114.html This reverts commit b706c6b479422d31f0124b92c21b4cb536bbddff. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/fhandler.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index cd73e6e87..153e3847f 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1439,7 +1439,7 @@ private: ssize_t __stdcall write (const void *ptr, size_t len); void doecho (const void *str, DWORD len) { (void) write (str, len); } int close (); - static bool exists () {return shared_console_info && !!GetConsoleCP ();} + static bool exists () {return !!GetConsoleCP ();} int tcflush (int); int tcsetattr (int a, const struct termios *t); From 05cfd1aed8b262e82f62acc2de2858d2d2b6679c Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 12 Sep 2017 14:30:34 -0500 Subject: [PATCH 032/649] cygwin: workaround GCC 6 changes GCC 6 includes a number of new warnings which cause Cygwin to either not compile, or not work properly even if said warnings are ignored: https://cygwin.com/ml/cygwin-developers/2017-09/msg00000.html https://gcc.gnu.org/gcc-6/porting_to.html For now, we use the flags necessary to revert to GCC 5 behaviour until we can fix the code properly. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/Makefile.in | 4 ++-- winsup/cygwin/crt0.c | 2 ++ winsup/cygwin/init.cc | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 10e6b1f81..98727c019 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -73,11 +73,11 @@ CRT0:=$(cygwin_build)/crt0.o # MT_SAFE:=@MT_SAFE@ CCEXTRA= -COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer $(CCEXTRA) +COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fno-delete-null-pointer-checks -fmerge-constants -ftracer $(CCEXTRA) ifeq ($(target_cpu),x86_64) COMMON_CFLAGS+=-mcmodel=small endif -COMPILE.cc+=${COMMON_CFLAGS} +COMPILE.cc+=${COMMON_CFLAGS} -std=gnu++98 COMPILE.c+=${COMMON_CFLAGS} AR:=@AR@ diff --git a/winsup/cygwin/crt0.c b/winsup/cygwin/crt0.c index f0103b4ca..271f5b911 100644 --- a/winsup/cygwin/crt0.c +++ b/winsup/cygwin/crt0.c @@ -20,7 +20,9 @@ void mainCRTStartup () { #ifdef __i386__ +#pragma GCC diagnostic ignored "-Wframe-address" (void)__builtin_return_address(1); +#pragma GCC diagnostic pop asm volatile ("andl $-16,%%esp" ::: "%esp"); #endif diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 5b84b1cc0..2d4299e5b 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -23,7 +23,9 @@ static void WINAPI threadfunc_fe (VOID *arg) { #ifndef __x86_64__ +#pragma GCC diagnostic ignored "-Wframe-address" (void)__builtin_return_address(1); +#pragma GCC diagnostic pop asm volatile ("andl $-16,%%esp" ::: "%esp"); #endif _cygtls::call ((DWORD (*) (void *, void *)) TlsGetValue (_my_oldfunc), arg); From 1592a0be0caa7476fccbb1f9ae9310780cad6ef2 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 14:31:01 +0200 Subject: [PATCH 033/649] Fix warnings and documentation in strnstr.c Signed-off-by: Sebastian Huber --- newlib/libc/string/strnstr.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c index ce32d0f73..947355fed 100644 --- a/newlib/libc/string/strnstr.c +++ b/newlib/libc/string/strnstr.c @@ -21,17 +21,16 @@ RETURNS PORTABILITY -<> is ANSI C. +<> is a BSD extension. <> requires no supporting OS subroutines. QUICKREF - strnstr ansi pure + strnstr pure */ -#undef __STRICT_ANSI__ -#include <_ansi.h> +#define _GNU_SOURCE #include /* From f9b24fad7c7b0ed20d2c5c82bd97f7dd8e1532f0 Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Wed, 13 Sep 2017 00:26:48 -0600 Subject: [PATCH 034/649] newlib/libm/complex/cargl.c change imag() real() to cimagl() creall() --- newlib/libm/complex/cargl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libm/complex/cargl.c b/newlib/libm/complex/cargl.c index d2885a459..790cffe8f 100644 --- a/newlib/libm/complex/cargl.c +++ b/newlib/libm/complex/cargl.c @@ -13,6 +13,6 @@ cargl(long double complex z) #ifdef _LDBL_EQ_DBL return carg (z); #else - return atan2l (imag (z), real (z)); + return atan2l (cimagl (z), creall (z)); #endif } From 4fef7312b31bed6c77add331805f5212551c54cd Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 19 Sep 2017 15:08:35 +0200 Subject: [PATCH 035/649] RTEMS: Optimize pthread_once_t Reduce size of pthread_once_t and make it zero-initialized. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/machine/_threads.h | 5 ++--- newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 8 ++++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/newlib/libc/sys/rtems/include/machine/_threads.h b/newlib/libc/sys/rtems/include/machine/_threads.h index 24db21c0e..5faa78f46 100644 --- a/newlib/libc/sys/rtems/include/machine/_threads.h +++ b/newlib/libc/sys/rtems/include/machine/_threads.h @@ -41,12 +41,11 @@ typedef __uint32_t tss_t; /* pthread_once_t */ typedef struct { - int _is_initialized; - int _init_executed; + unsigned char _flags; } once_flag; /* PTHREAD_ONCE_INIT */ -#define ONCE_FLAG_INIT { 1, 0 } +#define ONCE_FLAG_INIT { 0 } /* PTHREAD_DESTRUCTOR_ITERATIONS */ #define TSS_DTOR_ITERATIONS 4 diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h index bd66c689e..9db50fe44 100644 --- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h +++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h @@ -169,11 +169,11 @@ typedef struct { typedef __uint32_t pthread_key_t; /* thread-specific data keys */ typedef struct { - int is_initialized; /* is this structure initialized? */ - int init_executed; /* has the initialization routine been run? */ -} pthread_once_t; /* dynamic package initialization */ + unsigned char _flags; +} pthread_once_t; + +#define _PTHREAD_ONCE_INIT { 0 } -#define _PTHREAD_ONCE_INIT { 1, 0 } /* is initialized and not run */ #endif /* defined(_POSIX_THREADS) */ /* POSIX Barrier Types */ From 8253c240cb0fc24697bfe2b9388cb7cad1badb34 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 13 Sep 2017 13:07:31 +0200 Subject: [PATCH 036/649] RTEMS: Make sem_t self-contained Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/semaphore.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/newlib/libc/sys/rtems/include/semaphore.h b/newlib/libc/sys/rtems/include/semaphore.h index e3c61da04..44ecc58f4 100644 --- a/newlib/libc/sys/rtems/include/semaphore.h +++ b/newlib/libc/sys/rtems/include/semaphore.h @@ -24,7 +24,7 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD$ + * $FreeBSD: head/include/semaphore.h 314424 2017-02-28 21:47:00Z vangyzen $ */ /* semaphore.h: POSIX 1003.1b semaphores */ @@ -33,10 +33,14 @@ #define _SEMAPHORE_H_ #include +#include #include #include -typedef __uint32_t sem_t; +typedef struct { + unsigned long _flags; + struct _Semaphore_Control _Semaphore; +} sem_t; #define SEM_FAILED ((sem_t *)0) From 9187bb23a0dc7f0badcf22833de2ff193e9e0f68 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 21 Sep 2017 15:21:13 +0200 Subject: [PATCH 037/649] RTEMS: Make pthread_barrier_t self-contained Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h index 9db50fe44..4cb15d14b 100644 --- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h +++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h @@ -179,7 +179,13 @@ typedef struct { /* POSIX Barrier Types */ #if defined(_POSIX_BARRIERS) -typedef __uint32_t pthread_barrier_t; /* POSIX Barrier Object */ +typedef struct { + unsigned long _flags; + struct _Thread_queue_Queue _Queue; + unsigned int _count; + unsigned int _waiting_threads; +} pthread_barrier_t; + typedef struct { int is_initialized; /* is this structure initialized? */ #if defined(_POSIX_THREAD_PROCESS_SHARED) From d902eef0939eeae5ce4a188251c993cd00648a13 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 21 Sep 2017 15:41:30 +0200 Subject: [PATCH 038/649] RTEMS: Make pthread_rwlock_t self-contained Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h index 4cb15d14b..5638f1569 100644 --- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h +++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h @@ -206,9 +206,14 @@ typedef struct { /* POSIX Reader/Writer Lock Types */ #if defined(_POSIX_READER_WRITER_LOCKS) -typedef __uint32_t pthread_rwlock_t; /* POSIX RWLock Object */ +typedef struct { + unsigned long _flags; + struct _Thread_queue_Queue _Queue; + unsigned int _current_state; + unsigned int _number_of_readers; +} pthread_rwlock_t; -#define _PTHREAD_RWLOCK_INITIALIZER ((pthread_rwlock_t) 0xFFFFFFFF) +#define _PTHREAD_RWLOCK_INITIALIZER { 0, _THREAD_QUEUE_INITIALIZER, 0, 0 } typedef struct { int is_initialized; /* is this structure initialized? */ From 55c5dda9b5d2627ef7bb5568f11632c4c03bf41b Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 26 Sep 2017 07:36:25 +0200 Subject: [PATCH 039/649] RTEMS: Make pthread_cond_t self-contained Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h index 5638f1569..0b607f7f2 100644 --- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h +++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h @@ -152,9 +152,13 @@ typedef struct { /* Condition Variables */ -typedef __uint32_t pthread_cond_t; /* identify a condition variable */ +typedef struct { + unsigned long _flags; + struct _Thread_queue_Queue _Queue; + pthread_mutex_t *_mutex; +} pthread_cond_t; -#define _PTHREAD_COND_INITIALIZER ((pthread_cond_t) 0xFFFFFFFF) +#define _PTHREAD_COND_INITIALIZER { 0, _THREAD_QUEUE_INITIALIZER, 0 } typedef struct { int is_initialized; From 3a79700c2d994c635b2af053c8293d19f2e12bd5 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 27 Sep 2017 14:20:14 +0200 Subject: [PATCH 040/649] RTEMS: Make pthread_mutex_t self-contained Signed-off-by: Sebastian Huber --- .../sys/rtems/include/sys/_pthreadtypes.h | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h index 0b607f7f2..b091ebbaf 100644 --- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h +++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h @@ -131,9 +131,35 @@ typedef struct { #endif /* !defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) */ -typedef __uint32_t pthread_mutex_t; /* identify a mutex */ +struct _Chain_Node { + struct _Chain_Node *_next; + struct _Chain_Node *_previous; +}; -#define _PTHREAD_MUTEX_INITIALIZER ((pthread_mutex_t) 0xFFFFFFFF) +struct _RBTree_Node { + struct _RBTree_Node *_left; + struct _RBTree_Node *_right; + struct _RBTree_Node *_parent; + int _color; +}; + +struct _Priority_Node { + union { + struct _RBTree_Node _RBTree; + struct _Chain_Node _Chain; + } _Node; + __uint64_t _priority; +}; + +typedef struct { + unsigned long _flags; + struct _Mutex_recursive_Control _Recursive; + struct _Priority_Node _Priority_ceiling; + const struct _Scheduler_Control *_scheduler; +} pthread_mutex_t; + +#define _PTHREAD_MUTEX_INITIALIZER \ + { 0, _MUTEX_RECURSIVE_INITIALIZER, { { 0, 0, 0, 0 }, 0 }, 0 } typedef struct { int is_initialized; From 47bbe231054e84f1acaabf9610f75580b5b81fe3 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:09 -0400 Subject: [PATCH 041/649] cygwin: Remove comparisons of 'this' to 'NULL' in fhandler_dsp.cc Fix all callers. --- winsup/cygwin/fhandler_dsp.cc | 55 +++++++++++++++++++++++++---------- 1 file changed, 40 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/fhandler_dsp.cc b/winsup/cygwin/fhandler_dsp.cc index 5ae3309f8..b5c685bf8 100644 --- a/winsup/cygwin/fhandler_dsp.cc +++ b/winsup/cygwin/fhandler_dsp.cc @@ -63,7 +63,7 @@ class fhandler_dev_dsp::Audio void convert_S16LE_S16BE (unsigned char *buffer, int size_bytes); void fillFormat (WAVEFORMATEX * format, int rate, int bits, int channels); - unsigned blockSize (int rate, int bits, int channels); + static unsigned blockSize (int rate, int bits, int channels); void (fhandler_dev_dsp::Audio::*convert_) (unsigned char *buffer, int size_bytes); @@ -115,6 +115,7 @@ class fhandler_dev_dsp::Audio_out: public Audio void stop (bool immediately = false); int write (const char *pSampleData, int nBytes); void buf_info (audio_buf_info *p, int rate, int bits, int channels); + static void default_buf_info (audio_buf_info *p, int rate, int bits, int channels); void callback_sampledone (WAVEHDR *pHdr); bool parsewav (const char *&pData, int &nBytes, int rate, int bits, int channels); @@ -149,6 +150,7 @@ public: void stop (); bool read (char *pSampleData, int &nBytes); void buf_info (audio_buf_info *p, int rate, int bits, int channels); + static void default_buf_info (audio_buf_info *p, int rate, int bits, int channels); void callback_blockfull (WAVEHDR *pHdr); private: @@ -499,11 +501,11 @@ void fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p, int rate, int bits, int channels) { - p->fragstotal = MAX_BLOCKS; - if (this && dev_) + if (dev_) { /* If the device is running we use the internal values, possibly set from the wave file. */ + p->fragstotal = MAX_BLOCKS; p->fragsize = blockSize (freq_, bits_, channels_); p->fragments = Qisr2app_->query (); if (pHdr_ != NULL) @@ -514,10 +516,17 @@ fhandler_dev_dsp::Audio_out::buf_info (audio_buf_info *p, } else { + default_buf_info(p, rate, bits, channels); + } +} + +void fhandler_dev_dsp::Audio_out::default_buf_info (audio_buf_info *p, + int rate, int bits, int channels) +{ + p->fragstotal = MAX_BLOCKS; p->fragsize = blockSize (rate, bits, channels); p->fragments = MAX_BLOCKS; p->bytes = p->fragsize * p->fragments; - } } /* This is called on an interupt so use locking.. Note Qisr2app_ @@ -951,14 +960,23 @@ fhandler_dev_dsp::Audio_in::waitfordata () return true; } +void fhandler_dev_dsp::Audio_in::default_buf_info (audio_buf_info *p, + int rate, int bits, int channels) +{ + p->fragstotal = MAX_BLOCKS; + p->fragsize = blockSize (rate, bits, channels); + p->fragments = 0; + p->bytes = 0; +} + void fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p, int rate, int bits, int channels) { - p->fragstotal = MAX_BLOCKS; - p->fragsize = blockSize (rate, bits, channels); - if (this && dev_) + if (dev_) { + p->fragstotal = MAX_BLOCKS; + p->fragsize = blockSize (rate, bits, channels); p->fragments = Qisr2app_->query (); if (pHdr_ != NULL) p->bytes = pHdr_->dwBytesRecorded - bufferIndex_ @@ -968,8 +986,7 @@ fhandler_dev_dsp::Audio_in::buf_info (audio_buf_info *p, } else { - p->fragments = 0; - p->bytes = 0; + default_buf_info(p, rate, bits, channels); } } @@ -1343,9 +1360,13 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf) return -1; } audio_buf_info *p = (audio_buf_info *) buf; - audio_out_->buf_info (p, audiofreq_, audiobits_, audiochannels_); - debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d", - buf, p->fragments, p->fragsize, p->bytes); + if (audio_out_) { + audio_out_->buf_info (p, audiofreq_, audiobits_, audiochannels_); + } else { + Audio_out::default_buf_info(p, audiofreq_, audiobits_, audiochannels_); + } + debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d", + buf, p->fragments, p->fragsize, p->bytes); return 0; } @@ -1357,9 +1378,13 @@ fhandler_dev_dsp::_ioctl (unsigned int cmd, void *buf) return -1; } audio_buf_info *p = (audio_buf_info *) buf; - audio_in_->buf_info (p, audiofreq_, audiobits_, audiochannels_); - debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d", - buf, p->fragments, p->fragsize, p->bytes); + if (audio_in_) { + audio_in_->buf_info (p, audiofreq_, audiobits_, audiochannels_); + } else { + Audio_in::default_buf_info(p, audiofreq_, audiobits_, audiochannels_); + } + debug_printf ("buf=%p frags=%d fragsize=%d bytes=%d", + buf, p->fragments, p->fragsize, p->bytes); return 0; } From 504959d8fc5840d90bc8648c5570251616591732 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:10 -0400 Subject: [PATCH 042/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fds Fix all callers. --- winsup/cygwin/fhandler_process.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index bbb44fa56..97436dd1b 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -375,7 +375,7 @@ format_process_fd (void *data, char *&destbuf) { if (destbuf) cfree (destbuf); - destbuf = p->fds (fs); + destbuf = p ? p->fds (fs) : NULL; *((process_fd_t *) data)->fd_type = virt_symlink; } else diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index a504828fe..bba9ee494 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -856,7 +856,7 @@ char * _pinfo::fds (size_t &n) { char *s; - if (!this || !pid) + if (!pid) return NULL; if (pid != myself->pid) { From be436ad2a31ac3b00dabc0d39119e5fa130a2dd6 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:11 -0400 Subject: [PATCH 043/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::root Fix all callers. --- winsup/cygwin/fhandler_process.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 97436dd1b..08cc7ea92 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -478,7 +478,7 @@ format_process_root (void *data, char *&destbuf) cfree (destbuf); destbuf = NULL; } - destbuf = p->root (fs); + destbuf = p ? p->root (fs) : NULL; if (!destbuf || !*destbuf) { destbuf = cstrdup (""); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index bba9ee494..9fe1b3a88 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -884,7 +884,7 @@ char * _pinfo::root (size_t& n) { char *s; - if (!this || !pid) + if (!pid) return NULL; if (pid != myself->pid && !ISSTATE (this, PID_NOTCYGWIN)) { From 571b7689bb690148b9747a125ff2db1d5accb561 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:12 -0400 Subject: [PATCH 044/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cwd Fix all callers. --- winsup/cygwin/fhandler_process.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 08cc7ea92..453e79b16 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -498,7 +498,7 @@ format_process_cwd (void *data, char *&destbuf) cfree (destbuf); destbuf = NULL; } - destbuf = p->cwd (fs); + destbuf = p ? p->cwd (fs) : NULL; if (!destbuf || !*destbuf) { destbuf = cstrdup (""); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 9fe1b3a88..c28158168 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -930,7 +930,7 @@ char * _pinfo::cwd (size_t& n) { char *s = NULL; - if (!this || !pid) + if (!pid) return NULL; if (ISSTATE (this, PID_NOTCYGWIN)) { From 911f7d628d06b15c79524020eed2d4fc8f2eb1ae Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:13 -0400 Subject: [PATCH 045/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::cmdline Fix all callers. --- winsup/cygwin/external.cc | 2 +- winsup/cygwin/fhandler_process.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index c81bdc0fa..6aae32aea 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -339,7 +339,7 @@ cygwin_internal (cygwin_getinfo_types t, ...) size_t n; pid_t pid = va_arg (arg, pid_t); pinfo p (pid); - res = (uintptr_t) p->cmdline (n); + res = (uintptr_t) (p ? p->cmdline (n) : NULL); } break; case CW_CHECK_NTSEC: diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 453e79b16..7f122fbe4 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -518,7 +518,7 @@ format_process_cmdline (void *data, char *&destbuf) cfree (destbuf); destbuf = NULL; } - destbuf = p->cmdline (fs); + destbuf = p ? p->cmdline (fs) : NULL; if (!destbuf || !*destbuf) { destbuf = cstrdup (""); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index c28158168..e792a0a1c 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -976,7 +976,7 @@ char * _pinfo::cmdline (size_t& n) { char *s = NULL; - if (!this || !pid) + if (!pid) return NULL; if (ISSTATE (this, PID_NOTCYGWIN)) { From d1ea8f4a467af21737f29b225b72549d1346a7e2 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:14 -0400 Subject: [PATCH 046/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::commune_request Fix all callers. --- winsup/cygwin/pinfo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index e792a0a1c..a068bcc42 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -720,7 +720,7 @@ _pinfo::commune_request (__uint32_t code, ...) res.s = NULL; res.n = 0; - if (!this || !pid) + if (!pid) { set_errno (ESRCH); goto err; From 56f23a510703b399bdf9268b0a6230470531ab8c Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:15 -0400 Subject: [PATCH 047/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::pipe_fhandler Fix all callers. --- winsup/cygwin/pinfo.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index a068bcc42..72aa658eb 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -819,7 +819,7 @@ out: fhandler_pipe * _pinfo::pipe_fhandler (int64_t unique_id, size_t &n) { - if (!this || !pid) + if (!pid) return NULL; if (pid == myself->pid) return NULL; From 6cd1978fc81a2046fa0b27ff63b015f31d49ec77 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:16 -0400 Subject: [PATCH 048/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::fd Fix all callers. --- winsup/cygwin/fhandler_process.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 7f122fbe4..360d8ea81 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -391,7 +391,7 @@ format_process_fd (void *data, char *&destbuf) set_errno (ENOENT); return 0; } - destbuf = p->fd (fd, fs); + destbuf = p ? p->fd (fd, fs) : NULL; if (!destbuf || !*destbuf) { set_errno (ENOENT); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 72aa658eb..044c4fc3c 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -832,7 +832,7 @@ char * _pinfo::fd (int fd, size_t &n) { char *s; - if (!this || !pid) + if (!pid) return NULL; if (pid != myself->pid) { From d17c45f200c3b68fe1c99e413b0444366bfd9290 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:17 -0400 Subject: [PATCH 049/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::environ Fix all callers. --- winsup/cygwin/fhandler_process.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index 360d8ea81..eb5a523ff 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -583,7 +583,7 @@ format_process_environ (void *data, char *&destbuf) cfree (destbuf); destbuf = NULL; } - destbuf = p->environ (fs); + destbuf = p ? p->environ (fs) : NULL; if (!destbuf || !*destbuf) { destbuf = cstrdup (""); diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 044c4fc3c..7193f6884 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -1036,7 +1036,7 @@ char * _pinfo::environ (size_t& n) { char **env = NULL; - if (!this || !pid) + if (!pid) return NULL; if (ISSTATE (this, PID_NOTCYGWIN)) { From 5952d5f08f3200e7b7f65ef8568bfef9b4707940 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:18 -0400 Subject: [PATCH 050/649] cygwin: Remove comparison of 'this' to 'NULL' in _pinfo::kill Fix all callers. --- winsup/cygwin/signal.cc | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index fbd2b241e..016fce1de 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -260,7 +260,7 @@ _pinfo::kill (siginfo_t& si) } this_pid = pid; } - else if (this && process_state == PID_EXITED) + else if (process_state == PID_EXITED) { this_process_state = process_state; this_pid = pid; @@ -296,8 +296,17 @@ kill0 (pid_t pid, siginfo_t& si) syscall_printf ("signal %d out of range", si.si_signo); return -1; } - - return (pid > 0) ? pinfo (pid)->kill (si) : kill_pgrp (-pid, si); + if (pid > 0) + { + pinfo p (pid); + if (!p) + { + set_errno (ESRCH); + return -1; + } + return p->kill (si); + } + return kill_pgrp (-pid, si); } int From 7212b571a5b8ba855c47e16db8cde829a1340a76 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:19 -0400 Subject: [PATCH 051/649] cygwin: Remove comparison of 'this' to NULL in _pinfo::exists Fix all callers. --- winsup/cygwin/fhandler_termios.cc | 2 +- winsup/cygwin/pinfo.cc | 2 +- winsup/cygwin/signal.cc | 2 +- winsup/cygwin/sigproc.cc | 5 +++-- winsup/cygwin/times.cc | 10 +++++++--- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc index 19fcfc9cd..4ce53433a 100644 --- a/winsup/cygwin/fhandler_termios.cc +++ b/winsup/cygwin/fhandler_termios.cc @@ -131,7 +131,7 @@ tty_min::kill_pgrp (int sig) for (unsigned i = 0; i < pids.npids; i++) { _pinfo *p = pids[i]; - if (!p->exists () || p->ctty != ntty || p->pgid != pgid) + if (!p || !p->exists () || p->ctty != ntty || p->pgid != pgid) continue; if (p == myself) killself = sig != __SIGSETPGRP && !exit_state; diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc index 7193f6884..e4eef8b3c 100644 --- a/winsup/cygwin/pinfo.cc +++ b/winsup/cygwin/pinfo.cc @@ -529,7 +529,7 @@ _pinfo::set_ctty (fhandler_termios *fh, int flags) bool __reg1 _pinfo::exists () { - return this && process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED)); + return process_state && !(process_state & (PID_EXITED | PID_REAPED | PID_EXECED)); } bool diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 016fce1de..69c5e2aad 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -332,7 +332,7 @@ kill_pgrp (pid_t pid, siginfo_t& si) { _pinfo *p = pids[i]; - if (!p->exists ()) + if (!p || !p->exists ()) continue; /* Is it a process we want to kill? */ diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc index 36fc64903..92fa5ea3d 100644 --- a/winsup/cygwin/sigproc.cc +++ b/winsup/cygwin/sigproc.cc @@ -152,7 +152,8 @@ proc_can_be_signalled (_pinfo *p) bool __reg1 pid_exists (pid_t pid) { - return pinfo (pid)->exists (); + pinfo p (pid); + return p && p->exists (); } /* Return true if this is one of our children, false otherwise. */ @@ -1135,7 +1136,7 @@ remove_proc (int ci) if (_my_tls._ctinfo != procs[ci].wait_thread) procs[ci].wait_thread->terminate_thread (); } - else if (procs[ci]->exists ()) + else if (procs[ci] && procs[ci]->exists ()) return true; sigproc_printf ("removing procs[%d], pid %d, nprocs %d", ci, procs[ci]->pid, diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index fb480513f..5da0bbc7a 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -522,7 +522,7 @@ clock_gettime (clockid_t clk_id, struct timespec *tp) pid = getpid (); pinfo p (pid); - if (!p->exists ()) + if (!p || !p->exists ()) { set_errno (EINVAL); return -1; @@ -746,8 +746,12 @@ clock_setres (clockid_t clk_id, struct timespec *tp) extern "C" int clock_getcpuclockid (pid_t pid, clockid_t *clk_id) { - if (pid != 0 && !pinfo (pid)->exists ()) - return (ESRCH); + if (pid != 0) + { + pinfo p (pid); + if (!p || !p->exists ()) + return (ESRCH); + } *clk_id = (clockid_t) PID_TO_CLOCKID (pid); return 0; } From 51c6ef6b82bc39817a6f5b95a6a9a372ea8fbe95 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Sat, 16 Sep 2017 22:04:20 -0400 Subject: [PATCH 052/649] cygwin: Remove workaround for GCC 6 null pointer check warnings --- winsup/cygwin/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 98727c019..add1de0e9 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -73,7 +73,7 @@ CRT0:=$(cygwin_build)/crt0.o # MT_SAFE:=@MT_SAFE@ CCEXTRA= -COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fno-delete-null-pointer-checks -fmerge-constants -ftracer $(CCEXTRA) +COMMON_CFLAGS=-MMD ${$(*F)_CFLAGS} -Werror -fmerge-constants -ftracer $(CCEXTRA) ifeq ($(target_cpu),x86_64) COMMON_CFLAGS+=-mcmodel=small endif From e7eb9788812f43c776f9761e6e4bc9ee75cdea7b Mon Sep 17 00:00:00 2001 From: Alexander Fedotov Date: Fri, 29 Sep 2017 22:10:47 +0300 Subject: [PATCH 053/649] adjust libnosys config for aarch64 to avoid linker error when switching from rdimon.specs to nosys.specs --- libgloss/libnosys/configure | 2 ++ libgloss/libnosys/configure.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libgloss/libnosys/configure b/libgloss/libnosys/configure index fbe7db764..046dca5d3 100755 --- a/libgloss/libnosys/configure +++ b/libgloss/libnosys/configure @@ -2009,6 +2009,8 @@ case "${target}" in ;; a29k-amd-udi) ;; + aarch64*-*-*) + ;; arc-*-*) ;; arm*-*-*) diff --git a/libgloss/libnosys/configure.in b/libgloss/libnosys/configure.in index 1d4846b17..d3d8c89f6 100644 --- a/libgloss/libnosys/configure.in +++ b/libgloss/libnosys/configure.in @@ -43,6 +43,8 @@ case "${target}" in ;; a29k-amd-udi) ;; + aarch64*-*-*) + ;; arc-*-*) ;; arm*-*-*) From 15de9da0b962c4108ea300e5189d6810902bdd94 Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Tue, 26 Sep 2017 10:38:12 +0200 Subject: [PATCH 054/649] Fix typo with newlib-long-time_t default value. Fix typo for newlib-long-time_t to leave newlib-nano-malloc alone. --- newlib/configure | 2 +- newlib/configure.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/configure b/newlib/configure index eb4b3b275..9613214eb 100755 --- a/newlib/configure +++ b/newlib/configure @@ -2513,7 +2513,7 @@ if test "${enable_newlib_long_time_t+set}" = set; then : esac fi else - newlib_nano_malloc= + newlib_long_time_t=no fi diff --git a/newlib/configure.in b/newlib/configure.in index 9d304817d..adce036bf 100644 --- a/newlib/configure.in +++ b/newlib/configure.in @@ -247,7 +247,7 @@ AC_ARG_ENABLE(newlib-long-time_t, no) newlib_long_time_t=no ;; *) AC_MSG_ERROR(bad value ${enableval} for newlib-long-time_t option) ;; esac - fi], [newlib_nano_malloc=])dnl + fi], [newlib_long_time_t=no])dnl NEWLIB_CONFIGURE(.) From 7346a162f2956c53f36a0cabf969e7b8186d81b0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 9 Oct 2017 18:08:10 +0200 Subject: [PATCH 055/649] cygwin: disable -Wframe-address warning only on GCC 6 or later This is required as long as we don't have a GCC 6.x cross compiler on Linux. Signed-off-by: Corinna Vinschen --- winsup/cygwin/crt0.c | 4 ++++ winsup/cygwin/init.cc | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/crt0.c b/winsup/cygwin/crt0.c index 271f5b911..fee4b2e24 100644 --- a/winsup/cygwin/crt0.c +++ b/winsup/cygwin/crt0.c @@ -20,9 +20,13 @@ void mainCRTStartup () { #ifdef __i386__ +#if __GNUC_PREREQ(6,0) #pragma GCC diagnostic ignored "-Wframe-address" +#endif (void)__builtin_return_address(1); +#if __GNUC_PREREQ(6,0) #pragma GCC diagnostic pop +#endif asm volatile ("andl $-16,%%esp" ::: "%esp"); #endif diff --git a/winsup/cygwin/init.cc b/winsup/cygwin/init.cc index 2d4299e5b..aeeeac772 100644 --- a/winsup/cygwin/init.cc +++ b/winsup/cygwin/init.cc @@ -22,10 +22,14 @@ static bool dll_finished_loading; static void WINAPI threadfunc_fe (VOID *arg) { -#ifndef __x86_64__ +#ifdef __i386__ +#if __GNUC_PREREQ(6,0) #pragma GCC diagnostic ignored "-Wframe-address" +#endif (void)__builtin_return_address(1); +#if __GNUC_PREREQ(6,0) #pragma GCC diagnostic pop +#endif asm volatile ("andl $-16,%%esp" ::: "%esp"); #endif _cygtls::call ((DWORD (*) (void *, void *)) TlsGetValue (_my_oldfunc), arg); From 4bee8c48dfb1c53669dcc94dbe0e13e13af298ac Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Mon, 9 Oct 2017 17:37:40 +0200 Subject: [PATCH 056/649] cygwin: initialize variable for stack unwinding The third argument of RtlLookupFunctionEntry actually is documented as _Inout_opt_ for both x64 and ARM, although generic doc says _Out_ only. * exceptions.cc (__unwind_single_frame): Initialize hist variable. --- winsup/cygwin/exceptions.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 743c73200..a3ee5cf71 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -280,7 +280,7 @@ __unwind_single_frame (PCONTEXT ctx) { PRUNTIME_FUNCTION f; ULONG64 imagebase; - UNWIND_HISTORY_TABLE hist; + UNWIND_HISTORY_TABLE hist = {0}; DWORD64 establisher; PVOID hdl; From 111b6813fb967a4bae51dc43d574c0c28d4dea6c Mon Sep 17 00:00:00 2001 From: Tamar Christina Date: Tue, 26 Sep 2017 14:47:04 +0100 Subject: [PATCH 057/649] Fix multido compilation on ARM The previous multi-build implementation was copying the config.status from the parent multilib directory when building the different semihosting variants. It did so because the configuration doesn't change. However when you use a relative path to configure it turns out that the paths inside the config.status are also relative. To fix this, the srcdir is adjusted from the initial configuration instead of copying it. Tested on aarch64-none-elf and arm-none-eabi. Signed-off-by: Tamar Christina --- libgloss/multi-build.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libgloss/multi-build.in b/libgloss/multi-build.in index 1403eb35e..52aeeec26 100644 --- a/libgloss/multi-build.in +++ b/libgloss/multi-build.in @@ -17,9 +17,9 @@ multi-do: destpre=`echo $${rootpre}/$${dir}`/; export destpre; \ if ! test -d $${destpre} ; then \ mkdir -p $${destpre}; \ - cp config.status $${destpre}; \ cd $${destpre}; \ - $(SHELL) config.status; \ + config_cmd=`../config.status --config | sed -re "s:--srcdir=([^/]):--srcdir=../\1:"`; \ + $(SHELL) -c "$(SHELL) $${srcrootpre}/configure $${config_cmd}";\ sed -e "s:^MULTIDIRS[[:space:]]*+=.*$$:MULTIDIRS = :" \ -e "s:^MULTILIBNAME[[:space:]]*=.*$$:MULTILIBNAME = MULTIDIR_$${dir}_NAME:" \ -e "s:^MULTI_FLAGS_FOR_TARGET[[:space:]]*=.*$$:MULTI_FLAGS_FOR_TARGET = MULTIDIR_$${dir}_FLAGS:" \ From 44499712954d7450262da9db4ee4219e40b1aaac Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Mon, 9 Oct 2017 18:57:58 +0200 Subject: [PATCH 058/649] cygwin: fix potential buffer overflow in small_sprintf With "%C" format string, argument may convert in up to MB_LEN_MAX bytes. Relying on sys_wcstombs to add a trailing zero here requires us to provide a large enough buffer. * smallprint.c (__small_vsprintf): Use MB_LEN_MAX+1 bufsize for "%C". --- winsup/cygwin/smallprint.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 3cec31cce..8553f7002 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -193,8 +193,8 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) case 'C': { WCHAR wc = (WCHAR) va_arg (ap, int); - char buf[4], *c; - sys_wcstombs (buf, 4, &wc, 1); + char buf[MB_LEN_MAX+1] = "", *c; + sys_wcstombs (buf, MB_LEN_MAX+1, &wc, 1); for (c = buf; *c; ++c) *dst++ = *c; } From 1adbd77cab6f60b105c5d8b1a4350161c3ac213d Mon Sep 17 00:00:00 2001 From: Michael Haubenwallner Date: Mon, 9 Oct 2017 18:58:24 +0200 Subject: [PATCH 059/649] cygwin: fix potential buffer overflow in fork When fork fails, we can use "%s" now with system_sprintf for the errmsg rather than a (potentially too small) buffer for the format string. * fork.cc (fork): Use "%s" with system_printf now. --- winsup/cygwin/fork.cc | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index 73a72f530..bcbef12d8 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -618,13 +618,8 @@ fork () if (!grouped.errmsg) syscall_printf ("fork failed - child pid %d, errno %d", grouped.child_pid, grouped.this_errno); else - { - char buf[strlen (grouped.errmsg) + sizeof ("child %d - , errno 4294967295 ")]; - strcpy (buf, "child %d - "); - strcat (buf, grouped.errmsg); - strcat (buf, ", errno %d"); - system_printf (buf, grouped.child_pid, grouped.this_errno); - } + system_printf ("child %d - %s, errno %d", grouped.child_pid, + grouped.errmsg, grouped.this_errno); set_errno (grouped.this_errno); } From 0b45b053e833d2e87dd71a4a5198fd8158d53a1d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 26 Sep 2017 20:36:34 -0500 Subject: [PATCH 060/649] Feature test macros overhaul: Cygwin netdb.h herror etc. are MISC, rcmd etc. are BSD, addrinfo functions are POSIX.1-2001, except for IDN functionality which is GNU. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/netdb.h | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h index 968847b8f..e46e34169 100644 --- a/winsup/cygwin/include/netdb.h +++ b/winsup/cygwin/include/netdb.h @@ -117,7 +117,7 @@ struct rpcent { int r_number; /* rpc program number */ }; -#ifndef __INSIDE_CYGWIN_NET__ +#if __POSIX_VISIBLE >= 200112 && !defined(__INSIDE_CYGWIN_NET__) struct addrinfo { int ai_flags; /* input flags */ int ai_family; /* address family of socket */ @@ -135,6 +135,8 @@ struct addrinfo { * (left in extern int h_errno). */ +#if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 + #ifdef __INSIDE_CYGWIN_NET__ extern int h_errno; #else @@ -152,6 +154,10 @@ extern __declspec(dllimport) int h_errno; #define NO_DATA 4 /* Valid name, no data record of requested type */ #define NO_ADDRESS NO_DATA /* no address, look for MX record */ +#endif /* __MISC_VISIBLE || __POSIX_VISIBLE < 200809 */ + +#if __POSIX_VISIBLE >= 200112 + /* Flag values for getaddrinfo function. */ #define AI_PASSIVE 0x1 /* Intend socket address for bind. */ #define AI_CANONNAME 0x2 /* Return canonical node name. */ @@ -161,6 +167,7 @@ extern __declspec(dllimport) int h_errno; #define AI_ADDRCONFIG 0x400 /* Only return address types available on this host. */ #define AI_V4MAPPED 0x800 /* IPv4 mapped addresses are acceptable. */ +#ifdef __GNU_VISIBLE /* Glibc extensions. We use numerical values taken by winsock-specific extensions. */ #define AI_IDN 0x4000 /* Encode IDN input from current local to @@ -171,6 +178,7 @@ extern __declspec(dllimport) int h_errno; input string. */ #define AI_IDN_USE_STD3_ASCII_RULES 0x20000 /* Filter ASCII chars according to STD3 rules. */ +#endif /* __GNU_VISIBLE */ /* Flag values for getnameinfo function. */ #define NI_NOFQDN 0x1 /* Don't lookup hostname. */ @@ -178,6 +186,7 @@ extern __declspec(dllimport) int h_errno; #define NI_NAMEREQD 0x4 /* Not being able to resolve is an error. */ #define NI_NUMERICSERV 0x8 /* Return port number, rather than name. */ #define NI_DGRAM 0x10 /* Lookup datagram (UDP) service. */ +#ifdef __GNU_VISIBLE /* Glibc extensions. We use numerical values taken by winsock-specific extensions. */ #define NI_IDN 0x4000 /* Decode name from punycode to IDN in @@ -186,6 +195,7 @@ extern __declspec(dllimport) int h_errno; output string. */ #define NI_IDN_USE_STD3_ASCII_RULES 0x20000 /* Filter ASCII chars according to STD3 rules. */ +#endif /* __GNU_VISIBLE */ #define NI_MAXHOST 1025 /* Best effort maximum hostname length. */ #define NI_MAXSERV 32 /* Best effort maximum service name length. */ @@ -205,8 +215,12 @@ extern __declspec(dllimport) int h_errno; #define EAI_BADHINTS 12 /* Invalid value for hints */ #define EAI_PROTOCOL 13 /* Resolved protocol is unknown */ #define EAI_OVERFLOW 14 /* An argument buffer overflowed */ +#ifdef __GNU_VISIBLE /* Glibc extensions. */ #define EAI_IDN_ENCODE 15 /* Parameter string not correctly encoded */ +#endif + +#endif /* __POSIX_VISIBLE >= 200112 */ #ifndef __INSIDE_CYGWIN_NET__ void endhostent (void); @@ -216,7 +230,9 @@ void endservent (void); void endrpcent (void); struct hostent *gethostbyaddr (const char *, int, int); struct hostent *gethostbyname (const char *); +#if __MISC_VISIBLE struct hostent *gethostbyname2 (const char *, int); +#endif struct hostent *gethostent (void); struct netent *getnetbyaddr (uint32_t, int); struct netent *getnetbyname (const char *); @@ -230,20 +246,25 @@ struct servent *getservent (void); struct rpcent *getrpcent (void); struct rpcent *getrpcbyname (const char *); struct rpcent *getrpcbynumber (int); +#if __MISC_VISIBLE const char *hstrerror (int); void herror (const char *); +#endif void sethostent (int); void setnetent (int); void setprotoent (int); void setservent (int); void setrpcent (int); +#if __POSIX_VISIBLE >= 200112 void freeaddrinfo (struct addrinfo *); const char *gai_strerror (int); int getaddrinfo (const char *, const char *, const struct addrinfo *, struct addrinfo **); int getnameinfo (const struct sockaddr *, socklen_t, char *, socklen_t, char *, socklen_t, int); +#endif +#if __BSD_VISIBLE int rcmd (char **, uint16_t, const char *, const char *, const char *, int *); int rcmd_af (char **, uint16_t, const char *, const char *, @@ -255,7 +276,8 @@ int iruserok (unsigned long, int, const char *, const char *); int iruserok_sa (const void *, int, int, const char *, const char *); int ruserok (const char *, int, const char *, const char *); -#endif +#endif /* __BSD_VISIBLE */ +#endif /* !__INSIDE_CYGWIN_NET__ */ #ifdef __cplusplus }; From 747f31854a572b3dd64912997dde2dc984b1f2d8 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 26 Sep 2017 20:36:35 -0500 Subject: [PATCH 061/649] cygwin: fix gethostbyaddr argument types The first argument of gethostbyaddr needs to accept a generic pointer to be compatible with e.g. struct in_addr *. This caused an issue compiling krb5-1.15. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/netdb.h | 2 +- winsup/cygwin/net.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/include/netdb.h b/winsup/cygwin/include/netdb.h index e46e34169..91e91720d 100644 --- a/winsup/cygwin/include/netdb.h +++ b/winsup/cygwin/include/netdb.h @@ -228,7 +228,7 @@ void endnetent (void); void endprotoent (void); void endservent (void); void endrpcent (void); -struct hostent *gethostbyaddr (const char *, int, int); +struct hostent *gethostbyaddr (const void *, socklen_t, int); struct hostent *gethostbyname (const char *); #if __MISC_VISIBLE struct hostent *gethostbyname2 (const char *, int); diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index fd903b112..8969e7c6f 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -1152,13 +1152,13 @@ cygwin_gethostbyname (const char *name) /* exported as gethostbyaddr: standards? */ extern "C" struct hostent * -cygwin_gethostbyaddr (const char *addr, int len, int type) +cygwin_gethostbyaddr (const void *addr, socklen_t len, int type) { hostent *res = NULL; __try { - res = dup_ent (gethostbyaddr (addr, len, type)); + res = dup_ent (gethostbyaddr ((const char *) addr, len, type)); if (res) debug_printf ("h_name %s", res->h_name); else From c165a27c0147471977377acd8918ab3b446f947a Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 13 Oct 2017 08:06:19 +0200 Subject: [PATCH 062/649] RTEMS: Fix _PTHREAD_MUTEX_INITIALIZER Add missing braces around initializer. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/_pthreadtypes.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h index b091ebbaf..34e22221f 100644 --- a/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h +++ b/newlib/libc/sys/rtems/include/sys/_pthreadtypes.h @@ -159,7 +159,7 @@ typedef struct { } pthread_mutex_t; #define _PTHREAD_MUTEX_INITIALIZER \ - { 0, _MUTEX_RECURSIVE_INITIALIZER, { { 0, 0, 0, 0 }, 0 }, 0 } + { 0, _MUTEX_RECURSIVE_INITIALIZER, { { { 0, 0, 0, 0 } }, 0 }, 0 } typedef struct { int is_initialized; From c1560982710bed1065f9313d6548a8193030bcb9 Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Thu, 25 May 2017 16:41:38 +0100 Subject: [PATCH 063/649] New expf, exp2f, logf, log2f and powf implementations Based on code from https://github.com/ARM-software/optimized-routines/ This patch adds a highly optimized generic implementation of expf, exp2f, logf, log2f and powf. The new functions are not only faster (6x for powf!), but are also smaller and more accurate. In order to achieve this, the algorithm uses double precision arithmetic for accuracy, avoids divisions and uses small table lookups to minimize the polynomials. Special cases are handled inline to avoid the unnecessary overhead of wrapper functions and set errno to POSIX requirements. The new functions are added under newlib/libm/common, but the old implementations are kept (in newlib/libm/math) for non-IEEE or pre-C99 systems. Targets can enable the new math code by defining __OBSOLETE_MATH_DEFAULT to 0 in newlib/libc/include/machine/ieeefp.h, users can override the default by defining __OBSOLETE_MATH. Currently the new code is enabled for AArch64 and AArch32 with VFP. Targets with a single precision FPU may still prefer the old implementation. libm.a size changes: arm: -1692 arm/thumb/v7-a/nofp: -878 arm/thumb/v7-a+fp/hard: -864 arm/thumb/v7-a+fp/softfp: -908 aarch64: -1476 --- newlib/libc/include/machine/ieeefp.h | 27 +++ newlib/libm/common/Makefile.am | 7 +- newlib/libm/common/Makefile.in | 148 ++++++++++++----- newlib/libm/common/math_config.h | 179 ++++++++++++++++++++ newlib/libm/common/math_errf.c | 89 ++++++++++ newlib/libm/common/sf_exp.c | 113 +++++++++++++ newlib/libm/common/sf_exp2.c | 99 +++++++++++ newlib/libm/common/sf_exp2_data.c | 56 +++++++ newlib/libm/common/sf_log.c | 98 +++++++++++ newlib/libm/common/sf_log2.c | 127 +++++++++----- newlib/libm/common/sf_log2_data.c | 56 +++++++ newlib/libm/common/sf_log_data.c | 56 +++++++ newlib/libm/common/sf_pow.c | 230 ++++++++++++++++++++++++++ newlib/libm/common/sf_pow_log2_data.c | 57 +++++++ newlib/libm/math/Makefile.am | 3 +- newlib/libm/math/Makefile.in | 14 +- newlib/libm/math/ef_exp.c | 2 + newlib/libm/math/ef_log.c | 2 + newlib/libm/math/ef_pow.c | 2 + newlib/libm/math/wf_exp.c | 2 + newlib/libm/math/wf_exp2.c | 2 + newlib/libm/math/wf_log.c | 2 + newlib/libm/math/wf_log2.c | 50 ++++++ newlib/libm/math/wf_pow.c | 2 + 24 files changed, 1337 insertions(+), 86 deletions(-) create mode 100644 newlib/libm/common/math_config.h create mode 100644 newlib/libm/common/math_errf.c create mode 100644 newlib/libm/common/sf_exp.c create mode 100644 newlib/libm/common/sf_exp2.c create mode 100644 newlib/libm/common/sf_exp2_data.c create mode 100644 newlib/libm/common/sf_log.c create mode 100644 newlib/libm/common/sf_log2_data.c create mode 100644 newlib/libm/common/sf_log_data.c create mode 100644 newlib/libm/common/sf_pow.c create mode 100644 newlib/libm/common/sf_pow_log2_data.c create mode 100644 newlib/libm/math/wf_log2.c diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h index 29c08fa43..b1b44665e 100644 --- a/newlib/libc/include/machine/ieeefp.h +++ b/newlib/libc/include/machine/ieeefp.h @@ -48,6 +48,23 @@ This represents what type a float arg is passed as. It is used when the type is not promoted to double. + + __OBSOLETE_MATH_DEFAULT + + Default value for __OBSOLETE_MATH if that's not set by the user. + It should be set here based on predefined feature macros. + + __OBSOLETE_MATH + + If set to 1 then some new math code will be disabled and older libm + code will be used instead. This is necessary because the new math + code does not support all targets, it assumes that the toolchain has + ISO C99 support (hexfloat literals, standard fenv semantics), the + target has IEEE-754 conforming binary32 float and binary64 double + (not mixed endian) representation, standard SNaN representation, + double and single precision arithmetics has similar latency and it + has no legacy SVID matherr support, only POSIX errno and fenv + exception based error handling. */ #if (defined(__arm__) || defined(__thumb__)) && !defined(__MAVERICK__) @@ -61,6 +78,7 @@ # else # define __IEEE_BIG_ENDIAN # endif +# define __OBSOLETE_MATH_DEFAULT 0 #else # define __IEEE_BIG_ENDIAN # ifdef __ARMEL__ @@ -75,6 +93,7 @@ #else #define __IEEE_BIG_ENDIAN #endif +#define __OBSOLETE_MATH_DEFAULT 0 #endif #ifdef __epiphany__ @@ -427,6 +446,14 @@ #define __IEEE_BIG_ENDIAN #endif +#ifndef __OBSOLETE_MATH_DEFAULT +/* Use old math code by default. */ +#define __OBSOLETE_MATH_DEFAULT 1 +#endif +#ifndef __OBSOLETE_MATH +#define __OBSOLETE_MATH __OBSOLETE_MATH_DEFAULT +#endif + #ifndef __IEEE_BIG_ENDIAN #ifndef __IEEE_LITTLE_ENDIAN #error Endianess not declared!! diff --git a/newlib/libm/common/Makefile.am b/newlib/libm/common/Makefile.am index 1268e17db..3e2620c7e 100644 --- a/newlib/libm/common/Makefile.am +++ b/newlib/libm/common/Makefile.am @@ -18,11 +18,14 @@ fsrc = sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c \ sf_cbrt.c sf_exp10.c sf_expm1.c sf_ilogb.c \ sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c \ sf_log1p.c sf_nan.c sf_nextafter.c sf_pow10.c \ - sf_rint.c sf_logb.c sf_log2.c \ + sf_rint.c sf_logb.c \ sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_fpclassify.c \ sf_lrint.c sf_llrint.c \ sf_lround.c sf_llround.c sf_nearbyint.c sf_remquo.c sf_round.c \ - sf_scalbln.c sf_trunc.c + sf_scalbln.c sf_trunc.c \ + sf_exp.c sf_exp2.c sf_exp2_data.c sf_log.c sf_log_data.c \ + sf_log2.c sf_log2_data.c sf_pow_log2_data.c sf_pow.c \ + math_errf.c lsrc = atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.c \ floorl.c log1pl.c expm1l.c acosl.c asinl.c atan2l.c coshl.c sinhl.c \ diff --git a/newlib/libm/common/Makefile.in b/newlib/libm/common/Makefile.in index 9b367653d..c603be361 100644 --- a/newlib/libm/common/Makefile.in +++ b/newlib/libm/common/Makefile.in @@ -78,21 +78,21 @@ am__objects_1 = lib_a-s_finite.$(OBJEXT) lib_a-s_copysign.$(OBJEXT) \ lib_a-s_modf.$(OBJEXT) lib_a-s_scalbn.$(OBJEXT) \ lib_a-s_cbrt.$(OBJEXT) lib_a-s_exp10.$(OBJEXT) \ lib_a-s_expm1.$(OBJEXT) lib_a-s_ilogb.$(OBJEXT) \ - lib_a-s_infinity.$(OBJEXT) \ - lib_a-s_isinf.$(OBJEXT) lib_a-s_isinfd.$(OBJEXT) \ - lib_a-s_isnan.$(OBJEXT) lib_a-s_isnand.$(OBJEXT) \ - lib_a-s_log1p.$(OBJEXT) lib_a-s_nan.$(OBJEXT) \ - lib_a-s_nextafter.$(OBJEXT) lib_a-s_pow10.$(OBJEXT) \ - lib_a-s_rint.$(OBJEXT) lib_a-s_logb.$(OBJEXT) \ - lib_a-s_log2.$(OBJEXT) lib_a-s_matherr.$(OBJEXT) \ - lib_a-s_lib_ver.$(OBJEXT) lib_a-s_fdim.$(OBJEXT) \ - lib_a-s_fma.$(OBJEXT) lib_a-s_fmax.$(OBJEXT) \ - lib_a-s_fmin.$(OBJEXT) lib_a-s_fpclassify.$(OBJEXT) \ - lib_a-s_lrint.$(OBJEXT) lib_a-s_llrint.$(OBJEXT) \ - lib_a-s_lround.$(OBJEXT) lib_a-s_llround.$(OBJEXT) \ - lib_a-s_nearbyint.$(OBJEXT) lib_a-s_remquo.$(OBJEXT) \ - lib_a-s_round.$(OBJEXT) lib_a-s_scalbln.$(OBJEXT) \ - lib_a-s_signbit.$(OBJEXT) lib_a-s_trunc.$(OBJEXT) + lib_a-s_infinity.$(OBJEXT) lib_a-s_isinf.$(OBJEXT) \ + lib_a-s_isinfd.$(OBJEXT) lib_a-s_isnan.$(OBJEXT) \ + lib_a-s_isnand.$(OBJEXT) lib_a-s_log1p.$(OBJEXT) \ + lib_a-s_nan.$(OBJEXT) lib_a-s_nextafter.$(OBJEXT) \ + lib_a-s_pow10.$(OBJEXT) lib_a-s_rint.$(OBJEXT) \ + lib_a-s_logb.$(OBJEXT) lib_a-s_log2.$(OBJEXT) \ + lib_a-s_matherr.$(OBJEXT) lib_a-s_lib_ver.$(OBJEXT) \ + lib_a-s_fdim.$(OBJEXT) lib_a-s_fma.$(OBJEXT) \ + lib_a-s_fmax.$(OBJEXT) lib_a-s_fmin.$(OBJEXT) \ + lib_a-s_fpclassify.$(OBJEXT) lib_a-s_lrint.$(OBJEXT) \ + lib_a-s_llrint.$(OBJEXT) lib_a-s_lround.$(OBJEXT) \ + lib_a-s_llround.$(OBJEXT) lib_a-s_nearbyint.$(OBJEXT) \ + lib_a-s_remquo.$(OBJEXT) lib_a-s_round.$(OBJEXT) \ + lib_a-s_scalbln.$(OBJEXT) lib_a-s_signbit.$(OBJEXT) \ + lib_a-s_trunc.$(OBJEXT) am__objects_2 = lib_a-sf_finite.$(OBJEXT) lib_a-sf_copysign.$(OBJEXT) \ lib_a-sf_modf.$(OBJEXT) lib_a-sf_scalbn.$(OBJEXT) \ lib_a-sf_cbrt.$(OBJEXT) lib_a-sf_exp10.$(OBJEXT) \ @@ -102,14 +102,19 @@ am__objects_2 = lib_a-sf_finite.$(OBJEXT) lib_a-sf_copysign.$(OBJEXT) \ lib_a-sf_isnanf.$(OBJEXT) lib_a-sf_log1p.$(OBJEXT) \ lib_a-sf_nan.$(OBJEXT) lib_a-sf_nextafter.$(OBJEXT) \ lib_a-sf_pow10.$(OBJEXT) lib_a-sf_rint.$(OBJEXT) \ - lib_a-sf_logb.$(OBJEXT) lib_a-sf_log2.$(OBJEXT) \ - lib_a-sf_fdim.$(OBJEXT) lib_a-sf_fma.$(OBJEXT) \ - lib_a-sf_fmax.$(OBJEXT) lib_a-sf_fmin.$(OBJEXT) \ - lib_a-sf_fpclassify.$(OBJEXT) lib_a-sf_lrint.$(OBJEXT) \ - lib_a-sf_llrint.$(OBJEXT) lib_a-sf_lround.$(OBJEXT) \ - lib_a-sf_llround.$(OBJEXT) lib_a-sf_nearbyint.$(OBJEXT) \ - lib_a-sf_remquo.$(OBJEXT) lib_a-sf_round.$(OBJEXT) \ - lib_a-sf_scalbln.$(OBJEXT) lib_a-sf_trunc.$(OBJEXT) + lib_a-sf_logb.$(OBJEXT) lib_a-sf_fdim.$(OBJEXT) \ + lib_a-sf_fma.$(OBJEXT) lib_a-sf_fmax.$(OBJEXT) \ + lib_a-sf_fmin.$(OBJEXT) lib_a-sf_fpclassify.$(OBJEXT) \ + lib_a-sf_lrint.$(OBJEXT) lib_a-sf_llrint.$(OBJEXT) \ + lib_a-sf_lround.$(OBJEXT) lib_a-sf_llround.$(OBJEXT) \ + lib_a-sf_nearbyint.$(OBJEXT) lib_a-sf_remquo.$(OBJEXT) \ + lib_a-sf_round.$(OBJEXT) lib_a-sf_scalbln.$(OBJEXT) \ + lib_a-sf_trunc.$(OBJEXT) lib_a-sf_exp.$(OBJEXT) \ + lib_a-sf_exp2.$(OBJEXT) lib_a-sf_exp2_data.$(OBJEXT) \ + lib_a-sf_log.$(OBJEXT) lib_a-sf_log_data.$(OBJEXT) \ + lib_a-sf_log2.$(OBJEXT) lib_a-sf_log2_data.$(OBJEXT) \ + lib_a-sf_pow_log2_data.$(OBJEXT) lib_a-sf_pow.$(OBJEXT) \ + lib_a-math_errf.$(OBJEXT) am__objects_3 = lib_a-atanl.$(OBJEXT) lib_a-cosl.$(OBJEXT) \ lib_a-sinl.$(OBJEXT) lib_a-tanl.$(OBJEXT) \ lib_a-tanhl.$(OBJEXT) lib_a-frexpl.$(OBJEXT) \ @@ -148,21 +153,23 @@ lib_a_OBJECTS = $(am_lib_a_OBJECTS) LTLIBRARIES = $(noinst_LTLIBRARIES) libcommon_la_LIBADD = am__objects_5 = s_finite.lo s_copysign.lo s_modf.lo s_scalbn.lo \ - s_cbrt.lo s_exp10.lo s_expm1.lo s_ilogb.lo \ - s_infinity.lo s_isinf.lo s_isinfd.lo s_isnan.lo s_isnand.lo \ - s_log1p.lo s_nan.lo s_nextafter.lo s_pow10.lo s_rint.lo \ - s_logb.lo s_log2.lo s_matherr.lo s_lib_ver.lo s_fdim.lo \ - s_fma.lo s_fmax.lo s_fmin.lo s_fpclassify.lo s_lrint.lo \ - s_llrint.lo s_lround.lo s_llround.lo s_nearbyint.lo \ - s_remquo.lo s_round.lo s_scalbln.lo s_signbit.lo s_trunc.lo + s_cbrt.lo s_exp10.lo s_expm1.lo s_ilogb.lo s_infinity.lo \ + s_isinf.lo s_isinfd.lo s_isnan.lo s_isnand.lo s_log1p.lo \ + s_nan.lo s_nextafter.lo s_pow10.lo s_rint.lo s_logb.lo \ + s_log2.lo s_matherr.lo s_lib_ver.lo s_fdim.lo s_fma.lo \ + s_fmax.lo s_fmin.lo s_fpclassify.lo s_lrint.lo s_llrint.lo \ + s_lround.lo s_llround.lo s_nearbyint.lo s_remquo.lo s_round.lo \ + s_scalbln.lo s_signbit.lo s_trunc.lo am__objects_6 = sf_finite.lo sf_copysign.lo sf_modf.lo sf_scalbn.lo \ sf_cbrt.lo sf_exp10.lo sf_expm1.lo sf_ilogb.lo sf_infinity.lo \ sf_isinf.lo sf_isinff.lo sf_isnan.lo sf_isnanf.lo sf_log1p.lo \ sf_nan.lo sf_nextafter.lo sf_pow10.lo sf_rint.lo sf_logb.lo \ - sf_log2.lo sf_fdim.lo sf_fma.lo sf_fmax.lo sf_fmin.lo \ - sf_fpclassify.lo sf_lrint.lo sf_llrint.lo sf_lround.lo \ - sf_llround.lo sf_nearbyint.lo sf_remquo.lo sf_round.lo \ - sf_scalbln.lo sf_trunc.lo + sf_fdim.lo sf_fma.lo sf_fmax.lo sf_fmin.lo sf_fpclassify.lo \ + sf_lrint.lo sf_llrint.lo sf_lround.lo sf_llround.lo \ + sf_nearbyint.lo sf_remquo.lo sf_round.lo sf_scalbln.lo \ + sf_trunc.lo sf_exp.lo sf_exp2.lo sf_exp2_data.lo sf_log.lo \ + sf_log_data.lo sf_log2.lo sf_log2_data.lo sf_pow_log2_data.lo \ + sf_pow.lo math_errf.lo am__objects_7 = atanl.lo cosl.lo sinl.lo tanl.lo tanhl.lo frexpl.lo \ modfl.lo ceill.lo fabsl.lo floorl.lo log1pl.lo expm1l.lo \ acosl.lo asinl.lo atan2l.lo coshl.lo sinhl.lo expl.lo \ @@ -347,11 +354,14 @@ fsrc = sf_finite.c sf_copysign.c sf_modf.c sf_scalbn.c \ sf_cbrt.c sf_exp10.c sf_expm1.c sf_ilogb.c \ sf_infinity.c sf_isinf.c sf_isinff.c sf_isnan.c sf_isnanf.c \ sf_log1p.c sf_nan.c sf_nextafter.c sf_pow10.c \ - sf_rint.c sf_logb.c sf_log2.c \ + sf_rint.c sf_logb.c \ sf_fdim.c sf_fma.c sf_fmax.c sf_fmin.c sf_fpclassify.c \ sf_lrint.c sf_llrint.c \ sf_lround.c sf_llround.c sf_nearbyint.c sf_remquo.c sf_round.c \ - sf_scalbln.c sf_trunc.c + sf_scalbln.c sf_trunc.c \ + sf_exp.c sf_exp2.c sf_exp2_data.c sf_log.c sf_log_data.c \ + sf_log2.c sf_log2_data.c sf_pow_log2_data.c sf_pow.c \ + math_errf.c lsrc = atanl.c cosl.c sinl.c tanl.c tanhl.c frexpl.c modfl.c ceill.c fabsl.c \ floorl.c log1pl.c expm1l.c acosl.c asinl.c atan2l.c coshl.c sinhl.c \ @@ -796,12 +806,6 @@ lib_a-sf_logb.o: sf_logb.c lib_a-sf_logb.obj: sf_logb.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_logb.obj `if test -f 'sf_logb.c'; then $(CYGPATH_W) 'sf_logb.c'; else $(CYGPATH_W) '$(srcdir)/sf_logb.c'; fi` -lib_a-sf_log2.o: sf_log2.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log2.o `test -f 'sf_log2.c' || echo '$(srcdir)/'`sf_log2.c - -lib_a-sf_log2.obj: sf_log2.c - $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log2.obj `if test -f 'sf_log2.c'; then $(CYGPATH_W) 'sf_log2.c'; else $(CYGPATH_W) '$(srcdir)/sf_log2.c'; fi` - lib_a-sf_fdim.o: sf_fdim.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_fdim.o `test -f 'sf_fdim.c' || echo '$(srcdir)/'`sf_fdim.c @@ -886,6 +890,66 @@ lib_a-sf_trunc.o: sf_trunc.c lib_a-sf_trunc.obj: sf_trunc.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_trunc.obj `if test -f 'sf_trunc.c'; then $(CYGPATH_W) 'sf_trunc.c'; else $(CYGPATH_W) '$(srcdir)/sf_trunc.c'; fi` +lib_a-sf_exp.o: sf_exp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_exp.o `test -f 'sf_exp.c' || echo '$(srcdir)/'`sf_exp.c + +lib_a-sf_exp.obj: sf_exp.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_exp.obj `if test -f 'sf_exp.c'; then $(CYGPATH_W) 'sf_exp.c'; else $(CYGPATH_W) '$(srcdir)/sf_exp.c'; fi` + +lib_a-sf_exp2.o: sf_exp2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_exp2.o `test -f 'sf_exp2.c' || echo '$(srcdir)/'`sf_exp2.c + +lib_a-sf_exp2.obj: sf_exp2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_exp2.obj `if test -f 'sf_exp2.c'; then $(CYGPATH_W) 'sf_exp2.c'; else $(CYGPATH_W) '$(srcdir)/sf_exp2.c'; fi` + +lib_a-sf_exp2_data.o: sf_exp2_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_exp2_data.o `test -f 'sf_exp2_data.c' || echo '$(srcdir)/'`sf_exp2_data.c + +lib_a-sf_exp2_data.obj: sf_exp2_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_exp2_data.obj `if test -f 'sf_exp2_data.c'; then $(CYGPATH_W) 'sf_exp2_data.c'; else $(CYGPATH_W) '$(srcdir)/sf_exp2_data.c'; fi` + +lib_a-sf_log.o: sf_log.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log.o `test -f 'sf_log.c' || echo '$(srcdir)/'`sf_log.c + +lib_a-sf_log.obj: sf_log.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log.obj `if test -f 'sf_log.c'; then $(CYGPATH_W) 'sf_log.c'; else $(CYGPATH_W) '$(srcdir)/sf_log.c'; fi` + +lib_a-sf_log_data.o: sf_log_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log_data.o `test -f 'sf_log_data.c' || echo '$(srcdir)/'`sf_log_data.c + +lib_a-sf_log_data.obj: sf_log_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log_data.obj `if test -f 'sf_log_data.c'; then $(CYGPATH_W) 'sf_log_data.c'; else $(CYGPATH_W) '$(srcdir)/sf_log_data.c'; fi` + +lib_a-sf_log2.o: sf_log2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log2.o `test -f 'sf_log2.c' || echo '$(srcdir)/'`sf_log2.c + +lib_a-sf_log2.obj: sf_log2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log2.obj `if test -f 'sf_log2.c'; then $(CYGPATH_W) 'sf_log2.c'; else $(CYGPATH_W) '$(srcdir)/sf_log2.c'; fi` + +lib_a-sf_log2_data.o: sf_log2_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log2_data.o `test -f 'sf_log2_data.c' || echo '$(srcdir)/'`sf_log2_data.c + +lib_a-sf_log2_data.obj: sf_log2_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_log2_data.obj `if test -f 'sf_log2_data.c'; then $(CYGPATH_W) 'sf_log2_data.c'; else $(CYGPATH_W) '$(srcdir)/sf_log2_data.c'; fi` + +lib_a-sf_pow_log2_data.o: sf_pow_log2_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_pow_log2_data.o `test -f 'sf_pow_log2_data.c' || echo '$(srcdir)/'`sf_pow_log2_data.c + +lib_a-sf_pow_log2_data.obj: sf_pow_log2_data.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_pow_log2_data.obj `if test -f 'sf_pow_log2_data.c'; then $(CYGPATH_W) 'sf_pow_log2_data.c'; else $(CYGPATH_W) '$(srcdir)/sf_pow_log2_data.c'; fi` + +lib_a-sf_pow.o: sf_pow.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_pow.o `test -f 'sf_pow.c' || echo '$(srcdir)/'`sf_pow.c + +lib_a-sf_pow.obj: sf_pow.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sf_pow.obj `if test -f 'sf_pow.c'; then $(CYGPATH_W) 'sf_pow.c'; else $(CYGPATH_W) '$(srcdir)/sf_pow.c'; fi` + +lib_a-math_errf.o: math_errf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-math_errf.o `test -f 'math_errf.c' || echo '$(srcdir)/'`math_errf.c + +lib_a-math_errf.obj: math_errf.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-math_errf.obj `if test -f 'math_errf.c'; then $(CYGPATH_W) 'math_errf.c'; else $(CYGPATH_W) '$(srcdir)/math_errf.c'; fi` + lib_a-atanl.o: atanl.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-atanl.o `test -f 'atanl.c' || echo '$(srcdir)/'`atanl.c diff --git a/newlib/libm/common/math_config.h b/newlib/libm/common/math_config.h new file mode 100644 index 000000000..c5667844a --- /dev/null +++ b/newlib/libm/common/math_config.h @@ -0,0 +1,179 @@ +/* Configuration for math routines. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#ifndef _MATH_CONFIG_H +#define _MATH_CONFIG_H + +#include +#include + +#ifndef WANT_ROUNDING +/* Correct special case results in non-nearest rounding modes. */ +# define WANT_ROUNDING 1 +#endif +#ifndef WANT_ERRNO +/* Set errno according to ISO C with (math_errhandling & MATH_ERRNO) != 0. */ +# define WANT_ERRNO 1 +#endif +#ifndef WANT_ERRNO_UFLOW +/* Set errno to ERANGE if result underflows to 0 (in all rounding modes). */ +# define WANT_ERRNO_UFLOW (WANT_ROUNDING && WANT_ERRNO) +#endif + +#ifndef TOINT_INTRINSICS +# define TOINT_INTRINSICS 0 +#endif +#ifndef TOINT_RINT +# define TOINT_RINT 0 +#endif +#ifndef TOINT_SHIFT +# define TOINT_SHIFT 1 +#endif + +static inline uint32_t +asuint (float f) +{ + union + { + float f; + uint32_t i; + } u = {f}; + return u.i; +} + +static inline float +asfloat (uint32_t i) +{ + union + { + uint32_t i; + float f; + } u = {i}; + return u.f; +} + +static inline uint64_t +asuint64 (double f) +{ + union + { + double f; + uint64_t i; + } u = {f}; + return u.i; +} + +static inline double +asdouble (uint64_t i) +{ + union + { + uint64_t i; + double f; + } u = {i}; + return u.f; +} + +#ifndef IEEE_754_2008_SNAN +# define IEEE_754_2008_SNAN 1 +#endif +static inline int +issignalingf_inline (float x) +{ + uint32_t ix = asuint (x); + if (!IEEE_754_2008_SNAN) + return (ix & 0x7fc00000) == 0x7fc00000; + return 2 * (ix ^ 0x00400000) > 2u * 0x7fc00000; +} + +#ifdef __GNUC__ +# define HIDDEN __attribute__ ((__visibility__ ("hidden"))) +# define NOINLINE __attribute__ ((noinline)) +#else +# define HIDDEN +# define NOINLINE +#endif + +HIDDEN float __math_oflowf (unsigned long); +HIDDEN float __math_uflowf (unsigned long); +HIDDEN float __math_may_uflowf (unsigned long); +HIDDEN float __math_divzerof (unsigned long); +HIDDEN float __math_invalidf (float); + +/* Shared between expf, exp2f and powf. */ +#define EXP2F_TABLE_BITS 5 +#define EXP2F_POLY_ORDER 3 +extern const struct exp2f_data +{ + uint64_t tab[1 << EXP2F_TABLE_BITS]; + double shift_scaled; + double poly[EXP2F_POLY_ORDER]; + double shift; + double invln2_scaled; + double poly_scaled[EXP2F_POLY_ORDER]; +} __exp2f_data HIDDEN; + +#define LOGF_TABLE_BITS 4 +#define LOGF_POLY_ORDER 4 +extern const struct logf_data +{ + struct + { + double invc, logc; + } tab[1 << LOGF_TABLE_BITS]; + double ln2; + double poly[LOGF_POLY_ORDER - 1]; /* First order coefficient is 1. */ +} __logf_data HIDDEN; + +#define LOG2F_TABLE_BITS 4 +#define LOG2F_POLY_ORDER 4 +extern const struct log2f_data +{ + struct + { + double invc, logc; + } tab[1 << LOG2F_TABLE_BITS]; + double poly[LOG2F_POLY_ORDER]; +} __log2f_data HIDDEN; + +#define POWF_LOG2_TABLE_BITS 4 +#define POWF_LOG2_POLY_ORDER 5 +#if TOINT_INTRINSICS +# define POWF_SCALE_BITS EXP2F_TABLE_BITS +#else +# define POWF_SCALE_BITS 0 +#endif +#define POWF_SCALE ((double) (1 << POWF_SCALE_BITS)) +extern const struct powf_log2_data +{ + struct + { + double invc, logc; + } tab[1 << POWF_LOG2_TABLE_BITS]; + double poly[POWF_LOG2_POLY_ORDER]; +} __powf_log2_data HIDDEN; + +#endif diff --git a/newlib/libm/common/math_errf.c b/newlib/libm/common/math_errf.c new file mode 100644 index 000000000..60b1bb3f2 --- /dev/null +++ b/newlib/libm/common/math_errf.c @@ -0,0 +1,89 @@ +/* Single-precision math error handling. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include "math_config.h" + +#if WANT_ERRNO +#include +/* NOINLINE reduces code size and avoids making math functions non-leaf + when the error handling is inlined. */ +NOINLINE static float +with_errnof (float y, int e) +{ + errno = e; + return y; +} +#else +#define with_errnof(x, e) (x) +#endif + +/* NOINLINE prevents fenv semantics breaking optimizations. */ +NOINLINE static float +xflowf (unsigned long sign, float y) +{ + y = (sign ? -y : y) * y; + return with_errnof (y, ERANGE); +} + +HIDDEN float +__math_uflowf (unsigned long sign) +{ + return xflowf (sign, 0x1p-95f); +} + +#if WANT_ERRNO_UFLOW +/* Underflows to zero in some non-nearest rounding mode, setting errno + is valid even if the result is non-zero, but in the subnormal range. */ +HIDDEN float +__math_may_uflowf (unsigned long sign) +{ + return xflowf (sign, 0x1.4p-75f); +} +#endif + +HIDDEN float +__math_oflowf (unsigned long sign) +{ + return xflowf (sign, 0x1p97f); +} + +HIDDEN float +__math_divzerof (unsigned long sign) +{ + float y = 0; + return with_errnof ((sign ? -1 : 1) / y, ERANGE); +} + +HIDDEN float +__math_invalidf (float x) +{ + float y = (x - x) / (x - x); + return isnan (x) ? y : with_errnof (y, EDOM); +} +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_exp.c b/newlib/libm/common/sf_exp.c new file mode 100644 index 000000000..79ec62bf5 --- /dev/null +++ b/newlib/libm/common/sf_exp.c @@ -0,0 +1,113 @@ +/* Single-precision e^x function. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include +#include +#include "math_config.h" + +/* +EXP2F_TABLE_BITS = 5 +EXP2F_POLY_ORDER = 3 + +ULP error: 0.502 (nearest rounding.) +Relative error: 1.69 * 2^-34 in [-ln2/64, ln2/64] (before rounding.) +Wrong count: 170635 (all nearest rounding wrong results with fma.) +Non-nearest ULP error: 1 (rounded ULP error) +*/ + +#define N (1 << EXP2F_TABLE_BITS) +#define InvLn2N __exp2f_data.invln2_scaled +#define T __exp2f_data.tab +#define C __exp2f_data.poly_scaled + +static inline uint32_t +top12 (float x) +{ + return asuint (x) >> 20; +} + +float +expf (float x) +{ + uint32_t abstop; + uint64_t ki, t; + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t kd, xd, z, r, r2, y, s; + + xd = (double_t) x; + abstop = top12 (x) & 0x7ff; + if (__builtin_expect (abstop >= top12 (88.0f), 0)) + { + /* |x| >= 88 or x is nan. */ + if (asuint (x) == asuint (-INFINITY)) + return 0.0f; + if (abstop >= top12 (INFINITY)) + return x + x; + if (x > 0x1.62e42ep6f) /* x > log(0x1p128) ~= 88.72 */ + return __math_oflowf (0); + if (x < -0x1.9fe368p6f) /* x < log(0x1p-150) ~= -103.97 */ + return __math_uflowf (0); +#if WANT_ERRNO_UFLOW + if (x < -0x1.9d1d9ep6f) /* x < log(0x1p-149) ~= -103.28 */ + return __math_may_uflowf (0); +#endif + } + + /* x*N/Ln2 = k + r with r in [-1/2, 1/2] and int k. */ + z = InvLn2N * xd; + + /* Round and convert z to int, the result is in [-150*N, 128*N] and + ideally ties-to-even rule is used, otherwise the magnitude of r + can be bigger which gives larger approximation error. */ +#if TOINT_INTRINSICS + kd = roundtoint (z); + ki = converttoint (z); +#elif TOINT_RINT + kd = rint (z); + ki = (long) kd; +#elif TOINT_SHIFT +# define SHIFT __exp2f_data.shift + kd = (double) (z + SHIFT); /* Rounding to double precision is required. */ + ki = asuint64 (kd); + kd -= SHIFT; +#endif + r = z - kd; + + /* exp(x) = 2^(k/N) * 2^(r/N) ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ + t = T[ki % N]; + t += ki << (52 - EXP2F_TABLE_BITS); + s = asdouble (t); + z = C[0] * r + C[1]; + r2 = r * r; + y = C[2] * r + 1; + y = z * r2 + y; + y = y * s; + return (float) y; +} +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_exp2.c b/newlib/libm/common/sf_exp2.c new file mode 100644 index 000000000..75f2551c1 --- /dev/null +++ b/newlib/libm/common/sf_exp2.c @@ -0,0 +1,99 @@ +/* Single-precision 2^x function. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include +#include +#include "math_config.h" + +/* +EXP2F_TABLE_BITS = 5 +EXP2F_POLY_ORDER = 3 + +ULP error: 0.502 (nearest rounding.) +Relative error: 1.69 * 2^-34 in [-1/64, 1/64] (before rounding.) +Wrong count: 168353 (all nearest rounding wrong results with fma.) +Non-nearest ULP error: 1 (rounded ULP error) +*/ + +#define N (1 << EXP2F_TABLE_BITS) +#define T __exp2f_data.tab +#define C __exp2f_data.poly +#define SHIFT __exp2f_data.shift_scaled + +static inline uint32_t +top12 (float x) +{ + return asuint (x) >> 20; +} + +float +exp2f (float x) +{ + uint32_t abstop; + uint64_t ki, t; + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t kd, xd, z, r, r2, y, s; + + xd = (double_t) x; + abstop = top12 (x) & 0x7ff; + if (__builtin_expect (abstop >= top12 (128.0f), 0)) + { + /* |x| >= 128 or x is nan. */ + if (asuint (x) == asuint (-INFINITY)) + return 0.0f; + if (abstop >= top12 (INFINITY)) + return x + x; + if (x > 0.0f) + return __math_oflowf (0); + if (x <= -150.0f) + return __math_uflowf (0); +#if WANT_ERRNO_UFLOW + if (x < -149.0f) + return __math_may_uflowf (0); +#endif + } + + /* x = k/N + r with r in [-1/(2N), 1/(2N)] and int k. */ + kd = (double) (xd + SHIFT); /* Rounding to double precision is required. */ + ki = asuint64 (kd); + kd -= SHIFT; /* k/N for int k. */ + r = xd - kd; + + /* exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ + t = T[ki % N]; + t += ki << (52 - EXP2F_TABLE_BITS); + s = asdouble (t); + z = C[0] * r + C[1]; + r2 = r * r; + y = C[2] * r + 1; + y = z * r2 + y; + y = y * s; + return (float) y; +} +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_exp2_data.c b/newlib/libm/common/sf_exp2_data.c new file mode 100644 index 000000000..63b6f391d --- /dev/null +++ b/newlib/libm/common/sf_exp2_data.c @@ -0,0 +1,56 @@ +/* Shared data between expf, exp2f and powf. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include "math_config.h" + +#define N (1 << EXP2F_TABLE_BITS) + +const struct exp2f_data __exp2f_data = { + /* tab[i] = uint(2^(i/N)) - (i << 52-BITS) + used for computing 2^(k/N) for an int |k| < 150 N as + double(tab[k%N] + (k << 52-BITS)) */ + .tab = { +0x3ff0000000000000, 0x3fefd9b0d3158574, 0x3fefb5586cf9890f, 0x3fef9301d0125b51, +0x3fef72b83c7d517b, 0x3fef54873168b9aa, 0x3fef387a6e756238, 0x3fef1e9df51fdee1, +0x3fef06fe0a31b715, 0x3feef1a7373aa9cb, 0x3feedea64c123422, 0x3feece086061892d, +0x3feebfdad5362a27, 0x3feeb42b569d4f82, 0x3feeab07dd485429, 0x3feea47eb03a5585, +0x3feea09e667f3bcd, 0x3fee9f75e8ec5f74, 0x3feea11473eb0187, 0x3feea589994cce13, +0x3feeace5422aa0db, 0x3feeb737b0cdc5e5, 0x3feec49182a3f090, 0x3feed503b23e255d, +0x3feee89f995ad3ad, 0x3feeff76f2fb5e47, 0x3fef199bdd85529c, 0x3fef3720dcef9069, +0x3fef5818dcfba487, 0x3fef7c97337b9b5f, 0x3fefa4afa2a490da, 0x3fefd0765b6e4540, + }, + .shift_scaled = 0x1.8p+52 / N, + .poly = { 0x1.c6af84b912394p-5, 0x1.ebfce50fac4f3p-3, 0x1.62e42ff0c52d6p-1 }, + .shift = 0x1.8p+52, + .invln2_scaled = 0x1.71547652b82fep+0 * N, + .poly_scaled = { +0x1.c6af84b912394p-5/N/N/N, 0x1.ebfce50fac4f3p-3/N/N, 0x1.62e42ff0c52d6p-1/N + }, +}; +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_log.c b/newlib/libm/common/sf_log.c new file mode 100644 index 000000000..ba5558a54 --- /dev/null +++ b/newlib/libm/common/sf_log.c @@ -0,0 +1,98 @@ +/* Single-precision log function. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include +#include +#include "math_config.h" + +/* +LOGF_TABLE_BITS = 4 +LOGF_POLY_ORDER = 4 + +ULP error: 0.818 (nearest rounding.) +Relative error: 1.957 * 2^-26 (before rounding.) +*/ + +#define T __logf_data.tab +#define A __logf_data.poly +#define Ln2 __logf_data.ln2 +#define N (1 << LOGF_TABLE_BITS) +#define OFF 0x3f330000 + +float +logf (float x) +{ + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t z, r, r2, y, y0, invc, logc; + uint32_t ix, iz, tmp; + int k, i; + + ix = asuint (x); +#if WANT_ROUNDING + /* Fix sign of zero with downward rounding when x==1. */ + if (__builtin_expect (ix == 0x3f800000, 0)) + return 0; +#endif + if (__builtin_expect (ix - 0x00800000 >= 0x7f800000 - 0x00800000, 0)) + { + /* x < 0x1p-126 or inf or nan. */ + if (ix * 2 == 0) + return __math_divzerof (1); + if (ix == 0x7f800000) /* log(inf) == inf. */ + return x; + if ((ix & 0x80000000) || ix * 2 >= 0xff000000) + return __math_invalidf (x); + /* x is subnormal, normalize it. */ + ix = asuint (x * 0x1p23f); + ix -= 23 << 23; + } + + /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. + The range is split into N subintervals. + The ith subinterval contains z and c is near its center. */ + tmp = ix - OFF; + i = (tmp >> (23 - LOGF_TABLE_BITS)) % N; + k = (int32_t) tmp >> 23; /* arithmetic shift */ + iz = ix - (tmp & 0x1ff << 23); + invc = T[i].invc; + logc = T[i].logc; + z = (double_t) asfloat (iz); + + /* log(x) = log1p(z/c-1) + log(c) + k*Ln2 */ + r = z * invc - 1; + y0 = logc + (double_t) k * Ln2; + + /* Pipelined polynomial evaluation to approximate log1p(r). */ + r2 = r * r; + y = A[1] * r + A[2]; + y = A[0] * r2 + y; + y = y * r2 + (y0 + r); + return (float) y; +} +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_log2.c b/newlib/libm/common/sf_log2.c index 9fbaaca72..f52cd385d 100644 --- a/newlib/libm/common/sf_log2.c +++ b/newlib/libm/common/sf_log2.c @@ -1,48 +1,99 @@ -/* sf_log2.c -- float version of s_log2.c. - * Modification of sf_exp10.c by Yaakov Selkowitz 2009. - */ +/* Single-precision log2 function. + Copyright (c) 2017 ARM Ltd. All rights reserved. -/* - * ==================================================== - * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. - * - * Developed at SunPro, a Sun Microsystems, Inc. business. - * Permission to use, copy, modify, and distribute this - * software is freely granted, provided that this notice - * is preserved. - * ==================================================== - */ + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. -/* - * wrapper log2f(x) - */ + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "fdlibm.h" -#include +#if !__OBSOLETE_MATH + #include -#undef log2 -#undef log2f +#include +#include "math_config.h" -#ifdef __STDC__ - float log2f(float x) /* wrapper log2f */ -#else - float log2f(x) /* wrapper log2f */ - float x; -#endif +/* +LOG2F_TABLE_BITS = 4 +LOG2F_POLY_ORDER = 4 + +ULP error: 0.752 (nearest rounding.) +Relative error: 1.9 * 2^-26 (before rounding.) +*/ + +#define N (1 << LOG2F_TABLE_BITS) +#define T __log2f_data.tab +#define A __log2f_data.poly +#define OFF 0x3f330000 + +float +log2f (float x) { - return (logf(x) / (float_t) M_LN2); -} + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t z, r, r2, p, y, y0, invc, logc; + uint32_t ix, iz, top, tmp; + int k, i; -#ifdef _DOUBLE_IS_32BITS - -#ifdef __STDC__ - double log2(double x) -#else - double log2(x) - double x; + ix = asuint (x); +#if WANT_ROUNDING + /* Fix sign of zero with downward rounding when x==1. */ + if (__builtin_expect (ix == 0x3f800000, 0)) + return 0; #endif -{ - return (double) log2f((float) x); -} + if (__builtin_expect (ix - 0x00800000 >= 0x7f800000 - 0x00800000, 0)) + { + /* x < 0x1p-126 or inf or nan. */ + if (ix * 2 == 0) + return __math_divzerof (1); + if (ix == 0x7f800000) /* log2(inf) == inf. */ + return x; + if ((ix & 0x80000000) || ix * 2 >= 0xff000000) + return __math_invalidf (x); + /* x is subnormal, normalize it. */ + ix = asuint (x * 0x1p23f); + ix -= 23 << 23; + } -#endif /* defined(_DOUBLE_IS_32BITS) */ + /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. + The range is split into N subintervals. + The ith subinterval contains z and c is near its center. */ + tmp = ix - OFF; + i = (tmp >> (23 - LOG2F_TABLE_BITS)) % N; + top = tmp & 0xff800000; + iz = ix - top; + k = (int32_t) tmp >> 23; /* arithmetic shift */ + invc = T[i].invc; + logc = T[i].logc; + z = (double_t) asfloat (iz); + + /* log2(x) = log1p(z/c-1)/ln2 + log2(c) + k */ + r = z * invc - 1; + y0 = logc + (double_t) k; + + /* Pipelined polynomial evaluation to approximate log1p(r)/ln2. */ + r2 = r * r; + y = A[1] * r + A[2]; + y = A[0] * r2 + y; + p = A[3] * r + y0; + y = y * r2 + p; + return (float) y; +} +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_log2_data.c b/newlib/libm/common/sf_log2_data.c new file mode 100644 index 000000000..f0e80947c --- /dev/null +++ b/newlib/libm/common/sf_log2_data.c @@ -0,0 +1,56 @@ +/* Data definition for log2f. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include "math_config.h" + +const struct log2f_data __log2f_data = { + .tab = { + { 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2 }, + { 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2 }, + { 0x1.49539f0f010bp+0, -0x1.7418b0a1fb77bp-2 }, + { 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2 }, + { 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2 }, + { 0x1.25e227b0b8eap+0, -0x1.97c1d1b3b7afp-3 }, + { 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3 }, + { 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4 }, + { 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5 }, + { 0x1p+0, 0x0p+0 }, + { 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4 }, + { 0x1.ca4b31f026aap-1, 0x1.476a9543891bap-3 }, + { 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3 }, + { 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2 }, + { 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2 }, + { 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2 }, + }, + .poly = { + -0x1.712b6f70a7e4dp-2, 0x1.ecabf496832ep-2, -0x1.715479ffae3dep-1, + 0x1.715475f35c8b8p0, + } +}; +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_log_data.c b/newlib/libm/common/sf_log_data.c new file mode 100644 index 000000000..28231b4dc --- /dev/null +++ b/newlib/libm/common/sf_log_data.c @@ -0,0 +1,56 @@ +/* Data definition for logf. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include "math_config.h" + +const struct logf_data __logf_data = { + .tab = { + { 0x1.661ec79f8f3bep+0, -0x1.57bf7808caadep-2 }, + { 0x1.571ed4aaf883dp+0, -0x1.2bef0a7c06ddbp-2 }, + { 0x1.49539f0f010bp+0, -0x1.01eae7f513a67p-2 }, + { 0x1.3c995b0b80385p+0, -0x1.b31d8a68224e9p-3 }, + { 0x1.30d190c8864a5p+0, -0x1.6574f0ac07758p-3 }, + { 0x1.25e227b0b8eap+0, -0x1.1aa2bc79c81p-3 }, + { 0x1.1bb4a4a1a343fp+0, -0x1.a4e76ce8c0e5ep-4 }, + { 0x1.12358f08ae5bap+0, -0x1.1973c5a611cccp-4 }, + { 0x1.0953f419900a7p+0, -0x1.252f438e10c1ep-5 }, + { 0x1p+0, 0x0p+0 }, + { 0x1.e608cfd9a47acp-1, 0x1.aa5aa5df25984p-5 }, + { 0x1.ca4b31f026aap-1, 0x1.c5e53aa362eb4p-4 }, + { 0x1.b2036576afce6p-1, 0x1.526e57720db08p-3 }, + { 0x1.9c2d163a1aa2dp-1, 0x1.bc2860d22477p-3 }, + { 0x1.886e6037841edp-1, 0x1.1058bc8a07ee1p-2 }, + { 0x1.767dcf5534862p-1, 0x1.4043057b6ee09p-2 }, + }, + .ln2 = 0x1.62e42fefa39efp-1, + .poly = { + -0x1.00ea348b88334p-2, 0x1.5575b0be00b6ap-2, -0x1.ffffef20a4123p-2, + } +}; +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_pow.c b/newlib/libm/common/sf_pow.c new file mode 100644 index 000000000..6741a349b --- /dev/null +++ b/newlib/libm/common/sf_pow.c @@ -0,0 +1,230 @@ +/* Single-precision pow function. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include +#include +#include "math_config.h" + +/* +POWF_LOG2_POLY_ORDER = 5 +EXP2F_TABLE_BITS = 5 + +ULP error: 0.82 (~ 0.5 + relerr*2^24) +relerr: 1.27 * 2^-26 (Relative error ~= 128*Ln2*relerr_log2 + relerr_exp2) +relerr_log2: 1.83 * 2^-33 (Relative error of logx.) +relerr_exp2: 1.69 * 2^-34 (Relative error of exp2(ylogx).) +*/ + +#define N (1 << POWF_LOG2_TABLE_BITS) +#define T __powf_log2_data.tab +#define A __powf_log2_data.poly +#define OFF 0x3f330000 + +/* Subnormal input is normalized so ix has negative biased exponent. + Output is multiplied by N (POWF_SCALE) if TOINT_INTRINICS is set. */ +static inline double_t +log2_inline (uint32_t ix) +{ + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t z, r, r2, r4, p, q, y, y0, invc, logc; + uint32_t iz, top, tmp; + int k, i; + + /* x = 2^k z; where z is in range [OFF,2*OFF] and exact. + The range is split into N subintervals. + The ith subinterval contains z and c is near its center. */ + tmp = ix - OFF; + i = (tmp >> (23 - POWF_LOG2_TABLE_BITS)) % N; + top = tmp & 0xff800000; + iz = ix - top; + k = (int32_t) top >> (23 - POWF_SCALE_BITS); /* arithmetic shift */ + invc = T[i].invc; + logc = T[i].logc; + z = (double_t) asfloat (iz); + + /* log2(x) = log1p(z/c-1)/ln2 + log2(c) + k */ + r = z * invc - 1; + y0 = logc + (double_t) k; + + /* Pipelined polynomial evaluation to approximate log1p(r)/ln2. */ + r2 = r * r; + y = A[0] * r + A[1]; + p = A[2] * r + A[3]; + r4 = r2 * r2; + q = A[4] * r + y0; + q = p * r2 + q; + y = y * r4 + q; + return y; +} + +#undef N +#undef T +#define N (1 << EXP2F_TABLE_BITS) +#define T __exp2f_data.tab +#define SIGN_BIAS (1 << (EXP2F_TABLE_BITS + 11)) + +/* The output of log2 and thus the input of exp2 is either scaled by N + (in case of fast toint intrinsics) or not. The unscaled xd must be + in [-1021,1023], sign_bias sets the sign of the result. */ +static inline double_t +exp2_inline (double_t xd, unsigned long sign_bias) +{ + uint64_t ki, ski, t; + /* double_t for better performance on targets with FLT_EVAL_METHOD==2. */ + double_t kd, z, r, r2, y, s; + +#if TOINT_INTRINSICS +# define C __exp2f_data.poly_scaled + /* N*x = k + r with r in [-1/2, 1/2] */ + kd = roundtoint (xd); /* k */ + ki = converttoint (xd); +#else +# define C __exp2f_data.poly +# define SHIFT __exp2f_data.shift_scaled + /* x = k/N + r with r in [-1/(2N), 1/(2N)] */ + kd = (double) (xd + SHIFT); /* Rounding to double precision is required. */ + ki = asuint64 (kd); + kd -= SHIFT; /* k/N */ +#endif + r = xd - kd; + + /* exp2(x) = 2^(k/N) * 2^r ~= s * (C0*r^3 + C1*r^2 + C2*r + 1) */ + t = T[ki % N]; + ski = ki + sign_bias; + t += ski << (52 - EXP2F_TABLE_BITS); + s = asdouble (t); + z = C[0] * r + C[1]; + r2 = r * r; + y = C[2] * r + 1; + y = z * r2 + y; + y = y * s; + return y; +} + +/* Returns 0 if not int, 1 if odd int, 2 if even int. */ +static inline int +checkint (uint32_t iy) +{ + int e = iy >> 23 & 0xff; + if (e < 0x7f) + return 0; + if (e > 0x7f + 23) + return 2; + if (iy & ((1 << (0x7f + 23 - e)) - 1)) + return 0; + if (iy & (1 << (0x7f + 23 - e))) + return 1; + return 2; +} + +static inline int +zeroinfnan (uint32_t ix) +{ + return 2 * ix - 1 >= 2u * 0x7f800000 - 1; +} + +float +powf (float x, float y) +{ + unsigned long sign_bias = 0; + uint32_t ix, iy; + + ix = asuint (x); + iy = asuint (y); + if (__builtin_expect (ix - 0x00800000 >= 0x7f800000 - 0x00800000 + || zeroinfnan (iy), + 0)) + { + /* Either (x < 0x1p-126 or inf or nan) or (y is 0 or inf or nan). */ + if (__builtin_expect (zeroinfnan (iy), 0)) + { + if (2 * iy == 0) + return issignalingf_inline (x) ? x + y : 1.0f; + if (ix == 0x3f800000) + return issignalingf_inline (y) ? x + y : 1.0f; + if (2 * ix > 2u * 0x7f800000 || 2 * iy > 2u * 0x7f800000) + return x + y; + if (2 * ix == 2 * 0x3f800000) + return 1.0f; + if ((2 * ix < 2 * 0x3f800000) == !(iy & 0x80000000)) + return 0.0f; /* |x|<1 && y==inf or |x|>1 && y==-inf. */ + return y * y; + } + if (__builtin_expect (zeroinfnan (ix), 0)) + { + float_t x2 = x * x; + if (ix & 0x80000000 && checkint (iy) == 1) + { + x2 = -x2; + sign_bias = 1; + } +#if WANT_ERRNO + if (2 * ix == 0 && iy & 0x80000000) + return __math_divzerof (sign_bias); +#endif + return iy & 0x80000000 ? 1 / x2 : x2; + } + /* x and y are non-zero finite. */ + if (ix & 0x80000000) + { + /* Finite x < 0. */ + int yint = checkint (iy); + if (yint == 0) + return __math_invalidf (x); + if (yint == 1) + sign_bias = SIGN_BIAS; + ix &= 0x7fffffff; + } + if (ix < 0x00800000) + { + /* Normalize subnormal x so exponent becomes negative. */ + ix = asuint (x * 0x1p23f); + ix &= 0x7fffffff; + ix -= 23 << 23; + } + } + double_t logx = log2_inline (ix); + double_t ylogx = y * logx; /* Note: cannot overflow, y is single prec. */ + if (__builtin_expect ((asuint64 (ylogx) >> 47 & 0xffff) + >= asuint64 (126.0 * POWF_SCALE) >> 47, + 0)) + { + /* |y*log(x)| >= 126. */ + if (ylogx > 0x1.fffffffd1d571p+6 * POWF_SCALE) + return __math_oflowf (sign_bias); + if (ylogx <= -150.0 * POWF_SCALE) + return __math_uflowf (sign_bias); +#if WANT_ERRNO_UFLOW + if (ylogx < -149.0 * POWF_SCALE) + return __math_may_uflowf (sign_bias); +#endif + } + return (float) exp2_inline (ylogx, sign_bias); +} +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/common/sf_pow_log2_data.c b/newlib/libm/common/sf_pow_log2_data.c new file mode 100644 index 000000000..24f638c19 --- /dev/null +++ b/newlib/libm/common/sf_pow_log2_data.c @@ -0,0 +1,57 @@ +/* Data definition for powf. + Copyright (c) 2017 ARM Ltd. All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions + are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. The name of the company may not be used to endorse or promote + products derived from this software without specific prior written + permission. + + THIS SOFTWARE IS PROVIDED BY ARM LTD ``AS IS AND ANY EXPRESS OR IMPLIED + WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + IN NO EVENT SHALL ARM LTD BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED + TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF + LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING + NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + +#include "fdlibm.h" +#if !__OBSOLETE_MATH + +#include "math_config.h" + +const struct powf_log2_data __powf_log2_data = { + .tab = { + { 0x1.661ec79f8f3bep+0, -0x1.efec65b963019p-2 * POWF_SCALE }, + { 0x1.571ed4aaf883dp+0, -0x1.b0b6832d4fca4p-2 * POWF_SCALE }, + { 0x1.49539f0f010bp+0, -0x1.7418b0a1fb77bp-2 * POWF_SCALE }, + { 0x1.3c995b0b80385p+0, -0x1.39de91a6dcf7bp-2 * POWF_SCALE }, + { 0x1.30d190c8864a5p+0, -0x1.01d9bf3f2b631p-2 * POWF_SCALE }, + { 0x1.25e227b0b8eap+0, -0x1.97c1d1b3b7afp-3 * POWF_SCALE }, + { 0x1.1bb4a4a1a343fp+0, -0x1.2f9e393af3c9fp-3 * POWF_SCALE }, + { 0x1.12358f08ae5bap+0, -0x1.960cbbf788d5cp-4 * POWF_SCALE }, + { 0x1.0953f419900a7p+0, -0x1.a6f9db6475fcep-5 * POWF_SCALE }, + { 0x1p+0, 0x0p+0 * POWF_SCALE }, + { 0x1.e608cfd9a47acp-1, 0x1.338ca9f24f53dp-4 * POWF_SCALE }, + { 0x1.ca4b31f026aap-1, 0x1.476a9543891bap-3 * POWF_SCALE }, + { 0x1.b2036576afce6p-1, 0x1.e840b4ac4e4d2p-3 * POWF_SCALE }, + { 0x1.9c2d163a1aa2dp-1, 0x1.40645f0c6651cp-2 * POWF_SCALE }, + { 0x1.886e6037841edp-1, 0x1.88e9c2c1b9ff8p-2 * POWF_SCALE }, + { 0x1.767dcf5534862p-1, 0x1.ce0a44eb17bccp-2 * POWF_SCALE }, + }, + .poly = { + 0x1.27616c9496e0bp-2 * POWF_SCALE, -0x1.71969a075c67ap-2 * POWF_SCALE, + 0x1.ec70a6ca7baddp-2 * POWF_SCALE, -0x1.7154748bef6c8p-1 * POWF_SCALE, + 0x1.71547652ab82bp0 * POWF_SCALE, + } +}; +#endif /* !__OBSOLETE_MATH */ diff --git a/newlib/libm/math/Makefile.am b/newlib/libm/math/Makefile.am index 9e8e92840..e745159ae 100644 --- a/newlib/libm/math/Makefile.am +++ b/newlib/libm/math/Makefile.am @@ -48,7 +48,8 @@ fsrc = kf_rem_pio2.c \ sf_frexp.c sf_ldexp.c \ sf_signif.c sf_sin.c \ sf_tan.c sf_tanh.c \ - wf_exp2.c wf_tgamma.c + wf_exp2.c wf_tgamma.c \ + wf_log2.c lsrc = el_hypot.c diff --git a/newlib/libm/math/Makefile.in b/newlib/libm/math/Makefile.in index 8f76aad4e..1f5a69406 100644 --- a/newlib/libm/math/Makefile.in +++ b/newlib/libm/math/Makefile.in @@ -137,7 +137,8 @@ am__objects_2 = lib_a-kf_rem_pio2.$(OBJEXT) lib_a-kf_cos.$(OBJEXT) \ lib_a-sf_frexp.$(OBJEXT) lib_a-sf_ldexp.$(OBJEXT) \ lib_a-sf_signif.$(OBJEXT) lib_a-sf_sin.$(OBJEXT) \ lib_a-sf_tan.$(OBJEXT) lib_a-sf_tanh.$(OBJEXT) \ - lib_a-wf_exp2.$(OBJEXT) lib_a-wf_tgamma.$(OBJEXT) + lib_a-wf_exp2.$(OBJEXT) lib_a-wf_tgamma.$(OBJEXT) \ + lib_a-wf_log2.$(OBJEXT) am__objects_3 = lib_a-el_hypot.$(OBJEXT) @USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \ @USE_LIBTOOL_FALSE@ $(am__objects_2) $(am__objects_3) @@ -169,7 +170,7 @@ am__objects_5 = kf_rem_pio2.lo kf_cos.lo kf_sin.lo kf_tan.lo \ wf_sincos.lo wf_drem.lo sf_asinh.lo sf_atan.lo sf_ceil.lo \ sf_cos.lo sf_erf.lo sf_fabs.lo sf_floor.lo sf_frexp.lo \ sf_ldexp.lo sf_signif.lo sf_sin.lo sf_tan.lo sf_tanh.lo \ - wf_exp2.lo wf_tgamma.lo + wf_exp2.lo wf_tgamma.lo wf_log2.lo am__objects_6 = el_hypot.lo @USE_LIBTOOL_TRUE@am_libmath_la_OBJECTS = $(am__objects_4) \ @USE_LIBTOOL_TRUE@ $(am__objects_5) $(am__objects_6) @@ -372,7 +373,8 @@ fsrc = kf_rem_pio2.c \ sf_frexp.c sf_ldexp.c \ sf_signif.c sf_sin.c \ sf_tan.c sf_tanh.c \ - wf_exp2.c wf_tgamma.c + wf_exp2.c wf_tgamma.c \ + wf_log2.c lsrc = el_hypot.c libmath_la_LDFLAGS = -Xcompiler -nostdlib @@ -1270,6 +1272,12 @@ lib_a-wf_tgamma.o: wf_tgamma.c lib_a-wf_tgamma.obj: wf_tgamma.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_tgamma.obj `if test -f 'wf_tgamma.c'; then $(CYGPATH_W) 'wf_tgamma.c'; else $(CYGPATH_W) '$(srcdir)/wf_tgamma.c'; fi` +lib_a-wf_log2.o: wf_log2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_log2.o `test -f 'wf_log2.c' || echo '$(srcdir)/'`wf_log2.c + +lib_a-wf_log2.obj: wf_log2.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wf_log2.obj `if test -f 'wf_log2.c'; then $(CYGPATH_W) 'wf_log2.c'; else $(CYGPATH_W) '$(srcdir)/wf_log2.c'; fi` + lib_a-el_hypot.o: el_hypot.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-el_hypot.o `test -f 'el_hypot.c' || echo '$(srcdir)/'`el_hypot.c diff --git a/newlib/libm/math/ef_exp.c b/newlib/libm/math/ef_exp.c index 6824f991a..e817370ac 100644 --- a/newlib/libm/math/ef_exp.c +++ b/newlib/libm/math/ef_exp.c @@ -15,6 +15,7 @@ #include "fdlibm.h" +#if __OBSOLETE_MATH #ifdef __v810__ #define const #endif @@ -97,3 +98,4 @@ P5 = 4.1381369442e-08; /* 0x3331bb4c */ return y*twom100; } } +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/ef_log.c b/newlib/libm/math/ef_log.c index 619fe9090..8dc902478 100644 --- a/newlib/libm/math/ef_log.c +++ b/newlib/libm/math/ef_log.c @@ -15,6 +15,7 @@ #include "fdlibm.h" +#if __OBSOLETE_MATH #ifdef __STDC__ static const float #else @@ -90,3 +91,4 @@ static float zero = 0.0; return dk*ln2_hi-((s*(f-R)-dk*ln2_lo)-f); } } +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/ef_pow.c b/newlib/libm/math/ef_pow.c index b3041dbdc..524e3f9b0 100644 --- a/newlib/libm/math/ef_pow.c +++ b/newlib/libm/math/ef_pow.c @@ -15,6 +15,7 @@ #include "fdlibm.h" +#if __OBSOLETE_MATH #ifdef __v810__ #define const #endif @@ -253,3 +254,4 @@ ivln2_l = 7.0526075433e-06; /* 0x36eca570 =1/ln2 tail*/ else SET_FLOAT_WORD(z,j); return s*z; } +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/wf_exp.c b/newlib/libm/math/wf_exp.c index 70f4459b4..f16af1d1b 100644 --- a/newlib/libm/math/wf_exp.c +++ b/newlib/libm/math/wf_exp.c @@ -18,6 +18,7 @@ */ #include "fdlibm.h" +#if __OBSOLETE_MATH #include #ifdef __STDC__ @@ -101,3 +102,4 @@ u_threshold= -1.0397208405e+02; /* 0xc2cff1b5 */ } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/wf_exp2.c b/newlib/libm/math/wf_exp2.c index 944031405..5dce9c832 100644 --- a/newlib/libm/math/wf_exp2.c +++ b/newlib/libm/math/wf_exp2.c @@ -18,6 +18,7 @@ */ #include "fdlibm.h" +#if __OBSOLETE_MATH #include #include @@ -44,3 +45,4 @@ } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/wf_log.c b/newlib/libm/math/wf_log.c index 4518b863b..07be8d63c 100644 --- a/newlib/libm/math/wf_log.c +++ b/newlib/libm/math/wf_log.c @@ -18,6 +18,7 @@ */ #include "fdlibm.h" +#if __OBSOLETE_MATH #include #ifdef __STDC__ @@ -84,3 +85,4 @@ } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/wf_log2.c b/newlib/libm/math/wf_log2.c new file mode 100644 index 000000000..e32153747 --- /dev/null +++ b/newlib/libm/math/wf_log2.c @@ -0,0 +1,50 @@ +/* wf_log2.c -- float version of s_log2.c. + * Modification of sf_exp10.c by Yaakov Selkowitz 2009. + */ + +/* + * ==================================================== + * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. + * + * Developed at SunPro, a Sun Microsystems, Inc. business. + * Permission to use, copy, modify, and distribute this + * software is freely granted, provided that this notice + * is preserved. + * ==================================================== + */ + +/* + * wrapper log2f(x) + */ + +#include "fdlibm.h" +#if __OBSOLETE_MATH +#include +#include +#undef log2 +#undef log2f + +#ifdef __STDC__ + float log2f(float x) /* wrapper log2f */ +#else + float log2f(x) /* wrapper log2f */ + float x; +#endif +{ + return (logf(x) / (float_t) M_LN2); +} + +#ifdef _DOUBLE_IS_32BITS + +#ifdef __STDC__ + double log2(double x) +#else + double log2(x) + double x; +#endif +{ + return (double) log2f((float) x); +} + +#endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* __OBSOLETE_MATH */ diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c index a30f8808e..be453558b 100644 --- a/newlib/libm/math/wf_pow.c +++ b/newlib/libm/math/wf_pow.c @@ -18,6 +18,7 @@ */ #include "fdlibm.h" +#if __OBSOLETE_MATH #include #ifdef __STDC__ @@ -177,3 +178,4 @@ } #endif /* defined(_DOUBLE_IS_32BITS) */ +#endif /* __OBSOLETE_MATH */ From 7127e8ef3b6f9d76f57515ad4297709738d05a6b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:12:42 +0200 Subject: [PATCH 064/649] cygwin: unlink: Fix typos in comments Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 61872fe58..63563ea25 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -273,7 +273,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) mixed case or in all upper case. That's a problem when using casesensitivity. If the file handle given to FileRenameInformation has been opened casesensitive, the call also handles the path to the - target dir casesensitive. Rather then trying to find the right name + target dir casesensitive. Rather than trying to find the right name of the recycler, we just reopen the file to move with OBJ_CASE_INSENSITIVE, so the subsequent FileRenameInformation works caseinsensitive in terms of the recycler directory name, too. */ @@ -308,7 +308,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) /* Is fname really a subcomponent of the full path? If not, there's a high probability we're acessing the file via a virtual drive created with "subst". Check and accommodate it. Note that we - ony get here if the virtual drive is really pointing to a local + only get here if the virtual drive is really pointing to a local drive. Otherwise pc.isremote () returns "true". */ if (!RtlEqualUnicodePathSuffix (pc.get_nt_native_path (), &fname, TRUE)) { From 5224eb7517498318595fd7f9a67d9a1b50b66d25 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:13:48 +0200 Subject: [PATCH 065/649] cygwin: unlink: drop redundant check for netapp FS The try_to_bin function isn't called for netapp FSes anyway, so testing for this FS type in the function is moot. Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 63563ea25..8ff50c850 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -374,7 +374,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) names. */ RtlAppendUnicodeToString (&recycler, (pc.fs_flags () & FILE_UNICODE_ON_DISK - && !pc.fs_is_samba () && !pc.fs_is_netapp ()) + && !pc.fs_is_samba ()) ? L".\xdc63\xdc79\xdc67" : L".cyg"); pfii = (PFILE_INTERNAL_INFORMATION) infobuf; /* Note: Modern Samba versions apparently don't like buffer sizes of more From 9ac4c0325fba621cdb5bf503b2521b4edd35086f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:15:08 +0200 Subject: [PATCH 066/649] cygwin: unlink: simplify rootdir handling In try_to_bin, rootdir is NULL for remote drives anyway. No extra check required. Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8ff50c850..96fb6f39f 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -394,7 +394,7 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) /* Shoot. */ pfri = (PFILE_RENAME_INFORMATION) infobuf; pfri->ReplaceIfExists = TRUE; - pfri->RootDirectory = pc.isremote () ? NULL : rootdir; + pfri->RootDirectory = rootdir; pfri->FileNameLength = recycler.Length; memcpy (pfri->FileName, recycler.Buffer, recycler.Length); frisiz = sizeof *pfri + pfri->FileNameLength - sizeof (WCHAR); From 3dda58f1573a7e216f4656a3248252aea4f30593 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:18:12 +0200 Subject: [PATCH 067/649] cygwin: unlink: improve debug messages in try_to_bin Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 96fb6f39f..e64b01797 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -520,6 +520,8 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) bin_stat = dir_not_empty; goto out; } + debug_printf ("Renaming dir %S back to %S failed, status = %y", + &recycler, pc.get_nt_native_path (), status); } /* In case of success, restore R/O attribute to accommodate hardlinks. That leaves potentially hardlinks around with the R/O bit suddenly @@ -548,7 +550,8 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) NULL, 0); if (!NT_SUCCESS (status)) { - debug_printf ("Creating file for overwriting failed, status = %y", + debug_printf ("Creating file %S for overwriting %S (%S) failed, " + "status = %y", &fname, &recycler, pc.get_nt_native_path (), status); goto out; } @@ -556,7 +559,8 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) FileRenameInformation); NtClose (tmp_fh); if (!NT_SUCCESS (status)) - debug_printf ("Overwriting with another file failed, status = %y", status); + debug_printf ("Overwriting %S (%S) with %S failed, status = %y", + &recycler, pc.get_nt_native_path (), &fname, status); out: if (rootdir) From e6c79e7a2ab7fe9e1d45c25526841e035ee67407 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:21:12 +0200 Subject: [PATCH 068/649] cygwin: unlink: fix "final trick" overwrite method on remote drives The "final trick" code in try_to_bin accidentally never worked on remote drives because it relies on rootdir. Which isn't set for remote unlinks. The code now creates a full path for remote files. Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index e64b01797..8ccc7681e 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -542,8 +542,22 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) delete-on-close on the original file succeeds. There are still cases in which this fails, for instance, when trying to delete a hardlink to a DLL used by the unlinking application itself. */ - RtlAppendUnicodeToString (&recycler, L"X"); - InitializeObjectAttributes (&attr, &recycler, 0, rootdir, NULL); + if (pc.isremote ()) + { + /* In the remote case we need the full path, but recycler is only + a relative path. Convert to absolute path. */ + RtlInitEmptyUnicodeString (&fname, (PCWSTR) tp.w_get (), + (NT_MAX_PATH - 1) * sizeof (WCHAR)); + RtlCopyUnicodeString (&fname, pc.get_nt_native_path ()); + RtlSplitUnicodePath (&fname, &fname, NULL); + /* Reset max length, overwritten by RtlSplitUnicodePath. */ + fname.MaximumLength = (NT_MAX_PATH - 1) * sizeof (WCHAR); /* reset */ + RtlAppendUnicodeStringToString (&fname, &recycler); + } + else + fname = recycler; + RtlAppendUnicodeToString (&fname, L"X"); + InitializeObjectAttributes (&attr, &fname, 0, rootdir, NULL); status = NtCreateFile (&tmp_fh, DELETE, &attr, &io, NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_SUPERSEDE, FILE_NON_DIRECTORY_FILE | FILE_DELETE_ON_CLOSE, From 5b7921523da00d81aaa0af829fbd8c5fe36e1e56 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:22:14 +0200 Subject: [PATCH 069/649] cygwin: unlink: don't try "final trick" in try_to_bin on NFS Doesn't work. Just another STATUS_SHARING_VIOLATION. Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8ccc7681e..8124df91d 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -532,8 +532,8 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) NtClose (fh); fh = NULL; /* So unlink_nt doesn't close the handle twice. */ /* On success or when trying to unlink a directory we just return here. - The below code only works for files. */ - if (NT_SUCCESS (status) || pc.isdir ()) + The below code only works for files. It also fails on NFS. */ + if (NT_SUCCESS (status) || pc.isdir () || pc.fs_is_nfs ()) goto out; /* The final trick. We create a temporary file with delete-on-close semantic and rename that file to the file just moved to the bin. From 88cfcda06b1017b7a05cf7c6f7ebafba9fe6f9fa Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:27:17 +0200 Subject: [PATCH 070/649] cygwin: unlink: workaround NFS non-ability to move file in certain cases Under some not quite clear conditions, NFS fails to use its unlink workaround to rename a file to ".nfsXYZ". The problem has been reproduced with the GAWK testext.awk testcase. To workaround this in Cygwin, we now call try_to_bin on NFS, too. For some reason NFS doesn't fail to rename the .cygXYZ file to .nfsXYZ after this Cygwin rename. Fix comment in unlink_nt accordingly. Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 51 +++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 8124df91d..caa3a77b3 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -501,8 +501,11 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) Otherwise the below code closes the handle to allow replacing the file. */ status = NtSetInformationFile (fh, &io, &disp, sizeof disp, FileDispositionInformation); - if (status == STATUS_DIRECTORY_NOT_EMPTY) + switch (status) { + case STATUS_SUCCESS: + break; + case STATUS_DIRECTORY_NOT_EMPTY: /* Uh oh! This was supposed to be avoided by the check_dir_not_empty test in unlink_nt, but given that the test isn't atomic, this *can* happen. Try to move the dir back ASAP. */ @@ -522,6 +525,34 @@ try_to_bin (path_conv &pc, HANDLE &fh, ACCESS_MASK access, ULONG flags) } debug_printf ("Renaming dir %S back to %S failed, status = %y", &recycler, pc.get_nt_native_path (), status); + break; + case STATUS_FILE_RENAMED: + /* On NFS, the subsequent request to set the delete disposition fails + with STATUS_FILE_RENAMED. We have to reopen the file, close the + original handle, and set the delete disposition on the reopened + handle to make sure setting delete disposition works. */ + InitializeObjectAttributes (&attr, &ro_u_empty, 0, fh, NULL); + status = NtOpenFile (&tmp_fh, access, &attr, &io, + FILE_SHARE_VALID_FLAGS, flags); + if (!NT_SUCCESS (status)) + debug_printf ("NtOpenFile (%S) for reopening in renamed case failed, " + "status = %y", pc.get_nt_native_path (), status); + else + { + NtClose (fh); + fh = tmp_fh; + status = NtSetInformationFile (fh, &io, &disp, sizeof disp, + FileDispositionInformation); + if (!NT_SUCCESS (status)) + debug_printf ("Setting delete disposition %S (%S) in renamed " + "case failed, status = %y", + &recycler, pc.get_nt_native_path (), status); + } + break; + default: + debug_printf ("Setting delete disposition on %S (%S) failed, status = %y", + &recycler, pc.get_nt_native_path (), status); + break; } /* In case of success, restore R/O attribute to accommodate hardlinks. That leaves potentially hardlinks around with the R/O bit suddenly @@ -759,15 +790,19 @@ retry_open: { debug_printf ("Sharing violation when opening %S", pc.get_nt_native_path ()); - /* We never call try_to_bin on NFS and NetApp for the follwing reasons: + /* We never call try_to_bin on NetApp. Netapp filesystems don't + understand the "move and delete" method at all and have all kinds + of weird effects. Just setting the delete dispositon usually + works fine, though. NFS implements its own mechanism to remove in-use files, which looks - quite similar to what we do in try_to_bin for remote files. - - Netapp filesystems don't understand the "move and delete" method - at all and have all kinds of weird effects. Just setting the delete - dispositon usually works fine, though. */ - if (!pc.fs_is_nfs () && !pc.fs_is_netapp ()) + quite similar to what we do in try_to_bin for remote files. However, + apparently it doesn't work as desired in all cases. This has been + observed when running the gawk 4.1.62++ testcase "testext.awk" under + Windows 10. So for NFS we still call try_to_bin to rename the file, + at least to make room for subsequent creation of a file with the + same filename. */ + if (!pc.fs_is_netapp ()) bin_stat = move_to_bin; /* If the file is not a directory, of if we didn't set the move_to_bin flag, just proceed with the FILE_SHARE_VALID_FLAGS set. */ From 3bdd4841034bb1264135e8bd94fc01f76ded39bb Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 18 Oct 2017 16:40:56 +0200 Subject: [PATCH 071/649] cygwin: belatedly bump DLL minor version Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/cygwin/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index e5c9e7fcd..7b95de3ee 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -11,7 +11,7 @@ details. */ changes to the DLL and is mainly informative in nature. */ #define CYGWIN_VERSION_DLL_MAJOR 2009 -#define CYGWIN_VERSION_DLL_MINOR 0 +#define CYGWIN_VERSION_DLL_MINOR 1 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ From 56e494c074ef1c790e455f10c37337c6009c814c Mon Sep 17 00:00:00 2001 From: Szabolcs Nagy Date: Tue, 17 Oct 2017 12:41:20 +0100 Subject: [PATCH 072/649] fix internal __ieee754_expf and __ieee754_logf calls The recently added new math code inlines error handling instead of using error handling wrappers around __ieee754* internal symbols, and thus the __ieee754* symbols are no longer provided. However __ieee754_expf and __ieee754_logf are used in the implementation of a number of other math functions. These symbols are safe to redirect to the external expf and logf symbols, because those names are always reserved when single precision math functions are reserved and the additional error handling code is either not reached or there will be an error in the final result that will override an internal spurious errno setting. For consistency all of __ieee754_expf, __ieee754_logf and __ieee754_powf are redirected using a macro. --- newlib/libm/common/fdlibm.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/newlib/libm/common/fdlibm.h b/newlib/libm/common/fdlibm.h index 821e4dedb..4523e8b2a 100644 --- a/newlib/libm/common/fdlibm.h +++ b/newlib/libm/common/fdlibm.h @@ -225,6 +225,17 @@ extern float __ieee754_scalbf __P((float,int)); extern float __ieee754_scalbf __P((float,float)); #endif +#if !__OBSOLETE_MATH +/* The new math code does not provide separate wrapper function + for error handling, so the extern symbol is called directly. + This is valid as long as there are no namespace issues (the + extern symbol is reserved whenever the caller is reserved) + and there are no observable error handling side effects. */ +# define __ieee754_expf(x) expf(x) +# define __ieee754_logf(x) logf(x) +# define __ieee754_powf(x,y) powf(x,y) +#endif + /* float versions of fdlibm kernel functions */ extern float __kernel_sinf __P((float,float,int)); extern float __kernel_cosf __P((float,float)); From f6ef29c48fcb87b042f067b0815bcada64e6dd10 Mon Sep 17 00:00:00 2001 From: Alexander Fedotov Date: Wed, 11 Oct 2017 14:52:20 +0300 Subject: [PATCH 073/649] Fixed semihosting for AArch64 when heapinfo parameters are not provided by debugger --- libgloss/aarch64/crt0.S | 78 +++++++++++++++++++++++++------------ libgloss/aarch64/syscalls.c | 7 +++- 2 files changed, 59 insertions(+), 26 deletions(-) diff --git a/libgloss/aarch64/crt0.S b/libgloss/aarch64/crt0.S index f670e0373..f831be12e 100644 --- a/libgloss/aarch64/crt0.S +++ b/libgloss/aarch64/crt0.S @@ -102,33 +102,44 @@ ldr x0, .LC0 /* point at returned values */ ldr x1, [x0, #8] /* get heap_limit */ + /* Set __heap_limit. */ +#ifdef __ILP32__ + /* Sanity check on the __heap_limit. */ + tst x1, #0xffffffff00000000 + bne .Linsanepar +#endif + cmp x1, xzr + beq .LC4 + adrp x2, __heap_limit + add x2, x2, #:lo12:__heap_limit + str x1, [x2] +.LC4: + + ldr x1, [x0] /* get heap_base */ #ifdef __ILP32__ /* Sanity check on the heap base. */ - ldr x0, [x0] /* get heap_base */ - tst x0, #0xffffffff00000000 - beq 1f - /* Exit with 1 if the heap base is not within the 32-bit address - space. */ - mov x0, ADP_Stopped_ApplicationExit & 0xff - movk x0, ADP_Stopped_ApplicationExit >> 16, lsl #16 - adrp x1, HeapBase /* Reuse to construct the parameter block. */ - add x1, x1, #:lo12:HeapBase - str x0, [x1] - mov x0, 1 - str x0, [x1, #8] - mov w0, #AngelSVC_Reason_ReportException - AngelSVCAsm AngelSVC -1: - /* For the sake of safety, set the stack base to the top end of - the 32-bit address space if the returned value from the - Angel API call is larger than or equal to 4 GiB. */ tst x1, #0xffffffff00000000 - csinv w1, w1, wzr, eq + bne .Linsanepar #endif -#else - /* Set up the stack pointer to a fixed value. */ - ldr x1, .Lstack + cmp x1, xzr + bne .LC5 + /* If the heap base value [x0, #0] is 0 then the heap base is actually + at the end of program data (i.e. __end__) */ + ldr x1, .LC3 + str x1, [x0, #0] +.LC5: + ldr x1, [x0, #16] /* get stack_base */ + +#ifdef __ILP32__ + /* Sanity check on the stack_base. */ + tst x1, #0xffffffff00000000 + bne .Linsanepar #endif + cmp x1, xzr + bne .LC6 +#endif + ldr x1, .Lstack /* Set up the stack pointer to a fixed value */ +.LC6: /* Ensure quad-word stack alignment. */ and x0, x1, #~15 @@ -234,6 +245,22 @@ b FUNCTION (exit) /* Cannot return. */ +#if defined (ARM_RDI_MONITOR) && defined (__ILP32__) +.Linsanepar: + /* Exit with 1 if the parameter is not within the 32-bit address + space. */ + mov x1, ADP_Stopped_ApplicationExit & 0xff + movk x1, ADP_Stopped_ApplicationExit >> 16, lsl #16 + adrp x0, HeapBase /* Reuse to construct the parameter block. */ + add x0, x0, #:lo12:HeapBase + str x1, [x0] + mov x1, 1 + str x1, [x0, #8] + mov w1, #AngelSVC_Reason_ReportException + AngelSVCAsm AngelSVC + b . +#endif + /* Function initializing exception vector table, flatmap, etc. Declared as weak symbol so that user can override this definition by linking in their own version of the function. */ @@ -245,12 +272,13 @@ FUNCTION (_cpu_init_hook): #ifdef ARM_RDI_MONITOR .LC0: GEN_DWORD HeapBase -#else +.LC3: + GEN_DWORD __end__ +#endif .Lstack: GEN_DWORD __stack - .weak __stack -#endif + .LC1: GEN_DWORD __bss_start__ .LC2: diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c index af206a1d4..4de4e0dcc 100644 --- a/libgloss/aarch64/syscalls.c +++ b/libgloss/aarch64/syscalls.c @@ -625,6 +625,9 @@ _getpid (int n __attribute__ ((unused))) return 1; } +/* Heap limit returned from SYS_HEAPINFO Angel semihost call. */ +ulong __heap_limit __attribute__ ((aligned (8))) = 0xcafedead; + caddr_t _sbrk (int incr) { @@ -637,7 +640,9 @@ _sbrk (int incr) prev_heap_end = heap_end; - if (heap_end + incr > stack_ptr) + if ((heap_end + incr > stack_ptr) + /* Honour heap limit if it's valid. */ + || ((__heap_limit != 0xcafedead) && (heap_end + incr > __heap_limit))) { /* Some of the libstdc++-v3 tests rely upon detecting out of memory errors, so do not abort here. */ From 3e8323dc06acd4c1a39b53c38d3bd7acd7102756 Mon Sep 17 00:00:00 2001 From: Ken Brown Date: Tue, 24 Oct 2017 18:21:53 -0400 Subject: [PATCH 074/649] winsup/utils/dump_setup.cc: Remove the function 'base' This was called only on filenames in /etc/setup/installed.db, which are all basenames anyway. Moreover, base wasn't correctly handling filenames containing colons. --- winsup/utils/dump_setup.cc | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/winsup/utils/dump_setup.cc b/winsup/utils/dump_setup.cc index 320d69fab..4415954f9 100644 --- a/winsup/utils/dump_setup.cc +++ b/winsup/utils/dump_setup.cc @@ -48,21 +48,6 @@ find_tar_ext (const char *path) return 0; } -static char * -base (const char *s) -{ - if (!s) - return 0; - const char *rv = s; - while (*s) - { - if ((*s == '/' || *s == ':' || *s == '\\') && s[1]) - rv = s + 1; - s++; - } - return (char *) rv; -} - /* Parse a filename into package, version, and extension components. */ int parse_filename (const char *in_fn, fileparse& f) @@ -79,7 +64,7 @@ parse_filename (const char *in_fn, fileparse& f) strcpy (f.tail, fn + n); fn[n] = '\0'; f.pkg[0] = f.what[0] = '\0'; - p = base (fn); + p = fn; for (ver = p; *ver; ver++) if (*ver != '-') continue; From ce189d8afef720b0977b5cae7f9eabf5d49b530c Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 24 Oct 2017 11:16:22 +0200 Subject: [PATCH 075/649] RTEMS: Remove internal timecounter API Change copyright. Original BSD content moved to . Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/machine/_time.h | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/newlib/libc/sys/rtems/include/machine/_time.h b/newlib/libc/sys/rtems/include/machine/_time.h index dd69bd665..13fa14afa 100644 --- a/newlib/libc/sys/rtems/include/machine/_time.h +++ b/newlib/libc/sys/rtems/include/machine/_time.h @@ -1,6 +1,6 @@ /*- - * Copyright (c) 1982, 1986, 1993 - * The Regents of the University of California. All rights reserved. + * Copyright (c) 2016 embedded brains GmbH + * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,14 +10,11 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) @@ -25,34 +22,12 @@ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. - * - * @(#)time.h 8.5 (Berkeley) 5/4/95 - * $FreeBSD$ */ #ifndef _SYS_TIME_H_ #error "must be included via " #endif /* !_SYS_TIME_H_ */ -__BEGIN_DECLS -extern volatile time_t _Timecounter_Time_second; -extern volatile time_t _Timecounter_Time_uptime; -extern struct bintime _Timecounter_Boottimebin; - -void _Timecounter_Binuptime(struct bintime *); -void _Timecounter_Nanouptime(struct timespec *); -void _Timecounter_Microuptime(struct timeval *); -void _Timecounter_Bintime(struct bintime *); -void _Timecounter_Nanotime(struct timespec *); -void _Timecounter_Microtime(struct timeval *); -void _Timecounter_Getbinuptime(struct bintime *); -void _Timecounter_Getnanouptime(struct timespec *); -void _Timecounter_Getmicrouptime(struct timeval *); -void _Timecounter_Getbintime(struct bintime *); -void _Timecounter_Getnanotime(struct timespec *); -void _Timecounter_Getmicrotime(struct timeval *); -__END_DECLS - #ifdef _KERNEL /* Header file provided outside of Newlib */ #include From 076ce7098f5806bf29ff0ba0dbeba4f335786b3c Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Fri, 27 Oct 2017 16:32:39 -0500 Subject: [PATCH 076/649] newlib/configure.host: Remove obsolete definition of _I386MACH_ALLOW_HW_INTERRUPTS The *-*-rtems* targets defined this even though the conditional was no longer present in i386/setjmp.S. --- newlib/configure.host | 2 -- 1 file changed, 2 deletions(-) diff --git a/newlib/configure.host b/newlib/configure.host index ba2d8c6c7..fb3362ba1 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -608,8 +608,6 @@ case "${host}" in newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" # turn off unsupported items in posix directory newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN" - # turn off using cli/sti in i386 setjmp/longjmp - newlib_cflags="${newlib_cflags} -D_I386MACH_ALLOW_HW_INTERRUPTS" ;; # VxWorks supplies its own version of malloc, and the newlib one # doesn't work because VxWorks does not have sbrk. From 8c8cdd9ad72b07c1edefb5264cdcb4927700e813 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Thu, 2 Nov 2017 16:45:34 +0100 Subject: [PATCH 077/649] posix_fadvise() *returns* error codes but does not set errno Also updates the fhandler_*::fadvise implementations to adhere to the same semantics. --- winsup/cygwin/fhandler_disk_file.cc | 11 +++-------- winsup/cygwin/pipe.cc | 3 +-- winsup/cygwin/syscalls.cc | 2 +- 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 2144a4cdc..252dc660c 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1075,10 +1075,7 @@ int fhandler_disk_file::fadvise (off_t offset, off_t length, int advice) { if (advice < POSIX_FADV_NORMAL || advice > POSIX_FADV_NOREUSE) - { - set_errno (EINVAL); - return -1; - } + return EINVAL; /* Windows only supports advice flags for the whole file. We're using a simplified test here so that we don't have to ask for the actual @@ -1097,9 +1094,7 @@ fhandler_disk_file::fadvise (off_t offset, off_t length, int advice) NTSTATUS status = NtQueryInformationFile (get_handle (), &io, &fmi, sizeof fmi, FileModeInformation); - if (!NT_SUCCESS (status)) - __seterrno_from_nt_status (status); - else + if (NT_SUCCESS (status)) { fmi.Mode &= ~FILE_SEQUENTIAL_ONLY; if (advice == POSIX_FADV_SEQUENTIAL) @@ -1111,7 +1106,7 @@ fhandler_disk_file::fadvise (off_t offset, off_t length, int advice) __seterrno_from_nt_status (status); } - return -1; + return geterrno_from_nt_status (status); } int diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 79b796631..8738d34b9 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -165,8 +165,7 @@ fhandler_pipe::lseek (off_t offset, int whence) int fhandler_pipe::fadvise (off_t offset, off_t length, int advice) { - set_errno (ESPIPE); - return -1; + return ESPIPE; } int diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index caa3a77b3..d0d735bde 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2937,7 +2937,7 @@ posix_fadvise (int fd, off_t offset, off_t len, int advice) if (cfd >= 0) res = cfd->fadvise (offset, len, advice); else - set_errno (EBADF); + res = EBADF; syscall_printf ("%R = posix_fadvice(%d, %D, %D, %d)", res, fd, offset, len, advice); return res; From 94854321bb79603b3adcf42093031c7e85c81e0a Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Thu, 2 Nov 2017 16:45:35 +0100 Subject: [PATCH 078/649] posix_fallocate() *returns* error codes but does not set errno Also updates the fhandler_*::ftruncate implementations to adhere to the same semantics. The error handling semantics of those syscalls that use fhandler_*::ftruncate are moved to the implementations of those syscalls ( in particular ftruncate() and friends still set errno and return -1 on error but that logic is handled in the syscall implementation). --- winsup/cygwin/fhandler.cc | 3 +-- winsup/cygwin/fhandler_disk_file.cc | 17 ++++++----------- winsup/cygwin/pipe.cc | 3 +-- winsup/cygwin/syscalls.cc | 11 ++++++++--- 4 files changed, 16 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index d719b7ca2..5b7d002bd 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1771,8 +1771,7 @@ fhandler_base::fadvise (off_t offset, off_t length, int advice) int fhandler_base::ftruncate (off_t length, bool allow_truncate) { - set_errno (EINVAL); - return -1; + return EINVAL; } int diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 252dc660c..bc8fead5e 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1112,14 +1112,14 @@ fhandler_disk_file::fadvise (off_t offset, off_t length, int advice) int fhandler_disk_file::ftruncate (off_t length, bool allow_truncate) { - int res = -1; + int res = 0; if (length < 0 || !get_handle ()) - set_errno (EINVAL); + res = EINVAL; else if (pc.isdir ()) - set_errno (EISDIR); + res = EISDIR; else if (!(get_access () & GENERIC_WRITE)) - set_errno (EBADF); + res = EBADF; else { NTSTATUS status; @@ -1130,10 +1130,7 @@ fhandler_disk_file::ftruncate (off_t length, bool allow_truncate) status = NtQueryInformationFile (get_handle (), &io, &fsi, sizeof fsi, FileStandardInformation); if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - return -1; - } + return geterrno_from_nt_status (status); /* If called through posix_fallocate, silently succeed if length is less than the file's actual length. */ @@ -1159,9 +1156,7 @@ fhandler_disk_file::ftruncate (off_t length, bool allow_truncate) &feofi, sizeof feofi, FileEndOfFileInformation); if (!NT_SUCCESS (status)) - __seterrno_from_nt_status (status); - else - res = 0; + res = geterrno_from_nt_status (status); } return res; } diff --git a/winsup/cygwin/pipe.cc b/winsup/cygwin/pipe.cc index 8738d34b9..f1eace6a6 100644 --- a/winsup/cygwin/pipe.cc +++ b/winsup/cygwin/pipe.cc @@ -171,8 +171,7 @@ fhandler_pipe::fadvise (off_t offset, off_t length, int advice) int fhandler_pipe::ftruncate (off_t length, bool allow_truncate) { - set_errno (allow_truncate ? EINVAL : ESPIPE); - return -1; + return allow_truncate ? EINVAL : ESPIPE; } char * diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index d0d735bde..1807afcc6 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2946,16 +2946,16 @@ posix_fadvise (int fd, off_t offset, off_t len, int advice) extern "C" int posix_fallocate (int fd, off_t offset, off_t len) { - int res = -1; + int res = 0; if (offset < 0 || len == 0) - set_errno (EINVAL); + res = EINVAL; else { cygheap_fdget cfd (fd); if (cfd >= 0) res = cfd->ftruncate (offset + len, false); else - set_errno (EBADF); + res = EBADF; } syscall_printf ("%R = posix_fallocate(%d, %D, %D)", res, fd, offset, len); return res; @@ -2968,6 +2968,11 @@ ftruncate64 (int fd, off_t length) cygheap_fdget cfd (fd); if (cfd >= 0) res = cfd->ftruncate (length, true); + if (res) + { + set_errno (res); + res = -1; + } else set_errno (EBADF); syscall_printf ("%R = ftruncate(%d, %D)", res, fd, length); From 09d60f64441ab1e9c7c6fede7abcc6ee9019a1e5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 2 Nov 2017 18:09:39 +0100 Subject: [PATCH 079/649] cygwin: add 2.9.1 release messages file Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.9.1 | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 winsup/cygwin/release/2.9.1 diff --git a/winsup/cygwin/release/2.9.1 b/winsup/cygwin/release/2.9.1 new file mode 100644 index 000000000..0a04b2a7d --- /dev/null +++ b/winsup/cygwin/release/2.9.1 @@ -0,0 +1,16 @@ +What's new: +----------- + + +What changed: +------------- + + +Bug Fixes +--------- + +- Fix a problem in unlink on NFS. + Addresses: Shows up in GAWK testsuite test "testext" + +- Fix errno setting bug in posix_fadvise and posix_fallocate. + Addresses: https://cygwin.com/ml/cygwin-patches/2017-q4/msg00026.html From ad15b8ccee7d4253e7f3a5dd69fe2ab8c67895b8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 2 Nov 2017 19:13:09 +0100 Subject: [PATCH 080/649] cygwin: ftruncate64: add missing braces Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 1807afcc6..a045dcda9 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -2967,12 +2967,14 @@ ftruncate64 (int fd, off_t length) int res = -1; cygheap_fdget cfd (fd); if (cfd >= 0) - res = cfd->ftruncate (length, true); - if (res) - { - set_errno (res); - res = -1; - } + { + res = cfd->ftruncate (length, true); + if (res) + { + set_errno (res); + res = -1; + } + } else set_errno (EBADF); syscall_printf ("%R = ftruncate(%d, %D)", res, fd, length); From 1f42dc2bcf58d3b8629eb13d53de3f69fc314b47 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 29 Sep 2017 07:29:03 +0200 Subject: [PATCH 081/649] Make ffsl() and ffsll() BSD-visible Since glibc 2.27, they are visible via _DEFAULT_SOURCE (__USE_MISC): https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/commit/man3/ffs.3?id=247bbcf00c9a425ab0ad6e303ec8718e4ba844a6 In FreeBSD, they are guarded by __BSD_VISIBLE. Signed-off-by: Sebastian Huber --- newlib/libc/include/strings.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h index 122f2fcd6..50a304215 100644 --- a/newlib/libc/include/strings.h +++ b/newlib/libc/include/strings.h @@ -53,11 +53,9 @@ void explicit_bzero(void *, size_t); #if __MISC_VISIBLE || __POSIX_VISIBLE < 200809 || __XSI_VISIBLE >= 700 int ffs(int) __pure2; #endif -#if __GNU_VISIBLE +#if __BSD_VISIBLE int ffsl(long) __pure2; int ffsll(long long) __pure2; -#endif -#if __BSD_VISIBLE int fls(int) __pure2; int flsl(long) __pure2; int flsll(long long) __pure2; From 1c50e0d1abd5cc790e72572af6fd6b03f7d1c594 Mon Sep 17 00:00:00 2001 From: "Erik M. Bray" Date: Tue, 7 Nov 2017 14:44:49 +0100 Subject: [PATCH 082/649] Fix two bugs in the limit of large numbers of sockets: * Fix the maximum number of sockets allowed in the session to 2048, instead of making it relative to sizeof(wsa_event). The original choice of 2048 was in order to fit the wsa_events array in the .cygwin_dll_common shared section, but there is still enough room to grow there to have 2048 sockets on 64-bit as well. * Return an error and set errno=ENOBUF if a socket can't be created due to this limit being reached. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 7a6dbdc41..185fd51ff 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -496,7 +496,7 @@ fhandler_socket::af_local_set_secret (char *buf) /* Maximum number of concurrently opened sockets from all Cygwin processes per session. Note that shared sockets (through dup/fork/exec) are counted as one socket. */ -#define NUM_SOCKS (32768 / sizeof (wsa_event)) +#define NUM_SOCKS 2048U #define LOCK_EVENTS \ if (wsock_mtx && \ @@ -623,7 +623,14 @@ fhandler_socket::init_events () NtClose (wsock_mtx); return false; } - wsock_events = search_wsa_event_slot (new_serial_number); + if (!(wsock_events = search_wsa_event_slot (new_serial_number))); + { + set_errno (ENOBUFS); + NtClose (wsock_evt); + NtClose (wsock_mtx); + return false; + } + /* sock type not yet set here. */ if (pc.dev == FH_UDP || pc.dev == FH_DGRAM) wsock_events->events = FD_WRITE; From 2640628b091eb036eaaec7a3ae56b8a6820f74ff Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 7 Nov 2017 16:11:08 +0100 Subject: [PATCH 083/649] cygwin: add socket bugfix to release notes Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.9.1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/release/2.9.1 b/winsup/cygwin/release/2.9.1 index 0a04b2a7d..e01515f1d 100644 --- a/winsup/cygwin/release/2.9.1 +++ b/winsup/cygwin/release/2.9.1 @@ -14,3 +14,6 @@ Bug Fixes - Fix errno setting bug in posix_fadvise and posix_fallocate. Addresses: https://cygwin.com/ml/cygwin-patches/2017-q4/msg00026.html + +- Fix two bugs in the limit of large numbers of sockets. + Addresses: https://cygwin.com/ml/cygwin/2017-11/msg00052.html From 2e989b212955665384bf61ee82dd487844a9371a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 7 Nov 2017 16:34:17 +0100 Subject: [PATCH 084/649] cygwin: fix stray semicolon introduced by patch 1c50e0d1abd5cc790e72572af6fd6b03f7d1c594 Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 185fd51ff..b8e684fd8 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -623,7 +623,7 @@ fhandler_socket::init_events () NtClose (wsock_mtx); return false; } - if (!(wsock_events = search_wsa_event_slot (new_serial_number))); + if (!(wsock_events = search_wsa_event_slot (new_serial_number))) { set_errno (ENOBUFS); NtClose (wsock_evt); From 46702f92ea499d15cb43c7c46ff9ad05f26aec6d Mon Sep 17 00:00:00 2001 From: Xiaofeng Liu Date: Wed, 8 Nov 2017 13:21:30 +0100 Subject: [PATCH 085/649] cygwin: pread() returns non-zero if read beyond EOF NtReadFile returns EOF status but doesn't set information to 0. Set return value explicitly on EOF. --- winsup/cygwin/fhandler_disk_file.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index bc8fead5e..2e4cf4936 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1529,7 +1529,9 @@ fhandler_disk_file::pread (void *buf, size_t count, off_t offset) goto non_atomic; status = NtReadFile (prw_handle, NULL, NULL, NULL, &io, buf, count, &off, NULL); - if (!NT_SUCCESS (status) && status != STATUS_END_OF_FILE) + if (status == STATUS_END_OF_FILE) + res = 0; + else if (!NT_SUCCESS (status)) { if (pc.isdir ()) { @@ -1557,7 +1559,8 @@ fhandler_disk_file::pread (void *buf, size_t count, off_t offset) __seterrno_from_nt_status (status); return -1; } - res = io.Information; /* Valid on EOF. */ + else + res = io.Information; /* Valid on EOF. */ } else { From c983aa48798dc7adc165862de4b89a6e49b97bdd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 8 Nov 2017 13:30:42 +0100 Subject: [PATCH 086/649] cygwin: fhandler_disk_file::pread: always print debug info on return Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_disk_file.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 2e4cf4936..0b99c490e 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1541,14 +1541,20 @@ fhandler_disk_file::pread (void *buf, size_t count, off_t offset) if (status == (NTSTATUS) STATUS_ACCESS_VIOLATION) { if (is_at_eof (prw_handle)) - return 0; + { + res = 0; + goto out; + } switch (mmap_is_attached_or_noreserve (buf, count)) { case MMAP_NORESERVE_COMMITED: status = NtReadFile (prw_handle, NULL, NULL, NULL, &io, buf, count, &off, NULL); if (NT_SUCCESS (status)) - return io.Information; + { + res = io.Information; + goto out; + } break; case MMAP_RAISE_SIGBUS: raise (SIGBUS); @@ -1579,6 +1585,7 @@ non_atomic: res = -1; } } +out: debug_printf ("%d = pread(%p, %ld, %D)\n", res, buf, count, offset); return res; } From 181fe5d2edacfd1578fe881c857dda7eae9ec104 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 8 Nov 2017 13:36:34 +0100 Subject: [PATCH 087/649] cygwin: pread: Remove incorrect comment Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_disk_file.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 0b99c490e..8f5795206 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1566,7 +1566,7 @@ fhandler_disk_file::pread (void *buf, size_t count, off_t offset) return -1; } else - res = io.Information; /* Valid on EOF. */ + res = io.Information; } else { From b1a388799dc98e6d1451fb73aa71097cbf9f37d9 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 11 Oct 2017 07:57:44 -0500 Subject: [PATCH 088/649] newlib/.../getreent.c: Allow to be provided by host and do so for RTEMS RTEMS provides the option to have a global or per-thread reentrancy as part of application configuration. As part of this, RTEMS provides the implementation of __getreent() as appropriate. Allow the target to determine if this method is present in libc.a. --- newlib/configure.host | 4 ++-- newlib/libc/reent/getreent.c | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/newlib/configure.host b/newlib/configure.host index fb3362ba1..3e950d8a5 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -586,7 +586,7 @@ case "${host}" in default_newlib_io_long_double="yes" default_newlib_io_pos_args="yes" CC="${CC} -I${cygwin_srcdir}/include" - newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DSIGNAL_PROVIDED -D_COMPILING_NEWLIB -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED" + newlib_cflags="${newlib_cflags} -DHAVE_OPENDIR -DHAVE_RENAME -DGETREENT_PROVIDED -DSIGNAL_PROVIDED -D_COMPILING_NEWLIB -DHAVE_BLKSIZE -DHAVE_FCNTL -DMALLOC_PROVIDED" syscall_dir=syscalls ;; *-*-phoenix*) @@ -605,7 +605,7 @@ case "${host}" in default_newlib_io_long_long="yes" default_newlib_io_c99_formats="yes" newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB" - newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" +newlib_cflags="${newlib_cflags} -DCLOCK_PROVIDED -DMALLOC_PROVIDED -DEXIT_PROVIDED -DSIGNAL_PROVIDED -DGETREENT_PROVIDED -DREENTRANT_SYSCALLS_PROVIDED -DHAVE_NANOSLEEP -DHAVE_BLKSIZE -DHAVE_FCNTL -DHAVE_ASSERT_FUNC" # turn off unsupported items in posix directory newlib_cflags="${newlib_cflags} -D_NO_GETLOGIN -D_NO_GETPWENT -D_NO_GETUT -D_NO_GETPASS -D_NO_SIGSET -D_NO_WORDEXP -D_NO_POPEN -D_NO_POSIX_SPAWN" ;; diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c index 60ae6fbb7..124abce2a 100644 --- a/newlib/libc/reent/getreent.c +++ b/newlib/libc/reent/getreent.c @@ -1,5 +1,11 @@ /* default reentrant pointer when multithread enabled */ +#ifdef GETREENT_PROVIDED + +int _dummy_getreent; + +#else + #include <_ansi.h> #include @@ -12,3 +18,5 @@ _DEFUN_VOID(__getreent) { return _impure_ptr; } + +#endif From 9cf0c4a012b214504e19fb92b23d5f0f3c9da097 Mon Sep 17 00:00:00 2001 From: Florian Schmidt Date: Tue, 14 Nov 2017 09:01:14 +0100 Subject: [PATCH 089/649] newlib/libc/stdlib/realloc.c: fix variable name The variable doesn't follow the convention of having the same name as the function it's bundled with. Furthermore, it clashes with the variable of the same name in newlib/libc/stdlib/calloc.c. Signed-off-by: Florian Schmidt --- newlib/libc/stdlib/realloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/stdlib/realloc.c b/newlib/libc/stdlib/realloc.c index 2caa6e4d2..0cdbdb619 100644 --- a/newlib/libc/stdlib/realloc.c +++ b/newlib/libc/stdlib/realloc.c @@ -1,5 +1,5 @@ #ifdef MALLOC_PROVIDED -int _dummy_calloc = 1; +int _dummy_realloc = 1; #else /* realloc.c -- a wrapper for realloc_r. */ From f94fe74aad9c69ed17e55468ce1044eafca34687 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 16:28:44 +0100 Subject: [PATCH 090/649] Cygwin: open: cleanup code in preparation of O_TMPFILE Signed-off-by: Corinna Vinschen --- winsup/cygwin/syscalls.cc | 112 +++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 57 deletions(-) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index a045dcda9..aa796d3e8 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1361,6 +1361,7 @@ open (const char *unix_path, int flags, ...) int res = -1; va_list ap; mode_t mode = 0; + fhandler_base *fh = NULL; pthread_testcancel (); @@ -1368,69 +1369,66 @@ open (const char *unix_path, int flags, ...) { syscall_printf ("open(%s, %y)", unix_path, flags); if (!*unix_path) - set_errno (ENOENT); - else { - /* check for optional mode argument */ - va_start (ap, flags); - mode = va_arg (ap, mode_t); - va_end (ap); - - fhandler_base *fh; - cygheap_fdnew fd; - - if (fd >= 0) - { - /* This is a temporary kludge until all utilities can catch up - with a change in behavior that implements linux functionality: - opening a tty should not automatically cause it to become the - controlling tty for the process. */ - int opt = PC_OPEN | ((flags & (O_NOFOLLOW | O_EXCL)) - ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW); - if (!(flags & O_NOCTTY) && fd > 2 && myself->ctty != -2) - { - flags |= O_NOCTTY; - /* flag that, if opened, this fhandler could later be capable - of being a controlling terminal if /dev/tty is opened. */ - opt |= PC_CTTY; - } - if (!(fh = build_fh_name (unix_path, opt, stat_suffixes))) - ; // errno already set - else if ((flags & O_NOFOLLOW) && fh->issymlink ()) - { - delete fh; - set_errno (ELOOP); - } - else if ((flags & O_DIRECTORY) && fh->exists () - && !fh->pc.isdir ()) - { - delete fh; - set_errno (ENOTDIR); - } - else if (((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) - && fh->exists ()) - { - delete fh; - set_errno (EEXIST); - } - else if ((fh->is_fs_special () - && fh->device_access_denied (flags)) - || !fh->open_with_arch (flags, mode & 07777)) - delete fh; - else - { - fd = fh; - if (fd <= 2) - set_std_handle (fd); - res = fd; - } - } + set_errno (ENOENT); + __leave; } - syscall_printf ("%R = open(%s, %y)", res, unix_path, flags); + /* check for optional mode argument */ + va_start (ap, flags); + mode = va_arg (ap, mode_t); + va_end (ap); + + cygheap_fdnew fd; + + if (fd < 0) + __leave; /* errno already set */ + + /* This is a temporary kludge until all utilities can catch up + with a change in behavior that implements linux functionality: + opening a tty should not automatically cause it to become the + controlling tty for the process. */ + int opt = PC_OPEN | ((flags & (O_NOFOLLOW | O_EXCL)) + ? PC_SYM_NOFOLLOW : PC_SYM_FOLLOW); + if (!(flags & O_NOCTTY) && fd > 2 && myself->ctty != -2) + { + flags |= O_NOCTTY; + /* flag that, if opened, this fhandler could later be capable + of being a controlling terminal if /dev/tty is opened. */ + opt |= PC_CTTY; + } + + if (!(fh = build_fh_name (unix_path, opt, stat_suffixes))) + __leave; /* errno already set */ + if ((flags & O_NOFOLLOW) && fh->issymlink ()) + { + set_errno (ELOOP); + __leave; + } + if ((flags & O_DIRECTORY) && fh->exists () && !fh->pc.isdir ()) + { + set_errno (ENOTDIR); + __leave; + } + if (((flags & (O_CREAT | O_EXCL)) == (O_CREAT | O_EXCL)) && fh->exists ()) + { + set_errno (EEXIST); + __leave; + } + if ((fh->is_fs_special () && fh->device_access_denied (flags)) + || !fh->open_with_arch (flags, mode & 07777)) + __leave; /* errno already set */ + + fd = fh; + if (fd <= 2) + set_std_handle (fd); + res = fd; } __except (EFAULT) {} __endtry + if (res < 0 && fh) + delete fh; + syscall_printf ("%R = open(%s, %y)", res, unix_path, flags); return res; } From 0aa99373c1d01b19a7f8ba53e8c7749358480f3e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 21:28:45 +0100 Subject: [PATCH 091/649] Cygwin: fcntl.h: Define O_TMPFILE and implement it Difference to Linux: We can't create files which don't show up in the filesystem due to OS restrictions. As a kludge, make a (half-hearted) attempt to hide the file in the filesystem. Signed-off-by: Corinna Vinschen --- newlib/libc/include/sys/_default_fcntl.h | 2 ++ winsup/cygwin/fhandler.cc | 21 +++++++++-- winsup/cygwin/fhandler_disk_file.cc | 39 ++++++++++++++++++++- winsup/cygwin/syscalls.cc | 44 ++++++++++++++++++++++++ 4 files changed, 103 insertions(+), 3 deletions(-) diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h index ede90c4bc..09580754b 100644 --- a/newlib/libc/include/sys/_default_fcntl.h +++ b/newlib/libc/include/sys/_default_fcntl.h @@ -52,6 +52,7 @@ extern "C" { #define _FNOFOLLOW 0x100000 #define _FDIRECTORY 0x200000 #define _FEXECSRCH 0x400000 +#define _FTMPFILE 0x800000 #define O_BINARY _FBINARY #define O_TEXT _FTEXT @@ -63,6 +64,7 @@ extern "C" { #define O_DIRECTORY _FDIRECTORY #define O_EXEC _FEXECSRCH #define O_SEARCH _FEXECSRCH +#define O_TMPFILE _FTMPFILE #endif #if __MISC_VISIBLE diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 5b7d002bd..7e8f509b8 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -137,6 +137,11 @@ fhandler_base::set_name (path_conv &in_pc) char *fhandler_base::get_proc_fd_name (char *buf) { + /* If the file had been opened with O_TMPFILE | O_EXCL, don't + expose the filename. linkat is supposed to return ENOENT in this + case. See man 2 open on Linux. */ + if ((get_flags () & (O_TMPFILE | O_EXCL)) == (O_TMPFILE | O_EXCL)) + return strcpy (buf, ""); if (get_name ()) return strcpy (buf, get_name ()); if (dev ().name ()) @@ -582,7 +587,7 @@ fhandler_base::open (int flags, mode_t mode) /* Don't use the FILE_OVERWRITE{_IF} flags here. See below for an explanation, why that's not such a good idea. */ - if ((flags & O_EXCL) && (flags & O_CREAT)) + if (((flags & O_EXCL) && (flags & O_CREAT)) || (flags & O_TMPFILE)) create_disposition = FILE_CREATE; else create_disposition = (flags & O_CREAT) ? FILE_OPEN_IF : FILE_OPEN; @@ -594,6 +599,18 @@ fhandler_base::open (int flags, mode_t mode) if (pc.is_rep_symlink ()) options |= FILE_OPEN_REPARSE_POINT; + /* O_TMPFILE files are created with delete-on-close semantics, as well + as with FILE_ATTRIBUTE_TEMPORARY. The latter speeds up file access, + because the OS tries to keep the file in memory as much as possible. + In conjunction with FILE_DELETE_ON_CLOSE, ideally the OS never has + to write to the disk at all. */ + if (flags & O_TMPFILE) + { + access |= DELETE; + file_attributes |= FILE_ATTRIBUTE_TEMPORARY; + options |= FILE_DELETE_ON_CLOSE; + } + if (pc.fs_is_nfs ()) { /* Make sure we can read EAs of files on an NFS share. Also make @@ -617,7 +634,7 @@ fhandler_base::open (int flags, mode_t mode) && has_attribute (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) file_attributes |= pc.file_attributes (); - if (flags & O_CREAT) + if (flags & (O_CREAT | O_TMPFILE)) { file_attributes |= FILE_ATTRIBUTE_NORMAL; diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 8f5795206..2f96740e8 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1248,6 +1248,37 @@ fhandler_disk_file::link (const char *newpath) return -1; } } + else if (pc.file_attributes () & FILE_ATTRIBUTE_TEMPORARY) + { + /* If the original file has been opened with O_TMPFILE the file has + FILE_ATTRIBUTE_TEMPORARY set. After a successful hardlink the + file is not temporary anymore in the usual sense. So we remove + FILE_ATTRIBUTE_TEMPORARY here, even if this makes the original file + visible in directory enumeration. */ + OBJECT_ATTRIBUTES attr; + status = NtOpenFile (&fh, FILE_WRITE_ATTRIBUTES, + pc.init_reopen_attr (attr, fh), &io, + FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); + if (!NT_SUCCESS (status)) + debug_printf ("Opening for removing TEMPORARY attrib failed, " + "status = %y", status); + else + { + FILE_BASIC_INFORMATION fbi; + + fbi.CreationTime.QuadPart = fbi.LastAccessTime.QuadPart + = fbi.LastWriteTime.QuadPart = fbi.ChangeTime.QuadPart = 0LL; + fbi.FileAttributes = (pc.file_attributes () + & ~FILE_ATTRIBUTE_TEMPORARY) + ?: FILE_ATTRIBUTE_NORMAL; + status = NtSetInformationFile (fh, &io, &fbi, sizeof fbi, + FileBasicInformation); + if (!NT_SUCCESS (status)) + debug_printf ("Removing the TEMPORARY attrib failed, status = %y", + status); + NtClose (fh); + } + } return 0; } @@ -2064,12 +2095,14 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de) PFILE_ID_BOTH_DIR_INFORMATION buf = NULL; PWCHAR FileName; ULONG FileNameLength; - ULONG FileAttributes = 0; + ULONG FileAttributes; IO_STATUS_BLOCK io; UNICODE_STRING fname; /* d_cachepos always refers to the next cache entry to use. If it's 0 we must reload the cache. */ +restart: + FileAttributes = 0; if (d_cachepos (dir) == 0) { if ((dir->__flags & dirent_get_d_ino)) @@ -2183,6 +2216,10 @@ go_ahead: FileAttributes = ((PFILE_BOTH_DIR_INFORMATION) buf)->FileAttributes; } + /* We don't show O_TMPFILE files in the filesystem. This is a kludge, + so we may end up removing this snippet again. */ + if (FileAttributes & FILE_ATTRIBUTE_TEMPORARY) + goto restart; RtlInitCountedUnicodeString (&fname, FileName, FileNameLength); d_mounts (dir)->check_mount (&fname); if (de->d_ino == 0 && (dir->__flags & dirent_set_d_ino)) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index aa796d3e8..c0bc3ccf4 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -36,6 +36,7 @@ details. */ #include #include #include +#include #include "ntdll.h" #undef fstat @@ -1415,6 +1416,49 @@ open (const char *unix_path, int flags, ...) set_errno (EEXIST); __leave; } + if (flags & O_TMPFILE) + { + if ((flags & O_ACCMODE) != O_WRONLY && (flags & O_ACCMODE) != O_RDWR) + { + set_errno (EINVAL); + __leave; + } + if (!fh->pc.isdir ()) + { + set_errno (fh->exists () ? ENOTDIR : ENOENT); + __leave; + } + /* Unfortunately Windows does not allow to create a nameless file. + So create unique filename instead. It starts with ".cyg_tmp_", + followed by an 8 byte unique hex number, followed by an 8 byte + random hex number. */ + int64_t rnd; + fhandler_base *fh_file; + char *new_path; + + new_path = (char *) malloc (strlen (fh->get_name ()) + + 1 /* slash */ + + 10 /* prefix */ + + 16 /* 64 bit unique id as hex*/ + + 16 /* 64 bit random number as hex */ + + 1 /* trailing NUL */); + if (!new_path) + __leave; + fh->set_unique_id (); + RtlGenRandom (&rnd, sizeof rnd); + __small_sprintf (new_path, "%s/%s%016X%016X", + fh->get_name (), ".cyg_tmp_", + fh->get_unique_id (), rnd); + + if (!(fh_file = build_fh_name (new_path, opt, NULL))) + { + free (new_path); + __leave; /* errno already set */ + } + delete fh; + fh = fh_file; + } + if ((fh->is_fs_special () && fh->device_access_denied (flags)) || !fh->open_with_arch (flags, mode & 07777)) __leave; /* errno already set */ From f9d071aaf8fdabc610aa3d595c06ca795c019e28 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 21:29:37 +0100 Subject: [PATCH 092/649] Cygwin: fcntl.h: Define O_NOATIME Signed-off-by: Corinna Vinschen --- newlib/libc/include/sys/_default_fcntl.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h index 09580754b..7c07e3efa 100644 --- a/newlib/libc/include/sys/_default_fcntl.h +++ b/newlib/libc/include/sys/_default_fcntl.h @@ -53,6 +53,7 @@ extern "C" { #define _FDIRECTORY 0x200000 #define _FEXECSRCH 0x400000 #define _FTMPFILE 0x800000 +#define _FNOATIME 0x1000000 #define O_BINARY _FBINARY #define O_TEXT _FTEXT @@ -65,6 +66,7 @@ extern "C" { #define O_EXEC _FEXECSRCH #define O_SEARCH _FEXECSRCH #define O_TMPFILE _FTMPFILE +#define O_NOATIME _FNOATIME #endif #if __MISC_VISIBLE From baaceb8f37ad65ea9bb735bc154859e032d9fef4 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 21:31:31 +0100 Subject: [PATCH 093/649] Cygwin: fcntl.h: Use test macros to guard non-standard open flags Signed-off-by: Corinna Vinschen --- newlib/libc/include/sys/_default_fcntl.h | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h index 7c07e3efa..006e4efd5 100644 --- a/newlib/libc/include/sys/_default_fcntl.h +++ b/newlib/libc/include/sys/_default_fcntl.h @@ -57,17 +57,25 @@ extern "C" { #define O_BINARY _FBINARY #define O_TEXT _FTEXT -#define O_CLOEXEC _FNOINHERIT -#define O_DIRECT _FDIRECT -#define O_NOFOLLOW _FNOFOLLOW #define O_DSYNC _FSYNC #define O_RSYNC _FSYNC -#define O_DIRECTORY _FDIRECTORY #define O_EXEC _FEXECSRCH #define O_SEARCH _FEXECSRCH + +/* POSIX-1.2008 specific flags */ +#if __POSIX_VISIBLE >= 200809 +#define O_CLOEXEC _FNOINHERIT +#define O_NOFOLLOW _FNOFOLLOW +#define O_DIRECTORY _FDIRECTORY +#endif + +/* Linux-specific flags */ +#if __GNU_VISIBLE +#define O_DIRECT _FDIRECT #define O_TMPFILE _FTMPFILE #define O_NOATIME _FNOATIME #endif +#endif #if __MISC_VISIBLE From ce0b11f9c4d684cc136015d1bc1769ac193a6b0b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 21:36:38 +0100 Subject: [PATCH 094/649] Cygwin: Bump DLL version to 2.10.0, bump API minor to 319 Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/cygwin/version.h | 7 ++++--- winsup/cygwin/release/{2.9.1 => 2.10.0} | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-) rename winsup/cygwin/release/{2.9.1 => 2.10.0} (90%) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 7b95de3ee..8b85f863f 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -10,8 +10,8 @@ details. */ the Cygwin shared library". This version is used to track important changes to the DLL and is mainly informative in nature. */ -#define CYGWIN_VERSION_DLL_MAJOR 2009 -#define CYGWIN_VERSION_DLL_MINOR 1 +#define CYGWIN_VERSION_DLL_MAJOR 2010 +#define CYGWIN_VERSION_DLL_MINOR 0 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ @@ -483,12 +483,13 @@ details. */ 316: Export pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock. 317: Export renameat2. 318: Export strnstr. + 319: Define O_TMPFILE, O_NOATIME. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 318 +#define CYGWIN_VERSION_API_MINOR 319 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/release/2.9.1 b/winsup/cygwin/release/2.10.0 similarity index 90% rename from winsup/cygwin/release/2.9.1 rename to winsup/cygwin/release/2.10.0 index e01515f1d..8c90353c8 100644 --- a/winsup/cygwin/release/2.9.1 +++ b/winsup/cygwin/release/2.10.0 @@ -1,6 +1,8 @@ What's new: ----------- +- New open(2) flags O_TMPFILE and O_NOATIME. + What changed: ------------- From 0b0b2b96f2039403e456b1c84f6300cdef0696c0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 21:29:08 +0100 Subject: [PATCH 095/649] Cygwin: link: Simplify an expression Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_disk_file.cc | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 2f96740e8..5dfcae4d9 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1237,16 +1237,11 @@ fhandler_disk_file::link (const char *newpath) { if (status == STATUS_INVALID_DEVICE_REQUEST || status == STATUS_NOT_SUPPORTED) - { - /* FS doesn't support hard links. Linux returns EPERM. */ - set_errno (EPERM); - return -1; - } + /* FS doesn't support hard links. Linux returns EPERM. */ + set_errno (EPERM); else - { - __seterrno_from_nt_status (status); - return -1; - } + __seterrno_from_nt_status (status); + return -1; } else if (pc.file_attributes () & FILE_ATTRIBUTE_TEMPORARY) { From 0d57ef9de5e2e5b12694169ab0a3c4203e1aa605 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 14 Nov 2017 21:50:32 +0100 Subject: [PATCH 096/649] Cygwin: open: Remove unused code to handle HIDDEN and SYSTEM files Commit 603ef545bdbdbf7495e1a0bbabffb8741fc2a5bb broke this snippet and commit 5b312b4747cc4acda39c187369c02fcea456513b didn't help at all since FILE_CREATE is exactly *not* the situation the test was originally supposed to handle. In fact, none of the open flags used by fhandler_base::open actually hits this problem anymore, so just drop the code. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.cc | 8 -------- 1 file changed, 8 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 7e8f509b8..7da1c4e84 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -626,14 +626,6 @@ fhandler_base::open (int flags, mode_t mode) } } - /* Trying to overwrite an already existing file with FILE_ATTRIBUTE_HIDDEN - and/or FILE_ATTRIBUTE_SYSTEM attribute set, NtCreateFile fails with - STATUS_ACCESS_DENIED. Per MSDN you have to create the file with the - same attributes as already specified for the file. */ - if (create_disposition == FILE_CREATE - && has_attribute (FILE_ATTRIBUTE_HIDDEN | FILE_ATTRIBUTE_SYSTEM)) - file_attributes |= pc.file_attributes (); - if (flags & (O_CREAT | O_TMPFILE)) { file_attributes |= FILE_ATTRIBUTE_NORMAL; From 0f88d21e4de242bacca223d597d78f29b474d557 Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Tue, 14 Nov 2017 23:01:42 -0700 Subject: [PATCH 097/649] Cygwin: Add FAQ How do I fix find_fast_cwd warnings? --- winsup/doc/faq-using.xml | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/winsup/doc/faq-using.xml b/winsup/doc/faq-using.xml index b6b152e4e..f583b36ef 100644 --- a/winsup/doc/faq-using.xml +++ b/winsup/doc/faq-using.xml @@ -1419,4 +1419,54 @@ such as virtual memory paging and file caching. difficult to make fork() work reliably. + + + How do I fix find_fast_cwd warnings? + + Older Cygwin releases asked users to report problems to the mailing + list with the message: + + find_fast_cwd: WARNING: Couldn't compute FAST_CWD pointer. Please report + this problem to the public mailing list cygwin@cygwin.com + Recent Cygwin releases changed this to the message: + + This typically occurs if you're using an older Cygwin version on a newer Windows. + Please update to the latest available Cygwin version from https://cygwin.com/. + If the problem persists, please see https://cygwin.com/problems.html. + This is not serious, just a warning that Cygwin may not always be + able to exactly emulate all aspects of Unix current directory handling + under your Windows release. + Unfortunately some projects and products still distribute older + Cygwin releases which may not fully support newer Windows releases, + instead of installing the current release from the Cygwin project. + They also may not provide any obvious way to keep the Cygwin packages + their application uses up to date with fixes for security issues and + upgrades. + The solution is simply downloading and running Cygwin Setup, + following the instructions in the Internet Setup section of + + Setting Up Cygwin in the Cygwin User's Guide. + Please exit from all applications before running Cygwin Setup. + When running Setup, you should not change most of the values presented, + just select the Next button in most cases, as you + already have a Cygwin release installed, and only want to upgrade your + current installation. + You should make your own selection if the internet connection to your + system requires a proxy; and you must always pick an up to date Cygwin + download (mirror) site, preferably the site nearest to your system for + faster downloads, as shown, with more details to help you choose, on the + + Mirror Sites web page. + Cygwin Setup will download and apply upgrades to all packages + required for Cygwin itself and installed applications. + Any problems with applying updates, or the application after updates, + should be reported to the project or product supplier for remedial + action. + As Cygwin is a volunteer project, unable to provide support for older + releases installed by projects or products, it would be helpful to let + other users know what project or product you installed, in a quick + + email. + + From 57732f9b4b4b7b10740ebd24bd85663ea6a096a1 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 15 Nov 2017 20:11:05 +0100 Subject: [PATCH 098/649] Cygwin: pipe_data_available: cleanup code * Don't use a bool var to store three states (-1, 0, 1). * Correctly check for NT_SUCCESS of a function returning NTSTATUS. * Straighten out code for better readability. Signed-off-by: Corinna Vinschen --- winsup/cygwin/select.cc | 67 ++++++++++++++++++++++++----------------- 1 file changed, 40 insertions(+), 27 deletions(-) diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index f5a993850..0cd2dc929 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -568,45 +568,58 @@ pipe_data_available (int fd, fhandler_base *fh, HANDLE h, bool writing) { IO_STATUS_BLOCK iosb = {{0}, 0}; FILE_PIPE_LOCAL_INFORMATION fpli = {0}; + NTSTATUS status; - bool res; if (fh->has_ongoing_io ()) - res = false; - else if (NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli), - FilePipeLocalInformation)) + return 0; + + status = NtQueryInformationFile (h, &iosb, &fpli, sizeof (fpli), + FilePipeLocalInformation); + if (!NT_SUCCESS (status)) { /* If NtQueryInformationFile fails, optimistically assume the pipe is writable. This could happen if we somehow inherit a pipe that doesn't permit FILE_READ_ATTRIBUTES access on the write end. */ - select_printf ("fd %d, %s, NtQueryInformationFile failed", - fd, fh->get_name ()); - res = writing ? true : -1; + select_printf ("fd %d, %s, NtQueryInformationFile failed, status %y", + fd, fh->get_name (), status); + return writing ? 1 : -1; } - else if (!writing) + if (writing) + { + /* If there is anything available in the pipe buffer then signal + that. This means that a pipe could still block since you could + be trying to write more to the pipe than is available in the + buffer but that is the hazard of select(). */ + fpli.WriteQuotaAvailable = fpli.OutboundQuota - fpli.ReadDataAvailable; + if (fpli.WriteQuotaAvailable > 0) + { + paranoid_printf ("fd %d, %s, write: size %u, avail %u", fd, + fh->get_name (), fpli.OutboundQuota, + fpli.WriteQuotaAvailable); + return 1; + } + /* If we somehow inherit a tiny pipe (size < PIPE_BUF), then consider + the pipe writable only if it is completely empty, to minimize the + probability that a subsequent write will block. */ + if (fpli.OutboundQuota < PIPE_BUF + && fpli.WriteQuotaAvailable == fpli.OutboundQuota) + { + select_printf ("fd, %s, write tiny pipe: size %u, avail %u", + fd, fh->get_name (), fpli.OutboundQuota, + fpli.WriteQuotaAvailable); + return 1; + } + } + else if (fpli.ReadDataAvailable) { paranoid_printf ("fd %d, %s, read avail %u", fd, fh->get_name (), fpli.ReadDataAvailable); - res = !!fpli.ReadDataAvailable; + return 1; } - else if ((res = (fpli.WriteQuotaAvailable = (fpli.OutboundQuota - - fpli.ReadDataAvailable)))) - /* If there is anything available in the pipe buffer then signal - that. This means that a pipe could still block since you could - be trying to write more to the pipe than is available in the - buffer but that is the hazard of select(). */ - paranoid_printf ("fd %d, %s, write: size %u, avail %u", fd, - fh->get_name (), fpli.OutboundQuota, - fpli.WriteQuotaAvailable); - else if ((res = (fpli.OutboundQuota < PIPE_BUF && - fpli.WriteQuotaAvailable == fpli.OutboundQuota))) - /* If we somehow inherit a tiny pipe (size < PIPE_BUF), then consider - the pipe writable only if it is completely empty, to minimize the - probability that a subsequent write will block. */ - select_printf ("fd, %s, write tiny pipe: size %u, avail %u", - fd, fh->get_name (), fpli.OutboundQuota, - fpli.WriteQuotaAvailable); - return res ?: -!!(fpli.NamedPipeState & FILE_PIPE_CLOSING_STATE); + if (fpli.NamedPipeState & FILE_PIPE_CLOSING_STATE) + return -1; + return 0; } static int From 0e3e3753776d715a6032440e428052f036a29fac Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 20 Nov 2017 08:52:09 +0100 Subject: [PATCH 099/649] RTEMS: Add missing functions to crt0 This helps to get some more features from libstdc++. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/crt0.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c index 0e9d426ec..a56527434 100644 --- a/newlib/libc/sys/rtems/crt0.c +++ b/newlib/libc/sys/rtems/crt0.c @@ -10,12 +10,13 @@ * but this is enough to satisfy the autoconf macro AC_PROG_CC. */ +#include +#include +#include #include - -#include /* sigset_t */ -#include /* struct timespec */ -#include /* isatty */ -#include /* _Mutex_recursive_Control */ +#include +#include +#include #include #include @@ -97,6 +98,7 @@ RTEMS_STUB(int, access(const char *pathname, int mode), { return -1; }) RTEMS_STUB(int, clock_gettime(clockid_t clk_id, struct timespec *tp), { return -1; }) RTEMS_STUB(int, close (int fd), { return -1; }) RTEMS_STUB(int, dup2(int oldfd, int newfd), { return -1; }) +RTEMS_STUB(int, fchmod(int fd, mode_t mode ), { return -1; }) RTEMS_STUB(int, fcntl( int fd, int cmd, ... /* arg */ ), { return -1; }) RTEMS_STUB(pid_t, fork(void), { return -1; }) RTEMS_STUB(int, fstat(int fd, struct stat *buf), { return -1; }) @@ -113,10 +115,12 @@ RTEMS_STUB(int, lstat(const char *path, struct stat *buf), { return -1; }) RTEMS_STUB(int, open(const char *pathname, int flags, int mode), { return -1; }) RTEMS_STUB(int, pipe(int pipefd[2]), { return -1; }) RTEMS_STUB(_ssize_t, read(int fd, void *buf, size_t count), { return -1; }) +RTEMS_STUB(ssize_t, readv (int fd, const struct iovec *iov, int iovcnt), { return -1; }) RTEMS_STUB(int, sched_yield(void), { return -1; }) RTEMS_STUB(int, sigfillset(sigset_t *set), { return -1; }) RTEMS_STUB(int, sigprocmask(int how, const sigset_t *set, sigset_t *oldset), { return -1; }) RTEMS_STUB(int, stat(const char *path, struct stat *buf), { return -1; }) +RTEMS_STUB(long, sysconf(int name), { return -1; }) RTEMS_STUB(int, unlink(const char *pathname), { return -1; }) RTEMS_STUB(pid_t, vfork(void), { return -1; }) #if !defined(_NO_POPEN) && !defined(_NO_WORDEXP) @@ -124,6 +128,7 @@ RTEMS_STUB(pid_t, vfork(void), { return -1; }) RTEMS_STUB(int, waitpid (pid_t pid, int *status, int options), { return -1; }) #endif RTEMS_STUB(_ssize_t, write (int fd, const void *buf, size_t nbytes), { return -1; }) +RTEMS_STUB(ssize_t, writev (int fd, const struct iovec *iov, int iovcnt), { return -1; }) /* stubs for functions from reent.h */ RTEMS_STUB(int, _close_r (struct _reent *r, int fd), { return -1; }) From 6480987f3a845881789499e13bf52aadc0b241e1 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Mon, 20 Nov 2017 10:10:40 +0100 Subject: [PATCH 100/649] RTEMS: Add missing __getreent() to crt0 Default implementation was removed for RTEMS by b1a388799dc98e6d1451fb73aa71097cbf9f37d9. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/crt0.c | 1 + 1 file changed, 1 insertion(+) diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c index a56527434..9778b985a 100644 --- a/newlib/libc/sys/rtems/crt0.c +++ b/newlib/libc/sys/rtems/crt0.c @@ -146,6 +146,7 @@ RTEMS_STUB(int, _fstat_r (struct _reent *r, int fd, struct stat *buf), { return RTEMS_STUB(uid_t, geteuid (), { return -1; }) RTEMS_STUB(gid_t, getgid (), { return -1; }) RTEMS_STUB(gid_t, _getgid_r (struct _reent *r), { return -1; }) +RTEMS_STUB(struct _reent *, __getreent (void), { return 0; }) RTEMS_STUB(pid_t, getpid (), { return -1; }) RTEMS_STUB(pid_t, getppid (), { return -1; }) RTEMS_STUB(pid_t, _getpid_r (struct _reent *r), { return -1; }) From 569d048c892bcfd99707a351b8a345b2b977a0b6 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Wed, 22 Nov 2017 14:08:08 -0500 Subject: [PATCH 101/649] Add the Aarch64 SVE specific HWCAP_SVE define Checking in change from Alan Hayward Signed-off-by: Jeff Johnston --- newlib/libc/include/elf.h | 1 + 1 file changed, 1 insertion(+) diff --git a/newlib/libc/include/elf.h b/newlib/libc/include/elf.h index 1b62db530..79d3b974b 100644 --- a/newlib/libc/include/elf.h +++ b/newlib/libc/include/elf.h @@ -686,6 +686,7 @@ typedef struct { #define NT_ARM_HW_BREAK 0x402 #define NT_ARM_HW_WATCH 0x403 #define NT_ARM_SYSTEM_CALL 0x404 +#define NT_ARM_SVE 0x405 #define NT_METAG_CBUF 0x500 #define NT_METAG_RPIPE 0x501 #define NT_METAG_TLS 0x502 From 9789cdffde8bd365ca8fa94e924c870fa043e28a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 27 Nov 2017 13:38:21 +0100 Subject: [PATCH 102/649] cygwin: cleanup fhandler_socket::release_events Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index b8e684fd8..cc75b9719 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -801,14 +801,16 @@ fhandler_socket::wait_for_events (const long event_mask, const DWORD flags) void fhandler_socket::release_events () { - HANDLE evt = wsock_evt; - HANDLE mtx = wsock_mtx; + if (WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) + { + HANDLE evt = wsock_evt; + HANDLE mtx = wsock_mtx; - LOCK_EVENTS; - wsock_evt = wsock_mtx = NULL; - } ReleaseMutex (mtx); /* == UNLOCK_EVENTS, but note using local mtx here. */ - NtClose (evt); - NtClose (mtx); + wsock_evt = wsock_mtx = NULL; + ReleaseMutex (mtx); + NtClose (evt); + NtClose (mtx); + } } /* Called from net.cc:fdsock() if a freshly created socket is not From bc14f1c17487244f9a3c0fccd3400788635a0d48 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 27 Nov 2017 13:38:43 +0100 Subject: [PATCH 103/649] cygwin: improve tags generation Signed-off-by: Corinna Vinschen --- winsup/cygwin/Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index add1de0e9..bc452087f 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -774,7 +774,10 @@ sigfe.o: sigfe.s $(srcdir)/$(TLSOFFSETS_H) ctags: CTAGS tags: CTAGS CTAGS: - -cd $(srcdir) && ctags -R --regex-C++='/^([a-zA-Z0-9_]*::[a-zA-Z0-9_]*) /\1/f/' . + -cd $(srcdir) && \ + ctags -R --c++-kinds=+p --fields=+iaS --extra=+q \ + --regex-C++='/EXPORT_ALIAS *\([[a-zA-Z0-9_]*, *([a-zA-Z0-9_]*)\)/\1/' \ + @newlib_headers@ . deps:=${wildcard *.d} ifneq (,$(deps)) From 76f06705be30663cf823170fe66c9560c9d24566 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 27 Nov 2017 14:36:06 +0100 Subject: [PATCH 104/649] cygwin: convert most #ifndef __x86_64__ to #ifdef __i386__ Address the real offender Signed-off-by: Corinna Vinschen --- winsup/cygwin/autoload.cc | 8 +- winsup/cygwin/dcrt0.cc | 10 +-- winsup/cygwin/dlfcn.cc | 4 +- winsup/cygwin/dll_init.cc | 10 +-- winsup/cygwin/dll_init.h | 4 +- winsup/cygwin/environ.cc | 2 +- winsup/cygwin/exception.h | 6 +- winsup/cygwin/exceptions.cc | 4 +- winsup/cygwin/external.cc | 2 +- winsup/cygwin/fcntl.cc | 8 +- winsup/cygwin/globals.cc | 8 +- winsup/cygwin/grp.cc | 8 +- winsup/cygwin/include/a.out.h | 2 +- winsup/cygwin/include/cygwin/grp.h | 2 +- winsup/cygwin/include/cygwin/stat.h | 2 +- winsup/cygwin/include/sys/cygwin.h | 6 +- winsup/cygwin/include/sys/dirent.h | 8 +- winsup/cygwin/lib/_cygwin_crt0_common.cc | 4 +- winsup/cygwin/miscfuncs.cc | 2 +- winsup/cygwin/mmap.cc | 8 +- winsup/cygwin/passwd.cc | 8 +- winsup/cygwin/path.cc | 8 +- winsup/cygwin/sec_acl.cc | 28 +++---- winsup/cygwin/security.h | 2 +- winsup/cygwin/syscalls.cc | 98 ++++++++++++------------ winsup/cygwin/uinfo.cc | 24 +++--- winsup/cygwin/winsup.h | 4 +- 27 files changed, 140 insertions(+), 140 deletions(-) diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 02d2e67d7..349f5e7b3 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -401,7 +401,7 @@ __attribute__ ((used, noinline)) static two_addr_t std_dll_init () #endif { -#ifndef __x86_64__ +#ifdef __i386__ struct func_info *func = (struct func_info *) __builtin_return_address (0); #endif struct dll_info *dll = func->dll; @@ -453,7 +453,7 @@ std_dll_init () InterlockedDecrement (&dll->here); -#ifndef __x86_64__ +#ifdef __i386__ /* Kludge alert. Redirects the return address to dll_chain. */ uintptr_t *volatile frame = (uintptr_t *) __builtin_frame_address (0); frame[1] = (uintptr_t) dll_chain; @@ -480,7 +480,7 @@ wsock_init () See the git log for a description. */ static WSADATA NO_COPY wsadata; static LONG NO_COPY here = -1L; -#ifndef __x86_64__ +#ifdef __i386__ struct func_info *func = (struct func_info *) __builtin_return_address (0); #endif struct dll_info *dll = func->dll; @@ -514,7 +514,7 @@ wsock_init () } } -#ifndef __x86_64__ +#ifdef __i386__ /* Kludge alert. Redirects the return address to dll_chain. */ uintptr_t *volatile frame = (uintptr_t *) __builtin_frame_address (0); frame[1] = (uintptr_t) dll_chain; diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index ea6adcbbd..af5eaaca7 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -390,7 +390,7 @@ check_sanity_and_sync (per_process *p) api_fatal ("cygwin DLL and APP are out of sync -- API version mismatch %u > %u", p->api_major, cygwin_version.api_major); -#ifndef __x86_64__ +#ifdef __i386__ /* This is a kludge to work around a version of _cygwin_common_crt0 which overwrote the cxx_malloc field with the local DLL copy. Hilarity ensues if the DLL is not loaded while the process @@ -712,7 +712,7 @@ init_windows_system_directory () api_fatal ("can't find windows system directory"); windows_system_directory[windows_system_directory_length++] = L'\\'; windows_system_directory[windows_system_directory_length] = L'\0'; -#ifndef __x86_64__ +#ifdef __i386__ system_wow64_directory_length = GetSystemWow64DirectoryW (system_wow64_directory, MAX_PATH); if (system_wow64_directory_length) @@ -720,7 +720,7 @@ init_windows_system_directory () system_wow64_directory[system_wow64_directory_length++] = L'\\'; system_wow64_directory[system_wow64_directory_length] = L'\0'; } -#endif /* !__x86_64__ */ +#endif /* __i386__ */ } } @@ -1103,14 +1103,14 @@ dll_crt0 (per_process *uptr) extern "C" void cygwin_dll_init () { -#ifndef __x86_64__ +#ifdef __i386__ static char **envp; #endif static int _fmode; user_data->magic_biscuit = sizeof (per_process); -#ifndef __x86_64__ +#ifdef __i386__ user_data->envptr = &envp; #endif user_data->fmode_ptr = &_fmode; diff --git a/winsup/cygwin/dlfcn.cc b/winsup/cygwin/dlfcn.cc index 5b21b3214..7ef7dfd32 100644 --- a/winsup/cygwin/dlfcn.cc +++ b/winsup/cygwin/dlfcn.cc @@ -273,7 +273,7 @@ dlopen (const char *name, int flags) break; } -#ifndef __x86_64__ +#ifdef __i386__ /* Workaround for broken DLLs built against Cygwin versions 1.7.0-49 up to 1.7.0-57. They override the cxx_malloc pointer in their DLL initialization code even if loaded dynamically. This is a @@ -300,7 +300,7 @@ dlopen (const char *name, int flags) ++d->count; } -#ifndef __x86_64__ +#ifdef __i386__ /* Restore original cxx_malloc pointer. */ __cygwin_user_data.cxx_malloc = tmp_malloc; #endif diff --git a/winsup/cygwin/dll_init.cc b/winsup/cygwin/dll_init.cc index a9143e769..549e5cccd 100644 --- a/winsup/cygwin/dll_init.cc +++ b/winsup/cygwin/dll_init.cc @@ -84,7 +84,7 @@ dll::init () { int ret = 1; -#ifndef __x86_64__ +#ifdef __i386__ /* This should be a no-op. Why didn't we just import this variable? */ if (!p.envptr) p.envptr = &__cygwin_environ; @@ -243,7 +243,7 @@ dll_list::alloc (HINSTANCE h, per_process *p, dll_type type) loaded_dlls++; } guard (false); -#ifndef __x86_64__ +#ifdef __i386__ assert (p->envptr != NULL); #endif return d; @@ -725,7 +725,7 @@ dll_dllcrt0_1 (VOID *x) res = (PVOID) d; } -#ifndef __x86_64__ +#ifdef __i386__ /* OBSOLETE: This function is obsolete and will go away in the future. Cygwin can now handle being loaded from a noncygwin app using the same entry point. */ @@ -734,7 +734,7 @@ dll_noncygwin_dllcrt0 (HMODULE h, per_process *p) { return (int) dll_dllcrt0 (h, p); } -#endif /* !__x86_64__ */ +#endif /* __i386__ */ extern "C" void cygwin_detach_dll (dll *) @@ -753,7 +753,7 @@ dlfork (int val) dlls.reload_on_fork = val; } -#ifndef __x86_64__ +#ifdef __i386__ /* Called from various places to update all of the individual ideas of the environ block. Explain to me again why we didn't just import __cygwin_environ? */ diff --git a/winsup/cygwin/dll_init.h b/winsup/cygwin/dll_init.h index 8448813e1..862ad91b2 100644 --- a/winsup/cygwin/dll_init.h +++ b/winsup/cygwin/dll_init.h @@ -8,7 +8,7 @@ details. */ struct per_module { -#ifndef __x86_64__ +#ifdef __i386__ char ***envptr; #endif void (**ctors)(void); @@ -20,7 +20,7 @@ struct per_module int (*main)(int, char **, char **); per_module &operator = (per_process *p) { -#ifndef __x86_64__ +#ifdef __i386__ envptr = p->envptr; #endif ctors = p->ctors; diff --git a/winsup/cygwin/environ.cc b/winsup/cygwin/environ.cc index 10ffd689c..43225341c 100644 --- a/winsup/cygwin/environ.cc +++ b/winsup/cygwin/environ.cc @@ -1260,7 +1260,7 @@ build_env (const char * const *envp, PWCHAR &envblock, int &envc, return newenv; } -#ifndef __x86_64__ +#ifdef __i386__ /* This idiocy is necessary because the early implementers of cygwin did not seem to know about importing data variables from the DLL. So, we have to synchronize cygwin's idea of the environment with the diff --git a/winsup/cygwin/exception.h b/winsup/cygwin/exception.h index e4564b044..ffff7464b 100644 --- a/winsup/cygwin/exception.h +++ b/winsup/cygwin/exception.h @@ -6,7 +6,7 @@ details. */ #pragma once -#ifndef __x86_64__ +#ifdef __i386__ /* Documentation on the innards of 32 bit Windows exception handling (i.e. from the perspective of a compiler implementor) apparently doesn't exist. However, the following came from Onno Hovers @@ -123,7 +123,7 @@ public: ~exception () __attribute__ ((always_inline)) { _except_list = save; } }; -#else /* __x86_64__ */ +#else /* !__i386__ */ #define exception_list void typedef struct _DISPATCHER_CONTEXT *PDISPATCHER_CONTEXT; @@ -159,7 +159,7 @@ public: LONG CALLBACK myfault_altstack_handler (EXCEPTION_POINTERS *); -#endif /* !__x86_64__ */ +#endif /* __i386__ */ class cygwin_exception { diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index a3ee5cf71..47782e45b 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -434,7 +434,7 @@ _cygtls::inside_kernel (CONTEXT *cx) checkdir += 4; res = wcsncasecmp (windows_system_directory, checkdir, windows_system_directory_length) == 0; -#ifndef __x86_64__ +#ifdef __i386__ if (!res && system_wow64_directory_length) res = wcsncasecmp (system_wow64_directory, checkdir, system_wow64_directory_length) == 0; @@ -628,7 +628,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in, static int NO_COPY debugging = 0; _cygtls& me = _my_tls; -#ifndef __x86_64__ +#ifdef __i386__ if (me.andreas) me.andreas->leave (); /* Return from a "san" caught fault */ #endif diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc index 6aae32aea..3a9130efd 100644 --- a/winsup/cygwin/external.cc +++ b/winsup/cygwin/external.cc @@ -242,7 +242,7 @@ cygwin_internal (cygwin_getinfo_types t, ...) break; case CW_USER_DATA: -#ifndef __x86_64__ +#ifdef __i386__ /* This is a kludge to work around a version of _cygwin_common_crt0 which overwrote the cxx_malloc field with the local DLL copy. Hilarity ensues if the DLL is not loaded like while the process diff --git a/winsup/cygwin/fcntl.cc b/winsup/cygwin/fcntl.cc index 4859b131c..04eeaeb3b 100644 --- a/winsup/cygwin/fcntl.cc +++ b/winsup/cygwin/fcntl.cc @@ -79,10 +79,7 @@ fcntl64 (int fd, int cmd, ...) return res; } -#ifdef __x86_64__ -EXPORT_ALIAS (fcntl64, fcntl) -EXPORT_ALIAS (fcntl64, _fcntl) -#else +#ifdef __i386__ extern "C" int _fcntl (int fd, int cmd, ...) { @@ -121,4 +118,7 @@ _fcntl (int fd, int cmd, ...) __endtry return -1; } +#else +EXPORT_ALIAS (fcntl64, fcntl) +EXPORT_ALIAS (fcntl64, _fcntl) #endif diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc index 5c5d64ee4..d94a4f844 100644 --- a/winsup/cygwin/globals.cc +++ b/winsup/cygwin/globals.cc @@ -23,10 +23,10 @@ HMODULE NO_COPY hntdll; int NO_COPY sigExeced; WCHAR windows_system_directory[MAX_PATH]; UINT windows_system_directory_length; -#ifndef __x86_64__ +#ifdef __i386__ WCHAR system_wow64_directory[MAX_PATH]; UINT system_wow64_directory_length; -#endif /* !__x86_64__ */ +#endif /* __i386__ */ WCHAR global_progname[NT_MAX_PATH]; /* program exit the program */ @@ -154,7 +154,7 @@ const int __collate_load_error = 0; /* This is an exported copy of environ which can be used by DLLs which use cygwin.dll. */ char **__cygwin_environ; -#ifndef __x86_64__ +#ifdef __i386__ char ***main_environ = &__cygwin_environ; #endif /* __progname used in getopt error message */ @@ -167,7 +167,7 @@ const int __collate_load_error = 0; /* dll_major */ CYGWIN_VERSION_DLL_MAJOR, /* dll_major */ CYGWIN_VERSION_DLL_MINOR, /* impure_ptr_ptr */ NULL, -#ifndef __x86_64__ +#ifdef __i386__ /* envptr */ NULL, #endif /* malloc */ malloc, /* free */ free, diff --git a/winsup/cygwin/grp.cc b/winsup/cygwin/grp.cc index d66acad99..ca35a4bf4 100644 --- a/winsup/cygwin/grp.cc +++ b/winsup/cygwin/grp.cc @@ -237,7 +237,7 @@ internal_getgrgid (gid_t gid, cyg_ldap *pldap) return NULL; } -#ifndef __x86_64__ +#ifdef __i386__ static struct __group16 * grp32togrp16 (struct __group16 *gp16, struct group *gp32) { @@ -837,9 +837,7 @@ setgroups32 (int ngroups, const gid_t *grouplist) return 0; } -#ifdef __x86_64__ -EXPORT_ALIAS (setgroups32, setgroups) -#else +#ifdef __i386__ extern "C" int setgroups (int ngroups, const __gid16_t *grouplist) { @@ -855,4 +853,6 @@ setgroups (int ngroups, const __gid16_t *grouplist) } return setgroups32 (ngroups, grouplist32); } +#else +EXPORT_ALIAS (setgroups32, setgroups) #endif diff --git a/winsup/cygwin/include/a.out.h b/winsup/cygwin/include/a.out.h index 1a7a60be5..59fdd3dfb 100644 --- a/winsup/cygwin/include/a.out.h +++ b/winsup/cygwin/include/a.out.h @@ -391,7 +391,7 @@ typedef struct uint32_t bsize; /* uninitialized data " " */ uint32_t entry; /* entry pt. */ uint32_t text_start; /* base of text used for this file */ -#ifndef __x86_64__ +#ifdef __i386__ uint32_t data_start; /* base of all data used for this file */ #endif diff --git a/winsup/cygwin/include/cygwin/grp.h b/winsup/cygwin/include/cygwin/grp.h index 35265dbec..6efa29fc2 100644 --- a/winsup/cygwin/include/cygwin/grp.h +++ b/winsup/cygwin/include/cygwin/grp.h @@ -17,7 +17,7 @@ extern "C" { #endif #ifdef __INSIDE_CYGWIN__ -#ifndef __x86_64__ +#ifdef __i386__ struct __group16 { char *gr_name; diff --git a/winsup/cygwin/include/cygwin/stat.h b/winsup/cygwin/include/cygwin/stat.h index bbc58135c..0e489d7a9 100644 --- a/winsup/cygwin/include/cygwin/stat.h +++ b/winsup/cygwin/include/cygwin/stat.h @@ -33,7 +33,7 @@ struct stat }; #if defined (__INSIDE_CYGWIN__) || defined (_COMPILING_NEWLIB) -#ifndef __x86_64__ +#ifdef __i386__ struct __stat32 { __dev16_t st_dev; diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h index 5990e469a..c5da87c65 100644 --- a/winsup/cygwin/include/sys/cygwin.h +++ b/winsup/cygwin/include/sys/cygwin.h @@ -20,7 +20,7 @@ extern "C" { #define _CYGWIN_SIGNAL_STRING "cYgSiGw00f" -#ifndef __x86_64__ +#ifdef __i386__ /* DEPRECATED INTERFACES. These are restricted to MAX_PATH length. Don't use in modern applications. They don't exist on x86_64. */ extern int cygwin_win32_to_posix_path_list (const char *, char *) @@ -39,7 +39,7 @@ extern int cygwin_conv_to_posix_path (const char *, char *) __attribute__ ((__deprecated__)); extern int cygwin_conv_to_full_posix_path (const char *, char *) __attribute__ ((__deprecated__)); -#endif /* !__x86_64__ */ +#endif /* __i386__ */ /* Use these interfaces in favor of the above. */ @@ -310,7 +310,7 @@ struct per_process uint32_t dll_minor; struct _reent **impure_ptr_ptr; -#ifndef __x86_64__ +#ifdef __i386__ char ***envptr; #endif diff --git a/winsup/cygwin/include/sys/dirent.h b/winsup/cygwin/include/sys/dirent.h index 049e87ad0..48688efe4 100644 --- a/winsup/cygwin/include/sys/dirent.h +++ b/winsup/cygwin/include/sys/dirent.h @@ -15,7 +15,7 @@ #define __DIRENT_VERSION 2 -#ifndef __x86_64__ +#ifdef __i386__ #pragma pack(push,4) #endif #define _DIRENT_HAVE_D_TYPE @@ -28,7 +28,7 @@ struct dirent __uint32_t __d_internal1; char d_name[NAME_MAX + 1]; }; -#ifndef __x86_64__ +#ifdef __i386__ #pragma pack(pop) #endif @@ -40,7 +40,7 @@ struct dirent #define __DIRENT_COOKIE 0xdede4242 #endif -#ifndef __x86_64__ +#ifdef __i386__ #pragma pack(push,4) #endif typedef struct __DIR @@ -56,7 +56,7 @@ typedef struct __DIR void *__fh; unsigned __flags; } DIR; -#ifndef __x86_64__ +#ifdef __i386__ #pragma pack(pop) #endif diff --git a/winsup/cygwin/lib/_cygwin_crt0_common.cc b/winsup/cygwin/lib/_cygwin_crt0_common.cc index 612aa123d..c7e4eeac4 100644 --- a/winsup/cygwin/lib/_cygwin_crt0_common.cc +++ b/winsup/cygwin/lib/_cygwin_crt0_common.cc @@ -61,7 +61,7 @@ extern int __dynamically_loaded; extern "C" { -#ifndef __x86_64__ +#ifdef __i386__ char **environ; #endif int _fmode; @@ -114,7 +114,7 @@ _cygwin_crt0_common (MainFunc f, per_process *u) u->ctors = &__CTOR_LIST__; u->dtors = &__DTOR_LIST__; -#ifndef __x86_64__ +#ifdef __i386__ u->envptr = &environ; #endif if (uwasnull) diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index e2ab7a080..a6404c85e 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -399,7 +399,7 @@ pthread_wrapper (PVOID arg) /* Initialize new _cygtls. */ _my_tls.init_thread (wrapper_arg.stackbase - CYGTLS_PADSIZE, (DWORD (*)(void*, void*)) wrapper_arg.func); -#ifndef __x86_64__ +#ifdef __i386__ /* Copy exception list over to new stack. I'm not quite sure how the exception list is extended by Windows itself. What's clear is that it always grows downwards and that it starts right at the stackbase. diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 24bc162b5..4218466f0 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1065,7 +1065,7 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, off_t off) Note that this isn't done in 64 bit environments since apparently 64 bit systems don't support the AT_ROUND_TO_PAGE flag, which is required to get this right. Too bad. */ -#ifndef __x86_64__ +#ifdef __i386__ if (!wincap.is_wow64 () && (((off_t) len > fsiz && !autogrow (flags)) || roundup2 (len, wincap.page_size ()) @@ -1228,14 +1228,14 @@ out: return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (mmap64, mmap) -#else +#ifdef __i386__ extern "C" void * mmap (void *addr, size_t len, int prot, int flags, int fd, _off_t off) { return mmap64 (addr, len, prot, flags, fd, (off_t)off); } +#else +EXPORT_ALIAS (mmap64, mmap) #endif /* munmap () removes all mmapped pages between addr and addr+len. */ diff --git a/winsup/cygwin/passwd.cc b/winsup/cygwin/passwd.cc index d2f7b2c2e..e58f80e91 100644 --- a/winsup/cygwin/passwd.cc +++ b/winsup/cygwin/passwd.cc @@ -225,14 +225,14 @@ getpwuid32 (uid_t uid) return getpw_cp (temppw); } -#ifdef __x86_64__ -EXPORT_ALIAS (getpwuid32, getpwuid) -#else +#ifdef __i386__ extern "C" struct passwd * getpwuid (__uid16_t uid) { return getpwuid32 (uid16touid32 (uid)); } +#else +EXPORT_ALIAS (getpwuid32, getpwuid) #endif extern "C" int @@ -754,7 +754,7 @@ endpwent_filtered (void *pw) ((pw_ent *) pw)->endpwent (); } -#ifndef __x86_64__ +#ifdef __i386__ extern "C" struct passwd * getpwduid (__uid16_t) { diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 475c99599..cf6422341 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -3551,7 +3551,7 @@ cygwin_create_path (cygwin_conv_path_t what, const void *from) return to; } -#ifndef __x86_64__ /* Disable deprecated functions on x86_64. */ +#ifdef __i386__ extern "C" int cygwin_conv_to_win32_path (const char *path, char *win32_path) @@ -3583,7 +3583,7 @@ cygwin_conv_to_full_posix_path (const char *path, char *posix_path) MAX_PATH); } -#endif /* !__x86_64__ */ +#endif /* __i386__ */ /* The realpath function is required by POSIX:2008. */ @@ -3733,7 +3733,7 @@ env_PATH_to_posix (const void *win32, void *posix, size_t size) size, ENV_CVT)); } -#ifndef __x86_64__ /* Disable deprecated functions on x86_64. */ +#ifdef __i386__ extern "C" int cygwin_win32_to_posix_path_list_buf_size (const char *path_list) @@ -3761,7 +3761,7 @@ cygwin_posix_to_win32_path_list (const char *posix, char *win32) CCP_POSIX_TO_WIN_A | CCP_RELATIVE)); } -#endif /* !__x86_64__ */ +#endif /* __i386__ */ extern "C" ssize_t cygwin_conv_path_list (cygwin_conv_path_t what, const void *from, void *to, diff --git a/winsup/cygwin/sec_acl.cc b/winsup/cygwin/sec_acl.cc index 4a47d22b1..ce7910ed8 100644 --- a/winsup/cygwin/sec_acl.cc +++ b/winsup/cygwin/sec_acl.cc @@ -1227,7 +1227,7 @@ acl32 (const char *path, int cmd, int nentries, aclent_t *aclbufp) return res; } -#ifndef __x86_64__ +#ifdef __i386__ extern "C" int lacl32 (const char *path, int cmd, int nentries, aclent_t *aclbufp) { @@ -1969,18 +1969,7 @@ aclfromtext32 (char *acltextp, int *aclcnt) return (aclent_t *) __aclfromtext (acltextp, aclcnt, false); } -#ifdef __x86_64__ -EXPORT_ALIAS (acl32, acl) -EXPORT_ALIAS (facl32, facl) -EXPORT_ALIAS (aclcheck32, aclcheck) -EXPORT_ALIAS (aclsort32, aclsort) -EXPORT_ALIAS (acltomode32, acltomode) -EXPORT_ALIAS (aclfrommode32, aclfrommode) -EXPORT_ALIAS (acltopbits32, acltopbits) -EXPORT_ALIAS (aclfrompbits32, aclfrompbits) -EXPORT_ALIAS (acltotext32, acltotext) -EXPORT_ALIAS (aclfromtext32, aclfromtext) -#else +#ifdef __i386__ typedef struct __acl16 { int a_type; __uid16_t a_id; @@ -2066,4 +2055,15 @@ aclfromtext (char *acltextp, int *aclcnt) { return (__aclent16_t *) aclfromtext32 (acltextp, aclcnt); } -#endif /* !__x86_64__ */ +#else +EXPORT_ALIAS (acl32, acl) +EXPORT_ALIAS (facl32, facl) +EXPORT_ALIAS (aclcheck32, aclcheck) +EXPORT_ALIAS (aclsort32, aclsort) +EXPORT_ALIAS (acltomode32, acltomode) +EXPORT_ALIAS (aclfrommode32, aclfrommode) +EXPORT_ALIAS (acltopbits32, acltopbits) +EXPORT_ALIAS (aclfrompbits32, aclfrompbits) +EXPORT_ALIAS (acltotext32, acltotext) +EXPORT_ALIAS (aclfromtext32, aclfromtext) +#endif diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index 6ce687555..3faa99c23 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -44,7 +44,7 @@ void uinfo_init (); #define MAP_UNIX_TO_CYGWIN_ID(id) (UNIX_POSIX_OFFSET \ | ((id) & UNIX_POSIX_MASK)) -#ifndef __x86_64__ +#ifdef __i386__ #define ILLEGAL_UID16 ((__uid16_t)-1) #define ILLEGAL_GID16 ((__gid16_t)-1) #define uid16touid32(u16) ((u16)==ILLEGAL_UID16?ILLEGAL_UID:(uid_t)(u16)) diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index c0bc3ccf4..31b7629e8 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -1507,16 +1507,16 @@ lseek64 (int fd, off_t pos, int dir) EXPORT_ALIAS (lseek64, _lseek64) -#ifdef __x86_64__ -EXPORT_ALIAS (lseek64, lseek) -EXPORT_ALIAS (lseek64, _lseek) -#else +#ifdef __i386__ extern "C" _off_t lseek (int fd, _off_t pos, int dir) { return lseek64 (fd, (off_t) pos, dir); } EXPORT_ALIAS (lseek, _lseek) +#else +EXPORT_ALIAS (lseek64, lseek) +EXPORT_ALIAS (lseek64, _lseek) #endif @@ -1623,15 +1623,15 @@ chown32 (const char * name, uid_t uid, gid_t gid) return chown_worker (name, PC_SYM_FOLLOW, uid, gid); } -#ifdef __x86_64__ -EXPORT_ALIAS (chown32, chown) -#else +#ifdef __i386__ extern "C" int chown (const char * name, __uid16_t uid, __gid16_t gid) { return chown_worker (name, PC_SYM_FOLLOW, uid16touid32 (uid), gid16togid32 (gid)); } +#else +EXPORT_ALIAS (chown32, chown) #endif extern "C" int @@ -1640,15 +1640,15 @@ lchown32 (const char * name, uid_t uid, gid_t gid) return chown_worker (name, PC_SYM_NOFOLLOW, uid, gid); } -#ifdef __x86_64__ -EXPORT_ALIAS (lchown32, lchown) -#else +#ifdef __i386__ extern "C" int lchown (const char * name, __uid16_t uid, __gid16_t gid) { return chown_worker (name, PC_SYM_NOFOLLOW, uid16touid32 (uid), gid16togid32 (gid)); } +#else +EXPORT_ALIAS (lchown32, lchown) #endif extern "C" int @@ -1667,14 +1667,14 @@ fchown32 (int fd, uid_t uid, gid_t gid) return res; } -#ifdef __x86_64__ -EXPORT_ALIAS (fchown32, fchown) -#else +#ifdef __i386__ extern "C" int fchown (int fd, __uid16_t uid, __gid16_t gid) { return fchown32 (fd, uid16touid32 (uid), gid16togid32 (gid)); } +#else +EXPORT_ALIAS (fchown32, fchown) #endif /* umask: POSIX 5.3.3.1 */ @@ -1735,7 +1735,7 @@ fchmod (int fd, mode_t mode) return cfd->fchmod (FILTERED_MODE (mode)); } -#ifndef __x86_64__ +#ifdef __i386__ static void stat64_to_stat32 (struct stat *src, struct __stat32 *dst) { @@ -1839,10 +1839,7 @@ _fstat64_r (struct _reent *ptr, int fd, struct stat *buf) return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (fstat64, fstat) -EXPORT_ALIAS (_fstat64_r, _fstat_r) -#else +#ifdef __i386__ extern "C" int fstat (int fd, struct stat *buf) { @@ -1862,6 +1859,9 @@ _fstat_r (struct _reent *ptr, int fd, struct stat *buf) ptr->_errno = get_errno (); return ret; } +#else +EXPORT_ALIAS (fstat64, fstat) +EXPORT_ALIAS (_fstat64_r, _fstat_r) #endif /* fsync: P96 6.6.1.1 */ @@ -1996,10 +1996,7 @@ _stat64_r (struct _reent *__restrict ptr, const char *__restrict name, return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (stat64, stat) -EXPORT_ALIAS (_stat64_r, _stat_r) -#else +#ifdef __i386__ extern "C" int stat (const char *__restrict name, struct stat *__restrict buf) { @@ -2020,6 +2017,9 @@ _stat_r (struct _reent *__restrict ptr, const char *__restrict name, ptr->_errno = get_errno (); return ret; } +#else +EXPORT_ALIAS (stat64, stat) +EXPORT_ALIAS (_stat64_r, _stat_r) #endif /* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ @@ -2032,9 +2032,7 @@ lstat64 (const char *__restrict name, struct stat *__restrict buf) return stat_worker (pc, buf); } -#ifdef __x86_64__ -EXPORT_ALIAS (lstat64, lstat) -#else +#ifdef __i386__ /* lstat: Provided by SVR4 and 4.3+BSD, POSIX? */ extern "C" int lstat (const char *__restrict name, struct stat *__restrict buf) @@ -2045,6 +2043,8 @@ lstat (const char *__restrict name, struct stat *__restrict buf) stat64_to_stat32 (&buf64, (struct __stat32 *) buf); return ret; } +#else +EXPORT_ALIAS (lstat64, lstat) #endif extern "C" int @@ -3023,15 +3023,15 @@ ftruncate64 (int fd, off_t length) return res; } -#ifdef __x86_64__ -EXPORT_ALIAS (ftruncate64, ftruncate) -#else +#ifdef __i386__ /* ftruncate: P96 5.6.7.1 */ extern "C" int ftruncate (int fd, _off_t length) { return ftruncate64 (fd, (off_t)length); } +#else +EXPORT_ALIAS (ftruncate64, ftruncate) #endif /* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ @@ -3053,15 +3053,15 @@ truncate64 (const char *pathname, off_t length) return res; } -#ifdef __x86_64__ -EXPORT_ALIAS (truncate64, truncate) -#else +#ifdef __i386__ /* truncate: Provided by SVR4 and 4.3+BSD. Not part of POSIX.1 or XPG3 */ extern "C" int truncate (const char *pathname, _off_t length) { return truncate64 (pathname, (off_t)length); } +#else +EXPORT_ALIAS (truncate64, truncate) #endif extern "C" long @@ -3548,14 +3548,14 @@ seteuid32 (uid_t uid) return 0; } -#ifdef __x86_64__ -EXPORT_ALIAS (seteuid32, seteuid) -#else +#ifdef __i386__ extern "C" int seteuid (__uid16_t uid) { return seteuid32 (uid16touid32 (uid)); } +#else +EXPORT_ALIAS (seteuid32, seteuid) #endif /* setuid: POSIX 4.2.2.1 */ @@ -3573,14 +3573,14 @@ setuid32 (uid_t uid) return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (setuid32, setuid) -#else +#ifdef __i386__ extern "C" int setuid (__uid16_t uid) { return setuid32 (uid16touid32 (uid)); } +#else +EXPORT_ALIAS (setuid32, setuid) #endif extern "C" int @@ -3602,14 +3602,14 @@ setreuid32 (uid_t ruid, uid_t euid) return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (setreuid32, setreuid) -#else +#ifdef __i386__ extern "C" int setreuid (__uid16_t ruid, __uid16_t euid) { return setreuid32 (uid16touid32 (ruid), uid16touid32 (euid)); } +#else +EXPORT_ALIAS (setreuid32, setreuid) #endif /* setegid: from System V. */ @@ -3662,14 +3662,14 @@ setegid32 (gid_t gid) return 0; } -#ifdef __x86_64__ -EXPORT_ALIAS (setegid32, setegid) -#else +#ifdef __i386__ extern "C" int setegid (__gid16_t gid) { return setegid32 (gid16togid32 (gid)); } +#else +EXPORT_ALIAS (setegid32, setegid) #endif /* setgid: POSIX 4.2.2.1 */ @@ -3682,9 +3682,7 @@ setgid32 (gid_t gid) return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (setgid32, setgid) -#else +#ifdef __i386__ extern "C" int setgid (__gid16_t gid) { @@ -3693,6 +3691,8 @@ setgid (__gid16_t gid) cygheap->user.real_gid = myself->gid; return ret; } +#else +EXPORT_ALIAS (setgid32, setgid) #endif extern "C" int @@ -3714,14 +3714,14 @@ setregid32 (gid_t rgid, gid_t egid) return ret; } -#ifdef __x86_64__ -EXPORT_ALIAS (setregid32, setregid) -#else +#ifdef __i386__ extern "C" int setregid (__gid16_t rgid, __gid16_t egid) { return setregid32 (gid16togid32 (rgid), gid16togid32 (egid)); } +#else +EXPORT_ALIAS (setregid32, setregid) #endif /* chroot: privileged Unix system call. */ diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 1a2a6aa40..286105057 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -284,14 +284,14 @@ getuid32 (void) return cygheap->user.real_uid; } -#ifdef __x86_64__ -EXPORT_ALIAS (getuid32, getuid) -#else +#ifdef __i386__ extern "C" __uid16_t getuid (void) { return cygheap->user.real_uid; } +#else +EXPORT_ALIAS (getuid32, getuid) #endif extern "C" gid_t @@ -300,14 +300,14 @@ getgid32 (void) return cygheap->user.real_gid; } -#ifdef __x86_64__ -EXPORT_ALIAS (getgid32, getgid) -#else +#ifdef __i386__ extern "C" __gid16_t getgid (void) { return cygheap->user.real_gid; } +#else +EXPORT_ALIAS (getgid32, getgid) #endif extern "C" uid_t @@ -316,14 +316,14 @@ geteuid32 (void) return myself->uid; } -#ifdef __x86_64__ -EXPORT_ALIAS (geteuid32, geteuid) -#else +#ifdef __i386__ extern "C" uid_t geteuid (void) { return myself->uid; } +#else +EXPORT_ALIAS (geteuid32, geteuid) #endif extern "C" gid_t @@ -332,14 +332,14 @@ getegid32 (void) return myself->gid; } -#ifdef __x86_64__ -EXPORT_ALIAS (getegid32, getegid) -#else +#ifdef __i386__ extern "C" __gid16_t getegid (void) { return myself->gid; } +#else +EXPORT_ALIAS (getegid32, getegid) #endif /* Not quite right - cuserid can change, getlogin can't */ diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 44ea72a87..fcb08e213 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -160,10 +160,10 @@ extern "C" PVOID dll_dllcrt0 (HMODULE, per_process *); extern "C" void _pei386_runtime_relocator (per_process *); -#ifndef __x86_64__ +#ifdef __i386__ /* dynamically loaded dll initialization for non-cygwin apps */ extern "C" int dll_noncygwin_dllcrt0 (HMODULE, per_process *); -#endif /* !__x86_64__ */ +#endif /* __i386__ */ void __reg1 do_exit (int) __attribute__ ((noreturn)); From 032aa2dba5a5bf90c198d930c8d309b5de57cb47 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 22:07:13 -0600 Subject: [PATCH 105/649] Feature test macros overhaul: Cygwin limits.h, part 2 http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html https://sourceware.org/ml/newlib/2017/msg01133.html Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/limits.h | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/include/limits.h b/winsup/cygwin/include/limits.h index cf3c8d04d..fe1b8b493 100644 --- a/winsup/cygwin/include/limits.h +++ b/winsup/cygwin/include/limits.h @@ -24,6 +24,7 @@ details. */ #undef CHAR_BIT #define CHAR_BIT __CHAR_BIT__ +#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 /* Number of bits in a `long'. */ #undef LONG_BIT #define LONG_BIT (__SIZEOF_LONG__ * __CHAR_BIT__) @@ -31,6 +32,7 @@ details. */ /* Number of bits in a `int'. */ #undef WORD_BIT #define WORD_BIT (__SIZEOF_INT__ * __CHAR_BIT__) +#endif /* __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 */ /* Maximum length of a multibyte character. */ #ifndef MB_LEN_MAX @@ -118,6 +120,7 @@ details. */ #define ULONG_LONG_MAX (LONG_LONG_MAX * 2ULL + 1) #endif +#if __ISO_C_VISIBLE >= 1999 /* Minimum and maximum values a `signed long long int' can hold. */ #undef LLONG_MIN #define LLONG_MIN (-LLONG_MAX-1) @@ -127,6 +130,7 @@ details. */ /* Maximum value an `unsigned long long int' can hold. (Minimum is 0). */ #undef ULLONG_MAX #define ULLONG_MAX (LLONG_MAX * 2ULL + 1) +#endif /* __ISO_C_VISIBLE >= 1999 */ /* Maximum size of ssize_t. Sadly, gcc doesn't give us __SSIZE_MAX__ the way it does for __SIZE_MAX__. On the other hand, we happen to @@ -171,9 +175,11 @@ details. */ #undef ARG_MAX #define ARG_MAX 32000 +#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 /* Maximum number of functions that may be registered with atexit(). */ #undef ATEXIT_MAX #define ATEXIT_MAX 32 +#endif /* Maximum number of simultaneous processes per real user ID. */ #undef CHILD_MAX @@ -187,9 +193,11 @@ details. */ #undef HOST_NAME_MAX #define HOST_NAME_MAX 255 +#if __XSI_VISIBLE /* Maximum number of iovcnt in a writev (an arbitrary number) */ #undef IOV_MAX #define IOV_MAX 1024 +#endif /* Maximum number of characters in a login name. */ #undef LOGIN_NAME_MAX @@ -212,9 +220,11 @@ details. */ /* Size in bytes of a page. */ #undef PAGESIZE -#undef PAGE_SIZE #define PAGESIZE 65536 +#if __XSI_VISIBLE +#undef PAGE_SIZE #define PAGE_SIZE PAGESIZE +#endif /* Maximum number of attempts made to destroy a thread's thread-specific data values on thread exit. */ @@ -381,6 +391,7 @@ details. */ /* Runtime Increasable Values */ +#if __POSIX_VISIBLE >= 2 /* Maximum obase values allowed by the bc utility. */ #undef BC_BASE_MAX #define BC_BASE_MAX 99 @@ -428,6 +439,7 @@ details. */ using the interval notation \{m,n\} */ #undef RE_DUP_MAX #define RE_DUP_MAX 255 +#endif /* __POSIX_VISIBLE >= 2 */ /* POSIX values */ @@ -435,6 +447,7 @@ details. */ /* They represent the minimum values that POSIX systems must support. POSIX-conforming apps must not require larger values. */ +#if __POSIX_VISIBLE /* Maximum Values */ #define _POSIX_CLOCKRES_MIN 20000000 @@ -478,7 +491,9 @@ details. */ #define _POSIX_TRACE_USER_EVENT_MAX 32 #define _POSIX_TTY_NAME_MAX 9 #define _POSIX_TZNAME_MAX 6 +#endif /* __POSIX_VISIBLE */ +#if __POSIX_VISIBLE >= 2 #define _POSIX2_BC_BASE_MAX 99 #define _POSIX2_BC_DIM_MAX 2048 #define _POSIX2_BC_SCALE_MAX 99 @@ -487,23 +502,34 @@ details. */ #define _POSIX2_EXPR_NEST_MAX 32 #define _POSIX2_LINE_MAX 2048 #define _POSIX2_RE_DUP_MAX 255 +#endif /* __POSIX_VISIBLE >= 2 */ +#if __XSI_VISIBLE #define _XOPEN_IOV_MAX 16 #define _XOPEN_NAME_MAX 255 #define _XOPEN_PATH_MAX 1024 +#endif /* Other Invariant Values */ #define NL_ARGMAX 9 +#if __XSI_VISIBLE #define NL_LANGMAX 14 +#endif +#if __XSI_VISIBLE || __POSIX_VISIBLE >= 200809 #define NL_MSGMAX 32767 -#define NL_NMAX INT_MAX #define NL_SETMAX 255 #define NL_TEXTMAX _POSIX2_LINE_MAX +#endif +#if __POSIX_VISIBLE < 200809 +#define NL_NMAX INT_MAX +#endif +#if __XSI_VISIBLE /* Default process priority. */ #undef NZERO #define NZERO 20 +#endif #endif /* _MACH_MACHLIMITS_H_ */ #endif /* _LIMITS_H___ */ From 662740b3d0781b8e76896092d7bcc3921b0ecaf3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Nov 2017 13:10:34 +0100 Subject: [PATCH 106/649] cygwin: further improve tags generation Signed-off-by: Corinna Vinschen --- winsup/cygwin/Makefile.in | 4 +++- winsup/cygwin/fhandler_disk_file.cc | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index bc452087f..4675055d5 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -776,7 +776,9 @@ tags: CTAGS CTAGS: -cd $(srcdir) && \ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q \ - --regex-C++='/EXPORT_ALIAS *\([[a-zA-Z0-9_]*, *([a-zA-Z0-9_]*)\)/\1/' \ + --regex-C++='/EXPORT_ALIAS *\([a-zA-Z0-9_]*, *([a-zA-Z0-9_]*)\)/\1/' \ + --regex-C++='/_EXFUN *\(([a-zA-Z0-9_]*)[,\)]/\1/' \ + --regex-C++='/__ASMNAME *\("([a-zA-Z0-9_]*)"\)/\1/' \ @newlib_headers@ . deps:=${wildcard *.d} diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 5dfcae4d9..149c80484 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1635,8 +1635,10 @@ fhandler_disk_file::pwrite (void *buf, size_t count, off_t offset) if (!prw_handle && prw_open (true)) goto non_atomic; + debug_printf ("Before NtWriteFile, io %Y", io.Information); status = NtWriteFile (prw_handle, NULL, NULL, NULL, &io, buf, count, &off, NULL); + debug_printf ("After NtWriteFile, io %Y, status %y", io.Information); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); From 2d2833dfab8eaeeaad41b9c305b94c1d6e3b4a27 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Nov 2017 13:12:07 +0100 Subject: [PATCH 107/649] cygwin: remove accidentally committed debug statments Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_disk_file.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 149c80484..5dfcae4d9 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1635,10 +1635,8 @@ fhandler_disk_file::pwrite (void *buf, size_t count, off_t offset) if (!prw_handle && prw_open (true)) goto non_atomic; - debug_printf ("Before NtWriteFile, io %Y", io.Information); status = NtWriteFile (prw_handle, NULL, NULL, NULL, &io, buf, count, &off, NULL); - debug_printf ("After NtWriteFile, io %Y, status %y", io.Information); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); From df75aedc20cfe525d806510bc678d2902807b287 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Nov 2017 13:26:37 +0100 Subject: [PATCH 108/649] cygwin: improve _EXFUN tags generation Signed-off-by: Corinna Vinschen --- winsup/cygwin/Makefile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 4675055d5..ff20f07bd 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -777,7 +777,8 @@ CTAGS: -cd $(srcdir) && \ ctags -R --c++-kinds=+p --fields=+iaS --extra=+q \ --regex-C++='/EXPORT_ALIAS *\([a-zA-Z0-9_]*, *([a-zA-Z0-9_]*)\)/\1/' \ - --regex-C++='/_EXFUN *\(([a-zA-Z0-9_]*)[,\)]/\1/' \ + --regex-C++='/_EXFUN *\(([a-zA-Z0-9_]+) ?[,\)]/\1/' \ + --regex-C++='/_EXFUN *\([^,]* ([a-zA-Z0-9_]+) ?[,\)]/\1/' \ --regex-C++='/__ASMNAME *\("([a-zA-Z0-9_]*)"\)/\1/' \ @newlib_headers@ . From 76bd5cab331a873ac422fdcb7ba5fe79abea94f0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Nov 2017 13:31:20 +0100 Subject: [PATCH 109/649] cygwin: don't allow empty strings in __ASMNAME tags Signed-off-by: Corinna Vinschen --- winsup/cygwin/Makefile.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index ff20f07bd..a70f28dfc 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -779,7 +779,7 @@ CTAGS: --regex-C++='/EXPORT_ALIAS *\([a-zA-Z0-9_]*, *([a-zA-Z0-9_]*)\)/\1/' \ --regex-C++='/_EXFUN *\(([a-zA-Z0-9_]+) ?[,\)]/\1/' \ --regex-C++='/_EXFUN *\([^,]* ([a-zA-Z0-9_]+) ?[,\)]/\1/' \ - --regex-C++='/__ASMNAME *\("([a-zA-Z0-9_]*)"\)/\1/' \ + --regex-C++='/__ASMNAME *\("([a-zA-Z0-9_]+)"\)/\1/' \ @newlib_headers@ . deps:=${wildcard *.d} From f2b27ce620b98c3cd3bc22b7e2207a9e89eec3d8 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 28 Nov 2017 04:03:29 -0600 Subject: [PATCH 110/649] cygwin: define _POSIX_TIMEOUTS Since commit 8128f5482f2b1889e2336488e9d45a33c9972d11, we have all the non-tracing functions listed in posixoptions(7). The tracing functions are gated by their own option, and are obsolecent anyway. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/sys/features.h | 2 +- winsup/cygwin/sysconf.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index c9133af57..95d20533e 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -448,7 +448,7 @@ extern "C" { #define _POSIX_THREAD_SAFE_FUNCTIONS 200809L /* #define _POSIX_THREAD_SPORADIC_SERVER -1 */ #define _POSIX_THREADS 200809L -/* #define _POSIX_TIMEOUTS -1 */ +#define _POSIX_TIMEOUTS 200809L #define _POSIX_TIMERS 200809L /* #define _POSIX_TRACE -1 */ /* #define _POSIX_TRACE_EVENT_FILTER -1 */ diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index a24a98501..ecd9aeb93 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -588,7 +588,7 @@ static struct {cons, {c:SYMLOOP_MAX}}, /* 79, _SC_SYMLOOP_MAX */ {cons, {c:_POSIX_THREAD_CPUTIME}}, /* 80, _SC_THREAD_CPUTIME */ {cons, {c:-1L}}, /* 81, _SC_THREAD_SPORADIC_SERVER */ - {cons, {c:-1L}}, /* 82, _SC_TIMEOUTS */ + {cons, {c:_POSIX_TIMEOUTS}}, /* 82, _SC_TIMEOUTS */ {cons, {c:-1L}}, /* 83, _SC_TRACE */ {cons, {c:-1L}}, /* 84, _SC_TRACE_EVENT_FILTER */ {nsup, {c:0}}, /* 85, _SC_TRACE_EVENT_NAME_MAX */ From 36a0a675b4fd1c3cb3370367edb4ba2b457d008f Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 28 Nov 2017 04:21:16 -0600 Subject: [PATCH 111/649] Make __nonnull macro compatible with glibc This form allows for multiple arguments, e.g. __nonnull((1,2)). Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/pthread.h | 4 ++-- newlib/libc/include/stdlib.h | 2 +- newlib/libc/include/string.h | 2 +- newlib/libc/include/sys/cdefs.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h index 516131d83..fb2fa93d8 100644 --- a/newlib/libc/include/pthread.h +++ b/newlib/libc/include/pthread.h @@ -171,9 +171,9 @@ int _EXFUN(pthread_setschedprio, (pthread_t thread, int prio)); #endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ #if __GNU_VISIBLE -int pthread_getname_np(pthread_t, char *, size_t) __nonnull(2); +int pthread_getname_np(pthread_t, char *, size_t) __nonnull((2)); -int pthread_setname_np(pthread_t, const char *) __nonnull(2); +int pthread_setname_np(pthread_t, const char *) __nonnull((2)); #endif #if defined(_POSIX_THREAD_PRIO_INHERIT) || defined(_POSIX_THREAD_PRIO_PROTECT) diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index 968367f22..af5bfecf1 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -282,7 +282,7 @@ int _EXFUN(_unsetenv_r,(struct _reent *, const char *__string)); #endif /* !__CYGWIN__ */ #if __POSIX_VISIBLE >= 200112 -int _EXFUN(__nonnull (1) posix_memalign,(void **, size_t, size_t)); +int _EXFUN(__nonnull ((1)) posix_memalign,(void **, size_t, size_t)); #endif char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index 9c536f35f..57db7742b 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -169,7 +169,7 @@ int _EXFUN(strverscmp,(const char *, const char *)); sure here. */ #if __GNU_VISIBLE && !defined(basename) # define basename basename -char *_EXFUN(__nonnull (1) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename")); +char *_EXFUN(__nonnull ((1)) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename")); #endif #include diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index 8ce14b68e..db5f2bf2d 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -397,7 +397,7 @@ #endif #if __GNUC_PREREQ__(3, 3) -#define __nonnull(x) __attribute__((__nonnull__(x))) +#define __nonnull(x) __attribute__((__nonnull__ x)) #define __nonnull_all __attribute__((__nonnull__)) #else #define __nonnull(x) From c37171b528502aad4b55d329ff91a55335b641ad Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 28 Nov 2017 11:35:13 -0600 Subject: [PATCH 112/649] cygwin: fix getconf after commit 032aa2dba5a5bf90c198d930c8d309b5de57cb47 Signed-off-by: Yaakov Selkowitz --- winsup/utils/getconf.c | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c index e6b319e21..256bddb1a 100644 --- a/winsup/utils/getconf.c +++ b/winsup/utils/getconf.c @@ -27,6 +27,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#define _XOPEN_SOURCE #include #include #include From 39138114542027e2df79333c91f494cc3e058d6e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 28 Nov 2017 19:08:04 +0100 Subject: [PATCH 113/649] cygserver: remove all asserts on "this" Signed-off-by: Corinna Vinschen --- winsup/cygserver/process.cc | 3 --- winsup/cygserver/threaded_queue.cc | 4 ---- 2 files changed, 7 deletions(-) diff --git a/winsup/cygserver/process.cc b/winsup/cygserver/process.cc index f0fe4ecfd..c26341470 100644 --- a/winsup/cygserver/process.cc +++ b/winsup/cygserver/process.cc @@ -172,7 +172,6 @@ process::cleanup () void process_cache::submission_loop::request_loop () { - assert (this); assert (_cache); assert (_interrupt_event); @@ -377,7 +376,6 @@ process_cache::wait_for_processes (const HANDLE interrupt_event) size_t process_cache::sync_wait_array (const HANDLE interrupt_event) { - assert (this); assert (interrupt_event && interrupt_event != INVALID_HANDLE_VALUE); /* Always reset _cache_add_trigger before filling up the array again. */ @@ -424,7 +422,6 @@ process_cache::sync_wait_array (const HANDLE interrupt_event) void process_cache::check_and_remove_process (const size_t index) { - assert (this); assert (index < elements (_wait_array) - SPECIALS_COUNT); class process *const process = _process_array[index]; diff --git a/winsup/cygserver/threaded_queue.cc b/winsup/cygserver/threaded_queue.cc index df0bc0cc0..72f2a5fdd 100644 --- a/winsup/cygserver/threaded_queue.cc +++ b/winsup/cygserver/threaded_queue.cc @@ -85,7 +85,6 @@ threaded_queue::~threaded_queue () void threaded_queue::add_submission_loop (queue_submission_loop *const submitter) { - assert (this); assert (submitter); assert (submitter->_queue == this); assert (!submitter->_next); @@ -158,7 +157,6 @@ threaded_queue::stop () void threaded_queue::add (queue_request *const therequest) { - assert (this); assert (therequest); assert (!therequest->_next); @@ -313,7 +311,6 @@ queue_submission_loop::~queue_submission_loop () bool queue_submission_loop::start () { - assert (this); assert (!_hThread); const bool was_running = _running; @@ -337,7 +334,6 @@ queue_submission_loop::start () bool queue_submission_loop::stop () { - assert (this); assert (_hThread && _hThread != INVALID_HANDLE_VALUE); const bool was_running = _running; From 1bbdb3c9533684282695e147d0480b771fd13687 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 29 Nov 2017 15:01:30 +0100 Subject: [PATCH 114/649] newlib: [w]scanf: Fix behaviour on matching failure The special handling of %\0 in [w]scanf is flawed. It's just a matching failure and should be handled as such. scanf also fakes an int input value on %X with X being an invalid conversion char. This is also just a matching failure and should be handled the same way as %\0. There's no indication of the reason for this "disgusting backwards compatibility hacks" in the logs, given this code made it into newlib before setting up the CVS repo. Just handle these cases identically as matching failures. Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfscanf.c | 16 ++-------------- newlib/libc/stdio/vfwscanf.c | 9 +-------- 2 files changed, 3 insertions(+), 22 deletions(-) diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 544d8db7f..c5fcae577 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -787,20 +787,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } continue; - /* - * Disgusting backwards compatibility hacks. XXX - */ - case '\0': /* compat */ - _newlib_flockfile_exit (fp); - return EOF; - - default: /* compat */ - if (isupper (c)) - flags |= LONG; - c = CT_INT; - ccfn = (u_long (*)CCFN_PARAMS)_strtol_r; - base = 10; - break; + default: + goto match_failure; } /* diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 5b35601be..fd4f1f9f6 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -740,14 +740,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), } continue; - /* - * Disgusting backwards compatibility hacks. XXX - */ - case L'\0': /* compat */ - _newlib_flockfile_exit (fp); - return EOF; - - default: /* compat */ + default: goto match_failure; } From 0a5dfdbd1ba3663a54fa1a7de1a6c4a0a3316a6e Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:04:09 -0600 Subject: [PATCH 115/649] ssp: add APIs for Stack Smashing Protection Compiling with any of the -fstack-protector* flags requires the __stack_chk_guard data import (which needs to be initialized) and the __stack_chk_fail{,_local} functions. While GCC's own libssp can provide these, it is better that we provide these ourselves. The implementation is custom due to being OS-specific. Signed-off-by: Yaakov Selkowitz --- newlib/libc/ssp/stack_protector.c | 45 +++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 newlib/libc/ssp/stack_protector.c diff --git a/newlib/libc/ssp/stack_protector.c b/newlib/libc/ssp/stack_protector.c new file mode 100644 index 000000000..ee014b69d --- /dev/null +++ b/newlib/libc/ssp/stack_protector.c @@ -0,0 +1,45 @@ +#include +#include +#include +#include +#include +#include + +uintptr_t __stack_chk_guard = 0; + +void +__attribute__((__constructor__)) +__stack_chk_init (void) +{ + if (__stack_chk_guard != 0) + return; + +#if defined(__CYGWIN__) || defined(__rtems__) + arc4random_buf(&__stack_chk_guard, sizeof(__stack_chk_guard)); +#else + /* If getentropy is not available, use the "terminator canary". */ + ((unsigned char *)&__stack_chk_guard)[0] = 0; + ((unsigned char *)&__stack_chk_guard)[1] = 0; + ((unsigned char *)&__stack_chk_guard)[2] = '\n'; + ((unsigned char *)&__stack_chk_guard)[3] = 255; +#endif +} + +void +__attribute__((__noreturn__)) +__stack_chk_fail (void) +{ + char msg[] = "*** stack smashing detected ***: terminated\n"; + write (2, msg, strlen (msg)); + raise (SIGABRT); + _exit (127); +} + +#ifdef __ELF__ +void +__attribute__((visibility ("hidden"))) +__stack_chk_fail_local (void) +{ + __stack_chk_fail(); +} +#endif From 3e8fc7d9f21329d5a98ec3cf6de138bce9bc2c05 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:07:10 -0600 Subject: [PATCH 116/649] ssp: add Object Size Checking common code The Object Size Checking (-D_FORTIFY_SOURCE=*) functionality provides wrappers around functions suspectible to buffer overflows. While independent from Stack Smashing Protection (-fstack-protector*), they are often used and implemented together. While GCC also provides an implementation in libssp, it is completely broken (CVE-2016-4973, RHBZ#1324759) and seemingly unfixable, as there is no reliable way for a preprocessor macro to trigger a link flag. Therefore, adding this here is necessary to make it work. Note that this does require building gcc with --disable-libssp and gcc_cv_libc_provides_ssp=yes. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/ssp.h | 77 ++++++++++++++++++++++++++++++ newlib/libc/include/sys/features.h | 18 ++++++- newlib/libc/ssp/chk_fail.c | 13 +++++ 3 files changed, 107 insertions(+), 1 deletion(-) create mode 100644 newlib/libc/include/ssp/ssp.h create mode 100644 newlib/libc/ssp/chk_fail.c diff --git a/newlib/libc/include/ssp/ssp.h b/newlib/libc/include/ssp/ssp.h new file mode 100644 index 000000000..5c65cf4b2 --- /dev/null +++ b/newlib/libc/include/ssp/ssp.h @@ -0,0 +1,77 @@ +/* $NetBSD: ssp.h,v 1.13 2015/09/03 20:43:47 plunky Exp $ */ + +/*- + * Copyright (c) 2006, 2011 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_SSP_H_ +#define _SSP_SSP_H_ + +#include + +/* __ssp_real is used by the implementation in libc */ +#if __SSP_FORTIFY_LEVEL == 0 +#define __ssp_real_(fun) fun +#else +#define __ssp_real_(fun) __ssp_real_ ## fun +#endif +#define __ssp_real(fun) __ssp_real_(fun) + +#define __ssp_inline extern __inline__ __attribute__((__always_inline__, __gnu_inline__)) + +#define __ssp_bos(ptr) __builtin_object_size(ptr, __SSP_FORTIFY_LEVEL > 1) +#define __ssp_bos0(ptr) __builtin_object_size(ptr, 0) + +#define __ssp_check(buf, len, bos) \ + if (bos(buf) != (size_t)-1 && len > bos(buf)) \ + __chk_fail() +#define __ssp_decl(rtype, fun, args) \ +rtype __ssp_real_(fun) args __asm__(__ASMNAME(#fun)); \ +__ssp_inline rtype fun args __asm__(__ASMNAME("__ssp_protected_" #fun)); \ +__ssp_inline rtype fun args +#define __ssp_redirect_raw(rtype, fun, args, call, cond, bos) \ +__ssp_decl(rtype, fun, args) \ +{ \ + if (cond) \ + __ssp_check(__buf, __len, bos); \ + return __ssp_real_(fun) call; \ +} + +#define __ssp_redirect(rtype, fun, args, call) \ + __ssp_redirect_raw(rtype, fun, args, call, 1, __ssp_bos) +#define __ssp_redirect0(rtype, fun, args, call) \ + __ssp_redirect_raw(rtype, fun, args, call, 1, __ssp_bos0) + +#define __ssp_overlap(a, b, l) \ + (((a) <= (b) && (b) < (a) + (l)) || ((b) <= (a) && (a) < (b) + (l))) + +__BEGIN_DECLS +void __stack_chk_fail(void) __dead2; +void __chk_fail(void) __dead2; +__END_DECLS + +#endif /* _SSP_SSP_H_ */ diff --git a/newlib/libc/include/sys/features.h b/newlib/libc/include/sys/features.h index 95d20533e..2900b332f 100644 --- a/newlib/libc/include/sys/features.h +++ b/newlib/libc/include/sys/features.h @@ -100,6 +100,9 @@ extern "C" { * _SVID_SOURCE (deprecated by _DEFAULT_SOURCE) * _DEFAULT_SOURCE (or none of the above) * POSIX-1.2008 with BSD and SVr4 extensions + * + * _FORTIFY_SOURCE = 1 or 2 + * Object Size Checking function wrappers */ #ifdef _GNU_SOURCE @@ -233,9 +236,11 @@ extern "C" { * __GNU_VISIBLE * GNU extensions; enabled with _GNU_SOURCE. * + * __SSP_FORTIFY_LEVEL + * Object Size Checking; defined to 0 (off), 1, or 2. + * * In all cases above, "enabled by default" means either by defining * _DEFAULT_SOURCE, or by not defining any of the public feature test macros. - * Defining _GNU_SOURCE makes all of the above avaliable. */ #ifdef _ATFILE_SOURCE @@ -314,6 +319,17 @@ extern "C" { #define __XSI_VISIBLE 0 #endif +#if _FORTIFY_SOURCE > 0 && !defined(__cplusplus) && !defined(__lint__) && \ + (__OPTIMIZE__ > 0 || defined(__clang__)) && __GNUC_PREREQ__(4, 1) +# if _FORTIFY_SOURCE > 1 +# define __SSP_FORTIFY_LEVEL 2 +# else +# define __SSP_FORTIFY_LEVEL 1 +# endif +#else +# define __SSP_FORTIFY_LEVEL 0 +#endif + /* RTEMS adheres to POSIX -- 1003.1b with some features from annexes. */ #ifdef __rtems__ diff --git a/newlib/libc/ssp/chk_fail.c b/newlib/libc/ssp/chk_fail.c new file mode 100644 index 000000000..b1f8e42a6 --- /dev/null +++ b/newlib/libc/ssp/chk_fail.c @@ -0,0 +1,13 @@ +#include +#include +#include + +void +__attribute__((__noreturn__)) +__chk_fail(void) +{ + char msg[] = "*** buffer overflow detected ***: terminated\n"; + write (2, msg, strlen (msg)); + raise (SIGABRT); + _exit (127); +} From e4fc4d7bc47f5082a084415e237d39e40dd701be Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:14:15 -0600 Subject: [PATCH 117/649] ssp: add Object Size Checking for string.h The implementation is from NetBSD, with the addition of mempcpy (a GNU extension) for parity with glibc and libssp. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/string.h | 115 +++++++++++++++++++++++++++++++ newlib/libc/include/string.h | 4 ++ newlib/libc/ssp/memcpy_chk.c | 54 +++++++++++++++ newlib/libc/ssp/memmove_chk.c | 50 ++++++++++++++ newlib/libc/ssp/mempcpy_chk.c | 21 ++++++ newlib/libc/ssp/memset_chk.c | 49 +++++++++++++ newlib/libc/ssp/stpcpy_chk.c | 58 ++++++++++++++++ newlib/libc/ssp/stpncpy_chk.c | 56 +++++++++++++++ newlib/libc/ssp/strcat_chk.c | 62 +++++++++++++++++ newlib/libc/ssp/strcpy_chk.c | 55 +++++++++++++++ newlib/libc/ssp/strncat_chk.c | 73 ++++++++++++++++++++ newlib/libc/ssp/strncpy_chk.c | 55 +++++++++++++++ 12 files changed, 652 insertions(+) create mode 100644 newlib/libc/include/ssp/string.h create mode 100644 newlib/libc/ssp/memcpy_chk.c create mode 100644 newlib/libc/ssp/memmove_chk.c create mode 100644 newlib/libc/ssp/mempcpy_chk.c create mode 100644 newlib/libc/ssp/memset_chk.c create mode 100644 newlib/libc/ssp/stpcpy_chk.c create mode 100644 newlib/libc/ssp/stpncpy_chk.c create mode 100644 newlib/libc/ssp/strcat_chk.c create mode 100644 newlib/libc/ssp/strcpy_chk.c create mode 100644 newlib/libc/ssp/strncat_chk.c create mode 100644 newlib/libc/ssp/strncpy_chk.c diff --git a/newlib/libc/include/ssp/string.h b/newlib/libc/include/ssp/string.h new file mode 100644 index 000000000..85c4512ac --- /dev/null +++ b/newlib/libc/include/ssp/string.h @@ -0,0 +1,115 @@ +/* $NetBSD: string.h,v 1.13 2014/11/29 13:23:48 pooka Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STRING_H_ +#define _SSP_STRING_H_ + +#include +#include + +__BEGIN_DECLS +void *__memcpy_chk(void *, const void *, size_t, size_t); +void *__memmove_chk(void *, void *, size_t, size_t); +void *__mempcpy_chk(void *, const void *, size_t, size_t); +void *__memset_chk(void *, int, size_t, size_t); +char *__stpcpy_chk(char *, const char *, size_t); +char *__strcat_chk(char *, const char *, size_t); +char *__strcpy_chk(char *, const char *, size_t); +char *__strncat_chk(char *, const char *, size_t, size_t); +char *__strncpy_chk(char *, const char *, size_t, size_t); +__END_DECLS + +#if __SSP_FORTIFY_LEVEL > 0 + +#define __ssp_bos_check3(fun, dst, src, len) \ + ((__ssp_bos0(dst) != (size_t)-1) ? \ + __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)) : \ + __ ## fun ## _ichk(dst, src, len)) + +#define __ssp_bos_check2(fun, dst, src) \ + ((__ssp_bos0(dst) != (size_t)-1) ? \ + __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)) : \ + __ ## fun ## _ichk(dst, src)) + +#define __ssp_bos_icheck3_restrict(fun, type1, type2) \ +__ssp_inline type1 __ ## fun ## _ichk(type1 __restrict, type2 __restrict, size_t); \ +__ssp_inline type1 \ +__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src, size_t len) { \ + return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \ +} + +#define __ssp_bos_icheck3(fun, type1, type2) \ +__ssp_inline type1 __ ## fun ## _ichk(type1, type2, size_t); \ +__ssp_inline type1 \ +__ ## fun ## _ichk(type1 dst, type2 src, size_t len) { \ + return __builtin___ ## fun ## _chk(dst, src, len, __ssp_bos0(dst)); \ +} + +#define __ssp_bos_icheck2_restrict(fun, type1, type2) \ +__ssp_inline type1 __ ## fun ## _ichk(type1, type2); \ +__ssp_inline type1 \ +__ ## fun ## _ichk(type1 __restrict dst, type2 __restrict src) { \ + return __builtin___ ## fun ## _chk(dst, src, __ssp_bos0(dst)); \ +} + +__BEGIN_DECLS +__ssp_bos_icheck3_restrict(memcpy, void *, const void *) +__ssp_bos_icheck3(memmove, void *, const void *) +__ssp_bos_icheck3_restrict(mempcpy, void *, const void *) +__ssp_bos_icheck3(memset, void *, int) +__ssp_bos_icheck2_restrict(stpcpy, char *, const char *) +#if __GNUC_PREREQ__(4,8) || defined(__clang__) +__ssp_bos_icheck3_restrict(stpncpy, char *, const char *) +#endif +__ssp_bos_icheck2_restrict(strcpy, char *, const char *) +__ssp_bos_icheck2_restrict(strcat, char *, const char *) +__ssp_bos_icheck3_restrict(strncpy, char *, const char *) +__ssp_bos_icheck3_restrict(strncat, char *, const char *) +__END_DECLS + +#define memcpy(dst, src, len) __ssp_bos_check3(memcpy, dst, src, len) +#define memmove(dst, src, len) __ssp_bos_check3(memmove, dst, src, len) +#if __GNU_VISIBLE +#define mempcpy(dst, src, len) __ssp_bos_check3(mempcpy, dst, src, len) +#endif +#define memset(dst, val, len) __ssp_bos_check3(memset, dst, val, len) +#if __POSIX_VISIBLE >= 200809 +#define stpcpy(dst, src) __ssp_bos_check2(stpcpy, dst, src) +#if __GNUC_PREREQ__(4,8) || defined(__clang__) +#define stpncpy(dst, src, len) __ssp_bos_check3(stpncpy, dst, src, len) +#endif +#endif +#define strcpy(dst, src) __ssp_bos_check2(strcpy, dst, src) +#define strcat(dst, src) __ssp_bos_check2(strcat, dst, src) +#define strncpy(dst, src, len) __ssp_bos_check3(strncpy, dst, src, len) +#define strncat(dst, src, len) __ssp_bos_check3(strncat, dst, src, len) + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STRING_H_ */ diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index 57db7742b..b54b83335 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -176,4 +176,8 @@ char *_EXFUN(__nonnull ((1)) basename,(const char *)) __asm__(__ASMNAME("__gnu_b _END_STD_C +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _STRING_H_ */ diff --git a/newlib/libc/ssp/memcpy_chk.c b/newlib/libc/ssp/memcpy_chk.c new file mode 100644 index 000000000..63f536dc5 --- /dev/null +++ b/newlib/libc/ssp/memcpy_chk.c @@ -0,0 +1,54 @@ +/* $NetBSD: memcpy_chk.c,v 1.7 2015/05/13 19:57:16 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: memcpy_chk.c,v 1.7 2015/05/13 19:57:16 joerg Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef memcpy + +void *__memcpy_chk(void * __restrict, const void * __restrict, size_t, size_t); + +void * +__memcpy_chk(void * __restrict dst, const void * __restrict src, size_t len, + size_t slen) +{ + if (len > slen) + __chk_fail(); + + if (__ssp_overlap((const char *)src, (const char *)dst, len)) + __chk_fail(); + + return memcpy(dst, src, len); +} diff --git a/newlib/libc/ssp/memmove_chk.c b/newlib/libc/ssp/memmove_chk.c new file mode 100644 index 000000000..f8f03d778 --- /dev/null +++ b/newlib/libc/ssp/memmove_chk.c @@ -0,0 +1,50 @@ +/* $NetBSD: memmove_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: memmove_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef memmove + +void *__memmove_chk(void *, void *src, size_t, size_t); + +void * +__memmove_chk(void *dst, void *src, size_t len, + size_t slen) +{ + if (len > slen) + __chk_fail(); + return memmove(dst, src, len); +} diff --git a/newlib/libc/ssp/mempcpy_chk.c b/newlib/libc/ssp/mempcpy_chk.c new file mode 100644 index 000000000..fc2ccf894 --- /dev/null +++ b/newlib/libc/ssp/mempcpy_chk.c @@ -0,0 +1,21 @@ +#define _GNU_SOURCE +#include +#include +#include + +#undef mempcpy + +void *__mempcpy_chk(void * __restrict, const void * __restrict, size_t, size_t); + +void * +__mempcpy_chk(void * __restrict dst, const void * __restrict src, size_t len, + size_t slen) +{ + if (len > slen) + __chk_fail(); + + if (__ssp_overlap((const char *)src, (const char *)dst, len)) + __chk_fail(); + + return mempcpy(dst, src, len); +} diff --git a/newlib/libc/ssp/memset_chk.c b/newlib/libc/ssp/memset_chk.c new file mode 100644 index 000000000..0e303b9eb --- /dev/null +++ b/newlib/libc/ssp/memset_chk.c @@ -0,0 +1,49 @@ +/* $NetBSD: memset_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: memset_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef memset + +void *__memset_chk(void * __restrict, int, size_t, size_t); + +void * +__memset_chk(void * __restrict dst, int val, size_t len, size_t slen) +{ + if (len > slen) + __chk_fail(); + return memset(dst, val, len); +} diff --git a/newlib/libc/ssp/stpcpy_chk.c b/newlib/libc/ssp/stpcpy_chk.c new file mode 100644 index 000000000..ed1d74ad7 --- /dev/null +++ b/newlib/libc/ssp/stpcpy_chk.c @@ -0,0 +1,58 @@ +/* $NetBSD: stpcpy_chk.c,v 1.6 2015/05/09 15:42:21 christos Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: stpcpy_chk.c,v 1.6 2015/05/09 15:42:21 christos Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef memcpy + +#if !__GNUC_PREREQ__(4, 8) +char *__stpcpy_chk(char * __restrict, const char * __restrict, size_t); +#endif + +char * +__stpcpy_chk(char * __restrict dst, const char * __restrict src, size_t slen) +{ + size_t len = strlen(src); + + if (len >= slen) + __chk_fail(); + + if (__ssp_overlap(src, dst, len)) + __chk_fail(); + + (void)memcpy(dst, src, len + 1); + return dst + len; +} diff --git a/newlib/libc/ssp/stpncpy_chk.c b/newlib/libc/ssp/stpncpy_chk.c new file mode 100644 index 000000000..756626153 --- /dev/null +++ b/newlib/libc/ssp/stpncpy_chk.c @@ -0,0 +1,56 @@ +/* $NetBSD: stpncpy_chk.c,v 1.3 2015/05/09 15:42:21 christos Exp $ */ + +/*- + * Copyright (c) 2013 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: stpncpy_chk.c,v 1.3 2015/05/09 15:42:21 christos Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef stpncpy + +#if !__GNUC_PREREQ__(4, 8) +char *__stpncpy_chk(char * __restrict, const char * __restrict, size_t, size_t); +#endif + +char * +__stpncpy_chk(char * __restrict dst, const char * __restrict src, size_t len, + size_t slen) +{ + if (len > slen) + __chk_fail(); + + if (__ssp_overlap(src, dst, len)) + __chk_fail(); + + return stpncpy(dst, src, len); +} diff --git a/newlib/libc/ssp/strcat_chk.c b/newlib/libc/ssp/strcat_chk.c new file mode 100644 index 000000000..d57f9559b --- /dev/null +++ b/newlib/libc/ssp/strcat_chk.c @@ -0,0 +1,62 @@ +/* $NetBSD: strcat_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: strcat_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +char *__strcat_chk(char * __restrict, const char * __restrict, size_t); + +char * +__strcat_chk(char * __restrict dst, const char * __restrict src, size_t slen) +{ + char *d; + + for (d = dst; *d; d++) { + if (slen-- == 0) + __chk_fail(); + } + + while (*src) { + if (slen-- == 0) + __chk_fail(); + *d++ = *src++; + } + + if (slen-- == 0) + __chk_fail(); + + *d = '\0'; + return dst; +} diff --git a/newlib/libc/ssp/strcpy_chk.c b/newlib/libc/ssp/strcpy_chk.c new file mode 100644 index 000000000..cef160a62 --- /dev/null +++ b/newlib/libc/ssp/strcpy_chk.c @@ -0,0 +1,55 @@ +/* $NetBSD: strcpy_chk.c,v 1.8 2015/05/09 15:42:21 christos Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: strcpy_chk.c,v 1.8 2015/05/09 15:42:21 christos Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef memcpy + +char *__strcpy_chk(char * __restrict, const char * __restrict, size_t); + +char * +__strcpy_chk(char * __restrict dst, const char * __restrict src, size_t slen) +{ + size_t len = strlen(src) + 1; + + if (len > slen) + __chk_fail(); + + if (__ssp_overlap(src, dst, len)) + __chk_fail(); + + return memcpy(dst, src, len); +} diff --git a/newlib/libc/ssp/strncat_chk.c b/newlib/libc/ssp/strncat_chk.c new file mode 100644 index 000000000..5ce5a9ef6 --- /dev/null +++ b/newlib/libc/ssp/strncat_chk.c @@ -0,0 +1,73 @@ +/* $NetBSD: strncat_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: strncat_chk.c,v 1.5 2014/09/17 00:39:28 joerg Exp $"); + +/*LINTLIBRARY*/ + +#include +#include +#include + +char *__strncat_chk(char * __restrict, const char * __restrict, size_t, + size_t); + +char * +__strncat_chk(char * __restrict dst, const char * __restrict src, size_t len, + size_t slen) +{ + char *d; + + if (len == 0) + return dst; + + if (len > slen) + __chk_fail(); + + for (d = dst; *d; d++) { + if (slen-- == 0) + __chk_fail(); + } + + do { + if ((*d = *src++) == '\0') + break; + if (slen-- == 0) + __chk_fail(); + d++; + } while (--len != 0); + + if (slen-- == 0) + __chk_fail(); + + *d = '\0'; + return dst; +} diff --git a/newlib/libc/ssp/strncpy_chk.c b/newlib/libc/ssp/strncpy_chk.c new file mode 100644 index 000000000..591157a25 --- /dev/null +++ b/newlib/libc/ssp/strncpy_chk.c @@ -0,0 +1,55 @@ +/* $NetBSD: strncpy_chk.c,v 1.6 2015/05/09 15:42:21 christos Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: strncpy_chk.c,v 1.6 2015/05/09 15:42:21 christos Exp $"); + +/*LINTLIBRARY*/ + +#include +#include + +#undef strncpy + +char *__strncpy_chk(char * __restrict, const char * __restrict, size_t, + size_t); + +char * +__strncpy_chk(char * __restrict dst, const char * __restrict src, size_t len, + size_t slen) +{ + if (len > slen) + __chk_fail(); + + if (__ssp_overlap(src, dst, len)) + __chk_fail(); + + return strncpy(dst, src, len); +} From a997f98b2a82c74e0ad809a6d0a6d6a9b8cb03c3 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:21:35 -0600 Subject: [PATCH 118/649] ssp: add Object Size Checking for strings.h The implementation is from NetBSD, with the addition of explicit_bzero for parity with glibc. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/strings.h | 55 +++++++++++++++++++++++++++++++ newlib/libc/include/strings.h | 4 +++ 2 files changed, 59 insertions(+) create mode 100644 newlib/libc/include/ssp/strings.h diff --git a/newlib/libc/include/ssp/strings.h b/newlib/libc/include/ssp/strings.h new file mode 100644 index 000000000..13adba175 --- /dev/null +++ b/newlib/libc/include/ssp/strings.h @@ -0,0 +1,55 @@ +/* $NetBSD: strings.h,v 1.3 2008/04/28 20:22:54 martin Exp $ */ + +/*- + * Copyright (c) 2007 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STRINGS_H_ +#define _SSP_STRINGS_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +#if __BSD_VISIBLE || __POSIX_VISIBLE <= 200112 +#define bcopy(src, dst, len) \ + ((__ssp_bos0(dst) != (size_t)-1) ? \ + __builtin___memmove_chk(dst, src, len, __ssp_bos0(dst)) : \ + __memmove_ichk(dst, src, len)) +#define bzero(dst, len) \ + ((__ssp_bos0(dst) != (size_t)-1) ? \ + __builtin___memset_chk(dst, 0, len, __ssp_bos0(dst)) : \ + __memset_ichk(dst, 0, len)) +#endif + +#if __BSD_VISIBLE +__ssp_redirect0(void, explicit_bzero, (void *__buf, size_t __len), \ + (__buf, __len)); +#endif + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STRINGS_H_ */ diff --git a/newlib/libc/include/strings.h b/newlib/libc/include/strings.h index 50a304215..7e2e557e7 100644 --- a/newlib/libc/include/strings.h +++ b/newlib/libc/include/strings.h @@ -73,4 +73,8 @@ int strncasecmp_l (const char *, const char *, size_t, locale_t); #endif __END_DECLS +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _STRINGS_H_ */ From 576093d46b98100b5da9c606fe96f049f321bd90 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:24:16 -0600 Subject: [PATCH 119/649] ssp: add Object Size Checking for stdio.h, part 1 The implementation is mostly from NetBSD, except for switching fgets to pure inline, and the addition of fgets_unlocked, fread, and fread_unlocked for parity with glibc. The following functions are also guarded in glibc: asprintf, dprintf, fprintf, printf, vasprintf, vdprintf, vfprintf, vprintf. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/stdio.h | 101 ++++++++++++++++++++++++++++++++ newlib/libc/include/stdio.h | 4 ++ newlib/libc/ssp/gets_chk.c | 78 ++++++++++++++++++++++++ newlib/libc/ssp/snprintf_chk.c | 59 +++++++++++++++++++ newlib/libc/ssp/sprintf_chk.c | 63 ++++++++++++++++++++ newlib/libc/ssp/vsnprintf_chk.c | 51 ++++++++++++++++ newlib/libc/ssp/vsprintf_chk.c | 60 +++++++++++++++++++ 7 files changed, 416 insertions(+) create mode 100644 newlib/libc/include/ssp/stdio.h create mode 100644 newlib/libc/ssp/gets_chk.c create mode 100644 newlib/libc/ssp/snprintf_chk.c create mode 100644 newlib/libc/ssp/sprintf_chk.c create mode 100644 newlib/libc/ssp/vsnprintf_chk.c create mode 100644 newlib/libc/ssp/vsprintf_chk.c diff --git a/newlib/libc/include/ssp/stdio.h b/newlib/libc/include/ssp/stdio.h new file mode 100644 index 000000000..df2cd1859 --- /dev/null +++ b/newlib/libc/include/ssp/stdio.h @@ -0,0 +1,101 @@ +/* $NetBSD: stdio.h,v 1.5 2011/07/17 20:54:34 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_STDIO_H_ +#define _SSP_STDIO_H_ + +#include + +__BEGIN_DECLS +int __sprintf_chk(char *__restrict, int, size_t, const char *__restrict, ...) + __printflike(4, 5); +int __vsprintf_chk(char *__restrict, int, size_t, const char *__restrict, + __va_list) + __printflike(4, 0); +int __snprintf_chk(char *__restrict, size_t, int, size_t, + const char *__restrict, ...) + __printflike(5, 6); +int __vsnprintf_chk(char *__restrict, size_t, int, size_t, + const char *__restrict, __va_list) + __printflike(5, 0); +char *__gets_chk(char *, size_t); +__END_DECLS + +#if __SSP_FORTIFY_LEVEL > 0 + + +#define sprintf(str, ...) \ + __builtin___sprintf_chk(str, 0, __ssp_bos(str), __VA_ARGS__) + +#define vsprintf(str, fmt, ap) \ + __builtin___vsprintf_chk(str, 0, __ssp_bos(str), fmt, ap) + +#define snprintf(str, len, ...) \ + __builtin___snprintf_chk(str, len, 0, __ssp_bos(str), __VA_ARGS__) + +#define vsnprintf(str, len, fmt, ap) \ + __builtin___vsnprintf_chk(str, len, 0, __ssp_bos(str), fmt, ap) + +#define gets(str) \ + __gets_chk(str, __ssp_bos(str)) + +__ssp_decl(char *, fgets, (char *__restrict __buf, int __len, FILE *__fp)) +{ + if (__len > 0) + __ssp_check(__buf, (size_t)__len, __ssp_bos); + return __ssp_real_fgets(__buf, __len, __fp); +} + +#if __GNU_VISIBLE +__ssp_decl(char *, fgets_unlocked, (char *__restrict __buf, int __len, FILE *__fp)) +{ + if (__len > 0) + __ssp_check(__buf, (size_t)__len, __ssp_bos); + return __ssp_real_fgets_unlocked(__buf, __len, __fp); +} +#endif /* __GNU_VISIBLE */ + +__ssp_decl(size_t, fread, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __fp)) +{ + __ssp_check(__ptr, __size * __n, __ssp_bos0); + return __ssp_real_fread(__ptr, __size, __n, __fp); +} + +#if __MISC_VISIBLE +__ssp_decl(size_t, fread_unlocked, (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __fp)) +{ + __ssp_check(__ptr, __size * __n, __ssp_bos0); + return __ssp_real_fread_unlocked(__ptr, __size, __n, __fp); +} +#endif /* __MISC_VISIBLE */ + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ + +#endif /* _SSP_STDIO_H_ */ diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index ee0f612c4..b648e6201 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -796,4 +796,8 @@ _putchar_unlocked(int _c) _END_STD_C +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _STDIO_H_ */ diff --git a/newlib/libc/ssp/gets_chk.c b/newlib/libc/ssp/gets_chk.c new file mode 100644 index 000000000..b4f7015bc --- /dev/null +++ b/newlib/libc/ssp/gets_chk.c @@ -0,0 +1,78 @@ +/* $NetBSD: gets_chk.c,v 1.7 2013/10/04 20:49:16 christos Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: gets_chk.c,v 1.7 2013/10/04 20:49:16 christos Exp $"); + +/*LINTLIBRARY*/ + +#include +#include +#include +#include +#include +#include + +extern char *__gets(char *); +#undef gets +#ifdef __NEWLIB__ +#define __gets gets +#endif + +char * +__gets_chk(char * __restrict buf, size_t slen) +{ + char *abuf; + size_t len; + + if (slen >= (size_t)INT_MAX) + return __gets(buf); + + if ((abuf = malloc(slen + 1)) == NULL) + return __gets(buf); + + if (fgets(abuf, (int)(slen + 1), stdin) == NULL) { + free(abuf); + return NULL; + } + + len = strlen(abuf); + if (len > 0 && abuf[len - 1] == '\n') + --len; + + if (len >= slen) + __chk_fail(); + + (void)memcpy(buf, abuf, len); + + buf[len] = '\0'; + free(abuf); + return buf; +} diff --git a/newlib/libc/ssp/snprintf_chk.c b/newlib/libc/ssp/snprintf_chk.c new file mode 100644 index 000000000..cede5a4bd --- /dev/null +++ b/newlib/libc/ssp/snprintf_chk.c @@ -0,0 +1,59 @@ +/* $NetBSD: snprintf_chk.c,v 1.5 2008/04/28 20:23:00 martin Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: snprintf_chk.c,v 1.5 2008/04/28 20:23:00 martin Exp $"); + +/*LINTLIBRARY*/ + +#include +#include +#include +#include + +#undef vsnprintf + +/*ARGSUSED*/ +int +__snprintf_chk(char * __restrict buf, size_t len, int flags, size_t slen, + const char * __restrict fmt, ...) +{ + va_list ap; + int rv; + + if (len > slen) + __chk_fail(); + + va_start(ap, fmt); + rv = vsnprintf(buf, len, fmt, ap); + va_end(ap); + + return rv; +} diff --git a/newlib/libc/ssp/sprintf_chk.c b/newlib/libc/ssp/sprintf_chk.c new file mode 100644 index 000000000..1e924799b --- /dev/null +++ b/newlib/libc/ssp/sprintf_chk.c @@ -0,0 +1,63 @@ +/* $NetBSD: sprintf_chk.c,v 1.6 2009/02/05 05:40:36 lukem Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: sprintf_chk.c,v 1.6 2009/02/05 05:40:36 lukem Exp $"); + +/*LINTLIBRARY*/ + +#include +#include +#include +#include +#include + +#undef vsnprintf +#undef vsprintf + +int +/*ARGSUSED*/ +__sprintf_chk(char * __restrict buf, int flags, size_t slen, + const char * __restrict fmt, ...) +{ + va_list ap; + int rv; + + va_start(ap, fmt); + if (slen > (size_t)INT_MAX) + rv = vsprintf(buf, fmt, ap); + else { + if ((rv = vsnprintf(buf, slen, fmt, ap)) >= 0 && (size_t)rv >= slen) + __chk_fail(); + } + va_end(ap); + + return rv; +} diff --git a/newlib/libc/ssp/vsnprintf_chk.c b/newlib/libc/ssp/vsnprintf_chk.c new file mode 100644 index 000000000..2b8802908 --- /dev/null +++ b/newlib/libc/ssp/vsnprintf_chk.c @@ -0,0 +1,51 @@ +/* $NetBSD: vsnprintf_chk.c,v 1.5 2008/04/28 20:23:00 martin Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: vsnprintf_chk.c,v 1.5 2008/04/28 20:23:00 martin Exp $"); + +/*LINTLIBRARY*/ + +#include +#include +#include +#include + +#undef vsnprintf + +int +__vsnprintf_chk(char * __restrict buf, size_t len, int flags, size_t slen, + const char * __restrict fmt, va_list ap) +{ + if (len > slen) + __chk_fail(); + + return vsnprintf(buf, len, fmt, ap); +} diff --git a/newlib/libc/ssp/vsprintf_chk.c b/newlib/libc/ssp/vsprintf_chk.c new file mode 100644 index 000000000..fec8a18c7 --- /dev/null +++ b/newlib/libc/ssp/vsprintf_chk.c @@ -0,0 +1,60 @@ +/* $NetBSD: vsprintf_chk.c,v 1.6 2009/02/05 05:39:38 lukem Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#include +__RCSID("$NetBSD: vsprintf_chk.c,v 1.6 2009/02/05 05:39:38 lukem Exp $"); + +/*LINTLIBRARY*/ + +#include +#include +#include +#include +#include + +#undef vsprintf +#undef vsnprintf + +/*ARGSUSED*/ +int +__vsprintf_chk(char * __restrict buf, int flags, size_t slen, + const char * __restrict fmt, va_list ap) +{ + int rv; + + if (slen > (size_t)INT_MAX) + rv = vsprintf(buf, fmt, ap); + else { + if ((rv = vsnprintf(buf, slen, fmt, ap)) >= 0 && (size_t)rv >= slen) + __chk_fail(); + } + + return rv; +} From 6b02865d80f6a38caff78e9bff5c866ac0d6dff6 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:49:18 -0600 Subject: [PATCH 120/649] ssp: add Object Size Checking for unistd.h, part 1 The implementation is from NetBSD, with the addition of feature test macros for readlink. glibc also wraps the following functions: confstr, getdomainname, getgroups, gethostname, getlogin_r, getwd, pread, readlinkat, ttyname_r. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/unistd.h | 53 ++++++++++++++++++++++++++++++++ newlib/libc/include/sys/unistd.h | 5 +++ 2 files changed, 58 insertions(+) create mode 100644 newlib/libc/include/ssp/unistd.h diff --git a/newlib/libc/include/ssp/unistd.h b/newlib/libc/include/ssp/unistd.h new file mode 100644 index 000000000..861edd30b --- /dev/null +++ b/newlib/libc/include/ssp/unistd.h @@ -0,0 +1,53 @@ +/* $NetBSD: unistd.h,v 1.7 2015/06/25 18:41:03 joerg Exp $ */ + +/*- + * Copyright (c) 2006 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Christos Zoulas. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ +#ifndef _SSP_UNISTD_H_ +#define _SSP_UNISTD_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 +__BEGIN_DECLS + +__ssp_redirect0(_READ_WRITE_RETURN_TYPE, read, \ + (int __fd, void *__buf, size_t __len), (__fd, __buf, __len)); + +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4 +__ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \ + char *__restrict __buf, size_t __len), (__path, __buf, __len)); +#endif + +__ssp_redirect_raw(char *, getcwd, (char *__buf, size_t __len), + (__buf, __len), __buf != 0, __ssp_bos); + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_UNISTD_H_ */ diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 75f8a51df..0df4dc374 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -567,4 +567,9 @@ int _EXFUN(unlinkat, (int, const char *, int)); #ifdef __cplusplus } #endif + +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _SYS_UNISTD_H */ From 192de5a349f61a70e9d2f74c2be0674114391f56 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 28 Nov 2017 18:11:59 -0600 Subject: [PATCH 121/649] ssp: add documentation Signed-off-by: Yaakov Selkowitz --- newlib/libc/libc.in.xml | 1 + newlib/libc/libc.texinfo | 1 + newlib/libc/ssp/ssp.tex | 44 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 46 insertions(+) create mode 100644 newlib/libc/ssp/ssp.tex diff --git a/newlib/libc/libc.in.xml b/newlib/libc/libc.in.xml index 972696189..bf5f8a05f 100644 --- a/newlib/libc/libc.in.xml +++ b/newlib/libc/libc.in.xml @@ -35,6 +35,7 @@ + diff --git a/newlib/libc/libc.texinfo b/newlib/libc/libc.texinfo index 995e95e5c..f8c820baf 100644 --- a/newlib/libc/libc.texinfo +++ b/newlib/libc/libc.texinfo @@ -171,6 +171,7 @@ into another language, under the above conditions for modified versions. @ifset ICONV * Iconv:: @end ifset +* Overflow Protection:: * Document Index:: @end menu diff --git a/newlib/libc/ssp/ssp.tex b/newlib/libc/ssp/ssp.tex new file mode 100644 index 000000000..f8440bdf9 --- /dev/null +++ b/newlib/libc/ssp/ssp.tex @@ -0,0 +1,44 @@ +@node Overflow Protection +@chapter Overflow Protection + +@menu +* Stack Smashing Protection:: Checks enabled with -fstack-protector* +* Object Size Checking:: Checks enabled with _FORTIFY_SOURCE +@end menu + +@node Stack Smashing Protection +@section Stack Smashing Protection +Stack Smashing Protection is a compiler feature which emits extra code +to check for stack smashing attacks. It depends on a canary, which is +initialized with the process, and functions for process termination when +an overflow is detected. These are private entry points intended solely +for use by the compiler, and are used when any of the @code{-fstack-protector}, +@code{-fstack-protector-all}, @code{-fstack-protector-explicit}, or +@code{-fstack-protector-strong} compiler flags are enabled. + +@node Object Size Checking +@section Object Size Checking +Object Size Checking is a feature which wraps certain functions with checks +to prevent buffer overflows. These are enabled when compiling with +optimization (@code{-O1} and higher) and @code{_FORTIFY_SOURCE} defined +to 1, or for stricter checks, to 2. + +@cindex list of overflow protected functions +The following functions use object size checking to detect buffer overflows +when enabled: + +@example +@exdent @emph{String functions:} +bcopy memmove strcpy +bzero mempcpy strcat +explicit_bzero memset strncat +memcpy stpcpy strncpy + +@exdent @emph{Stdio functions:} +fgets fread_unlocked sprintf +fgets_unlocked gets vsnprintf +fread snprintf vsprintf + +@exdent @emph{System functions:} +getcwd read readlink +@end example From 6f84ee8105787b45d05cf18e85a405790da39591 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:54:09 -0600 Subject: [PATCH 122/649] ssp: add build infrastructure Signed-off-by: Yaakov Selkowitz --- newlib/Makefile.am | 4 + newlib/Makefile.in | 4 + newlib/libc/Makefile.am | 4 +- newlib/libc/Makefile.in | 15 +- newlib/libc/configure | 3 +- newlib/libc/configure.in | 2 +- newlib/libc/ssp/Makefile.am | 69 ++++ newlib/libc/ssp/Makefile.in | 706 ++++++++++++++++++++++++++++++++++++ 8 files changed, 798 insertions(+), 9 deletions(-) create mode 100644 newlib/libc/ssp/Makefile.am create mode 100644 newlib/libc/ssp/Makefile.in diff --git a/newlib/Makefile.am b/newlib/Makefile.am index effa2adba..205705d88 100644 --- a/newlib/Makefile.am +++ b/newlib/Makefile.am @@ -324,6 +324,10 @@ endif for i in $(srcdir)/libc/include/rpc/*.h; do \ $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \ done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/ssp; \ + for i in $(srcdir)/libc/include/ssp/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/ssp/`basename $$i`; \ + done; \ $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \ for i in $(srcdir)/libc/include/sys/*.h; do \ $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \ diff --git a/newlib/Makefile.in b/newlib/Makefile.in index 7756e7066..3b35251a7 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -1071,6 +1071,10 @@ install-data-local: install-toollibLIBRARIES for i in $(srcdir)/libc/include/rpc/*.h; do \ $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/rpc/`basename $$i`; \ done; \ + $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/ssp; \ + for i in $(srcdir)/libc/include/ssp/*.h; do \ + $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/ssp/`basename $$i`; \ + done; \ $(mkinstalldirs) $(DESTDIR)$(tooldir)/include/sys; \ for i in $(srcdir)/libc/include/sys/*.h; do \ $(INSTALL_DATA) $$i $(DESTDIR)$(tooldir)/include/sys/`basename $$i`; \ diff --git a/newlib/libc/Makefile.am b/newlib/libc/Makefile.am index 6e97bca52..e27ff5cf1 100644 --- a/newlib/libc/Makefile.am +++ b/newlib/libc/Makefile.am @@ -42,7 +42,7 @@ endif # Do not change the order without considering the doc impact. SUBDIRS = argz stdlib ctype search $(STDIO_SUBDIR) $(STDIO64_SUBDIR) string $(SIGNAL_SUBDIR) time locale sys reent \ $(extra_dir) errno misc machine $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) $(NEWLIB_ICONV_DIRS) \ - $(XDR_SUBDIR) . + $(XDR_SUBDIR) ssp . noinst_DATA = $(CRT0) @@ -64,6 +64,7 @@ SUBLIBS = \ $(LIBC_EXTRA_LIB) \ errno/liberrno.$(aext) \ misc/libmisc.$(aext) \ + ssp/libssp.$(aext) \ $(LIBC_UNIX_LIB) \ $(LIBC_POSIX_LIB) \ $(LIBC_SYSCALL_LIB) \ @@ -87,6 +88,7 @@ SUBLIBS = \ $(LIBC_EXTRA_LIB) \ errno/lib.$(aext) \ misc/lib.$(aext) \ + ssp/lib.$(aext) \ $(LIBC_UNIX_LIB) \ $(LIBC_POSIX_LIB) \ $(LIBC_SYSCALL_LIB) \ diff --git a/newlib/libc/Makefile.in b/newlib/libc/Makefile.in index a597c1d92..c3de3f600 100644 --- a/newlib/libc/Makefile.in +++ b/newlib/libc/Makefile.in @@ -90,9 +90,10 @@ am__DEPENDENCIES_1 = @USE_LIBTOOL_FALSE@ time/lib.$(aext) locale/lib.$(aext) \ @USE_LIBTOOL_FALSE@ reent/lib.$(aext) $(am__DEPENDENCIES_1) \ @USE_LIBTOOL_FALSE@ errno/lib.$(aext) misc/lib.$(aext) \ +@USE_LIBTOOL_FALSE@ ssp/lib.$(aext) $(am__DEPENDENCIES_1) \ @USE_LIBTOOL_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ -@USE_LIBTOOL_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ -@USE_LIBTOOL_FALSE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +@USE_LIBTOOL_FALSE@ $(am__DEPENDENCIES_2) $(am__DEPENDENCIES_1) \ +@USE_LIBTOOL_FALSE@ $(am__DEPENDENCIES_1) @USE_LIBTOOL_TRUE@am__DEPENDENCIES_3 = argz/libargz.$(aext) \ @USE_LIBTOOL_TRUE@ stdlib/libstdlib.$(aext) \ @USE_LIBTOOL_TRUE@ ctype/libctype.$(aext) \ @@ -104,9 +105,9 @@ am__DEPENDENCIES_1 = @USE_LIBTOOL_TRUE@ locale/liblocale.$(aext) \ @USE_LIBTOOL_TRUE@ reent/libreent.$(aext) $(am__DEPENDENCIES_1) \ @USE_LIBTOOL_TRUE@ errno/liberrno.$(aext) misc/libmisc.$(aext) \ +@USE_LIBTOOL_TRUE@ ssp/libssp.$(aext) $(am__DEPENDENCIES_1) \ @USE_LIBTOOL_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ -@USE_LIBTOOL_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) \ -@USE_LIBTOOL_TRUE@ $(am__DEPENDENCIES_1) +@USE_LIBTOOL_TRUE@ $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) am_libc_la_OBJECTS = libc_la_OBJECTS = $(am_libc_la_OBJECTS) libc_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ @@ -191,7 +192,7 @@ ETAGS = etags CTAGS = ctags DIST_SUBDIRS = argz stdlib ctype search stdio stdio64 string signal \ time locale sys reent @extra_dir@ errno misc machine unix \ - posix syscalls iconv xdr . + posix syscalls iconv xdr ssp . ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AR = @AR@ @@ -353,7 +354,7 @@ AUTOMAKE_OPTIONS = cygnus # Do not change the order without considering the doc impact. SUBDIRS = argz stdlib ctype search $(STDIO_SUBDIR) $(STDIO64_SUBDIR) string $(SIGNAL_SUBDIR) time locale sys reent \ $(extra_dir) errno misc machine $(UNIX_SUBDIR) $(POSIX_SUBDIR) $(SYSCALLS_SUBDIR) $(NEWLIB_ICONV_DIRS) \ - $(XDR_SUBDIR) . + $(XDR_SUBDIR) ssp . noinst_DATA = $(CRT0) @USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libc.la @@ -373,6 +374,7 @@ noinst_DATA = $(CRT0) @USE_LIBTOOL_FALSE@ $(LIBC_EXTRA_LIB) \ @USE_LIBTOOL_FALSE@ errno/lib.$(aext) \ @USE_LIBTOOL_FALSE@ misc/lib.$(aext) \ +@USE_LIBTOOL_FALSE@ ssp/lib.$(aext) \ @USE_LIBTOOL_FALSE@ $(LIBC_UNIX_LIB) \ @USE_LIBTOOL_FALSE@ $(LIBC_POSIX_LIB) \ @USE_LIBTOOL_FALSE@ $(LIBC_SYSCALL_LIB) \ @@ -396,6 +398,7 @@ noinst_DATA = $(CRT0) @USE_LIBTOOL_TRUE@ $(LIBC_EXTRA_LIB) \ @USE_LIBTOOL_TRUE@ errno/liberrno.$(aext) \ @USE_LIBTOOL_TRUE@ misc/libmisc.$(aext) \ +@USE_LIBTOOL_TRUE@ ssp/libssp.$(aext) \ @USE_LIBTOOL_TRUE@ $(LIBC_UNIX_LIB) \ @USE_LIBTOOL_TRUE@ $(LIBC_POSIX_LIB) \ @USE_LIBTOOL_TRUE@ $(LIBC_SYSCALL_LIB) \ diff --git a/newlib/libc/configure b/newlib/libc/configure index dabe44fd9..240c384d3 100755 --- a/newlib/libc/configure +++ b/newlib/libc/configure @@ -12121,7 +12121,7 @@ fi -ac_config_files="$ac_config_files Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile iconv/Makefile iconv/ces/Makefile iconv/ccs/Makefile iconv/ccs/binary/Makefile iconv/lib/Makefile xdr/Makefile" +ac_config_files="$ac_config_files Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile iconv/Makefile iconv/ces/Makefile iconv/ccs/Makefile iconv/ccs/binary/Makefile iconv/lib/Makefile ssp/Makefile xdr/Makefile" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure @@ -13240,6 +13240,7 @@ do "iconv/ccs/Makefile") CONFIG_FILES="$CONFIG_FILES iconv/ccs/Makefile" ;; "iconv/ccs/binary/Makefile") CONFIG_FILES="$CONFIG_FILES iconv/ccs/binary/Makefile" ;; "iconv/lib/Makefile") CONFIG_FILES="$CONFIG_FILES iconv/lib/Makefile" ;; + "ssp/Makefile") CONFIG_FILES="$CONFIG_FILES ssp/Makefile" ;; "xdr/Makefile") CONFIG_FILES="$CONFIG_FILES xdr/Makefile" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; diff --git a/newlib/libc/configure.in b/newlib/libc/configure.in index ac25a3933..d3b10a500 100644 --- a/newlib/libc/configure.in +++ b/newlib/libc/configure.in @@ -219,5 +219,5 @@ fi AC_SUBST(LIBC_MACHINE_LIB) AC_SUBST(machine_dir) -AC_CONFIG_FILES([Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile iconv/Makefile iconv/ces/Makefile iconv/ccs/Makefile iconv/ccs/binary/Makefile iconv/lib/Makefile xdr/Makefile]) +AC_CONFIG_FILES([Makefile argz/Makefile ctype/Makefile errno/Makefile locale/Makefile misc/Makefile reent/Makefile search/Makefile stdio/Makefile stdio64/Makefile stdlib/Makefile string/Makefile time/Makefile posix/Makefile signal/Makefile syscalls/Makefile unix/Makefile iconv/Makefile iconv/ces/Makefile iconv/ccs/Makefile iconv/ccs/binary/Makefile iconv/lib/Makefile ssp/Makefile xdr/Makefile]) AC_OUTPUT diff --git a/newlib/libc/ssp/Makefile.am b/newlib/libc/ssp/Makefile.am new file mode 100644 index 000000000..23754baf5 --- /dev/null +++ b/newlib/libc/ssp/Makefile.am @@ -0,0 +1,69 @@ +## Process this file with automake to generate Makefile.in + +AUTOMAKE_OPTIONS = cygnus + +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) + +GENERAL_SOURCES = \ + chk_fail.c \ + stack_protector.c + +STRING_SOURCES = \ + memcpy_chk.c \ + memmove_chk.c \ + mempcpy_chk.c \ + memset_chk.c \ + stpcpy_chk.c \ + stpncpy_chk.c \ + strcat_chk.c \ + strcpy_chk.c \ + strncat_chk.c \ + strncpy_chk.c + +STDIO_SOURCES = \ + gets_chk.c \ + snprintf_chk.c \ + sprintf_chk.c \ + vsnprintf_chk.c \ + vsprintf_chk.c + +## None of these functions are specified by EL/IX +if ELIX_LEVEL_1 +ELIX_SOURCES = +else +if ELIX_LEVEL_2 +ELIX_SOURCES = +else +if ELIX_LEVEL_3 +ELIX_SOURCES = +else +if ELIX_LEVEL_4 +ELIX_SOURCES = +else +if HAVE_STDIO_DIR +ELIX_SOURCES = $(GENERAL_SOURCES) $(STRING_SOURCES) $(STDIO_SOURCES) +else +ELIX_SOURCES = $(GENERAL_SOURCES) $(STRING_SOURCES) +endif +endif +endif +endif +endif + +libssp_la_LDFLAGS = -Xcompiler -nostdlib + +if USE_LIBTOOL +noinst_LTLIBRARIES = libssp.la +libssp_la_SOURCES = $(ELIX_SOURCES) +noinst_DATA = objectlist.awk.in +else +noinst_LIBRARIES = lib.a +lib_a_SOURCES = $(ELIX_SOURCES) +lib_a_CFLAGS = $(AM_CFLAGS) +noinst_DATA = +endif # USE_LIBTOOL + +CHEWOUT_FILES = +CHAPTERS = ssp.tex + +include $(srcdir)/../../Makefile.shared diff --git a/newlib/libc/ssp/Makefile.in b/newlib/libc/ssp/Makefile.in new file mode 100644 index 000000000..7b5ca11ff --- /dev/null +++ b/newlib/libc/ssp/Makefile.in @@ -0,0 +1,706 @@ +# Makefile.in generated by automake 1.11.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +am__make_dryrun = \ + { \ + am__dry=no; \ + case $$MAKEFLAGS in \ + *\\[\ \ ]*) \ + echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ + | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ + *) \ + for am__flg in $$MAKEFLAGS; do \ + case $$am__flg in \ + *=*|--*) ;; \ + *n*) am__dry=yes; break;; \ + esac; \ + done;; \ + esac; \ + test $$am__dry = yes; \ + } +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \ + $(srcdir)/Makefile.am +subdir = ssp +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/../../lt~obsolete.m4 \ + $(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LIBRARIES = $(noinst_LIBRARIES) +ARFLAGS = cru +lib_a_AR = $(AR) $(ARFLAGS) +lib_a_LIBADD = +am__objects_1 = lib_a-chk_fail.$(OBJEXT) \ + lib_a-stack_protector.$(OBJEXT) +am__objects_2 = lib_a-memcpy_chk.$(OBJEXT) lib_a-memmove_chk.$(OBJEXT) \ + lib_a-mempcpy_chk.$(OBJEXT) lib_a-memset_chk.$(OBJEXT) \ + lib_a-stpcpy_chk.$(OBJEXT) lib_a-stpncpy_chk.$(OBJEXT) \ + lib_a-strcat_chk.$(OBJEXT) lib_a-strcpy_chk.$(OBJEXT) \ + lib_a-strncat_chk.$(OBJEXT) lib_a-strncpy_chk.$(OBJEXT) +am__objects_3 = lib_a-gets_chk.$(OBJEXT) lib_a-snprintf_chk.$(OBJEXT) \ + lib_a-sprintf_chk.$(OBJEXT) lib_a-vsnprintf_chk.$(OBJEXT) \ + lib_a-vsprintf_chk.$(OBJEXT) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_FALSE@am__objects_4 = $(am__objects_1) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_FALSE@ $(am__objects_2) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@am__objects_4 = $(am__objects_1) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@ $(am__objects_2) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@ $(am__objects_3) +@USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_4) +lib_a_OBJECTS = $(am_lib_a_OBJECTS) +LTLIBRARIES = $(noinst_LTLIBRARIES) +libssp_la_LIBADD = +am__objects_5 = chk_fail.lo stack_protector.lo +am__objects_6 = memcpy_chk.lo memmove_chk.lo mempcpy_chk.lo \ + memset_chk.lo stpcpy_chk.lo stpncpy_chk.lo strcat_chk.lo \ + strcpy_chk.lo strncat_chk.lo strncpy_chk.lo +am__objects_7 = gets_chk.lo snprintf_chk.lo sprintf_chk.lo \ + vsnprintf_chk.lo vsprintf_chk.lo +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_FALSE@am__objects_8 = $(am__objects_5) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_FALSE@ $(am__objects_6) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@am__objects_8 = $(am__objects_5) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@ $(am__objects_6) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@ $(am__objects_7) +@USE_LIBTOOL_TRUE@am_libssp_la_OBJECTS = $(am__objects_8) +libssp_la_OBJECTS = $(am_libssp_la_OBJECTS) +libssp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libssp_la_LDFLAGS) $(LDFLAGS) -o $@ +@USE_LIBTOOL_TRUE@am_libssp_la_rpath = +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = +am__depfiles_maybe = +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(lib_a_SOURCES) $(libssp_la_SOURCES) +am__can_run_installinfo = \ + case $$AM_UPDATE_INFO_DIR in \ + n|no|NO) false;; \ + *) (install-info --version) >/dev/null 2>&1;; \ + esac +DATA = $(noinst_DATA) +ETAGS = etags +CTAGS = ctags +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CRT0 = @CRT0@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +GREP = @GREP@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBC_EXTRA_DEF = @LIBC_EXTRA_DEF@ +LIBC_EXTRA_LIB = @LIBC_EXTRA_LIB@ +LIBC_MACHINE_LIB = @LIBC_MACHINE_LIB@ +LIBC_POSIX_DEF = @LIBC_POSIX_DEF@ +LIBC_POSIX_LIB = @LIBC_POSIX_LIB@ +LIBC_SIGNAL_DEF = @LIBC_SIGNAL_DEF@ +LIBC_SIGNAL_LIB = @LIBC_SIGNAL_LIB@ +LIBC_STDIO64_DEF = @LIBC_STDIO64_DEF@ +LIBC_STDIO64_LIB = @LIBC_STDIO64_LIB@ +LIBC_STDIO_DEF = @LIBC_STDIO_DEF@ +LIBC_STDIO_LIB = @LIBC_STDIO_LIB@ +LIBC_SYSCALL_LIB = @LIBC_SYSCALL_LIB@ +LIBC_SYS_LIB = @LIBC_SYS_LIB@ +LIBC_UNIX_LIB = @LIBC_UNIX_LIB@ +LIBC_XDR_DEF = @LIBC_XDR_DEF@ +LIBC_XDR_LIB = @LIBC_XDR_LIB@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NO_INCLUDE_LIST = @NO_INCLUDE_LIST@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +READELF = @READELF@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +aext = @aext@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +extra_dir = @extra_dir@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +libm_machine_dir = @libm_machine_dir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +lpfx = @lpfx@ +machine_dir = @machine_dir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +newlib_basedir = @newlib_basedir@ +oext = @oext@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +subdirs = @subdirs@ +sys_dir = @sys_dir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = cygnus +INCLUDES = $(NEWLIB_CFLAGS) $(CROSS_CFLAGS) $(TARGET_CFLAGS) +GENERAL_SOURCES = \ + chk_fail.c \ + stack_protector.c + +STRING_SOURCES = \ + memcpy_chk.c \ + memmove_chk.c \ + mempcpy_chk.c \ + memset_chk.c \ + stpcpy_chk.c \ + stpncpy_chk.c \ + strcat_chk.c \ + strcpy_chk.c \ + strncat_chk.c \ + strncpy_chk.c + +STDIO_SOURCES = \ + gets_chk.c \ + snprintf_chk.c \ + sprintf_chk.c \ + vsnprintf_chk.c \ + vsprintf_chk.c + +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_FALSE@ELIX_SOURCES = $(GENERAL_SOURCES) $(STRING_SOURCES) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_FALSE@@HAVE_STDIO_DIR_TRUE@ELIX_SOURCES = $(GENERAL_SOURCES) $(STRING_SOURCES) $(STDIO_SOURCES) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@@ELIX_LEVEL_4_TRUE@ELIX_SOURCES = +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_SOURCES = +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_SOURCES = +@ELIX_LEVEL_1_TRUE@ELIX_SOURCES = +libssp_la_LDFLAGS = -Xcompiler -nostdlib +@USE_LIBTOOL_TRUE@noinst_LTLIBRARIES = libssp.la +@USE_LIBTOOL_TRUE@libssp_la_SOURCES = $(ELIX_SOURCES) +@USE_LIBTOOL_FALSE@noinst_DATA = +@USE_LIBTOOL_TRUE@noinst_DATA = objectlist.awk.in +@USE_LIBTOOL_FALSE@noinst_LIBRARIES = lib.a +@USE_LIBTOOL_FALSE@lib_a_SOURCES = $(ELIX_SOURCES) +@USE_LIBTOOL_FALSE@lib_a_CFLAGS = $(AM_CFLAGS) +CHEWOUT_FILES = +CHAPTERS = ssp.tex + +# +# documentation rules +# +SUFFIXES = .def .xml +CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str +DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py +DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) +DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) +CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +all: all-am + +.SUFFIXES: +.SUFFIXES: .def .xml .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/../../Makefile.shared $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --cygnus ssp/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --cygnus ssp/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; +$(srcdir)/../../Makefile.shared: + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLIBRARIES: + -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES) +lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES) + -rm -f lib.a + $(lib_a_AR) lib.a $(lib_a_OBJECTS) $(lib_a_LIBADD) + $(RANLIB) lib.a + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libssp.la: $(libssp_la_OBJECTS) $(libssp_la_DEPENDENCIES) $(EXTRA_libssp_la_DEPENDENCIES) + $(libssp_la_LINK) $(am_libssp_la_rpath) $(libssp_la_OBJECTS) $(libssp_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +.c.o: + $(COMPILE) -c $< + +.c.obj: + $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: + $(LTCOMPILE) -c -o $@ $< + +lib_a-chk_fail.o: chk_fail.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-chk_fail.o `test -f 'chk_fail.c' || echo '$(srcdir)/'`chk_fail.c + +lib_a-chk_fail.obj: chk_fail.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-chk_fail.obj `if test -f 'chk_fail.c'; then $(CYGPATH_W) 'chk_fail.c'; else $(CYGPATH_W) '$(srcdir)/chk_fail.c'; fi` + +lib_a-stack_protector.o: stack_protector.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stack_protector.o `test -f 'stack_protector.c' || echo '$(srcdir)/'`stack_protector.c + +lib_a-stack_protector.obj: stack_protector.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stack_protector.obj `if test -f 'stack_protector.c'; then $(CYGPATH_W) 'stack_protector.c'; else $(CYGPATH_W) '$(srcdir)/stack_protector.c'; fi` + +lib_a-memcpy_chk.o: memcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy_chk.o `test -f 'memcpy_chk.c' || echo '$(srcdir)/'`memcpy_chk.c + +lib_a-memcpy_chk.obj: memcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memcpy_chk.obj `if test -f 'memcpy_chk.c'; then $(CYGPATH_W) 'memcpy_chk.c'; else $(CYGPATH_W) '$(srcdir)/memcpy_chk.c'; fi` + +lib_a-memmove_chk.o: memmove_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmove_chk.o `test -f 'memmove_chk.c' || echo '$(srcdir)/'`memmove_chk.c + +lib_a-memmove_chk.obj: memmove_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memmove_chk.obj `if test -f 'memmove_chk.c'; then $(CYGPATH_W) 'memmove_chk.c'; else $(CYGPATH_W) '$(srcdir)/memmove_chk.c'; fi` + +lib_a-mempcpy_chk.o: mempcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mempcpy_chk.o `test -f 'mempcpy_chk.c' || echo '$(srcdir)/'`mempcpy_chk.c + +lib_a-mempcpy_chk.obj: mempcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mempcpy_chk.obj `if test -f 'mempcpy_chk.c'; then $(CYGPATH_W) 'mempcpy_chk.c'; else $(CYGPATH_W) '$(srcdir)/mempcpy_chk.c'; fi` + +lib_a-memset_chk.o: memset_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memset_chk.o `test -f 'memset_chk.c' || echo '$(srcdir)/'`memset_chk.c + +lib_a-memset_chk.obj: memset_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-memset_chk.obj `if test -f 'memset_chk.c'; then $(CYGPATH_W) 'memset_chk.c'; else $(CYGPATH_W) '$(srcdir)/memset_chk.c'; fi` + +lib_a-stpcpy_chk.o: stpcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stpcpy_chk.o `test -f 'stpcpy_chk.c' || echo '$(srcdir)/'`stpcpy_chk.c + +lib_a-stpcpy_chk.obj: stpcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stpcpy_chk.obj `if test -f 'stpcpy_chk.c'; then $(CYGPATH_W) 'stpcpy_chk.c'; else $(CYGPATH_W) '$(srcdir)/stpcpy_chk.c'; fi` + +lib_a-stpncpy_chk.o: stpncpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stpncpy_chk.o `test -f 'stpncpy_chk.c' || echo '$(srcdir)/'`stpncpy_chk.c + +lib_a-stpncpy_chk.obj: stpncpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-stpncpy_chk.obj `if test -f 'stpncpy_chk.c'; then $(CYGPATH_W) 'stpncpy_chk.c'; else $(CYGPATH_W) '$(srcdir)/stpncpy_chk.c'; fi` + +lib_a-strcat_chk.o: strcat_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcat_chk.o `test -f 'strcat_chk.c' || echo '$(srcdir)/'`strcat_chk.c + +lib_a-strcat_chk.obj: strcat_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcat_chk.obj `if test -f 'strcat_chk.c'; then $(CYGPATH_W) 'strcat_chk.c'; else $(CYGPATH_W) '$(srcdir)/strcat_chk.c'; fi` + +lib_a-strcpy_chk.o: strcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy_chk.o `test -f 'strcpy_chk.c' || echo '$(srcdir)/'`strcpy_chk.c + +lib_a-strcpy_chk.obj: strcpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strcpy_chk.obj `if test -f 'strcpy_chk.c'; then $(CYGPATH_W) 'strcpy_chk.c'; else $(CYGPATH_W) '$(srcdir)/strcpy_chk.c'; fi` + +lib_a-strncat_chk.o: strncat_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncat_chk.o `test -f 'strncat_chk.c' || echo '$(srcdir)/'`strncat_chk.c + +lib_a-strncat_chk.obj: strncat_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncat_chk.obj `if test -f 'strncat_chk.c'; then $(CYGPATH_W) 'strncat_chk.c'; else $(CYGPATH_W) '$(srcdir)/strncat_chk.c'; fi` + +lib_a-strncpy_chk.o: strncpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncpy_chk.o `test -f 'strncpy_chk.c' || echo '$(srcdir)/'`strncpy_chk.c + +lib_a-strncpy_chk.obj: strncpy_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-strncpy_chk.obj `if test -f 'strncpy_chk.c'; then $(CYGPATH_W) 'strncpy_chk.c'; else $(CYGPATH_W) '$(srcdir)/strncpy_chk.c'; fi` + +lib_a-gets_chk.o: gets_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets_chk.o `test -f 'gets_chk.c' || echo '$(srcdir)/'`gets_chk.c + +lib_a-gets_chk.obj: gets_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-gets_chk.obj `if test -f 'gets_chk.c'; then $(CYGPATH_W) 'gets_chk.c'; else $(CYGPATH_W) '$(srcdir)/gets_chk.c'; fi` + +lib_a-snprintf_chk.o: snprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-snprintf_chk.o `test -f 'snprintf_chk.c' || echo '$(srcdir)/'`snprintf_chk.c + +lib_a-snprintf_chk.obj: snprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-snprintf_chk.obj `if test -f 'snprintf_chk.c'; then $(CYGPATH_W) 'snprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/snprintf_chk.c'; fi` + +lib_a-sprintf_chk.o: sprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.o `test -f 'sprintf_chk.c' || echo '$(srcdir)/'`sprintf_chk.c + +lib_a-sprintf_chk.obj: sprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-sprintf_chk.obj `if test -f 'sprintf_chk.c'; then $(CYGPATH_W) 'sprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/sprintf_chk.c'; fi` + +lib_a-vsnprintf_chk.o: vsnprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsnprintf_chk.o `test -f 'vsnprintf_chk.c' || echo '$(srcdir)/'`vsnprintf_chk.c + +lib_a-vsnprintf_chk.obj: vsnprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsnprintf_chk.obj `if test -f 'vsnprintf_chk.c'; then $(CYGPATH_W) 'vsnprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/vsnprintf_chk.c'; fi` + +lib_a-vsprintf_chk.o: vsprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsprintf_chk.o `test -f 'vsprintf_chk.c' || echo '$(srcdir)/'`vsprintf_chk.c + +lib_a-vsprintf_chk.obj: vsprintf_chk.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-vsprintf_chk.obj `if test -f 'vsprintf_chk.c'; then $(CYGPATH_W) 'vsprintf_chk.c'; else $(CYGPATH_W) '$(srcdir)/vsprintf_chk.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags +check-am: +check: check-am +all-am: Makefile $(LIBRARIES) $(LTLIBRARIES) $(DATA) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + if test -z '$(STRIP)'; then \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + install; \ + else \ + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ + fi +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstLIBRARIES \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ + ctags distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags dvi dvi-am html html-am info \ + info-am install install-am install-data install-data-am \ + install-dvi install-dvi-am install-exec install-exec-am \ + install-html install-html-am install-info install-info-am \ + install-man install-pdf install-pdf-am install-ps \ + install-ps-am install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am + +objectlist.awk.in: $(noinst_LTLIBRARIES) + -rm -f objectlist.awk.in + for i in `ls *.lo` ; \ + do \ + echo $$i `pwd`/$$i >> objectlist.awk.in ; \ + done + +.c.def: + $(CHEW) < $< > $*.def 2> $*.ref + touch stmp-def + +TARGETDOC ?= ../tmp.texi + +doc: $(CHEWOUT_FILES) + for chapter in $(CHAPTERS) ; \ + do \ + cat $(srcdir)/$$chapter >> $(TARGETDOC) ; \ + done + +.c.xml: + $(DOCBOOK_CHEW) < $< > $*.xml || ( rm $*.xml && false ) + @touch stmp-xml + +docbook: $(DOCBOOK_OUT_FILES) + for chapter in $(DOCBOOK_CHAPTERS) ; \ + do \ + ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \ + done + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: From 6a848db44242a24d6570ef7994918c66ce483fd2 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:55:11 -0600 Subject: [PATCH 123/649] cygwin: export SSP functions Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/common.din | 19 +++++++++++++++++++ winsup/cygwin/include/cygwin/version.h | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index 55fa9b16c..a482cf2b7 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -7,6 +7,7 @@ __cygwin_user_data DATA __mb_cur_max DATA __progname DATA __rcmd_errstr DATA +__stack_chk_guard DATA _check_for_executable DATA _ctype_ DATA _daylight DATA @@ -42,6 +43,7 @@ __assertfail NOSIGFE __b64_ntop NOSIGFE __b64_pton NOSIGFE __bsd_qsort_r NOSIGFE +__chk_fail SIGFE __cxa_atexit = cygwin__cxa_atexit SIGFE __cxa_finalize SIGFE __dn_comp SIGFE @@ -62,6 +64,7 @@ __fwritable NOSIGFE __fwriting NOSIGFE __getpagesize = getpagesize SIGFE __getreent NOSIGFE +__gets_chk SIGFE __gnu_basename NOSIGFE __infinity NOSIGFE __isinfd = isinf NOSIGFE @@ -72,7 +75,11 @@ __locale_ctype_ptr NOSIGFE __locale_ctype_ptr_l NOSIGFE __locale_mb_cur_max NOSIGFE __main NOSIGFE +__memcpy_chk NOSIGFE +__memmove_chk NOSIGFE __mempcpy = mempcpy NOSIGFE +__mempcpy_chk NOSIGFE +__memset_chk NOSIGFE __opendir_with_d_ino SIGFE __res_close SIGFE __res_init SIGFE @@ -92,10 +99,22 @@ __res_state SIGFE __signbitd NOSIGFE __signbitf NOSIGFE __signgam NOSIGFE +__snprintf_chk SIGFE +__sprintf_chk SIGFE __srget SIGFE __srget_r SIGFE +__stack_chk_fail SIGFE +__stack_chk_fail_local = __stack_chk_fail SIGFE +__stpcpy_chk NOSIGFE +__stpncpy_chk NOSIGFE +__strcat_chk NOSIGFE +__strcpy_chk NOSIGFE +__strncat_chk NOSIGFE +__strncpy_chk NOSIGFE __swbuf SIGFE __swbuf_r SIGFE +__vsnprintf_chk SIGFE +__vsprintf_chk SIGFE __wrap__ZdaPv NOSIGFE # void operator delete[](void *p) throw() __wrap__ZdaPvRKSt9nothrow_t NOSIGFE # void operator delete[](void *p, const std::nothrow_t &nt) throw() __wrap__ZdlPv NOSIGFE # void operator delete(void *p) throw() diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 8b85f863f..d8bb3ee44 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -484,12 +484,17 @@ details. */ 317: Export renameat2. 318: Export strnstr. 319: Define O_TMPFILE, O_NOATIME. + 320: Export __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, + __mempcpy_chk, __memset_chk, __snprintf_chk, __sprintf_chk, + __stack_chk_fail, __stack_chk_guard, __stpcpy_chk, __stpncpy_chk, + __strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, + __vsnprintf_chk, __vsprintf_chk. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 319 +#define CYGWIN_VERSION_API_MINOR 320 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared From 552a20ab4e2736d7cbd0293f8a69d7fbf8761fa8 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 27 Nov 2017 23:56:30 -0600 Subject: [PATCH 124/649] cygwin: create libssp compatibility import library Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/Makefile.in | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index a70f28dfc..c1de26c1b 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -540,7 +540,7 @@ endif API_VER:=$(srcdir)/include/cygwin/version.h LIB_NAME:=libcygwin.a -SUBLIBS:=libpthread.a libutil.a ${CURDIR}/libm.a ${CURDIR}/libc.a libdl.a libresolv.a librt.a libacl.a +SUBLIBS:=libpthread.a libutil.a ${CURDIR}/libm.a ${CURDIR}/libc.a libdl.a libresolv.a librt.a libacl.a libssp.a EXTRALIBS:=libautomode.a libbinmode.a libtextmode.a libtextreadmode.a INSTOBJS:=automode.o binmode.o textmode.o textreadmode.o TARGET_LIBS:=$(LIB_NAME) $(CYGWIN_START) $(GMON_START) $(LIBGMON_A) $(SUBLIBS) $(INSTOBJS) $(EXTRALIBS) @@ -745,6 +745,9 @@ librt.a: ${LIB_NAME} posix_ipc.o libacl.a: ${LIB_NAME} sec_posixacl.o ${speclib} ${@F} +libssp.a: ${LIB_NAME} $(newlib_build)/libc/ssp/lib.a + ${speclib} ${@F} + ${EXTRALIBS}: lib%.a: %.o $(AR) cru $@ $? From 186166f67abcfe51f9224c868845a2742c44bbbf Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 28 Nov 2017 07:57:51 +0100 Subject: [PATCH 125/649] RTEMS: Add set/get name functions Add inline functions to set/get the name. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/lock.h | 72 +++++++++++++++++++++++- 1 file changed, 71 insertions(+), 1 deletion(-) diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h index ec3415a52..f2666ed31 100644 --- a/newlib/libc/sys/rtems/include/sys/lock.h +++ b/newlib/libc/sys/rtems/include/sys/lock.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2016 embedded brains GmbH. All rights reserved. + * Copyright (c) 2015, 2017 embedded brains GmbH. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -119,6 +119,20 @@ _Mutex_Initialize_named(struct _Mutex_Control *_mutex, const char *_name) *_mutex = _init; } +static __inline void +_Mutex_Set_name(struct _Mutex_Control *_mutex, const char *_name) +{ + + _mutex->_Queue._name = _name; +} + +static __inline const char * +_Mutex_Get_name(const struct _Mutex_Control *_mutex) +{ + + return (_mutex->_Queue._name); +} + void _Mutex_Acquire(struct _Mutex_Control *); int _Mutex_Acquire_timed(struct _Mutex_Control *, const struct timespec *); @@ -152,6 +166,20 @@ _Mutex_recursive_Initialize_named(struct _Mutex_recursive_Control *_mutex, *_mutex = _init; } +static __inline void +_Mutex_recursive_Set_name(struct _Mutex_recursive_Control *_mutex, const char *_name) +{ + + _mutex->_Mutex._Queue._name = _name; +} + +static __inline const char * +_Mutex_recursive_Get_name(const struct _Mutex_recursive_Control *_mutex) +{ + + return (_mutex->_Mutex._Queue._name); +} + void _Mutex_recursive_Acquire(struct _Mutex_recursive_Control *); int _Mutex_recursive_Acquire_timed(struct _Mutex_recursive_Control *, @@ -185,6 +213,20 @@ _Condition_Initialize_named(struct _Condition_Control *_cond, *_cond = _init; } +static __inline void +_Condition_Set_name(struct _Condition_Control *_condition, const char *_name) +{ + + _condition->_Queue._name = _name; +} + +static __inline const char * +_Condition_Get_name(const struct _Condition_Control *_condition) +{ + + return (_condition->_Queue._name); +} + void _Condition_Wait(struct _Condition_Control *, struct _Mutex_Control *); int _Condition_Wait_timed(struct _Condition_Control *, @@ -226,6 +268,20 @@ _Semaphore_Initialize_named(struct _Semaphore_Control *_semaphore, *_semaphore = _init; } +static __inline void +_Semaphore_Set_name(struct _Semaphore_Control *_semaphore, const char *_name) +{ + + _semaphore->_Queue._name = _name; +} + +static __inline const char * +_Semaphore_Get_name(const struct _Semaphore_Control *_semaphore) +{ + + return (_semaphore->_Queue._name); +} + void _Semaphore_Wait(struct _Semaphore_Control *); void _Semaphore_Post(struct _Semaphore_Control *); @@ -253,6 +309,20 @@ _Futex_Initialize_named(struct _Futex_Control *_futex, const char *_name) *_futex = _init; } +static __inline void +_Futex_Set_name(struct _Futex_Control *_futex, const char *_name) +{ + + _futex->_Queue._name = _name; +} + +static __inline const char * +_Futex_Get_name(const struct _Futex_Control *_futex) +{ + + return (_futex->_Queue._name); +} + int _Futex_Wait(struct _Futex_Control *, int *, int); int _Futex_Wake(struct _Futex_Control *, int); From 5a2ab9d55eb0cb018fc7095422581af9fdca0275 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 28 Nov 2017 07:59:44 +0100 Subject: [PATCH 126/649] RTEMS: Timed wait by ticks functions Declare timed wait by ticks functions. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/lock.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h index f2666ed31..85b0cd8c4 100644 --- a/newlib/libc/sys/rtems/include/sys/lock.h +++ b/newlib/libc/sys/rtems/include/sys/lock.h @@ -137,6 +137,8 @@ void _Mutex_Acquire(struct _Mutex_Control *); int _Mutex_Acquire_timed(struct _Mutex_Control *, const struct timespec *); +int _Mutex_Acquire_timed_ticks(struct _Mutex_Control *, __uint32_t); + int _Mutex_Try_acquire(struct _Mutex_Control *); void _Mutex_Release(struct _Mutex_Control *); @@ -185,6 +187,9 @@ void _Mutex_recursive_Acquire(struct _Mutex_recursive_Control *); int _Mutex_recursive_Acquire_timed(struct _Mutex_recursive_Control *, const struct timespec *); +int _Mutex_recursive_Acquire_timed_ticks(struct _Mutex_recursive_Control *, + __uint32_t); + int _Mutex_recursive_Try_acquire(struct _Mutex_recursive_Control *); void _Mutex_recursive_Release(struct _Mutex_recursive_Control *); @@ -232,12 +237,18 @@ void _Condition_Wait(struct _Condition_Control *, struct _Mutex_Control *); int _Condition_Wait_timed(struct _Condition_Control *, struct _Mutex_Control *, const struct timespec *); +int _Condition_Wait_timed_ticks(struct _Condition_Control *, + struct _Mutex_Control *, __uint32_t); + void _Condition_Wait_recursive(struct _Condition_Control *, struct _Mutex_recursive_Control *); int _Condition_Wait_recursive_timed(struct _Condition_Control *, struct _Mutex_recursive_Control *, const struct timespec *); +int _Condition_Wait_recursive_timed_ticks(struct _Condition_Control *, + struct _Mutex_recursive_Control *, __uint32_t); + void _Condition_Signal(struct _Condition_Control *); void _Condition_Broadcast(struct _Condition_Control *); @@ -284,6 +295,11 @@ _Semaphore_Get_name(const struct _Semaphore_Control *_semaphore) void _Semaphore_Wait(struct _Semaphore_Control *); +int _Semaphore_Wait_timed(struct _Semaphore_Control *, + const struct timespec *); + +int _Semaphore_Wait_timed_ticks(struct _Semaphore_Control *, __uint32_t); + void _Semaphore_Post(struct _Semaphore_Control *); static __inline void From dadc9e7e4addbaad6c3249c883a80f6f8a33eafd Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Tue, 28 Nov 2017 08:00:33 +0100 Subject: [PATCH 127/649] RTEMS: Add semaphore functions Declare semaphore try wait and post binary functions. Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/sys/lock.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/newlib/libc/sys/rtems/include/sys/lock.h b/newlib/libc/sys/rtems/include/sys/lock.h index 85b0cd8c4..d6169025b 100644 --- a/newlib/libc/sys/rtems/include/sys/lock.h +++ b/newlib/libc/sys/rtems/include/sys/lock.h @@ -300,8 +300,12 @@ int _Semaphore_Wait_timed(struct _Semaphore_Control *, int _Semaphore_Wait_timed_ticks(struct _Semaphore_Control *, __uint32_t); +int _Semaphore_Try_wait(struct _Semaphore_Control *); + void _Semaphore_Post(struct _Semaphore_Control *); +void _Semaphore_Post_binary(struct _Semaphore_Control *); + static __inline void _Semaphore_Destroy(struct _Semaphore_Control *_semaphore) { From b3281de25fd8c1d856cc45dfb814593a537bce80 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 29 Nov 2017 11:38:17 -0600 Subject: [PATCH 128/649] cygwin: add Object Size Checking to sys/poll.h Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/ssp/poll.h | 26 ++++++++++++++++++++++++++ winsup/cygwin/include/sys/poll.h | 4 ++++ 2 files changed, 30 insertions(+) create mode 100644 winsup/cygwin/include/ssp/poll.h diff --git a/winsup/cygwin/include/ssp/poll.h b/winsup/cygwin/include/ssp/poll.h new file mode 100644 index 000000000..831e626d6 --- /dev/null +++ b/winsup/cygwin/include/ssp/poll.h @@ -0,0 +1,26 @@ +#ifndef _SSP_POLL_H_ +#define _SSP_POLL_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 +__BEGIN_DECLS + +__ssp_decl(int, poll, (struct pollfd *__fds, nfds_t __nfds, int __timeout)) +{ + __ssp_check (__fds, __nfds * sizeof(*__fds), __ssp_bos); + return __ssp_real_poll (__fds, __nfds, __timeout); +} + +#if __GNU_VISIBLE +__ssp_decl(int, ppoll, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout_ts, const sigset_t *__sigmask)) +{ + __ssp_check (__fds, __nfds * sizeof(*__fds), __ssp_bos); + return __ssp_real_ppoll (__fds, __nfds, __timeout_ts, __sigmask); +} +#endif + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_POLL_H_ */ diff --git a/winsup/cygwin/include/sys/poll.h b/winsup/cygwin/include/sys/poll.h index 0da4c3f03..65822edb3 100644 --- a/winsup/cygwin/include/sys/poll.h +++ b/winsup/cygwin/include/sys/poll.h @@ -47,4 +47,8 @@ extern int ppoll __P ((struct pollfd *fds, nfds_t nfds, __END_DECLS +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _SYS_POLL_H */ From da4839ec18cac49fc1c2cee732104c7dabdc2d4c Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 29 Nov 2017 11:38:54 -0600 Subject: [PATCH 129/649] cygwin: add Object Size Checking to sys/socket.h Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/ssp/socket.h | 20 ++++++++++++++++++++ winsup/cygwin/include/sys/socket.h | 4 ++++ 2 files changed, 24 insertions(+) create mode 100644 winsup/cygwin/include/ssp/socket.h diff --git a/winsup/cygwin/include/ssp/socket.h b/winsup/cygwin/include/ssp/socket.h new file mode 100644 index 000000000..3abbddbdf --- /dev/null +++ b/winsup/cygwin/include/ssp/socket.h @@ -0,0 +1,20 @@ +#ifndef _SSP_SOCKET_H_ +#define _SSP_SOCKET_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 +__BEGIN_DECLS + +__ssp_redirect0(ssize_t, recv, \ + (int __fd, void *__buf, size_t __len, int __flags), \ + (__fd, __buf, __len, __flags)); + +__ssp_redirect0(ssize_t, recvfrom, \ + (int __fd, void *__buf, size_t __len, int __flags, struct sockaddr *__from, socklen_t *__fromlen), \ + (__fd, __buf, __len, __flags, __from, __fromlen)); + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_SOCKET_H_ */ diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h index 8bab35b68..9e897a9ff 100644 --- a/winsup/cygwin/include/sys/socket.h +++ b/winsup/cygwin/include/sys/socket.h @@ -50,4 +50,8 @@ extern "C" }; #endif +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _SYS_SOCKET_H */ From 8a94bca694a6b6eb259f191922e0ef2ac9afc60a Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 29 Nov 2017 19:45:56 -0600 Subject: [PATCH 130/649] string: add wmempcpy Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/wchar.h | 4 ++ newlib/libc/string/Makefile.am | 5 ++- newlib/libc/string/Makefile.in | 67 +++++++++++++++----------------- newlib/libc/string/wcstrings.tex | 4 ++ newlib/libc/string/wmempcpy.c | 43 ++++++++++++++++++++ 5 files changed, 85 insertions(+), 38 deletions(-) create mode 100644 newlib/libc/string/wmempcpy.c diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index 25ee9a880..16e28f41d 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -186,6 +186,10 @@ int _EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t)); wchar_t *_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict, size_t)); wchar_t *_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t)); +#if __GNU_VISIBLE +wchar_t *_EXFUN(wmempcpy, (wchar_t *__restrict, const wchar_t *__restrict, + size_t)); +#endif wchar_t *_EXFUN(wmemset, (wchar_t *, wchar_t, size_t)); long _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int)); diff --git a/newlib/libc/string/Makefile.am b/newlib/libc/string/Makefile.am index a21e3d55d..49de080e1 100644 --- a/newlib/libc/string/Makefile.am +++ b/newlib/libc/string/Makefile.am @@ -125,7 +125,8 @@ ELIX_4_SOURCES = \ wcscoll_l.c \ wcsncasecmp.c \ wcsncasecmp_l.c \ - wcsxfrm_l.c + wcsxfrm_l.c \ + wmempcpy.c endif !ELIX_LEVEL_3 endif !ELIX_LEVEL_2 endif !ELIX_LEVEL_1 @@ -164,6 +165,6 @@ wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \ memmem.def memrchr.def rawmemchr.def strchrnul.def \ strcasecmp_l.def strcoll_l.def strncasecmp_l.def strxfrm_l.def \ wcscasecmp_l.def wcscoll_l.def wcsncasecmp_l.def wcsxfrm_l.def \ -strverscmp.def strnstr.def +strverscmp.def strnstr.def wmempcpy.def CHAPTERS = strings.tex wcstrings.tex diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in index 13dee83e0..a73d2fe7b 100644 --- a/newlib/libc/string/Makefile.in +++ b/newlib/libc/string/Makefile.in @@ -1,8 +1,9 @@ -# Makefile.in generated by automake 1.12.2 from Makefile.am. +# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ -# Copyright (C) 1994-2012 Free Software Foundation, Inc. - +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software +# Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -53,11 +54,15 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(srcdir)/../../Makefile.shared $(srcdir)/Makefile.in \ - $(srcdir)/Makefile.am $(top_srcdir)/../../mkinstalldirs + $(srcdir)/Makefile.am subdir = string ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/../acinclude.m4 \ - $(top_srcdir)/configure.in +am__aclocal_m4_deps = $(top_srcdir)/../../libtool.m4 \ + $(top_srcdir)/../../ltoptions.m4 \ + $(top_srcdir)/../../ltsugar.m4 \ + $(top_srcdir)/../../ltversion.m4 \ + $(top_srcdir)/../../lt~obsolete.m4 \ + $(top_srcdir)/../acinclude.m4 $(top_srcdir)/configure.in am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/../../mkinstalldirs @@ -132,7 +137,8 @@ am__objects_1 = lib_a-bcopy.$(OBJEXT) lib_a-bzero.$(OBJEXT) \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcscoll_l.$(OBJEXT) \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcsncasecmp.$(OBJEXT) \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcsncasecmp_l.$(OBJEXT) \ -@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcsxfrm_l.$(OBJEXT) +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wcsxfrm_l.$(OBJEXT) \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ lib_a-wmempcpy.$(OBJEXT) @USE_LIBTOOL_FALSE@am_lib_a_OBJECTS = $(am__objects_1) \ @USE_LIBTOOL_FALSE@ $(am__objects_2) $(am__objects_3) lib_a_OBJECTS = $(am_lib_a_OBJECTS) @@ -171,7 +177,8 @@ am__objects_4 = bcopy.lo bzero.lo explicit_bzero.lo ffsl.lo ffsll.lo \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcscoll_l.lo \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsncasecmp.lo \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsncasecmp_l.lo \ -@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsxfrm_l.lo +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsxfrm_l.lo \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wmempcpy.lo @USE_LIBTOOL_TRUE@am_libstring_la_OBJECTS = $(am__objects_4) \ @USE_LIBTOOL_TRUE@ $(am__objects_5) $(am__objects_6) libstring_la_OBJECTS = $(am_libstring_la_OBJECTS) @@ -258,10 +265,8 @@ LIBTOOL = @LIBTOOL@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAINT = @MAINT@ MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEWLIB_CFLAGS = @NEWLIB_CFLAGS@ NM = @NM@ @@ -290,7 +295,6 @@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ aext = @aext@ @@ -458,7 +462,8 @@ GENERAL_SOURCES = \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcscoll_l.c \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsncasecmp.c \ @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsncasecmp_l.c \ -@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsxfrm_l.c +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wcsxfrm_l.c \ +@ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_FALSE@ wmempcpy.c @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_FALSE@@ELIX_LEVEL_3_TRUE@ELIX_4_SOURCES = @ELIX_LEVEL_1_FALSE@@ELIX_LEVEL_2_TRUE@ELIX_4_SOURCES = @@ -500,7 +505,7 @@ wmemcmp.def wmemcpy.def wmemmove.def wmemset.def \ memmem.def memrchr.def rawmemchr.def strchrnul.def \ strcasecmp_l.def strcoll_l.def strncasecmp_l.def strxfrm_l.def \ wcscasecmp_l.def wcscoll_l.def wcsncasecmp_l.def wcsxfrm_l.def \ -strverscmp.def strnstr.def +strverscmp.def strnstr.def wmempcpy.def CHAPTERS = strings.tex wcstrings.tex all: all-am @@ -548,14 +553,12 @@ lib.a: $(lib_a_OBJECTS) $(lib_a_DEPENDENCIES) $(EXTRA_lib_a_DEPENDENCIES) clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) - @list='$(noinst_LTLIBRARIES)'; \ - locs=`for p in $$list; do echo $$p; done | \ - sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ - sort -u`; \ - test -z "$$locs" || { \ - echo rm -f $${locs}; \ - rm -f $${locs}; \ - } + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done libstring.la: $(libstring_la_OBJECTS) $(libstring_la_DEPENDENCIES) $(EXTRA_libstring_la_DEPENDENCIES) $(libstring_la_LINK) $(am_libstring_la_rpath) $(libstring_la_OBJECTS) $(libstring_la_LIBADD) $(LIBS) @@ -1198,6 +1201,12 @@ lib_a-wcsxfrm_l.o: wcsxfrm_l.c lib_a-wcsxfrm_l.obj: wcsxfrm_l.c $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wcsxfrm_l.obj `if test -f 'wcsxfrm_l.c'; then $(CYGPATH_W) 'wcsxfrm_l.c'; else $(CYGPATH_W) '$(srcdir)/wcsxfrm_l.c'; fi` +lib_a-wmempcpy.o: wmempcpy.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wmempcpy.o `test -f 'wmempcpy.c' || echo '$(srcdir)/'`wmempcpy.c + +lib_a-wmempcpy.obj: wmempcpy.c + $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-wmempcpy.obj `if test -f 'wmempcpy.c'; then $(CYGPATH_W) 'wmempcpy.c'; else $(CYGPATH_W) '$(srcdir)/wmempcpy.c'; fi` + mostlyclean-libtool: -rm -f *.lo @@ -1253,20 +1262,6 @@ GTAGS: && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: $(HEADERS) $(SOURCES) $(LISP) - list='$(SOURCES) $(HEADERS) $(LISP)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags check-am: @@ -1377,7 +1372,7 @@ uninstall-am: .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstLIBRARIES clean-noinstLTLIBRARIES \ - cscopelist ctags distclean distclean-compile distclean-generic \ + ctags distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags dvi dvi-am html html-am info \ info-am install install-am install-data install-data-am \ install-dvi install-dvi-am install-exec install-exec-am \ diff --git a/newlib/libc/string/wcstrings.tex b/newlib/libc/string/wcstrings.tex index 5b9c22069..161b35cb5 100644 --- a/newlib/libc/string/wcstrings.tex +++ b/newlib/libc/string/wcstrings.tex @@ -10,6 +10,7 @@ declarations are in @file{wchar.h}. * wmemcmp:: Compare two wide-character memory areas * wmemcpy:: Copy wide-character memory regions * wmemmove:: Move possibly overlapping wide-character memory +* wmempcpy:: Copy wide-character memory regions and locate end * wmemset:: Set an area of memory to a specified wide character * wcscat:: Concatenate wide-character strings * wcschr:: Search for wide character in string @@ -49,6 +50,9 @@ declarations are in @file{wchar.h}. @page @include string/wmemmove.def +@page +@include string/wmempcpy.def + @page @include string/wmemset.def diff --git a/newlib/libc/string/wmempcpy.c b/newlib/libc/string/wmempcpy.c new file mode 100644 index 000000000..a3b2ce637 --- /dev/null +++ b/newlib/libc/string/wmempcpy.c @@ -0,0 +1,43 @@ +/* +FUNCTION + <>---copy wide characters in memory and return end pointer + +SYNOPSIS + #define _GNU_SOURCE + #include + wchar_t *wmempcpy(wchar_t *<[d]>, + const wchar_t *<[s]>, size_t <[n]>); + +DESCRIPTION + The <> function copies <[n]> wide characters from the object + pointed to by <[s]> to the object pointed to be <[d]>. This function + is not affected by locale and all wchar_t values are treated + identically. The null wide character and wchar_t values not + corresponding to valid characters are not treated specially. + + If <[n]> is zero, <[d]> and <[s]> must be a valid pointers, and the + function copies zero wide characters. + +RETURNS + <> returns a pointer to the wide character following the + last wide character copied to the <[out]> region. + +PORTABILITY +<> is a GNU extension. + +No supporting OS subroutines are required. +*/ + +#define _GNU_SOURCE +#include <_ansi.h> +#include +#include + +wchar_t * +_DEFUN (wmempcpy, (d, s, n), + wchar_t *__restrict d _AND + _CONST wchar_t *__restrict s _AND + size_t n) +{ + return (wchar_t *) mempcpy (d, s, n * sizeof (wchar_t)); +} From f636eae26f70b7c5bae5fb7ec7386cf92aca125d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 29 Nov 2017 19:47:13 -0600 Subject: [PATCH 131/649] cygwin: export wmempcpy Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/common.din | 1 + winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/doc/posix.xml | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index a482cf2b7..14b9c2c18 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -1609,6 +1609,7 @@ wmemchr NOSIGFE wmemcmp NOSIGFE wmemcpy NOSIGFE wmemmove NOSIGFE +wmempcpy NOSIGFE wmemset NOSIGFE wordexp NOSIGFE wordfree NOSIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index d8bb3ee44..7510f42b0 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -489,12 +489,13 @@ details. */ __stack_chk_fail, __stack_chk_guard, __stpcpy_chk, __stpncpy_chk, __strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk, __vsprintf_chk. + 321: Export wmempcpy. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 320 +#define CYGWIN_VERSION_API_MINOR 321 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml index c99e003ba..ab574300f 100644 --- a/winsup/doc/posix.xml +++ b/winsup/doc/posix.xml @@ -1396,6 +1396,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). wcstoll_l wcstoul_l wcstoull_l + wmempcpy From 2e328edee411d4f21603417fedf218b44260e788 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 11:36:04 +0100 Subject: [PATCH 132/649] newlib: vf[w]scanf: Only return from a single point to simplify cleanup Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfscanf.c | 3 +-- newlib/libc/stdio/vfwscanf.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index c5fcae577..b6b90c80e 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -1623,8 +1623,7 @@ input_failure: should have been set prior to here. On EOF failure (including invalid format string), return EOF if no matches yet, else number of matches made prior to failure. */ - _newlib_flockfile_exit (fp); - return nassigned && !(fp->_flags & __SERR) ? nassigned : EOF; + nassigned = nassigned && !(fp->_flags & __SERR) ? nassigned : EOF; match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index fd4f1f9f6..3b0e11355 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -1469,8 +1469,7 @@ input_failure: should have been set prior to here. On EOF failure (including invalid format string), return EOF if no matches yet, else number of matches made prior to failure. */ - _newlib_flockfile_exit (fp); - return nassigned && !(fp->_flags & __SERR) ? nassigned : EOF; + nassigned = nassigned && !(fp->_flags & __SERR) ? nassigned : EOF; match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ From 5e4a1c9c97af46aa619e0002f86734ee2662133b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 11:38:32 +0100 Subject: [PATCH 133/649] newlib: vfscanf: fix formatting Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfscanf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index b6b90c80e..b9d59aa5b 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -871,7 +871,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } else #endif - if (flags & SUPPRESS) + if (flags & SUPPRESS) { size_t sum = 0; for (;;) @@ -1013,7 +1013,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } else #endif - if (flags & SUPPRESS) + if (flags & SUPPRESS) { n = 0; while (!isspace (*fp->_p)) From 31f11d0572495ed16f9fbdab9fefaeb64b665a79 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 11:40:34 +0100 Subject: [PATCH 134/649] newlib: vf[w]scanf: Use SIZE_MAX rather than ~0 Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfscanf.c | 4 ++-- newlib/libc/stdio/vfwscanf.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index b9d59aa5b..a81ebd5b8 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -912,7 +912,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), case CT_CCL: /* scan a (nonempty) character class (sets NOSKIP) */ if (width == 0) - width = ~0; /* `infinity' */ + width = SIZE_MAX; /* take only those things in the class */ if (flags & SUPPRESS) { @@ -960,7 +960,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), case CT_STRING: /* like CCL, but zero-length string OK, & no NOSKIP */ if (width == 0) - width = (size_t)~0; + width = SIZE_MAX; #if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 if (flags & LONG) { diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 3b0e11355..0d34fb1a1 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -827,7 +827,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), case CT_CCL: /* scan a (nonempty) character class (sets NOSKIP) */ if (width == 0) - width = (size_t) ~0; /* `infinity' */ + width = SIZE_MAX; /* `infinity' */ /* take only those things in the class */ if ((flags & SUPPRESS) && (flags & LONG)) { @@ -898,7 +898,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), case CT_STRING: /* like CCL, but zero-length string OK, & no NOSKIP */ if (width == 0) - width = (size_t)~0; + width = SIZE_MAX; if ((flags & SUPPRESS) && (flags & LONG)) { while ((wi = _fgetwc_r (rptr, fp)) != WEOF From 0fd2c9bd1290c84d2160191d105147bf75629411 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 11:55:27 +0100 Subject: [PATCH 135/649] newlib: vf[w]scanf: add validity checks POSIX requires that directive characters appear in a certain sequence: 1. '%' or '%$' 2. optional '*' 3. optional field width digits 4. optional 'm' (not yet implemented) 5. optional length modifier ('l', 'L', 'll', 'h', 'hh', 'j', 't', 'z') 6. conversion specifier ('d', 's', etc) Add a few basic validity checks to that effect, otherwise reject directive as match failure. Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfscanf.c | 19 +++++++++++++++++++ newlib/libc/stdio/vfwscanf.c | 18 ++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index a81ebd5b8..9d6f12404 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -564,9 +564,14 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), continue; case '*': + if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + || width) + goto match_failure; flags |= SUPPRESS; goto again; case 'l': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; #if defined _WANT_IO_C99_FORMATS || !defined _NO_LONGLONG if (*fmt == 'l') /* Check for 'll' = long long (SUSv3) */ { @@ -578,9 +583,13 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), flags |= LONG; goto again; case 'L': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; flags |= LONGDBL; goto again; case 'h': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; #ifdef _WANT_IO_C99_FORMATS if (*fmt == 'h') /* Check for 'hh' = char int (SUSv3) */ { @@ -593,12 +602,16 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), goto again; #ifdef _WANT_IO_C99_FORMATS case 'j': /* intmax_t */ + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (sizeof (intmax_t) == sizeof (long)) flags |= LONG; else flags |= LONGDBL; goto again; case 't': /* ptrdiff_t */ + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (sizeof (ptrdiff_t) < sizeof (int)) /* POSIX states ptrdiff_t is 16 or more bits, as is short. */ @@ -615,6 +628,8 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), flags |= LONGDBL; goto again; case 'z': /* size_t */ + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (sizeof (size_t) < sizeof (int)) /* POSIX states size_t is 16 or more bits, as is short. */ flags |= SHORT; @@ -641,11 +656,15 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), case '7': case '8': case '9': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; width = width * 10 + c - '0'; goto again; #ifndef _NO_POS_ARGS case '$': + if (flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + goto match_failure; if (width <= MAX_POS_ARGS) { N = width - 1; diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 0d34fb1a1..54bbb09b0 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -518,9 +518,13 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), continue; case L'*': + if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + || width) flags |= SUPPRESS; goto again; case L'l': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; #if defined _WANT_IO_C99_FORMATS || !defined _NO_LONGLONG if (*fmt == L'l') /* Check for 'll' = long long (SUSv3) */ { @@ -532,10 +536,14 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), flags |= LONG; goto again; case L'L': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; flags |= LONGDBL; goto again; case L'h': #ifdef _WANT_IO_C99_FORMATS + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (*fmt == 'h') /* Check for 'hh' = char int (SUSv3) */ { ++fmt; @@ -547,12 +555,16 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), goto again; #ifdef _WANT_IO_C99_FORMATS case L'j': /* intmax_t */ + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (sizeof (intmax_t) == sizeof (long)) flags |= LONG; else flags |= LONGDBL; goto again; case L't': /* ptrdiff_t */ + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (sizeof (ptrdiff_t) < sizeof (int)) /* POSIX states ptrdiff_t is 16 or more bits, as is short. */ @@ -569,6 +581,8 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), flags |= LONGDBL; goto again; case L'z': /* size_t */ + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; if (sizeof (size_t) < sizeof (int)) /* POSIX states size_t is 16 or more bits, as is short. */ flags |= SHORT; @@ -595,11 +609,15 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), case L'7': case L'8': case L'9': + if (flags & (CHAR | SHORT | LONG | LONGDBL)) + goto match_failure; width = width * 10 + c - L'0'; goto again; #ifndef _NO_POS_ARGS case L'$': + if (flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + goto match_failure; if (width <= MAX_POS_ARGS) { N = width - 1; From 1e43e181c2b4d135e2407b8df1e58ea5c1a9bb82 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 29 Nov 2017 21:17:09 -0600 Subject: [PATCH 136/649] ssp: add Object Size Checking for stdlib.h Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/stdlib.h | 30 ++++++++++++++++++++++++++++++ newlib/libc/include/stdlib.h | 4 ++++ newlib/libc/ssp/ssp.tex | 4 ++++ 3 files changed, 38 insertions(+) create mode 100644 newlib/libc/include/ssp/stdlib.h diff --git a/newlib/libc/include/ssp/stdlib.h b/newlib/libc/include/ssp/stdlib.h new file mode 100644 index 000000000..d5edb6d09 --- /dev/null +++ b/newlib/libc/include/ssp/stdlib.h @@ -0,0 +1,30 @@ +#ifndef _SSP_STDLIB_H_ +#define _SSP_STDLIB_H_ + +#include + +#if __SSP_FORTIFY_LEVEL > 0 +__BEGIN_DECLS + +__ssp_decl(size_t, mbstowcs, (wchar_t *__buf, const char *__src, size_t __n)) +{ + if (__buf != NULL) + __ssp_check(__buf, __n * sizeof(wchar_t), __ssp_bos); + return __ssp_real_mbstowcs (__buf, __src, __n); +} + +__ssp_redirect_raw(size_t, wcstombs, \ + (char *__buf, const wchar_t *__src, size_t __len), \ + (__buf, __src, __len), __buf != NULL, __ssp_bos); + +__ssp_decl(int, wctomb, (char *__buf, wchar_t __wc)) +{ + if (__buf != NULL) + __ssp_check(__buf, MB_CUR_MAX, __ssp_bos); + return __ssp_real_wctomb (__buf, __wc); +} + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_STDLIB_H_ */ diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index af5bfecf1..c3c591d20 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -334,4 +334,8 @@ _Noreturn void _END_STD_C +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _STDLIB_H_ */ diff --git a/newlib/libc/ssp/ssp.tex b/newlib/libc/ssp/ssp.tex index f8440bdf9..b30ecf159 100644 --- a/newlib/libc/ssp/ssp.tex +++ b/newlib/libc/ssp/ssp.tex @@ -39,6 +39,10 @@ fgets fread_unlocked sprintf fgets_unlocked gets vsnprintf fread snprintf vsprintf +@exdent @emph{Stdlib functions:} +mbstowcs wcstombs wctomb + @exdent @emph{System functions:} getcwd read readlink + @end example From b9a662bb4c9afb4a1b6699638a250009d63cec86 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 29 Nov 2017 23:18:05 -0600 Subject: [PATCH 137/649] Feature test macros overhaul: unistd.h, part 3 Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/sys/unistd.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 0df4dc374..05962219a 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -73,13 +73,17 @@ int _EXFUN(execvpe, (const char *__file, char * const __argv[], char * const #if __ATFILE_VISIBLE int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags)); #endif -#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 int _EXFUN(fchdir, (int __fildes)); #endif +#if __POSIX_VISIBLE >= 199309 int _EXFUN(fchmod, (int __fildes, mode_t __mode )); +#endif #if !defined(__INSIDE_CYGWIN__) +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group )); #endif +#endif #if __ATFILE_VISIBLE int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags)); #endif @@ -89,7 +93,9 @@ int _EXFUN(fexecve, (int __fd, char * const __argv[], char * const __envp[] )); pid_t _EXFUN(fork, (void )); long _EXFUN(fpathconf, (int __fd, int __name )); int _EXFUN(fsync, (int __fd)); +#if __POSIX_VISIBLE >= 199309 int _EXFUN(fdatasync, (int __fd)); +#endif #if __GNU_VISIBLE char * _EXFUN(get_current_dir_name, (void)); #endif @@ -113,12 +119,16 @@ char * _EXFUN(getlogin, (void )); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) int _EXFUN(getlogin_r, (char *name, size_t namesize) ); #endif +#if __BSD_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112) char * _EXFUN(getpass, (const char *__prompt)); int _EXFUN(getpagesize, (void)); +#endif #if __BSD_VISIBLE int _EXFUN(getpeereid, (int, uid_t *, gid_t *)); #endif +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4 pid_t _EXFUN(getpgid, (pid_t)); +#endif pid_t _EXFUN(getpgrp, (void )); pid_t _EXFUN(getpid, (void )); pid_t _EXFUN(getppid, (void )); @@ -142,13 +152,17 @@ int _EXFUN(isatty, (int __fildes )); int _EXFUN(issetugid, (void)); #endif #if !defined(__INSIDE_CYGWIN__) +#if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group )); #endif +#endif int _EXFUN(link, (const char *__path1, const char *__path2 )); #if __ATFILE_VISIBLE int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags )); #endif +#if __MISC_VISIBLE || __XSI_VISIBLE int _EXFUN(nice, (int __nice_value )); +#endif #if !defined(__INSIDE_CYGWIN__) off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); #endif @@ -168,8 +182,10 @@ int _EXFUN(pipe, (int __fildes[2] )); #if __GNU_VISIBLE int _EXFUN(pipe2, (int __fildes[2], int flags)); #endif +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500 ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset)); ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset)); +#endif _READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte )); #if __BSD_VISIBLE int _EXFUN(rresvport, (int *__alport)); @@ -179,7 +195,9 @@ int _EXFUN(rmdir, (const char *__path )); #if __BSD_VISIBLE int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser)); #endif +#if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112) void * _EXFUN(sbrk, (ptrdiff_t __incr)); +#endif #if !defined(__INSIDE_CYGWIN__) #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 int _EXFUN(setegid, (gid_t __gid )); @@ -194,7 +212,9 @@ int _EXFUN(setgroups, (int ngroups, const gid_t *grouplist )); int _EXFUN(sethostname, (const char *, size_t)); #endif int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid )); +#if __SVID_VISIBLE || __XSI_VISIBLE >= 500 int _EXFUN(setpgrp, (void )); +#endif #if (__BSD_VISIBLE || __XSI_VISIBLE >= 4) && !defined(__INSIDE_CYGWIN__) int _EXFUN(setregid, (gid_t __rgid, gid_t __egid)); int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid)); From 71616225144e61c0a951a1353aea77e524849976 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 21:02:38 +0100 Subject: [PATCH 138/649] newlib: vfwscanf: fix miscomputation of max field width in %[] case Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfwscanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 54bbb09b0..27b70fba6 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -879,7 +879,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), n = 0; memset ((_PTR) &mbs, '\0', sizeof (mbstate_t)); while ((wi = _fgetwc_r (rptr, fp)) != WEOF - && width-- != 0 && INCCL (wi)) + && width != 0 && INCCL (wi)) { if (width >= MB_CUR_MAX && !(flags & SUPPRESS)) { From aea710b5fbaec09ebe29bd32424440723731ec6e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 10:47:38 +0100 Subject: [PATCH 139/649] cygwin: x86_64: implement mempcpy/wmempcpy in assembler * change memcpy to internal _memcpy not setting the return value in %rax * implement all memcpy-like functions as caller to _memcpy, setting %rax to correct return value beforehand. This is possible because _memcpy does not use %rax at all Signed-off-by: Corinna Vinschen --- winsup/cygwin/miscfuncs.cc | 60 ++++++++++++++++++++++++++++---------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index a6404c85e..923556d1f 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -824,16 +824,8 @@ asm volatile (" \n\ * DAMAGE. \n\ */ \n\ \n\ - .globl memmove \n\ - .seh_proc memmove \n\ -memmove: \n\ - .seh_endprologue \n\ - nop /* FALLTHRU */ \n\ - .seh_endproc \n\ - \n\ - .globl memcpy \n\ - .seh_proc memcpy \n\ -memcpy: \n\ + .seh_proc _memcpy \n\ +_memcpy: \n\ movq %rsi,8(%rsp) \n\ movq %rdi,16(%rsp) \n\ .seh_endprologue \n\ @@ -841,7 +833,6 @@ memcpy: \n\ movq %rdx,%rsi \n\ movq %r8,%rdx \n\ \n\ - movq %rdi,%rax /* return dst */ \n\ movq %rdx,%rcx \n\ movq %rdi,%r8 \n\ subq %rsi,%r8 \n\ @@ -873,14 +864,39 @@ memcpy: \n\ movq 16(%rsp),%rdi \n\ ret \n\ .seh_endproc \n\ -"); - -asm volatile (" \n\ + \n\ + .globl memmove \n\ + .seh_proc memmove \n\ +memmove: \n\ + .seh_endprologue \n\ + movq %rcx,%rax /* return dst */ \n\ + jmp _memcpy \n\ + .seh_endproc \n\ + \n\ + .globl memcpy \n\ + .seh_proc memcpy \n\ +memcpy: \n\ + .seh_endprologue \n\ + movq %rcx,%rax /* return dst */ \n\ + jmp _memcpy \n\ + .seh_endproc \n\ + \n\ + .globl memcpy \n\ + .seh_proc memcpy \n\ +mempcpy: \n\ + .seh_endprologue \n\ + movq %rcx,%rax /* return dst */ \n\ + addq %r8,%rax /* + n */ \n\ + jmp _memcpy \n\ + .seh_endproc \n\ + \n\ .globl wmemmove \n\ .seh_proc wmemmove \n\ wmemmove: \n\ .seh_endprologue \n\ - nop /* FALLTHRU */ \n\ + shlq $1,%r8 /* cnt * sizeof (wchar_t) */ \n\ + movq %rcx,%rax /* return dst */ \n\ + jmp _memcpy \n\ .seh_endproc \n\ \n\ .globl wmemcpy \n\ @@ -888,9 +904,21 @@ wmemmove: \n\ wmemcpy: \n\ .seh_endprologue \n\ shlq $1,%r8 /* cnt * sizeof (wchar_t) */ \n\ - jmp memcpy \n\ + movq %rcx,%rax /* return dst */ \n\ + jmp _memcpy \n\ + .seh_endproc \n\ + \n\ + .globl wmemcpy \n\ + .seh_proc wmemcpy \n\ +wmempcpy: \n\ + .seh_endprologue \n\ + shlq $1,%r8 /* cnt * sizeof (wchar_t) */ \n\ + movq %rcx,%rax /* return dst */ \n\ + addq %r8,%rax /* + n */ \n\ + jmp _memcpy \n\ .seh_endproc \n\ "); + #endif /* Signal the thread name to any attached debugger From 27c1a7972cedc1b488070e907930189f370b2293 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 21:34:29 +0100 Subject: [PATCH 140/649] cygwin: [w]mempcpy: fix global symbol Signed-off-by: Corinna Vinschen --- winsup/cygwin/miscfuncs.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index 923556d1f..3ad658739 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -881,9 +881,9 @@ memcpy: \n\ jmp _memcpy \n\ .seh_endproc \n\ \n\ - .globl memcpy \n\ - .seh_proc memcpy \n\ -mempcpy: \n\ + .globl mempcpy \n\ + .seh_proc mempcpy \n\ +mempcpy: \n\ .seh_endprologue \n\ movq %rcx,%rax /* return dst */ \n\ addq %r8,%rax /* + n */ \n\ @@ -908,8 +908,8 @@ wmemcpy: \n\ jmp _memcpy \n\ .seh_endproc \n\ \n\ - .globl wmemcpy \n\ - .seh_proc wmemcpy \n\ + .globl wmempcpy \n\ + .seh_proc wmempcpy \n\ wmempcpy: \n\ .seh_endprologue \n\ shlq $1,%r8 /* cnt * sizeof (wchar_t) */ \n\ From d43863f5695fc7b236ca166291d0b226678802e5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 21:50:23 +0100 Subject: [PATCH 141/649] newlib: vf[w]scanf: Implement POSIX %m modifier * The new code is guarded with _WANT_IO_POSIX_EXTENSIONS, but this is automatically enabled with _WANT_IO_C99_FORMATS for now. * vfscanf neglects to implement %l[, so %ml[ is not implemented yet either. * Sidenote: vfwscanf doesn't allow ranges in %[ yet. Strictly this is allowed per POSIX, but it differes from vfscanf as well as from glibc. Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfscanf.c | 225 +++++++++++++++++++++++++++++-- newlib/libc/stdio/vfwscanf.c | 247 +++++++++++++++++++++++++++++++++-- 2 files changed, 448 insertions(+), 24 deletions(-) diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 9d6f12404..2d5940567 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -212,6 +212,7 @@ static void * get_arg (int, va_list *, int *, void **); #define SUPPRESS 0x10 /* suppress assignment */ #define POINTER 0x20 /* weird %p pointer (`fake hex') */ #define NOSKIP 0x40 /* do not skip blanks */ +#define MALLOC 0x80 /* handle 'm' modifier */ /* * The following are used in numeric conversions only: @@ -453,6 +454,122 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), #ifdef _MB_CAPABLE mbstate_t state; /* value to keep track of multibyte state */ #endif +#ifdef _WANT_IO_C99_FORMATS +#define _WANT_IO_POSIX_EXTENSIONS +#endif +#ifdef _WANT_IO_POSIX_EXTENSIONS + /* POSIX requires that fscanf frees all allocated strings from 'm' + conversions in case it returns EOF. m_ptr is used to keep track. + It will be allocated on the stack the first time an 'm' conversion + takes place, and it will be free'd on return from the function. + This implementation tries to save space by only allocating 8 + pointer slots at a time. Most scenarios should never have to call + realloc again. This implementation allows only up to 65528 'm' + conversions per fscanf invocation for now. That should be enough + for almost all scenarios, right? */ + struct m_ptrs { + void ***m_arr; /* Array of pointer args to 'm' conversion */ + uint16_t m_siz; /* Number of slots in m_arr */ + uint16_t m_cnt; /* Number of valid entries in m_arr */ + } *m_ptr = NULL; + #define init_m_ptr() \ + do \ + { \ + if (!m_ptr) \ + { \ + m_ptr = (struct m_ptrs *) alloca (sizeof *m_ptr); \ + m_ptr->m_arr = NULL; \ + m_ptr->m_siz = 0; \ + m_ptr->m_cnt = 0; \ + } \ + } \ + while (0) + #define push_m_ptr(arg) \ + do \ + { \ + if (m_ptr->m_cnt >= m_ptr->m_siz) \ + { \ + void ***n = NULL; \ + \ + if (m_ptr->m_siz + 8 > 0 && m_ptr->m_siz + 8 < UINT16_MAX) \ + n = (void ***) realloc (m_ptr->m_arr, \ + (m_ptr->m_siz + 8) * \ + sizeof (void **)); \ + if (!n) \ + { \ + nassigned = EOF; \ + goto match_failure; \ + } \ + m_ptr->m_arr = n; \ + m_ptr->m_siz += 8; \ + } \ + m_ptr->m_arr[m_ptr->m_cnt++] = (void **) (arg); \ + } \ + while (0) + #define alloc_m_ptr(_type, _p, _p0, _p_p, _w) \ + ({ \ + _p_p = GET_ARG (N, ap, _type **); \ + if (!_p_p) \ + goto match_failure; \ + _p0 = (_type *) malloc ((_w) * sizeof (_type)); \ + if (!_p0) \ + { \ + nassigned = EOF; \ + goto match_failure; \ + } \ + *_p_p = _p0; \ + push_m_ptr (_p_p); \ + _p = _p0; \ + _w; \ + }) + #define realloc_m_ptr(_type, _p, _p0, _p_p, _w) \ + ({ \ + size_t _nw = (_w); \ + if (_p_p && _p - _p0 == _nw) \ + { \ + _p0 = (_type *) realloc (_p0, (_nw << 1) * sizeof (_type)); \ + if (!_p0) \ + { \ + nassigned = EOF; \ + goto match_failure; \ + } \ + _p = _p0 + _nw; \ + *_p_p = _p0; \ + _nw <<= 1; \ + } \ + _nw; \ + }) + #define shrink_m_ptr(_type, _p_p, _w, _cw) \ + ({ \ + size_t _nw = (_w); \ + if (_p_p && _nw < _cw) \ + { \ + _type *_np_p = (_type *) \ + realloc (*_p_p, _nw * sizeof (_type)); \ + if (_np_p) \ + *_p_p = _np_p; \ + } \ + }) + #define free_m_ptr() \ + do \ + { \ + if (m_ptr) \ + { \ + if (nassigned == EOF) \ + { \ + int i; \ + for (i = 0; i < m_ptr->m_cnt; ++i) \ + { \ + free (*m_ptr->m_arr[i]); \ + *m_ptr->m_arr[i] = NULL; \ + } \ + } \ + if (m_ptr->m_arr) \ + free (m_ptr->m_arr); \ + } \ + } \ + while (0) +#endif #define CCFN_PARAMS _PARAMS((struct _reent *, const char *, char **, int)) u_long (*ccfn)CCFN_PARAMS=0; /* conversion function (strtol/strtoul) */ @@ -564,7 +681,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), continue; case '*': - if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS | MALLOC)) || width) goto match_failure; flags |= SUPPRESS; @@ -645,6 +762,14 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), flags |= LONGDBL; goto again; #endif /* _WANT_IO_C99_FORMATS */ +#ifdef _WANT_IO_POSIX_EXTENSIONS + case 'm': + if (flags & (CHAR | SHORT | LONG | LONGDBL | MALLOC)) + goto match_failure; + init_m_ptr (); + flags |= MALLOC; + goto again; +#endif case '0': case '1': @@ -656,14 +781,14 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), case '7': case '8': case '9': - if (flags & (CHAR | SHORT | LONG | LONGDBL)) + if (flags & (CHAR | SHORT | LONG | LONGDBL | MALLOC)) goto match_failure; width = width * 10 + c - '0'; goto again; #ifndef _NO_POS_ARGS case '$': - if (flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + if (flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS | MALLOC)) goto match_failure; if (width <= MAX_POS_ARGS) { @@ -851,12 +976,21 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), #if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 if (flags & LONG) { +#ifdef _WANT_IO_POSIX_EXTENSIONS + wchar_t **wcp_p = NULL; + wchar_t *wcp0 = NULL; + size_t width0 = 0; +#endif mbstate_t state; memset (&state, 0, sizeof (mbstate_t)); - if ((flags & SUPPRESS) == 0) - wcp = GET_ARG (N, ap, wchar_t *); - else + if (flags & SUPPRESS) wcp = NULL; +#ifdef _WANT_IO_POSIX_EXTENSIONS + else if (flags & MALLOC) + width0 = alloc_m_ptr (wchar_t, wcp, wcp0, wcp_p, width); +#endif + else + wcp = GET_ARG (N, ap, wchar_t *); n = 0; while (width != 0) { @@ -885,6 +1019,9 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), break; } } +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (wchar_t, wcp_p, width0 - width, width0); +#endif if (!(flags & SUPPRESS)) nassigned++; } @@ -919,10 +1056,20 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } else { - size_t r = _fread_r (rptr, (_PTR) GET_ARG (N, ap, char *), 1, width, fp); - + size_t r; +#ifdef _WANT_IO_POSIX_EXTENSIONS + char **p_p = NULL; + if (flags & MALLOC) + alloc_m_ptr (char, p, p0, p_p, width); + else +#endif + p = GET_ARG (N, ap, char *); + r = _fread_r (rptr, p, 1, width, fp); if (r == 0) goto input_failure; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (char, p_p, r, width); +#endif nread += r; nassigned++; } @@ -953,11 +1100,22 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } else { - p0 = p = GET_ARG (N, ap, char *); +#ifdef _WANT_IO_POSIX_EXTENSIONS + char **p_p = NULL; + size_t p_siz = 0; + + if (flags & MALLOC) + p_siz = alloc_m_ptr (char, p, p0, p_p, 32); + else +#endif + p0 = p = GET_ARG (N, ap, char *); while (ccltab[*fp->_p]) { fp->_r--; *p++ = *fp->_p++; +#ifdef _WANT_IO_POSIX_EXTENSIONS + p_siz = realloc_m_ptr (char, p, p0, p_p, p_siz); +#endif if (--width == 0) break; if (BufferEmpty) @@ -971,6 +1129,9 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), if (n == 0) goto match_failure; *p = 0; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (char, p_p, n + 1, p_siz); +#endif nassigned++; } nread += n; @@ -983,13 +1144,22 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), #if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 2 if (flags & LONG) { +#ifdef _WANT_IO_POSIX_EXTENSIONS + wchar_t **wcp_p = NULL; + wchar_t *wcp0 = NULL; + size_t wcp_siz = 0; +#endif /* Process %S and %ls placeholders */ mbstate_t state; memset (&state, 0, sizeof (mbstate_t)); - if ((flags & SUPPRESS) == 0) - wcp = GET_ARG (N, ap, wchar_t *); - else + if (flags & SUPPRESS) wcp = &wc; +#ifdef _WANT_IO_POSIX_EXTENSIONS + else if (flags & MALLOC) + wcp_siz = alloc_m_ptr (wchar_t, wcp, wcp0, wcp_p, 32); +#endif + else + wcp = GET_ARG (N, ap, wchar_t *); n = 0; while (!isspace (*fp->_p) && width != 0) { @@ -1014,7 +1184,13 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), nread += n; width -= 1; if ((flags & SUPPRESS) == 0) - wcp += 1; + { + wcp += 1; +#ifdef _WANT_IO_POSIX_EXTENSIONS + wcp_siz = realloc_m_ptr (wchar_t, wcp, wcp0, wcp_p, + wcp_siz); +#endif + } n = 0; } if (BufferEmpty) @@ -1027,6 +1203,9 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), if (!(flags & SUPPRESS)) { *wcp = L'\0'; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (wchar_t, wcp_p, wcp - wcp0 + 1, wcp_siz); +#endif nassigned++; } } @@ -1047,17 +1226,32 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } else { - p0 = p = GET_ARG (N, ap, char *); +#ifdef _WANT_IO_POSIX_EXTENSIONS + char **p_p = NULL; + size_t p_siz = 0; + + if (flags & MALLOC) + p_siz = alloc_m_ptr (char, p, p0, p_p, 32); + else +#endif + p0 = GET_ARG (N, ap, char *); + p = p0; while (!isspace (*fp->_p)) { fp->_r--; *p++ = *fp->_p++; +#ifdef _WANT_IO_POSIX_EXTENSIONS + p_siz = realloc_m_ptr (char, p, p0, p_p, p_siz); +#endif if (--width == 0) break; if (BufferEmpty) break; } *p = 0; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (char, p_p, p - p0 + 1, p_siz); +#endif nread += p - p0; nassigned++; } @@ -1647,6 +1841,9 @@ match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ _newlib_flockfile_end (fp); +#ifdef _WANT_IO_POSIX_EXTENSIONS + free_m_ptr (); +#endif return nassigned; } diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 27b70fba6..e2b63c54c 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -219,6 +219,7 @@ static void * get_arg (int, va_list *, int *, void **); #define SUPPRESS 0x10 /* suppress assignment */ #define POINTER 0x20 /* weird %p pointer (`fake hex') */ #define NOSKIP 0x40 /* do not skip blanks */ +#define MALLOC 0x80 /* handle 'm' modifier */ /* * The following are used in numeric conversions only: @@ -424,6 +425,125 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), #ifndef _NO_LONGLONG long long *llp; #endif +#ifdef _WANT_IO_C99_FORMATS +#define _WANT_IO_POSIX_EXTENSIONS +#endif +#ifdef _WANT_IO_POSIX_EXTENSIONS + /* POSIX requires that fwscanf frees all allocated strings from 'm' + conversions in case it returns EOF. m_ptr is used to keep track. + It will be allocated on the stack the first time an 'm' conversion + takes place, and it will be free'd on return from the function. + This implementation tries to save space by only allocating 8 + pointer slots at a time. Most scenarios should never have to call + realloc again. This implementation allows only up to 65528 'm' + conversions per fwscanf invocation for now. That should be enough + for almost all scenarios, right? */ + struct m_ptrs { + void ***m_arr; /* Array of pointer args to 'm' conversion */ + uint16_t m_siz; /* Number of slots in m_arr */ + uint16_t m_cnt; /* Number of valid entries in m_arr */ + } *m_ptr = NULL; + #define init_m_ptr() \ + do \ + { \ + if (!m_ptr) \ + { \ + m_ptr = (struct m_ptrs *) alloca (sizeof *m_ptr); \ + m_ptr->m_arr = NULL; \ + m_ptr->m_siz = 0; \ + m_ptr->m_cnt = 0; \ + } \ + } \ + while (0) + #define push_m_ptr(arg) \ + do \ + { \ + if (m_ptr->m_cnt >= m_ptr->m_siz) \ + { \ + void ***n = NULL; \ + \ + if (m_ptr->m_siz + 8 > 0 && m_ptr->m_siz + 8 < UINT16_MAX) \ + n = (void ***) realloc (m_ptr->m_arr, \ + (m_ptr->m_siz + 8) * \ + sizeof (void **)); \ + if (!n) \ + { \ + nassigned = EOF; \ + goto match_failure; \ + } \ + m_ptr->m_arr = n; \ + m_ptr->m_siz += 8; \ + } \ + m_ptr->m_arr[m_ptr->m_cnt++] = (void **) (arg); \ + } \ + while (0) + #define alloc_m_ptr(_type, _p, _p0, _p_p, _w) \ + ({ \ + _p_p = GET_ARG (N, ap, _type **); \ + if (!_p_p) \ + goto match_failure; \ + _p0 = (_type *) malloc ((_w) * sizeof (_type)); \ + if (!_p0) \ + { \ + nassigned = EOF; \ + goto match_failure; \ + } \ + *_p_p = _p0; \ + push_m_ptr (_p_p); \ + _p = _p0; \ + _w; \ + }) + #define realloc_m_ptr(_type, _p, _p0, _p_p, _w) \ + ({ \ + size_t _nw = (_w); \ + ptrdiff_t _dif = _p - _p0; \ + if (_p_p && \ + ((sizeof (_type) == 1 && _dif >= _nw - MB_CUR_MAX) \ + || (sizeof (_type) != 1 && _dif == _nw))) \ + { \ + _p0 = (_type *) realloc (_p0, (_nw << 1) * sizeof (_type)); \ + if (!_p0) \ + { \ + nassigned = EOF; \ + goto match_failure; \ + } \ + _p = _p0 + _dif; \ + *_p_p = _p0; \ + _nw <<= 1; \ + } \ + _nw; \ + }) + #define shrink_m_ptr(_type, _p_p, _w, _cw) \ + ({ \ + size_t _nw = (_w); \ + if (_p_p && _nw < _cw) \ + { \ + _type *_np_p = (_type *) \ + realloc (*_p_p, _nw * sizeof (_type)); \ + if (_np_p) \ + *_p_p = _np_p; \ + } \ + }) + #define free_m_ptr() \ + do \ + { \ + if (m_ptr) \ + { \ + if (nassigned == EOF) \ + { \ + int i; \ + for (i = 0; i < m_ptr->m_cnt; ++i) \ + { \ + free (*m_ptr->m_arr[i]); \ + *m_ptr->m_arr[i] = NULL; \ + } \ + } \ + if (m_ptr->m_arr) \ + free (m_ptr->m_arr); \ + } \ + } \ + while (0) +#endif /* `basefix' is used to avoid `if' tests in the integer scanner */ static _CONST short basefix[17] = @@ -518,7 +638,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), continue; case L'*': - if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + if ((flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS | MALLOC)) || width) flags |= SUPPRESS; goto again; @@ -598,6 +718,14 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), flags |= LONGDBL; goto again; #endif /* _WANT_IO_C99_FORMATS */ +#ifdef _WANT_IO_POSIX_EXTENSIONS + case 'm': + if (flags & (CHAR | SHORT | LONG | LONGDBL | MALLOC)) + goto match_failure; + init_m_ptr (); + flags |= MALLOC; + goto again; +#endif case L'0': case L'1': @@ -609,14 +737,14 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), case L'7': case L'8': case L'9': - if (flags & (CHAR | SHORT | LONG | LONGDBL)) + if (flags & (CHAR | SHORT | LONG | LONGDBL | MALLOC)) goto match_failure; width = width * 10 + c - L'0'; goto again; #ifndef _NO_POS_ARGS case L'$': - if (flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS)) + if (flags & (CHAR | SHORT | LONG | LONGDBL | SUPPRESS | MALLOC)) goto match_failure; if (width <= MAX_POS_ARGS) { @@ -787,7 +915,19 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), width = 1; if (flags & LONG) { - if (!(flags & SUPPRESS)) +#ifdef _WANT_IO_POSIX_EXTENSIONS + wchar_t **p_p = NULL; + wchar_t *p0 = NULL; + size_t width0 = 0; +#endif + + if (flags & SUPPRESS) + ; +#ifdef _WANT_IO_POSIX_EXTENSIONS + else if (flags & MALLOC) + width0 = alloc_m_ptr (wchar_t, p, p0, p_p, width); +#endif + else p = GET_ARG(N, ap, wchar_t *); n = 0; while (width-- != 0 && (wi = _fgetwc_r (rptr, fp)) != WEOF) @@ -799,12 +939,27 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), if (n == 0) goto input_failure; nread += n; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (wchar_t, p_p, width0 - width, width0); +#endif if (!(flags & SUPPRESS)) nassigned++; } else { - if (!(flags & SUPPRESS)) +#ifdef _WANT_IO_POSIX_EXTENSIONS + char **mbp_p = NULL; + char *mbp0 = NULL; + size_t width0 = 0; +#endif + + if (flags & SUPPRESS) + ; +#ifdef _WANT_IO_POSIX_EXTENSIONS + else if (flags & MALLOC) + width0 = alloc_m_ptr (char, mbp, mbp0, mbp_p, width); +#endif + else mbp = GET_ARG(N, ap, char *); n = 0; memset ((_PTR)&mbs, '\0', sizeof (mbstate_t)); @@ -837,6 +992,9 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), if (n == 0) goto input_failure; nread += n; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (char, mbp_p, width0 - width, width0); +#endif if (!(flags & SUPPRESS)) nassigned++; } @@ -860,27 +1018,58 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), } else if (flags & LONG) { - p0 = p = GET_ARG(N, ap, wchar_t *); +#ifdef _WANT_IO_POSIX_EXTENSIONS + wchar_t **p_p = NULL; + size_t p_siz = 0; + + if (flags & MALLOC) + p_siz = alloc_m_ptr (wchar_t, p, p0, p_p, 32); + else +#endif + p0 = p = GET_ARG(N, ap, wchar_t *); while ((wi = _fgetwc_r (rptr, fp)) != WEOF && width-- != 0 && INCCL (wi)) - *p++ = (wchar_t) wi; + { + *p++ = (wchar_t) wi; +#ifdef _WANT_IO_POSIX_EXTENSIONS + p_siz = realloc_m_ptr (wchar_t, p, p0, p_p, p_siz); +#endif + } if (wi != WEOF) _ungetwc_r (rptr, wi, fp); n = p - p0; if (n == 0) goto match_failure; *p = L'\0'; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (wchar_t, p_p, n + 1, p_siz); +#endif nassigned++; } else { - if (!(flags & SUPPRESS)) +#ifdef _WANT_IO_POSIX_EXTENSIONS + char **mbp_p = NULL; + char *mbp0 = NULL; + size_t mbp_siz = 0; +#endif + + if (flags & SUPPRESS) + ; +#ifdef _WANT_IO_POSIX_EXTENSIONS + else if (flags & MALLOC) + mbp_siz = alloc_m_ptr (char, mbp, mbp0, mbp_p, 32); +#endif + else mbp = GET_ARG(N, ap, char *); n = 0; memset ((_PTR) &mbs, '\0', sizeof (mbstate_t)); while ((wi = _fgetwc_r (rptr, fp)) != WEOF && width != 0 && INCCL (wi)) { +#ifdef _WANT_IO_POSIX_EXTENSIONS + mbp_siz = realloc_m_ptr (char, mbp, mbp0, mbp_p, mbp_siz); +#endif if (width >= MB_CUR_MAX && !(flags & SUPPRESS)) { nconv = _wcrtomb_r (rptr, mbp, wi, &mbs); @@ -907,6 +1096,9 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), if (!(flags & SUPPRESS)) { *mbp = 0; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (char, mbp_p, mbp - mbp0 + 1, mbp_siz); +#endif nassigned++; } } @@ -927,26 +1119,55 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), } else if (flags & LONG) { - p0 = p = GET_ARG(N, ap, wchar_t *); +#ifdef _WANT_IO_POSIX_EXTENSIONS + wchar_t **p_p = NULL; + size_t p_siz = 0; + + if (flags & MALLOC) + p_siz = alloc_m_ptr (wchar_t, p, p0, p_p, 32); + else +#endif + p0 = p = GET_ARG(N, ap, wchar_t *); while ((wi = _fgetwc_r (rptr, fp)) != WEOF && width-- != 0 && !iswspace (wi)) { *p++ = (wchar_t) wi; nread++; +#ifdef _WANT_IO_POSIX_EXTENSIONS + p_siz = realloc_m_ptr (wchar_t, p, p0, p_p, p_siz); +#endif } if (wi != WEOF) _ungetwc_r (rptr, wi, fp); *p = L'\0'; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (wchar_t, p_p, p - p0 + 1, p_siz); +#endif nassigned++; } else { - if (!(flags & SUPPRESS)) +#ifdef _WANT_IO_POSIX_EXTENSIONS + char **mbp_p = NULL; + char *mbp0 = NULL; + size_t mbp_siz = 0; +#endif + + if (flags & SUPPRESS) + ; +#ifdef _WANT_IO_POSIX_EXTENSIONS + else if (flags & MALLOC) + mbp_siz = alloc_m_ptr (char, mbp, mbp0, mbp_p, 32); +#endif + else mbp = GET_ARG(N, ap, char *); memset ((_PTR) &mbs, '\0', sizeof (mbstate_t)); while ((wi = _fgetwc_r (rptr, fp)) != WEOF && width != 0 && !iswspace (wi)) { +#ifdef _WANT_IO_POSIX_EXTENSIONS + mbp_siz = realloc_m_ptr (char, mbp, mbp0, mbp_p, mbp_siz); +#endif if (width >= MB_CUR_MAX && !(flags & SUPPRESS)) { nconv = wcrtomb(mbp, wi, &mbs); @@ -973,6 +1194,9 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), if (!(flags & SUPPRESS)) { *mbp = 0; +#ifdef _WANT_IO_POSIX_EXTENSIONS + shrink_m_ptr (char, mbp_p, mbp - mbp0 + 1, mbp_siz); +#endif nassigned++; } } @@ -1492,6 +1716,9 @@ match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ _newlib_flockfile_end (fp); +#ifdef _WANT_IO_POSIX_EXTENSIONS + free_m_ptr (); +#endif return nassigned; } From 10b57ba8d0b5eb56d17d73e280755bf8461230c6 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 30 Nov 2017 21:57:16 +0100 Subject: [PATCH 142/649] cygwin: Document latest changes, bump API minor Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/release/2.10.0 | 4 ++++ winsup/doc/new-features.xml | 20 ++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 7510f42b0..ef06c2d3b 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -490,12 +490,13 @@ details. */ __strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk, __vsprintf_chk. 321: Export wmempcpy. + 322: [w]scanf %m modifier. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 321 +#define CYGWIN_VERSION_API_MINOR 322 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0 index 8c90353c8..42c960b85 100644 --- a/winsup/cygwin/release/2.10.0 +++ b/winsup/cygwin/release/2.10.0 @@ -3,6 +3,10 @@ What's new: - New open(2) flags O_TMPFILE and O_NOATIME. +- scanf/wscanf now handle the POSIX %m modifier. + +- New API: wmempcpy. + What changed: ------------- diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml index 4f1ff97dc..14fb0593a 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -4,6 +4,26 @@ What's new and what changed in Cygwin +What's new and what changed in 2.10 + + + + +New open(2) flags O_TMPFILE and O_NOATIME. + + + +scanf/wscanf now handle the POSIX %m modifier. + + + +New API: wmempcpy. + + + + + + What's new and what changed in 2.9 From 8ba0bbb913e0ea3b691f04b7b842c9af977447ce Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 15:38:15 -0600 Subject: [PATCH 143/649] ssp: add Object Size Checking for unistd.h, part 2 Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/unistd.h | 44 ++++++++++++++++++++++++++++++-- newlib/libc/ssp/ssp.tex | 3 ++- 2 files changed, 44 insertions(+), 3 deletions(-) diff --git a/newlib/libc/include/ssp/unistd.h b/newlib/libc/include/ssp/unistd.h index 861edd30b..5ca6ace7a 100644 --- a/newlib/libc/include/ssp/unistd.h +++ b/newlib/libc/include/ssp/unistd.h @@ -36,6 +36,40 @@ #if __SSP_FORTIFY_LEVEL > 0 __BEGIN_DECLS +#if __POSIX_VISIBLE >= 199209 +__ssp_redirect(size_t, confstr, (int __name, char *__buf, size_t __len), \ + (__name, __buf, __len)); +#endif + +__ssp_redirect_raw(char *, getcwd, (char *__buf, size_t __len), + (__buf, __len), __buf != 0, __ssp_bos); + +#if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) +__ssp_redirect(int, getdomainname, (char *__buf, size_t __len), \ + (__buf, __len)); +#endif + +__ssp_decl(int, getgroups, (int __n, gid_t __buf[])) +{ + __ssp_check(__buf, __n * sizeof(gid_t), __ssp_bos); + return __ssp_real_getgroups (__n, __buf); +} + +#if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 +#if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) +__ssp_redirect(int, gethostname, (char *__buf, size_t __len), \ + (__buf, __len)); +#endif +#endif + +__ssp_redirect(int, getlogin_r, (char *__buf, size_t __len), \ + (__buf, __len)); + +#if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500 +__ssp_redirect0(ssize_t, pread, (int __fd, void *__buf, size_t __len, off_t __off), \ + (__fd, __buf, __len, __off)); +#endif + __ssp_redirect0(_READ_WRITE_RETURN_TYPE, read, \ (int __fd, void *__buf, size_t __len), (__fd, __buf, __len)); @@ -44,8 +78,14 @@ __ssp_redirect(ssize_t, readlink, (const char *__restrict __path, \ char *__restrict __buf, size_t __len), (__path, __buf, __len)); #endif -__ssp_redirect_raw(char *, getcwd, (char *__buf, size_t __len), - (__buf, __len), __buf != 0, __ssp_bos); +#if __ATFILE_VISIBLE +__ssp_redirect(ssize_t, readlinkat, \ + (int __dirfd1, const char *__restrict __path, char *__restrict __buf, size_t __len), \ + (__dirfd1, __path, __buf, __len)); +#endif + +__ssp_redirect(int, ttyname_r, (int __fd, char *__buf, size_t __len), \ + (__fd, __buf, __len)); __END_DECLS diff --git a/newlib/libc/ssp/ssp.tex b/newlib/libc/ssp/ssp.tex index b30ecf159..1e0cb6b12 100644 --- a/newlib/libc/ssp/ssp.tex +++ b/newlib/libc/ssp/ssp.tex @@ -43,6 +43,7 @@ fread snprintf vsprintf mbstowcs wcstombs wctomb @exdent @emph{System functions:} -getcwd read readlink +getcwd read ttyname_r +pread readlink @end example From 9db76095926cbbecef324ccd9c7dcb4e38c64e12 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:17:11 -0600 Subject: [PATCH 144/649] ctype: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/ctype/isalnum.c | 6 +----- newlib/libc/ctype/isalpha.c | 6 +----- newlib/libc/ctype/isascii.c | 6 +----- newlib/libc/ctype/isblank.c | 6 +----- newlib/libc/ctype/iscntrl.c | 6 +----- newlib/libc/ctype/isdigit.c | 6 +----- newlib/libc/ctype/islower.c | 6 +----- newlib/libc/ctype/isprint.c | 7 +------ newlib/libc/ctype/ispunct.c | 6 +----- newlib/libc/ctype/isspace.c | 6 +----- newlib/libc/ctype/isupper.c | 6 +----- newlib/libc/ctype/iswalnum.c | 7 +------ newlib/libc/ctype/iswalpha.c | 7 +------ newlib/libc/ctype/iswblank.c | 7 +------ newlib/libc/ctype/iswcntrl.c | 7 +------ newlib/libc/ctype/iswctype.c | 8 +------- newlib/libc/ctype/iswdigit.c | 7 +------ newlib/libc/ctype/iswgraph.c | 7 +------ newlib/libc/ctype/iswlower.c | 7 +------ newlib/libc/ctype/iswprint.c | 7 +------ newlib/libc/ctype/iswpunct.c | 7 +------ newlib/libc/ctype/iswspace.c | 7 +------ newlib/libc/ctype/iswupper.c | 7 +------ newlib/libc/ctype/iswxdigit.c | 7 +------ newlib/libc/ctype/isxdigit.c | 6 +----- newlib/libc/ctype/toascii.c | 7 +------ newlib/libc/ctype/tolower.c | 7 +------ newlib/libc/ctype/toupper.c | 7 +------ newlib/libc/ctype/towctrans.c | 8 +------- newlib/libc/ctype/towlower.c | 7 +------ newlib/libc/ctype/towupper.c | 7 +------ newlib/libc/ctype/wctrans.c | 7 +------ newlib/libc/ctype/wctype.c | 7 +------ 33 files changed, 33 insertions(+), 189 deletions(-) diff --git a/newlib/libc/ctype/isalnum.c b/newlib/libc/ctype/isalnum.c index 113ef0232..ebb414c69 100644 --- a/newlib/libc/ctype/isalnum.c +++ b/newlib/libc/ctype/isalnum.c @@ -7,17 +7,13 @@ INDEX INDEX isalnum_l -ANSI_SYNOPSIS +SYNOPSIS #include int isalnum(int <[c]>); #include int isalnum_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isalnum(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table diff --git a/newlib/libc/ctype/isalpha.c b/newlib/libc/ctype/isalpha.c index 59511e18e..7a737a527 100644 --- a/newlib/libc/ctype/isalpha.c +++ b/newlib/libc/ctype/isalpha.c @@ -8,17 +8,13 @@ INDEX INDEX isalpha_l -ANSI_SYNOPSIS +SYNOPSIS #include int isalpha(int <[c]>); #include int isalpha_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isalpha(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero when <[c]> represents an diff --git a/newlib/libc/ctype/isascii.c b/newlib/libc/ctype/isascii.c index 45e19efd3..71f299fa0 100644 --- a/newlib/libc/ctype/isascii.c +++ b/newlib/libc/ctype/isascii.c @@ -8,17 +8,13 @@ INDEX INDEX isascii_l -ANSI_SYNOPSIS +SYNOPSIS #include int isascii(int <[c]>); #include int isascii_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isascii(<[c]>); - DESCRIPTION <> is a macro which returns non-zero when <[c]> is an ASCII character, and 0 otherwise. It is defined for all integer values. diff --git a/newlib/libc/ctype/isblank.c b/newlib/libc/ctype/isblank.c index db62a2681..e054b947c 100644 --- a/newlib/libc/ctype/isblank.c +++ b/newlib/libc/ctype/isblank.c @@ -8,17 +8,13 @@ INDEX INDEX isblank_l -ANSI_SYNOPSIS +SYNOPSIS #include int isblank(int <[c]>); #include int isblank_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isblank(<[c]>); - DESCRIPTION <> is a function which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for blank characters, and 0 diff --git a/newlib/libc/ctype/iscntrl.c b/newlib/libc/ctype/iscntrl.c index d78c957f8..b57b71790 100644 --- a/newlib/libc/ctype/iscntrl.c +++ b/newlib/libc/ctype/iscntrl.c @@ -8,17 +8,13 @@ INDEX INDEX iscntrl_l -ANSI_SYNOPSIS +SYNOPSIS #include int iscntrl(int <[c]>); #include int iscntrl_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iscntrl(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for control characters, and 0 diff --git a/newlib/libc/ctype/isdigit.c b/newlib/libc/ctype/isdigit.c index 06f14221d..5cd411b65 100644 --- a/newlib/libc/ctype/isdigit.c +++ b/newlib/libc/ctype/isdigit.c @@ -8,17 +8,13 @@ INDEX INDEX isdigit_l -ANSI_SYNOPSIS +SYNOPSIS #include int isdigit(int <[c]>); #include int isdigit_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isdigit(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for decimal digits, and 0 for diff --git a/newlib/libc/ctype/islower.c b/newlib/libc/ctype/islower.c index 466252a63..a6fb889a1 100644 --- a/newlib/libc/ctype/islower.c +++ b/newlib/libc/ctype/islower.c @@ -8,17 +8,13 @@ INDEX INDEX islower_l -ANSI_SYNOPSIS +SYNOPSIS #include int islower(int <[c]>); #include int islower_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int islower(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for minuscules diff --git a/newlib/libc/ctype/isprint.c b/newlib/libc/ctype/isprint.c index 21fdf5b1d..afabe8b1d 100644 --- a/newlib/libc/ctype/isprint.c +++ b/newlib/libc/ctype/isprint.c @@ -14,7 +14,7 @@ INDEX INDEX isgraph_l -ANSI_SYNOPSIS +SYNOPSIS #include int isprint(int <[c]>); int isgraph(int <[c]>); @@ -23,11 +23,6 @@ ANSI_SYNOPSIS int isprint_l(int <[c]>, locale_t <[locale]>); int isgraph_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isprint(<[c]>); - int isgraph(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for printable characters, diff --git a/newlib/libc/ctype/ispunct.c b/newlib/libc/ctype/ispunct.c index 4fb62197d..83796dc1c 100644 --- a/newlib/libc/ctype/ispunct.c +++ b/newlib/libc/ctype/ispunct.c @@ -8,17 +8,13 @@ INDEX INDEX ispunct_l -ANSI_SYNOPSIS +SYNOPSIS #include int ispunct(int <[c]>); #include int ispunct_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int ispunct(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for printable diff --git a/newlib/libc/ctype/isspace.c b/newlib/libc/ctype/isspace.c index 2a19518eb..68dc5cb1d 100644 --- a/newlib/libc/ctype/isspace.c +++ b/newlib/libc/ctype/isspace.c @@ -8,17 +8,13 @@ INDEX INDEX isspace_l -ANSI_SYNOPSIS +SYNOPSIS #include int isspace(int <[c]>); #include int isspace_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isspace(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for whitespace diff --git a/newlib/libc/ctype/isupper.c b/newlib/libc/ctype/isupper.c index e36b3a35d..10fa230bd 100644 --- a/newlib/libc/ctype/isupper.c +++ b/newlib/libc/ctype/isupper.c @@ -8,17 +8,13 @@ INDEX INDEX isupper_l -ANSI_SYNOPSIS +SYNOPSIS #include int isupper(int <[c]>); #include int isupper_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isupper(<[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for uppercase letters diff --git a/newlib/libc/ctype/iswalnum.c b/newlib/libc/ctype/iswalnum.c index 76fa5042c..d9295434d 100644 --- a/newlib/libc/ctype/iswalnum.c +++ b/newlib/libc/ctype/iswalnum.c @@ -8,18 +8,13 @@ INDEX INDEX iswalnum_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswalnum(wint_t <[c]>); #include int iswalnum_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswalnum(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are alphanumeric. diff --git a/newlib/libc/ctype/iswalpha.c b/newlib/libc/ctype/iswalpha.c index 92fad8e04..973aa09b4 100644 --- a/newlib/libc/ctype/iswalpha.c +++ b/newlib/libc/ctype/iswalpha.c @@ -37,18 +37,13 @@ INDEX INDEX iswalpha_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswalpha(wint_t <[c]>); #include int iswalpha_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswalpha(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are alphabetic. diff --git a/newlib/libc/ctype/iswblank.c b/newlib/libc/ctype/iswblank.c index ca448a997..b83683d94 100644 --- a/newlib/libc/ctype/iswblank.c +++ b/newlib/libc/ctype/iswblank.c @@ -37,18 +37,13 @@ INDEX INDEX iswblank_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswblank(wint_t <[c]>); #include int iswblank_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswblank(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are categorized as blank. diff --git a/newlib/libc/ctype/iswcntrl.c b/newlib/libc/ctype/iswcntrl.c index d094d19ed..c96ed343a 100644 --- a/newlib/libc/ctype/iswcntrl.c +++ b/newlib/libc/ctype/iswcntrl.c @@ -37,18 +37,13 @@ INDEX INDEX iswcntrl_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswcntrl(wint_t <[c]>); #include int iswcntrl_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswcntrl(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are categorized as control characters. diff --git a/newlib/libc/ctype/iswctype.c b/newlib/libc/ctype/iswctype.c index ff8e3246b..bfa7b003c 100644 --- a/newlib/libc/ctype/iswctype.c +++ b/newlib/libc/ctype/iswctype.c @@ -8,19 +8,13 @@ INDEX INDEX iswctype_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswctype(wint_t <[c]>, wctype_t <[desc]>); #include int iswctype_l(wint_t <[c]>, wctype_t <[desc]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswctype(<[c]>, <[desc]>) - wint_t <[c]>; - wctype_t <[desc]>; - DESCRIPTION <> is a function which classifies wide-character values using the wide-character test specified by <[desc]>. diff --git a/newlib/libc/ctype/iswdigit.c b/newlib/libc/ctype/iswdigit.c index 7c3ad4be0..7926f8dc2 100644 --- a/newlib/libc/ctype/iswdigit.c +++ b/newlib/libc/ctype/iswdigit.c @@ -8,18 +8,13 @@ INDEX INDEX iswdigit_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswdigit(wint_t <[c]>); #include int iswdigit_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswdigit(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are decimal digits. diff --git a/newlib/libc/ctype/iswgraph.c b/newlib/libc/ctype/iswgraph.c index 17e3060e5..90e1f97fa 100644 --- a/newlib/libc/ctype/iswgraph.c +++ b/newlib/libc/ctype/iswgraph.c @@ -37,18 +37,13 @@ INDEX INDEX iswgraph_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswgraph(wint_t <[c]>); #include int iswgraph_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswgraph(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are graphic. diff --git a/newlib/libc/ctype/iswlower.c b/newlib/libc/ctype/iswlower.c index 9d3b8441f..19cfdc420 100644 --- a/newlib/libc/ctype/iswlower.c +++ b/newlib/libc/ctype/iswlower.c @@ -8,18 +8,13 @@ INDEX INDEX iswlower_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswlower(wint_t <[c]>); #include int iswlower_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswlower(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that have uppercase translations. diff --git a/newlib/libc/ctype/iswprint.c b/newlib/libc/ctype/iswprint.c index aad34acab..51a50019b 100644 --- a/newlib/libc/ctype/iswprint.c +++ b/newlib/libc/ctype/iswprint.c @@ -37,18 +37,13 @@ INDEX INDEX iswprint_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswprint(wint_t <[c]>); #include int iswprint_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswprint(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are printable. diff --git a/newlib/libc/ctype/iswpunct.c b/newlib/libc/ctype/iswpunct.c index 8b1791b03..b1069a202 100644 --- a/newlib/libc/ctype/iswpunct.c +++ b/newlib/libc/ctype/iswpunct.c @@ -37,18 +37,13 @@ INDEX INDEX iswpunct_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswpunct(wint_t <[c]>); #include int iswpunct_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswpunct(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are punctuation. diff --git a/newlib/libc/ctype/iswspace.c b/newlib/libc/ctype/iswspace.c index 40a667cd4..d6ba3e97d 100644 --- a/newlib/libc/ctype/iswspace.c +++ b/newlib/libc/ctype/iswspace.c @@ -37,18 +37,13 @@ INDEX INDEX iswspace_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswspace(wint_t <[c]>); #include int iswspace_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswspace(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that are categorized as whitespace. diff --git a/newlib/libc/ctype/iswupper.c b/newlib/libc/ctype/iswupper.c index 588e7f173..49f009346 100644 --- a/newlib/libc/ctype/iswupper.c +++ b/newlib/libc/ctype/iswupper.c @@ -8,18 +8,13 @@ INDEX INDEX iswupper_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswupper(wint_t <[c]>); #include int iswupper_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswupper(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide-character values that have uppercase translations. diff --git a/newlib/libc/ctype/iswxdigit.c b/newlib/libc/ctype/iswxdigit.c index 7cd3abbd5..3f47962f1 100644 --- a/newlib/libc/ctype/iswxdigit.c +++ b/newlib/libc/ctype/iswxdigit.c @@ -8,18 +8,13 @@ INDEX INDEX iswxdigit_l -ANSI_SYNOPSIS +SYNOPSIS #include int iswxdigit(wint_t <[c]>); #include int iswxdigit_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int iswxdigit(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which classifies wide character values that are hexadecimal digits. diff --git a/newlib/libc/ctype/isxdigit.c b/newlib/libc/ctype/isxdigit.c index b55ba9c13..f5e858c94 100644 --- a/newlib/libc/ctype/isxdigit.c +++ b/newlib/libc/ctype/isxdigit.c @@ -8,17 +8,13 @@ INDEX INDEX isxdigit_l -ANSI_SYNOPSIS +SYNOPSIS #include int isxdigit(int <[c]>); #include int isxdigit_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int isxdigit(int <[c]>); - DESCRIPTION <> is a macro which classifies singlebyte charset values by table lookup. It is a predicate returning non-zero for hexadecimal digits, diff --git a/newlib/libc/ctype/toascii.c b/newlib/libc/ctype/toascii.c index 945e91883..450e231a3 100644 --- a/newlib/libc/ctype/toascii.c +++ b/newlib/libc/ctype/toascii.c @@ -8,18 +8,13 @@ INDEX INDEX toascii_l -ANSI_SYNOPSIS +SYNOPSIS #include int toascii(int <[c]>); #include int toascii_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int toascii(<[c]>); - int (<[c]>); - DESCRIPTION <> is a macro which coerces integers to the ASCII range (0--127) by zeroing any higher-order bits. diff --git a/newlib/libc/ctype/tolower.c b/newlib/libc/ctype/tolower.c index d1850ede5..5ebd3cd96 100644 --- a/newlib/libc/ctype/tolower.c +++ b/newlib/libc/ctype/tolower.c @@ -11,7 +11,7 @@ INDEX INDEX _tolower -ANSI_SYNOPSIS +SYNOPSIS #include int tolower(int <[c]>); int _tolower(int <[c]>); @@ -19,11 +19,6 @@ ANSI_SYNOPSIS #include int tolower_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int tolower(<[c]>); - int _tolower(<[c]>); - DESCRIPTION <> is a macro which converts uppercase characters to lowercase, diff --git a/newlib/libc/ctype/toupper.c b/newlib/libc/ctype/toupper.c index dc800e449..d9089a95b 100644 --- a/newlib/libc/ctype/toupper.c +++ b/newlib/libc/ctype/toupper.c @@ -11,7 +11,7 @@ INDEX INDEX _toupper -ANSI_SYNOPSIS +SYNOPSIS #include int toupper(int <[c]>); int _toupper(int <[c]>); @@ -19,11 +19,6 @@ ANSI_SYNOPSIS #include int toupper_l(int <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - int toupper(<[c]>); - int _toupper(<[c]>); - DESCRIPTION <> is a macro which converts lowercase characters to uppercase, diff --git a/newlib/libc/ctype/towctrans.c b/newlib/libc/ctype/towctrans.c index a9eaf495d..5528542ff 100644 --- a/newlib/libc/ctype/towctrans.c +++ b/newlib/libc/ctype/towctrans.c @@ -37,19 +37,13 @@ INDEX INDEX towctrans_l -ANSI_SYNOPSIS +SYNOPSIS #include wint_t towctrans(wint_t <[c]>, wctrans_t <[w]>); #include wint_t towctrans_l(wint_t <[c]>, wctrans_t <[w]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - wint_t towctrans(<[c]>, <[w]>) - wint_t <[c]>; - wctrans_t <[w]>; - DESCRIPTION <> is a function which converts wide characters based on diff --git a/newlib/libc/ctype/towlower.c b/newlib/libc/ctype/towlower.c index b69c8ffe5..4485fdef4 100644 --- a/newlib/libc/ctype/towlower.c +++ b/newlib/libc/ctype/towlower.c @@ -37,18 +37,13 @@ INDEX INDEX towlower_l -ANSI_SYNOPSIS +SYNOPSIS #include wint_t towlower(wint_t <[c]>); #include wint_t towlower_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - wint_t towlower(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which converts uppercase wide characters to diff --git a/newlib/libc/ctype/towupper.c b/newlib/libc/ctype/towupper.c index 1e4d0f5cb..06d12ea99 100644 --- a/newlib/libc/ctype/towupper.c +++ b/newlib/libc/ctype/towupper.c @@ -37,18 +37,13 @@ INDEX INDEX towupper_l -ANSI_SYNOPSIS +SYNOPSIS #include wint_t towupper(wint_t <[c]>); #include wint_t towupper_l(wint_t <[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - wint_t towupper(<[c]>) - wint_t <[c]>; - DESCRIPTION <> is a function which converts lowercase wide characters to diff --git a/newlib/libc/ctype/wctrans.c b/newlib/libc/ctype/wctrans.c index b3ad0bbdb..dd5b28c4b 100644 --- a/newlib/libc/ctype/wctrans.c +++ b/newlib/libc/ctype/wctrans.c @@ -37,18 +37,13 @@ INDEX INDEX wctrans_l -ANSI_SYNOPSIS +SYNOPSIS #include wctrans_t wctrans(const char *<[c]>); #include wctrans_t wctrans_l(const char *<[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - wctrans_t wctrans(<[c]>) - const char * <[c]>; - DESCRIPTION <> is a function which takes a string <[c]> and gives back diff --git a/newlib/libc/ctype/wctype.c b/newlib/libc/ctype/wctype.c index f32c42151..c1a70eebb 100644 --- a/newlib/libc/ctype/wctype.c +++ b/newlib/libc/ctype/wctype.c @@ -37,18 +37,13 @@ INDEX INDEX wctype_l -ANSI_SYNOPSIS +SYNOPSIS #include wctype_t wctype(const char *<[c]>); #include wctype_t wctype_l(const char *<[c]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - wctype_t wctype(<[c]>) - const char * <[c]>; - DESCRIPTION <> is a function which takes a string <[c]> and gives back From 03973c19e9eef7c11cc5f54a3ed2c4fca62d6906 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:19:48 -0600 Subject: [PATCH 145/649] iconv: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/iconv/lib/iconv.c | 40 +---------------------------------- 1 file changed, 1 insertion(+), 39 deletions(-) diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c index 8214a7874..9d9d6a717 100644 --- a/newlib/libc/iconv/lib/iconv.c +++ b/newlib/libc/iconv/lib/iconv.c @@ -41,7 +41,7 @@ INDEX INDEX _iconv_close_r -ANSI_SYNOPSIS +SYNOPSIS #include iconv_t iconv_open (const char *<[to]>, const char *<[from]>); int iconv_close (iconv_t <[cd]>); @@ -58,44 +58,6 @@ ANSI_SYNOPSIS size_t *<[inbytesleft]>, char **<[outbuf]>, size_t *<[outbytesleft]>); -TRAD_SYNOPSIS - #include - size_t iconv (<[cd]>, <[in]>, <[inleft]>, <[out]>, <[outleft]>); - iconv_t <[cd]>; - char **<[in]>; - size_t *<[inleft]>; - char **<[out]>; - size_t *<[outleft]>); - - #include - iconv_t iconv_open (<[to]>, <[from]>); - const char *<[to]>; - const char *<[from]>; - - #include - int iconv_close (<[cd]>); - iconv_t <[cd]>; - - #include - size_t _iconv_r (<[rptr]>, <[cd]>, <[in]>, <[inleft]>, <[out]>, <[outleft]>); - struct _reent *<[rptr]>; - iconv_t <[cd]>; - const char **<[in]>; - size_t *<[inleft]>; - char **<[out]>; - size_t *<[outleft]>); - - #include - iconv_t _iconv_open_r (<[rptr]>, <[to]>, <[from]>); - struct _reent *<[rptr]>; - const char *<[to]>; - const char *<[from]>; - - #include - int iconv_close (<[rptr]>, <[cd]>); - struct _reent *<[rptr]>; - iconv_t <[cd]>; - DESCRIPTION The function <> converts characters from <[in]> which are in one encoding to characters of another encoding, outputting them to <[out]>. From 59235deeec436e8e7f39d9ac4447fab30413f963 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:20:53 -0600 Subject: [PATCH 146/649] locale: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/locale/duplocale.c | 2 +- newlib/libc/locale/freelocale.c | 2 +- newlib/libc/locale/locale.c | 18 +----------------- newlib/libc/locale/newlocale.c | 2 +- newlib/libc/locale/uselocale.c | 2 +- 5 files changed, 5 insertions(+), 21 deletions(-) diff --git a/newlib/libc/locale/duplocale.c b/newlib/libc/locale/duplocale.c index 9f6156cb4..d3e7d782e 100644 --- a/newlib/libc/locale/duplocale.c +++ b/newlib/libc/locale/duplocale.c @@ -8,7 +8,7 @@ INDEX INDEX _duplocale_r -ANSI_SYNOPSIS +SYNOPSIS #include locale_t duplocale(locale_t <[locobj]>); diff --git a/newlib/libc/locale/freelocale.c b/newlib/libc/locale/freelocale.c index dd3c0f95e..f5d55f5e2 100644 --- a/newlib/libc/locale/freelocale.c +++ b/newlib/libc/locale/freelocale.c @@ -8,7 +8,7 @@ INDEX INDEX _freelocale_r -ANSI_SYNOPSIS +SYNOPSIS #include locale_t freelocale(locale_t <[locobj]>); diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index b5402372c..073189a29 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -11,7 +11,7 @@ INDEX INDEX _localeconv_r -ANSI_SYNOPSIS +SYNOPSIS #include char *setlocale(int <[category]>, const char *<[locale]>); lconv *localeconv(void); @@ -20,22 +20,6 @@ ANSI_SYNOPSIS int <[category]>, const char *<[locale]>); lconv *_localeconv_r(void *<[reent]>); -TRAD_SYNOPSIS - #include - char *setlocale(<[category]>, <[locale]>) - int <[category]>; - char *<[locale]>; - - lconv *localeconv(); - - char *_setlocale_r(<[reent]>, <[category]>, <[locale]>) - char *<[reent]>; - int <[category]>; - char *<[locale]>; - - lconv *_localeconv_r(<[reent]>); - char *<[reent]>; - DESCRIPTION <> is the facility defined by ANSI C to condition the execution environment for international collating and formatting diff --git a/newlib/libc/locale/newlocale.c b/newlib/libc/locale/newlocale.c index c8176256e..c6c2a9ca9 100644 --- a/newlib/libc/locale/newlocale.c +++ b/newlib/libc/locale/newlocale.c @@ -8,7 +8,7 @@ INDEX INDEX _newlocale_r -ANSI_SYNOPSIS +SYNOPSIS #include locale_t newlocale(int <[category_mask]>, const char *<[locale]>, locale_t <[locobj]>); diff --git a/newlib/libc/locale/uselocale.c b/newlib/libc/locale/uselocale.c index 810590fc0..83ebcdd19 100644 --- a/newlib/libc/locale/uselocale.c +++ b/newlib/libc/locale/uselocale.c @@ -8,7 +8,7 @@ INDEX INDEX _uselocale_r -ANSI_SYNOPSIS +SYNOPSIS #include locale_t uselocale(locale_t <[locobj]>); From 4e8c64b928dad78c5d39d6c729ea062b516afc83 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:37:32 -0600 Subject: [PATCH 147/649] microblaze: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/machine/microblaze/abort.c | 6 +----- newlib/libc/machine/microblaze/strcmp.c | 8 +------- newlib/libc/machine/microblaze/strcpy.c | 8 +------- newlib/libc/machine/microblaze/strlen.c | 7 +------ 4 files changed, 4 insertions(+), 25 deletions(-) diff --git a/newlib/libc/machine/microblaze/abort.c b/newlib/libc/machine/microblaze/abort.c index b2c5a00b2..82daebe43 100644 --- a/newlib/libc/machine/microblaze/abort.c +++ b/newlib/libc/machine/microblaze/abort.c @@ -15,14 +15,10 @@ FUNCTION INDEX abort -ANSI_SYNOPSIS +SYNOPSIS #include void abort(void); -TRAD_SYNOPSIS - #include - void abort(); - DESCRIPTION Use <> to signal that your program has detected a condition it cannot deal with. Normally, <> ends your program's execution. diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c index 2f0337412..fc7dc2143 100644 --- a/newlib/libc/machine/microblaze/strcmp.c +++ b/newlib/libc/machine/microblaze/strcmp.c @@ -34,16 +34,10 @@ FUNCTION INDEX strcmp -ANSI_SYNOPSIS +SYNOPSIS #include int strcmp(const char *<[a]>, const char *<[b]>); -TRAD_SYNOPSIS - #include - int strcmp(<[a]>, <[b]>) - char *<[a]>; - char *<[b]>; - DESCRIPTION <> compares the string at <[a]> to the string at <[b]>. diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c index 0819ee511..44ba382c7 100644 --- a/newlib/libc/machine/microblaze/strcpy.c +++ b/newlib/libc/machine/microblaze/strcpy.c @@ -34,16 +34,10 @@ FUNCTION INDEX strcpy -ANSI_SYNOPSIS +SYNOPSIS #include char *strcpy(char *restrict <[dst]>, const char *restrict <[src]>); -TRAD_SYNOPSIS - #include - char *strcpy(<[dst]>, <[src]>) - char *<[dst]>; - char *<[src]>; - DESCRIPTION <> copies the string pointed to by <[src]> (including the terminating null character) to the array diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c index 51387cd9c..ddd9e6a82 100644 --- a/newlib/libc/machine/microblaze/strlen.c +++ b/newlib/libc/machine/microblaze/strlen.c @@ -34,15 +34,10 @@ FUNCTION INDEX strlen -ANSI_SYNOPSIS +SYNOPSIS #include size_t strlen(const char *<[str]>); -TRAD_SYNOPSIS - #include - size_t strlen(<[str]>) - char *<[src]>; - DESCRIPTION The <> function works out the length of the string starting at <<*<[str]>>> by counting chararacters until it From ddd22ee06902fbe6cf8a9f4b67c351ac28c3872c Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:38:06 -0600 Subject: [PATCH 148/649] nds32: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/machine/nds32/abort.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/newlib/libc/machine/nds32/abort.c b/newlib/libc/machine/nds32/abort.c index 724562a84..abceb4b8b 100644 --- a/newlib/libc/machine/nds32/abort.c +++ b/newlib/libc/machine/nds32/abort.c @@ -5,14 +5,10 @@ FUNCTION INDEX abort -ANSI_SYNOPSIS +SYNOPSIS #include void abort(void); -TRAD_SYNOPSIS - #include - void abort(); - DESCRIPTION Use <> to signal that your program has detected a condition it cannot deal with. Normally, <> ends your program's execution. From 1f1e477554ce58dec2cb0b4629164e420cca75f0 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:38:25 -0600 Subject: [PATCH 149/649] powerpc: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/machine/powerpc/atosfix16.c | 25 +----------- newlib/libc/machine/powerpc/atoufix16.c | 25 +----------- newlib/libc/machine/powerpc/strtosfix16.c | 31 +------------- newlib/libc/machine/powerpc/strtoufix16.c | 31 +------------- newlib/libc/machine/powerpc/vec_calloc.c | 14 +------ newlib/libc/machine/powerpc/vec_malloc.c | 28 +------------ newlib/libc/machine/powerpc/vfprintf.c | 49 +---------------------- newlib/libc/machine/powerpc/vfscanf.c | 36 +---------------- 8 files changed, 8 insertions(+), 231 deletions(-) diff --git a/newlib/libc/machine/powerpc/atosfix16.c b/newlib/libc/machine/powerpc/atosfix16.c index 501c0f1cb..30379c579 100644 --- a/newlib/libc/machine/powerpc/atosfix16.c +++ b/newlib/libc/machine/powerpc/atosfix16.c @@ -15,7 +15,7 @@ INDEX INDEX _atosfix64_r -ANSI_SYNOPSIS +SYNOPSIS #include __int16_t atosfix16(const char *<[s]>); __int32_t atosfix32(const char *<[s]>); @@ -25,29 +25,6 @@ ANSI_SYNOPSIS __int32_t _atosfix32_r(struct __reent *, const char *<[s]>); __int64_t _atosfix32_r(struct __reent *, const char *<[s]>); -TRAD_SYNOPSIS - #include - __int16_t atosfix16(<[s]>) - const char *<[s]>; - - __int32_t atosfix32(<[s]>) - const char *<[s]>; - - __int64_t atosfix64(<[s]>) - const char *<[s]>; - - __int16_t _atosfix16_r(, <[s]>) - struct _reent *<[reent]>; - const char *<[s]>; - - __int32_t _atosfix32_r(, <[s]>) - struct _reent *<[reent]>; - const char *<[s]>; - - __int64_t _atosfix64_r(, <[s]>) - struct _reent *<[reent]>; - const char *<[s]>; - DESCRIPTION <> converts the initial portion of a string to a sign + 15-bit fraction fixed point value. diff --git a/newlib/libc/machine/powerpc/atoufix16.c b/newlib/libc/machine/powerpc/atoufix16.c index 53db13764..45d130fac 100644 --- a/newlib/libc/machine/powerpc/atoufix16.c +++ b/newlib/libc/machine/powerpc/atoufix16.c @@ -15,7 +15,7 @@ INDEX INDEX _atoufix64_r -ANSI_SYNOPSIS +SYNOPSIS #include __uint16_t atoufix16(const char *<[s]>); __uint32_t atoufix32(const char *<[s]>); @@ -25,29 +25,6 @@ ANSI_SYNOPSIS __uint32_t _atoufix32_r(struct __reent *, const char *<[s]>); __uint64_t _atoufix32_r(struct __reent *, const char *<[s]>); -TRAD_SYNOPSIS - #include - __uint16_t atoufix16(<[s]>) - const char *<[s]>; - - __uint32_t atoufix32(<[s]>) - const char *<[s]>; - - __uint64_t atoufix64(<[s]>) - const char *<[s]>; - - __uint16_t _atoufix16_r(, <[s]>) - struct _reent *<[reent]>; - const char *<[s]>; - - __uint32_t _atoufix32_r(, <[s]>) - struct _reent *<[reent]>; - const char *<[s]>; - - __uint64_t _atoufix64_r(, <[s]>) - struct _reent *<[reent]>; - const char *<[s]>; - DESCRIPTION <> converts the initial portion of a string to a 16-bit fraction unsigned fixed point value. diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c index d3cfe0781..e39887dc1 100644 --- a/newlib/libc/machine/powerpc/strtosfix16.c +++ b/newlib/libc/machine/powerpc/strtosfix16.c @@ -15,7 +15,7 @@ INDEX INDEX _strtosfix64_r -ANSI_SYNOPSIS +SYNOPSIS #include __int16 strtosfix16 (const char *<[s]>, char **<[ptr]>); @@ -32,35 +32,6 @@ ANSI_SYNOPSIS __int64 _strtosfix64_r (void *<[reent]>, const char *<[s]>, char **<[ptr]>); -TRAD_SYNOPSIS - #include - __int16 strtosfix16 (<[s]>, <[ptr]>) - char *<[s]>; - char **<[ptr]>; - - __int32 strtosfix32 (<[s]>, <[ptr]>) - char *<[s]>; - char **<[ptr]>; - - __int64 strtosfix64 (<[s]>, <[ptr]>) - char *<[s]>; - char **<[ptr]>; - - __int16 _strtosfix16_r (<[reent]>, <[s]>, <[ptr]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - - __int32 _strtosfix32_r (<[reent]>, <[s]>, <[ptr]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - - __int64 _strtosfix64_r (<[reent]>, <[s]>, <[ptr]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - DESCRIPTION The function <> converts the string <<*<[s]>>> to a fixed-point sign + 15-bits fraction representation. The function diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c index d90255c0e..3bf2d6b29 100644 --- a/newlib/libc/machine/powerpc/strtoufix16.c +++ b/newlib/libc/machine/powerpc/strtoufix16.c @@ -15,7 +15,7 @@ INDEX INDEX _strtoufix64_r -ANSI_SYNOPSIS +SYNOPSIS #include __uint16_t strtoufix16 (const char *<[s]>, char **<[ptr]>); @@ -32,35 +32,6 @@ ANSI_SYNOPSIS __uint64_t _strtoufix64_r (void *<[reent]>, const char *<[s]>, char **<[ptr]>); -TRAD_SYNOPSIS - #include - __uint16_t strtoufix16 (<[s]>, <[ptr]>) - char *<[s]>; - char **<[ptr]>; - - __uint32_t strtoufix32 (<[s]>, <[ptr]>) - char *<[s]>; - char **<[ptr]>; - - __uint64_t strtoufix64 (<[s]>, <[ptr]>) - char *<[s]>; - char **<[ptr]>; - - __uint16_t _strtoufix16_r (<[reent]>, <[s]>, <[ptr]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - - __uint32_t _strtoufix32_r (<[reent]>, <[s]>, <[ptr]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - - __uint64_t _strtoufix64_r (<[reent]>, <[s]>, <[ptr]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - DESCRIPTION The function <> converts the string <<*<[s]>>> to a fixed-point 16-bits fraction representation. The function diff --git a/newlib/libc/machine/powerpc/vec_calloc.c b/newlib/libc/machine/powerpc/vec_calloc.c index 5efe91049..8b2e835f0 100644 --- a/newlib/libc/machine/powerpc/vec_calloc.c +++ b/newlib/libc/machine/powerpc/vec_calloc.c @@ -8,22 +8,10 @@ INDEX INDEX _vec_calloc_r -ANSI_SYNOPSIS +SYNOPSIS #include void *vec_calloc(size_t <[n]>, size_t <[s]>); void *vec_calloc_r(void *<[reent]>, size_t , <[s]>); - -TRAD_SYNOPSIS - #include - char *vec_calloc(<[n]>, <[s]>) - size_t <[n]>, <[s]>; - - char *_vec_calloc_r(<[reent]>, <[n]>, <[s]>) - char *<[reent]>; - size_t <[n]>; - size_t <[s]>; - - DESCRIPTION Use <> to request a block of memory sufficient to hold an diff --git a/newlib/libc/machine/powerpc/vec_malloc.c b/newlib/libc/machine/powerpc/vec_malloc.c index 6bcad59b6..181f360f0 100644 --- a/newlib/libc/machine/powerpc/vec_malloc.c +++ b/newlib/libc/machine/powerpc/vec_malloc.c @@ -15,7 +15,7 @@ INDEX INDEX _vec_free_r -ANSI_SYNOPSIS +SYNOPSIS #include void *vec_malloc(size_t <[nbytes]>); void *vec_realloc(void *<[aptr]>, size_t <[nbytes]>); @@ -27,32 +27,6 @@ ANSI_SYNOPSIS void *<[aptr]>, size_t <[nbytes]>); void _vec_free_r(void *<[reent]>, void *<[aptr]>); - -TRAD_SYNOPSIS - #include - char *vec_malloc(<[nbytes]>) - size_t <[nbytes]>; - - char *vec_realloc(<[aptr]>, <[nbytes]>) - char *<[aptr]>; - size_t <[nbytes]>; - - void vec_free(<[aptr]>) - char *<[aptr]>; - - char *_vec_malloc_r(<[reent]>,<[nbytes]>) - char *<[reent]>; - size_t <[nbytes]>; - - char *_vec_realloc_r(<[reent]>, <[aptr]>, <[nbytes]>) - char *<[reent]>; - char *<[aptr]>; - size_t <[nbytes]>; - - void _vec_free_r(<[reent]>, <[aptr]>) - char *<[reent]>; - char *<[aptr]>; - DESCRIPTION These functions manage a pool of system memory that is 16-byte aligned.. diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c index d264e2673..e0b90fcde 100644 --- a/newlib/libc/machine/powerpc/vfprintf.c +++ b/newlib/libc/machine/powerpc/vfprintf.c @@ -11,7 +11,7 @@ INDEX INDEX vsnprintf -ANSI_SYNOPSIS +SYNOPSIS #include #include int vprintf(const char *<[fmt]>, va_list <[list]>); @@ -28,53 +28,6 @@ ANSI_SYNOPSIS int _vsnprintf_r(void *<[reent]>, char *<[str]>, size_t <[size]>, const char *<[fmt]>, va_list <[list]>); -TRAD_SYNOPSIS - #include - #include - int vprintf( <[fmt]>, <[list]>) - char *<[fmt]>; - va_list <[list]>; - - int vfprintf(<[fp]>, <[fmt]>, <[list]>) - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int vsprintf(<[str]>, <[fmt]>, <[list]>) - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - - int vsnprintf(<[str]>, <[size]>, <[fmt]>, <[list]>) - char *<[str]>; - size_t <[size]>; - char *<[fmt]>; - va_list <[list]>; - - int _vprintf_r(<[reent]>, <[fmt]>, <[list]>) - char *<[reent]>; - char *<[fmt]>; - va_list <[list]>; - - int _vfprintf_r(<[reent]>, <[fp]>, <[fmt]>, <[list]>) - char *<[reent]>; - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int _vsprintf_r(<[reent]>, <[str]>, <[fmt]>, <[list]>) - char *<[reent]>; - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - - int _vsnprintf_r(<[reent]>, <[str]>, <[size]>, <[fmt]>, <[list]>) - char *<[reent]>; - char *<[str]>; - size_t <[size]>; - char *<[fmt]>; - va_list <[list]>; - DESCRIPTION <>, <>, <> and <> are (respectively) variants of <>, <>, <> and <>. They differ diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index 1520ceab8..6cbc624de 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -9,7 +9,7 @@ INDEX INDEX vsscanf -ANSI_SYNOPSIS +SYNOPSIS #include #include int vscanf(const char *restrict <[fmt]>, va_list <[list]>); @@ -23,40 +23,6 @@ ANSI_SYNOPSIS int _vsscanf_r(void *<[reent]>, const char *restrict <[str]>, const char *restrict <[fmt]>, va_list <[list]>); -TRAD_SYNOPSIS - #include - #include - int vscanf( <[fmt]>, <[ist]>) - char *<[fmt]>; - va_list <[list]>; - - int vfscanf( <[fp]>, <[fmt]>, <[list]>) - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int vsscanf( <[str]>, <[fmt]>, <[list]>) - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - - int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>) - char *<[reent]>; - char *<[fmt]>; - va_list <[list]>; - - int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>) - char *<[reent]>; - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>) - char *<[reent]>; - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - DESCRIPTION <>, <>, and <> are (respectively) variants of <>, <>, and <>. They differ only in From 191b4f35bc0026ef3f1f6b3bcaf0524810cbd358 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:39:06 -0600 Subject: [PATCH 150/649] misc: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/misc/ffs.c | 6 +----- newlib/libc/misc/lock.c | 2 +- newlib/libc/misc/unctrl.c | 7 +------ 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/newlib/libc/misc/ffs.c b/newlib/libc/misc/ffs.c index ba5700920..068f25481 100644 --- a/newlib/libc/misc/ffs.c +++ b/newlib/libc/misc/ffs.c @@ -5,14 +5,10 @@ FUNCTION INDEX ffs -ANSI_SYNOPSIS +SYNOPSIS #include int ffs(int <[word]>); -TRAD_SYNOPSIS - #include - int ffs(<[word]>); - DESCRIPTION <> returns the first bit set in a word. diff --git a/newlib/libc/misc/lock.c b/newlib/libc/misc/lock.c index a76317668..545511e78 100644 --- a/newlib/libc/misc/lock.c +++ b/newlib/libc/misc/lock.c @@ -42,7 +42,7 @@ INDEX INDEX __retarget_lock_release_recursive -ANSI_SYNOPSIS +SYNOPSIS #include struct __lock __lock___sinit_recursive_mutex; struct __lock __lock___sfp_recursive_mutex; diff --git a/newlib/libc/misc/unctrl.c b/newlib/libc/misc/unctrl.c index fa0b90ff1..e2cdb3861 100644 --- a/newlib/libc/misc/unctrl.c +++ b/newlib/libc/misc/unctrl.c @@ -7,16 +7,11 @@ INDEX INDEX unctrllen -ANSI_SYNOPSIS +SYNOPSIS #include char *unctrl(int <[c]>); int unctrllen(int <[c]>); -TRAD_SYNOPSIS - #include - char *unctrl(<[c]>); - int unctrllen(<[c]>); - DESCRIPTION <> is a macro which returns the printable representation of <[c]> as a string. From aa06fa01dce9d5173051cd8f773a61b1f20254d4 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:01:32 -0600 Subject: [PATCH 151/649] posix: remove TRAD_SYNOPSIS --- newlib/libc/posix/popen.c | 2 +- newlib/libc/posix/posix_spawn.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libc/posix/popen.c b/newlib/libc/posix/popen.c index faf72b6e3..f9abfac3f 100644 --- a/newlib/libc/posix/popen.c +++ b/newlib/libc/posix/popen.c @@ -41,7 +41,7 @@ INDEX INDEX pclose -ANSI_SYNOPSIS +SYNOPSIS #include FILE *popen(const char *<[s]>, const char *<[mode]>); diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c index e5655e29a..61d36304d 100644 --- a/newlib/libc/posix/posix_spawn.c +++ b/newlib/libc/posix/posix_spawn.c @@ -33,7 +33,7 @@ INDEX INDEX posix_spawnp -ANSI_SYNOPSIS +SYNOPSIS #include int posix_spawn(pid_t *<[pid]>, const char *<[path]>, From 35d2d2fe2ecbfc611820285cc4d47644012e1e1d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:41:14 -0600 Subject: [PATCH 152/649] reent: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/reent/closer.c | 8 +------- newlib/libc/reent/execr.c | 25 +++---------------------- newlib/libc/reent/fcntlr.c | 10 +--------- newlib/libc/reent/fstat64r.c | 9 +-------- newlib/libc/reent/fstatr.c | 9 +-------- newlib/libc/reent/gettimeofdayr.c | 10 +--------- newlib/libc/reent/isattyr.c | 8 +------- newlib/libc/reent/linkr.c | 9 +-------- newlib/libc/reent/lseek64r.c | 10 +--------- newlib/libc/reent/lseekr.c | 10 +--------- newlib/libc/reent/mkdirr.c | 9 +-------- newlib/libc/reent/open64r.c | 10 +--------- newlib/libc/reent/openr.c | 10 +--------- newlib/libc/reent/readr.c | 10 +--------- newlib/libc/reent/renamer.c | 9 +-------- newlib/libc/reent/sbrkr.c | 8 +------- newlib/libc/reent/signalr.c | 16 ++-------------- newlib/libc/reent/stat64r.c | 9 +-------- newlib/libc/reent/statr.c | 9 +-------- newlib/libc/reent/timesr.c | 9 +-------- newlib/libc/reent/unlinkr.c | 8 +------- newlib/libc/reent/writer.c | 10 +--------- 22 files changed, 25 insertions(+), 200 deletions(-) diff --git a/newlib/libc/reent/closer.c b/newlib/libc/reent/closer.c index aeacebd6c..deb34b002 100644 --- a/newlib/libc/reent/closer.c +++ b/newlib/libc/reent/closer.c @@ -26,16 +26,10 @@ FUNCTION INDEX _close_r -ANSI_SYNOPSIS +SYNOPSIS #include int _close_r(struct _reent *<[ptr]>, int <[fd]>); -TRAD_SYNOPSIS - #include - int _close_r(<[ptr]>, <[fd]>) - struct _reent *<[ptr]>; - int <[fd]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c index d8026703a..559ca030a 100644 --- a/newlib/libc/reent/execr.c +++ b/newlib/libc/reent/execr.c @@ -33,19 +33,11 @@ FUNCTION INDEX _execve_r -ANSI_SYNOPSIS +SYNOPSIS #include int _execve_r(struct _reent *<[ptr]>, const char *<[name]>, char *const <[argv]>[], char *const <[env]>[]); -TRAD_SYNOPSIS - #include - int _execve_r(<[ptr]>, <[name]>, <[argv]>, <[env]>) - struct _reent *<[ptr]>; - char *<[name]>; - char *<[argv]>[]; - char *<[env]>[]; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds @@ -76,15 +68,10 @@ FUNCTION INDEX _fork_r -ANSI_SYNOPSIS +SYNOPSIS #include int _fork_r(struct _reent *<[ptr]>); -TRAD_SYNOPSIS - #include - int _fork_r(<[ptr]>) - struct _reent *<[ptr]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds @@ -115,16 +102,10 @@ FUNCTION INDEX _wait_r -ANSI_SYNOPSIS +SYNOPSIS #include int _wait_r(struct _reent *<[ptr]>, int *<[status]>); -TRAD_SYNOPSIS - #include - int _wait_r(<[ptr]>, <[status]>) - struct _reent *<[ptr]>; - int *<[status]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/fcntlr.c b/newlib/libc/reent/fcntlr.c index d632d183f..328b9de13 100644 --- a/newlib/libc/reent/fcntlr.c +++ b/newlib/libc/reent/fcntlr.c @@ -28,19 +28,11 @@ FUNCTION INDEX _fcntl_r -ANSI_SYNOPSIS +SYNOPSIS #include int _fcntl_r(struct _reent *<[ptr]>, int <[fd]>, int <[cmd]>, <[arg]>); -TRAD_SYNOPSIS - #include - int _fcntl_r(<[ptr]>, <[fd]>, <[cmd]>, <[arg]>) - struct _reent *<[ptr]>; - int <[fd]>; - int <[cmd]>; - int <[arg]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/fstat64r.c b/newlib/libc/reent/fstat64r.c index 1c4589713..d9fa8b71f 100644 --- a/newlib/libc/reent/fstat64r.c +++ b/newlib/libc/reent/fstat64r.c @@ -34,18 +34,11 @@ FUNCTION INDEX _fstat64_r -ANSI_SYNOPSIS +SYNOPSIS #include int _fstat64_r(struct _reent *<[ptr]>, int <[fd]>, struct stat64 *<[pstat]>); -TRAD_SYNOPSIS - #include - int _fstat64_r(<[ptr]>, <[fd]>, <[pstat]>) - struct _reent *<[ptr]>; - int <[fd]>; - struct stat *<[pstat]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/fstatr.c b/newlib/libc/reent/fstatr.c index 7f5d559da..ec906c98d 100644 --- a/newlib/libc/reent/fstatr.c +++ b/newlib/libc/reent/fstatr.c @@ -32,18 +32,11 @@ FUNCTION INDEX _fstat_r -ANSI_SYNOPSIS +SYNOPSIS #include int _fstat_r(struct _reent *<[ptr]>, int <[fd]>, struct stat *<[pstat]>); -TRAD_SYNOPSIS - #include - int _fstat_r(<[ptr]>, <[fd]>, <[pstat]>) - struct _reent *<[ptr]>; - int <[fd]>; - struct stat *<[pstat]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/gettimeofdayr.c b/newlib/libc/reent/gettimeofdayr.c index f5a49f73c..007dff8da 100644 --- a/newlib/libc/reent/gettimeofdayr.c +++ b/newlib/libc/reent/gettimeofdayr.c @@ -35,21 +35,13 @@ FUNCTION INDEX _gettimeofday_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int _gettimeofday_r(struct _reent *<[ptr]>, struct timeval *<[ptimeval]>, void *<[ptimezone]>); -TRAD_SYNOPSIS - #include - #include - int _gettimeofday_r(<[ptr]>, <[ptimeval]>, <[ptimezone]>) - struct _reent *<[ptr]>; - struct timeval *<[ptimeval]>; - void *<[ptimezone]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/isattyr.c b/newlib/libc/reent/isattyr.c index 05d47d323..f21bf25b2 100644 --- a/newlib/libc/reent/isattyr.c +++ b/newlib/libc/reent/isattyr.c @@ -30,17 +30,11 @@ FUNCTION INDEX _isatty_r -ANSI_SYNOPSIS +SYNOPSIS #include int _isatty_r(struct _reent *<[ptr]>, int <[fd]>); -TRAD_SYNOPSIS - #include - int _isatty_r(<[ptr]>, <[fd]>) - struct _reent *<[ptr]>; - int <[fd]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/linkr.c b/newlib/libc/reent/linkr.c index ded636af7..8cfdf2f06 100644 --- a/newlib/libc/reent/linkr.c +++ b/newlib/libc/reent/linkr.c @@ -31,18 +31,11 @@ FUNCTION INDEX _link_r -ANSI_SYNOPSIS +SYNOPSIS #include int _link_r(struct _reent *<[ptr]>, const char *<[old]>, const char *<[new]>); -TRAD_SYNOPSIS - #include - int _link_r(<[ptr]>, <[old]>, <[new]>) - struct _reent *<[ptr]>; - char *<[old]>; - char *<[new]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/lseek64r.c b/newlib/libc/reent/lseek64r.c index 0207a1220..1241a27e4 100644 --- a/newlib/libc/reent/lseek64r.c +++ b/newlib/libc/reent/lseek64r.c @@ -28,19 +28,11 @@ FUNCTION INDEX _lseek64_r -ANSI_SYNOPSIS +SYNOPSIS #include off64_t _lseek64_r(struct _reent *<[ptr]>, int <[fd]>, off64_t <[pos]>, int <[whence]>); -TRAD_SYNOPSIS - #include - off64_t _lseek64_r(<[ptr]>, <[fd]>, <[pos]>, <[whence]>) - struct _reent *<[ptr]>; - int <[fd]>; - off64_t <[pos]>; - int <[whence]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/lseekr.c b/newlib/libc/reent/lseekr.c index fa00695a8..cc73ab467 100644 --- a/newlib/libc/reent/lseekr.c +++ b/newlib/libc/reent/lseekr.c @@ -26,19 +26,11 @@ FUNCTION INDEX _lseek_r -ANSI_SYNOPSIS +SYNOPSIS #include off_t _lseek_r(struct _reent *<[ptr]>, int <[fd]>, off_t <[pos]>, int <[whence]>); -TRAD_SYNOPSIS - #include - off_t _lseek_r(<[ptr]>, <[fd]>, <[pos]>, <[whence]>) - struct _reent *<[ptr]>; - int <[fd]>; - off_t <[pos]>; - int <[whence]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/mkdirr.c b/newlib/libc/reent/mkdirr.c index fe36de11a..eee999e19 100644 --- a/newlib/libc/reent/mkdirr.c +++ b/newlib/libc/reent/mkdirr.c @@ -26,18 +26,11 @@ FUNCTION INDEX _mkdir_r -ANSI_SYNOPSIS +SYNOPSIS #include int _mkdir_r(struct _reent *<[ptr]>, const char *<[path]>, int <[mode]>); -TRAD_SYNOPSIS - #include - int _mkdir_r(<[ptr]>, <[path]>, <[mode]>) - struct _reent *<[ptr]>; - char *<[path]>; - int <[mode]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/open64r.c b/newlib/libc/reent/open64r.c index 30310d301..6b39fa1fd 100644 --- a/newlib/libc/reent/open64r.c +++ b/newlib/libc/reent/open64r.c @@ -29,19 +29,11 @@ FUNCTION INDEX _open64_r -ANSI_SYNOPSIS +SYNOPSIS #include int _open64_r(struct _reent *<[ptr]>, const char *<[file]>, int <[flags]>, int <[mode]>); -TRAD_SYNOPSIS - #include - int _open64_r(<[ptr]>, <[file]>, <[flags]>, <[mode]>) - struct _reent *<[ptr]>; - char *<[file]>; - int <[flags]>; - int <[mode]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/openr.c b/newlib/libc/reent/openr.c index 35138c6de..06b203b81 100644 --- a/newlib/libc/reent/openr.c +++ b/newlib/libc/reent/openr.c @@ -27,19 +27,11 @@ FUNCTION INDEX _open_r -ANSI_SYNOPSIS +SYNOPSIS #include int _open_r(struct _reent *<[ptr]>, const char *<[file]>, int <[flags]>, int <[mode]>); -TRAD_SYNOPSIS - #include - int _open_r(<[ptr]>, <[file]>, <[flags]>, <[mode]>) - struct _reent *<[ptr]>; - char *<[file]>; - int <[flags]>; - int <[mode]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c index 38c1d9e39..65e0514cf 100644 --- a/newlib/libc/reent/readr.c +++ b/newlib/libc/reent/readr.c @@ -26,19 +26,11 @@ FUNCTION INDEX _read_r -ANSI_SYNOPSIS +SYNOPSIS #include _ssize_t _read_r(struct _reent *<[ptr]>, int <[fd]>, void *<[buf]>, size_t <[cnt]>); -TRAD_SYNOPSIS - #include - _ssize_t _read_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) - struct _reent *<[ptr]>; - int <[fd]>; - char *<[buf]>; - size_t <[cnt]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c index d3951a28d..9b42dc380 100644 --- a/newlib/libc/reent/renamer.c +++ b/newlib/libc/reent/renamer.c @@ -28,18 +28,11 @@ FUNCTION INDEX _rename_r -ANSI_SYNOPSIS +SYNOPSIS #include int _rename_r(struct _reent *<[ptr]>, const char *<[old]>, const char *<[new]>); -TRAD_SYNOPSIS - #include - int _rename_r(<[ptr]>, <[old]>, <[new]>) - struct _reent *<[ptr]>; - char *<[old]>; - char *<[new]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/sbrkr.c b/newlib/libc/reent/sbrkr.c index 44e42b57f..4217174b3 100644 --- a/newlib/libc/reent/sbrkr.c +++ b/newlib/libc/reent/sbrkr.c @@ -30,16 +30,10 @@ FUNCTION INDEX _sbrk_r -ANSI_SYNOPSIS +SYNOPSIS #include void *_sbrk_r(struct _reent *<[ptr]>, ptrdiff_t <[incr]>); -TRAD_SYNOPSIS - #include - void *_sbrk_r(<[ptr]>, <[incr]>) - struct _reent *<[ptr]>; - ptrdiff_t <[incr]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/signalr.c b/newlib/libc/reent/signalr.c index 161d53091..95dd49ed3 100644 --- a/newlib/libc/reent/signalr.c +++ b/newlib/libc/reent/signalr.c @@ -32,17 +32,10 @@ FUNCTION INDEX _kill_r -ANSI_SYNOPSIS +SYNOPSIS #include int _kill_r(struct _reent *<[ptr]>, int <[pid]>, int <[sig]>); -TRAD_SYNOPSIS - #include - int _kill_r(<[ptr]>, <[pid]>, <[sig]>) - struct _reent *<[ptr]>; - int <[pid]>; - int <[sig]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds @@ -71,15 +64,10 @@ FUNCTION INDEX _getpid_r -ANSI_SYNOPSIS +SYNOPSIS #include int _getpid_r(struct _reent *<[ptr]>); -TRAD_SYNOPSIS - #include - int _getpid_r(<[ptr]>) - struct _reent *<[ptr]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c index 695b7f813..1f175e0a9 100644 --- a/newlib/libc/reent/stat64r.c +++ b/newlib/libc/reent/stat64r.c @@ -33,18 +33,11 @@ FUNCTION INDEX _stat64_r -ANSI_SYNOPSIS +SYNOPSIS #include int _stat64_r(struct _reent *<[ptr]>, const char *<[file]>, struct stat64 *<[pstat]>); -TRAD_SYNOPSIS - #include - int _stat64_r(<[ptr]>, <[file]>, <[pstat]>) - struct _reent *<[ptr]>; - char *<[file]>; - struct stat64 *<[pstat]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/statr.c b/newlib/libc/reent/statr.c index 9ad2bb209..3500c88b1 100644 --- a/newlib/libc/reent/statr.c +++ b/newlib/libc/reent/statr.c @@ -33,18 +33,11 @@ FUNCTION INDEX _stat_r -ANSI_SYNOPSIS +SYNOPSIS #include int _stat_r(struct _reent *<[ptr]>, const char *<[file]>, struct stat *<[pstat]>); -TRAD_SYNOPSIS - #include - int _stat_r(<[ptr]>, <[file]>, <[pstat]>) - struct _reent *<[ptr]>; - char *<[file]>; - struct stat *<[pstat]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/timesr.c b/newlib/libc/reent/timesr.c index 1881724ba..efb98b61d 100644 --- a/newlib/libc/reent/timesr.c +++ b/newlib/libc/reent/timesr.c @@ -32,18 +32,11 @@ FUNCTION INDEX _times_r -ANSI_SYNOPSIS +SYNOPSIS #include #include clock_t _times_r(struct _reent *<[ptr]>, struct tms *<[ptms]>); -TRAD_SYNOPSIS - #include - #include - clock_t _times_r(<[ptr]>, <[ptms]>) - struct _reent *<[ptr]>; - struct tms *<[ptms]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/unlinkr.c b/newlib/libc/reent/unlinkr.c index 95b815f1b..53b8f11e3 100644 --- a/newlib/libc/reent/unlinkr.c +++ b/newlib/libc/reent/unlinkr.c @@ -27,16 +27,10 @@ FUNCTION INDEX _unlink_r -ANSI_SYNOPSIS +SYNOPSIS #include int _unlink_r(struct _reent *<[ptr]>, const char *<[file]>); -TRAD_SYNOPSIS - #include - int _unlink_r(<[ptr]>, <[file]>) - struct _reent *<[ptr]>; - char *<[file]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index 128f7f7ac..4190a9059 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -26,19 +26,11 @@ FUNCTION INDEX _write_r -ANSI_SYNOPSIS +SYNOPSIS #include _ssize_t _write_r(struct _reent *<[ptr]>, int <[fd]>, const void *<[buf]>, size_t <[cnt]>); -TRAD_SYNOPSIS - #include - _ssize_t _write_r(<[ptr]>, <[fd]>, <[buf]>, <[cnt]>) - struct _reent *<[ptr]>; - int <[fd]>; - char *<[buf]>; - size_t <[cnt]>; - DESCRIPTION This is a reentrant version of <>. It takes a pointer to the global data block, which holds From bf3a554bc65b563c437ee9b46c1b8b915e1a056b Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:41:48 -0600 Subject: [PATCH 153/649] search: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/search/bsearch.c | 10 +--------- newlib/libc/search/qsort.c | 10 +--------- newlib/libc/search/qsort_r.c | 11 +---------- 3 files changed, 3 insertions(+), 28 deletions(-) diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index d874e79ae..579633c12 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -20,20 +20,12 @@ FUNCTION INDEX bsearch -ANSI_SYNOPSIS +SYNOPSIS #include void *bsearch(const void *<[key]>, const void *<[base]>, size_t <[nmemb]>, size_t <[size]>, int (*<[compar]>)(const void *, const void *)); -TRAD_SYNOPSIS - #include - char *bsearch(<[key]>, <[base]>, <[nmemb]>, <[size]>, <[compar]>) - char *<[key]>; - char *<[base]>; - size_t <[nmemb]>, <[size]>; - int (*<[compar]>)(); - DESCRIPTION <> searches an array beginning at <[base]> for any element that matches <[key]>, using binary search. <[nmemb]> is the element diff --git a/newlib/libc/search/qsort.c b/newlib/libc/search/qsort.c index bf6285f5e..9a8e7fabe 100644 --- a/newlib/libc/search/qsort.c +++ b/newlib/libc/search/qsort.c @@ -5,19 +5,11 @@ FUNCTION INDEX qsort -ANSI_SYNOPSIS +SYNOPSIS #include void qsort(void *<[base]>, size_t <[nmemb]>, size_t <[size]>, int (*<[compar]>)(const void *, const void *) ); -TRAD_SYNOPSIS - #include - qsort(<[base]>, <[nmemb]>, <[size]>, <[compar]> ) - char *<[base]>; - size_t <[nmemb]>; - size_t <[size]>; - int (*<[compar]>)(); - DESCRIPTION <> sorts an array (beginning at <[base]>) of <[nmemb]> objects. <[size]> describes the size of each element of the array. diff --git a/newlib/libc/search/qsort_r.c b/newlib/libc/search/qsort_r.c index 9073061f0..c4b6fb7e2 100644 --- a/newlib/libc/search/qsort_r.c +++ b/newlib/libc/search/qsort_r.c @@ -5,7 +5,7 @@ FUNCTION INDEX qsort_r -ANSI_SYNOPSIS +SYNOPSIS #define _BSD_SOURCE #include void qsort_r(void *<[base]>, size_t <[nmemb]>, size_t <[size]>, @@ -18,15 +18,6 @@ ANSI_SYNOPSIS int (*<[compar]>)(const void *, const void *, void *), void *<[thunk]>); -TRAD_SYNOPSIS - #include - qsort_r(<[base]>, <[nmemb]>, <[size]>, <[compar]>, <[thumb]>) - char *<[base]>; - size_t <[nmemb]>; - size_t <[size]>; - int (*<[compar]>)(); - char *<[thumb]>; - DESCRIPTION <> sorts an array (beginning at <[base]>) of <[nmemb]> objects. <[size]> describes the size of each element of the array. From b88cfbc1e56810282303eb4edaa6d79a8c100643 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 01:43:14 -0600 Subject: [PATCH 154/649] signal: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/signal/psignal.c | 8 +------- newlib/libc/signal/raise.c | 11 +---------- newlib/libc/signal/signal.c | 13 +------------ 3 files changed, 3 insertions(+), 29 deletions(-) diff --git a/newlib/libc/signal/psignal.c b/newlib/libc/signal/psignal.c index 4638518da..f2cfdf3ff 100644 --- a/newlib/libc/signal/psignal.c +++ b/newlib/libc/signal/psignal.c @@ -6,16 +6,10 @@ FUNCTION INDEX psignal -ANSI_SYNOPSIS +SYNOPSIS #include void psignal(int <[signal]>, const char *<[prefix]>); -TRAD_SYNOPSIS - #include - void psignal(<[signal]>, <[prefix]>) - int <[signal]>; - const char *<[prefix]>; - DESCRIPTION Use <> to print (on standard error) a signal message corresponding to the value of the signal number <[signal]>. diff --git a/newlib/libc/signal/raise.c b/newlib/libc/signal/raise.c index bc47864e8..df3ebb50f 100644 --- a/newlib/libc/signal/raise.c +++ b/newlib/libc/signal/raise.c @@ -12,21 +12,12 @@ INDEX INDEX _raise_r -ANSI_SYNOPSIS +SYNOPSIS #include int raise(int <[sig]>); int _raise_r(void *<[reent]>, int <[sig]>); -TRAD_SYNOPSIS - #include - int raise(<[sig]>) - int <[sig]>; - - int _raise_r(<[reent]>, <[sig]>) - char *<[reent]>; - int <[sig]>; - DESCRIPTION Send the signal <[sig]> (one of the macros from `<>'). This interrupts your program's normal flow of execution, and allows a signal diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c index 183004725..5729f65e3 100644 --- a/newlib/libc/signal/signal.c +++ b/newlib/libc/signal/signal.c @@ -7,23 +7,12 @@ INDEX INDEX _signal_r -ANSI_SYNOPSIS +SYNOPSIS #include void (*signal(int <[sig]>, void(*<[func]>)(int))) (int); void (*_signal_r(void *<[reent]>, int <[sig]>, void(*<[func]>)(int))) (int); -TRAD_SYNOPSIS - #include - char ( * signal(<[sig]>, <[func]>) )() - int <[sig]>; - char ( * <[func]> )(); - - char ( * _signal_r(<[reent]>, <[sig]>, <[func]>) )() - char *<[reent]>; - int <[sig]>; - char ( * <[func]> )(); - DESCRIPTION <> provides a simple signal-handling implementation for embedded targets. From c7ef9668cff35d1d7b60c9881e786010177b4a22 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:05:02 -0600 Subject: [PATCH 155/649] stdio: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/stdio/clearerr.c | 12 +------ newlib/libc/stdio/diprintf.c | 2 +- newlib/libc/stdio/dprintf.c | 2 +- newlib/libc/stdio/fclose.c | 11 +----- newlib/libc/stdio/fcloseall.c | 9 +---- newlib/libc/stdio/fdopen.c | 13 +------ newlib/libc/stdio/feof.c | 12 +------ newlib/libc/stdio/ferror.c | 12 +------ newlib/libc/stdio/fflush.c | 2 +- newlib/libc/stdio/fgetc.c | 23 +----------- newlib/libc/stdio/fgetpos.c | 13 +------ newlib/libc/stdio/fgets.c | 30 +--------------- newlib/libc/stdio/fgetwc.c | 49 +------------------------ newlib/libc/stdio/fgetws.c | 30 +--------------- newlib/libc/stdio/fileno.c | 12 +------ newlib/libc/stdio/fmemopen.c | 2 +- newlib/libc/stdio/fopen.c | 13 +------ newlib/libc/stdio/fopencookie.c | 2 +- newlib/libc/stdio/fpurge.c | 2 +- newlib/libc/stdio/fputc.c | 26 +------------- newlib/libc/stdio/fputs.c | 26 +------------- newlib/libc/stdio/fputwc.c | 57 +----------------------------- newlib/libc/stdio/fputws.c | 26 +------------- newlib/libc/stdio/fread.c | 34 +----------------- newlib/libc/stdio/freopen.c | 15 +------- newlib/libc/stdio/fseek.c | 26 +------------- newlib/libc/stdio/fseeko.c | 26 +------------- newlib/libc/stdio/fsetlocking.c | 2 +- newlib/libc/stdio/fsetpos.c | 13 +------ newlib/libc/stdio/ftell.c | 18 +--------- newlib/libc/stdio/ftello.c | 18 +--------- newlib/libc/stdio/funopen.c | 2 +- newlib/libc/stdio/fwide.c | 13 +------ newlib/libc/stdio/fwrite.c | 34 +----------------- newlib/libc/stdio/getc.c | 12 +------ newlib/libc/stdio/getchar.c | 9 +---- newlib/libc/stdio/getdelim.c | 10 +----- newlib/libc/stdio/getline.c | 9 +---- newlib/libc/stdio/gets.c | 12 +------ newlib/libc/stdio/getw.c | 7 +--- newlib/libc/stdio/getwchar.c | 18 +--------- newlib/libc/stdio/mktemp.c | 2 +- newlib/libc/stdio/nano-vfprintf.c | 2 +- newlib/libc/stdio/nano-vfscanf.c | 36 +------------------ newlib/libc/stdio/open_memstream.c | 2 +- newlib/libc/stdio/perror.c | 11 +----- newlib/libc/stdio/putc.c | 14 +------- newlib/libc/stdio/putchar.c | 11 +----- newlib/libc/stdio/puts.c | 11 +----- newlib/libc/stdio/putw.c | 8 +---- newlib/libc/stdio/putwchar.c | 21 +---------- newlib/libc/stdio/remove.c | 11 +----- newlib/libc/stdio/rename.c | 8 +---- newlib/libc/stdio/rewind.c | 11 +----- newlib/libc/stdio/setbuf.c | 8 +---- newlib/libc/stdio/setbuffer.c | 9 +---- newlib/libc/stdio/setlinebuf.c | 7 +--- newlib/libc/stdio/setvbuf.c | 10 +----- newlib/libc/stdio/siprintf.c | 2 +- newlib/libc/stdio/siscanf.c | 32 +---------------- newlib/libc/stdio/sprintf.c | 2 +- newlib/libc/stdio/sscanf.c | 32 +---------------- newlib/libc/stdio/stdio_ext.c | 2 +- newlib/libc/stdio/swprintf.c | 2 +- newlib/libc/stdio/swscanf.c | 32 +---------------- newlib/libc/stdio/tmpfile.c | 9 +---- newlib/libc/stdio/tmpnam.c | 20 +---------- newlib/libc/stdio/ungetc.c | 2 +- newlib/libc/stdio/ungetwc.c | 2 +- newlib/libc/stdio/vfprintf.c | 2 +- newlib/libc/stdio/vfscanf.c | 36 +------------------ newlib/libc/stdio/vfwprintf.c | 2 +- newlib/libc/stdio/vfwscanf.c | 36 +------------------ newlib/libc/stdio/viprintf.c | 2 +- newlib/libc/stdio/viscanf.c | 36 +------------------ 75 files changed, 75 insertions(+), 1022 deletions(-) diff --git a/newlib/libc/stdio/clearerr.c b/newlib/libc/stdio/clearerr.c index 9bf0837f5..4174a7425 100644 --- a/newlib/libc/stdio/clearerr.c +++ b/newlib/libc/stdio/clearerr.c @@ -24,7 +24,7 @@ INDEX INDEX clearerr_unlocked -ANSI_SYNOPSIS +SYNOPSIS #include void clearerr(FILE *<[fp]>); @@ -32,16 +32,6 @@ ANSI_SYNOPSIS #include void clearerr_unlocked(FILE *<[fp]>); -TRAD_SYNOPSIS - #include - void clearerr(<[fp]>) - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - void clearerr_unlocked(<[fp]>) - FILE *<[fp]>; - DESCRIPTION The <> functions maintain an error indicator with each file pointer <[fp]>, to record whether any read or write errors have diff --git a/newlib/libc/stdio/diprintf.c b/newlib/libc/stdio/diprintf.c index e0a5595e1..fde6ea44c 100644 --- a/newlib/libc/stdio/diprintf.c +++ b/newlib/libc/stdio/diprintf.c @@ -16,7 +16,7 @@ INDEX INDEX _vdiprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int diprintf(int <[fd]>, const char *<[format]>, ...); diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c index 2925ceb31..7389eefaa 100644 --- a/newlib/libc/stdio/dprintf.c +++ b/newlib/libc/stdio/dprintf.c @@ -16,7 +16,7 @@ INDEX INDEX _vdprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int dprintf(int <[fd]>, const char *restrict <[format]>, ...); diff --git a/newlib/libc/stdio/fclose.c b/newlib/libc/stdio/fclose.c index 0ce112306..3325a8920 100644 --- a/newlib/libc/stdio/fclose.c +++ b/newlib/libc/stdio/fclose.c @@ -24,20 +24,11 @@ INDEX INDEX _fclose_r -ANSI_SYNOPSIS +SYNOPSIS #include int fclose(FILE *<[fp]>); int _fclose_r(struct _reent *<[reent]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int fclose(<[fp]>) - FILE *<[fp]>; - - int fclose(<[fp]>) - struct _reent *<[reent]> - FILE *<[fp]>; - DESCRIPTION If the file or stream identified by <[fp]> is open, <> closes it, after first ensuring that any pending data is written (by calling diff --git a/newlib/libc/stdio/fcloseall.c b/newlib/libc/stdio/fcloseall.c index 090f3f2c3..a578e8a00 100644 --- a/newlib/libc/stdio/fcloseall.c +++ b/newlib/libc/stdio/fcloseall.c @@ -24,18 +24,11 @@ INDEX INDEX _fcloseall_r -ANSI_SYNOPSIS +SYNOPSIS #include int fcloseall(void); int _fcloseall_r (struct _reent *<[ptr]>); -TRAD_SYNOPSIS - #include - int fcloseall() - - int _fcloseall_r (<[ptr]>) - struct _reent *<[ptr]>; - DESCRIPTION <> closes all files in the current reentrancy struct's domain. The function <<_fcloseall_r>> is the same function, except the reentrancy diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c index 77f599b65..e0268ed87 100644 --- a/newlib/libc/stdio/fdopen.c +++ b/newlib/libc/stdio/fdopen.c @@ -24,23 +24,12 @@ INDEX INDEX _fdopen_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *fdopen(int <[fd]>, const char *<[mode]>); FILE *_fdopen_r(struct _reent *<[reent]>, int <[fd]>, const char *<[mode]>); -TRAD_SYNOPSIS - #include - FILE *fdopen(<[fd]>, <[mode]>) - int <[fd]>; - char *<[mode]>; - - FILE *_fdopen_r(<[reent]>, <[fd]>, <[mode]>) - struct _reent *<[reent]>; - int <[fd]>; - char *<[mode]>); - DESCRIPTION <> produces a file descriptor of type <>, from a descriptor for an already-open file (returned, for example, by the diff --git a/newlib/libc/stdio/feof.c b/newlib/libc/stdio/feof.c index 7aadd8209..617ce58df 100644 --- a/newlib/libc/stdio/feof.c +++ b/newlib/libc/stdio/feof.c @@ -24,7 +24,7 @@ INDEX INDEX feof_unlocked -ANSI_SYNOPSIS +SYNOPSIS #include int feof(FILE *<[fp]>); @@ -32,16 +32,6 @@ ANSI_SYNOPSIS #include int feof_unlocked(FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int feof(<[fp]>) - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - int feof_unlocked(<[fp]>) - FILE *<[fp]>; - DESCRIPTION <> tests whether or not the end of the file identified by <[fp]> has been reached. diff --git a/newlib/libc/stdio/ferror.c b/newlib/libc/stdio/ferror.c index f93063d71..f99df2311 100644 --- a/newlib/libc/stdio/ferror.c +++ b/newlib/libc/stdio/ferror.c @@ -24,7 +24,7 @@ INDEX INDEX ferror_unlocked -ANSI_SYNOPSIS +SYNOPSIS #include int ferror(FILE *<[fp]>); @@ -32,16 +32,6 @@ ANSI_SYNOPSIS #include int ferror_unlocked(FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int ferror(<[fp]>) - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - int ferror_unlocked(<[fp]>) - FILE *<[fp]>; - DESCRIPTION The <> functions maintain an error indicator with each file pointer <[fp]>, to record whether any read or write errors have diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c index a4e639e72..199acbdc3 100644 --- a/newlib/libc/stdio/fflush.c +++ b/newlib/libc/stdio/fflush.c @@ -28,7 +28,7 @@ INDEX INDEX _fflush_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include int fflush(FILE *<[fp]>); diff --git a/newlib/libc/stdio/fgetc.c b/newlib/libc/stdio/fgetc.c index 34447a2c8..54322a069 100644 --- a/newlib/libc/stdio/fgetc.c +++ b/newlib/libc/stdio/fgetc.c @@ -28,7 +28,7 @@ INDEX INDEX _fgetc_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include int fgetc(FILE *<[fp]>); @@ -43,27 +43,6 @@ ANSI_SYNOPSIS #include int _fgetc_unlocked_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int fgetc(<[fp]>) - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - int fgetc_unlocked(<[fp]>) - FILE *<[fp]>; - - #include - int _fgetc_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - int _fgetc_unlocked_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION Use <> to get the next single character from the file or stream identified by <[fp]>. As a side effect, <> advances the file's diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c index 20dd1082c..3074526b4 100644 --- a/newlib/libc/stdio/fgetpos.c +++ b/newlib/libc/stdio/fgetpos.c @@ -24,22 +24,11 @@ INDEX INDEX _fgetpos_r -ANSI_SYNOPSIS +SYNOPSIS #include int fgetpos(FILE *restrict <[fp]>, fpos_t *restrict <[pos]>); int _fgetpos_r(struct _reent *<[ptr]>, FILE *restrict <[fp]>, fpos_t *restrict <[pos]>); -TRAD_SYNOPSIS - #include - int fgetpos(<[fp]>, <[pos]>) - FILE *<[fp]>; - fpos_t *<[pos]>; - - int _fgetpos_r(<[ptr]>, <[fp]>, <[pos]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - fpos_t *<[pos]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c index f7c8a0300..54097510d 100644 --- a/newlib/libc/stdio/fgets.c +++ b/newlib/libc/stdio/fgets.c @@ -28,7 +28,7 @@ INDEX INDEX _fgets_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include char *fgets(char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>); @@ -42,34 +42,6 @@ ANSI_SYNOPSIS #include char *_fgets_unlocked_r(struct _reent *<[ptr]>, char *restrict <[buf]>, int <[n]>, FILE *restrict <[fp]>); -TRAD_SYNOPSIS - #include - char *fgets(<[buf]>,<[n]>,<[fp]>) - char *<[buf]>; - int <[n]>; - FILE *<[fp]>; - - #define _GNU_SOURCE - #include - char *fgets_unlocked(<[buf]>,<[n]>,<[fp]>) - char *<[buf]>; - int <[n]>; - FILE *<[fp]>; - - #include - char *_fgets_r(<[ptr]>, <[buf]>,<[n]>,<[fp]>) - struct _reent *<[ptr]>; - char *<[buf]>; - int <[n]>; - FILE *<[fp]>; - - #include - char *_fgets_unlocked_r(<[ptr]>, <[buf]>,<[n]>,<[fp]>) - struct _reent *<[ptr]>; - char *<[buf]>; - int <[n]>; - FILE *<[fp]>; - DESCRIPTION Reads at most <[n-1]> characters from <[fp]> until a newline is found. The characters including to the newline are stored diff --git a/newlib/libc/stdio/fgetwc.c b/newlib/libc/stdio/fgetwc.c index d6de4b6cb..07731487d 100644 --- a/newlib/libc/stdio/fgetwc.c +++ b/newlib/libc/stdio/fgetwc.c @@ -45,7 +45,7 @@ INDEX INDEX _getwc_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include #include wint_t fgetwc(FILE *<[fp]>); @@ -80,53 +80,6 @@ ANSI_SYNOPSIS #include wint_t _getwc_unlocked_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - #include - wint_t fgetwc(<[fp]>) - FILE *<[fp]>; - - #define _GNU_SOURCE - #include - #include - wint_t fgetwc_unlocked(<[fp]>) - FILE *<[fp]>; - - #include - #include - wint_t _fgetwc_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - - #include - #include - wint_t _fgetwc_unlocked_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - - #include - #include - wint_t getwc(<[fp]>) - FILE *<[fp]>; - - #define _GNU_SOURCE - #include - #include - wint_t getwc_unlocked(<[fp]>) - FILE *<[fp]>; - - #include - #include - wint_t _getwc_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - - #include - #include - wint_t _getwc_unlocked_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION Use <> to get the next wide character from the file or stream identified by <[fp]>. As a side effect, <> advances the file's diff --git a/newlib/libc/stdio/fgetws.c b/newlib/libc/stdio/fgetws.c index ae1f48e66..3dbf3ef74 100644 --- a/newlib/libc/stdio/fgetws.c +++ b/newlib/libc/stdio/fgetws.c @@ -37,7 +37,7 @@ INDEX INDEX _fgetws_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *fgetws(wchar_t *__restrict <[ws]>, int <[n]>, FILE *__restrict <[fp]>); @@ -55,34 +55,6 @@ ANSI_SYNOPSIS wchar_t *_fgetws_unlocked_r(struct _reent *<[ptr]>, wchar_t *<[ws]>, int <[n]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - wchar_t *fgetws(<[ws]>,<[n]>,<[fp]>) - wchar_t *__restrict <[ws]>; - int <[n]>; - FILE *__restrict <[fp]>; - - #define _GNU_SOURCE - #include - wchar_t *fgetws_unlocked(<[ws]>,<[n]>,<[fp]>) - wchar_t *__restrict <[ws]>; - int <[n]>; - FILE *__restrict <[fp]>; - - #include - wchar_t *_fgetws_r(<[ptr]>, <[ws]>,<[n]>,<[fp]>) - struct _reent *<[ptr]>; - wchar_t *<[ws]>; - int <[n]>; - FILE *<[fp]>; - - #include - wchar_t *_fgetws_unlocked_r(<[ptr]>, <[ws]>,<[n]>,<[fp]>) - struct _reent *<[ptr]>; - wchar_t *<[ws]>; - int <[n]>; - FILE *<[fp]>; - DESCRIPTION Reads at most <[n-1]> wide characters from <[fp]> until a newline is found. The wide characters including to the newline are stored diff --git a/newlib/libc/stdio/fileno.c b/newlib/libc/stdio/fileno.c index 7b505827d..949a381f8 100644 --- a/newlib/libc/stdio/fileno.c +++ b/newlib/libc/stdio/fileno.c @@ -24,7 +24,7 @@ INDEX INDEX fileno_unlocked -ANSI_SYNOPSIS +SYNOPSIS #include int fileno(FILE *<[fp]>); @@ -32,16 +32,6 @@ ANSI_SYNOPSIS #include int fileno_unlocked(FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int fileno(<[fp]>) - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - int fileno_unlocked(<[fp]>) - FILE *<[fp]>; - DESCRIPTION You can use <> to return the file descriptor identified by <[fp]>. diff --git a/newlib/libc/stdio/fmemopen.c b/newlib/libc/stdio/fmemopen.c index 17a3c9b5c..520ba1b80 100644 --- a/newlib/libc/stdio/fmemopen.c +++ b/newlib/libc/stdio/fmemopen.c @@ -10,7 +10,7 @@ FUNCTION INDEX fmemopen -ANSI_SYNOPSIS +SYNOPSIS #include FILE *fmemopen(void *restrict <[buf]>, size_t <[size]>, const char *restrict <[mode]>); diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c index 6d07561a3..2551befed 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -24,24 +24,13 @@ INDEX INDEX _fopen_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *fopen(const char *<[file]>, const char *<[mode]>); FILE *_fopen_r(struct _reent *<[reent]>, const char *<[file]>, const char *<[mode]>); -TRAD_SYNOPSIS - #include - FILE *fopen(<[file]>, <[mode]>) - char *<[file]>; - char *<[mode]>; - - FILE *_fopen_r(<[reent]>, <[file]>, <[mode]>) - struct _reent *<[reent]>; - char *<[file]>; - char *<[mode]>; - DESCRIPTION <> initializes the data structures needed to read or write a file. Specify the file's name as the string at <[file]>, and the kind diff --git a/newlib/libc/stdio/fopencookie.c b/newlib/libc/stdio/fopencookie.c index 3697b48d7..eb9861392 100644 --- a/newlib/libc/stdio/fopencookie.c +++ b/newlib/libc/stdio/fopencookie.c @@ -10,7 +10,7 @@ FUNCTION INDEX fopencookie -ANSI_SYNOPSIS +SYNOPSIS #include FILE *fopencookie(const void *<[cookie]>, const char *<[mode]>, cookie_io_functions_t <[functions]>); diff --git a/newlib/libc/stdio/fpurge.c b/newlib/libc/stdio/fpurge.c index dc052e85b..de621feb6 100644 --- a/newlib/libc/stdio/fpurge.c +++ b/newlib/libc/stdio/fpurge.c @@ -14,7 +14,7 @@ INDEX INDEX __fpurge -ANSI_SYNOPSIS +SYNOPSIS #include int fpurge(FILE *<[fp]>); diff --git a/newlib/libc/stdio/fputc.c b/newlib/libc/stdio/fputc.c index 0aad0a9f7..f9273d6ae 100644 --- a/newlib/libc/stdio/fputc.c +++ b/newlib/libc/stdio/fputc.c @@ -28,7 +28,7 @@ INDEX INDEX _fputc_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include int fputc(int <[ch]>, FILE *<[fp]>); @@ -42,30 +42,6 @@ ANSI_SYNOPSIS #include int _fputc_unlocked_r(struct _rent *<[ptr]>, int <[ch]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int fputc(<[ch]>, <[fp]>) - int <[ch]>; - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - int fputc_unlocked(<[ch]>, <[fp]>) - int <[ch]>; - FILE *<[fp]>; - - #include - int _fputc_r(<[ptr]>, <[ch]>, <[fp]>) - struct _reent *<[ptr]>; - int <[ch]>; - FILE *<[fp]>; - - #include - int _fputc_unlocked_r(<[ptr]>, <[ch]>, <[fp]>) - struct _reent *<[ptr]>; - int <[ch]>; - FILE *<[fp]>; - DESCRIPTION <> converts the argument <[ch]> from an <> to an <>, then writes it to the file or stream identified by diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c index 75f65d96e..c4588265b 100644 --- a/newlib/libc/stdio/fputs.c +++ b/newlib/libc/stdio/fputs.c @@ -28,7 +28,7 @@ INDEX INDEX _fputs_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include int fputs(const char *restrict <[s]>, FILE *restrict <[fp]>); @@ -42,30 +42,6 @@ ANSI_SYNOPSIS #include int _fputs_unlocked_r(struct _reent *<[ptr]>, const char *restrict <[s]>, FILE *restrict <[fp]>); -TRAD_SYNOPSIS - #include - int fputs(<[s]>, <[fp]>) - char *<[s]>; - FILE *<[fp]>; - - #define _GNU_SOURCE - #include - int fputs_unlocked(<[s]>, <[fp]>) - char *<[s]>; - FILE *<[fp]>; - - #include - int _fputs_r(<[ptr]>, <[s]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[s]>; - FILE *<[fp]>; - - #include - int _fputs_unlocked_r(<[ptr]>, <[s]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[s]>; - FILE *<[fp]>; - DESCRIPTION <> writes the string at <[s]> (but without the trailing null) to the file or stream identified by <[fp]>. diff --git a/newlib/libc/stdio/fputwc.c b/newlib/libc/stdio/fputwc.c index 9c2ef6c3b..5e2a9e322 100644 --- a/newlib/libc/stdio/fputwc.c +++ b/newlib/libc/stdio/fputwc.c @@ -45,7 +45,7 @@ INDEX INDEX _putwc_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include #include wint_t fputwc(wchar_t <[wc]>, FILE *<[fp]>); @@ -80,61 +80,6 @@ ANSI_SYNOPSIS #include wint_t _putwc_unlocked_r(struct _reent *<[ptr]>, wchar_t <[wc]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - #include - wint_t fputwc(<[wc]>, <[fp]>) - wchar_t <[wc]>; - FILE *<[fp]>; - - #define _GNU_SOURCE - #include - #include - wint_t fputwc_unlocked(<[wc]>, <[fp]>) - wchar_t <[wc]>; - FILE *<[fp]>; - - #include - #include - wint_t _fputwc_r(<[ptr]>, <[wc]>, <[fp]>) - struct _reent *<[ptr]>; - wchar_t <[wc]>; - FILE *<[fp]>; - - #include - #include - wint_t _fputwc_unlocked_r(<[ptr]>, <[wc]>, <[fp]>) - struct _reent *<[ptr]>; - wchar_t <[wc]>; - FILE *<[fp]>; - - #include - #include - wint_t putwc(<[wc]>, <[fp]>) - wchar_t <[wc]>; - FILE *<[fp]>; - - #define _GNU_SOURCE - #include - #include - wint_t putwc_unlocked(<[wc]>, <[fp]>) - wchar_t <[wc]>; - FILE *<[fp]>; - - #include - #include - wint_t _putwc_r(<[ptr]>, <[wc]>, <[fp]>) - struct _reent *<[ptr]>; - wchar_t <[wc]>; - FILE *<[fp]>; - - #include - #include - wint_t _putwc_unlocked_r(<[ptr]>, <[wc]>, <[fp]>) - struct _reent *<[ptr]>; - wchar_t <[wc]>; - FILE *<[fp]>; - DESCRIPTION <> writes the wide character argument <[wc]> to the file or stream identified by <[fp]>. diff --git a/newlib/libc/stdio/fputws.c b/newlib/libc/stdio/fputws.c index bb2fa6dbe..c68241c92 100644 --- a/newlib/libc/stdio/fputws.c +++ b/newlib/libc/stdio/fputws.c @@ -37,7 +37,7 @@ INDEX INDEX _fputws_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include int fputws(const wchar_t *__restrict <[ws]>, FILE *__restrict <[fp]>); @@ -53,30 +53,6 @@ ANSI_SYNOPSIS int _fputws_unlocked_r(struct _reent *<[ptr]>, const wchar_t *<[ws]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int fputws(<[ws]>, <[fp]>) - wchar_t *__restrict <[ws]>; - FILE *__restrict <[fp]>; - - #define _GNU_SOURCE - #include - int fputws_unlocked(<[ws]>, <[fp]>) - wchar_t *__restrict <[ws]>; - FILE *__restrict <[fp]>; - - #include - int _fputws_r(<[ptr]>, <[ws]>, <[fp]>) - struct _reent *<[ptr]>; - wchar_t *<[ws]>; - FILE *<[fp]>; - - #include - int _fputws_unlocked_r(<[ptr]>, <[ws]>, <[fp]>) - struct _reent *<[ptr]>; - wchar_t *<[ws]>; - FILE *<[fp]>; - DESCRIPTION <> writes the wide character string at <[ws]> (but without the trailing null) to the file or stream identified by <[fp]>. diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index c6839476d..c2e60bedc 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -28,7 +28,7 @@ INDEX INDEX _fread_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include size_t fread(void *restrict <[buf]>, size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>); @@ -46,38 +46,6 @@ ANSI_SYNOPSIS size_t _fread_unlocked_r(struct _reent *<[ptr]>, void *restrict <[buf]>, size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>); -TRAD_SYNOPSIS - #include - size_t fread(<[buf]>, <[size]>, <[count]>, <[fp]>) - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - size_t fread_unlocked(<[buf]>, <[size]>, <[count]>, <[fp]>) - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - - #include - size_t _fread_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - - #include - size_t _fread_unlocked_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - DESCRIPTION <> attempts to copy, from the file or stream identified by <[fp]>, <[count]> elements (each of size <[size]>) into memory, diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c index fb1f6c4db..e5bb73a26 100644 --- a/newlib/libc/stdio/freopen.c +++ b/newlib/libc/stdio/freopen.c @@ -24,26 +24,13 @@ INDEX INDEX _freopen_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *freopen(const char *restrict <[file]>, const char *restrict <[mode]>, FILE *restrict <[fp]>); FILE *_freopen_r(struct _reent *<[ptr]>, const char *restrict <[file]>, const char *restrict <[mode]>, FILE *restrict <[fp]>); -TRAD_SYNOPSIS - #include - FILE *freopen(<[file]>, <[mode]>, <[fp]>) - char *<[file]>; - char *<[mode]>; - FILE *<[fp]>; - - FILE *_freopen_r(<[ptr]>, <[file]>, <[mode]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[file]>; - char *<[mode]>; - FILE *<[fp]>; - DESCRIPTION Use this variant of <> if you wish to specify a particular file descriptor <[fp]> (notably <>, <>, or <>) for diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c index b8fc36a04..b5bd979d3 100644 --- a/newlib/libc/stdio/fseek.c +++ b/newlib/libc/stdio/fseek.c @@ -28,7 +28,7 @@ INDEX INDEX _fseeko_r -ANSI_SYNOPSIS +SYNOPSIS #include int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>); int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>); @@ -37,30 +37,6 @@ ANSI_SYNOPSIS int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>, off_t <[offset]>, int <[whence]>); -TRAD_SYNOPSIS - #include - int fseek(<[fp]>, <[offset]>, <[whence]>); - FILE *<[fp]>; - long <[offset]>; - int <[whence]>; - - int fseeko(<[fp]>, <[offset]>, <[whence]>); - FILE *<[fp]>; - off_t <[offset]>; - int <[whence]>; - - int _fseek_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>); - struct _reent *<[ptr]>; - FILE *<[fp]>; - long <[offset]>; - int <[whence]>; - - int _fseeko_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>); - struct _reent *<[ptr]>; - FILE *<[fp]>; - off_t <[offset]>; - int <[whence]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c index 2c9419d97..52f978929 100644 --- a/newlib/libc/stdio/fseeko.c +++ b/newlib/libc/stdio/fseeko.c @@ -28,7 +28,7 @@ INDEX INDEX _fseeko_r -ANSI_SYNOPSIS +SYNOPSIS #include int fseek(FILE *<[fp]>, long <[offset]>, int <[whence]>) int fseeko(FILE *<[fp]>, off_t <[offset]>, int <[whence]>) @@ -37,30 +37,6 @@ ANSI_SYNOPSIS int _fseeko_r(struct _reent *<[ptr]>, FILE *<[fp]>, off_t <[offset]>, int <[whence]>) -TRAD_SYNOPSIS - #include - int fseek(<[fp]>, <[offset]>, <[whence]>) - FILE *<[fp]>; - long <[offset]>; - int <[whence]>; - - int fseeko(<[fp]>, <[offset]>, <[whence]>) - FILE *<[fp]>; - off_t <[offset]>; - int <[whence]>; - - int _fseek_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - long <[offset]>; - int <[whence]>; - - int _fseeko_r(<[ptr]>, <[fp]>, <[offset]>, <[whence]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - off_t <[offset]>; - int <[whence]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio/fsetlocking.c b/newlib/libc/stdio/fsetlocking.c index 3c489f54d..d62aef334 100644 --- a/newlib/libc/stdio/fsetlocking.c +++ b/newlib/libc/stdio/fsetlocking.c @@ -30,7 +30,7 @@ FUNCTION INDEX __fsetlocking -ANSI_SYNOPSIS +SYNOPSIS #include #include int __fsetlocking(FILE *<[fp]>, int <[type]>); diff --git a/newlib/libc/stdio/fsetpos.c b/newlib/libc/stdio/fsetpos.c index d1596293b..a2a5d7b2e 100644 --- a/newlib/libc/stdio/fsetpos.c +++ b/newlib/libc/stdio/fsetpos.c @@ -24,23 +24,12 @@ INDEX INDEX _fsetpos_r -ANSI_SYNOPSIS +SYNOPSIS #include int fsetpos(FILE *<[fp]>, const fpos_t *<[pos]>); int _fsetpos_r(struct _reent *<[ptr]>, FILE *<[fp]>, const fpos_t *<[pos]>); -TRAD_SYNOPSIS - #include - int fsetpos(<[fp]>, <[pos]>) - FILE *<[fp]>; - fpos_t *<[pos]>; - - int _fsetpos_r(<[ptr]>, <[fp]>, <[pos]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - fpos_t *<[pos]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c index 5af0709cb..70eed84c0 100644 --- a/newlib/libc/stdio/ftell.c +++ b/newlib/libc/stdio/ftell.c @@ -28,29 +28,13 @@ INDEX INDEX _ftello_r -ANSI_SYNOPSIS +SYNOPSIS #include long ftell(FILE *<[fp]>); off_t ftello(FILE *<[fp]>); long _ftell_r(struct _reent *<[ptr]>, FILE *<[fp]>); off_t _ftello_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - long ftell(<[fp]>) - FILE *<[fp]>; - - off_t ftello(<[fp]>) - FILE *<[fp]>; - - long _ftell_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - - off_t _ftello_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c index 3a1885e81..c120c26a9 100644 --- a/newlib/libc/stdio/ftello.c +++ b/newlib/libc/stdio/ftello.c @@ -28,29 +28,13 @@ INDEX INDEX _ftello_r -ANSI_SYNOPSIS +SYNOPSIS #include long ftell(FILE *<[fp]>); off_t ftello(FILE *<[fp]>); long _ftell_r(struct _reent *<[ptr]>, FILE *<[fp]>); off_t _ftello_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - long ftell(<[fp]>) - FILE *<[fp]>; - - off_t ftello(<[fp]>) - FILE *<[fp]>; - - long _ftell_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - - off_t _ftello_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio/funopen.c b/newlib/libc/stdio/funopen.c index e71d23187..58b75648a 100644 --- a/newlib/libc/stdio/funopen.c +++ b/newlib/libc/stdio/funopen.c @@ -14,7 +14,7 @@ INDEX INDEX fwopen -ANSI_SYNOPSIS +SYNOPSIS #include FILE *funopen(const void *<[cookie]>, int (*<[readfn]>) (void *cookie, char *buf, int n), diff --git a/newlib/libc/stdio/fwide.c b/newlib/libc/stdio/fwide.c index b2aaf8a62..a57a77c95 100644 --- a/newlib/libc/stdio/fwide.c +++ b/newlib/libc/stdio/fwide.c @@ -7,23 +7,12 @@ INDEX INDEX _fwide_r -ANSI_SYNOPSIS +SYNOPSIS #include int fwide(FILE *<[fp]>, int <[mode]>); int _fwide_r(struct _reent *<[ptr]>, FILE *<[fp]>, int <[mode]>); -TRAD_SYNOPSIS - #include - int fwide(<[fp]>, <[mode]>); - FILE *<[fp]>; - int <[mode]>; - - int _fwide_r(<[ptr]>, <[fp]>, <[mode]>); - struct _reent *<[ptr]>; - FILE *<[fp]>; - int <[mode]>; - DESCRIPTION When <[mode]> is zero, the <> function determines the current orientation of <[fp]>. It returns a value > 0 if <[fp]> is diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c index 6b3ff9015..2ba71f38a 100644 --- a/newlib/libc/stdio/fwrite.c +++ b/newlib/libc/stdio/fwrite.c @@ -28,7 +28,7 @@ INDEX INDEX _fwrite_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include size_t fwrite(const void *restrict <[buf]>, size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>); @@ -46,38 +46,6 @@ ANSI_SYNOPSIS size_t _fwrite_unlocked_r(struct _reent *<[ptr]>, const void *restrict <[buf]>, size_t <[size]>, size_t <[count]>, FILE *restrict <[fp]>); -TRAD_SYNOPSIS - #include - size_t fwrite(<[buf]>, <[size]>, <[count]>, <[fp]>) - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - - #define _BSD_SOURCE - #include - size_t fwrite_unlocked(<[buf]>, <[size]>, <[count]>, <[fp]>) - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - - #include - size_t _fwrite_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - - #include - size_t _fwrite_unlocked_r(<[ptr]>, <[buf]>, <[size]>, <[count]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[buf]>; - size_t <[size]>; - size_t <[count]>; - FILE *<[fp]>; - DESCRIPTION <> attempts to copy, starting from the memory location <[buf]>, <[count]> elements (each of size <[size]>) into the file or diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c index 7951cdc93..37e345870 100644 --- a/newlib/libc/stdio/getc.c +++ b/newlib/libc/stdio/getc.c @@ -24,23 +24,13 @@ INDEX INDEX _getc_r -ANSI_SYNOPSIS +SYNOPSIS #include int getc(FILE *<[fp]>); #include int _getc_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int getc(<[fp]>) - FILE *<[fp]>; - - #include - int _getc_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION <> is a macro, defined in <>. You can use <> to get the next single character from the file or stream diff --git a/newlib/libc/stdio/getchar.c b/newlib/libc/stdio/getchar.c index 7f3ceac62..07ba9e64f 100644 --- a/newlib/libc/stdio/getchar.c +++ b/newlib/libc/stdio/getchar.c @@ -24,19 +24,12 @@ INDEX INDEX _getchar_r -ANSI_SYNOPSIS +SYNOPSIS #include int getchar(void); int _getchar_r(struct _reent *<[reent]>); -TRAD_SYNOPSIS - #include - int getchar(); - - int _getchar_r(<[reent]>) - char * <[reent]>; - DESCRIPTION <> is a macro, defined in <>. You can use <> to get the next single character from the standard input stream. diff --git a/newlib/libc/stdio/getdelim.c b/newlib/libc/stdio/getdelim.c index 63a579a79..d806c02cf 100644 --- a/newlib/libc/stdio/getdelim.c +++ b/newlib/libc/stdio/getdelim.c @@ -6,19 +6,11 @@ FUNCTION INDEX getdelim -ANSI_SYNOPSIS +SYNOPSIS #include int getdelim(char **<[bufptr]>, size_t *<[n]>, int <[delim]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int getdelim(<[bufptr]>, <[n]>, <[delim]>, <[fp]>) - char **<[bufptr]>; - size_t *<[n]>; - int <[delim]>; - FILE *<[fp]>; - DESCRIPTION <> reads a file <[fp]> up to and possibly including a specified delimiter <[delim]>. The line is read into a buffer pointed to diff --git a/newlib/libc/stdio/getline.c b/newlib/libc/stdio/getline.c index c758ae964..66ffd1990 100644 --- a/newlib/libc/stdio/getline.c +++ b/newlib/libc/stdio/getline.c @@ -6,17 +6,10 @@ FUNCTION INDEX getline -ANSI_SYNOPSIS +SYNOPSIS #include ssize_t getline(char **<[bufptr]>, size_t *<[n]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - ssize_t getline(<[bufptr]>, <[n]>, <[fp]>) - char **<[bufptr]>; - size_t *<[n]>; - FILE *<[fp]>; - DESCRIPTION <> reads a file <[fp]> up to and possibly including the newline character. The line is read into a buffer pointed to diff --git a/newlib/libc/stdio/gets.c b/newlib/libc/stdio/gets.c index 6c21f3e0c..a78d06b89 100644 --- a/newlib/libc/stdio/gets.c +++ b/newlib/libc/stdio/gets.c @@ -24,23 +24,13 @@ INDEX INDEX _gets_r -ANSI_SYNOPSIS +SYNOPSIS #include char *gets(char *<[buf]>); char *_gets_r(struct _reent *<[reent]>, char *<[buf]>); -TRAD_SYNOPSIS - #include - - char *gets(<[buf]>) - char *<[buf]>; - - char *_gets_r(<[reent]>, <[buf]>) - struct _reent *<[reent]>; - char *<[buf]>; - DESCRIPTION Reads characters from standard input until a newline is found. The characters up to the newline are stored in <[buf]>. The diff --git a/newlib/libc/stdio/getw.c b/newlib/libc/stdio/getw.c index 210c5939a..4585d9f37 100644 --- a/newlib/libc/stdio/getw.c +++ b/newlib/libc/stdio/getw.c @@ -22,15 +22,10 @@ FUNCTION INDEX getw -ANSI_SYNOPSIS +SYNOPSIS #include int getw(FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int getw(<[fp]>) - FILE *<[fp]>; - DESCRIPTION <> is a function, defined in <>. You can use <> to get the next word from the file or stream identified by <[fp]>. As diff --git a/newlib/libc/stdio/getwchar.c b/newlib/libc/stdio/getwchar.c index 7ab230a4c..61031e5a6 100644 --- a/newlib/libc/stdio/getwchar.c +++ b/newlib/libc/stdio/getwchar.c @@ -37,7 +37,7 @@ INDEX INDEX _getwchar_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include wint_t getwchar(void); @@ -51,22 +51,6 @@ ANSI_SYNOPSIS #include wint_t _getwchar_unlocked_r(struct _reent *<[reent]>); -TRAD_SYNOPSIS - #include - wint_t getwchar(); - - #define _GNU_SOURCE - #include - wint_t getwchar_unlocked(); - - #include - wint_t _getwchar_r(<[reent]>) - char * <[reent]>; - - #include - wint_t _getwchar_unlocked_r(<[reent]>) - char * <[reent]>; - DESCRIPTION <> function or macro is the wide character equivalent of the <> function. You can use <> to get the next diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c index ecbc7afea..3ece9ab2c 100644 --- a/newlib/libc/stdio/mktemp.c +++ b/newlib/libc/stdio/mktemp.c @@ -52,7 +52,7 @@ INDEX INDEX _mkostemps_r -ANSI_SYNOPSIS +SYNOPSIS #include char *mktemp(char *<[path]>); char *mkdtemp(char *<[path]>); diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index f106a4167..e6604e771 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -87,7 +87,7 @@ INDEX INDEX _vasnprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int vprintf(const char *<[fmt]>, va_list <[list]>); diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index 5ba00f797..564f2916d 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -60,7 +60,7 @@ INDEX INDEX _vsscanf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int vscanf(const char *<[fmt]>, va_list <[list]>); @@ -74,40 +74,6 @@ ANSI_SYNOPSIS int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>, const char *<[fmt]>, va_list <[list]>); -TRAD_SYNOPSIS - #include - #include - int vscanf( <[fmt]>, <[ist]>) - char *<[fmt]>; - va_list <[list]>; - - int vfscanf( <[fp]>, <[fmt]>, <[list]>) - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int vsscanf( <[str]>, <[fmt]>, <[list]>) - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - - int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>) - struct _reent *<[reent]>; - char *<[fmt]>; - va_list <[list]>; - - int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - DESCRIPTION <>, <>, and <> are (respectively) variants of <>, <>, and <>. They differ only in diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c index 5de99474d..9e6736f77 100644 --- a/newlib/libc/stdio/open_memstream.c +++ b/newlib/libc/stdio/open_memstream.c @@ -12,7 +12,7 @@ INDEX INDEX open_wmemstream -ANSI_SYNOPSIS +SYNOPSIS #include FILE *open_memstream(char **restrict <[buf]>, size_t *restrict <[size]>); diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c index 14b4d2173..0f0259632 100644 --- a/newlib/libc/stdio/perror.c +++ b/newlib/libc/stdio/perror.c @@ -24,21 +24,12 @@ INDEX INDEX _perror_r -ANSI_SYNOPSIS +SYNOPSIS #include void perror(char *<[prefix]>); void _perror_r(struct _reent *<[reent]>, char *<[prefix]>); -TRAD_SYNOPSIS - #include - void perror(<[prefix]>) - char *<[prefix]>; - - void _perror_r(<[reent]>, <[prefix]>) - struct _reent *<[reent]>; - char *<[prefix]>; - DESCRIPTION Use <> to print (on standard error) an error message corresponding to the current value of the global variable <>. diff --git a/newlib/libc/stdio/putc.c b/newlib/libc/stdio/putc.c index 2b1fd1bf3..a00aaad08 100644 --- a/newlib/libc/stdio/putc.c +++ b/newlib/libc/stdio/putc.c @@ -24,25 +24,13 @@ INDEX INDEX _putc_r -ANSI_SYNOPSIS +SYNOPSIS #include int putc(int <[ch]>, FILE *<[fp]>); #include int _putc_r(struct _reent *<[ptr]>, int <[ch]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int putc(<[ch]>, <[fp]>) - int <[ch]>; - FILE *<[fp]>; - - #include - int _putc_r(<[ptr]>, <[ch]>, <[fp]>) - struct _reent *<[ptr]>; - int <[ch]>; - FILE *<[fp]>; - DESCRIPTION <> is a macro, defined in <>. <> writes the argument <[ch]> to the file or stream identified by diff --git a/newlib/libc/stdio/putchar.c b/newlib/libc/stdio/putchar.c index bb27dc4e6..a4b669832 100644 --- a/newlib/libc/stdio/putchar.c +++ b/newlib/libc/stdio/putchar.c @@ -24,21 +24,12 @@ INDEX INDEX _putchar_r -ANSI_SYNOPSIS +SYNOPSIS #include int putchar(int <[ch]>); int _putchar_r(struct _reent *<[reent]>, int <[ch]>); -TRAD_SYNOPSIS - #include - int putchar(<[ch]>) - int <[ch]>; - - int _putchar_r(<[reent]>, <[ch]>) - struct _reent *<[reent]>; - int <[ch]>; - DESCRIPTION <> is a macro, defined in <>. <> writes its argument to the standard output stream, diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c index 74673715f..72f929eea 100644 --- a/newlib/libc/stdio/puts.c +++ b/newlib/libc/stdio/puts.c @@ -24,21 +24,12 @@ INDEX INDEX _puts_r -ANSI_SYNOPSIS +SYNOPSIS #include int puts(const char *<[s]>); int _puts_r(struct _reent *<[reent]>, const char *<[s]>); -TRAD_SYNOPSIS - #include - int puts(<[s]>) - char *<[s]>; - - int _puts_r(<[reent]>, <[s]>) - struct _reent *<[reent]>; - char *<[s]>; - DESCRIPTION <> writes the string at <[s]> (followed by a newline, instead of the trailing null) to the standard output stream. diff --git a/newlib/libc/stdio/putw.c b/newlib/libc/stdio/putw.c index 682015c0a..d4f785814 100644 --- a/newlib/libc/stdio/putw.c +++ b/newlib/libc/stdio/putw.c @@ -22,16 +22,10 @@ FUNCTION INDEX putw -ANSI_SYNOPSIS +SYNOPSIS #include int putw(int <[w]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - int putw(, <[fp]>) - int ; - FILE *<[fp]>; - DESCRIPTION <> is a function, defined in <>. You can use <> to write a word to the file or stream identified by <[fp]>. As a side diff --git a/newlib/libc/stdio/putwchar.c b/newlib/libc/stdio/putwchar.c index cdd254217..248d5922d 100644 --- a/newlib/libc/stdio/putwchar.c +++ b/newlib/libc/stdio/putwchar.c @@ -37,7 +37,7 @@ INDEX INDEX _putwchar_unlocked_r -ANSI_SYNOPSIS +SYNOPSIS #include wint_t putwchar(wchar_t <[wc]>); @@ -50,25 +50,6 @@ ANSI_SYNOPSIS #include wint_t _putwchar_unlocked_r(struct _reent *<[reent]>, wchar_t <[wc]>); -TRAD_SYNOPSIS - #include - wint_t putwchar(<[wc]>) - wchar_t <[wc]>; - - #include - wint_t putwchar_unlocked(<[wc]>) - wchar_t <[wc]>; - - #include - wint_t _putwchar_r(<[reent]>, <[wc]>) - struct _reent *<[reent]>; - wchar_t <[wc]>; - - #include - wint_t _putwchar_unlocked_r(<[reent]>, <[wc]>) - struct _reent *<[reent]>; - wchar_t <[wc]>; - DESCRIPTION The <> function or macro is the wide-character equivalent of the <> function. It writes the wide character wc to stdout. diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c index 5a3e16be9..7b8d3060f 100644 --- a/newlib/libc/stdio/remove.c +++ b/newlib/libc/stdio/remove.c @@ -24,21 +24,12 @@ INDEX INDEX _remove_r -ANSI_SYNOPSIS +SYNOPSIS #include int remove(char *<[filename]>); int _remove_r(struct _reent *<[reent]>, char *<[filename]>); -TRAD_SYNOPSIS - #include - int remove(<[filename]>) - char *<[filename]>; - - int _remove_r(<[reent]>, <[filename]>) - struct _reent *<[reent]>; - char *<[filename]>; - DESCRIPTION Use <> to dissolve the association between a particular filename (the string at <[filename]>) and the file it represents. diff --git a/newlib/libc/stdio/rename.c b/newlib/libc/stdio/rename.c index 6eb1f7d19..1b807f8b2 100644 --- a/newlib/libc/stdio/rename.c +++ b/newlib/libc/stdio/rename.c @@ -22,16 +22,10 @@ FUNCTION INDEX rename -ANSI_SYNOPSIS +SYNOPSIS #include int rename(const char *<[old]>, const char *<[new]>); -TRAD_SYNOPSIS - #include - int rename(<[old]>, <[new]>) - char *<[old]>; - char *<[new]>; - DESCRIPTION Use <> to establish a new name (the string at <[new]>) for a file now known by the string at <[old]>. After a successful diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c index fb03e5be7..417a5963d 100644 --- a/newlib/libc/stdio/rewind.c +++ b/newlib/libc/stdio/rewind.c @@ -24,20 +24,11 @@ INDEX INDEX _rewind_r -ANSI_SYNOPSIS +SYNOPSIS #include void rewind(FILE *<[fp]>); void _rewind_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - void rewind(<[fp]>) - FILE *<[fp]>; - - void _rewind_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION <> returns the file position indicator (if any) for the file or stream identified by <[fp]> to the beginning of the file. It also diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c index cffb6fbf4..29f5377a7 100644 --- a/newlib/libc/stdio/setbuf.c +++ b/newlib/libc/stdio/setbuf.c @@ -22,16 +22,10 @@ FUNCTION INDEX setbuf -ANSI_SYNOPSIS +SYNOPSIS #include void setbuf(FILE *<[fp]>, char *<[buf]>); -TRAD_SYNOPSIS - #include - void setbuf(<[fp]>, <[buf]>) - FILE *<[fp]>; - char *<[buf]>; - DESCRIPTION <> specifies that output to the file or stream identified by <[fp]> should be fully buffered. All output for this file will go to a diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c index e88187446..880779d13 100644 --- a/newlib/libc/stdio/setbuffer.c +++ b/newlib/libc/stdio/setbuffer.c @@ -27,17 +27,10 @@ FUNCTION INDEX setbuffer -ANSI_SYNOPSIS +SYNOPSIS #include void setbuffer(FILE *<[fp]>, char *<[buf]>, int <[size]>); -TRAD_SYNOPSIS - #include - void setbuffer(<[fp]>, <[buf]>, <[size]>) - FILE *<[fp]>; - char *<[buf]>; - int <[size]>; - DESCRIPTION <> specifies that output to the file or stream identified by <[fp]> should be fully buffered. All output for this file will go to a diff --git a/newlib/libc/stdio/setlinebuf.c b/newlib/libc/stdio/setlinebuf.c index 0df6a579a..d8cb013d9 100644 --- a/newlib/libc/stdio/setlinebuf.c +++ b/newlib/libc/stdio/setlinebuf.c @@ -27,15 +27,10 @@ FUNCTION INDEX setlinebuf -ANSI_SYNOPSIS +SYNOPSIS #include void setlinebuf(FILE *<[fp]>); -TRAD_SYNOPSIS - #include - void setlinebuf(<[fp]>) - FILE *<[fp]>; - DESCRIPTION <> specifies that output to the file or stream identified by <[fp]> should be line buffered. This causes the file or stream to pass diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c index a8e46a5d0..6fa0252b0 100644 --- a/newlib/libc/stdio/setvbuf.c +++ b/newlib/libc/stdio/setvbuf.c @@ -22,19 +22,11 @@ FUNCTION INDEX setvbuf -ANSI_SYNOPSIS +SYNOPSIS #include int setvbuf(FILE *<[fp]>, char *<[buf]>, int <[mode]>, size_t <[size]>); -TRAD_SYNOPSIS - #include - int setvbuf(<[fp]>, <[buf]>, <[mode]>, <[size]>) - FILE *<[fp]>; - char *<[buf]>; - int <[mode]>; - size_t <[size]>; - DESCRIPTION Use <> to specify what kind of buffering you want for the file or stream identified by <[fp]>, by using one of the following diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index f0a80980c..d9559c359 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -44,7 +44,7 @@ INDEX INDEX _asniprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include int iprintf(const char *<[format]>, ...); diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c index a6a812670..c89eb7c8d 100644 --- a/newlib/libc/stdio/siscanf.c +++ b/newlib/libc/stdio/siscanf.c @@ -32,7 +32,7 @@ INDEX INDEX _siscanf_r -ANSI_SYNOPSIS +SYNOPSIS #include int iscanf(const char *<[format]>, ...); @@ -45,36 +45,6 @@ ANSI_SYNOPSIS int _siscanf_r(struct _reent *<[ptr]>, const char *<[str]>, const char *<[format]>, ...); - -TRAD_SYNOPSIS - #include - - int iscanf(<[format]> [, <[arg]>, ...]) - char *<[format]>; - - int fiscanf(<[fd]>, <[format]> [, <[arg]>, ...]); - FILE *<[fd]>; - char *<[format]>; - - int siscanf(<[str]>, <[format]> [, <[arg]>, ...]); - char *<[str]>; - char *<[format]>; - - int _iscanf_r(<[ptr]>, <[format]> [, <[arg]>, ...]) - struct _reent *<[ptr]>; - char *<[format]>; - - int _fiscanf_r(<[ptr]>, <[fd]>, <[format]> [, <[arg]>, ...]); - struct _reent *<[ptr]>; - FILE *<[fd]>; - char *<[format]>; - - int _siscanf_r(<[ptr]>, <[str]>, <[format]> [, <[arg]>, ...]); - struct _reent *<[ptr]>; - char *<[str]>; - char *<[format]>; - - DESCRIPTION <>, <>, and <> are the same as <>, <>, and <> respectively, only that diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index d74c6f891..7fc9e6821 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -44,7 +44,7 @@ INDEX INDEX _asnprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include int printf(const char *restrict <[format]>, ...); diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index 7961294e7..d2d9dfe8b 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -32,7 +32,7 @@ INDEX INDEX _sscanf_r -ANSI_SYNOPSIS +SYNOPSIS #include int scanf(const char *restrict <[format]>, ...); @@ -45,36 +45,6 @@ ANSI_SYNOPSIS int _sscanf_r(struct _reent *<[ptr]>, const char *restrict <[str]>, const char *restrict <[format]>, ...); - -TRAD_SYNOPSIS - #include - - int scanf(<[format]> [, <[arg]>, ...]) - char *<[format]>; - - int fscanf(<[fd]>, <[format]> [, <[arg]>, ...]); - FILE *<[fd]>; - char *<[format]>; - - int sscanf(<[str]>, <[format]> [, <[arg]>, ...]); - char *<[str]>; - char *<[format]>; - - int _scanf_r(<[ptr]>, <[format]> [, <[arg]>, ...]) - struct _reent *<[ptr]>; - char *<[format]>; - - int _fscanf_r(<[ptr]>, <[fd]>, <[format]> [, <[arg]>, ...]); - struct _reent *<[ptr]>; - FILE *<[fd]>; - char *<[format]>; - - int _sscanf_r(<[ptr]>, <[str]>, <[format]> [, <[arg]>, ...]); - struct _reent *<[ptr]>; - char *<[str]>; - char *<[format]>; - - DESCRIPTION <> scans a series of input fields from standard input, one character at a time. Each field is interpreted according to diff --git a/newlib/libc/stdio/stdio_ext.c b/newlib/libc/stdio/stdio_ext.c index 588209d18..98f2ccaa9 100644 --- a/newlib/libc/stdio/stdio_ext.c +++ b/newlib/libc/stdio/stdio_ext.c @@ -17,7 +17,7 @@ INDEX INDEX __fwriting -ANSI_SYNOPSIS +SYNOPSIS #include #include size_t __fbufsize(FILE *<[fp]>); diff --git a/newlib/libc/stdio/swprintf.c b/newlib/libc/stdio/swprintf.c index 2233b3ba7..fe106f036 100644 --- a/newlib/libc/stdio/swprintf.c +++ b/newlib/libc/stdio/swprintf.c @@ -32,7 +32,7 @@ INDEX INDEX _swprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include int wprintf(const wchar_t *<[format]>, ...); diff --git a/newlib/libc/stdio/swscanf.c b/newlib/libc/stdio/swscanf.c index 6a469ac31..d52d826e3 100644 --- a/newlib/libc/stdio/swscanf.c +++ b/newlib/libc/stdio/swscanf.c @@ -32,7 +32,7 @@ INDEX INDEX _swscanf_r -ANSI_SYNOPSIS +SYNOPSIS #include int wscanf(const wchar_t *__restrict <[format]>, ...); @@ -47,36 +47,6 @@ ANSI_SYNOPSIS int _swscanf_r(struct _reent *<[ptr]>, const wchar_t *<[str]>, const wchar_t *<[format]>, ...); - -TRAD_SYNOPSIS - #include - - int wscanf(<[format]> [, <[arg]>, ...]) - wchar_t *__restrict <[format]>; - - int fwscanf(<[fd]>, <[format]> [, <[arg]>, ...]); - FILE *<[fd]>; - wchar_t *<[format]>; - - int swscanf(<[str]>, <[format]> [, <[arg]>, ...]); - wchar_t *__restrict <[str]>; - wchar_t *__restrict <[format]>; - - int _wscanf_r(<[ptr]>, <[format]> [, <[arg]>, ...]) - struct _reent *<[ptr]>; - wchar_t *<[format]>; - - int _fwscanf_r(<[ptr]>, <[fd]>, <[format]> [, <[arg]>, ...]); - struct _reent *<[ptr]>; - FILE *<[fd]>; - wchar_t *<[format]>; - - int _swscanf_r(<[ptr]>, <[str]>, <[format]> [, <[arg]>, ...]); - struct _reent *<[ptr]>; - wchar_t *<[str]>; - wchar_t *<[format]>; - - DESCRIPTION <> scans a series of input fields from standard input, one wide character at a time. Each field is interpreted according to diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c index eca4ec735..6145ad0bc 100644 --- a/newlib/libc/stdio/tmpfile.c +++ b/newlib/libc/stdio/tmpfile.c @@ -7,19 +7,12 @@ INDEX INDEX _tmpfile_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *tmpfile(void); FILE *_tmpfile_r(struct _reent *<[reent]>); -TRAD_SYNOPSIS - #include - FILE *tmpfile(); - - FILE *_tmpfile_r(<[reent]>) - struct _reent *<[reent]>; - DESCRIPTION Create a temporary file (a file which will be deleted automatically), using a name generated by <>. The temporary file is opened with diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c index ee722e630..765d27afd 100644 --- a/newlib/libc/stdio/tmpnam.c +++ b/newlib/libc/stdio/tmpnam.c @@ -15,31 +15,13 @@ INDEX INDEX _tempnam_r -ANSI_SYNOPSIS +SYNOPSIS #include char *tmpnam(char *<[s]>); char *tempnam(char *<[dir]>, char *<[pfx]>); char *_tmpnam_r(struct _reent *<[reent]>, char *<[s]>); char *_tempnam_r(struct _reent *<[reent]>, char *<[dir]>, char *<[pfx]>); -TRAD_SYNOPSIS - #include - char *tmpnam(<[s]>) - char *<[s]>; - - char *tempnam(<[dir]>, <[pfx]>) - char *<[dir]>; - char *<[pfx]>; - - char *_tmpnam_r(<[reent]>, <[s]>) - struct _reent *<[reent]>; - char *<[s]>; - - char *_tempnam_r(<[reent]>, <[dir]>, <[pfx]>) - struct *<[reent]>; - char *<[dir]>; - char *<[pfx]>; - DESCRIPTION Use either of these functions to generate a name for a temporary file. The generated name is guaranteed to avoid collision with other files diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c index e385ce8fb..da4b19d3c 100644 --- a/newlib/libc/stdio/ungetc.c +++ b/newlib/libc/stdio/ungetc.c @@ -23,7 +23,7 @@ INDEX INDEX _ungetc_r -ANSI_SYNOPSIS +SYNOPSIS #include int ungetc(int <[c]>, FILE *<[stream]>); diff --git a/newlib/libc/stdio/ungetwc.c b/newlib/libc/stdio/ungetwc.c index a69449eb2..000d4bdbb 100644 --- a/newlib/libc/stdio/ungetwc.c +++ b/newlib/libc/stdio/ungetwc.c @@ -33,7 +33,7 @@ INDEX INDEX _ungetwc_r -ANSI_SYNOPSIS +SYNOPSIS #include #include wint_t ungetwc(wint_t <[wc]>, FILE *<[stream]>); diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 3585423af..50a3478a4 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -63,7 +63,7 @@ INDEX INDEX _vasnprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int vprintf(const char *<[fmt]>, va_list <[list]>); diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 2d5940567..23d73916a 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -32,7 +32,7 @@ INDEX INDEX _vsscanf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int vscanf(const char *<[fmt]>, va_list <[list]>); @@ -46,40 +46,6 @@ ANSI_SYNOPSIS int _vsscanf_r(struct _reent *<[reent]>, const char *<[str]>, const char *<[fmt]>, va_list <[list]>); -TRAD_SYNOPSIS - #include - #include - int vscanf( <[fmt]>, <[ist]>) - char *<[fmt]>; - va_list <[list]>; - - int vfscanf( <[fp]>, <[fmt]>, <[list]>) - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int vsscanf( <[str]>, <[fmt]>, <[list]>) - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - - int _vscanf_r( <[reent]>, <[fmt]>, <[ist]>) - struct _reent *<[reent]>; - char *<[fmt]>; - va_list <[list]>; - - int _vfscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int _vsscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - DESCRIPTION <>, <>, and <> are (respectively) variants of <>, <>, and <>. They differ only in diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index 4786ed6a9..9c421d267 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -47,7 +47,7 @@ INDEX INDEX _vswprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include #include diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index e2b63c54c..46c156694 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -32,7 +32,7 @@ INDEX INDEX _vswscanf -ANSI_SYNOPSIS +SYNOPSIS #include #include int vwscanf(const wchar_t *__restrict <[fmt]>, va_list <[list]>); @@ -48,40 +48,6 @@ ANSI_SYNOPSIS int _vswscanf(struct _reent *<[reent]>, const wchar_t *<[str]>, const wchar_t *<[fmt]>, va_list <[list]>); -TRAD_SYNOPSIS - #include - #include - int vwscanf( <[fmt]>, <[ist]>) - wchar_t *__restrict <[fmt]>; - va_list <[list]>; - - int vfwscanf( <[fp]>, <[fmt]>, <[list]>) - FILE *__restrict <[fp]>; - wchar_t *__restrict <[fmt]>; - va_list <[list]>; - - int vswscanf( <[str]>, <[fmt]>, <[list]>) - wchar_t *__restrict <[str]>; - wchar_t *__restrict <[fmt]>; - va_list <[list]>; - - int _vwscanf( <[reent]>, <[fmt]>, <[ist]>) - struct _reent *<[reent]>; - wchar_t *<[fmt]>; - va_list <[list]>; - - int _vfwscanf( <[reent]>, <[fp]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - FILE *<[fp]>; - wchar_t *<[fmt]>; - va_list <[list]>; - - int _vswscanf( <[reent]>, <[str]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - wchar_t *<[str]>; - wchar_t *<[fmt]>; - va_list <[list]>; - DESCRIPTION <>, <>, and <> are (respectively) variants of <>, <>, and <>. They differ only in diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c index fec92fa8a..85ae286bb 100644 --- a/newlib/libc/stdio/viprintf.c +++ b/newlib/libc/stdio/viprintf.c @@ -44,7 +44,7 @@ INDEX INDEX _vasniprintf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int viprintf(const char *<[fmt]>, va_list <[list]>); diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c index 9a7d0c5f2..379daa232 100644 --- a/newlib/libc/stdio/viscanf.c +++ b/newlib/libc/stdio/viscanf.c @@ -34,7 +34,7 @@ INDEX INDEX _vsiscanf_r -ANSI_SYNOPSIS +SYNOPSIS #include #include int viscanf(const char *<[fmt]>, va_list <[list]>); @@ -48,40 +48,6 @@ ANSI_SYNOPSIS int _vsiscanf_r(struct _reent *<[reent]>, const char *<[str]>, const char *<[fmt]>, va_list <[list]>); -TRAD_SYNOPSIS - #include - #include - int viscanf( <[fmt]>, <[ist]>) - char *<[fmt]>; - va_list <[list]>; - - int vfiscanf( <[fp]>, <[fmt]>, <[list]>) - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int vsiscanf( <[str]>, <[fmt]>, <[list]>) - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - - int _viscanf_r( <[reent]>, <[fmt]>, <[ist]>) - struct _reent *<[reent]>; - char *<[fmt]>; - va_list <[list]>; - - int _vfiscanf_r( <[reent]>, <[fp]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - FILE *<[fp]>; - char *<[fmt]>; - va_list <[list]>; - - int _vsiscanf_r( <[reent]>, <[str]>, <[fmt]>, <[list]>) - struct _reent *<[reent]>; - char *<[str]>; - char *<[fmt]>; - va_list <[list]>; - DESCRIPTION <>, <>, and <> are (respectively) variants of <>, <>, and <>. They differ only in From a60026253d244fd722ef153625defe16c4504010 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:06:47 -0600 Subject: [PATCH 156/649] stdio64: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/stdio64/fgetpos64.c | 12 +----------- newlib/libc/stdio64/fopen64.c | 13 +------------ newlib/libc/stdio64/freopen64.c | 15 +-------------- newlib/libc/stdio64/fseeko64.c | 15 +-------------- newlib/libc/stdio64/fsetpos64.c | 13 +------------ newlib/libc/stdio64/ftello64.c | 11 +---------- newlib/libc/stdio64/tmpfile64.c | 9 +-------- 7 files changed, 7 insertions(+), 81 deletions(-) diff --git a/newlib/libc/stdio64/fgetpos64.c b/newlib/libc/stdio64/fgetpos64.c index 36f7ec90b..a1d0a3724 100644 --- a/newlib/libc/stdio64/fgetpos64.c +++ b/newlib/libc/stdio64/fgetpos64.c @@ -7,22 +7,12 @@ INDEX INDEX _fgetpos64_r -ANSI_SYNOPSIS +SYNOPSIS #include int fgetpos64(FILE *<[fp]>, _fpos64_t *<[pos]>); int _fgetpos64_r(struct _reent *<[ptr]>, FILE *<[fp]>, _fpos64_t *<[pos]>); -TRAD_SYNOPSIS - #include - int fgetpos64(<[fp]>, <[pos]>) - FILE *<[fp]>; - _fpos64_t *<[pos]>; - - int _fgetpos64_r(<[ptr]>, <[fp]>, <[pos]>) - FILE *<[fp]>; - _fpos64_t *<[pos]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c index 84f7b6e49..60ac73fda 100644 --- a/newlib/libc/stdio64/fopen64.c +++ b/newlib/libc/stdio64/fopen64.c @@ -24,23 +24,12 @@ INDEX INDEX _fopen64_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *fopen64(const char *<[file]>, const char *<[mode]>); FILE *_fopen64_r(void *<[reent]>, const char *<[file]>, const char *<[mode]>); -TRAD_SYNOPSIS - #include - FILE *fopen64(<[file]>, <[mode]>) - char *<[file]>; - char *<[mode]>; - - FILE *_fopen64_r(<[reent]>, <[file]>, <[mode]>) - char *<[reent]>; - char *<[file]>; - char *<[mode]>; - DESCRIPTION <> is identical to <> except it opens a large file that is potentially >2GB in size. See <> for further details. diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c index f7df35407..379462c31 100644 --- a/newlib/libc/stdio64/freopen64.c +++ b/newlib/libc/stdio64/freopen64.c @@ -24,26 +24,13 @@ INDEX INDEX _freopen64_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *freopen64(const char *<[file]>, const char *<[mode]>, FILE *<[fp]>); FILE *_freopen64_r(struct _reent *<[ptr]>, const char *<[file]>, const char *<[mode]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - FILE *freopen64(<[file]>, <[mode]>, <[fp]>) - char *<[file]>; - char *<[mode]>; - FILE *<[fp]>; - - FILE *_freopen64_r(<[ptr]>, <[file]>, <[mode]>, <[fp]>) - struct _reent *<[ptr]>; - char *<[file]>; - char *<[mode]>; - FILE *<[fp]>; - DESCRIPTION Use this variant of <> if you wish to specify a particular file descriptor <[fp]> (notably <>, <>, or <>) for diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c index 34eee6783..624e91275 100644 --- a/newlib/libc/stdio64/fseeko64.c +++ b/newlib/libc/stdio64/fseeko64.c @@ -24,24 +24,11 @@ INDEX INDEX _fseeko64_r -ANSI_SYNOPSIS +SYNOPSIS #include int fseeko64(FILE *<[fp]>, _off64_t <[offset]>, int <[whence]>); int _fseeko64_r (struct _reent *<[ptr]>, FILE *<[fp]>, _off64_t <[offset]>, int <[whence]>); -TRAD_SYNOPSIS - #include - - int fseeko64(<[fp]>, <[offset]>, <[whence]>); - FILE *<[fp]>; - _off64_t <[offset]>; - int <[whence]>; - - int _fseeko64_r (<[ptr]>, <[fp]>, <[offset]>, <[whence]>); - struct _reent *<[ptr]>; - FILE *<[fp]>; - _off64_t <[offset]>; - int <[whence]>; DESCRIPTION Objects of type <> can have a ``position'' that records how much diff --git a/newlib/libc/stdio64/fsetpos64.c b/newlib/libc/stdio64/fsetpos64.c index 046990d7a..83d99627d 100644 --- a/newlib/libc/stdio64/fsetpos64.c +++ b/newlib/libc/stdio64/fsetpos64.c @@ -7,23 +7,12 @@ INDEX INDEX _fsetpos64_r -ANSI_SYNOPSIS +SYNOPSIS #include int fsetpos64(FILE *<[fp]>, const _fpos64_t *<[pos]>); int _fsetpos64_r(struct _reent *<[ptr]>, FILE *<[fp]>, const _fpos64_t *<[pos]>); -TRAD_SYNOPSIS - #include - int fsetpos64(<[fp]>, <[pos]>) - FILE *<[fp]>; - _fpos64_t *<[pos]>; - - int _fsetpos64_r(<[ptr]>, <[fp]>, <[pos]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - _fpos64_t *<[pos]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c index c4d6da24b..c6226d105 100644 --- a/newlib/libc/stdio64/ftello64.c +++ b/newlib/libc/stdio64/ftello64.c @@ -24,20 +24,11 @@ INDEX INDEX _ftello64_r -ANSI_SYNOPSIS +SYNOPSIS #include _off64_t ftello64(FILE *<[fp]>); _off64_t _ftello64_r(struct _reent *<[ptr]>, FILE *<[fp]>); -TRAD_SYNOPSIS - #include - _off64_t ftello64(<[fp]>) - FILE *<[fp]>; - - _off64_t _ftello64_r(<[ptr]>, <[fp]>) - struct _reent *<[ptr]>; - FILE *<[fp]>; - DESCRIPTION Objects of type <> can have a ``position'' that records how much of the file your program has already read. Many of the <> functions diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c index 98a7d7817..d58aa1472 100644 --- a/newlib/libc/stdio64/tmpfile64.c +++ b/newlib/libc/stdio64/tmpfile64.c @@ -7,19 +7,12 @@ INDEX INDEX _tmpfile64_r -ANSI_SYNOPSIS +SYNOPSIS #include FILE *tmpfile64(void); FILE *_tmpfile64_r(void *<[reent]>); -TRAD_SYNOPSIS - #include - FILE *tmpfile64(); - - FILE *_tmpfile64_r(<[reent]>) - char *<[reent]>; - DESCRIPTION Create a large temporary file (a file which will be deleted automatically), using a name generated by <>. The temporary file is opened with From a38fc79ee9f7ccef78adf91aba8f5ae374803dfe Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:17:18 -0600 Subject: [PATCH 157/649] stdlib: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/stdlib/_Exit.c | 7 +---- newlib/libc/stdlib/a64l.c | 10 +------ newlib/libc/stdlib/abort.c | 6 +--- newlib/libc/stdlib/abs.c | 7 +---- newlib/libc/stdlib/assert.c | 2 +- newlib/libc/stdlib/atexit.c | 7 +---- newlib/libc/stdlib/atof.c | 10 +------ newlib/libc/stdlib/atoi.c | 19 +----------- newlib/libc/stdlib/atoll.c | 11 +------ newlib/libc/stdlib/calloc.c | 14 +-------- newlib/libc/stdlib/div.c | 7 +---- newlib/libc/stdlib/ecvtbuf.c | 19 +----------- newlib/libc/stdlib/efgcvt.c | 41 ++------------------------ newlib/libc/stdlib/envlock.c | 9 +----- newlib/libc/stdlib/exit.c | 7 +---- newlib/libc/stdlib/getenv.c | 7 +---- newlib/libc/stdlib/getenv_r.c | 8 +---- newlib/libc/stdlib/itoa.c | 2 +- newlib/libc/stdlib/labs.c | 7 +---- newlib/libc/stdlib/ldiv.c | 7 +---- newlib/libc/stdlib/llabs.c | 7 +---- newlib/libc/stdlib/lldiv.c | 7 +---- newlib/libc/stdlib/malloc.c | 52 +-------------------------------- newlib/libc/stdlib/mblen.c | 8 +---- newlib/libc/stdlib/mblen_r.c | 10 +------ newlib/libc/stdlib/mbsnrtowcs.c | 35 +--------------------- newlib/libc/stdlib/mbstowcs.c | 9 +----- newlib/libc/stdlib/mbtowc.c | 9 +----- newlib/libc/stdlib/mlock.c | 9 +----- newlib/libc/stdlib/mstats.c | 23 +-------------- newlib/libc/stdlib/on_exit.c | 8 +---- newlib/libc/stdlib/rand.c | 13 +-------- newlib/libc/stdlib/rand48.c | 28 +----------------- newlib/libc/stdlib/random.c | 2 +- newlib/libc/stdlib/rpmatch.c | 7 +---- newlib/libc/stdlib/strtod.c | 17 +---------- newlib/libc/stdlib/strtol.c | 15 +--------- newlib/libc/stdlib/strtoll.c | 15 +--------- newlib/libc/stdlib/strtoul.c | 15 +--------- newlib/libc/stdlib/strtoull.c | 15 +--------- newlib/libc/stdlib/system.c | 11 +------ newlib/libc/stdlib/utoa.c | 2 +- newlib/libc/stdlib/wcsnrtombs.c | 35 +--------------------- newlib/libc/stdlib/wcstod.c | 22 +------------- newlib/libc/stdlib/wcstol.c | 15 +--------- newlib/libc/stdlib/wcstoll.c | 15 +--------- newlib/libc/stdlib/wcstombs.c | 9 +----- newlib/libc/stdlib/wcstoul.c | 15 +--------- newlib/libc/stdlib/wcstoull.c | 15 +--------- newlib/libc/stdlib/wctomb.c | 8 +---- 50 files changed, 51 insertions(+), 607 deletions(-) diff --git a/newlib/libc/stdlib/_Exit.c b/newlib/libc/stdlib/_Exit.c index 3f189a21f..b07559acb 100644 --- a/newlib/libc/stdlib/_Exit.c +++ b/newlib/libc/stdlib/_Exit.c @@ -5,15 +5,10 @@ FUNCTION INDEX _Exit -ANSI_SYNOPSIS +SYNOPSIS #include void _Exit(int <[code]>); -TRAD_SYNOPSIS - #include - void _Exit(<[code]>) - int <[code]>; - DESCRIPTION Use <<_Exit>> to return control from a program to the host operating environment. Use the argument <[code]> to pass an exit status to the diff --git a/newlib/libc/stdlib/a64l.c b/newlib/libc/stdlib/a64l.c index ee3d40d49..8d68ed0e9 100644 --- a/newlib/libc/stdlib/a64l.c +++ b/newlib/libc/stdlib/a64l.c @@ -7,19 +7,11 @@ INDEX INDEX l64a -ANSI_SYNOPSIS +SYNOPSIS #include long a64l(const char *<[input]>); char *l64a(long <[input]>); -TRAD_SYNOPSIS - #include - long a64l(<[input]>) - const char *<[input]>; - - char *l64a(<[input]>) - long <[input]>; - DESCRIPTION Conversion is performed between long and radix-64 characters. The <> routine transforms up to 32 bits of input value starting from diff --git a/newlib/libc/stdlib/abort.c b/newlib/libc/stdlib/abort.c index 93f7c2f42..febc07a31 100644 --- a/newlib/libc/stdlib/abort.c +++ b/newlib/libc/stdlib/abort.c @@ -15,14 +15,10 @@ FUNCTION INDEX abort -ANSI_SYNOPSIS +SYNOPSIS #include void abort(void); -TRAD_SYNOPSIS - #include - void abort(); - DESCRIPTION Use <> to signal that your program has detected a condition it cannot deal with. Normally, <> ends your program's execution. diff --git a/newlib/libc/stdlib/abs.c b/newlib/libc/stdlib/abs.c index 0308b5729..d347265fa 100644 --- a/newlib/libc/stdlib/abs.c +++ b/newlib/libc/stdlib/abs.c @@ -5,15 +5,10 @@ FUNCTION INDEX abs -ANSI_SYNOPSIS +SYNOPSIS #include int abs(int <[i]>); -TRAD_SYNOPSIS - #include - int abs(<[i]>) - int <[i]>; - DESCRIPTION <> returns @tex diff --git a/newlib/libc/stdlib/assert.c b/newlib/libc/stdlib/assert.c index 135bf1519..a6218746c 100644 --- a/newlib/libc/stdlib/assert.c +++ b/newlib/libc/stdlib/assert.c @@ -5,7 +5,7 @@ FUNCTION INDEX assert -ANSI_SYNOPSIS +SYNOPSIS #include void assert(int <[expression]>); diff --git a/newlib/libc/stdlib/atexit.c b/newlib/libc/stdlib/atexit.c index fa91deb03..78180895c 100644 --- a/newlib/libc/stdlib/atexit.c +++ b/newlib/libc/stdlib/atexit.c @@ -12,15 +12,10 @@ FUNCTION INDEX atexit -ANSI_SYNOPSIS +SYNOPSIS #include int atexit (void (*<[function]>)(void)); -TRAD_SYNOPSIS - #include - int atexit ((<[function]>) - void (*<[function]>)(); - DESCRIPTION You can use <> to enroll functions in a list of functions that will be called when your program terminates normally. The argument is diff --git a/newlib/libc/stdlib/atof.c b/newlib/libc/stdlib/atof.c index 8497f6807..4653d4f93 100644 --- a/newlib/libc/stdlib/atof.c +++ b/newlib/libc/stdlib/atof.c @@ -7,19 +7,11 @@ INDEX INDEX atoff -ANSI_SYNOPSIS +SYNOPSIS #include double atof(const char *<[s]>); float atoff(const char *<[s]>); -TRAD_SYNOPSIS - #include - double atof(<[s]>) - char *<[s]>; - - float atoff(<[s]>) - char *<[s]>; - DESCRIPTION <> converts the initial portion of a string to a <>. <> converts the initial portion of a string to a <>. diff --git a/newlib/libc/stdlib/atoi.c b/newlib/libc/stdlib/atoi.c index 6156eda4d..ac3b39a0e 100644 --- a/newlib/libc/stdlib/atoi.c +++ b/newlib/libc/stdlib/atoi.c @@ -11,30 +11,13 @@ INDEX INDEX _atol_r -ANSI_SYNOPSIS +SYNOPSIS #include int atoi(const char *<[s]>); long atol(const char *<[s]>); int _atoi_r(struct _reent *<[ptr]>, const char *<[s]>); long _atol_r(struct _reent *<[ptr]>, const char *<[s]>); -TRAD_SYNOPSIS - #include - int atoi(<[s]>) - char *<[s]>; - - long atol(<[s]>) - char *<[s]>; - - int _atoi_r(<[ptr]>, <[s]>) - struct _reent *<[ptr]>; - char *<[s]>; - - long _atol_r(<[ptr]>, <[s]>) - struct _reent *<[ptr]>; - char *<[s]>; - - DESCRIPTION <> converts the initial portion of a string to an <>. <> converts the initial portion of a string to a <>. diff --git a/newlib/libc/stdlib/atoll.c b/newlib/libc/stdlib/atoll.c index a6abd9595..9d8a64a9c 100644 --- a/newlib/libc/stdlib/atoll.c +++ b/newlib/libc/stdlib/atoll.c @@ -7,20 +7,11 @@ INDEX INDEX _atoll_r -ANSI_SYNOPSIS +SYNOPSIS #include long long atoll(const char *<[str]>); long long _atoll_r(struct _reent *<[ptr]>, const char *<[str]>); -TRAD_SYNOPSIS - #include - long long atoll(<[str]>) - const char *<[str]>; - - long long _atoll_r(<[ptr]>, <[str]>) - struct _reent *<[ptr]>; - const char *<[str]>; - DESCRIPTION The function <> converts the initial portion of the string pointed to by <<*<[str]>>> to a type <>. A call to diff --git a/newlib/libc/stdlib/calloc.c b/newlib/libc/stdlib/calloc.c index 4415c6591..3a723783b 100644 --- a/newlib/libc/stdlib/calloc.c +++ b/newlib/libc/stdlib/calloc.c @@ -11,22 +11,10 @@ INDEX INDEX _calloc_r -ANSI_SYNOPSIS +SYNOPSIS #include void *calloc(size_t <[n]>, size_t <[s]>); void *_calloc_r(void *<[reent]>, size_t <[n]>, size_t <[s]>); - -TRAD_SYNOPSIS - #include - char *calloc(<[n]>, <[s]>) - size_t <[n]>, <[s]>; - - char *_calloc_r(<[reent]>, <[n]>, <[s]>) - char *<[reent]>; - size_t <[n]>; - size_t <[s]>; - - DESCRIPTION Use <> to request a block of memory sufficient to hold an diff --git a/newlib/libc/stdlib/div.c b/newlib/libc/stdlib/div.c index 816c3fb3c..a780a2d3a 100644 --- a/newlib/libc/stdlib/div.c +++ b/newlib/libc/stdlib/div.c @@ -5,15 +5,10 @@ FUNCTION INDEX div -ANSI_SYNOPSIS +SYNOPSIS #include div_t div(int <[n]>, int <[d]>); -TRAD_SYNOPSIS - #include - div_t div(<[n]>, <[d]>) - int <[n]>, <[d]>; - DESCRIPTION Divide @tex diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c index feaa33fd0..ee58c9a9a 100644 --- a/newlib/libc/stdlib/ecvtbuf.c +++ b/newlib/libc/stdlib/ecvtbuf.c @@ -7,7 +7,7 @@ INDEX INDEX fcvtbuf -ANSI_SYNOPSIS +SYNOPSIS #include char *ecvtbuf(double <[val]>, int <[chars]>, int *<[decpt]>, @@ -16,23 +16,6 @@ ANSI_SYNOPSIS char *fcvtbuf(double <[val]>, int <[decimals]>, int *<[decpt]>, int *<[sgn]>, char *<[buf]>); -TRAD_SYNOPSIS - #include - - char *ecvtbuf(<[val]>, <[chars]>, <[decpt]>, <[sgn]>, <[buf]>); - double <[val]>; - int <[chars]>; - int *<[decpt]>; - int *<[sgn]>; - char *<[buf]>; - - char *fcvtbuf(<[val]>, <[decimals]>, <[decpt]>, <[sgn]>, <[buf]>); - double <[val]>; - int <[decimals]>; - int *<[decpt]>; - int *<[sgn]>; - char *<[buf]>; - DESCRIPTION <> and <> produce (null-terminated) strings of digits representating the <> number <[val]>. diff --git a/newlib/libc/stdlib/efgcvt.c b/newlib/libc/stdlib/efgcvt.c index b7d9812f6..ae6424559 100644 --- a/newlib/libc/stdlib/efgcvt.c +++ b/newlib/libc/stdlib/efgcvt.c @@ -11,7 +11,7 @@ INDEX INDEX fcvtf -ANSI_SYNOPSIS +SYNOPSIS #include char *ecvt(double <[val]>, int <[chars]>, int *<[decpt]>, int *<[sgn]>); @@ -22,31 +22,6 @@ ANSI_SYNOPSIS char *fcvtf(float <[val]>, int <[decimals]>, int *<[decpt]>, int *<[sgn]>); -TRAD_SYNOPSIS - #include - - char *ecvt(<[val]>, <[chars]>, <[decpt]>, <[sgn]>); - double <[val]>; - int <[chars]>; - int *<[decpt]>; - int *<[sgn]>; - char *ecvtf(<[val]>, <[chars]>, <[decpt]>, <[sgn]>); - float <[val]>; - int <[chars]>; - int *<[decpt]>; - int *<[sgn]>; - - char *fcvt(<[val]>, <[decimals]>, <[decpt]>, <[sgn]>); - double <[val]>; - int <[decimals]>; - int *<[decpt]>; - int *<[sgn]>; - char *fcvtf(<[val]>, <[decimals]>, <[decpt]>, <[sgn]>); - float <[val]>; - int <[decimals]>; - int *<[decpt]>; - int *<[sgn]>; - DESCRIPTION <> and <> produce (null-terminated) strings of digits representating the <> number <[val]>. @@ -91,24 +66,12 @@ INDEX INDEX gcvtf -ANSI_SYNOPSIS +SYNOPSIS #include char *gcvt(double <[val]>, int <[precision]>, char *<[buf]>); char *gcvtf(float <[val]>, int <[precision]>, char *<[buf]>); -TRAD_SYNOPSIS - #include - - char *gcvt(<[val]>, <[precision]>, <[buf]>); - double <[val]>; - int <[precision]>; - char *<[buf]>; - char *gcvtf(<[val]>, <[precision]>, <[buf]>); - float <[val]>; - int <[precision]>; - char *<[buf]>; - DESCRIPTION <> writes a fully formatted number as a null-terminated string in the buffer <<*<[buf]>>>. <> produces corresponding diff --git a/newlib/libc/stdlib/envlock.c b/newlib/libc/stdlib/envlock.c index 410a28a9c..3afe30ee9 100644 --- a/newlib/libc/stdlib/envlock.c +++ b/newlib/libc/stdlib/envlock.c @@ -7,18 +7,11 @@ INDEX INDEX __env_unlock -ANSI_SYNOPSIS +SYNOPSIS #include void __env_lock (struct _reent *<[reent]>); void __env_unlock (struct _reent *<[reent]>); -TRAD_SYNOPSIS - void __env_lock(<[reent]>) - struct _reent *<[reent]>; - - void __env_unlock(<[reent]>) - struct _reent *<[reent]>; - DESCRIPTION The <> family of routines call these functions when they need to modify the environ variable. The version of these routines supplied in the diff --git a/newlib/libc/stdlib/exit.c b/newlib/libc/stdlib/exit.c index 1dc56944a..8d1be9d3a 100644 --- a/newlib/libc/stdlib/exit.c +++ b/newlib/libc/stdlib/exit.c @@ -12,15 +12,10 @@ FUNCTION INDEX exit -ANSI_SYNOPSIS +SYNOPSIS #include void exit(int <[code]>); -TRAD_SYNOPSIS - #include - void exit(<[code]>) - int <[code]>; - DESCRIPTION Use <> to return control from a program to the host operating environment. Use the argument <[code]> to pass an exit status to the diff --git a/newlib/libc/stdlib/getenv.c b/newlib/libc/stdlib/getenv.c index 79360ac42..c64241ee6 100644 --- a/newlib/libc/stdlib/getenv.c +++ b/newlib/libc/stdlib/getenv.c @@ -7,15 +7,10 @@ INDEX INDEX environ -ANSI_SYNOPSIS +SYNOPSIS #include char *getenv(const char *<[name]>); -TRAD_SYNOPSIS - #include - char *getenv(<[name]>) - char *<[name]>; - DESCRIPTION <> searches the list of environment variable names and values (using the global pointer ``<>'') for a variable whose diff --git a/newlib/libc/stdlib/getenv_r.c b/newlib/libc/stdlib/getenv_r.c index cdc12c0a9..7376f7407 100644 --- a/newlib/libc/stdlib/getenv_r.c +++ b/newlib/libc/stdlib/getenv_r.c @@ -7,16 +7,10 @@ INDEX INDEX environ -ANSI_SYNOPSIS +SYNOPSIS #include char *_getenv_r(struct _reent *<[reent_ptr]>, const char *<[name]>); -TRAD_SYNOPSIS - #include - char *_getenv_r(<[reent_ptr]>, <[name]>) - struct _reent *<[reent_ptr]>; - char *<[name]>; - DESCRIPTION <<_getenv_r>> searches the list of environment variable names and values (using the global pointer ``<>'') for a variable whose diff --git a/newlib/libc/stdlib/itoa.c b/newlib/libc/stdlib/itoa.c index 377834d03..3178cd454 100644 --- a/newlib/libc/stdlib/itoa.c +++ b/newlib/libc/stdlib/itoa.c @@ -5,7 +5,7 @@ FUNCTION INDEX itoa -ANSI_SYNOPSIS +SYNOPSIS #include char *itoa(int <[value]>, char *<[str]>, int <[base]>); char *__itoa(int <[value]>, char *<[str]>, int <[base]>); diff --git a/newlib/libc/stdlib/labs.c b/newlib/libc/stdlib/labs.c index 634cf7348..712f56c37 100644 --- a/newlib/libc/stdlib/labs.c +++ b/newlib/libc/stdlib/labs.c @@ -5,15 +5,10 @@ FUNCTION INDEX labs -ANSI_SYNOPSIS +SYNOPSIS #include long labs(long <[i]>); -TRAD_SYNOPSIS - #include - long labs(<[i]>) - long <[i]>; - DESCRIPTION <> returns @tex diff --git a/newlib/libc/stdlib/ldiv.c b/newlib/libc/stdlib/ldiv.c index d7508f1c5..242b6bd87 100644 --- a/newlib/libc/stdlib/ldiv.c +++ b/newlib/libc/stdlib/ldiv.c @@ -5,15 +5,10 @@ FUNCTION INDEX ldiv -ANSI_SYNOPSIS +SYNOPSIS #include ldiv_t ldiv(long <[n]>, long <[d]>); -TRAD_SYNOPSIS - #include - ldiv_t ldiv(<[n]>, <[d]>) - long <[n]>, <[d]>; - DESCRIPTION Divide @tex diff --git a/newlib/libc/stdlib/llabs.c b/newlib/libc/stdlib/llabs.c index 496373910..c2a561c38 100644 --- a/newlib/libc/stdlib/llabs.c +++ b/newlib/libc/stdlib/llabs.c @@ -5,15 +5,10 @@ FUNCTION INDEX llabs -ANSI_SYNOPSIS +SYNOPSIS #include long long llabs(long long <[j]>); -TRAD_SYNOPSIS - #include - long long llabs(<[j]>) - long long <[j]>; - DESCRIPTION The <> function computes the absolute value of the long long integer argument <[j]> (also called the magnitude of <[j]>). diff --git a/newlib/libc/stdlib/lldiv.c b/newlib/libc/stdlib/lldiv.c index 6b853e4b6..61a9b50ca 100644 --- a/newlib/libc/stdlib/lldiv.c +++ b/newlib/libc/stdlib/lldiv.c @@ -5,15 +5,10 @@ FUNCTION INDEX lldiv -ANSI_SYNOPSIS +SYNOPSIS #include lldiv_t lldiv(long long <[n]>, long long <[d]>); -TRAD_SYNOPSIS - #include - lldiv_t lldiv(<[n]>, <[d]>) - long long <[n]>, <[d]>; - DESCRIPTION Divide @tex diff --git a/newlib/libc/stdlib/malloc.c b/newlib/libc/stdlib/malloc.c index 160a13eff..9cf897852 100644 --- a/newlib/libc/stdlib/malloc.c +++ b/newlib/libc/stdlib/malloc.c @@ -43,7 +43,7 @@ INDEX INDEX _malloc_usable_size_r -ANSI_SYNOPSIS +SYNOPSIS #include void *malloc(size_t <[nbytes]>); void *realloc(void *<[aptr]>, size_t <[nbytes]>); @@ -66,56 +66,6 @@ ANSI_SYNOPSIS size_t _malloc_usable_size_r(void *<[reent]>, void *<[aptr]>); -TRAD_SYNOPSIS - #include - char *malloc(<[nbytes]>) - size_t <[nbytes]>; - - char *realloc(<[aptr]>, <[nbytes]>) - char *<[aptr]>; - size_t <[nbytes]>; - - char *reallocf(<[aptr]>, <[nbytes]>) - char *<[aptr]>; - size_t <[nbytes]>; - - void free(<[aptr]>) - char *<[aptr]>; - - char *memalign(<[align]>, <[nbytes]>) - size_t <[align]>; - size_t <[nbytes]>; - - size_t malloc_usable_size(<[aptr]>) - char *<[aptr]>; - - char *_malloc_r(<[reent]>,<[nbytes]>) - char *<[reent]>; - size_t <[nbytes]>; - - char *_realloc_r(<[reent]>, <[aptr]>, <[nbytes]>) - char *<[reent]>; - char *<[aptr]>; - size_t <[nbytes]>; - - char *_reallocf_r(<[reent]>, <[aptr]>, <[nbytes]>) - char *<[reent]>; - char *<[aptr]>; - size_t <[nbytes]>; - - void _free_r(<[reent]>, <[aptr]>) - char *<[reent]>; - char *<[aptr]>; - - char *_memalign_r(<[reent]>, <[align]>, <[nbytes]>) - char *<[reent]>; - size_t <[align]>; - size_t <[nbytes]>; - - size_t malloc_usable_size(<[reent]>, <[aptr]>) - char *<[reent]>; - char *<[aptr]>; - DESCRIPTION These functions manage a pool of system memory. diff --git a/newlib/libc/stdlib/mblen.c b/newlib/libc/stdlib/mblen.c index f9fb46466..30d759be0 100644 --- a/newlib/libc/stdlib/mblen.c +++ b/newlib/libc/stdlib/mblen.c @@ -5,16 +5,10 @@ FUNCTION INDEX mblen -ANSI_SYNOPSIS +SYNOPSIS #include int mblen(const char *<[s]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - int mblen(<[s]>, <[n]>) - const char *<[s]>; - size_t <[n]>; - DESCRIPTION When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <>. In this case, the diff --git a/newlib/libc/stdlib/mblen_r.c b/newlib/libc/stdlib/mblen_r.c index 9c1533ec4..5e58e1e45 100644 --- a/newlib/libc/stdlib/mblen_r.c +++ b/newlib/libc/stdlib/mblen_r.c @@ -5,18 +5,10 @@ FUNCTION INDEX _mblen_r -ANSI_SYNOPSIS +SYNOPSIS #include int _mblen_r(struct _reent *<[r]>, const char *<[s]>, size_t <[n]>, int *<[state]>); -TRAD_SYNOPSIS - #include - int _mblen_r(<[r]>, <[s]>, <[n]>, <[state]>) - struct _reent *<[r]>; - const char *<[s]>; - size_t <[n]>; - int *<[state]>; - DESCRIPTION When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <<_mblen_r>>. In this case, the diff --git a/newlib/libc/stdlib/mbsnrtowcs.c b/newlib/libc/stdlib/mbsnrtowcs.c index 7ab384721..018f075ee 100644 --- a/newlib/libc/stdlib/mbsnrtowcs.c +++ b/newlib/libc/stdlib/mbsnrtowcs.c @@ -11,7 +11,7 @@ INDEX INDEX _mbsnrtowcs_r -ANSI_SYNOPSIS +SYNOPSIS #include size_t mbsrtowcs(wchar_t *__restrict <[dst]>, const char **__restrict <[src]>, @@ -33,39 +33,6 @@ ANSI_SYNOPSIS const char **<[src]>, size_t <[nms]>, size_t <[len]>, mbstate_t *<[ps]>); -TRAD_SYNOPSIS - #include - size_t mbsrtowcs(<[dst]>, <[src]>, <[len]>, <[ps]>) - wchar_t *__restrict <[dst]>; - const char **__restrict <[src]>; - size_t <[len]>; - mbstate_t *__restrict <[ps]>; - - #include - size_t _mbsrtowcs_r(<[ptr]>, <[dst]>, <[src]>, <[len]>, <[ps]>) - struct _reent *<[ptr]>; - wchar_t *<[dst]>; - const char **<[src]>; - size_t <[len]>; - mbstate_t *<[ps]>; - - #include - size_t mbsnrtowcs(<[dst]>, <[src]>, <[nms]>, <[len]>, <[ps]>) - wchar_t *__restrict <[dst]>; - const char **__restrict <[src]>; - size_t <[nms]>; - size_t <[len]>; - mbstate_t *__restrict <[ps]>; - - #include - size_t _mbsnrtowcs_r(<[ptr]>, <[dst]>, <[src]>, <[nms]>, <[len]>, <[ps]>) - struct _reent *<[ptr]>; - wchar_t *<[dst]>; - const char **<[src]>; - size_t <[nms]>; - size_t <[len]>; - mbstate_t *<[ps]>; - DESCRIPTION The <> function converts a sequence of multibyte characters pointed to indirectly by <[src]> into a sequence of corresponding wide diff --git a/newlib/libc/stdlib/mbstowcs.c b/newlib/libc/stdlib/mbstowcs.c index 09543451c..70ed9ede6 100644 --- a/newlib/libc/stdlib/mbstowcs.c +++ b/newlib/libc/stdlib/mbstowcs.c @@ -5,17 +5,10 @@ FUNCTION INDEX mbstowcs -ANSI_SYNOPSIS +SYNOPSIS #include int mbstowcs(wchar_t *restrict <[pwc]>, const char *restrict <[s]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - int mbstowcs(<[pwc]>, <[s]>, <[n]>) - wchar_t *<[pwc]>; - const char *<[s]>; - size_t <[n]>; - DESCRIPTION When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <>. In this case, the diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c index 7b8be771c..0c29cf3d9 100644 --- a/newlib/libc/stdlib/mbtowc.c +++ b/newlib/libc/stdlib/mbtowc.c @@ -5,17 +5,10 @@ FUNCTION INDEX mbtowc -ANSI_SYNOPSIS +SYNOPSIS #include int mbtowc(wchar_t *restrict <[pwc]>, const char *restrict <[s]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - int mbtowc(<[pwc]>, <[s]>, <[n]>) - wchar_t *<[pwc]>; - const char *<[s]>; - size_t <[n]>; - DESCRIPTION When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <>. In this case, diff --git a/newlib/libc/stdlib/mlock.c b/newlib/libc/stdlib/mlock.c index 4c392947d..23aa10173 100644 --- a/newlib/libc/stdlib/mlock.c +++ b/newlib/libc/stdlib/mlock.c @@ -8,18 +8,11 @@ INDEX INDEX __malloc_unlock -ANSI_SYNOPSIS +SYNOPSIS #include void __malloc_lock (struct _reent *<[reent]>); void __malloc_unlock (struct _reent *<[reent]>); -TRAD_SYNOPSIS - void __malloc_lock(<[reent]>) - struct _reent *<[reent]>; - - void __malloc_unlock(<[reent]>) - struct _reent *<[reent]>; - DESCRIPTION The <> family of routines call these functions when they need to lock the memory pool. The version of these routines supplied in the library use diff --git a/newlib/libc/stdlib/mstats.c b/newlib/libc/stdlib/mstats.c index ba89f494d..88cb54c40 100644 --- a/newlib/libc/stdlib/mstats.c +++ b/newlib/libc/stdlib/mstats.c @@ -25,7 +25,7 @@ INDEX INDEX _mallopt_r -ANSI_SYNOPSIS +SYNOPSIS #include struct mallinfo mallinfo(void); void malloc_stats(void); @@ -35,27 +35,6 @@ ANSI_SYNOPSIS void _malloc_stats_r(void *<[reent]>); int _mallopt_r(void *<[reent]>, int <[parameter]>, <[value]>); -TRAD_SYNOPSIS - #include - struct mallinfo mallinfo(); - - void malloc_stats(); - - int mallopt(<[parameter]>, <[value]>) - int <[parameter]>; - int <[value]>; - - struct mallinfo _mallinfo_r(<[reent]>); - char *<[reent]>; - - void _malloc_stats_r(<[reent]>); - char *<[reent]>; - - int _mallopt_r(<[reent]>, <[parameter]>, <[value]>) - char *<[reent]>; - int <[parameter]>; - int <[value]>; - DESCRIPTION <> returns a structure describing the current state of memory allocation. The structure is defined in malloc.h. The diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index a405b1b51..d22fc3728 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -14,16 +14,10 @@ FUNCTION INDEX on_exit -ANSI_SYNOPSIS +SYNOPSIS #include int on_exit (void (*<[function]>)(int, void *), void *<[arg]>); -TRAD_SYNOPSIS - #include - int on_exit ((<[function]>, <[arg]>) - void (*<[function]>)(int, void *); - void *<[arg]>; - DESCRIPTION You can use <> to enroll functions in a list of functions that will be called when your program terminates normally. The argument is diff --git a/newlib/libc/stdlib/rand.c b/newlib/libc/stdlib/rand.c index 42acde4aa..aacb0a8a4 100644 --- a/newlib/libc/stdlib/rand.c +++ b/newlib/libc/stdlib/rand.c @@ -9,23 +9,12 @@ INDEX INDEX rand_r -ANSI_SYNOPSIS +SYNOPSIS #include int rand(void); void srand(unsigned int <[seed]>); int rand_r(unsigned int *<[seed]>); -TRAD_SYNOPSIS - #include - int rand(); - - void srand(<[seed]>) - unsigned int <[seed]>; - - void rand_r(<[seed]>) - unsigned int *<[seed]>; - - DESCRIPTION <> returns a different integer each time it is called; each integer is chosen by an algorithm designed to be unpredictable, so diff --git a/newlib/libc/stdlib/rand48.c b/newlib/libc/stdlib/rand48.c index af2be3c07..b9bf320b2 100644 --- a/newlib/libc/stdlib/rand48.c +++ b/newlib/libc/stdlib/rand48.c @@ -36,7 +36,7 @@ INDEX INDEX lcong48 -ANSI_SYNOPSIS +SYNOPSIS #include double drand48(void); double erand48(unsigned short <[xseed]>[3]); @@ -48,32 +48,6 @@ ANSI_SYNOPSIS unsigned short *seed48(unsigned short <[xseed]>[3]); void lcong48(unsigned short <[p]>[7]); -TRAD_SYNOPSIS - #include - double drand48(); - - double erand48(<[xseed]>) - unsigned short <[xseed]>[3]; - - long lrand48(); - - long nrand48(<[xseed]>) - unsigned short <[xseed]>[3]; - - long mrand48(); - - long jrand48(<[xseed]>) - unsigned short <[xseed]>[3]; - - void srand48(<[seed]>) - long <[seed]>; - - unsigned short *seed48(<[xseed]>) - unsigned short <[xseed]>[3]; - - void lcong48(<[p]>) - unsigned short <[p]>[7]; - DESCRIPTION The <> family of functions generates pseudo-random numbers using a linear congruential algorithm working on integers 48 bits in size. diff --git a/newlib/libc/stdlib/random.c b/newlib/libc/stdlib/random.c index de132f363..7abca6da4 100644 --- a/newlib/libc/stdlib/random.c +++ b/newlib/libc/stdlib/random.c @@ -7,7 +7,7 @@ INDEX INDEX srandom -ANSI_SYNOPSIS +SYNOPSIS #define _XOPEN_SOURCE 500 #include long int random(void); diff --git a/newlib/libc/stdlib/rpmatch.c b/newlib/libc/stdlib/rpmatch.c index 0bbdf43ed..93d2c3f11 100644 --- a/newlib/libc/stdlib/rpmatch.c +++ b/newlib/libc/stdlib/rpmatch.c @@ -5,15 +5,10 @@ FUNCTION INDEX rpmatch -ANSI_SYNOPSIS +SYNOPSIS #include int rpmatch(const char *<[response]>); -TRAD_SYNOPSIS - #include - int rpmatch(<[response]>) - const char *<[response]>; - DESCRIPTION The <> function determines whether <[response]> is an affirmative or negative response to a question according to the current locale. diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index 82e847c40..236daa5f6 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -23,7 +23,7 @@ INDEX INDEX _strtod_r -ANSI_SYNOPSIS +SYNOPSIS #include double strtod(const char *restrict <[str]>, char **restrict <[tail]>); float strtof(const char *restrict <[str]>, char **restrict <[tail]>); @@ -42,21 +42,6 @@ ANSI_SYNOPSIS double _strtod_r(void *<[reent]>, const char *restrict <[str]>, char **restrict <[tail]>); -TRAD_SYNOPSIS - #include - double strtod(<[str]>,<[tail]>) - char *<[str]>; - char **<[tail]>; - - float strtof(<[str]>,<[tail]>) - char *<[str]>; - char **<[tail]>; - - double _strtod_r(<[reent]>,<[str]>,<[tail]>) - char *<[reent]>; - char *<[str]>; - char **<[tail]>; - DESCRIPTION <>, <>, <> parse the character string <[str]>, producing a substring which can be converted to a double, diff --git a/newlib/libc/stdlib/strtol.c b/newlib/libc/stdlib/strtol.c index 276ad1340..ba58b6e8c 100644 --- a/newlib/libc/stdlib/strtol.c +++ b/newlib/libc/stdlib/strtol.c @@ -11,7 +11,7 @@ INDEX INDEX _strtol_r -ANSI_SYNOPSIS +SYNOPSIS #include long strtol(const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); @@ -23,19 +23,6 @@ ANSI_SYNOPSIS long _strtol_r(void *<[reent]>, const char *restrict <[s]>, char **restrict <[ptr]>,int <[base]>); -TRAD_SYNOPSIS - #include - long strtol (<[s]>, <[ptr]>, <[base]>) - char *<[s]>; - char **<[ptr]>; - int <[base]>; - - long _strtol_r (<[reent]>, <[s]>, <[ptr]>, <[base]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the string <<*<[s]>>> to a <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/strtoll.c b/newlib/libc/stdlib/strtoll.c index e61a62a7d..2922452c7 100644 --- a/newlib/libc/stdlib/strtoll.c +++ b/newlib/libc/stdlib/strtoll.c @@ -11,7 +11,7 @@ INDEX INDEX _strtoll_r -ANSI_SYNOPSIS +SYNOPSIS #include long long strtoll(const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); @@ -25,19 +25,6 @@ ANSI_SYNOPSIS const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - long long strtoll (<[s]>, <[ptr]>, <[base]>) - const char *<[s]>; - char **<[ptr]>; - int <[base]>; - - long long _strtoll_r (<[reent]>, <[s]>, <[ptr]>, <[base]>) - char *<[reent]>; - const char *<[s]>; - char **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the string <<*<[s]>>> to a <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/strtoul.c b/newlib/libc/stdlib/strtoul.c index aa5897e13..9414661ec 100644 --- a/newlib/libc/stdlib/strtoul.c +++ b/newlib/libc/stdlib/strtoul.c @@ -11,7 +11,7 @@ INDEX INDEX _strtoul_r -ANSI_SYNOPSIS +SYNOPSIS #include unsigned long strtoul(const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); @@ -24,19 +24,6 @@ ANSI_SYNOPSIS unsigned long _strtoul_r(void *<[reent]>, const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - unsigned long strtoul(<[s]>, <[ptr]>, <[base]>) - char *<[s]>; - char **<[ptr]>; - int <[base]>; - - unsigned long _strtoul_r(<[reent]>, <[s]>, <[ptr]>, <[base]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the string <<*<[s]>>> to an <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/strtoull.c b/newlib/libc/stdlib/strtoull.c index ba6452e62..aff1fc7c3 100644 --- a/newlib/libc/stdlib/strtoull.c +++ b/newlib/libc/stdlib/strtoull.c @@ -8,7 +8,7 @@ INDEX INDEX strtoull_l -ANSI_SYNOPSIS +SYNOPSIS #include unsigned long long strtoull(const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); @@ -22,19 +22,6 @@ ANSI_SYNOPSIS const char *restrict <[s]>, char **restrict <[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - unsigned long long strtoull(<[s]>, <[ptr]>, <[base]>) - char *<[s]>; - char **<[ptr]>; - int <[base]>; - - unsigned long long _strtoull_r(<[reent]>, <[s]>, <[ptr]>, <[base]>) - char *<[reent]>; - char *<[s]>; - char **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the string <<*<[s]>>> to an <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c index 135a9d05b..6cacfa587 100644 --- a/newlib/libc/stdlib/system.c +++ b/newlib/libc/stdlib/system.c @@ -7,21 +7,12 @@ INDEX INDEX _system_r -ANSI_SYNOPSIS +SYNOPSIS #include int system(char *<[s]>); int _system_r(void *<[reent]>, char *<[s]>); -TRAD_SYNOPSIS - #include - int system(<[s]>) - char *<[s]>; - - int _system_r(<[reent]>, <[s]>) - char *<[reent]>; - char *<[s]>; - DESCRIPTION Use <> to pass a command string <<*<[s]>>> to <> on diff --git a/newlib/libc/stdlib/utoa.c b/newlib/libc/stdlib/utoa.c index 7738c2321..75e8616ea 100644 --- a/newlib/libc/stdlib/utoa.c +++ b/newlib/libc/stdlib/utoa.c @@ -5,7 +5,7 @@ FUNCTION INDEX utoa -ANSI_SYNOPSIS +SYNOPSIS #include char *utoa(unsigned <[value]>, char *<[str]>, int <[base]>); char *__utoa(unsigned <[value]>, char *<[str]>, int <[base]>); diff --git a/newlib/libc/stdlib/wcsnrtombs.c b/newlib/libc/stdlib/wcsnrtombs.c index 8e5c38703..ed5f36968 100644 --- a/newlib/libc/stdlib/wcsnrtombs.c +++ b/newlib/libc/stdlib/wcsnrtombs.c @@ -11,7 +11,7 @@ INDEX INDEX _wcsnrtombs_r -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcsrtombs(char *__restrict <[dst]>, const wchar_t **__restrict <[src]>, size_t <[len]>, @@ -33,39 +33,6 @@ ANSI_SYNOPSIS const wchar_t **<[src]>, size_t <[nwc]>, size_t <[len]>, mbstate_t *<[ps]>); -TRAD_SYNOPSIS - #include - size_t wcsrtombs(<[dst]>, <[src]>, <[len]>, <[ps]>) - char *__restrict <[dst]>; - const wchar_t **__restrict <[src]>; - size_t <[len]>; - mbstate_t *__restrict <[ps]>; - - #include - size_t _wcsrtombs_r(<[ptr]>, <[dst]>, <[src]>, <[len]>, <[ps]>) - struct _rent *<[ptr]>; - char *<[dst]>; - const wchar_t **<[src]>; - size_t <[len]>; - mbstate_t *<[ps]>; - - #include - size_t wcsnrtombs(<[dst]>, <[src]>, <[nwc]>, <[len]>, <[ps]>) - char *__restrict <[dst]>; - const wchar_t **__restrict <[src]>; - size_t <[nwc]>; - size_t <[len]>; - mbstate_t *__restrict <[ps]>; - - #include - size_t _wcsnrtombs_r(<[ptr]>, <[dst]>, <[src]>, <[nwc]>, <[len]>, <[ps]>) - struct _rent *<[ptr]>; - char *<[dst]>; - const wchar_t **<[src]>; - size_t <[nwc]>; - size_t <[len]>; - mbstate_t *<[ps]>; - DESCRIPTION The <> function converts a string of wide characters indirectly pointed to by <[src]> to a corresponding multibyte character string stored in diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c index 605fca40b..201a2c32c 100644 --- a/newlib/libc/stdlib/wcstod.c +++ b/newlib/libc/stdlib/wcstod.c @@ -26,7 +26,7 @@ INDEX INDEX _wcstof_r -ANSI_SYNOPSIS +SYNOPSIS #include double wcstod(const wchar_t *__restrict <[str]>, wchar_t **__restrict <[tail]>); @@ -49,26 +49,6 @@ ANSI_SYNOPSIS float _wcstof_r(void *<[reent]>, const wchar_t *<[str]>, wchar_t **<[tail]>); -TRAD_SYNOPSIS - #include - double wcstod(<[str]>,<[tail]>) - wchar_t *__restrict <[str]>; - wchar_t **__restrict <[tail]>; - - float wcstof(<[str]>,<[tail]>) - wchar_t *__restrict <[str]>; - wchar_t **__restrict <[tail]>; - - double _wcstod_r(<[reent]>,<[str]>,<[tail]>) - wchar_t *<[reent]>; - wchar_t *<[str]>; - wchar_t **<[tail]>; - - float _wcstof_r(<[reent]>,<[str]>,<[tail]>) - wchar_t *<[reent]>; - wchar_t *<[str]>; - wchar_t **<[tail]>; - DESCRIPTION <>, <>, <> parse the wide-character string <[str]>, producing a substring which can be converted to a double, diff --git a/newlib/libc/stdlib/wcstol.c b/newlib/libc/stdlib/wcstol.c index 4c7480594..417a46d63 100644 --- a/newlib/libc/stdlib/wcstol.c +++ b/newlib/libc/stdlib/wcstol.c @@ -11,7 +11,7 @@ INDEX INDEX _wcstol_r -ANSI_SYNOPSIS +SYNOPSIS #include long wcstol(const wchar_t *__restrict <[s]>, wchar_t **__restrict <[ptr]>, int <[base]>); @@ -24,19 +24,6 @@ ANSI_SYNOPSIS long _wcstol_r(void *<[reent]>, const wchar_t *<[s]>, wchar_t **<[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - long wcstol (<[s]>, <[ptr]>, <[base]>) - wchar_t *__restrict <[s]>; - wchar_t **__restrict <[ptr]>; - int <[base]>; - - long _wcstol_r (<[reent]>, <[s]>, <[ptr]>, <[base]>) - struct _reent *<[reent]>; - wchar_t *<[s]>; - wchar_t **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the wide string <<*<[s]>>> to a <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/wcstoll.c b/newlib/libc/stdlib/wcstoll.c index 2996b11a6..3a7a0e28d 100644 --- a/newlib/libc/stdlib/wcstoll.c +++ b/newlib/libc/stdlib/wcstoll.c @@ -11,7 +11,7 @@ INDEX INDEX _wcstoll_r -ANSI_SYNOPSIS +SYNOPSIS #include long long wcstoll(const wchar_t *__restrict <[s]>, wchar_t **__restrict <[ptr]>,int <[base]>); @@ -24,19 +24,6 @@ ANSI_SYNOPSIS long long _wcstoll_r(void *<[reent]>, const wchar_t *<[s]>, wchar_t **<[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - long long wcstoll (<[s]>, <[ptr]>, <[base]>) - const wchar_t *__restrict <[s]>; - wchar_t **__restrict <[ptr]>; - int <[base]>; - - long long _wcstoll_r (<[reent]>, <[s]>, <[ptr]>, <[base]>) - wchar_t *<[reent]>; - const wchar_t *<[s]>; - wchar_t **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the wide string <<*<[s]>>> to a <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/wcstombs.c b/newlib/libc/stdlib/wcstombs.c index b0123a313..9e1937887 100644 --- a/newlib/libc/stdlib/wcstombs.c +++ b/newlib/libc/stdlib/wcstombs.c @@ -5,17 +5,10 @@ FUNCTION INDEX wcstombs -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcstombs(char *restrict <[s]>, const wchar_t *restrict <[pwc]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - size_t wcstombs(<[s]>, <[pwc]>, <[n]>) - char *<[s]>; - const wchar_t *<[pwc]>; - size_t <[n]>; - DESCRIPTION When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <>. In this case, diff --git a/newlib/libc/stdlib/wcstoul.c b/newlib/libc/stdlib/wcstoul.c index e87b2ecc9..d649810ea 100644 --- a/newlib/libc/stdlib/wcstoul.c +++ b/newlib/libc/stdlib/wcstoul.c @@ -11,7 +11,7 @@ INDEX INDEX _wcstoul_r -ANSI_SYNOPSIS +SYNOPSIS #include unsigned long wcstoul(const wchar_t *__restrict <[s]>, wchar_t **__restrict <[ptr]>, int <[base]>); @@ -24,19 +24,6 @@ ANSI_SYNOPSIS unsigned long _wcstoul_r(void *<[reent]>, const wchar_t *<[s]>, wchar_t **<[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - unsigned long wcstoul(<[s]>, <[ptr]>, <[base]>) - wchar_t *__restrict <[s]>; - wchar_t **__restrict <[ptr]>; - int <[base]>; - - unsigned long _wcstoul_r(<[reent]>, <[s]>, <[ptr]>, <[base]>) - wchar_t *<[reent]>; - wchar_t *<[s]>; - wchar_t **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the wide string <<*<[s]>>> to an <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/wcstoull.c b/newlib/libc/stdlib/wcstoull.c index 131a83795..4bb0cd781 100644 --- a/newlib/libc/stdlib/wcstoull.c +++ b/newlib/libc/stdlib/wcstoull.c @@ -11,7 +11,7 @@ INDEX INDEX _wcstoull_r -ANSI_SYNOPSIS +SYNOPSIS #include unsigned long long wcstoull(const wchar_t *__restrict <[s]>, wchar_t **__restrict <[ptr]>, @@ -26,19 +26,6 @@ ANSI_SYNOPSIS unsigned long long _wcstoull_r(void *<[reent]>, const wchar_t *<[s]>, wchar_t **<[ptr]>, int <[base]>); -TRAD_SYNOPSIS - #include - unsigned long long wcstoull(<[s]>, <[ptr]>, <[base]>) - wchar_t *__restrict <[s]>; - wchar_t **__restrict <[ptr]>; - int <[base]>; - - unsigned long long _wcstoull_r(<[reent]>, <[s]>, <[ptr]>, <[base]>) - wchar_t *<[reent]>; - wchar_t *<[s]>; - wchar_t **<[ptr]>; - int <[base]>; - DESCRIPTION The function <> converts the wide string <<*<[s]>>> to an <>. First, it breaks down the string into three parts: diff --git a/newlib/libc/stdlib/wctomb.c b/newlib/libc/stdlib/wctomb.c index 13892ffa4..8b267a324 100644 --- a/newlib/libc/stdlib/wctomb.c +++ b/newlib/libc/stdlib/wctomb.c @@ -5,16 +5,10 @@ FUNCTION INDEX wctomb -ANSI_SYNOPSIS +SYNOPSIS #include int wctomb(char *<[s]>, wchar_t <[wchar]>); -TRAD_SYNOPSIS - #include - int wctomb(<[s]>, <[wchar]>) - char *<[s]>; - wchar_t <[wchar]>; - DESCRIPTION When _MB_CAPABLE is not defined, this is a minimal ANSI-conforming implementation of <>. The From 352c8f2f0dd977f2b2d2dfb7087d701d85fd5361 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:20:06 -0600 Subject: [PATCH 158/649] string: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/string/bcmp.c | 9 +-------- newlib/libc/string/bcopy.c | 8 +------- newlib/libc/string/bzero.c | 8 +------- newlib/libc/string/index.c | 8 +------- newlib/libc/string/memccpy.c | 9 +-------- newlib/libc/string/memchr.c | 9 +-------- newlib/libc/string/memcmp.c | 9 +-------- newlib/libc/string/memcpy.c | 9 +-------- newlib/libc/string/memmem.c | 2 +- newlib/libc/string/memmove.c | 9 +-------- newlib/libc/string/mempcpy.c | 8 +------- newlib/libc/string/memrchr.c | 9 +-------- newlib/libc/string/memset.c | 9 +-------- newlib/libc/string/rawmemchr.c | 8 +------- newlib/libc/string/rindex.c | 8 +------- newlib/libc/string/stpcpy.c | 8 +------- newlib/libc/string/stpncpy.c | 9 +-------- newlib/libc/string/strcasecmp.c | 8 +------- newlib/libc/string/strcasecmp_l.c | 2 +- newlib/libc/string/strcasestr.c | 8 +------- newlib/libc/string/strcat.c | 8 +------- newlib/libc/string/strchr.c | 8 +------- newlib/libc/string/strchrnul.c | 8 +------- newlib/libc/string/strcmp.c | 8 +------- newlib/libc/string/strcoll.c | 8 +------- newlib/libc/string/strcoll_l.c | 2 +- newlib/libc/string/strcpy.c | 8 +------- newlib/libc/string/strcspn.c | 7 +------ newlib/libc/string/strerror.c | 7 +------ newlib/libc/string/strerror_r.c | 9 +-------- newlib/libc/string/strlen.c | 7 +------ newlib/libc/string/strlwr.c | 7 +------ newlib/libc/string/strncasecmp.c | 9 +-------- newlib/libc/string/strncasecmp_l.c | 2 +- newlib/libc/string/strncat.c | 9 +-------- newlib/libc/string/strncmp.c | 9 +-------- newlib/libc/string/strncpy.c | 9 +-------- newlib/libc/string/strnlen.c | 8 +------- newlib/libc/string/strnstr.c | 2 +- newlib/libc/string/strpbrk.c | 8 +------- newlib/libc/string/strrchr.c | 8 +------- newlib/libc/string/strsignal.c | 7 +------ newlib/libc/string/strspn.c | 8 +------- newlib/libc/string/strstr.c | 8 +------- newlib/libc/string/strtok.c | 17 +---------------- newlib/libc/string/strupr.c | 7 +------ newlib/libc/string/strverscmp.c | 9 +-------- newlib/libc/string/strxfrm.c | 9 +-------- newlib/libc/string/strxfrm_l.c | 2 +- newlib/libc/string/swab.c | 8 +------- newlib/libc/string/wcpcpy.c | 7 +------ newlib/libc/string/wcpncpy.c | 8 +------- newlib/libc/string/wcscasecmp.c | 8 +------- newlib/libc/string/wcscasecmp_l.c | 2 +- newlib/libc/string/wcscat.c | 7 +------ newlib/libc/string/wcschr.c | 7 +------ newlib/libc/string/wcscmp.c | 6 +----- newlib/libc/string/wcscoll.c | 8 +------- newlib/libc/string/wcscoll_l.c | 2 +- newlib/libc/string/wcscpy.c | 7 +------ newlib/libc/string/wcscspn.c | 7 +------ newlib/libc/string/wcsdup.c | 8 +------- newlib/libc/string/wcslcat.c | 9 +-------- newlib/libc/string/wcslcpy.c | 9 +-------- newlib/libc/string/wcslen.c | 6 +----- newlib/libc/string/wcsncasecmp.c | 9 +-------- newlib/libc/string/wcsncasecmp_l.c | 2 +- newlib/libc/string/wcsncat.c | 8 +------- newlib/libc/string/wcsncmp.c | 8 +------- newlib/libc/string/wcsncpy.c | 8 +------- newlib/libc/string/wcsnlen.c | 8 +------- newlib/libc/string/wcspbrk.c | 7 +------ newlib/libc/string/wcsrchr.c | 8 +------- newlib/libc/string/wcsspn.c | 7 +------ newlib/libc/string/wcsstr.c | 7 +------ newlib/libc/string/wcstok.c | 9 +-------- newlib/libc/string/wcswidth.c | 8 +------- newlib/libc/string/wcsxfrm.c | 9 +-------- newlib/libc/string/wcsxfrm_l.c | 2 +- newlib/libc/string/wcwidth.c | 7 +------ newlib/libc/string/wmemchr.c | 8 +------- newlib/libc/string/wmemcmp.c | 8 +------- newlib/libc/string/wmemcpy.c | 8 +------- newlib/libc/string/wmemmove.c | 8 +------- newlib/libc/string/wmemset.c | 8 +------- 85 files changed, 85 insertions(+), 546 deletions(-) diff --git a/newlib/libc/string/bcmp.c b/newlib/libc/string/bcmp.c index 8d6e12ffb..86aada10c 100644 --- a/newlib/libc/string/bcmp.c +++ b/newlib/libc/string/bcmp.c @@ -5,17 +5,10 @@ FUNCTION INDEX bcmp -ANSI_SYNOPSIS +SYNOPSIS #include int bcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - int bcmp(<[s1]>, <[s2]>, <[n]>) - const void *<[s1]>; - const void *<[s2]>; - size_t <[n]>; - DESCRIPTION This function compares not more than <[n]> bytes of the object pointed to by <[s1]> with the object pointed to by <[s2]>. diff --git a/newlib/libc/string/bcopy.c b/newlib/libc/string/bcopy.c index 2881fd92c..22a7f1bfe 100644 --- a/newlib/libc/string/bcopy.c +++ b/newlib/libc/string/bcopy.c @@ -2,16 +2,10 @@ FUNCTION <>---copy memory regions -ANSI_SYNOPSIS +SYNOPSIS #include void bcopy(const void *<[in]>, void *<[out]>, size_t <[n]>); -TRAD_SYNOPSIS - void bcopy(<[in]>, <[out]>, <[n]> - const void *<[in]>; - void *<[out]>; - size_t <[n]>; - DESCRIPTION This function copies <[n]> bytes from the memory region pointed to by <[in]> to the memory region pointed to by diff --git a/newlib/libc/string/bzero.c b/newlib/libc/string/bzero.c index e99529af6..dc52170c5 100644 --- a/newlib/libc/string/bzero.c +++ b/newlib/libc/string/bzero.c @@ -5,16 +5,10 @@ FUNCTION INDEX bzero -ANSI_SYNOPSIS +SYNOPSIS #include void bzero(void *<[b]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - void bzero(<[b]>, <[length]>) - void *<[b]>; - size_t <[length]>; - DESCRIPTION <> initializes <[length]> bytes of memory, starting at address <[b]>, to zero. diff --git a/newlib/libc/string/index.c b/newlib/libc/string/index.c index ec241ffa8..2c4b49016 100644 --- a/newlib/libc/string/index.c +++ b/newlib/libc/string/index.c @@ -5,16 +5,10 @@ FUNCTION INDEX index -ANSI_SYNOPSIS +SYNOPSIS #include char * index(const char *<[string]>, int <[c]>); -TRAD_SYNOPSIS - #include - char * index(<[string]>, <[c]>); - char *<[string]>; - int *<[c]>; - DESCRIPTION This function finds the first occurence of <[c]> (converted to a char) in the string pointed to by <[string]> (including the diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c index 332ed4660..219aa5cfe 100644 --- a/newlib/libc/string/memccpy.c +++ b/newlib/libc/string/memccpy.c @@ -2,18 +2,11 @@ FUNCTION <>---copy memory regions with end-token check -ANSI_SYNOPSIS +SYNOPSIS #include void* memccpy(void *restrict <[out]>, const void *restrict <[in]>, int <[endchar]>, size_t <[n]>); -TRAD_SYNOPSIS - void *memccpy(<[out]>, <[in]>, <[endchar]>, <[n]> - void *<[out]>; - void *<[in]>; - int <[endchar]>; - size_t <[n]>; - DESCRIPTION This function copies up to <[n]> bytes from the memory region pointed to by <[in]> to the memory region pointed to by diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c index db0af7cd7..152cd718a 100644 --- a/newlib/libc/string/memchr.c +++ b/newlib/libc/string/memchr.c @@ -5,17 +5,10 @@ FUNCTION INDEX memchr -ANSI_SYNOPSIS +SYNOPSIS #include void *memchr(const void *<[src]>, int <[c]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - void *memchr(<[src]>, <[c]>, <[length]>) - void *<[src]>; - void *<[c]>; - size_t <[length]>; - DESCRIPTION This function searches memory starting at <<*<[src]>>> for the character <[c]>. The search only ends with the first diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c index 4a871fa60..8f86e7afd 100644 --- a/newlib/libc/string/memcmp.c +++ b/newlib/libc/string/memcmp.c @@ -5,17 +5,10 @@ FUNCTION INDEX memcmp -ANSI_SYNOPSIS +SYNOPSIS #include int memcmp(const void *<[s1]>, const void *<[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - int memcmp(<[s1]>, <[s2]>, <[n]>) - void *<[s1]>; - void *<[s2]>; - size_t <[n]>; - DESCRIPTION This function compares not more than <[n]> characters of the object pointed to by <[s1]> with the object pointed to by <[s2]>. diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index 5f27bca72..c76ab484f 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -2,18 +2,11 @@ FUNCTION <>---copy memory regions -ANSI_SYNOPSIS +SYNOPSIS #include void* memcpy(void *restrict <[out]>, const void *restrict <[in]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - void *memcpy(<[out]>, <[in]>, <[n]> - void *<[out]>; - void *<[in]>; - size_t <[n]>; - DESCRIPTION This function copies <[n]> bytes from the memory region pointed to by <[in]> to the memory region pointed to by diff --git a/newlib/libc/string/memmem.c b/newlib/libc/string/memmem.c index 25704e467..59e19d245 100644 --- a/newlib/libc/string/memmem.c +++ b/newlib/libc/string/memmem.c @@ -11,7 +11,7 @@ FUNCTION INDEX memmem -ANSI_SYNOPSIS +SYNOPSIS #include char *memmem(const void *<[s1]>, size_t <[l1]>, const void *<[s2]>, size_t <[l2]>); diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c index a037c7c2f..e6275a7e1 100644 --- a/newlib/libc/string/memmove.c +++ b/newlib/libc/string/memmove.c @@ -5,17 +5,10 @@ FUNCTION INDEX memmove -ANSI_SYNOPSIS +SYNOPSIS #include void *memmove(void *<[dst]>, const void *<[src]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - void *memmove(<[dst]>, <[src]>, <[length]>) - void *<[dst]>; - void *<[src]>; - size_t <[length]>; - DESCRIPTION This function moves <[length]> characters from the block of memory starting at <<*<[src]>>> to the memory starting at diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c index 5c6738f22..1a8e7cd34 100644 --- a/newlib/libc/string/mempcpy.c +++ b/newlib/libc/string/mempcpy.c @@ -2,16 +2,10 @@ FUNCTION <>---copy memory regions and return end pointer -ANSI_SYNOPSIS +SYNOPSIS #include void* mempcpy(void *<[out]>, const void *<[in]>, size_t <[n]>); -TRAD_SYNOPSIS - void *mempcpy(<[out]>, <[in]>, <[n]> - void *<[out]>; - void *<[in]>; - size_t <[n]>; - DESCRIPTION This function copies <[n]> bytes from the memory region pointed to by <[in]> to the memory region pointed to by diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c index 60dee42ed..974cebc16 100644 --- a/newlib/libc/string/memrchr.c +++ b/newlib/libc/string/memrchr.c @@ -5,17 +5,10 @@ FUNCTION INDEX memrchr -ANSI_SYNOPSIS +SYNOPSIS #include void *memrchr(const void *<[src]>, int <[c]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - void *memrchr(<[src]>, <[c]>, <[length]>) - void *<[src]>; - void *<[c]>; - size_t <[length]>; - DESCRIPTION This function searches memory starting at <[length]> bytes beyond <<*<[src]>>> backwards for the character <[c]>. diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c index b84e155f7..7d05478eb 100644 --- a/newlib/libc/string/memset.c +++ b/newlib/libc/string/memset.c @@ -5,17 +5,10 @@ FUNCTION INDEX memset -ANSI_SYNOPSIS +SYNOPSIS #include void *memset(void *<[dst]>, int <[c]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - void *memset(<[dst]>, <[c]>, <[length]>) - void *<[dst]>; - int <[c]>; - size_t <[length]>; - DESCRIPTION This function converts the argument <[c]> into an unsigned char and fills the first <[length]> characters of the array diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c index 4b5a4cdeb..c1b360dd3 100644 --- a/newlib/libc/string/rawmemchr.c +++ b/newlib/libc/string/rawmemchr.c @@ -5,16 +5,10 @@ FUNCTION INDEX rawmemchr -ANSI_SYNOPSIS +SYNOPSIS #include void *rawmemchr(const void *<[src]>, int <[c]>); -TRAD_SYNOPSIS - #include - void *rawmemchr(<[src]>, <[c]>) - void *<[src]>; - void *<[c]>; - DESCRIPTION This function searches memory starting at <<*<[src]>>> for the character <[c]>. The search only ends with the first occurrence diff --git a/newlib/libc/string/rindex.c b/newlib/libc/string/rindex.c index daa1c5237..3284361f8 100644 --- a/newlib/libc/string/rindex.c +++ b/newlib/libc/string/rindex.c @@ -5,16 +5,10 @@ FUNCTION INDEX rindex -ANSI_SYNOPSIS +SYNOPSIS #include char * rindex(const char *<[string]>, int <[c]>); -TRAD_SYNOPSIS - #include - char * rindex(<[string]>, <[c]>); - char *<[string]>; - int *<[c]>; - DESCRIPTION This function finds the last occurence of <[c]> (converted to a char) in the string pointed to by <[string]> (including the diff --git a/newlib/libc/string/stpcpy.c b/newlib/libc/string/stpcpy.c index bc58f4771..6272f1da6 100644 --- a/newlib/libc/string/stpcpy.c +++ b/newlib/libc/string/stpcpy.c @@ -5,16 +5,10 @@ FUNCTION INDEX stpcpy -ANSI_SYNOPSIS +SYNOPSIS #include char *stpcpy(char *restrict <[dst]>, const char *restrict <[src]>); -TRAD_SYNOPSIS - #include - char *stpcpy(<[dst]>, <[src]>) - char *<[dst]>; - char *<[src]>; - DESCRIPTION <> copies the string pointed to by <[src]> (including the terminating null character) to the array diff --git a/newlib/libc/string/stpncpy.c b/newlib/libc/string/stpncpy.c index abd9bbdbf..aa5acd45f 100644 --- a/newlib/libc/string/stpncpy.c +++ b/newlib/libc/string/stpncpy.c @@ -5,18 +5,11 @@ FUNCTION INDEX stpncpy -ANSI_SYNOPSIS +SYNOPSIS #include char *stpncpy(char *restrict <[dst]>, const char *restrict <[src]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - char *stpncpy(<[dst]>, <[src]>, <[length]>) - char *<[dst]>; - char *<[src]>; - size_t <[length]>; - DESCRIPTION <> copies not more than <[length]> characters from the the string pointed to by <[src]> (including the terminating diff --git a/newlib/libc/string/strcasecmp.c b/newlib/libc/string/strcasecmp.c index df8510b13..a6c34862f 100644 --- a/newlib/libc/string/strcasecmp.c +++ b/newlib/libc/string/strcasecmp.c @@ -5,16 +5,10 @@ FUNCTION INDEX strcasecmp -ANSI_SYNOPSIS +SYNOPSIS #include int strcasecmp(const char *<[a]>, const char *<[b]>); -TRAD_SYNOPSIS - #include - int strcasecmp(<[a]>, <[b]>) - char *<[a]>; - char *<[b]>; - DESCRIPTION <> compares the string at <[a]> to the string at <[b]> in a case-insensitive manner. diff --git a/newlib/libc/string/strcasecmp_l.c b/newlib/libc/string/strcasecmp_l.c index f87039d91..587f56ee1 100644 --- a/newlib/libc/string/strcasecmp_l.c +++ b/newlib/libc/string/strcasecmp_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX strcasecmp_l -ANSI_SYNOPSIS +SYNOPSIS #include int strcasecmp_l(const char *<[a]>, const char *<[b]>, locale_t <[locale]>); diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c index 8fff00b00..599f50227 100644 --- a/newlib/libc/string/strcasestr.c +++ b/newlib/libc/string/strcasestr.c @@ -5,16 +5,10 @@ FUNCTION INDEX strcasestr -ANSI_SYNOPSIS +SYNOPSIS #include char *strcasestr(const char *<[s]>, const char *<[find]>); -TRAD_SYNOPSIS - #include - int strcasecmp(<[s]>, <[find]>) - char *<[s]>; - char *<[find]>; - DESCRIPTION <> searchs the string <[s]> for the first occurrence of the sequence <[find]>. <> diff --git a/newlib/libc/string/strcat.c b/newlib/libc/string/strcat.c index 1e4614991..44b6b03f0 100644 --- a/newlib/libc/string/strcat.c +++ b/newlib/libc/string/strcat.c @@ -5,16 +5,10 @@ FUNCTION INDEX strcat -ANSI_SYNOPSIS +SYNOPSIS #include char *strcat(char *restrict <[dst]>, const char *restrict <[src]>); -TRAD_SYNOPSIS - #include - char *strcat(<[dst]>, <[src]>) - char *<[dst]>; - char *<[src]>; - DESCRIPTION <> appends a copy of the string pointed to by <[src]> (including the terminating null character) to the end of the diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c index e921b5db7..7147bd457 100644 --- a/newlib/libc/string/strchr.c +++ b/newlib/libc/string/strchr.c @@ -5,16 +5,10 @@ FUNCTION INDEX strchr -ANSI_SYNOPSIS +SYNOPSIS #include char * strchr(const char *<[string]>, int <[c]>); -TRAD_SYNOPSIS - #include - char * strchr(<[string]>, <[c]>); - const char *<[string]>; - int <[c]>; - DESCRIPTION This function finds the first occurence of <[c]> (converted to a char) in the string pointed to by <[string]> (including the diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c index afeef434e..3b6cd62fb 100644 --- a/newlib/libc/string/strchrnul.c +++ b/newlib/libc/string/strchrnul.c @@ -5,16 +5,10 @@ FUNCTION INDEX strchrnul -ANSI_SYNOPSIS +SYNOPSIS #include char * strchrnul(const char *<[string]>, int <[c]>); -TRAD_SYNOPSIS - #include - char * strchrnul(<[string]>, <[c]>); - const char *<[string]>; - int <[c]>; - DESCRIPTION This function finds the first occurence of <[c]> (converted to a char) in the string pointed to by <[string]> (including the diff --git a/newlib/libc/string/strcmp.c b/newlib/libc/string/strcmp.c index 81d65272e..d5e9148ef 100644 --- a/newlib/libc/string/strcmp.c +++ b/newlib/libc/string/strcmp.c @@ -5,16 +5,10 @@ FUNCTION INDEX strcmp -ANSI_SYNOPSIS +SYNOPSIS #include int strcmp(const char *<[a]>, const char *<[b]>); -TRAD_SYNOPSIS - #include - int strcmp(<[a]>, <[b]>) - char *<[a]>; - char *<[b]>; - DESCRIPTION <> compares the string at <[a]> to the string at <[b]>. diff --git a/newlib/libc/string/strcoll.c b/newlib/libc/string/strcoll.c index a6bb31a4e..551ede65b 100644 --- a/newlib/libc/string/strcoll.c +++ b/newlib/libc/string/strcoll.c @@ -5,16 +5,10 @@ FUNCTION INDEX strcoll -ANSI_SYNOPSIS +SYNOPSIS #include int strcoll(const char *<[stra]>, const char * <[strb]>); -TRAD_SYNOPSIS - #include - int strcoll(<[stra]>, <[strb]>) - char *<[stra]>; - char *<[strb]>; - DESCRIPTION <> compares the string pointed to by <[stra]> to the string pointed to by <[strb]>, using an interpretation diff --git a/newlib/libc/string/strcoll_l.c b/newlib/libc/string/strcoll_l.c index 5032f8439..89a7d0535 100644 --- a/newlib/libc/string/strcoll_l.c +++ b/newlib/libc/string/strcoll_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX strcoll_l -ANSI_SYNOPSIS +SYNOPSIS #include int strcoll_l(const char *<[stra]>, const char * <[strb]>, locale_t <[locale]>); diff --git a/newlib/libc/string/strcpy.c b/newlib/libc/string/strcpy.c index 3dc3c33f6..9670d2c13 100644 --- a/newlib/libc/string/strcpy.c +++ b/newlib/libc/string/strcpy.c @@ -5,16 +5,10 @@ FUNCTION INDEX strcpy -ANSI_SYNOPSIS +SYNOPSIS #include char *strcpy(char *<[dst]>, const char *<[src]>); -TRAD_SYNOPSIS - #include - char *strcpy(<[dst]>, <[src]>) - char *<[dst]>; - char *<[src]>; - DESCRIPTION <> copies the string pointed to by <[src]> (including the terminating null character) to the array diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c index 403330c94..f80b61f37 100644 --- a/newlib/libc/string/strcspn.c +++ b/newlib/libc/string/strcspn.c @@ -5,14 +5,9 @@ FUNCTION INDEX strcspn -ANSI_SYNOPSIS +SYNOPSIS size_t strcspn(const char *<[s1]>, const char *<[s2]>); -TRAD_SYNOPSIS - size_t strcspn(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - DESCRIPTION This function computes the length of the initial part of the string pointed to by <[s1]> which consists entirely of diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c index d5f0a3ec9..8da7d5185 100644 --- a/newlib/libc/string/strerror.c +++ b/newlib/libc/string/strerror.c @@ -15,18 +15,13 @@ INDEX INDEX strerror_l -ANSI_SYNOPSIS +SYNOPSIS #include char *strerror(int <[errnum]>); char *strerror_l(int <[errnum]>, locale_t <[locale]>); char *_strerror_r(struct _reent <[ptr]>, int <[errnum]>, int <[internal]>, int *<[error]>); -TRAD_SYNOPSIS - #include - char *strerror(<[errnum]>) - int <[errnum]>; - DESCRIPTION <> converts the error number <[errnum]> into a string. The value of <[errnum]> is usually a copy of <>. diff --git a/newlib/libc/string/strerror_r.c b/newlib/libc/string/strerror_r.c index d26a412a5..af9337563 100644 --- a/newlib/libc/string/strerror_r.c +++ b/newlib/libc/string/strerror_r.c @@ -6,7 +6,7 @@ FUNCTION INDEX strerror_r -ANSI_SYNOPSIS +SYNOPSIS #include #ifdef _GNU_SOURCE char *strerror_r(int <[errnum]>, char *<[buffer]>, size_t <[n]>); @@ -14,13 +14,6 @@ ANSI_SYNOPSIS int strerror_r(int <[errnum]>, char *<[buffer]>, size_t <[n]>); #endif -TRAD_SYNOPSIS - #include - char *strerror_r(<[errnum]>, <[buffer]>, <[n]>) - int <[errnum]>; - char *<[buffer]>; - size_t <[n]>; - DESCRIPTION <> converts the error number <[errnum]> into a string and copies the result into the supplied <[buffer]> for diff --git a/newlib/libc/string/strlen.c b/newlib/libc/string/strlen.c index a796d2738..2e8c09f7f 100644 --- a/newlib/libc/string/strlen.c +++ b/newlib/libc/string/strlen.c @@ -5,15 +5,10 @@ FUNCTION INDEX strlen -ANSI_SYNOPSIS +SYNOPSIS #include size_t strlen(const char *<[str]>); -TRAD_SYNOPSIS - #include - size_t strlen(<[str]>) - char *<[src]>; - DESCRIPTION The <> function works out the length of the string starting at <<*<[str]>>> by counting chararacters until it diff --git a/newlib/libc/string/strlwr.c b/newlib/libc/string/strlwr.c index 3b73dba4b..c47ff4859 100644 --- a/newlib/libc/string/strlwr.c +++ b/newlib/libc/string/strlwr.c @@ -5,15 +5,10 @@ FUNCTION INDEX strlwr -ANSI_SYNOPSIS +SYNOPSIS #include char *strlwr(char *<[a]>); -TRAD_SYNOPSIS - #include - char *strlwr(<[a]>) - char *<[a]>; - DESCRIPTION <> converts each character in the string at <[a]> to lowercase. diff --git a/newlib/libc/string/strncasecmp.c b/newlib/libc/string/strncasecmp.c index 828f30bf9..c06294232 100644 --- a/newlib/libc/string/strncasecmp.c +++ b/newlib/libc/string/strncasecmp.c @@ -5,17 +5,10 @@ FUNCTION INDEX strncasecmp -ANSI_SYNOPSIS +SYNOPSIS #include int strncasecmp(const char *<[a]>, const char * <[b]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - int strncasecmp(<[a]>, <[b]>, <[length]>) - char *<[a]>; - char *<[b]>; - size_t <[length]> - DESCRIPTION <> compares up to <[length]> characters from the string at <[a]> to the string at <[b]> in a diff --git a/newlib/libc/string/strncasecmp_l.c b/newlib/libc/string/strncasecmp_l.c index 41ae58265..b15c6c545 100644 --- a/newlib/libc/string/strncasecmp_l.c +++ b/newlib/libc/string/strncasecmp_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX strncasecmp_l -ANSI_SYNOPSIS +SYNOPSIS #include int strncasecmp_l(const char *<[a]>, const char * <[b]>, size_t <[length]>, locale_t <[locale]>); diff --git a/newlib/libc/string/strncat.c b/newlib/libc/string/strncat.c index 2f5a061bf..761cf87a7 100644 --- a/newlib/libc/string/strncat.c +++ b/newlib/libc/string/strncat.c @@ -5,18 +5,11 @@ FUNCTION INDEX strncat -ANSI_SYNOPSIS +SYNOPSIS #include char *strncat(char *restrict <[dst]>, const char *restrict <[src]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - char *strncat(<[dst]>, <[src]>, <[length]>) - char *<[dst]>; - char *<[src]>; - size_t <[length]>; - DESCRIPTION <> appends not more than <[length]> characters from the string pointed to by <[src]> (including the terminating diff --git a/newlib/libc/string/strncmp.c b/newlib/libc/string/strncmp.c index 9801b7d92..3bbe47bcc 100644 --- a/newlib/libc/string/strncmp.c +++ b/newlib/libc/string/strncmp.c @@ -5,17 +5,10 @@ FUNCTION INDEX strncmp -ANSI_SYNOPSIS +SYNOPSIS #include int strncmp(const char *<[a]>, const char * <[b]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - int strncmp(<[a]>, <[b]>, <[length]>) - char *<[a]>; - char *<[b]>; - size_t <[length]> - DESCRIPTION <> compares up to <[length]> characters from the string at <[a]> to the string at <[b]>. diff --git a/newlib/libc/string/strncpy.c b/newlib/libc/string/strncpy.c index ff5d0d409..83596f408 100644 --- a/newlib/libc/string/strncpy.c +++ b/newlib/libc/string/strncpy.c @@ -5,18 +5,11 @@ FUNCTION INDEX strncpy -ANSI_SYNOPSIS +SYNOPSIS #include char *strncpy(char *restrict <[dst]>, const char *restrict <[src]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - char *strncpy(<[dst]>, <[src]>, <[length]>) - char *<[dst]>; - char *<[src]>; - size_t <[length]>; - DESCRIPTION <> copies not more than <[length]> characters from the the string pointed to by <[src]> (including the terminating diff --git a/newlib/libc/string/strnlen.c b/newlib/libc/string/strnlen.c index ed60e9371..07ece0d8b 100644 --- a/newlib/libc/string/strnlen.c +++ b/newlib/libc/string/strnlen.c @@ -5,16 +5,10 @@ FUNCTION INDEX strnlen -ANSI_SYNOPSIS +SYNOPSIS #include size_t strnlen(const char *<[str]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - size_t strnlen(<[str]>, <[n]>) - char *<[src]>; - size_t <[n]>; - DESCRIPTION The <> function works out the length of the string starting at <<*<[str]>>> by counting chararacters until it diff --git a/newlib/libc/string/strnstr.c b/newlib/libc/string/strnstr.c index 947355fed..cb5f71914 100644 --- a/newlib/libc/string/strnstr.c +++ b/newlib/libc/string/strnstr.c @@ -5,7 +5,7 @@ FUNCTION INDEX strnstr -ANSI_SYNOPSIS +SYNOPSIS #include size_t strnstr(const char *<[s1]>, const char *<[s2]>, size_t <[n]>); diff --git a/newlib/libc/string/strpbrk.c b/newlib/libc/string/strpbrk.c index 5668db395..4507a86a4 100644 --- a/newlib/libc/string/strpbrk.c +++ b/newlib/libc/string/strpbrk.c @@ -5,16 +5,10 @@ FUNCTION INDEX strpbrk -ANSI_SYNOPSIS +SYNOPSIS #include char *strpbrk(const char *<[s1]>, const char *<[s2]>); -TRAD_SYNOPSIS - #include - char *strpbrk(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - DESCRIPTION This function locates the first occurence in the string pointed to by <[s1]> of any character in string pointed to by diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c index 4f903afe2..8217c6df3 100644 --- a/newlib/libc/string/strrchr.c +++ b/newlib/libc/string/strrchr.c @@ -5,16 +5,10 @@ FUNCTION INDEX strrchr -ANSI_SYNOPSIS +SYNOPSIS #include char * strrchr(const char *<[string]>, int <[c]>); -TRAD_SYNOPSIS - #include - char * strrchr(<[string]>, <[c]>); - char *<[string]>; - int *<[c]>; - DESCRIPTION This function finds the last occurence of <[c]> (converted to a char) in the string pointed to by <[string]> (including the diff --git a/newlib/libc/string/strsignal.c b/newlib/libc/string/strsignal.c index e32c9a7be..86a0e5dd9 100644 --- a/newlib/libc/string/strsignal.c +++ b/newlib/libc/string/strsignal.c @@ -5,15 +5,10 @@ FUNCTION INDEX strsignal -ANSI_SYNOPSIS +SYNOPSIS #include char *strsignal(int <[signal]>); -TRAD_SYNOPSIS - #include - char *strsignal(<[signal]>) - int <[signal]>; - DESCRIPTION <> converts the signal number <[signal]> into a string. If <[signal]> is not a known signal number, the result diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c index 32b921b10..3f43b8f82 100644 --- a/newlib/libc/string/strspn.c +++ b/newlib/libc/string/strspn.c @@ -5,16 +5,10 @@ FUNCTION INDEX strspn -ANSI_SYNOPSIS +SYNOPSIS #include size_t strspn(const char *<[s1]>, const char *<[s2]>); -TRAD_SYNOPSIS - #include - size_t strspn(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - DESCRIPTION This function computes the length of the initial segment of the string pointed to by <[s1]> which consists entirely of diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c index 0480bce0a..288c74466 100644 --- a/newlib/libc/string/strstr.c +++ b/newlib/libc/string/strstr.c @@ -5,16 +5,10 @@ FUNCTION INDEX strstr -ANSI_SYNOPSIS +SYNOPSIS #include char *strstr(const char *<[s1]>, const char *<[s2]>); -TRAD_SYNOPSIS - #include - char *strstr(<[s1]>, <[s2]>) - char *<[s1]>; - char *<[s2]>; - DESCRIPTION Locates the first occurrence in the string pointed to by <[s1]> of the sequence of characters in the string pointed to by <[s2]> diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c index 8d07ab387..a24c538e4 100644 --- a/newlib/libc/string/strtok.c +++ b/newlib/libc/string/strtok.c @@ -11,7 +11,7 @@ INDEX INDEX strsep -ANSI_SYNOPSIS +SYNOPSIS #include char *strtok(char *restrict <[source]>, const char *restrict <[delimiters]>); @@ -20,21 +20,6 @@ ANSI_SYNOPSIS char **<[lasts]>); char *strsep(char **<[source_ptr]>, const char *<[delimiters]>); -TRAD_SYNOPSIS - #include - char *strtok(<[source]>, <[delimiters]>); - char *<[source]>; - char *<[delimiters]>; - - char *strtok_r(<[source]>, <[delimiters]>, <[lasts]>); - char *<[source]>; - char *<[delimiters]>; - char **<[lasts]>; - - char *strsep(<[source_ptr]>, <[delimiters]>); - char **<[source_ptr]>; - char *<[delimiters]>; - DESCRIPTION The <> function is used to isolate sequential tokens in a null-terminated string, <<*<[source]>>>. These tokens are delimited diff --git a/newlib/libc/string/strupr.c b/newlib/libc/string/strupr.c index 350618e78..dbec79e46 100644 --- a/newlib/libc/string/strupr.c +++ b/newlib/libc/string/strupr.c @@ -5,15 +5,10 @@ FUNCTION INDEX strupr -ANSI_SYNOPSIS +SYNOPSIS #include char *strupr(char *<[a]>); -TRAD_SYNOPSIS - #include - char *strupr(<[a]>) - char *<[a]>; - DESCRIPTION <> converts each character in the string at <[a]> to uppercase. diff --git a/newlib/libc/string/strverscmp.c b/newlib/libc/string/strverscmp.c index 83f053222..04aa7213a 100644 --- a/newlib/libc/string/strverscmp.c +++ b/newlib/libc/string/strverscmp.c @@ -5,18 +5,11 @@ FUNCTION INDEX strverscmp -ANSI_SYNOPSIS +SYNOPSIS #define _GNU_SOURCE #include int strverscmp(const char *<[a]>, const char *<[b]>); -TRAD_SYNOPSIS - #define _GNU_SOURCE - #include - int strverscmp(<[a]>, <[b]>) - char *<[a]>; - char *<[b]>; - DESCRIPTION <> compares the string at <[a]> to the string at <[b]> in a version-logical order. diff --git a/newlib/libc/string/strxfrm.c b/newlib/libc/string/strxfrm.c index edc1272de..de397210b 100644 --- a/newlib/libc/string/strxfrm.c +++ b/newlib/libc/string/strxfrm.c @@ -5,18 +5,11 @@ FUNCTION INDEX strxfrm -ANSI_SYNOPSIS +SYNOPSIS #include size_t strxfrm(char *restrict <[s1]>, const char *restrict <[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - size_t strxfrm(<[s1]>, <[s2]>, <[n]>); - char *<[s1]>; - char *<[s2]>; - size_t <[n]>; - DESCRIPTION This function transforms the string pointed to by <[s2]> and places the resulting string into the array pointed to by diff --git a/newlib/libc/string/strxfrm_l.c b/newlib/libc/string/strxfrm_l.c index a1f4fe295..0ac52432c 100644 --- a/newlib/libc/string/strxfrm_l.c +++ b/newlib/libc/string/strxfrm_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX strxfrm_l -ANSI_SYNOPSIS +SYNOPSIS #include size_t strxfrm_l(char *restrict <[s1]>, const char *restrict <[s2]>, size_t <[n]>, locale_t <[locale]>); diff --git a/newlib/libc/string/swab.c b/newlib/libc/string/swab.c index aee076319..ecf5abed9 100644 --- a/newlib/libc/string/swab.c +++ b/newlib/libc/string/swab.c @@ -2,16 +2,10 @@ FUNCTION <>---swap adjacent bytes -ANSI_SYNOPSIS +SYNOPSIS #include void swab(const void *<[in]>, void *<[out]>, ssize_t <[n]>); -TRAD_SYNOPSIS - void swab(<[in]>, <[out]>, <[n]> - void *<[in]>; - void *<[out]>; - ssize_t <[n]>; - DESCRIPTION This function copies <[n]> bytes from the memory region pointed to by <[in]> to the memory region pointed to by diff --git a/newlib/libc/string/wcpcpy.c b/newlib/libc/string/wcpcpy.c index e1d9ad073..f0f9c4a08 100644 --- a/newlib/libc/string/wcpcpy.c +++ b/newlib/libc/string/wcpcpy.c @@ -2,15 +2,10 @@ FUNCTION <>---copy a wide-character string returning a pointer to its end -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcpcpy(wchar_t *<[s1]>, const wchar_t *<[s2]>); -TRAD_SYNOPSIS - wchar_t *wcpcpy(<[s1]>, <[s2]> - wchar_t *__restrict <[s1]>; - const wchar_t *__restrict <[s2]>; - DESCRIPTION The <> function copies the wide-character string pointed to by <[s2]> (including the terminating null wide-character code) into the diff --git a/newlib/libc/string/wcpncpy.c b/newlib/libc/string/wcpncpy.c index 87843b422..8f7ee796f 100644 --- a/newlib/libc/string/wcpncpy.c +++ b/newlib/libc/string/wcpncpy.c @@ -2,17 +2,11 @@ FUNCTION <>---copy part of a wide-character string returning a pointer to its end -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcpncpy(wchar_t *__restrict <[s1]>, const wchar_t *__restrict <[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wcpncpy(<[s1]>, <[s2]>, <[n]> - wchar_t *__restrict <[s1]>; - const wchar_t *__restrict <[s2]>; - size_t <[n]>; - DESCRIPTION The <> function copies not more than n wide-character codes (wide-character codes that follow a null wide-character code are not diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c index 05f95619d..26c7cc237 100644 --- a/newlib/libc/string/wcscasecmp.c +++ b/newlib/libc/string/wcscasecmp.c @@ -5,16 +5,10 @@ FUNCTION INDEX wcscasecmp -ANSI_SYNOPSIS +SYNOPSIS #include int wcscasecmp(const wchar_t *<[a]>, const wchar_t *<[b]>); -TRAD_SYNOPSIS - #include - int wcscasecmp(<[a]>, <[b]>) - wchar_t *<[a]>; - wchar_t *<[b]>; - DESCRIPTION <> compares the wide character string at <[a]> to the wide character string at <[b]> in a case-insensitive manner. diff --git a/newlib/libc/string/wcscasecmp_l.c b/newlib/libc/string/wcscasecmp_l.c index 329be0529..3c58d8f50 100644 --- a/newlib/libc/string/wcscasecmp_l.c +++ b/newlib/libc/string/wcscasecmp_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX wcscasecmp_l -ANSI_SYNOPSIS +SYNOPSIS #include int wcscasecmp_l(const wchar_t *<[a]>, const wchar_t *<[b]>, locale_t <[locale]>); diff --git a/newlib/libc/string/wcscat.c b/newlib/libc/string/wcscat.c index 11afbe3a6..586512d0f 100644 --- a/newlib/libc/string/wcscat.c +++ b/newlib/libc/string/wcscat.c @@ -4,16 +4,11 @@ FUNCTION INDEX wcscat -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcscat(wchar_t *__restrict <[s1]>, const wchar_t *__restrict <[s2]>); -TRAD_SYNOPSIS - wchar_t *wcscat(<[s1]>, <[s2]> - wchar_t *__restrict <[s1]>; - const wchar_t *__restrict <[s2]>; - DESCRIPTION The <> function appends a copy of the wide-character string pointed to by <[s2]> (including the terminating null wide-character diff --git a/newlib/libc/string/wcschr.c b/newlib/libc/string/wcschr.c index fb35d1f42..c705a08d5 100644 --- a/newlib/libc/string/wcschr.c +++ b/newlib/libc/string/wcschr.c @@ -2,15 +2,10 @@ FUNCTION <>---wide-character string scanning operation -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcschr(const wchar_t *<[s]>, wchar_t <[c]>); -TRAD_SYNOPSIS - wchar_t *wcschr(<[s]>, <[c]> - const wchar_t *<[s]>; - wchar_t <[c]>; - DESCRIPTION The <> function locates the first occurrence of <[c]> in the wide-character string pointed to by <[s]>. The value of <[c]> must be a diff --git a/newlib/libc/string/wcscmp.c b/newlib/libc/string/wcscmp.c index 03089620d..8155742b8 100644 --- a/newlib/libc/string/wcscmp.c +++ b/newlib/libc/string/wcscmp.c @@ -2,14 +2,10 @@ FUNCTION <>---compare two wide-character strings -ANSI_SYNOPSIS +SYNOPSIS #include int wcscmp(const wchar_t *<[s1]>, *<[s2]>); -TRAD_SYNOPSIS - int wcscmp(<[s1]>, <[s2]> - const wchar_t *<[s1]>, <[s2]>; - DESCRIPTION The <> function compares the wide-character string pointed to by <[s1]> to the wide-character string pointed to by <[s2]>. diff --git a/newlib/libc/string/wcscoll.c b/newlib/libc/string/wcscoll.c index 726f4ca0b..020f7e57f 100644 --- a/newlib/libc/string/wcscoll.c +++ b/newlib/libc/string/wcscoll.c @@ -5,16 +5,10 @@ FUNCTION INDEX wcscoll -ANSI_SYNOPSIS +SYNOPSIS #include int wcscoll(const wchar_t *<[stra]>, const wchar_t * <[strb]>); -TRAD_SYNOPSIS - #include - int wcscoll(<[stra]>, <[strb]>) - wchar_t *<[stra]>; - wchar_t *<[strb]>; - DESCRIPTION <> compares the wide-character string pointed to by <[stra]> to the wide-character string pointed to by <[strb]>, diff --git a/newlib/libc/string/wcscoll_l.c b/newlib/libc/string/wcscoll_l.c index e71d02a75..2c9df5244 100644 --- a/newlib/libc/string/wcscoll_l.c +++ b/newlib/libc/string/wcscoll_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX wcscoll_l -ANSI_SYNOPSIS +SYNOPSIS #include int wcscoll_l(const wchar_t *<[stra]>, const wchar_t * <[strb]>, locale_t <[locale]>); diff --git a/newlib/libc/string/wcscpy.c b/newlib/libc/string/wcscpy.c index ed8b484bc..79f065ca0 100644 --- a/newlib/libc/string/wcscpy.c +++ b/newlib/libc/string/wcscpy.c @@ -2,16 +2,11 @@ FUNCTION <>---copy a wide-character string -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcscpy(wchar_t *__restrict <[s1]>, const wchar_t *__restrict <[s2]>); -TRAD_SYNOPSIS - wchar_t *wcscpy(<[s1]>, <[s2]> - wchar_t *__restrict <[s1]>; - const wchar_t *__restrict <[s2]>; - DESCRIPTION The <> function copies the wide-character string pointed to by <[s2]> (including the terminating null wide-character code) into the diff --git a/newlib/libc/string/wcscspn.c b/newlib/libc/string/wcscspn.c index 5ab965690..7be5f5eee 100644 --- a/newlib/libc/string/wcscspn.c +++ b/newlib/libc/string/wcscspn.c @@ -2,15 +2,10 @@ FUNCTION <>---get length of a complementary wide substring -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcscspn(const wchar_t *<[s]>, wchar_t *<[set]>); -TRAD_SYNOPSIS - size_t wcscspn(<[s]>, <[set]> - const wchar_t *<[s]>; - const wchar_t *<[set]>; - DESCRIPTION The <> function computes the length of the maximum initial segment of the wide-character string pointed to by <[s]> which consists diff --git a/newlib/libc/string/wcsdup.c b/newlib/libc/string/wcsdup.c index 90be68e02..e0e97c0bd 100644 --- a/newlib/libc/string/wcsdup.c +++ b/newlib/libc/string/wcsdup.c @@ -7,19 +7,13 @@ INDEX INDEX _wcsdup_r -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcsdup(const wchar_t *<[str]>); #include wchar_t *_wcsdup_r(struct _reent *<[ptr]>, const wchar_t *<[str]>); -TRAD_SYNOPSIS - #include - wchar_t *wcsdup(<[ptr]>, <[str]>) - struct _reent *<[ptr]>; - wchar_t *<[str]>; - DESCRIPTION <> allocates a new wide character string using <>, and copies the content of the argument <[str]> into the newly diff --git a/newlib/libc/string/wcslcat.c b/newlib/libc/string/wcslcat.c index 75c085b5b..2caa58820 100644 --- a/newlib/libc/string/wcslcat.c +++ b/newlib/libc/string/wcslcat.c @@ -2,17 +2,10 @@ FUNCTION <>---concatenate wide-character strings to specified length -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcslcat(wchar_t *<[dst]>, const wchar_t *<[src]>, size_t <[siz]>); -TRAD_SYNOPSIS - #include - size_t wcslcat(<[dst]>, <[src]>, <[siz]> - wchar_t *<[dst]>; - const wchar_t *<[src]>; - size_t <[siz]>; - DESCRIPTION The <> function appends wide characters from <[src]> to end of the <[dst]> wide-character string so that the resultant diff --git a/newlib/libc/string/wcslcpy.c b/newlib/libc/string/wcslcpy.c index 21c030b38..34352fb9d 100644 --- a/newlib/libc/string/wcslcpy.c +++ b/newlib/libc/string/wcslcpy.c @@ -2,17 +2,10 @@ FUNCTION <>---copy a wide-character string to specified length -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcslcpy(wchar_t *<[dst]>, const wchar_t *<[src]>, size_t <[siz]>); -TRAD_SYNOPSIS - #include - size_t wcslcpy(<[dst]>, <[src]>, <[siz]>) - wchar_t *<[dst]>; - const wchar_t *<[src]>; - size_t <[siz]>; - DESCRIPTION <> copies wide characters from <[src]> to <[dst]> such that up to <[siz]> - 1 characters are copied. A diff --git a/newlib/libc/string/wcslen.c b/newlib/libc/string/wcslen.c index d671551af..ebef17285 100644 --- a/newlib/libc/string/wcslen.c +++ b/newlib/libc/string/wcslen.c @@ -2,14 +2,10 @@ FUNCTION <>---get wide-character string length -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcslen(const wchar_t *<[s]>); -TRAD_SYNOPSIS - size_t wcslen(<[s]> - const wchar_t *<[s]>; - DESCRIPTION The <> function computes the number of wide-character codes in the wide-character string to which <[s]> points, not including the diff --git a/newlib/libc/string/wcsncasecmp.c b/newlib/libc/string/wcsncasecmp.c index c6fc08ef6..a339bbfa5 100644 --- a/newlib/libc/string/wcsncasecmp.c +++ b/newlib/libc/string/wcsncasecmp.c @@ -5,17 +5,10 @@ FUNCTION INDEX wcsncasecmp -ANSI_SYNOPSIS +SYNOPSIS #include int wcsncasecmp(const wchar_t *<[a]>, const wchar_t * <[b]>, size_t <[length]>); -TRAD_SYNOPSIS - #include - int wcsncasecmp(<[a]>, <[b]>, <[length]>) - wchar_t *<[a]>; - wchar_t *<[b]>; - size_t <[length]> - DESCRIPTION <> compares up to <[length]> wide characters from the string at <[a]> to the string at <[b]> in a diff --git a/newlib/libc/string/wcsncasecmp_l.c b/newlib/libc/string/wcsncasecmp_l.c index 4b360b802..f276635d7 100644 --- a/newlib/libc/string/wcsncasecmp_l.c +++ b/newlib/libc/string/wcsncasecmp_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX wcsncasecmp_l -ANSI_SYNOPSIS +SYNOPSIS #include int wcsncasecmp_l(const wchar_t *<[a]>, const wchar_t * <[b]>, size_t <[length]>, locale_t <[locale]>); diff --git a/newlib/libc/string/wcsncat.c b/newlib/libc/string/wcsncat.c index b73f6e93e..34a694790 100644 --- a/newlib/libc/string/wcsncat.c +++ b/newlib/libc/string/wcsncat.c @@ -2,17 +2,11 @@ FUNCTION <>---concatenate part of two wide-character strings -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcsncat(wchar_t *__restrict <[s1]>, const wchar_t *__restrict <[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wcsncat(<[s1]>, <[s2]>, <[n]> - wchar_t *__restrict <[s1]>; - const wchar_t *__restrict <[s2]>; - size_t <[n]>; - DESCRIPTION The <> function appends not more than <[n]> wide-character codes (a null wide-character code and wide-character codes that follow diff --git a/newlib/libc/string/wcsncmp.c b/newlib/libc/string/wcsncmp.c index 1897f5c4e..72c5d1291 100644 --- a/newlib/libc/string/wcsncmp.c +++ b/newlib/libc/string/wcsncmp.c @@ -2,16 +2,10 @@ FUNCTION <>---compare part of two wide-character strings -ANSI_SYNOPSIS +SYNOPSIS #include int wcsncmp(const wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - int wcsncmp(<[s1]>, <[s2]>, <[n]> - const wchar_t *<[s1]>; - const wchar_t *<[s2]>; - size_t <[n]>; - DESCRIPTION The <> function compares not more than <[n]> wide-character codes (wide-character codes that follow a null wide-character code are diff --git a/newlib/libc/string/wcsncpy.c b/newlib/libc/string/wcsncpy.c index 3d6d70b7d..793e522da 100644 --- a/newlib/libc/string/wcsncpy.c +++ b/newlib/libc/string/wcsncpy.c @@ -2,17 +2,11 @@ FUNCTION <>---copy part of a wide-character string -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcsncpy(wchar_t *__restrict <[s1]>, const wchar_t *__restrict <[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wcsncpy(<[s1]>, <[s2]>, <[n]> - wchar_t *__restrict <[s1]>; - const wchar_t *__restrict <[s2]>; - size_t <[n]>; - DESCRIPTION The <> function copies not more than <[n]> wide-character codes (wide-character codes that follow a null wide-character code are not diff --git a/newlib/libc/string/wcsnlen.c b/newlib/libc/string/wcsnlen.c index 9d680d603..77aad65a3 100644 --- a/newlib/libc/string/wcsnlen.c +++ b/newlib/libc/string/wcsnlen.c @@ -5,16 +5,10 @@ FUNCTION INDEX wcsnlen -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcsnlen(const wchar_t *<[s]>, size_t <[maxlen]>); -TRAD_SYNOPSIS - #include - size_t wcsnlen(<[s]>, <[maxlen]>) - wchar_t *<[s]>; - size_t <[maxlen]>; - DESCRIPTION The <> function computes the number of wide-character codes in the wide-character string pointed to by <[s]> not including the diff --git a/newlib/libc/string/wcspbrk.c b/newlib/libc/string/wcspbrk.c index fbdf9e49c..55401f1a9 100644 --- a/newlib/libc/string/wcspbrk.c +++ b/newlib/libc/string/wcspbrk.c @@ -2,15 +2,10 @@ FUNCTION <>----scan wide-character string for a wide-character code -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcspbrk(const wchar_t *<[s]>, const wchar_t *<[set]>); -TRAD_SYNOPSIS - wchar_t *wcspbrk(<[s]>, <[set]> - const wchar_t *<[s]>; - const wchar_t *<[set]>; - DESCRIPTION The <> function locates the first occurrence in the wide-character string pointed to by <[s]> of any wide-character code diff --git a/newlib/libc/string/wcsrchr.c b/newlib/libc/string/wcsrchr.c index 495d95a15..b99cb9760 100644 --- a/newlib/libc/string/wcsrchr.c +++ b/newlib/libc/string/wcsrchr.c @@ -2,16 +2,10 @@ FUNCTION <>---wide-character string scanning operation -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcsrchr(const wchar_t *<[s]>, wchar_t <[c]>); -TRAD_SYNOPSIS - #include - wchar_t *wcsrchr(<[s]>, <[c]> - const wchar_t *<[s]>; - wchar_t <[c]>; - DESCRIPTION The <> function locates the last occurrence of <[c]> in the wide-character string pointed to by <[s]>. The value of <[c]> must be a diff --git a/newlib/libc/string/wcsspn.c b/newlib/libc/string/wcsspn.c index e83f42f4f..652d971dd 100644 --- a/newlib/libc/string/wcsspn.c +++ b/newlib/libc/string/wcsspn.c @@ -2,15 +2,10 @@ FUNCTION <>---get length of a wide substring -ANSI_SYNOPSIS +SYNOPSIS #include size_t wcsspn(const wchar_t *<[s]>, const wchar_t *<[set]>); -TRAD_SYNOPSIS - size_t wcsspn(<[s]>, <[set]> - const wchar_t *<[s]>; - const wchar_t *<[set]>; - DESCRIPTION The <> function computes the length of the maximum initial segment of the wide-character string pointed to by <[s]> which consists diff --git a/newlib/libc/string/wcsstr.c b/newlib/libc/string/wcsstr.c index 6e891120d..bb6e3eda8 100644 --- a/newlib/libc/string/wcsstr.c +++ b/newlib/libc/string/wcsstr.c @@ -2,16 +2,11 @@ FUNCTION <>---find a wide-character substring -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcsstr(const wchar_t *__restrict <[big]>, const wchar_t *__restrict <[little]>); -TRAD_SYNOPSIS - wchar_t *wcsstr(<[big]>, <[little]> - const wchar_t *__restrict <[big]>; - const wchar_t *__restrict <[little]>; - DESCRIPTION The <> function locates the first occurrence in the wide-character string pointed to by <[big]> of the sequence of diff --git a/newlib/libc/string/wcstok.c b/newlib/libc/string/wcstok.c index 144b33efd..091f4bd3e 100644 --- a/newlib/libc/string/wcstok.c +++ b/newlib/libc/string/wcstok.c @@ -6,19 +6,12 @@ INDEX wcstok -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wcstok(wchar_t *__restrict <[source]>, const wchar_t *__restrict <[delimiters]>, wchar_t **__restrict <[lasts]>); -TRAD_SYNOPSIS - #include - wchar_t *wcstok(<[source]>, <[delimiters]>, <[lasts]>); - wchar_t *__restrict <[source]>; - wchar_t *__restrict <[delimiters]>; - wchar_t **__restrict <[lasts]>; - DESCRIPTION The <> function is the wide-character equivalent of the <> function (which in turn is the same as the <> diff --git a/newlib/libc/string/wcswidth.c b/newlib/libc/string/wcswidth.c index 6c0efe63f..4cb8fa812 100644 --- a/newlib/libc/string/wcswidth.c +++ b/newlib/libc/string/wcswidth.c @@ -5,16 +5,10 @@ FUNCTION INDEX wcswidth -ANSI_SYNOPSIS +SYNOPSIS #include int wcswidth(const wchar_t *<[pwcs]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - int wcswidth(<[pwcs]>, <[n]>) - wchar_t *<[wc]>; - size_t <[n]>; - DESCRIPTION The <> function shall determine the number of column positions required for <[n]> wide-character codes (or fewer than <[n]> diff --git a/newlib/libc/string/wcsxfrm.c b/newlib/libc/string/wcsxfrm.c index d267d274f..e11516ff4 100644 --- a/newlib/libc/string/wcsxfrm.c +++ b/newlib/libc/string/wcsxfrm.c @@ -5,18 +5,11 @@ FUNCTION INDEX wcsxfrm -ANSI_SYNOPSIS +SYNOPSIS #include int wcsxfrm(wchar_t *__restrict <[stra]>, const wchar_t *__restrict <[strb]>, size_t <[n]>); -TRAD_SYNOPSIS - #include - size_t wcsxfrm(<[stra]>, <[strb]>, <[n]>) - wchar_t *__restrict <[stra]>; - wchar_t *__restrict <[strb]>; - size_t <[n]> - DESCRIPTION <> transforms the wide-character string pointed to by <[strb]> to the wide-character string pointed to by <[stra]>, diff --git a/newlib/libc/string/wcsxfrm_l.c b/newlib/libc/string/wcsxfrm_l.c index c44b0d639..bfc4ae56b 100644 --- a/newlib/libc/string/wcsxfrm_l.c +++ b/newlib/libc/string/wcsxfrm_l.c @@ -5,7 +5,7 @@ FUNCTION INDEX wcsxfrm_l -ANSI_SYNOPSIS +SYNOPSIS #include int wcsxfrm_l(wchar_t *__restrict <[stra]>, const wchar_t *__restrict <[strb]>, size_t <[n]>, diff --git a/newlib/libc/string/wcwidth.c b/newlib/libc/string/wcwidth.c index ac5c47f67..acb15d0dc 100644 --- a/newlib/libc/string/wcwidth.c +++ b/newlib/libc/string/wcwidth.c @@ -5,15 +5,10 @@ FUNCTION INDEX wcwidth -ANSI_SYNOPSIS +SYNOPSIS #include int wcwidth(const wchar_t <[wc]>); -TRAD_SYNOPSIS - #include - int wcwidth(<[wc]>) - wchar_t *<[wc]>; - DESCRIPTION The <> function shall determine the number of column positions required for the wide character <[wc]>. The application diff --git a/newlib/libc/string/wmemchr.c b/newlib/libc/string/wmemchr.c index b582b8948..097e47a03 100644 --- a/newlib/libc/string/wmemchr.c +++ b/newlib/libc/string/wmemchr.c @@ -3,16 +3,10 @@ FUNCTION <>---find a wide character in memory -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wmemchr(const wchar_t *<[s]>, wchar_t <[c]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wmemchr(<[s]>, <[c]>, <[n]> - const wchar_t *<[s]>; - wchar_t <[c]>; - size_t <[n]>; - DESCRIPTION The <> function locates the first occurrence of <[c]> in the initial <[n]> wide characters of the object pointed to be <[s]>. This diff --git a/newlib/libc/string/wmemcmp.c b/newlib/libc/string/wmemcmp.c index af9ee3207..a01bf32f1 100644 --- a/newlib/libc/string/wmemcmp.c +++ b/newlib/libc/string/wmemcmp.c @@ -2,16 +2,10 @@ FUNCTION <>---compare wide characters in memory -ANSI_SYNOPSIS +SYNOPSIS #include int wmemcmp(const wchar_t *<[s1]>, const wchar_t *<[s2]>, size_t <[n]>); -TRAD_SYNOPSIS - int wmemcmp(<[s1]>, <[s2]>, <[n]> - const wchar_t *<[s1]>; - const wchar_t *<[s2]>; - size_t <[n]>; - DESCRIPTION The <> function compares the first <[n]> wide characters of the object pointed to by <[s1]> to the first <[n]> wide characters of the diff --git a/newlib/libc/string/wmemcpy.c b/newlib/libc/string/wmemcpy.c index a57d6a512..0e8d6e494 100644 --- a/newlib/libc/string/wmemcpy.c +++ b/newlib/libc/string/wmemcpy.c @@ -2,17 +2,11 @@ FUNCTION <>---copy wide characters in memory -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wmemcpy(wchar_t *__restrict <[d]>, const wchar_t *__restrict <[s]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wmemcpy(<[d]>, <[s]>, <[n]> - wchar_t *__restrict <[d]>; - const wchar_t *__restrict <[s]>; - size_t <[n]>; - DESCRIPTION The <> function copies <[n]> wide characters from the object pointed to by <[s]> to the object pointed to be <[d]>. This function diff --git a/newlib/libc/string/wmemmove.c b/newlib/libc/string/wmemmove.c index e20a26ae9..18d2a2bfd 100644 --- a/newlib/libc/string/wmemmove.c +++ b/newlib/libc/string/wmemmove.c @@ -2,16 +2,10 @@ FUNCTION <>---copy wide characters in memory with overlapping areas -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wmemmove(wchar_t *<[d]>, const wchar_t *<[s]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wmemmove(<[d]>, <[s]>, <[n]> - wchar_t *<[d]>; - const wchar_t *<[s]>; - size_t <[n]>; - DESCRIPTION The <> function copies <[n]> wide characters from the object pointed to by <[s]> to the object pointed to by <[d]>. Copying takes diff --git a/newlib/libc/string/wmemset.c b/newlib/libc/string/wmemset.c index 0af6f91d5..377fbee1f 100644 --- a/newlib/libc/string/wmemset.c +++ b/newlib/libc/string/wmemset.c @@ -2,16 +2,10 @@ FUNCTION <>---set wide characters in memory -ANSI_SYNOPSIS +SYNOPSIS #include wchar_t *wmemset(wchar_t *<[s]>, wchar_t <[c]>, size_t <[n]>); -TRAD_SYNOPSIS - wchar_t *wmemset(<[s]>, <[c]>, <[n]> - wchar_t *<[s]>; - wchar_t <[c]>; - size_t <[n]>; - DESCRIPTION The <> function copies the value of <[c]> into each of the first <[n]> wide characters of the object pointed to by <[s]>. This From adfde9d773faa2c17ada9480c7a6a744bbd10c1f Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:21:24 -0600 Subject: [PATCH 159/649] sys: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/sys/linux/getdate.c | 11 +---------- newlib/libc/sys/linux/pread64.c | 10 +--------- newlib/libc/sys/linux/pwrite64.c | 10 +--------- newlib/libc/sys/rdos/getenv.c | 7 +------ 4 files changed, 4 insertions(+), 34 deletions(-) diff --git a/newlib/libc/sys/linux/getdate.c b/newlib/libc/sys/linux/getdate.c index 5c056c750..0e689f99a 100644 --- a/newlib/libc/sys/linux/getdate.c +++ b/newlib/libc/sys/linux/getdate.c @@ -27,20 +27,11 @@ INDEX INDEX getdate_r -ANSI_SYNOPSIS +SYNOPSIS #include struct tm *getdate(const char *<[string]>); int getdate_r(const char *<[string]>, struct tm *<[res]>); -TRAD_SYNOPSIS - #include - struct tm *getdate(<[string]>); - const char *<[string]>; - - int getdate_r(<[string]>, <[res]>); - const char *<[string]>; - struct tm *<[res]>; - DESCRIPTION <> reads a file which is specified by the environment variable: DATEMSK. This file contains a number of formats valid for input to the diff --git a/newlib/libc/sys/linux/pread64.c b/newlib/libc/sys/linux/pread64.c index c4bdca706..3ced04818 100644 --- a/newlib/libc/sys/linux/pread64.c +++ b/newlib/libc/sys/linux/pread64.c @@ -5,18 +5,10 @@ FUNCTION INDEX pread64 -ANSI_SYNOPSIS +SYNOPSIS #include ssize_t pread64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>); -TRAD_SYNOPSIS - #include - ssize_t pread64(<[fd]>, <[buf]>, <[n]>, <[off]>) - int <[fd]>; - void *<[buf]>; - size_t <[n]>; - loff_t <[off]>; - DESCRIPTION The <> function is similar to <>. The only difference is that it operates on large files and so takes a 64-bit offset. Like <>>, diff --git a/newlib/libc/sys/linux/pwrite64.c b/newlib/libc/sys/linux/pwrite64.c index f1d678493..876749943 100644 --- a/newlib/libc/sys/linux/pwrite64.c +++ b/newlib/libc/sys/linux/pwrite64.c @@ -5,18 +5,10 @@ FUNCTION INDEX pwrite64 -ANSI_SYNOPSIS +SYNOPSIS #include ssize_t pwrite64(int <[fd]>, void *<[buf]>, size_t <[n]>, loff_t <[off]>); -TRAD_SYNOPSIS - #include - ssize_t pwrite64(<[fd]>, <[buf]>, <[n]>, <[off]>) - int <[fd]>; - void *<[buf]>; - size_t <[n]>; - loff_t <[off]>; - DESCRIPTION The <> function is similar to <>. The only difference is that it operates on large files and so takes a 64-bit offset. Like <>>, diff --git a/newlib/libc/sys/rdos/getenv.c b/newlib/libc/sys/rdos/getenv.c index 933ea4d76..1787769e3 100644 --- a/newlib/libc/sys/rdos/getenv.c +++ b/newlib/libc/sys/rdos/getenv.c @@ -32,15 +32,10 @@ INDEX INDEX environ -ANSI_SYNOPSIS +SYNOPSIS #include char *getenv(const char *<[name]>); -TRAD_SYNOPSIS - #include - char *getenv(<[name]>) - char *<[name]>; - DESCRIPTION <> searches the list of environment variable names and values (using the global pointer ``<>'') for a variable whose From 5aa2434de0a495a4df5af91f257fc6a8037fec5b Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 30 Nov 2017 02:22:31 -0600 Subject: [PATCH 160/649] time: remove TRAD_SYNOPSIS Signed-off-by: Yaakov Selkowitz --- newlib/libc/time/asctime.c | 10 +--------- newlib/libc/time/clock.c | 6 +----- newlib/libc/time/ctime.c | 11 +---------- newlib/libc/time/difftime.c | 8 +------- newlib/libc/time/gmtime.c | 10 +--------- newlib/libc/time/lcltime.c | 10 +--------- newlib/libc/time/mktime.c | 7 +------ newlib/libc/time/strftime.c | 10 +--------- newlib/libc/time/time.c | 7 +------ newlib/libc/time/tzlock.c | 6 +----- newlib/libc/time/tzset.c | 8 +------- newlib/libc/time/wcsftime.c | 2 +- 12 files changed, 12 insertions(+), 83 deletions(-) diff --git a/newlib/libc/time/asctime.c b/newlib/libc/time/asctime.c index f56b511b8..b9345f581 100644 --- a/newlib/libc/time/asctime.c +++ b/newlib/libc/time/asctime.c @@ -19,19 +19,11 @@ INDEX INDEX _asctime_r -ANSI_SYNOPSIS +SYNOPSIS #include char *asctime(const struct tm *<[clock]>); char *_asctime_r(const struct tm *<[clock]>, char *<[buf]>); -TRAD_SYNOPSIS - #include - char *asctime(<[clock]>) - struct tm *<[clock]>; - char *asctime_r(<[clock]>) - struct tm *<[clock]>; - char *<[buf]>; - DESCRIPTION Format the time value at <[clock]> into a string of the form . Wed Jun 15 11:38:07 1988\n\0 diff --git a/newlib/libc/time/clock.c b/newlib/libc/time/clock.c index 0bcfbb6d3..53ca208ee 100644 --- a/newlib/libc/time/clock.c +++ b/newlib/libc/time/clock.c @@ -25,14 +25,10 @@ FUNCTION INDEX clock -ANSI_SYNOPSIS +SYNOPSIS #include clock_t clock(void); -TRAD_SYNOPSIS - #include - clock_t clock(); - DESCRIPTION Calculates the best available approximation of the cumulative amount of time used by your program since it started. To convert the result diff --git a/newlib/libc/time/ctime.c b/newlib/libc/time/ctime.c index df070a858..160eb9948 100644 --- a/newlib/libc/time/ctime.c +++ b/newlib/libc/time/ctime.c @@ -12,20 +12,11 @@ INDEX INDEX ctime_r -ANSI_SYNOPSIS +SYNOPSIS #include char *ctime(const time_t *<[clock]>); char *ctime_r(const time_t *<[clock]>, char *<[buf]>); -TRAD_SYNOPSIS - #include - char *ctime(<[clock]>) - time_t *<[clock]>; - - char *ctime_r(<[clock]>, <[buf]>) - time_t *<[clock]>; - char *<[buf]>; - DESCRIPTION Convert the time value at <[clock]> to local time (like <>) and format it into a string of the form diff --git a/newlib/libc/time/difftime.c b/newlib/libc/time/difftime.c index de6ffdb5c..893fa4700 100644 --- a/newlib/libc/time/difftime.c +++ b/newlib/libc/time/difftime.c @@ -10,16 +10,10 @@ FUNCTION INDEX difftime -ANSI_SYNOPSIS +SYNOPSIS #include double difftime(time_t <[tim1]>, time_t <[tim2]>); -TRAD_SYNOPSIS - #include - double difftime(<[tim1]>, <[tim2]>) - time_t <[tim1]>; - time_t <[tim2]>; - DESCRIPTION Subtracts the two times in the arguments: `<<<[tim1]> - <[tim2]>>>'. diff --git a/newlib/libc/time/gmtime.c b/newlib/libc/time/gmtime.c index 141d20327..c62a212f7 100644 --- a/newlib/libc/time/gmtime.c +++ b/newlib/libc/time/gmtime.c @@ -17,19 +17,11 @@ INDEX INDEX gmtime_r -ANSI_SYNOPSIS +SYNOPSIS #include struct tm *gmtime(const time_t *<[clock]>); struct tm *gmtime_r(const time_t *<[clock]>, struct tm *<[res]>); -TRAD_SYNOPSIS - #include - struct tm *gmtime(<[clock]>) - const time_t *<[clock]>; - struct tm *gmtime_r(<[clock]>, <[res]>) - const time_t *<[clock]>; - struct tm *<[res]>; - DESCRIPTION <> takes the time at <[clock]> representing the number of elapsed seconds since 00:00:00 on January 1, 1970, Universal diff --git a/newlib/libc/time/lcltime.c b/newlib/libc/time/lcltime.c index 2c9a25fd7..0129335a5 100644 --- a/newlib/libc/time/lcltime.c +++ b/newlib/libc/time/lcltime.c @@ -11,19 +11,11 @@ INDEX INDEX localtime_r -ANSI_SYNOPSIS +SYNOPSIS #include struct tm *localtime(time_t *<[clock]>); struct tm *localtime_r(time_t *<[clock]>, struct tm *<[res]>); -TRAD_SYNOPSIS - #include - struct tm *localtime(<[clock]>) - time_t *<[clock]>; - struct tm *localtime(<[clock]>, <[res]>) - time_t *<[clock]>; - struct tm *<[res]>; - DESCRIPTION <> converts the time at <[clock]> into local time, then converts its representation from the arithmetic representation to the diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c index 44c0257f7..4849ea407 100644 --- a/newlib/libc/time/mktime.c +++ b/newlib/libc/time/mktime.c @@ -20,15 +20,10 @@ FUNCTION INDEX mktime -ANSI_SYNOPSIS +SYNOPSIS #include time_t mktime(struct tm *<[timp]>); -TRAD_SYNOPSIS - #include - time_t mktime(<[timp]>) - struct tm *<[timp]>; - DESCRIPTION <> assumes the time at <[timp]> is a local time, and converts its representation from the traditional representation defined by diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index 382318047..cf426d673 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -25,7 +25,7 @@ INDEX INDEX strftime_l -ANSI_SYNOPSIS +SYNOPSIS #include size_t strftime(char *restrict <[s]>, size_t <[maxsize]>, const char *restrict <[format]>, @@ -35,14 +35,6 @@ ANSI_SYNOPSIS const struct tm *restrict <[timp]>, locale_t <[locale]>); -TRAD_SYNOPSIS - #include - size_t strftime(<[s]>, <[maxsize]>, <[format]>, <[timp]>) - char *<[s]>; - size_t <[maxsize]>; - char *<[format]>; - struct tm *<[timp]>; - DESCRIPTION <> converts a <> representation of the time (at <[timp]>) into a null-terminated string, starting at <[s]> and occupying diff --git a/newlib/libc/time/time.c b/newlib/libc/time/time.c index 9de71d457..e0c3a8e74 100644 --- a/newlib/libc/time/time.c +++ b/newlib/libc/time/time.c @@ -5,15 +5,10 @@ FUNCTION INDEX time -ANSI_SYNOPSIS +SYNOPSIS #include time_t time(time_t *<[t]>); -TRAD_SYNOPSIS - #include - time_t time(<[t]>) - time_t *<[t]>; - DESCRIPTION < + +- scanf now handles the %l[ conversion. + + New API: wmempcpy. From 8f7c712bb8db2a811bf8b8c6628d4f83a2118cc7 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 1 Dec 2017 12:45:14 -0600 Subject: [PATCH 172/649] ssp: add Object Size Checking for wchar.h, part 1 The following functions are also guarded in glibc: fwprintf, swprintf, wprintf, vfwprintf, vswprintf, vwprintf. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/wchar.h | 97 +++++++++++++++++++++++++++++++++ newlib/libc/include/wchar.h | 4 ++ newlib/libc/ssp/ssp.tex | 8 +++ 3 files changed, 109 insertions(+) create mode 100644 newlib/libc/include/ssp/wchar.h diff --git a/newlib/libc/include/ssp/wchar.h b/newlib/libc/include/ssp/wchar.h new file mode 100644 index 000000000..39033cf39 --- /dev/null +++ b/newlib/libc/include/ssp/wchar.h @@ -0,0 +1,97 @@ +#ifndef _SSP_WCHAR_H_ +#define _SSP_WCHAR_H_ + +#include +#include + +#if __SSP_FORTIFY_LEVEL > 0 + +/* wide character variant, __wlen is number of wchar_t */ +#define __ssp_redirect_wc(rtype, fun, args, call, cond, bos) \ +__ssp_decl(rtype, fun, args) \ +{ \ + if (cond) \ + __ssp_check(__buf, __wlen * sizeof(wchar_t), bos); \ + return __ssp_real_(fun) call; \ +} + +#define __ssp_bos_wicheck3(fun) \ +__ssp_redirect_wc(wchar_t *, fun, \ + (wchar_t *__buf, const wchar_t *__src, size_t __wlen), \ + (__buf, __src, __wlen), 1, __ssp_bos0) + +#define __ssp_bos_wicheck3_restrict(fun) \ +__ssp_redirect_wc(wchar_t *, fun, \ + (wchar_t *__restrict __buf, const wchar_t *__restrict __src, size_t __wlen), \ + (__buf, __src, __wlen), 1, __ssp_bos0) + +#define __ssp_bos_wicheck2_restrict(fun) \ +__ssp_decl(wchar_t *, fun, (wchar_t *__restrict __buf, const wchar_t *__restrict __src)) \ +{ \ + __ssp_check(__buf, (wcslen(__src) + 1) * sizeof(wchar_t), __ssp_bos0); \ + return __ssp_real_(fun) (__buf, __src); \ +} + +__BEGIN_DECLS +#if __POSIX_VISIBLE >= 200809 +__ssp_bos_wicheck2_restrict(wcpcpy) +__ssp_bos_wicheck3_restrict(wcpncpy) +#endif +__ssp_bos_wicheck2_restrict(wcscpy) +__ssp_bos_wicheck2_restrict(wcscat) +__ssp_bos_wicheck3_restrict(wcsncpy) +__ssp_bos_wicheck3_restrict(wcsncat) +__ssp_bos_wicheck3_restrict(wmemcpy) +__ssp_bos_wicheck3(wmemmove) +#if __GNU_VISIBLE +__ssp_bos_wicheck3_restrict(wmempcpy) +#endif +__ssp_redirect_wc(wchar_t *, wmemset, \ + (wchar_t *__buf, wchar_t __src, size_t __wlen), \ + (__buf, __src, __wlen), 1, __ssp_bos0) + +__ssp_decl(size_t, wcrtomb, (char *__buf, wchar_t __src, mbstate_t *__ps)) +{ + if (__buf != NULL && __src != L'\0') + __ssp_check(__buf, sizeof(wchar_t), __ssp_bos); + return __ssp_real_wcrtomb (__buf, __src, __ps); +} + +__ssp_redirect_wc(size_t, mbsrtowcs, \ + (wchar_t *__buf, const char **__src, size_t __wlen, mbstate_t *__ps), \ + (__buf, __src, __wlen, __ps), __buf != NULL, __ssp_bos) + +__ssp_redirect_raw(size_t, wcsrtombs, \ + (char *__buf, const wchar_t **__src, size_t __len, mbstate_t *__ps), \ + (__buf, __src, __len, __ps), __buf != NULL, __ssp_bos) + +#if __POSIX_VISIBLE >= 200809 +__ssp_redirect_wc(size_t, mbsnrtowcs, \ + (wchar_t *__buf, const char **__src, size_t __nms, size_t __wlen, mbstate_t *__ps), \ + (__buf, __src, __nms, __wlen, __ps), __buf != NULL, __ssp_bos) + +__ssp_redirect_raw(size_t, wcsnrtombs, \ + (char *__buf, const wchar_t **__src, size_t __nwc, size_t __len, mbstate_t *__ps), \ + (__buf, __src, __nwc, __len, __ps), __buf != NULL, __ssp_bos) +#endif + +__ssp_decl(wchar_t *, fgetws, (wchar_t *__restrict __buf, int __wlen, FILE *__restrict __fp)) +{ + if (__wlen > 0) + __ssp_check(__buf, (size_t)__wlen * sizeof(wchar_t) , __ssp_bos); + return __ssp_real_fgetws(__buf, __wlen, __fp); +} + +#if __GNU_VISIBLE +__ssp_decl(wchar_t *, fgetws_unlocked, (wchar_t *__buf, int __wlen, FILE *__fp)) +{ + if (__wlen > 0) + __ssp_check(__buf, (size_t)__wlen * sizeof(wchar_t) , __ssp_bos); + return __ssp_real_fgetws_unlocked(__buf, __wlen, __fp); +} +#endif /* __GNU_VISIBLE */ + +__END_DECLS + +#endif /* __SSP_FORTIFY_LEVEL > 0 */ +#endif /* _SSP_WCHAR_H_ */ diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index 16e28f41d..dccc10627 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -332,4 +332,8 @@ int _EXFUN(_wscanf_r, (struct _reent *, const wchar_t *, ...)); _END_STD_C +#if __SSP_FORTIFY_LEVEL > 0 +#include +#endif + #endif /* _WCHAR_H_ */ diff --git a/newlib/libc/ssp/ssp.tex b/newlib/libc/ssp/ssp.tex index 1e0cb6b12..927035082 100644 --- a/newlib/libc/ssp/ssp.tex +++ b/newlib/libc/ssp/ssp.tex @@ -34,6 +34,14 @@ bzero mempcpy strcat explicit_bzero memset strncat memcpy stpcpy strncpy +@exdent @emph{Wide Character String functions:} +fgetws wcrtomb wcsrtombs +fgetws_unlocked wcscat wmemcpy +mbsnrtowcs wcscpy wmemmove +mbsrtowcs wcsncat wmempcpy +wcpcpy wcsncpy wmemset +wcpncpy wcsnrtombs + @exdent @emph{Stdio functions:} fgets fread_unlocked sprintf fgets_unlocked gets vsnprintf From 67e628fa335cc5f5ef2c82e3b1609a6672d39266 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 4 Dec 2017 17:05:11 +0100 Subject: [PATCH 173/649] newlib: vfwscanf: fix negation bug in %[ conversion Old BSD bug: While ^ is recognized and the set of matching characters is negated, the code neglects to increment the pointer pointing to the matching characters. Thus, on a negation expression like %[^xyz], the matching doesn't only stop at x, y, or z, but incorrectly also on ^. Fix this by setting the start pointer after recognizing the ^. Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/vfwscanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 9ef2bcae7..a286464e6 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -783,7 +783,6 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), break; case L'[': - ccls = fmt; if (*fmt == '^') { cclcompl = 1; @@ -791,6 +790,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), } else cclcompl = 0; + ccls = fmt; if (*fmt == ']') fmt++; while (*fmt != '\0' && *fmt != ']') From 3476c8c868d95825f16710a6b893b62576f625de Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 5 Dec 2017 17:58:02 +0100 Subject: [PATCH 174/649] cygwin: doc: cleanup cygutils info Especially don't keep on about d2u and u2d. Dos2unix exists. Signed-off-by: Corinna Vinschen --- winsup/doc/effectively.xml | 39 ++++++++------------------------------ winsup/doc/faq-api.xml | 4 ++-- winsup/doc/intro.xml | 7 +++---- winsup/doc/textbinary.xml | 4 ++-- 4 files changed, 15 insertions(+), 39 deletions(-) diff --git a/winsup/doc/effectively.xml b/winsup/doc/effectively.xml index f0d654715..e6a394b60 100644 --- a/winsup/doc/effectively.xml +++ b/winsup/doc/effectively.xml @@ -96,40 +96,16 @@ programs in your environment. -The cygutils package - +Creating shortcuts -The optional cygutils package contains -miscellaneous tools that are small enough to not require their own package. -It is not included in a default Cygwin install; select it from the Utils -category in setup.exe. Several of the -cygutils tools are useful for interacting with -Windows. - - -One of the hassles of Unix-Windows interoperability is the different line -endings on text files. As mentioned in , -Unix tools such as tr can convert between CRLF and LF -endings, but cygutils provides several dedicated programs: -conv, d2u, dos2unix, -u2d, and unix2dos. Use the ---help switch for usage information. - - - -Creating shortcuts with cygutils - -Another problem area is between Unix-style links, which link one file -to another, and Microsoft .lnk files, which provide a shortcut to a -file. They seem similar at first glance but, in reality, are fairly -different. By default, Cygwin does not create symlinks as .lnk files, -but there's an option to do that, see . +By default, Cygwin does not create symlinks as .lnk files, but there's an +option to do that, see . These symlink .lnk files are compatible with Windows-created .lnk files, but they are still different. They do not include much of the information that is available in a standard Microsoft shortcut, such as the working directory, an icon, etc. The cygutils package includes a mkshortcut utility for creating -standard native Microsoft .lnk files. +standard native Microsoft .lnk files from the command line. @@ -144,11 +120,12 @@ Windows shortcuts. -Printing with cygutils +Printing There are several options for printing from Cygwin, including the -lpr found in cygutils (not to be confused with the -native Windows lpr.exe). The easiest way to use cygutils' +lpr found in cygutils-extra +(not to be confused with the native Windows lpr.exe). +The easiest way to use cygutils-extra's lpr is to specify a default device name in the PRINTER environment variable. You may also specify a device on the command line with the -d or -P diff --git a/winsup/doc/faq-api.xml b/winsup/doc/faq-api.xml index 993274a33..6abbbc4b6 100644 --- a/winsup/doc/faq-api.xml +++ b/winsup/doc/faq-api.xml @@ -75,8 +75,8 @@ since it only slows down reading and writing files. Additionally many Windows applications can deal with POSIX \n line endings just fine (unfortunate exception: Notepad). So we suggest to use binary mode as much as possible and only convert files from or to DOS text mode -using tools specifically created to do that job, for instance, d2u and -u2d from the cygutils package. +using tools specifically created to do that job, for instance, dos2unix and +unix2dos from the dos2unix package. It is rather easy for the porter of a Unix package to fix the source code by supplying the appropriate file processing mode switches to the diff --git a/winsup/doc/intro.xml b/winsup/doc/intro.xml index 5e96d8b5b..c68345979 100644 --- a/winsup/doc/intro.xml +++ b/winsup/doc/intro.xml @@ -71,10 +71,9 @@ - The optional cygutils package also contains - utilities that help with common problems, such as - dos2unix and unix2dos for the - CRLF issue. + The optional cygutils and + cygutils-extra packages also contain utilities that + help with common problems. DOCUMENTATION diff --git a/winsup/doc/textbinary.xml b/winsup/doc/textbinary.xml index dbc540aea..447bc6f99 100644 --- a/winsup/doc/textbinary.xml +++ b/winsup/doc/textbinary.xml @@ -98,8 +98,8 @@ handle binmode files just fine. A notable exception is the mini-editor and only produces output files with DOS CRLF lineendings. You can convert files between CRLF and LF lineendings by using -certain tools in the Cygwin distribution like d2u and -u2d from the cygutils package. You can also specify +certain tools in the Cygwin distribution like dos2unix and +unix2dos from the dos2unix package. You can also specify a directory in the mount table to be mounted in textmode so you can use that directory for exchange purposes. From c006fd459f4df832b24e6c7a32228e154a0261ba Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 4 Dec 2017 18:08:28 +0000 Subject: [PATCH 175/649] makedoc: make errors visible Discard QUICKREF sections, rather than writing them to stderr Discard MATHREF sections, rather than discarding as an error Pass NOTES sections through to texinfo, rather than discarding as an error Don't redirect makedoc stderr to .ref file Remove makedoc output on error Remove .ref files from CLEANFILES Regenerate Makefile.ins Signed-off-by: Jon Turney --- newlib/Makefile.shared | 6 +-- newlib/doc/doc.str | 10 ++-- newlib/doc/makedoc.c | 47 ------------------- newlib/libc/argz/Makefile.in | 6 +-- newlib/libc/ctype/Makefile.in | 6 +-- newlib/libc/errno/Makefile.in | 6 +-- newlib/libc/iconv/Makefile.in | 6 +-- newlib/libc/iconv/ccs/Makefile.in | 6 +-- newlib/libc/iconv/ccs/binary/Makefile.in | 6 +-- newlib/libc/iconv/ces/Makefile.in | 6 +-- newlib/libc/iconv/lib/Makefile.in | 6 +-- newlib/libc/locale/Makefile.in | 6 +-- newlib/libc/machine/i386/Makefile.in | 6 +-- newlib/libc/misc/Makefile.in | 6 +-- newlib/libc/posix/Makefile.in | 6 +-- newlib/libc/reent/Makefile.in | 6 +-- newlib/libc/search/Makefile.in | 6 +-- newlib/libc/signal/Makefile.in | 6 +-- newlib/libc/ssp/Makefile.in | 6 +-- newlib/libc/stdio/Makefile.in | 6 +-- newlib/libc/stdio64/Makefile.in | 6 +-- newlib/libc/stdlib/Makefile.in | 6 +-- newlib/libc/string/Makefile.in | 6 +-- newlib/libc/sys/linux/argp/Makefile.in | 6 +-- newlib/libc/sys/linux/cmath/Makefile.in | 6 +-- newlib/libc/sys/linux/dl/Makefile.in | 6 +-- newlib/libc/sys/linux/iconv/Makefile.in | 6 +-- newlib/libc/sys/linux/intl/Makefile.in | 6 +-- .../libc/sys/linux/linuxthreads/Makefile.in | 6 +-- .../linuxthreads/machine/i386/Makefile.in | 6 +-- .../libc/sys/linux/machine/i386/Makefile.in | 6 +-- newlib/libc/sys/linux/net/Makefile.in | 6 +-- newlib/libc/syscalls/Makefile.in | 6 +-- newlib/libc/time/Makefile.in | 6 +-- newlib/libc/unix/Makefile.in | 6 +-- newlib/libc/xdr/Makefile.in | 6 +-- newlib/libm/common/Makefile.in | 6 +-- newlib/libm/complex/Makefile.in | 6 +-- newlib/libm/machine/aarch64/Makefile.in | 6 +-- newlib/libm/machine/arm/Makefile.in | 6 +-- newlib/libm/machine/i386/Makefile.in | 6 +-- newlib/libm/machine/nds32/Makefile.in | 6 +-- newlib/libm/machine/riscv/Makefile.in | 6 +-- newlib/libm/machine/spu/Makefile.in | 6 +-- newlib/libm/math/Makefile.in | 6 +-- newlib/libm/mathfp/Makefile.in | 6 +-- 46 files changed, 139 insertions(+), 182 deletions(-) diff --git a/newlib/Makefile.shared b/newlib/Makefile.shared index c9ce5f468..f1152fc62 100644 --- a/newlib/Makefile.shared +++ b/newlib/Makefile.shared @@ -14,8 +14,8 @@ SUFFIXES = .def .xml CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi @@ -39,4 +39,4 @@ docbook: $(DOCBOOK_OUT_FILES) ${top_srcdir}/../doc/chapter-texi2docbook.py <$(srcdir)/$${chapter%.xml}.tex >../$$chapter ; \ done -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) diff --git a/newlib/doc/doc.str b/newlib/doc/doc.str index 3fc1006f8..949c6e794 100644 --- a/newlib/doc/doc.str +++ b/newlib/doc/doc.str @@ -17,9 +17,10 @@ : QUICKREF skip_past_newline - get_stuff_in_command - "&&~&&~&&\cr\tablerule\n" - quickref + ; + +: MATHREF + skip_past_newline ; : EXAMPLE @@ -153,6 +154,9 @@ : SEEALSO "@strong{See Also}@*\n" catstr subhead ; +: NOTES + "@strong{Notes}@*\n" catstr subhead ; + : INTERNAL_FUNCTION ; diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c index 96362f782..fdcc5b926 100644 --- a/newlib/doc/makedoc.c +++ b/newlib/doc/makedoc.c @@ -444,52 +444,6 @@ WORD(translatecomments) } -/* find something like - QUICKREF - memchar ansi pure - - into - merge with words on tos and output them to stderror - -*/ -WORD(quickref) -{ - string_type *nos = tos-1; - unsigned int nosscan = 0; - unsigned int idx = 0; - - while (at(tos, idx)) - { - if (at(tos,idx) == '~') - { - /* Skip the whitespace */ - while (at(nos, nosscan) == ' ') - nosscan++; - - /* Sub the next word from the nos*/ - while (at(nos, nosscan) != ' ' && - at(nos, nosscan) != 0) - { - fprintf(stderr, "%c", at(nos, nosscan)); - nosscan++; - } - } - - else - { - fprintf(stderr,"%c", at(tos, idx)); - - } - idx++; - } - - delete_string(tos); - delete_string(nos); - tos-=2; - pc++; - -} - #if 0 /* turn everything not starting with a . into a comment */ @@ -1428,7 +1382,6 @@ char *av[]) add_intrinsic("translatecomments", translatecomments ); add_intrinsic("kill_bogus_lines", kill_bogus_lines); add_intrinsic("indent", indent); - add_intrinsic("quickref", quickref); add_intrinsic("internalmode", internalmode); /* Put a nl at the start */ diff --git a/newlib/libc/argz/Makefile.in b/newlib/libc/argz/Makefile.in index a129dc0fc..e18a2d117 100644 --- a/newlib/libc/argz/Makefile.in +++ b/newlib/libc/argz/Makefile.in @@ -319,7 +319,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -694,8 +694,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/ctype/Makefile.in b/newlib/libc/ctype/Makefile.in index f883e1c99..2b2331767 100644 --- a/newlib/libc/ctype/Makefile.in +++ b/newlib/libc/ctype/Makefile.in @@ -425,7 +425,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = \ isalnum.def \ isalpha.def \ @@ -1124,8 +1124,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/errno/Makefile.in b/newlib/libc/errno/Makefile.in index 4855f926b..724def236 100644 --- a/newlib/libc/errno/Makefile.in +++ b/newlib/libc/errno/Makefile.in @@ -269,7 +269,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = CHAPTERS = all: all-am @@ -532,8 +532,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/iconv/Makefile.in b/newlib/libc/iconv/Makefile.in index 1bdf44b34..3bc64c587 100644 --- a/newlib/libc/iconv/Makefile.in +++ b/newlib/libc/iconv/Makefile.in @@ -276,7 +276,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = iconv.def CHAPTERS = iconv.tex all: all-recursive @@ -606,8 +606,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/iconv/ccs/Makefile.in b/newlib/libc/iconv/ccs/Makefile.in index 4de6bc9ad..ff849d544 100644 --- a/newlib/libc/iconv/ccs/Makefile.in +++ b/newlib/libc/iconv/ccs/Makefile.in @@ -360,7 +360,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-recursive .SUFFIXES: @@ -942,8 +942,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/iconv/ccs/binary/Makefile.in b/newlib/libc/iconv/ccs/binary/Makefile.in index be683c638..0748e7936 100644 --- a/newlib/libc/iconv/ccs/binary/Makefile.in +++ b/newlib/libc/iconv/ccs/binary/Makefile.in @@ -273,7 +273,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -466,8 +466,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/iconv/ces/Makefile.in b/newlib/libc/iconv/ces/Makefile.in index b4c17c536..ab3836096 100644 --- a/newlib/libc/iconv/ces/Makefile.in +++ b/newlib/libc/iconv/ces/Makefile.in @@ -296,7 +296,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = CHAPTERS = all: all-am @@ -607,8 +607,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/iconv/lib/Makefile.in b/newlib/libc/iconv/lib/Makefile.in index 85e3394e7..ee4510a38 100644 --- a/newlib/libc/iconv/lib/Makefile.in +++ b/newlib/libc/iconv/lib/Makefile.in @@ -279,7 +279,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = iconv.def CHAPTER = all: all-am @@ -560,8 +560,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/locale/Makefile.in b/newlib/libc/locale/Makefile.in index 07efc34ab..c939fa358 100644 --- a/newlib/libc/locale/Makefile.in +++ b/newlib/libc/locale/Makefile.in @@ -298,7 +298,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = \ duplocale.def \ freelocale.def \ @@ -633,8 +633,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/machine/i386/Makefile.in b/newlib/libc/machine/i386/Makefile.in index fb5808064..5ab7c00b6 100644 --- a/newlib/libc/machine/i386/Makefile.in +++ b/newlib/libc/machine/i386/Makefile.in @@ -273,7 +273,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -588,8 +588,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/misc/Makefile.in b/newlib/libc/misc/Makefile.in index e7925231c..803db8d23 100644 --- a/newlib/libc/misc/Makefile.in +++ b/newlib/libc/misc/Makefile.in @@ -278,7 +278,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = unctrl.def lock.def ffs.def CHAPTERS = misc.tex all: all-am @@ -571,8 +571,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/posix/Makefile.in b/newlib/libc/posix/Makefile.in index 360f2ca87..147476a33 100644 --- a/newlib/libc/posix/Makefile.in +++ b/newlib/libc/posix/Makefile.in @@ -328,7 +328,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = \ popen.def \ posix_spawn.def @@ -775,8 +775,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/reent/Makefile.in b/newlib/libc/reent/Makefile.in index 62b8500d4..4b323f209 100644 --- a/newlib/libc/reent/Makefile.in +++ b/newlib/libc/reent/Makefile.in @@ -343,7 +343,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = \ closer.def \ reent.def \ @@ -776,8 +776,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/search/Makefile.in b/newlib/libc/search/Makefile.in index dc748c2b8..54f33e122 100644 --- a/newlib/libc/search/Makefile.in +++ b/newlib/libc/search/Makefile.in @@ -328,7 +328,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -685,8 +685,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/signal/Makefile.in b/newlib/libc/signal/Makefile.in index ad5bddc0e..2f89f73d1 100644 --- a/newlib/libc/signal/Makefile.in +++ b/newlib/libc/signal/Makefile.in @@ -270,7 +270,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = psignal.def raise.def signal.def CHAPTERS = signal.tex all: all-am @@ -545,8 +545,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/ssp/Makefile.in b/newlib/libc/ssp/Makefile.in index 7b5ca11ff..8de2d36c6 100644 --- a/newlib/libc/ssp/Makefile.in +++ b/newlib/libc/ssp/Makefile.in @@ -323,7 +323,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -680,8 +680,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/stdio/Makefile.in b/newlib/libc/stdio/Makefile.in index 061554d2d..aa22a0e3a 100644 --- a/newlib/libc/stdio/Makefile.in +++ b/newlib/libc/stdio/Makefile.in @@ -657,7 +657,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) @NEWLIB_NANO_FORMATTED_IO_FALSE@CHEWOUT_INT_FORMATTED_IO_FILES = \ @NEWLIB_NANO_FORMATTED_IO_FALSE@ diprintf.def \ @NEWLIB_NANO_FORMATTED_IO_FALSE@ siprintf.def \ @@ -1859,8 +1859,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/stdio64/Makefile.in b/newlib/libc/stdio64/Makefile.in index 5e77115c7..d002af62a 100644 --- a/newlib/libc/stdio64/Makefile.in +++ b/newlib/libc/stdio64/Makefile.in @@ -300,7 +300,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) AM_CFLAGS = -I $(srcdir)/../stdio CHEWOUT_FILES = \ fdopen64.def \ @@ -627,8 +627,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/stdlib/Makefile.in b/newlib/libc/stdlib/Makefile.in index 00d07bf6d..5cca4f2e5 100644 --- a/newlib/libc/stdlib/Makefile.in +++ b/newlib/libc/stdlib/Makefile.in @@ -500,7 +500,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) MALLOC_COMPILE = $(LIB_COMPILE) -DINTERNAL_NEWLIB CHEWOUT_FILES = \ _Exit.def \ @@ -1561,8 +1561,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/string/Makefile.in b/newlib/libc/string/Makefile.in index a73d2fe7b..eb8fafc6b 100644 --- a/newlib/libc/string/Makefile.in +++ b/newlib/libc/string/Makefile.in @@ -485,7 +485,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = \ bcmp.def memcpy.def strcmp.def strncat.def strstr.def \ bcopy.def memmove.def strcoll.def strncmp.def strtok.def \ @@ -1392,8 +1392,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/argp/Makefile.in b/newlib/libc/sys/linux/argp/Makefile.in index cfd05bd81..76841d1ec 100644 --- a/newlib/libc/sys/linux/argp/Makefile.in +++ b/newlib/libc/sys/linux/argp/Makefile.in @@ -263,7 +263,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -572,8 +572,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/cmath/Makefile.in b/newlib/libc/sys/linux/cmath/Makefile.in index 882b17e5f..2c6c3da26 100644 --- a/newlib/libc/sys/linux/cmath/Makefile.in +++ b/newlib/libc/sys/linux/cmath/Makefile.in @@ -286,7 +286,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -757,8 +757,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/dl/Makefile.in b/newlib/libc/sys/linux/dl/Makefile.in index e1c8485ae..6598fd8d5 100644 --- a/newlib/libc/sys/linux/dl/Makefile.in +++ b/newlib/libc/sys/linux/dl/Makefile.in @@ -273,7 +273,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -660,8 +660,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/iconv/Makefile.in b/newlib/libc/sys/linux/iconv/Makefile.in index f535c3796..238c62d4a 100644 --- a/newlib/libc/sys/linux/iconv/Makefile.in +++ b/newlib/libc/sys/linux/iconv/Makefile.in @@ -273,7 +273,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -645,8 +645,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/intl/Makefile.in b/newlib/libc/sys/linux/intl/Makefile.in index 2c2999abd..b54bfe152 100644 --- a/newlib/libc/sys/linux/intl/Makefile.in +++ b/newlib/libc/sys/linux/intl/Makefile.in @@ -272,7 +272,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) AM_CFLAGS = -DNOT_IN_libc -DHAVE_CONFIG_H -D_GNU_SOURCE -D__libc_enable_secure=1 -D'LOCALEDIR="$(msgcatdir)"' -D'LOCALE_ALIAS_PATH="$(msgcatdir)"' -DNLSPATH='"$(msgcatdir)/%L/%N:$(msgcatdir)/%L/LC_MESSAGES/%N:$(msgcatdir)/%l/%N:$(msgcatdir)/%l/LC_MESSAGES/%N:"' # shouldn't have to do the following, but if needed @@ -639,8 +639,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/linuxthreads/Makefile.in b/newlib/libc/sys/linux/linuxthreads/Makefile.in index 49094bece..ce07c8344 100644 --- a/newlib/libc/sys/linux/linuxthreads/Makefile.in +++ b/newlib/libc/sys/linux/linuxthreads/Makefile.in @@ -451,7 +451,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 ACLOCAL_AMFLAGS = -I ../../../.. -I ../../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host @@ -1290,8 +1290,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in index f3c78282e..87797a0b3 100644 --- a/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/Makefile.in @@ -265,7 +265,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) AM_CFLAGS = -D_XOPEN_SOURCE=600 -D_GNU_SOURCE=1 ACLOCAL_AMFLAGS = -I ../../../../../.. -I ../../../../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host @@ -566,8 +566,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/machine/i386/Makefile.in b/newlib/libc/sys/linux/machine/i386/Makefile.in index c4edaaf93..80cc02161 100644 --- a/newlib/libc/sys/linux/machine/i386/Makefile.in +++ b/newlib/libc/sys/linux/machine/i386/Makefile.in @@ -267,7 +267,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../../../.. -I ../../../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -579,8 +579,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/sys/linux/net/Makefile.in b/newlib/libc/sys/linux/net/Makefile.in index f11a55410..cce36182e 100644 --- a/newlib/libc/sys/linux/net/Makefile.in +++ b/newlib/libc/sys/linux/net/Makefile.in @@ -400,7 +400,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -1600,8 +1600,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/syscalls/Makefile.in b/newlib/libc/syscalls/Makefile.in index 8ff80d4d8..5c1cc3aec 100644 --- a/newlib/libc/syscalls/Makefile.in +++ b/newlib/libc/syscalls/Makefile.in @@ -310,7 +310,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = CHAPTERS = all: all-am @@ -681,8 +681,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/time/Makefile.in b/newlib/libc/time/Makefile.in index 4d91d682a..a32333234 100644 --- a/newlib/libc/time/Makefile.in +++ b/newlib/libc/time/Makefile.in @@ -306,7 +306,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = \ asctime.def \ clock.def \ @@ -708,8 +708,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/unix/Makefile.in b/newlib/libc/unix/Makefile.in index 0657bc710..9d7da14a4 100644 --- a/newlib/libc/unix/Makefile.in +++ b/newlib/libc/unix/Makefile.in @@ -310,7 +310,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = CHAPTERS = all: all-am @@ -639,8 +639,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libc/xdr/Makefile.in b/newlib/libc/xdr/Makefile.in index 29a49dc08..7495c1178 100644 --- a/newlib/libc/xdr/Makefile.in +++ b/newlib/libc/xdr/Makefile.in @@ -306,7 +306,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) all: all-am .SUFFIXES: @@ -621,8 +621,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/common/Makefile.in b/newlib/libm/common/Makefile.in index c603be361..6a0ba73d2 100644 --- a/newlib/libm/common/Makefile.in +++ b/newlib/libm/common/Makefile.in @@ -391,7 +391,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = s_cbrt.def s_copysign.def s_exp10.def s_expm1.def s_ilogb.def \ s_infinity.def s_isnan.def s_log1p.def s_matherr.def s_modf.def \ s_nan.def s_nextafter.def s_pow10.def s_scalbn.def \ @@ -1495,8 +1495,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/complex/Makefile.in b/newlib/libm/complex/Makefile.in index ba30971be..1c878780a 100644 --- a/newlib/libm/complex/Makefile.in +++ b/newlib/libm/complex/Makefile.in @@ -316,7 +316,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = cabs.def cacos.def cacosh.def carg.def \ casin.def casinh.def catan.def catanh.def \ ccos.def ccosh.def cexp.def cimag.def clog.def \ @@ -1020,8 +1020,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/machine/aarch64/Makefile.in b/newlib/libm/machine/aarch64/Makefile.in index 2c5a3e71f..d31237e0f 100644 --- a/newlib/libm/machine/aarch64/Makefile.in +++ b/newlib/libm/machine/aarch64/Makefile.in @@ -256,7 +256,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -677,8 +677,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/machine/arm/Makefile.in b/newlib/libm/machine/arm/Makefile.in index 5088db828..0a5a27327 100644 --- a/newlib/libm/machine/arm/Makefile.in +++ b/newlib/libm/machine/arm/Makefile.in @@ -232,7 +232,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -557,8 +557,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/machine/i386/Makefile.in b/newlib/libm/machine/i386/Makefile.in index f3f16f9d1..13f536e40 100644 --- a/newlib/libm/machine/i386/Makefile.in +++ b/newlib/libm/machine/i386/Makefile.in @@ -284,7 +284,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -710,8 +710,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/machine/nds32/Makefile.in b/newlib/libm/machine/nds32/Makefile.in index d31488610..a72bc6f9c 100644 --- a/newlib/libm/machine/nds32/Makefile.in +++ b/newlib/libm/machine/nds32/Makefile.in @@ -223,7 +223,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -476,8 +476,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/machine/riscv/Makefile.in b/newlib/libm/machine/riscv/Makefile.in index 511b3785d..68cb6780a 100644 --- a/newlib/libm/machine/riscv/Makefile.in +++ b/newlib/libm/machine/riscv/Makefile.in @@ -221,7 +221,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -534,8 +534,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/machine/spu/Makefile.in b/newlib/libm/machine/spu/Makefile.in index fa7a30ce7..ef4e3f4c7 100644 --- a/newlib/libm/machine/spu/Makefile.in +++ b/newlib/libm/machine/spu/Makefile.in @@ -296,7 +296,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) ACLOCAL_AMFLAGS = -I ../../.. -I ../../../.. CONFIG_STATUS_DEPENDENCIES = $(newlib_basedir)/configure.host all: all-am @@ -1287,8 +1287,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/math/Makefile.in b/newlib/libm/math/Makefile.in index 1f5a69406..0ac2b1668 100644 --- a/newlib/libm/math/Makefile.in +++ b/newlib/libm/math/Makefile.in @@ -394,7 +394,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = w_acos.def w_acosh.def w_asin.def s_asinh.def \ s_atan.def w_atan2.def w_atanh.def w_j0.def \ w_cosh.def s_erf.def w_exp.def w_exp2.def \ @@ -1469,8 +1469,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi diff --git a/newlib/libm/mathfp/Makefile.in b/newlib/libm/mathfp/Makefile.in index 76db091d8..383121bd6 100644 --- a/newlib/libm/mathfp/Makefile.in +++ b/newlib/libm/mathfp/Makefile.in @@ -357,7 +357,7 @@ CHEW = ${top_builddir}/../doc/makedoc -f $(top_srcdir)/../doc/doc.str DOCBOOK_CHEW = ${top_srcdir}/../doc/makedocbook.py DOCBOOK_OUT_FILES = $(CHEWOUT_FILES:.def=.xml) DOCBOOK_CHAPTERS = $(CHAPTERS:.tex=.xml) -CLEANFILES = $(CHEWOUT_FILES) $(CHEWOUT_FILES:.def=.ref) $(DOCBOOK_OUT_FILES) +CLEANFILES = $(CHEWOUT_FILES) $(DOCBOOK_OUT_FILES) CHEWOUT_FILES = e_acosh.def \ e_atanh.def \ e_hypot.def \ @@ -1200,8 +1200,8 @@ objectlist.awk.in: $(noinst_LTLIBRARIES) done .c.def: - $(CHEW) < $< > $*.def 2> $*.ref - touch stmp-def + $(CHEW) < $< > $*.def || ( rm $*.def && false ) + @touch stmp-def TARGETDOC ?= ../tmp.texi From 06bd0ecc8dc472e3b2c3d54de994c11122559ee2 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 4 Dec 2017 18:24:55 +0000 Subject: [PATCH 176/649] makedoc: exit with non-zero status on error Signed-off-by: Jon Turney --- newlib/doc/makedoc.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c index fdcc5b926..45ddfb81e 100644 --- a/newlib/doc/makedoc.c +++ b/newlib/doc/makedoc.c @@ -1113,9 +1113,10 @@ DEFUN(lookup_word,(word), } -static void DEFUN_VOID(perform) +static int DEFUN_VOID(perform) { tos = stack; + int errors = 0; while (at(ptr, idx)) { /* It's worth looking through the command list */ @@ -1140,6 +1141,7 @@ static void DEFUN_VOID(perform) else { fprintf(stderr,"warning, %s is not recognised\n", next); + errors++; skip_past_newline(); } @@ -1147,6 +1149,7 @@ static void DEFUN_VOID(perform) else skip_past_newline(); } + return errors; } dict_type * @@ -1220,6 +1223,8 @@ DEFUN(compile, (string), int ret=0; /* add words to the dictionary */ char *word; + dict_type *lookup; + string = nextword(string, &word); while (string && *string && word[0]) { @@ -1275,7 +1280,9 @@ DEFUN(compile, (string), break; default: add_to_definition(ptr, call); - add_to_definition(ptr, lookup_word(word)); + lookup = lookup_word(word); + if (!lookup) ret++; + add_to_definition(ptr, lookup); } string = nextword(string, &word); @@ -1349,7 +1356,7 @@ int ac AND char *av[]) { unsigned int i; - + int status = 0; string_type buffer; string_type pptr; @@ -1410,7 +1417,7 @@ char *av[]) read_in(&b, f); if( compile(b.ptr) ) { fclose(f); exit(1); } - perform(); + status = perform(); fclose(f); } else if (av[i][1] == 'i') @@ -1425,8 +1432,5 @@ char *av[]) } write_buffer(stack+0); - return 0; + return status; } - - - From 2ce4e1e5ad5b694a729e5df13cccaaf514abad45 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Tue, 5 Dec 2017 18:40:44 +0000 Subject: [PATCH 177/649] makedoc: warn about some obsolete and deprecated commands To follow up the thread starting at [1], since all uses of TRAD_SYNOPSIS have been removed, and all uses of ANSI_SYNOPSIS have been renamed to SYNOPSIS, we can now warn about the use of these. [1] https://sourceware.org/ml/newlib/2017/msg01182.html Signed-off-by: Jon Turney --- newlib/doc/doc.str | 17 ++--------------- newlib/doc/makedoc.c | 14 +++++++++++++- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/newlib/doc/doc.str b/newlib/doc/doc.str index 949c6e794..b0bfc9ea4 100644 --- a/newlib/doc/doc.str +++ b/newlib/doc/doc.str @@ -62,25 +62,12 @@ indent catstr "@end example\n" catstr - - ; - -: OLDTRAD_SYNOPSIS - skip_past_newline - "@strong{Traditional Synopsis}\n" catstr - "@example\n" catstr - get_stuff_in_command - do_fancy_stuff - nokill_bogus_lines - indent - catstr - "@end example\n" catstr - + "ANSI_SYNOPSIS is deprecated, use SYNOPSIS instead" warn ; : TRAD_SYNOPSIS skip_past_newline - + "TRAD_SYNOPSIS is obsolete and ignored" warn ; : INDEX diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c index 45ddfb81e..3f4ff4c06 100644 --- a/newlib/doc/makedoc.c +++ b/newlib/doc/makedoc.c @@ -1019,6 +1019,17 @@ WORD(maybecatstr) } +/* write tos to stderr */ +WORD(warn) +{ + fputs("Warning: ", stderr); + fwrite(tos->ptr, tos->write_idx, 1, stderr); + fputc('\n', stderr); + delete_string(tos); + tos--; + pc++; +} + char * DEFUN(nextword,(string, word), char *string AND @@ -1390,7 +1401,8 @@ char *av[]) add_intrinsic("kill_bogus_lines", kill_bogus_lines); add_intrinsic("indent", indent); add_intrinsic("internalmode", internalmode); - + add_intrinsic("warn", warn); + /* Put a nl at the start */ catchar(&buffer,'\n'); From c6f14b3c81f5a40317452625ef8d56c2612fe776 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Mon, 6 Mar 2017 17:45:40 +0000 Subject: [PATCH 178/649] cygwin: Improve discussion of linker library ordering in faq-programming Signed-off-by: Jon Turney --- winsup/doc/faq-programming.xml | 37 +++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/winsup/doc/faq-programming.xml b/winsup/doc/faq-programming.xml index c0ddd7902..65bfed97e 100644 --- a/winsup/doc/faq-programming.xml +++ b/winsup/doc/faq-programming.xml @@ -876,10 +876,45 @@ example, single-stepping from these signals may not work as expected. A common error is to put the library on the command line before the thing that needs things from it. + This is wrong gcc -lstdc++ hello.cc. This is right gcc hello.cc -lstdc++. - + + + The first command above (usually) works on Linux, because: + + A DT_NEEDED tag for libstdc++ is added when the library name is seen. + The executable has unresolved symbols, which can be found in libstdc++. + When executed, the ELF loader resolves those symbols. + + + + + Note that this won't work if the linker flags --as-needed + or --no-undefined are used, or if the library being linked + with is a static library. + + + + PE/COFF executables work very differently, and the dynamic library which + provides a symbol must be fully resolved at link time + (so the library which provides a symbol must follow a reference to it). + + + + See point 3 in for more + discussion of how this affects plugins. + + + + This also has consequences for how weak symbols are resolved. See for more + discussion of that. + + + + Why do I get an error using struct stat64? From 67a657cb1d41e6ae90e9fdeba9e69fff09a2ea06 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 10 Dec 2017 14:11:03 +0100 Subject: [PATCH 179/649] cygwin: mmap: fix a fork failure with private, anonymous mappings Rounddown incoming addr on a page boundary. Without this, we may end up with a fork error for private, anonymous maps. The reason is, we use VirtualAlloc in this case which will potentially overcommit if addr is not on a page boundary. This isn't taken into account in bookkeeping, but fixup_mmaps_after_fork will eventually stumble over this when trying to reproduce the copy-on-write pages: VirtualQuery returns a region reaching beyond the supposedly allocated address range and from there it goes downhill. Signed-off-by: Corinna Vinschen --- winsup/cygwin/mmap.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index 4218466f0..d4eddfcb4 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -917,6 +917,13 @@ mmap64 (void *addr, size_t len, int prot, int flags, int fd, off_t off) goto out; } + /* POSIX: When MAP_FIXED is not set, the implementation uses addr in an + implementation-defined manner to arrive at pa [the return address]. + Given that we refuse addr if it's not exactly at a page boundary, we + can just make sure addr does so indiscriminately. Just round down + to the next lower page boundary. */ + addr = (void *) rounddown ((uintptr_t) addr, pagesize); + if (!anonymous (flags) && fd != -1) { /* Ensure that fd is open */ From 0c201166f5e8bf17ce9620867d2d35a4a63e47de Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 10 Dec 2017 14:11:41 +0100 Subject: [PATCH 180/649] cygwin: mmap: fix comment and formatting, drop unused code Signed-off-by: Corinna Vinschen --- winsup/cygwin/mmap.cc | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/mmap.cc b/winsup/cygwin/mmap.cc index d4eddfcb4..d7d480fda 100644 --- a/winsup/cygwin/mmap.cc +++ b/winsup/cygwin/mmap.cc @@ -1177,12 +1177,9 @@ go_ahead: protection as the file's pages, then as much pages as necessary to accomodate the requested length, but as reserved pages which raise a SIGBUS when trying to access them. AT_ROUND_TO_PAGE - and page protection on shared pages is only supported by 32 bit NT, - so don't even try on WOW64. This is accomplished by not setting - orig_len on WOW64 above. */ -#if 0 - orig_len = roundup2 (orig_len, pagesize); -#endif + and page protection on shared pages is only supported by the + 32 bit environment, so don't even try on 64 bit or even WOW64. + This is accomplished by not setting orig_len on 64 bit above. */ len = roundup2 (len, wincap.page_size ()); if (orig_len - len) { @@ -1465,7 +1462,7 @@ mlock (const void *addr, size_t len) /* Align address and length values to page size. */ size_t pagesize = wincap.allocation_granularity (); - PVOID base = (PVOID) rounddown((uintptr_t) addr, pagesize); + PVOID base = (PVOID) rounddown ((uintptr_t) addr, pagesize); SIZE_T size = roundup2 (((uintptr_t) addr - (uintptr_t) base) + len, pagesize); NTSTATUS status = 0; @@ -1523,7 +1520,7 @@ munlock (const void *addr, size_t len) /* Align address and length values to page size. */ size_t pagesize = wincap.allocation_granularity (); - PVOID base = (PVOID) rounddown((uintptr_t) addr, pagesize); + PVOID base = (PVOID) rounddown ((uintptr_t) addr, pagesize); SIZE_T size = roundup2 (((uintptr_t) addr - (uintptr_t) base) + len, pagesize); NTSTATUS status = NtUnlockVirtualMemory (NtCurrentProcess (), &base, &size, From 32988bd409273a497d7f5a0b9c34913d87e282ee Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 10 Dec 2017 14:32:34 +0100 Subject: [PATCH 181/649] cygwin: add mmap fork fix to 2.10.0 release test Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.10.0 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0 index 22f761e8a..b16bb2394 100644 --- a/winsup/cygwin/release/2.10.0 +++ b/winsup/cygwin/release/2.10.0 @@ -25,3 +25,6 @@ Bug Fixes - Fix two bugs in the limit of large numbers of sockets. Addresses: https://cygwin.com/ml/cygwin/2017-11/msg00052.html + +- Fix a fork failure with private anonymous mmaps. + Addresses: https://cygwin.com/ml/cygwin/2017-12/msg00061.html From efce18d7541edd709dc10315e54c1842e14fbf63 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Mon, 11 Dec 2017 16:14:18 -0800 Subject: [PATCH 182/649] Update MAINTAINERS file email address. To update my email address to my current employer. Specifix died quite a while ago, and I've had two jobs in the interim. newlib/ * MAINTAINERS: Update my email address. --- newlib/MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/MAINTAINERS b/newlib/MAINTAINERS index 811f3cbd8..1fbff5174 100644 --- a/newlib/MAINTAINERS +++ b/newlib/MAINTAINERS @@ -60,7 +60,7 @@ These are users with general write privileges after getting approval: Anthony Green green@moxielogic.com DJ Delorie dj@redhat.com -Jim Wilson wilson@specifixinc.com +Jim Wilson jimw@sifive.com Nick Clifton nickc@redhat.com Eric Blake eblake@redhat.com Will Newton will.newton@linaro.org From c338bc22554fcddf64f12148785d07c1a4021160 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 12 Dec 2017 11:38:01 -0800 Subject: [PATCH 183/649] Don't call double rint from float powf. Updated patch to use 0.0f in addition to calling rintf. Tested same way as before, with a testcase that triggers the code and make check. OK? newlib/ * libm/math/wf_pow.c (powf): Call rintf instead of rint. Use 0.0f for compare. --- newlib/libm/math/wf_pow.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c index be453558b..9a10254bf 100644 --- a/newlib/libm/math/wf_pow.c +++ b/newlib/libm/math/wf_pow.c @@ -127,11 +127,11 @@ if (_LIB_VERSION == _SVID_) { exc.retval = HUGE; y *= 0.5; - if(x<0.0&&rint(y)!=y) exc.retval = -HUGE; + if(x<0.0f&&rintf(y)!=y) exc.retval = -HUGE; } else { exc.retval = HUGE_VAL; y *= 0.5; - if(x<0.0&&rint(y)!=y) exc.retval = -HUGE_VAL; + if(x<0.0f&&rintf(y)!=y) exc.retval = -HUGE_VAL; } if (_LIB_VERSION == _POSIX_) errno = ERANGE; From c874f1145ff5d2fa461cef21d6f8d575138fcdbf Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 12 Dec 2017 11:39:13 -0800 Subject: [PATCH 184/649] newlib: Don't do double divide in powf. * Use 0.0f instead of 0.0 in divide. --- newlib/libm/math/wf_pow.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/newlib/libm/math/wf_pow.c b/newlib/libm/math/wf_pow.c index 9a10254bf..f753b5226 100644 --- a/newlib/libm/math/wf_pow.c +++ b/newlib/libm/math/wf_pow.c @@ -108,7 +108,9 @@ if (_LIB_VERSION == _SVID_) exc.retval = 0.0; else - exc.retval = 0.0/0.0; /* X/Open allow NaN */ + /* Use a float divide, to avoid a soft-float double + divide call on single-float only targets. */ + exc.retval = (0.0f/0.0f); /* X/Open allow NaN */ if (_LIB_VERSION == _POSIX_) errno = EDOM; else if (!matherr(&exc)) { From 314ddf908c7d32f5293a942d391073e3d8b29fca Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 18 Dec 2017 19:42:42 +0100 Subject: [PATCH 185/649] winsup: Belatedly add Mark Geisert to CONTRIBUTORS Signed-off-by: Corinna Vinschen --- winsup/CONTRIBUTORS | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/CONTRIBUTORS b/winsup/CONTRIBUTORS index 61fba810b..0f50f3f5e 100644 --- a/winsup/CONTRIBUTORS +++ b/winsup/CONTRIBUTORS @@ -77,6 +77,7 @@ Joshua Daniel Franklin joshuadfranklin@yahoo.com Ken Brown kbrown@cornell.edu Lapo Luchini lapo@lapo.it Lev Bishop lev.bishop@gmail.com +Mark Geisert mark@maxrnd.com Max Kaehn slothman@electric-cloud.com Micha Nelissen mdvpost@hotmail.com Michael Haubenwallner michael.haubenwallner@ssi-schaefer.com From 24ff42d79aab60651113d60b5a8e9081c15acd82 Mon Sep 17 00:00:00 2001 From: Mark Geisert Date: Thu, 14 Dec 2017 17:05:55 -0800 Subject: [PATCH 186/649] Cygwin: Implement sigtimedwait Abstract out common code from sigwait/sigwaitinfo/sigtimedwait to implement the latter. --- winsup/cygwin/common.din | 1 + winsup/cygwin/include/cygwin/version.h | 3 ++- winsup/cygwin/signal.cc | 36 ++++++++++++++++++++++++-- winsup/cygwin/thread.cc | 2 +- winsup/doc/posix.xml | 2 +- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index 14b9c2c18..91f2915bf 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -1326,6 +1326,7 @@ sigrelse SIGFE sigset SIGFE sigsetjmp NOSIGFE sigsuspend SIGFE +sigtimedwait SIGFE sigwait SIGFE sigwaitinfo SIGFE sin NOSIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index 0fee73c1d..aa7c14ec3 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -492,12 +492,13 @@ details. */ 321: Export wmempcpy. 322: [w]scanf %m modifier. 323: scanf %l[ conversion. + 324: Export sigtimedwait. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 323 +#define CYGWIN_VERSION_API_MINOR 324 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 69c5e2aad..16210b571 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -575,6 +575,29 @@ siginterrupt (int sig, int flag) return res; } +static int sigwait_common (const sigset_t *, siginfo_t *, PLARGE_INTEGER); + +extern "C" int +sigtimedwait (const sigset_t *set, siginfo_t *info, const timespec *timeout) +{ + LARGE_INTEGER waittime; + + if (timeout) + { + if (timeout->tv_sec < 0 + || timeout->tv_nsec < 0 || timeout->tv_nsec > (NSPERSEC * 100LL)) + { + set_errno (EINVAL); + return -1; + } + /* convert timespec to 100ns units */ + waittime.QuadPart = (LONGLONG) timeout->tv_sec * NSPERSEC + + ((LONGLONG) timeout->tv_nsec + 99LL) / 100LL; + } + + return sigwait_common (set, info, timeout ? &waittime : cw_infinite); +} + extern "C" int sigwait (const sigset_t *set, int *sig_ptr) { @@ -582,7 +605,7 @@ sigwait (const sigset_t *set, int *sig_ptr) do { - sig = sigwaitinfo (set, NULL); + sig = sigwait_common (set, NULL, cw_infinite); } while (sig == -1 && get_errno () == EINTR); if (sig > 0) @@ -592,6 +615,12 @@ sigwait (const sigset_t *set, int *sig_ptr) extern "C" int sigwaitinfo (const sigset_t *set, siginfo_t *info) +{ + return sigwait_common (set, info, cw_infinite); +} + +static int +sigwait_common (const sigset_t *set, siginfo_t *info, PLARGE_INTEGER waittime) { int res = -1; @@ -602,7 +631,7 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info) set_signal_mask (_my_tls.sigwait_mask, *set); sig_dispatch_pending (true); - switch (cygwait (NULL, cw_infinite, cw_sig_eintr | cw_cancel | cw_cancel_self)) + switch (cygwait (NULL, waittime, cw_sig_eintr | cw_cancel | cw_cancel_self)) { case WAIT_SIGNALED: if (!sigismember (set, _my_tls.infodata.si_signo)) @@ -619,6 +648,9 @@ sigwaitinfo (const sigset_t *set, siginfo_t *info) _my_tls.unlock (); } break; + case WAIT_TIMEOUT: + set_errno (EAGAIN); + break; default: __seterrno (); break; diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index b9b2c7aaa..f3c709a15 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -708,7 +708,7 @@ pthread::cancel () * sendto () * sigpause () * sigsuspend () - o sigtimedwait () + * sigtimedwait () * sigwait () * sigwaitinfo () * sleep () diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml index ab574300f..2664159e1 100644 --- a/winsup/doc/posix.xml +++ b/winsup/doc/posix.xml @@ -888,6 +888,7 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). sigset sigsetjmp sigsuspend + sigtimedwait sigwait sigwaitinfo sin @@ -1582,7 +1583,6 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). pthread_mutex_consistent putmsg setnetent - sigtimedwait timer_getoverrun ulimit waitid From 7af691a7848f808d629a8c18fe3b7a6aed9b9870 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 18 Dec 2017 19:44:30 +0100 Subject: [PATCH 187/649] Cygwin: rearrange sigwait functions, convert sigwait_common to inline Signed-off-by: Corinna Vinschen --- winsup/cygwin/signal.cc | 88 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 45 deletions(-) diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index 16210b571..f7c56c591 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -575,51 +575,7 @@ siginterrupt (int sig, int flag) return res; } -static int sigwait_common (const sigset_t *, siginfo_t *, PLARGE_INTEGER); - -extern "C" int -sigtimedwait (const sigset_t *set, siginfo_t *info, const timespec *timeout) -{ - LARGE_INTEGER waittime; - - if (timeout) - { - if (timeout->tv_sec < 0 - || timeout->tv_nsec < 0 || timeout->tv_nsec > (NSPERSEC * 100LL)) - { - set_errno (EINVAL); - return -1; - } - /* convert timespec to 100ns units */ - waittime.QuadPart = (LONGLONG) timeout->tv_sec * NSPERSEC - + ((LONGLONG) timeout->tv_nsec + 99LL) / 100LL; - } - - return sigwait_common (set, info, timeout ? &waittime : cw_infinite); -} - -extern "C" int -sigwait (const sigset_t *set, int *sig_ptr) -{ - int sig; - - do - { - sig = sigwait_common (set, NULL, cw_infinite); - } - while (sig == -1 && get_errno () == EINTR); - if (sig > 0) - *sig_ptr = sig; - return sig > 0 ? 0 : get_errno (); -} - -extern "C" int -sigwaitinfo (const sigset_t *set, siginfo_t *info) -{ - return sigwait_common (set, info, cw_infinite); -} - -static int +static inline int sigwait_common (const sigset_t *set, siginfo_t *info, PLARGE_INTEGER waittime) { int res = -1; @@ -664,6 +620,48 @@ sigwait_common (const sigset_t *set, siginfo_t *info, PLARGE_INTEGER waittime) return res; } +extern "C" int +sigtimedwait (const sigset_t *set, siginfo_t *info, const timespec *timeout) +{ + LARGE_INTEGER waittime; + + if (timeout) + { + if (timeout->tv_sec < 0 + || timeout->tv_nsec < 0 || timeout->tv_nsec > (NSPERSEC * 100LL)) + { + set_errno (EINVAL); + return -1; + } + /* convert timespec to 100ns units */ + waittime.QuadPart = (LONGLONG) timeout->tv_sec * NSPERSEC + + ((LONGLONG) timeout->tv_nsec + 99LL) / 100LL; + } + + return sigwait_common (set, info, timeout ? &waittime : cw_infinite); +} + +extern "C" int +sigwait (const sigset_t *set, int *sig_ptr) +{ + int sig; + + do + { + sig = sigwait_common (set, NULL, cw_infinite); + } + while (sig == -1 && get_errno () == EINTR); + if (sig > 0) + *sig_ptr = sig; + return sig > 0 ? 0 : get_errno (); +} + +extern "C" int +sigwaitinfo (const sigset_t *set, siginfo_t *info) +{ + return sigwait_common (set, info, cw_infinite); +} + /* FIXME: SUSv3 says that this function should block until the signal has actually been delivered. Currently, this will only happen when sending signals to the current process. It will not happen when sending signals From 1251555311100fc04550201f838a22c3193821ad Mon Sep 17 00:00:00 2001 From: Martin Aberg Date: Sun, 17 Dec 2017 19:23:51 +0100 Subject: [PATCH 188/649] newlib: Availability of _kill() in sys/signal.h Make prototype of _kill() always visible when _COMPILING_NEWLIB is defined. This makes consistent with the use of _COMPILING_NEWLIB in , , etc. --- newlib/libc/include/sys/signal.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h index ab35718ae..70ff15d01 100644 --- a/newlib/libc/include/sys/signal.h +++ b/newlib/libc/include/sys/signal.h @@ -168,11 +168,9 @@ int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset)); int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset)); #endif -#if defined(__CYGWIN__) || defined(__rtems__) #ifdef _COMPILING_NEWLIB int _EXFUN(_kill, (pid_t, int)); #endif /* _COMPILING_NEWLIB */ -#endif /* __CYGWIN__ || __rtems__ */ #if __POSIX_VISIBLE int _EXFUN(kill, (pid_t, int)); From dc2d175721df8ceb801d50581df95b49c26a6ff7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 18 Dec 2017 20:15:27 +0100 Subject: [PATCH 189/649] newlib: ftello{64}: Fix type of returned value Especially don't just use -1L since _off_t/_off64_t are not guaranteed to be of type long. Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/ftello.c | 8 ++++---- newlib/libc/stdio64/ftello64.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c index c120c26a9..0a9bb7bd6 100644 --- a/newlib/libc/stdio/ftello.c +++ b/newlib/libc/stdio/ftello.c @@ -99,7 +99,7 @@ _DEFUN(_ftello_r, (ptr, fp), { ptr->_errno = ESPIPE; _newlib_flockfile_exit (fp); - return -1L; + return (_off_t) -1; } /* Find offset of underlying I/O object, then adjust for buffered @@ -113,10 +113,10 @@ _DEFUN(_ftello_r, (ptr, fp), else { pos = fp->_seek (ptr, fp->_cookie, (_fpos_t) 0, SEEK_CUR); - if (pos == -1L) + if (pos == (_fpos_t) -1) { _newlib_flockfile_exit (fp); - return pos; + return (_off_t) -1; } } if (fp->_flags & __SRD) @@ -141,7 +141,7 @@ _DEFUN(_ftello_r, (ptr, fp), } _newlib_flockfile_end (fp); - return pos; + return (_off_t) pos; } #ifndef _REENT_ONLY diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c index c6226d105..9aca231ef 100644 --- a/newlib/libc/stdio64/ftello64.c +++ b/newlib/libc/stdio64/ftello64.c @@ -96,7 +96,7 @@ _DEFUN (_ftello64_r, (ptr, fp), { ptr->_errno = ESPIPE; _newlib_flockfile_exit(fp); - return -1L; + return (_off64_t) -1; } /* Find offset of underlying I/O object, then adjust for buffered @@ -110,10 +110,10 @@ _DEFUN (_ftello64_r, (ptr, fp), else { pos = fp->_seek64 (ptr, fp->_cookie, (_fpos64_t) 0, SEEK_CUR); - if (pos == -1L) + if (pos == (_fpos64_t) -1) { _newlib_flockfile_exit(fp); - return pos; + return (_off64_t) pos; } } if (fp->_flags & __SRD) @@ -138,7 +138,7 @@ _DEFUN (_ftello64_r, (ptr, fp), } _newlib_flockfile_end(fp); - return pos; + return (_off64_t) pos; } #ifndef _REENT_ONLY From 6e5b39940ae95d098fb89cf80d48f6e03d3833bf Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 18 Dec 2017 20:17:51 +0100 Subject: [PATCH 190/649] newlib: ftello{64}: Handle appending stream without fflushing Neither upstream FreeBSD nor glibc ever call fflush from ftell and friends. In border cases it has the tendency to return wrong or unexpected values, for instance on block devices. Signed-off-by: Corinna Vinschen --- newlib/libc/stdio/ftello.c | 20 +++++++++++++------- newlib/libc/stdio64/ftello64.c | 20 +++++++++++++------- 2 files changed, 26 insertions(+), 14 deletions(-) diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c index 0a9bb7bd6..90c4d321e 100644 --- a/newlib/libc/stdio/ftello.c +++ b/newlib/libc/stdio/ftello.c @@ -102,13 +102,19 @@ _DEFUN(_ftello_r, (ptr, fp), return (_off_t) -1; } - /* Find offset of underlying I/O object, then adjust for buffered - bytes. Flush a write stream, since the offset may be altered if - the stream is appending. Do not flush a read stream, since we - must not lose the ungetc buffer. */ - if (fp->_flags & __SWR) - _fflush_r (ptr, fp); - if (fp->_flags & __SOFF) + /* Find offset of underlying I/O object, then adjust for buffered bytes. */ + if (!(fp->_flags & __SRD) && (fp->_flags & __SWR) && + fp->_p != NULL && fp->_p - fp->_bf._base > 0 && + (fp->_flags & __SAPP)) + { + pos = fp->_seek (ptr, fp->_cookie, (_fpos_t) 0, SEEK_END); + if (pos == (_fpos_t) -1) + { + _newlib_flockfile_exit (fp); + return (_off_t) -1; + } + } + else if (fp->_flags & __SOFF) pos = fp->_offset; else { diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c index 9aca231ef..2441d4c1f 100644 --- a/newlib/libc/stdio64/ftello64.c +++ b/newlib/libc/stdio64/ftello64.c @@ -99,13 +99,19 @@ _DEFUN (_ftello64_r, (ptr, fp), return (_off64_t) -1; } - /* Find offset of underlying I/O object, then adjust for buffered - bytes. Flush a write stream, since the offset may be altered if - the stream is appending. Do not flush a read stream, since we - must not lose the ungetc buffer. */ - if (fp->_flags & __SWR) - _fflush_r (ptr, fp); - if (fp->_flags & __SOFF) + /* Find offset of underlying I/O object, then adjust for buffered bytes. */ + if (!(fp->_flags & __SRD) && (fp->_flags & __SWR) && + fp->_p != NULL && fp->_p - fp->_bf._base > 0 && + (fp->_flags & __SAPP)) + { + pos = fp->_seek64 (ptr, fp->_cookie, (_fpos64_t) 0, SEEK_END); + if (pos == (_fpos64_t) -1) + { + _newlib_flockfile_exit (fp); + return (_off64_t) -1; + } + } + else if (fp->_flags & __SOFF) pos = fp->_offset; else { From d5abcdd5a7fc3e45f4b0d20b7661c746e1091a8d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 18 Dec 2017 20:21:15 +0100 Subject: [PATCH 191/649] Cygwin: document sigtimedwait and ftell{o} patch Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.10.0 | 5 ++++- winsup/doc/new-features.xml | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0 index b16bb2394..3afc4b7d0 100644 --- a/winsup/cygwin/release/2.10.0 +++ b/winsup/cygwin/release/2.10.0 @@ -7,7 +7,7 @@ What's new: - scanf now handles the %l[ conversion. -- New API: wmempcpy. +- New APIs: sigtimedwait, wmempcpy. What changed: @@ -28,3 +28,6 @@ Bug Fixes - Fix a fork failure with private anonymous mmaps. Addresses: https://cygwin.com/ml/cygwin/2017-12/msg00061.html + +- Remove a call to fflush from ftell{o}, which may result in wrong offsets. + Addresses: https://cygwin.com/ml/cygwin/2017-12/msg00151.html diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml index 7e013890d..b3d258862 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -21,7 +21,7 @@ scanf/wscanf now handle the POSIX %m modifier. -New API: wmempcpy. +New APIs: sigtimedwait, wmempcpy. From eb4bfe4621ecaa49d0b4e586315286f8e4731046 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 19 Dec 2017 18:58:06 +0100 Subject: [PATCH 192/649] cygwin: block devices: fix file offset after short writes When reading/writing block devices, Cygwin emulates Linux, providing a byte-exact file position, albeit the underlying device drivers don't. Unfortunately this only worked correctly for reading. The raw_write method failed to revalidate the buffer after the read-modify-write cycle in case len is not a multiple of the sector length. This in turn resulted in lseek reporting a wrong file pointer. Also, fix a condition for invalidating the buffer after writing from a remaining read buffer. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_floppy.cc | 12 ++++++++++-- winsup/cygwin/release/2.10.0 | 3 +++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_floppy.cc b/winsup/cygwin/fhandler_floppy.cc index de9e163e5..cca00bab8 100644 --- a/winsup/cygwin/fhandler_floppy.cc +++ b/winsup/cygwin/fhandler_floppy.cc @@ -566,11 +566,11 @@ fhandler_dev_floppy::raw_write (const void *ptr, size_t len) /* Align pointers, lengths, etc. */ cplen = MIN (cplen, written); devbufstart += cplen; + if (devbufstart >= devbufend) + devbufstart = devbufend = 0; p += cplen; len -= cplen; bytes_written += cplen; - if (len) - devbufstart = devbufend = 0; } /* As long as there's still something left in the input buffer ... */ while (len) @@ -607,6 +607,14 @@ fhandler_dev_floppy::raw_write (const void *ptr, size_t len) p += cplen; len -= cplen; bytes_written += cplen; + /* If we overwrote, revalidate devbuf. It still contains the + content from the above read/modify/write. Revalidating makes + sure lseek reports the correct position. */ + if (cplen < bytes_per_sector) + { + devbufstart = cplen; + devbufend = bytes_per_sector; + } } return bytes_written; } diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0 index 3afc4b7d0..0c6b406a1 100644 --- a/winsup/cygwin/release/2.10.0 +++ b/winsup/cygwin/release/2.10.0 @@ -31,3 +31,6 @@ Bug Fixes - Remove a call to fflush from ftell{o}, which may result in wrong offsets. Addresses: https://cygwin.com/ml/cygwin/2017-12/msg00151.html + +- Fix file pointer computation after short writes on block devices. + Addresses: https://cygwin.com/ml/cygwin/2017-12/msg00151.html From ae3bd4f49e7800e786c0f9534df67e4fbee9fe69 Mon Sep 17 00:00:00 2001 From: Brian Inglis Date: Fri, 22 Dec 2017 11:32:57 -0700 Subject: [PATCH 193/649] winsup/doc/etc.postinstall.cygwin-doc.sh fix shell variable typo --- winsup/doc/etc.postinstall.cygwin-doc.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh index 2873d9395..935bd94e1 100755 --- a/winsup/doc/etc.postinstall.cygwin-doc.sh +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh @@ -52,7 +52,7 @@ fi # create User Guide and API PDF and HTML shortcuts while read target name desc do - [ -r $t ] && $mks $CYGWINFORALL -P -n "Cygwin/$name" -d "$desc" -- $target + [ -r $target ] && $mks $CYGWINFORALL -P -n "Cygwin/$name" -d "$desc" -- $target done < Date: Fri, 22 Dec 2017 11:35:56 -0700 Subject: [PATCH 194/649] cleanup winsup/doc/etc.{postinstall,preremove}.cygwin-doc.sh quote test variables, correct utility paths, define site in preremove --- winsup/doc/etc.postinstall.cygwin-doc.sh | 10 +++++----- winsup/doc/etc.preremove.cygwin-doc.sh | 5 +++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/winsup/doc/etc.postinstall.cygwin-doc.sh b/winsup/doc/etc.postinstall.cygwin-doc.sh index 935bd94e1..de7d9e0c3 100755 --- a/winsup/doc/etc.postinstall.cygwin-doc.sh +++ b/winsup/doc/etc.postinstall.cygwin-doc.sh @@ -10,9 +10,9 @@ doc=/usr/share/doc/cygwin-doc site=https://cygwin.com -cygp=/bin/cygpath -mks=/bin/mkshortcut -launch=/bin/cygstart +cygp=/usr/bin/cygpath +mks=/usr/bin/mkshortcut +launch=/usr/bin/cygstart html=$doc/html @@ -29,7 +29,7 @@ done # check for programs for p in $cygp $mks $launch do - if [ ! -x $p ] + if [ ! -x "$p" ] then echo "Can't find program '$p'" exit 2 @@ -52,7 +52,7 @@ fi # create User Guide and API PDF and HTML shortcuts while read target name desc do - [ -r $target ] && $mks $CYGWINFORALL -P -n "Cygwin/$name" -d "$desc" -- $target + [ -r "$target" ] && $mks $CYGWINFORALL -P -n "Cygwin/$name" -d "$desc" -- $target done < Date: Tue, 26 Dec 2017 12:18:42 -0800 Subject: [PATCH 195/649] RISC-V: Fix libnosys build. --- libgloss/libnosys/configure | 2 ++ libgloss/libnosys/configure.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libgloss/libnosys/configure b/libgloss/libnosys/configure index 046dca5d3..7c23c7a0a 100755 --- a/libgloss/libnosys/configure +++ b/libgloss/libnosys/configure @@ -2033,6 +2033,8 @@ case "${target}" in ;; mn10?00-*-*) ;; + riscv*-*-*) + ;; powerpcle-*-pe) ;; sh*-*-*) diff --git a/libgloss/libnosys/configure.in b/libgloss/libnosys/configure.in index d3d8c89f6..890821740 100644 --- a/libgloss/libnosys/configure.in +++ b/libgloss/libnosys/configure.in @@ -67,6 +67,8 @@ case "${target}" in ;; mn10?00-*-*) ;; + riscv*-*-*) + ;; powerpcle-*-pe) ;; sh*-*-*) From a6633677b9152d02164a51ae9ba79cef9230e1d3 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 26 Dec 2017 12:24:45 -0800 Subject: [PATCH 196/649] RISC-V: Add nanosleep functionality --- libgloss/riscv/Makefile.in | 1 + libgloss/riscv/nanosleep.c | 12 ++++++++++++ newlib/configure.host | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 libgloss/riscv/nanosleep.c diff --git a/libgloss/riscv/Makefile.in b/libgloss/riscv/Makefile.in index 2f03f4402..de4ea8d83 100644 --- a/libgloss/riscv/Makefile.in +++ b/libgloss/riscv/Makefile.in @@ -7,6 +7,7 @@ gloss_hdrs = \ gloss_srcs = \ syscalls.c \ + nanosleep.c # Extra files diff --git a/libgloss/riscv/nanosleep.c b/libgloss/riscv/nanosleep.c new file mode 100644 index 000000000..1a247109c --- /dev/null +++ b/libgloss/riscv/nanosleep.c @@ -0,0 +1,12 @@ +#include +#include + +int +nanosleep(const struct timespec *rqtp, struct timespec *rmtp) +{ + unsigned long current_time, end_time; + asm ("rdtime %0" : "+r" (current_time)); + end_time = current_time + rqtp->tv_sec * 1000000000ULL + rqtp->tv_nsec; + while (current_time <= end_time) asm ("rdtime %0" : "+r" (current_time)); + return 0; +} diff --git a/newlib/configure.host b/newlib/configure.host index 3e950d8a5..eb645868b 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -258,7 +258,7 @@ case "${host_cpu}" in riscv*) libm_machine_dir=riscv machine_dir=riscv - newlib_cflags="${newlib_cflags}" + newlib_cflags="${newlib_cflags} -DHAVE_NANOSLEEP" default_newlib_atexit_dynamic_alloc="no" ;; rl78) From 347b08391132d61702f9004d7b74f742a49907f6 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 26 Dec 2017 12:26:19 -0800 Subject: [PATCH 197/649] RISC-V: Updated syscall to take 6 arguments --- libgloss/riscv/machine/syscall.h | 6 +++-- libgloss/riscv/syscalls.c | 42 +++++++++++++++++--------------- 2 files changed, 26 insertions(+), 22 deletions(-) diff --git a/libgloss/riscv/machine/syscall.h b/libgloss/riscv/machine/syscall.h index 391dbaa71..cc7183273 100644 --- a/libgloss/riscv/machine/syscall.h +++ b/libgloss/riscv/machine/syscall.h @@ -57,12 +57,14 @@ extern long __syscall_error(long); static inline long -__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3) +__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5) { register long a0 asm("a0") = _a0; register long a1 asm("a1") = _a1; register long a2 asm("a2") = _a2; register long a3 asm("a3") = _a3; + register long a4 asm("a4") = _a4; + register long a5 asm("a5") = _a5; #ifdef __riscv_32e register long syscall_id asm("t0") = n; @@ -71,7 +73,7 @@ __internal_syscall(long n, long _a0, long _a1, long _a2, long _a3) #endif asm volatile ("scall" - : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(syscall_id)); + : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id)); if (a0 < 0) return __syscall_error (a0); diff --git a/libgloss/riscv/syscalls.c b/libgloss/riscv/syscalls.c index f9ec25dcd..19c69f083 100644 --- a/libgloss/riscv/syscalls.c +++ b/libgloss/riscv/syscalls.c @@ -69,8 +69,9 @@ #include #include -#define syscall_errno(n, a, b, c, d) \ - __internal_syscall(n, (long)(a), (long)(b), (long)(c), (long)(d)) +#define syscall_errno(n, a, b, c, d, e, f) \ + __internal_syscall(n, (long)(a), (long)(b), (long)(c), \ + (long)(d), (long)(e), (long)(f)) long __syscall_error(long a0) @@ -83,35 +84,35 @@ __syscall_error(long a0) int _open(const char *name, int flags, int mode) { - return syscall_errno (SYS_open, name, flags, mode, 0); + return syscall_errno (SYS_open, name, flags, mode, 0, 0, 0); } /* Open file relative to given directory. */ int _openat(int dirfd, const char *name, int flags, int mode) { - return syscall_errno (SYS_openat, dirfd, name, flags, mode); + return syscall_errno (SYS_openat, dirfd, name, flags, mode, 0, 0); } /* Set position in a file. */ off_t _lseek(int file, off_t ptr, int dir) { - return syscall_errno (SYS_lseek, file, ptr, dir, 0); + return syscall_errno (SYS_lseek, file, ptr, dir, 0, 0, 0); } /* Read from a file. */ ssize_t _read(int file, void *ptr, size_t len) { - return syscall_errno (SYS_read, file, ptr, len, 0); + return syscall_errno (SYS_read, file, ptr, len, 0, 0, 0); } /* Write to a file. */ ssize_t _write(int file, const void *ptr, size_t len) { - return syscall_errno (SYS_write, file, ptr, len, 0); + return syscall_errno (SYS_write, file, ptr, len, 0, 0, 0); } struct kernel_stat @@ -159,7 +160,7 @@ int _fstat(int file, struct stat *st) { struct kernel_stat kst; - int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0); + int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0, 0, 0); conv_stat (st, &kst); return rv; } @@ -169,7 +170,7 @@ int _stat(const char *file, struct stat *st) { struct kernel_stat kst; - int rv = syscall_errno (SYS_stat, file, &kst, 0, 0); + int rv = syscall_errno (SYS_stat, file, &kst, 0, 0, 0, 0); conv_stat (st, &kst); return rv; } @@ -179,7 +180,7 @@ int _lstat(const char *file, struct stat *st) { struct kernel_stat kst; - int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0); + int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0, 0, 0); conv_stat (st, &kst); return rv; } @@ -189,7 +190,7 @@ int _fstatat(int dirfd, const char *file, struct stat *st, int flags) { struct kernel_stat kst; - int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags); + int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags, 0, 0); conv_stat (st, &kst); return rv; } @@ -198,35 +199,35 @@ _fstatat(int dirfd, const char *file, struct stat *st, int flags) int _access(const char *file, int mode) { - return syscall_errno (SYS_access, file, mode, 0, 0); + return syscall_errno (SYS_access, file, mode, 0, 0, 0, 0); } /* Permissions of a file (by name) in a given directory. */ int _faccessat(int dirfd, const char *file, int mode, int flags) { - return syscall_errno (SYS_faccessat, dirfd, file, mode, flags); + return syscall_errno (SYS_faccessat, dirfd, file, mode, flags, 0, 0); } /* Close a file. */ int _close(int file) { - return syscall_errno (SYS_close, file, 0, 0, 0); + return syscall_errno (SYS_close, file, 0, 0, 0, 0, 0); } /* Establish a new name for an existing file. */ int _link(const char *old_name, const char *new_name) { - return syscall_errno (SYS_link, old_name, new_name, 0, 0); + return syscall_errno (SYS_link, old_name, new_name, 0, 0, 0, 0); } /* Remove a file's directory entry. */ int _unlink(const char *name) { - return syscall_errno (SYS_unlink, name, 0, 0, 0); + return syscall_errno (SYS_unlink, name, 0, 0, 0, 0, 0); } /* Transfer control to a new process. Minimal implementation for a @@ -295,7 +296,7 @@ _isatty(int file) int _gettimeofday(struct timeval *tp, void *tz) { - return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0); + return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0, 0, 0); } /* Timing information for current process. From @@ -396,13 +397,14 @@ _sbrk(ptrdiff_t incr) if (heap_end == 0) { - long brk = syscall_errno (SYS_brk, 0, 0, 0, 0); + long brk = syscall_errno (SYS_brk, 0, 0, 0, 0, 0, 0); if (brk == -1) return (void *)-1; heap_end = brk; } - if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0) != heap_end + incr) + if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0) + != heap_end + incr) return (void *)-1; heap_end += incr; @@ -414,6 +416,6 @@ _sbrk(ptrdiff_t incr) void _exit(int exit_status) { - syscall_errno (SYS_exit, exit_status, 0, 0, 0); + syscall_errno (SYS_exit, exit_status, 0, 0, 0, 0, 0); while (1); } From 28d5b98038dd18797375f4ff6a11fecd59809b22 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 26 Dec 2017 12:27:52 -0800 Subject: [PATCH 198/649] RISC-V: Moved syscalls to separate files to fix aliasing problems. --- libgloss/riscv/Makefile.in | 35 ++- libgloss/riscv/internal_syscall.h | 52 ++++ libgloss/riscv/kernel_stat.h | 39 +++ libgloss/riscv/machine/syscall.h | 27 -- libgloss/riscv/sys_access.c | 9 + libgloss/riscv/sys_chdir.c | 8 + libgloss/riscv/sys_chmod.c | 9 + libgloss/riscv/sys_chown.c | 8 + libgloss/riscv/sys_close.c | 9 + libgloss/riscv/sys_conv_stat.c | 21 ++ libgloss/riscv/sys_execve.c | 11 + libgloss/riscv/sys_exit.c | 10 + libgloss/riscv/sys_faccessat.c | 8 + libgloss/riscv/sys_fork.c | 10 + libgloss/riscv/sys_fstat.c | 15 ++ libgloss/riscv/sys_fstatat.c | 14 + libgloss/riscv/sys_ftime.c | 10 + libgloss/riscv/sys_getcwd.c | 9 + libgloss/riscv/sys_getpid.c | 11 + libgloss/riscv/sys_gettimeofday.c | 10 + libgloss/riscv/sys_isatty.c | 17 ++ libgloss/riscv/sys_kill.c | 11 + libgloss/riscv/sys_link.c | 8 + libgloss/riscv/sys_lseek.c | 10 + libgloss/riscv/sys_lstat.c | 13 + libgloss/riscv/sys_open.c | 9 + libgloss/riscv/sys_openat.c | 8 + libgloss/riscv/sys_read.c | 9 + libgloss/riscv/sys_sbrk.c | 27 ++ libgloss/riscv/sys_stat.c | 14 + libgloss/riscv/sys_sysconf.c | 17 ++ libgloss/riscv/sys_times.c | 37 +++ libgloss/riscv/sys_unlink.c | 9 + libgloss/riscv/sys_utime.c | 8 + libgloss/riscv/sys_wait.c | 10 + libgloss/riscv/sys_write.c | 10 + libgloss/riscv/syscalls.c | 421 ------------------------------ 37 files changed, 513 insertions(+), 450 deletions(-) create mode 100644 libgloss/riscv/internal_syscall.h create mode 100644 libgloss/riscv/kernel_stat.h create mode 100644 libgloss/riscv/sys_access.c create mode 100644 libgloss/riscv/sys_chdir.c create mode 100644 libgloss/riscv/sys_chmod.c create mode 100644 libgloss/riscv/sys_chown.c create mode 100644 libgloss/riscv/sys_close.c create mode 100644 libgloss/riscv/sys_conv_stat.c create mode 100644 libgloss/riscv/sys_execve.c create mode 100644 libgloss/riscv/sys_exit.c create mode 100644 libgloss/riscv/sys_faccessat.c create mode 100644 libgloss/riscv/sys_fork.c create mode 100644 libgloss/riscv/sys_fstat.c create mode 100644 libgloss/riscv/sys_fstatat.c create mode 100644 libgloss/riscv/sys_ftime.c create mode 100644 libgloss/riscv/sys_getcwd.c create mode 100644 libgloss/riscv/sys_getpid.c create mode 100644 libgloss/riscv/sys_gettimeofday.c create mode 100644 libgloss/riscv/sys_isatty.c create mode 100644 libgloss/riscv/sys_kill.c create mode 100644 libgloss/riscv/sys_link.c create mode 100644 libgloss/riscv/sys_lseek.c create mode 100644 libgloss/riscv/sys_lstat.c create mode 100644 libgloss/riscv/sys_open.c create mode 100644 libgloss/riscv/sys_openat.c create mode 100644 libgloss/riscv/sys_read.c create mode 100644 libgloss/riscv/sys_sbrk.c create mode 100644 libgloss/riscv/sys_stat.c create mode 100644 libgloss/riscv/sys_sysconf.c create mode 100644 libgloss/riscv/sys_times.c create mode 100644 libgloss/riscv/sys_unlink.c create mode 100644 libgloss/riscv/sys_utime.c create mode 100644 libgloss/riscv/sys_wait.c create mode 100644 libgloss/riscv/sys_write.c delete mode 100644 libgloss/riscv/syscalls.c diff --git a/libgloss/riscv/Makefile.in b/libgloss/riscv/Makefile.in index de4ea8d83..503575975 100644 --- a/libgloss/riscv/Makefile.in +++ b/libgloss/riscv/Makefile.in @@ -6,8 +6,39 @@ gloss_hdrs = \ machine/syscall.h \ gloss_srcs = \ - syscalls.c \ - nanosleep.c + nanosleep.c \ + sys_access.c \ + sys_chdir.c \ + sys_chmod.c \ + sys_chown.c \ + sys_close.c \ + sys_conv_stat.c \ + sys_execve.c \ + sys_exit.c \ + sys_faccessat.c \ + sys_fork.c \ + sys_fstatat.c \ + sys_fstat.c \ + sys_ftime.c \ + sys_getcwd.c \ + sys_getpid.c \ + sys_gettimeofday.c \ + sys_isatty.c \ + sys_kill.c \ + sys_link.c \ + sys_lseek.c \ + sys_lstat.c \ + sys_openat.c \ + sys_open.c \ + sys_read.c \ + sys_sbrk.c \ + sys_stat.c \ + sys_sysconf.c \ + sys_times.c \ + sys_unlink.c \ + sys_utime.c \ + sys_wait.c \ + sys_write.c # Extra files diff --git a/libgloss/riscv/internal_syscall.h b/libgloss/riscv/internal_syscall.h new file mode 100644 index 000000000..8f7dcb451 --- /dev/null +++ b/libgloss/riscv/internal_syscall.h @@ -0,0 +1,52 @@ +/* Copyright (c) 2017 SiFive Inc. All rights reserved. + + This copyrighted material is made available to anyone wishing to use, + modify, copy, or redistribute it subject to the terms and conditions + of the FreeBSD License. This program is distributed in the hope that + it will be useful, but WITHOUT ANY WARRANTY expressed or implied, + including the implied warranties of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. A copy of this license is available at + http://www.opensource.org/licenses. +*/ + +#ifndef _INTERNAL_SYSCALL_H +#define _INTERNAL_SYSCALL_H + +#include + +static inline long +__syscall_error(long a0) +{ + errno = -a0; + return -1; +} + +static inline long +__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5) +{ + register long a0 asm("a0") = _a0; + register long a1 asm("a1") = _a1; + register long a2 asm("a2") = _a2; + register long a3 asm("a3") = _a3; + register long a4 asm("a4") = _a4; + register long a5 asm("a5") = _a5; + +#ifdef __riscv_32e + register long syscall_id asm("t0") = n; +#else + register long syscall_id asm("a7") = n; +#endif + + asm volatile ("scall" + : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id)); + + if (a0 < 0) + return __syscall_error (a0); + else + return a0; +} + +#define syscall_errno(n, a, b, c, d, e, f) \ + __internal_syscall(n, (long)(a), (long)(b), (long)(c), (long)(d), (long)(e), (long)(f)) + +#endif diff --git a/libgloss/riscv/kernel_stat.h b/libgloss/riscv/kernel_stat.h new file mode 100644 index 000000000..d07bac544 --- /dev/null +++ b/libgloss/riscv/kernel_stat.h @@ -0,0 +1,39 @@ +/* Copyright (c) 2017 SiFive Inc. All rights reserved. + + This copyrighted material is made available to anyone wishing to use, + modify, copy, or redistribute it subject to the terms and conditions + of the FreeBSD License. This program is distributed in the hope that + it will be useful, but WITHOUT ANY WARRANTY expressed or implied, + including the implied warranties of MERCHANTABILITY or FITNESS FOR + A PARTICULAR PURPOSE. A copy of this license is available at + http://www.opensource.org/licenses. +*/ + +#ifndef _RISCV_KERNEL_STAT_H +#define _RISCV_KERNEL_STAT_H + +#include +#include + +struct kernel_stat +{ + unsigned long long st_dev; + unsigned long long st_ino; + unsigned int st_mode; + unsigned int st_nlink; + unsigned int st_uid; + unsigned int st_gid; + unsigned long long st_rdev; + unsigned long long __pad1; + long long st_size; + int st_blksize; + int __pad2; + long long st_blocks; + struct timespec st_atim; + struct timespec st_mtim; + struct timespec st_ctim; + int __glibc_reserved[2]; +}; + +void _conv_stat (struct stat *, struct kernel_stat *); +#endif /* _RISCV_KERNEL_STAT_H */ diff --git a/libgloss/riscv/machine/syscall.h b/libgloss/riscv/machine/syscall.h index cc7183273..5cd15b848 100644 --- a/libgloss/riscv/machine/syscall.h +++ b/libgloss/riscv/machine/syscall.h @@ -54,31 +54,4 @@ #define SYS_time 1062 #define SYS_getmainvars 2011 -extern long __syscall_error(long); - -static inline long -__internal_syscall(long n, long _a0, long _a1, long _a2, long _a3, long _a4, long _a5) -{ - register long a0 asm("a0") = _a0; - register long a1 asm("a1") = _a1; - register long a2 asm("a2") = _a2; - register long a3 asm("a3") = _a3; - register long a4 asm("a4") = _a4; - register long a5 asm("a5") = _a5; - -#ifdef __riscv_32e - register long syscall_id asm("t0") = n; -#else - register long syscall_id asm("a7") = n; -#endif - - asm volatile ("scall" - : "+r"(a0) : "r"(a1), "r"(a2), "r"(a3), "r"(a4), "r"(a5), "r"(syscall_id)); - - if (a0 < 0) - return __syscall_error (a0); - else - return a0; -} - #endif diff --git a/libgloss/riscv/sys_access.c b/libgloss/riscv/sys_access.c new file mode 100644 index 000000000..ef446d29b --- /dev/null +++ b/libgloss/riscv/sys_access.c @@ -0,0 +1,9 @@ +#include +#include "internal_syscall.h" + +/* Permissions of a file (by name). */ +int +_access(const char *file, int mode) +{ + return syscall_errno (SYS_access, file, mode, 0, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_chdir.c b/libgloss/riscv/sys_chdir.c new file mode 100644 index 000000000..0b2b0f53d --- /dev/null +++ b/libgloss/riscv/sys_chdir.c @@ -0,0 +1,8 @@ +#include + +/* Stub. */ +int +_chdir(const char *path) +{ + return -1; +} diff --git a/libgloss/riscv/sys_chmod.c b/libgloss/riscv/sys_chmod.c new file mode 100644 index 000000000..2c11e1d03 --- /dev/null +++ b/libgloss/riscv/sys_chmod.c @@ -0,0 +1,9 @@ +#include +#include + +/* Stub. */ +int +_chmod(const char *path, mode_t mode) +{ + return -1; +} diff --git a/libgloss/riscv/sys_chown.c b/libgloss/riscv/sys_chown.c new file mode 100644 index 000000000..8faddffe2 --- /dev/null +++ b/libgloss/riscv/sys_chown.c @@ -0,0 +1,8 @@ +#include +#include + +/* Stub. */ +int _chown(const char *path, uid_t owner, gid_t group) +{ + return -1; +} diff --git a/libgloss/riscv/sys_close.c b/libgloss/riscv/sys_close.c new file mode 100644 index 000000000..80b10c66a --- /dev/null +++ b/libgloss/riscv/sys_close.c @@ -0,0 +1,9 @@ +#include +#include "internal_syscall.h" + +/* Close a file. */ +int +_close(int file) +{ + return syscall_errno (SYS_close, file, 0, 0, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_conv_stat.c b/libgloss/riscv/sys_conv_stat.c new file mode 100644 index 000000000..73c6a8672 --- /dev/null +++ b/libgloss/riscv/sys_conv_stat.c @@ -0,0 +1,21 @@ +#include +#include "kernel_stat.h" + +/* Convert linux's stat64 sturct to newlib's stat. */ +void +_conv_stat (struct stat *st, struct kernel_stat *kst) +{ + st->st_dev = kst->st_dev; + st->st_ino = kst->st_ino; + st->st_mode = kst->st_mode; + st->st_nlink = kst->st_nlink; + st->st_uid = kst->st_uid; + st->st_gid = kst->st_gid; + st->st_rdev = kst->st_rdev; + st->st_size = kst->st_size; + st->st_blocks = kst->st_blocks; + st->st_blksize = kst->st_blksize; + st->st_atime = kst->st_atim.tv_sec; + st->st_mtime = kst->st_mtim.tv_sec; + st->st_ctime = kst->st_ctim.tv_sec; +} diff --git a/libgloss/riscv/sys_execve.c b/libgloss/riscv/sys_execve.c new file mode 100644 index 000000000..d6447373e --- /dev/null +++ b/libgloss/riscv/sys_execve.c @@ -0,0 +1,11 @@ +#include +#include "internal_syscall.h" + +/* Transfer control to a new process. Minimal implementation for a + system without processes from newlib documentation. */ +int +_execve(const char *name, char *const argv[], char *const env[]) +{ + errno = ENOMEM; + return -1; +} diff --git a/libgloss/riscv/sys_exit.c b/libgloss/riscv/sys_exit.c new file mode 100644 index 000000000..03e1c34e8 --- /dev/null +++ b/libgloss/riscv/sys_exit.c @@ -0,0 +1,10 @@ +#include +#include "internal_syscall.h" + +/* Exit a program without cleaning up files. */ +void +_exit(int exit_status) +{ + syscall_errno (SYS_exit, exit_status, 0, 0, 0, 0, 0); + while (1); +} diff --git a/libgloss/riscv/sys_faccessat.c b/libgloss/riscv/sys_faccessat.c new file mode 100644 index 000000000..e966a4a78 --- /dev/null +++ b/libgloss/riscv/sys_faccessat.c @@ -0,0 +1,8 @@ +#include +#include "internal_syscall.h" + +/* Permissions of a file (by name) in a given directory. */ +int _faccessat(int dirfd, const char *file, int mode, int flags) +{ + return syscall_errno (SYS_faccessat, dirfd, file, mode, flags, 0, 0); +} diff --git a/libgloss/riscv/sys_fork.c b/libgloss/riscv/sys_fork.c new file mode 100644 index 000000000..8ace14096 --- /dev/null +++ b/libgloss/riscv/sys_fork.c @@ -0,0 +1,10 @@ +#include +#include "internal_syscall.h" + +/* Create a new process. Minimal implementation for a system without + processes from newlib documentation. */ +int _fork() +{ + errno = EAGAIN; + return -1; +} diff --git a/libgloss/riscv/sys_fstat.c b/libgloss/riscv/sys_fstat.c new file mode 100644 index 000000000..13a0bca2f --- /dev/null +++ b/libgloss/riscv/sys_fstat.c @@ -0,0 +1,15 @@ +#include +#include "kernel_stat.h" +#include "internal_syscall.h" + +/* Status of an open file. The sys/stat.h header file required is + distributed in the include subdirectory for this C library. */ + +int +_fstat(int file, struct stat *st) +{ + struct kernel_stat kst; + int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0, 0, 0); + _conv_stat (st, &kst); + return rv; +} diff --git a/libgloss/riscv/sys_fstatat.c b/libgloss/riscv/sys_fstatat.c new file mode 100644 index 000000000..0e4ea42d0 --- /dev/null +++ b/libgloss/riscv/sys_fstatat.c @@ -0,0 +1,14 @@ +#include +#include "kernel_stat.h" +#include "internal_syscall.h" + +/* Status of an open file. The sys/stat.h header file required is + distributed in the include subdirectory for this C library. */ +int +_fstatat(int dirfd, const char *file, struct stat *st, int flags) +{ + struct kernel_stat kst; + int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags, 0, 0); + _conv_stat (st, &kst); + return rv; +} diff --git a/libgloss/riscv/sys_ftime.c b/libgloss/riscv/sys_ftime.c new file mode 100644 index 000000000..5705592be --- /dev/null +++ b/libgloss/riscv/sys_ftime.c @@ -0,0 +1,10 @@ +#include +#include + +/* Get the current time. Only relatively correct. */ +int +_ftime(struct timeb *tp) +{ + tp->time = tp->millitm = 0; + return 0; +} diff --git a/libgloss/riscv/sys_getcwd.c b/libgloss/riscv/sys_getcwd.c new file mode 100644 index 000000000..b0fb205d7 --- /dev/null +++ b/libgloss/riscv/sys_getcwd.c @@ -0,0 +1,9 @@ +#include +#include + +/* Stub. */ +char * +_getcwd(char *buf, size_t size) +{ + return NULL; +} diff --git a/libgloss/riscv/sys_getpid.c b/libgloss/riscv/sys_getpid.c new file mode 100644 index 000000000..2aa072177 --- /dev/null +++ b/libgloss/riscv/sys_getpid.c @@ -0,0 +1,11 @@ +#include + +/* Get process id. This is sometimes used to generate strings unlikely + to conflict with other processes. Minimal implementation for a + system without processes just returns 1. */ + +int +_getpid() +{ + return 1; +} diff --git a/libgloss/riscv/sys_gettimeofday.c b/libgloss/riscv/sys_gettimeofday.c new file mode 100644 index 000000000..457dcbcc7 --- /dev/null +++ b/libgloss/riscv/sys_gettimeofday.c @@ -0,0 +1,10 @@ +#include +#include +#include "internal_syscall.h" + +/* Get the current time. Only relatively correct. */ +int +_gettimeofday(struct timeval *tp, void *tzp) +{ + return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_isatty.c b/libgloss/riscv/sys_isatty.c new file mode 100644 index 000000000..0dc3db169 --- /dev/null +++ b/libgloss/riscv/sys_isatty.c @@ -0,0 +1,17 @@ +#include +#include +#include "internal_syscall.h" + +extern int _fstat(int file, struct stat *st); + +/* Query whether output stream is a terminal. For consistency with the + other minimal implementations, which only support output to stdout, + this minimal implementation is suggested by the newlib docs. */ + +int +_isatty(int file) +{ + struct stat s; + int ret = _fstat (file, &s); + return ret == -1 ? -1 : !!(s.st_mode & S_IFCHR); +} diff --git a/libgloss/riscv/sys_kill.c b/libgloss/riscv/sys_kill.c new file mode 100644 index 000000000..cf7f224ef --- /dev/null +++ b/libgloss/riscv/sys_kill.c @@ -0,0 +1,11 @@ +#include +#include "internal_syscall.h" + +/* Send a signal. Minimal implementation for a system without processes + just causes an error. */ +int +_kill(int pid, int sig) +{ + errno = EINVAL; + return -1; +} diff --git a/libgloss/riscv/sys_link.c b/libgloss/riscv/sys_link.c new file mode 100644 index 000000000..eaeb22b25 --- /dev/null +++ b/libgloss/riscv/sys_link.c @@ -0,0 +1,8 @@ +#include +#include "internal_syscall.h" + +/* Establish a new name for an existing file. */ +int _link(const char *old_name, const char *new_name) +{ + return syscall_errno (SYS_link, old_name, new_name, 0, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_lseek.c b/libgloss/riscv/sys_lseek.c new file mode 100644 index 000000000..7486a3a3e --- /dev/null +++ b/libgloss/riscv/sys_lseek.c @@ -0,0 +1,10 @@ +#include +#include +#include "internal_syscall.h" + +/* Set position in a file. */ +off_t +_lseek(int file, off_t ptr, int dir) +{ + return syscall_errno (SYS_lseek, file, ptr, dir, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_lstat.c b/libgloss/riscv/sys_lstat.c new file mode 100644 index 000000000..2eeabcce3 --- /dev/null +++ b/libgloss/riscv/sys_lstat.c @@ -0,0 +1,13 @@ +#include +#include +#include "internal_syscall.h" +#include "kernel_stat.h" + +/* Status of a link (by name). */ +int _lstat(const char *file, struct stat *st) +{ + struct kernel_stat kst; + int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0, 0, 0); + _conv_stat (st, &kst); + return rv; +} diff --git a/libgloss/riscv/sys_open.c b/libgloss/riscv/sys_open.c new file mode 100644 index 000000000..4fd5d672f --- /dev/null +++ b/libgloss/riscv/sys_open.c @@ -0,0 +1,9 @@ +#include +#include "internal_syscall.h" + +/* Open a file. */ +int +_open(const char *name, int flags, int mode) +{ + return syscall_errno (SYS_open, name, flags, mode, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_openat.c b/libgloss/riscv/sys_openat.c new file mode 100644 index 000000000..cf429b7b2 --- /dev/null +++ b/libgloss/riscv/sys_openat.c @@ -0,0 +1,8 @@ +#include +#include "internal_syscall.h" + +/* Open file relative to given directory. */ +int _openat(int dirfd, const char *name, int flags, int mode) +{ + return syscall_errno (SYS_openat, dirfd, name, flags, mode, 0, 0); +} diff --git a/libgloss/riscv/sys_read.c b/libgloss/riscv/sys_read.c new file mode 100644 index 000000000..7367e2643 --- /dev/null +++ b/libgloss/riscv/sys_read.c @@ -0,0 +1,9 @@ +#include +#include +#include "internal_syscall.h" + +/* Read from a file. */ +ssize_t _read(int file, void *ptr, size_t len) +{ + return syscall_errno (SYS_read, file, ptr, len, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_sbrk.c b/libgloss/riscv/sys_sbrk.c new file mode 100644 index 000000000..036b897f4 --- /dev/null +++ b/libgloss/riscv/sys_sbrk.c @@ -0,0 +1,27 @@ +#include +#include +#include "internal_syscall.h" + +/* Increase program data space. As malloc and related functions depend + on this, it is useful to have a working implementation. The following + is suggested by the newlib docs and suffices for a standalone + system. */ +void * +_sbrk(ptrdiff_t incr) +{ + static unsigned long heap_end; + + if (heap_end == 0) + { + long brk = syscall_errno (SYS_brk, 0, 0, 0, 0, 0, 0); + if (brk == -1) + return (void *)-1; + heap_end = brk; + } + + if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0) != heap_end + incr) + return (void *)-1; + + heap_end += incr; + return (void *)(heap_end - incr); +} diff --git a/libgloss/riscv/sys_stat.c b/libgloss/riscv/sys_stat.c new file mode 100644 index 000000000..a193b10ad --- /dev/null +++ b/libgloss/riscv/sys_stat.c @@ -0,0 +1,14 @@ +#include +#include "kernel_stat.h" +#include "internal_syscall.h" + +/* Status of a file (by name). */ + +int +_stat(const char *file, struct stat *st) +{ + struct kernel_stat kst; + int rv = syscall_errno (SYS_stat, file, &kst, 0, 0, 0, 0); + _conv_stat (st, &kst); + return rv; +} diff --git a/libgloss/riscv/sys_sysconf.c b/libgloss/riscv/sys_sysconf.c new file mode 100644 index 000000000..dffdebab9 --- /dev/null +++ b/libgloss/riscv/sys_sysconf.c @@ -0,0 +1,17 @@ +#include +#include +#include + +/* Get configurable system variables. */ + +long +_sysconf(int name) +{ + switch (name) + { + case _SC_CLK_TCK: + return CLOCKS_PER_SEC; + } + + return -1; +} diff --git a/libgloss/riscv/sys_times.c b/libgloss/riscv/sys_times.c new file mode 100644 index 000000000..eb0ef9d1f --- /dev/null +++ b/libgloss/riscv/sys_times.c @@ -0,0 +1,37 @@ +#include +#include +#include +#include +#include "internal_syscall.h" + +extern int _gettimeofday(struct timeval *, void *); + +/* Timing information for current process. From + newlib/libc/include/sys/times.h the tms struct fields are as follows: + + - clock_t tms_utime : user clock ticks + - clock_t tms_stime : system clock ticks + - clock_t tms_cutime : children's user clock ticks + - clock_t tms_cstime : children's system clock ticks + + Since maven does not currently support processes we set both of the + children's times to zero. Eventually we might want to separately + account for user vs system time, but for now we just return the total + number of cycles since starting the program. */ +clock_t +_times(struct tms *buf) +{ + // when called for the first time, initialize t0 + static struct timeval t0; + if (t0.tv_sec == 0) + _gettimeofday (&t0, 0); + + struct timeval t; + _gettimeofday (&t, 0); + + long long utime = (t.tv_sec - t0.tv_sec) * 1000000 + (t.tv_usec - t0.tv_usec); + buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000; + buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0; + + return -1; +} diff --git a/libgloss/riscv/sys_unlink.c b/libgloss/riscv/sys_unlink.c new file mode 100644 index 000000000..b55fe1ec2 --- /dev/null +++ b/libgloss/riscv/sys_unlink.c @@ -0,0 +1,9 @@ +#include +#include "internal_syscall.h" + +/* Remove a file's directory entry. */ +int +_unlink(const char *name) +{ + return syscall_errno (SYS_unlink, name, 0, 0, 0, 0, 0); +} diff --git a/libgloss/riscv/sys_utime.c b/libgloss/riscv/sys_utime.c new file mode 100644 index 000000000..c03a968e4 --- /dev/null +++ b/libgloss/riscv/sys_utime.c @@ -0,0 +1,8 @@ +#include + +/* Stub. */ +int +_utime(const char *path, const struct utimbuf *times) +{ + return -1; +} diff --git a/libgloss/riscv/sys_wait.c b/libgloss/riscv/sys_wait.c new file mode 100644 index 000000000..25bf44800 --- /dev/null +++ b/libgloss/riscv/sys_wait.c @@ -0,0 +1,10 @@ +#include +#include + +/* Wait for a child process. Minimal implementation for a system without + processes just causes an error. */ +int _wait(int *status) +{ + errno = ECHILD; + return -1; +} diff --git a/libgloss/riscv/sys_write.c b/libgloss/riscv/sys_write.c new file mode 100644 index 000000000..b972734e2 --- /dev/null +++ b/libgloss/riscv/sys_write.c @@ -0,0 +1,10 @@ +#include +#include +#include "internal_syscall.h" + +/* Write to a file. */ +ssize_t +_write(int file, const void *ptr, size_t len) +{ + return syscall_errno (SYS_write, file, ptr, len, 0, 0, 0); +} diff --git a/libgloss/riscv/syscalls.c b/libgloss/riscv/syscalls.c deleted file mode 100644 index 19c69f083..000000000 --- a/libgloss/riscv/syscalls.c +++ /dev/null @@ -1,421 +0,0 @@ -/* Copyright (c) 2017 SiFive Inc. All rights reserved. - - This copyrighted material is made available to anyone wishing to use, - modify, copy, or redistribute it subject to the terms and conditions - of the FreeBSD License. This program is distributed in the hope that - it will be useful, but WITHOUT ANY WARRANTY expressed or implied, - including the implied warranties of MERCHANTABILITY or FITNESS FOR - A PARTICULAR PURPOSE. A copy of this license is available at - http://www.opensource.org/licenses. - - ======================================================================== - syscalls.c : Newlib operating system interface - ======================================================================== - This is the maven implementation of the narrow newlib operating - system interface. It is based on the minimum stubs in the newlib - documentation, the error stubs in libnosys, and the previous scale - implementation. Please do not include any additional system calls or - other functions in this file. Additional header and source files - should be in the machine subdirectory. - - Here is a list of the functions which make up the operating system - interface. The file management instructions execute syscall assembly - instructions so that a proxy kernel (or the simulator) can marshal up - the request to the host machine. The process management functions are - mainly just stubs since for now maven only supports a single process. - - - File management functions - + open : (v) open file - + lseek : (v) set position in file - + read : (v) read from file - + write : (v) write to file - + fstat : (z) status of an open file - + stat : (z) status of a file by name - + close : (z) close a file - + link : (z) rename a file - + unlink : (z) remote file's directory entry - - - Process management functions - + execve : (z) transfer control to new proc - + fork : (z) create a new process - + getpid : (v) get process id - + kill : (z) send signal to child process - + wait : (z) wait for a child process - - - Misc functions - + isatty : (v) query whether output stream is a terminal - + times : (z) timing information for current process - + sbrk : (v) increase program data space - + _exit : (-) exit program without cleaning up files - - There are two types of system calls. Those which return a value when - everything is okay (marked with (v) in above list) and those which - return a zero when everything is okay (marked with (z) in above - list). On an error (ie. when the error flag is 1) the return value is - always an errno which should correspond to the numbers in - newlib/libc/include/sys/errno.h - - See the newlib documentation for more information - http://sourceware.org/newlib/libc.html#Syscalls -*/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define syscall_errno(n, a, b, c, d, e, f) \ - __internal_syscall(n, (long)(a), (long)(b), (long)(c), \ - (long)(d), (long)(e), (long)(f)) - -long -__syscall_error(long a0) -{ - errno = -a0; - return -1; -} - -/* Open a file. */ -int -_open(const char *name, int flags, int mode) -{ - return syscall_errno (SYS_open, name, flags, mode, 0, 0, 0); -} - -/* Open file relative to given directory. */ -int -_openat(int dirfd, const char *name, int flags, int mode) -{ - return syscall_errno (SYS_openat, dirfd, name, flags, mode, 0, 0); -} - -/* Set position in a file. */ -off_t -_lseek(int file, off_t ptr, int dir) -{ - return syscall_errno (SYS_lseek, file, ptr, dir, 0, 0, 0); -} - -/* Read from a file. */ -ssize_t -_read(int file, void *ptr, size_t len) -{ - return syscall_errno (SYS_read, file, ptr, len, 0, 0, 0); -} - -/* Write to a file. */ -ssize_t -_write(int file, const void *ptr, size_t len) -{ - return syscall_errno (SYS_write, file, ptr, len, 0, 0, 0); -} - -struct kernel_stat -{ - unsigned long long st_dev; - unsigned long long st_ino; - unsigned int st_mode; - unsigned int st_nlink; - unsigned int st_uid; - unsigned int st_gid; - unsigned long long st_rdev; - unsigned long long __pad1; - long long st_size; - int st_blksize; - int __pad2; - long long st_blocks; - struct timespec st_atim; - struct timespec st_mtim; - struct timespec st_ctim; - int __glibc_reserved[2]; -}; - -/* Convert linux's stat64 sturct to newlib's stat. */ -static void -conv_stat (struct stat *st, struct kernel_stat *kst) -{ - st->st_dev = kst->st_dev; - st->st_ino = kst->st_ino; - st->st_mode = kst->st_mode; - st->st_nlink = kst->st_nlink; - st->st_uid = kst->st_uid; - st->st_gid = kst->st_gid; - st->st_rdev = kst->st_rdev; - st->st_size = kst->st_size; - st->st_blocks = kst->st_blocks; - st->st_blksize = kst->st_blksize; - st->st_atime = kst->st_atim.tv_sec; - st->st_mtime = kst->st_mtim.tv_sec; - st->st_ctime = kst->st_ctim.tv_sec; -} - -/* Status of an open file. The sys/stat.h header file required is - distributed in the include subdirectory for this C library. */ -int -_fstat(int file, struct stat *st) -{ - struct kernel_stat kst; - int rv = syscall_errno (SYS_fstat, file, &kst, 0, 0, 0, 0); - conv_stat (st, &kst); - return rv; -} - -/* Status of a file (by name). */ -int -_stat(const char *file, struct stat *st) -{ - struct kernel_stat kst; - int rv = syscall_errno (SYS_stat, file, &kst, 0, 0, 0, 0); - conv_stat (st, &kst); - return rv; -} - -/* Status of a link (by name). */ -int -_lstat(const char *file, struct stat *st) -{ - struct kernel_stat kst; - int rv = syscall_errno (SYS_lstat, file, &kst, 0, 0, 0, 0); - conv_stat (st, &kst); - return rv; -} - -/* Status of a file (by name) in a given directory. */ -int -_fstatat(int dirfd, const char *file, struct stat *st, int flags) -{ - struct kernel_stat kst; - int rv = syscall_errno (SYS_fstatat, dirfd, file, &kst, flags, 0, 0); - conv_stat (st, &kst); - return rv; -} - -/* Permissions of a file (by name). */ -int -_access(const char *file, int mode) -{ - return syscall_errno (SYS_access, file, mode, 0, 0, 0, 0); -} - -/* Permissions of a file (by name) in a given directory. */ -int -_faccessat(int dirfd, const char *file, int mode, int flags) -{ - return syscall_errno (SYS_faccessat, dirfd, file, mode, flags, 0, 0); -} - -/* Close a file. */ -int -_close(int file) -{ - return syscall_errno (SYS_close, file, 0, 0, 0, 0, 0); -} - -/* Establish a new name for an existing file. */ -int -_link(const char *old_name, const char *new_name) -{ - return syscall_errno (SYS_link, old_name, new_name, 0, 0, 0, 0); -} - -/* Remove a file's directory entry. */ -int -_unlink(const char *name) -{ - return syscall_errno (SYS_unlink, name, 0, 0, 0, 0, 0); -} - -/* Transfer control to a new process. Minimal implementation for a - system without processes from newlib documentation. */ -int -_execve(const char *name, char *const argv[], char *const env[]) -{ - errno = ENOMEM; - return -1; -} - -/* Create a new process. Minimal implementation for a system without - processes from newlib documentation. */ - -int -_fork() -{ - errno = EAGAIN; - return -1; -} - -/* Get process id. This is sometimes used to generate strings unlikely - to conflict with other processes. Minimal implementation for a - system without processes just returns 1. */ - -int -_getpid() -{ - return 1; -} - -/* Send a signal. Minimal implementation for a system without processes - just causes an error. */ - -int -_kill(int pid, int sig) -{ - errno = EINVAL; - return -1; -} - -/* Wait for a child process. Minimal implementation for a system without - processes just causes an error. */ - -int -_wait(int *status) -{ - errno = ECHILD; - return -1; -} - -/* Query whether output stream is a terminal. For consistency with the - other minimal implementations, which only support output to stdout, - this minimal implementation is suggested by the newlib docs. */ - -int -_isatty(int file) -{ - struct stat s; - int ret = _fstat (file, &s); - return ret == -1 ? -1 : !!(s.st_mode & S_IFCHR); -} - -/* Get the current time. Only relatively correct. */ - -int -_gettimeofday(struct timeval *tp, void *tz) -{ - return syscall_errno (SYS_gettimeofday, tp, 0, 0, 0, 0, 0); -} - -/* Timing information for current process. From - newlib/libc/include/sys/times.h the tms struct fields are as follows: - - - clock_t tms_utime : user clock ticks - - clock_t tms_stime : system clock ticks - - clock_t tms_cutime : children's user clock ticks - - clock_t tms_cstime : children's system clock ticks - - Since maven does not currently support processes we set both of the - children's times to zero. Eventually we might want to separately - account for user vs system time, but for now we just return the total - number of cycles since starting the program. */ -clock_t -_times(struct tms *buf) -{ - // when called for the first time, initialize t0 - static struct timeval t0; - if(t0.tv_sec == 0) - _gettimeofday (&t0,0); - - struct timeval t; - _gettimeofday (&t, 0); - - long long utime = (t.tv_sec - t0.tv_sec) * 1000000 + (t.tv_usec - t0.tv_usec); - buf->tms_utime = utime * CLOCKS_PER_SEC / 1000000; - buf->tms_stime = buf->tms_cstime = buf->tms_cutime = 0; - - return -1; -} - -/* Get the current time. Only relatively correct. */ -int -_ftime(struct timeb *tp) -{ - tp->time = tp->millitm = 0; - return 0; -} - -/* Stub. */ -int -_utime(const char *path, const struct utimbuf *times) -{ - return -1; -} - -/* Stub. */ -int -_chown(const char *path, uid_t owner, gid_t group) -{ - return -1; -} - -/* Stub. */ -int -_chmod(const char *path, mode_t mode) -{ - return -1; -} - -/* Stub. */ -int -_chdir(const char *path) -{ - return -1; -} - -/* Stub. */ -char * -_getcwd(char *buf, size_t size) -{ - return NULL; -} - -/* Get configurable system variables. */ - -long -_sysconf(int name) -{ - switch (name) - { - case _SC_CLK_TCK: - return CLOCKS_PER_SEC; - } - - return -1; -} - -/* Increase program data space. As malloc and related functions depend - on this, it is useful to have a working implementation. The following - is suggested by the newlib docs and suffices for a standalone - system. */ -void * -_sbrk(ptrdiff_t incr) -{ - static unsigned long heap_end; - - if (heap_end == 0) - { - long brk = syscall_errno (SYS_brk, 0, 0, 0, 0, 0, 0); - if (brk == -1) - return (void *)-1; - heap_end = brk; - } - - if (syscall_errno (SYS_brk, heap_end + incr, 0, 0, 0, 0, 0) - != heap_end + incr) - return (void *)-1; - - heap_end += incr; - return (void *)(heap_end - incr); -} - -/* Exit a program without cleaning up files. */ - -void -_exit(int exit_status) -{ - syscall_errno (SYS_exit, exit_status, 0, 0, 0, 0, 0); - while (1); -} From 9588ff7555057ea1f62fda35e60428b5fa2ce943 Mon Sep 17 00:00:00 2001 From: Jim Wilson Date: Tue, 26 Dec 2017 12:30:27 -0800 Subject: [PATCH 199/649] RISC-V: Add gdb sim and newlib nano support. Fix a few misc minor bugs. --- libgloss/riscv/Makefile.in | 55 +++++++++++++++++++++++++++++++++----- libgloss/riscv/nano.specs | 23 ++++++++++++++++ libgloss/riscv/sim.specs | 10 +++++++ libgloss/riscv/sys_sbrk.c | 29 ++++++++++++++++++++ 4 files changed, 111 insertions(+), 6 deletions(-) create mode 100644 libgloss/riscv/nano.specs create mode 100644 libgloss/riscv/sim.specs diff --git a/libgloss/riscv/Makefile.in b/libgloss/riscv/Makefile.in index 503575975..579dd9554 100644 --- a/libgloss/riscv/Makefile.in +++ b/libgloss/riscv/Makefile.in @@ -40,6 +40,9 @@ gloss_srcs = \ sys_wait.c \ sys_write.c +gloss_specs = \ + nano.specs sim.specs + # Extra files crt0_asm = crt0.S @@ -117,10 +120,20 @@ gloss_c_deps = $(patsubst %.c, %.d, $(notdir $(gloss_c_srcs))) $(gloss_c_objs) : %.o : %.c $(COMPILE) -c $< -objs += $(gloss_c_objs) +gloss_objs += $(gloss_c_objs) deps += $(gloss_c_deps) junk += $(gloss_c_deps) $(gloss_c_objs) +sim_c_objs = $(patsubst %.c, sim-%.o, $(notdir $(gloss_c_srcs))) +sim_c_deps = $(patsubst %.c, sim-%.d, $(notdir $(gloss_c_srcs))) + +$(sim_c_objs): sim-%.o : %.c + $(COMPILE) -c -DUSING_SIM_SPECS -o $@ $< + +sim_objs += $(sim_c_objs) +deps += $(sim_c_deps) +junk += $(sim_c_deps) $(sim_c_objs) + #------------------------------------------------------------------------- # Build Object Files from Assembly Source #------------------------------------------------------------------------- @@ -130,25 +143,49 @@ gloss_asm_objs = $(patsubst %.S, %.o, $(notdir $(gloss_asm_srcs))) gloss_asm_deps = $(patsubst %.S, %.d, $(notdir $(gloss_asm_srcs))) $(gloss_asm_objs) : %.o : %.S - $(COMPILE) -c $< + $(COMPILE) -c -o $@ $< -objs += $(gloss_asm_objs) +gloss_objs += $(gloss_asm_objs) deps += $(gloss_asm_deps) junk += $(gloss_asm_deps) $(gloss_asm_objs) +sim_asm_objs = $(patsubst %.S, sim-%.o, $(notdir $(gloss_asm_srcs))) +sim_asm_deps = $(patsubst %.S, sim-%.d, $(notdir $(gloss_asm_srcs))) + +$(sim_asm_objs) : sim-%.o : %.S + $(COMPILE) -c -DUSING_SIM_SPECS -o $@ $< + +sim_objs += $(sim_asm_objs) +deps += $(sim_asm_deps) +junk += $(sim_asm_deps) $(sim_asm_objs) + #------------------------------------------------------------------------- # Build libgloss.a #------------------------------------------------------------------------- gloss_lib = libgloss.a -$(gloss_lib) : $(objs) +$(gloss_lib) : $(gloss_objs) $(AR) rcv $@ $^ $(RANLIB) $@ -junk += $(gloss_libs) +junk += $(gloss_lib) install_hdrs += $(gloss_hdrs) install_libs += $(gloss_lib) +install_specs += $(gloss_specs) + +#------------------------------------------------------------------------- +# Build libsim.a +#------------------------------------------------------------------------- + +sim_lib = libsim.a +$(sim_lib) : $(sim_objs) + $(AR) rcv $@ $^ + $(RANLIB) $@ + +junk += $(sim_lib) + +install_libs += $(sim_lib) #------------------------------------------------------------------------- # Build crt0.o @@ -191,7 +228,13 @@ install-libs : $(install_libs) $(INSTALL_DATA) $$file $(install_libs_dir)/$$file; \ done -install : install-hdrs install-libs +install-specs : $(install_specs) + test -d $(install_libs_dir) || mkdir -p $(install_libs_dir) + for file in $^; do \ + $(INSTALL_DATA) $$file $(install_libs_dir)/; \ + done + +install : install-hdrs install-libs install-specs .PHONY : install install-hdrs install-libs #------------------------------------------------------------------------- diff --git a/libgloss/riscv/nano.specs b/libgloss/riscv/nano.specs new file mode 100644 index 000000000..89fd23176 --- /dev/null +++ b/libgloss/riscv/nano.specs @@ -0,0 +1,23 @@ +%rename link nano_link +%rename link_gcc_c_sequence nano_link_gcc_c_sequence +%rename cpp nano_cpp + +*cpp: +-isystem =/include/newlib-nano %(nano_cpp) + +*nano_libc: +-lc_nano + +*nano_libgloss: +%{specs=nosys.specs:-lnosys} %{!specs=nosys.specs:-lgloss_nano} + +*link_gcc_c_sequence: +%(nano_link_gcc_c_sequence) --start-group %G %(nano_libc) %(nano_libgloss) --end-group + +*link: +%(nano_link) %:replace-outfile(-lc -lc_nano) %:replace-outfile(-lg -lg_nano) + +*lib: +%{!shared:%{g*:-lg_nano} %{!p:%{!pg:-lc_nano}}%{p:-lc_p}%{pg:-lc_p}} + +# ??? Maybe put --gc-sections option in here? diff --git a/libgloss/riscv/sim.specs b/libgloss/riscv/sim.specs new file mode 100644 index 000000000..31fde6906 --- /dev/null +++ b/libgloss/riscv/sim.specs @@ -0,0 +1,10 @@ +# Spec file for gdb simulator. + +%rename lib sim_lib +%rename link sim_link + +*lib: +--start-group -lc -lsim --end-group + +*link: +%(sim_link) %:replace-outfile(-lgloss -lsim) diff --git a/libgloss/riscv/sys_sbrk.c b/libgloss/riscv/sys_sbrk.c index 036b897f4..19802fb7b 100644 --- a/libgloss/riscv/sys_sbrk.c +++ b/libgloss/riscv/sys_sbrk.c @@ -1,3 +1,31 @@ +#ifdef USING_SIM_SPECS + +// Gdb simulator requires that sbrk be implemented without a syscall. +extern char _end[]; /* _end is set in the linker command file */ +char *heap_ptr; + +/* + * sbrk -- changes heap size size. Get nbytes more + * RAM. We just increment a pointer in what's + * left of memory on the board. + */ +char * +_sbrk (nbytes) + int nbytes; +{ + char *base; + + if (!heap_ptr) + heap_ptr = (char *)&_end; + base = heap_ptr; + heap_ptr += nbytes; + + return base; +} + +#else + +// QEMU uses a syscall. #include #include #include "internal_syscall.h" @@ -25,3 +53,4 @@ _sbrk(ptrdiff_t incr) heap_end += incr; return (void *)(heap_end - incr); } +#endif From fcd33916ac03086b9090c68e88036afa4b25d913 Mon Sep 17 00:00:00 2001 From: Alexander Fedotov Date: Mon, 25 Dec 2017 16:28:22 +0300 Subject: [PATCH 200/649] fix incompatible pointer type for va_list in nano versions of printf and scanf for target like PowerPC --- newlib/libc/stdio/nano-vfprintf.c | 14 ++++++++++++-- newlib/libc/stdio/nano-vfscanf.c | 15 ++++++++++++--- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index e6604e771..663eb7149 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -168,6 +168,16 @@ static char *rcsid = "$Id$"; #include "vfieeefp.h" #include "nano-vfprintf_local.h" + +/* GCC PR 14577 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557 */ +#if __STDC_VERSION__ >= 201112L +#define va_ptr(ap) _Generic(&(ap), va_list *: &(ap), default: (va_list *)(ap)) +#elif __GNUC__ >= 4 +#define va_ptr(ap) __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(&(ap)), va_list *), &(ap), (va_list *)(ap)) +#else +#define va_ptr(ap) (sizeof(ap) == sizeof(va_list) ? (va_list *)&(ap) : (va_list *)(ap)) +#endif + /* The __ssputs_r function is shared between all versions of vfprintf and vfwprintf. */ #ifdef STRING_ONLY @@ -633,12 +643,12 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), } else { - n = _printf_float (data, &prt_data, fp, pfunc, &ap); + n = _printf_float (data, &prt_data, fp, pfunc, va_ptr(ap)); } } else #endif - n = _printf_i (data, &prt_data, fp, pfunc, &ap); + n = _printf_i (data, &prt_data, fp, pfunc, va_ptr(ap)); if (n == -1) goto error; diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index 564f2916d..6467e5425 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -119,6 +119,15 @@ Supporting OS subroutines required: #include "../stdlib/local.h" #include "nano-vfscanf_local.h" +/* GCC PR 14577 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557 */ +#if __STDC_VERSION__ >= 201112L +#define va_ptr(ap) _Generic(&(ap), va_list *: &(ap), default: (va_list *)(ap)) +#elif __GNUC__ >= 4 +#define va_ptr(ap) __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(&(ap)), va_list *), &(ap), (va_list *)(ap)) +#else +#define va_ptr(ap) (sizeof(ap) == sizeof(va_list) ? (va_list *)&(ap) : (va_list *)(ap)) +#endif + #define VFSCANF vfscanf #define _VFSCANF_R _vfscanf_r #define __SVFSCANF __svfscanf @@ -424,12 +433,12 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), } ret = 0; if (scan_data.code < CT_INT) - ret = _scanf_chars (rptr, &scan_data, fp, &ap); + ret = _scanf_chars (rptr, &scan_data, fp, va_ptr(ap)); else if (scan_data.code < CT_FLOAT) - ret = _scanf_i (rptr, &scan_data, fp, &ap); + ret = _scanf_i (rptr, &scan_data, fp, va_ptr(ap)); #ifdef FLOATING_POINT else if (_scanf_float) - ret = _scanf_float (rptr, &scan_data, fp, &ap); + ret = _scanf_float (rptr, &scan_data, fp, va_ptr(ap)); #endif if (ret == MATCH_FAILURE) From 1d01586b62dcf80236021cc514c487a1da160de6 Mon Sep 17 00:00:00 2001 From: Ivan Grokhotkov Date: Tue, 9 Jan 2018 14:07:25 +0800 Subject: [PATCH 201/649] newlib: fvprintf: fix get_arg for !_MB_CAPABLE Code path for _MB_CAPABLE scans for the '%' character and advances 'fmt' pointer past '%'. Code path for !_MB_CAPABLE leaved fmt pointing to '%', which caused the state machine to go from START to DONE state immediately. --- newlib/libc/stdio/vfprintf.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 50a3478a4..211cb17bb 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -2098,6 +2098,8 @@ _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), if (*fmt == '\0') break; + + fmt++; # endif /* ! _MB_CAPABLE */ state = START; flags = 0; From 2cb24159fbb2a5f8a28d87413b517e6f2b242a0f Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 15 Jan 2018 21:15:28 -0600 Subject: [PATCH 202/649] cygwin: add LFS_CFLAGS etc. to confstr/getconf These are used, for instance, when cross-compiling the Linux kernel. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/sys/unistd.h | 4 ++++ winsup/cygwin/sysconf.cc | 6 +++++- winsup/utils/getconf.c | 4 ++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index 05962219a..c811eb649 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -582,6 +582,10 @@ int _EXFUN(unlinkat, (int, const char *, int)); #define _CS_POSIX_V7_THREADS_LDFLAGS 19 #define _CS_V7_ENV 20 #define _CS_V6_ENV _CS_V7_ENV +#define _CS_LFS_CFLAGS 21 +#define _CS_LFS_LDFLAGS 22 +#define _CS_LFS_LIBS 23 +#define _CS_LFS_LINTFLAGS 24 #endif #ifdef __cplusplus diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index ecd9aeb93..9563b889a 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -719,10 +719,14 @@ static struct {ls ("")}, /* _CS_POSIX_V7_THREADS_CFLAGS */ {ls ("")}, /* _CS_POSIX_V7_THREADS_LDFLAGS */ {ls ("POSIXLY_CORRECT=1")}, /* _CS_V7_ENV */ + {ls ("")}, /* _CS_LFS_CFLAGS */ + {ls ("")}, /* _CS_LFS_LDFLAGS */ + {ls ("")}, /* _CS_LFS_LIBS */ + {ls ("")}, /* _CS_LFS_LINTFLAGS */ }; #define CS_MIN _CS_PATH -#define CS_MAX _CS_V7_ENV +#define CS_MAX _CS_LFS_LINTFLAGS extern "C" size_t confstr (int in, char *buf, size_t len) diff --git a/winsup/utils/getconf.c b/winsup/utils/getconf.c index 256bddb1a..5ac84abd2 100644 --- a/winsup/utils/getconf.c +++ b/winsup/utils/getconf.c @@ -97,6 +97,10 @@ static const struct conf_variable conf_table[] = { "XBS5_WIDTH_RESTRICTED_ENVS", CONFSTR, _CS_XBS5_WIDTH_RESTRICTED_ENVS }, { "V7_ENV", CONFSTR, _CS_V7_ENV }, { "V6_ENV", CONFSTR, _CS_V6_ENV }, + { "LFS_CFLAGS", CONFSTR, _CS_LFS_CFLAGS }, + { "LFS_LDFLAGS", CONFSTR, _CS_LFS_LDFLAGS }, + { "LFS_LIBS", CONFSTR, _CS_LFS_LIBS }, + { "LFS_LINTFLAGS", CONFSTR, _CS_LFS_LINTFLAGS }, /* Symbolic constants from */ { "_POSIX_AIO_LISTIO_MAX", CONSTANT, _POSIX_AIO_LISTIO_MAX }, From 82339fcd717b4365caf65abf67072840342b4730 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 16 Jan 2018 13:24:42 -0600 Subject: [PATCH 203/649] Make __always_inline macro compatible with glibc For example, this is used when cross-compiling the Linux kernel on Cygwin. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/sys/cdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h index db5f2bf2d..fc564a5c6 100644 --- a/newlib/libc/include/sys/cdefs.h +++ b/newlib/libc/include/sys/cdefs.h @@ -385,7 +385,7 @@ #endif #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800) -#define __always_inline __attribute__((__always_inline__)) +#define __always_inline __inline__ __attribute__((__always_inline__)) #else #define __always_inline #endif From 1e39db3062f941778e748f833e1f88dd5c7399a3 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Wed, 17 Jan 2018 03:03:23 -0600 Subject: [PATCH 204/649] cygwin: add asm/bitsperlong.h, dummy asm/posix_types.h headers These changes are necessary for cross-compiling the Linux kernel. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/asm/bitsperlong.h | 18 ++++++++++++++++++ winsup/cygwin/include/asm/posix_types.h | 14 ++++++++++++++ winsup/cygwin/include/asm/types.h | 2 ++ 3 files changed, 34 insertions(+) create mode 100644 winsup/cygwin/include/asm/bitsperlong.h create mode 100644 winsup/cygwin/include/asm/posix_types.h diff --git a/winsup/cygwin/include/asm/bitsperlong.h b/winsup/cygwin/include/asm/bitsperlong.h new file mode 100644 index 000000000..48037b645 --- /dev/null +++ b/winsup/cygwin/include/asm/bitsperlong.h @@ -0,0 +1,18 @@ +/* asm/bitsperlong.h + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef __ASM_BITSPERLONG_H +#define __ASM_BITSPERLONG_H + +#ifdef __x86_64__ +#define __BITS_PER_LONG 64 +#else +#define __BITS_PER_LONG 32 +#endif + +#endif /* __ASM_BITSPERLONG_H */ diff --git a/winsup/cygwin/include/asm/posix_types.h b/winsup/cygwin/include/asm/posix_types.h new file mode 100644 index 000000000..4e9aac057 --- /dev/null +++ b/winsup/cygwin/include/asm/posix_types.h @@ -0,0 +1,14 @@ +/* asm/posix_types.h + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _ASM_POSIX_TYPES_H +#define _ASM_POSIX_TYPES_H + +/* This is just a placeholder to simplify cross-compiling the Linux kernel */ + +#endif /* _ASM_POSIX_TYPES_H */ diff --git a/winsup/cygwin/include/asm/types.h b/winsup/cygwin/include/asm/types.h index c2342efc1..e1e947054 100644 --- a/winsup/cygwin/include/asm/types.h +++ b/winsup/cygwin/include/asm/types.h @@ -9,6 +9,8 @@ details. */ #ifndef _ASM_TYPES_H #define _ASM_TYPES_H +#include + typedef __signed__ char __s8; typedef unsigned char __u8; From 6783860a2e4e4183c073f62e4bb938cea0e096c3 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 19:31:41 -0600 Subject: [PATCH 205/649] ansification: remove _AND Signed-off-by: Yaakov Selkowitz --- libgloss/cr16/fstat.c | 2 +- libgloss/cr16/isatty.c | 2 +- libgloss/cr16/kill.c | 2 +- libgloss/cr16/stat.c | 2 +- libgloss/crx/fstat.c | 2 +- libgloss/crx/isatty.c | 2 +- libgloss/crx/kill.c | 2 +- libgloss/crx/stat.c | 2 +- libgloss/frv/fstat.c | 2 +- libgloss/frv/isatty.c | 2 +- libgloss/frv/kill.c | 2 +- libgloss/frv/sim-time.c | 2 +- libgloss/frv/stat.c | 2 +- libgloss/fstat.c | 2 +- libgloss/ft32/fstat.c | 2 +- libgloss/ft32/isatty.c | 2 +- libgloss/ft32/kill.c | 2 +- libgloss/ft32/sim-lseek.S | 4 +- libgloss/ft32/sim-lseek.c | 4 +- libgloss/ft32/sim-time.c | 2 +- libgloss/ft32/stat.c | 2 +- libgloss/isatty.c | 2 +- libgloss/kill.c | 2 +- libgloss/libnosys/chown.c | 4 +- libgloss/libnosys/execve.c | 4 +- libgloss/libnosys/fstat.c | 2 +- libgloss/libnosys/gettod.c | 2 +- libgloss/libnosys/kill.c | 2 +- libgloss/libnosys/link.c | 2 +- libgloss/libnosys/lseek.c | 4 +- libgloss/libnosys/open.c | 4 +- libgloss/libnosys/read.c | 4 +- libgloss/libnosys/readlink.c | 4 +- libgloss/libnosys/stat.c | 2 +- libgloss/libnosys/symlink.c | 2 +- libgloss/libnosys/write.c | 4 +- libgloss/lseek.c | 4 +- libgloss/mcore/fstat.c | 2 +- libgloss/mcore/kill.c | 2 +- libgloss/mcore/lseek.c | 4 +- libgloss/mcore/open.c | 4 +- libgloss/mcore/read.c | 4 +- libgloss/mcore/stat.c | 2 +- libgloss/mcore/write.c | 4 +- libgloss/moxie/fstat.c | 2 +- libgloss/moxie/isatty.c | 2 +- libgloss/moxie/kill.c | 2 +- libgloss/moxie/qemu-time.c | 2 +- libgloss/moxie/sim-lseek.S | 4 +- libgloss/moxie/sim-lseek.c | 4 +- libgloss/moxie/sim-time.c | 2 +- libgloss/moxie/stat.c | 2 +- libgloss/open.c | 4 +- libgloss/read.c | 4 +- libgloss/stat.c | 2 +- libgloss/tic6x/kill.c | 2 +- libgloss/write.c | 4 +- libgloss/xc16x/misc.c | 2 +- libgloss/xstormy16/fstat.c | 2 +- libgloss/xstormy16/isatty.c | 2 +- libgloss/xstormy16/kill.c | 2 +- libgloss/xstormy16/lseek.c | 4 +- libgloss/xstormy16/open.c | 4 +- libgloss/xstormy16/stat.c | 2 +- newlib/libc/argz/argz_add.c | 4 +- newlib/libc/argz/argz_add_sep.c | 6 +- newlib/libc/argz/argz_append.c | 6 +- newlib/libc/argz/argz_count.c | 2 +- newlib/libc/argz/argz_create.c | 4 +- newlib/libc/argz/argz_create_sep.c | 6 +- newlib/libc/argz/argz_delete.c | 4 +- newlib/libc/argz/argz_extract.c | 4 +- newlib/libc/argz/argz_insert.c | 6 +- newlib/libc/argz/argz_next.c | 4 +- newlib/libc/argz/argz_replace.c | 8 +-- newlib/libc/argz/argz_stringify.c | 4 +- newlib/libc/argz/envz_add.c | 6 +- newlib/libc/argz/envz_entry.c | 4 +- newlib/libc/argz/envz_get.c | 4 +- newlib/libc/argz/envz_merge.c | 8 +-- newlib/libc/argz/envz_remove.c | 4 +- newlib/libc/argz/envz_strip.c | 2 +- newlib/libc/ctype/iswctype.c | 2 +- newlib/libc/ctype/jp2uc.c | 2 +- newlib/libc/ctype/towctrans.c | 6 +- newlib/libc/ctype/wctrans.c | 2 +- newlib/libc/ctype/wctype.c | 2 +- newlib/libc/iconv/ces/euc.c | 18 ++--- newlib/libc/iconv/ces/table-pcs.c | 18 ++--- newlib/libc/iconv/ces/table.c | 26 ++++---- newlib/libc/iconv/ces/ucs-2-internal.c | 10 +-- newlib/libc/iconv/ces/ucs-2.c | 14 ++-- newlib/libc/iconv/ces/ucs-4-internal.c | 10 +-- newlib/libc/iconv/ces/ucs-4.c | 14 ++-- newlib/libc/iconv/ces/us-ascii.c | 10 +-- newlib/libc/iconv/ces/utf-16.c | 16 ++--- newlib/libc/iconv/ces/utf-8.c | 10 +-- newlib/libc/iconv/lib/aliasesi.c | 10 +-- newlib/libc/iconv/lib/iconv.c | 26 ++++---- newlib/libc/iconv/lib/iconvnls.c | 40 ++++++------ newlib/libc/iconv/lib/nullconv.c | 30 ++++----- newlib/libc/iconv/lib/ucsconv.c | 32 ++++----- newlib/libc/include/_ansi.h | 2 - newlib/libc/locale/locale.c | 6 +- newlib/libc/machine/microblaze/strcmp.c | 2 +- newlib/libc/machine/microblaze/strcpy.c | 2 +- newlib/libc/machine/powerpc/atosfix16.c | 2 +- newlib/libc/machine/powerpc/atosfix32.c | 2 +- newlib/libc/machine/powerpc/atosfix64.c | 2 +- newlib/libc/machine/powerpc/atoufix16.c | 2 +- newlib/libc/machine/powerpc/atoufix32.c | 2 +- newlib/libc/machine/powerpc/atoufix64.c | 2 +- newlib/libc/machine/powerpc/strtosfix16.c | 6 +- newlib/libc/machine/powerpc/strtosfix32.c | 6 +- newlib/libc/machine/powerpc/strtosfix64.c | 6 +- newlib/libc/machine/powerpc/strtoufix16.c | 6 +- newlib/libc/machine/powerpc/strtoufix32.c | 6 +- newlib/libc/machine/powerpc/strtoufix64.c | 6 +- newlib/libc/machine/powerpc/ufix64toa.c | 12 ++-- newlib/libc/machine/powerpc/vec_calloc.c | 2 +- newlib/libc/machine/powerpc/vec_realloc.c | 2 +- newlib/libc/machine/powerpc/vfprintf.c | 10 +-- newlib/libc/machine/powerpc/vfscanf.c | 10 +-- newlib/libc/machine/spu/assert.c | 10 +-- newlib/libc/machine/spu/creat.c | 2 +- newlib/libc/machine/spu/fdopen.c | 2 +- newlib/libc/machine/spu/fgetpos.c | 2 +- newlib/libc/machine/spu/fgets.c | 4 +- newlib/libc/machine/spu/fopen.c | 2 +- newlib/libc/machine/spu/fputs.c | 2 +- newlib/libc/machine/spu/fread.c | 6 +- newlib/libc/machine/spu/freopen.c | 4 +- newlib/libc/machine/spu/fseek.c | 4 +- newlib/libc/machine/spu/fsetpos.c | 2 +- newlib/libc/machine/spu/fwrite.c | 6 +- newlib/libc/machine/spu/setbuf.c | 2 +- newlib/libc/machine/spu/setvbuf.c | 6 +- newlib/libc/machine/spu/vfprintf.c | 4 +- newlib/libc/machine/spu/vfscanf.c | 4 +- newlib/libc/machine/spu/vprintf.c | 2 +- newlib/libc/machine/spu/vscanf.c | 2 +- newlib/libc/machine/spu/vsnprintf.c | 6 +- newlib/libc/machine/spu/vsprintf.c | 4 +- newlib/libc/machine/spu/vsscanf.c | 4 +- newlib/libc/misc/__dprintf.c | 8 +-- newlib/libc/posix/creat.c | 2 +- newlib/libc/posix/execl.c | 6 +- newlib/libc/posix/execle.c | 6 +- newlib/libc/posix/execlp.c | 6 +- newlib/libc/posix/execv.c | 2 +- newlib/libc/posix/execve.c | 4 +- newlib/libc/posix/execvp.c | 6 +- newlib/libc/posix/popen.c | 2 +- newlib/libc/posix/posix_spawn.c | 58 ++++++++-------- newlib/libc/posix/readdir_r.c | 4 +- newlib/libc/posix/scandir.c | 8 +-- newlib/libc/posix/seekdir.c | 2 +- newlib/libc/posix/telldir.c | 2 +- newlib/libc/reent/execr.c | 8 +-- newlib/libc/reent/fcntlr.c | 6 +- newlib/libc/reent/fstat64r.c | 4 +- newlib/libc/reent/gettimeofdayr.c | 4 +- newlib/libc/reent/linkr.c | 4 +- newlib/libc/reent/lseek64r.c | 6 +- newlib/libc/reent/lseekr.c | 6 +- newlib/libc/reent/mkdirr.c | 4 +- newlib/libc/reent/openr.c | 6 +- newlib/libc/reent/readr.c | 6 +- newlib/libc/reent/reent.c | 2 +- newlib/libc/reent/renamer.c | 4 +- newlib/libc/reent/sbrkr.c | 2 +- newlib/libc/reent/signalr.c | 4 +- newlib/libc/reent/stat64r.c | 4 +- newlib/libc/reent/statr.c | 4 +- newlib/libc/reent/timesr.c | 2 +- newlib/libc/reent/unlinkr.c | 2 +- newlib/libc/reent/writer.c | 6 +- newlib/libc/search/bsearch.c | 8 +-- newlib/libc/search/hash.c | 8 +-- newlib/libc/search/hcreate.c | 2 +- newlib/libc/search/qsort.c | 36 +++++----- newlib/libc/search/tdelete.c | 4 +- newlib/libc/search/tdestroy.c | 2 +- newlib/libc/search/tfind.c | 4 +- newlib/libc/search/tsearch.c | 4 +- newlib/libc/search/twalk.c | 2 +- newlib/libc/signal/psignal.c | 2 +- newlib/libc/signal/raise.c | 2 +- newlib/libc/signal/signal.c | 10 +-- newlib/libc/stdio/asiprintf.c | 6 +- newlib/libc/stdio/asniprintf.c | 10 +-- newlib/libc/stdio/asnprintf.c | 10 +-- newlib/libc/stdio/asprintf.c | 6 +- newlib/libc/stdio/diprintf.c | 6 +- newlib/libc/stdio/dprintf.c | 6 +- newlib/libc/stdio/fclose.c | 2 +- newlib/libc/stdio/fdopen.c | 6 +- newlib/libc/stdio/fflush.c | 6 +- newlib/libc/stdio/fgetc.c | 2 +- newlib/libc/stdio/fgetc_u.c | 2 +- newlib/libc/stdio/fgetpos.c | 6 +- newlib/libc/stdio/fgets.c | 10 +-- newlib/libc/stdio/fgetwc.c | 4 +- newlib/libc/stdio/fgetwc_u.c | 2 +- newlib/libc/stdio/fgetws.c | 10 +-- newlib/libc/stdio/findfp.c | 6 +- newlib/libc/stdio/fiprintf.c | 6 +- newlib/libc/stdio/flags.c | 4 +- newlib/libc/stdio/fmemopen.c | 36 +++++----- newlib/libc/stdio/fopen.c | 6 +- newlib/libc/stdio/fopencookie.c | 36 +++++----- newlib/libc/stdio/fprintf.c | 6 +- newlib/libc/stdio/fpurge.c | 2 +- newlib/libc/stdio/fputc.c | 6 +- newlib/libc/stdio/fputc_u.c | 6 +- newlib/libc/stdio/fputs.c | 6 +- newlib/libc/stdio/fputwc.c | 10 +-- newlib/libc/stdio/fputwc_u.c | 6 +- newlib/libc/stdio/fputws.c | 6 +- newlib/libc/stdio/fread.c | 22 +++---- newlib/libc/stdio/freopen.c | 10 +-- newlib/libc/stdio/fseek.c | 10 +-- newlib/libc/stdio/fseeko.c | 10 +-- newlib/libc/stdio/fsetlocking.c | 2 +- newlib/libc/stdio/fsetpos.c | 6 +- newlib/libc/stdio/ftell.c | 2 +- newlib/libc/stdio/ftello.c | 2 +- newlib/libc/stdio/funopen.c | 44 ++++++------- newlib/libc/stdio/fvwrite.c | 4 +- newlib/libc/stdio/fwalk.c | 4 +- newlib/libc/stdio/fwide.c | 6 +- newlib/libc/stdio/fwprintf.c | 6 +- newlib/libc/stdio/fwrite.c | 14 ++-- newlib/libc/stdio/getc.c | 2 +- newlib/libc/stdio/getc_u.c | 2 +- newlib/libc/stdio/getdelim.c | 6 +- newlib/libc/stdio/getline.c | 4 +- newlib/libc/stdio/gets.c | 2 +- newlib/libc/stdio/getwc.c | 2 +- newlib/libc/stdio/getwc_u.c | 2 +- newlib/libc/stdio/iprintf.c | 2 +- newlib/libc/stdio/makebuf.c | 8 +-- newlib/libc/stdio/mktemp.c | 38 +++++------ newlib/libc/stdio/nano-vfprintf.c | 34 +++++----- newlib/libc/stdio/nano-vfscanf.c | 26 ++++---- newlib/libc/stdio/open_memstream.c | 38 +++++------ newlib/libc/stdio/perror.c | 2 +- newlib/libc/stdio/printf.c | 2 +- newlib/libc/stdio/putc.c | 6 +- newlib/libc/stdio/putc_u.c | 6 +- newlib/libc/stdio/putchar.c | 2 +- newlib/libc/stdio/putchar_u.c | 2 +- newlib/libc/stdio/puts.c | 2 +- newlib/libc/stdio/putw.c | 2 +- newlib/libc/stdio/putwc.c | 6 +- newlib/libc/stdio/putwc_u.c | 6 +- newlib/libc/stdio/putwchar.c | 2 +- newlib/libc/stdio/putwchar_u.c | 2 +- newlib/libc/stdio/refill.c | 2 +- newlib/libc/stdio/remove.c | 2 +- newlib/libc/stdio/rename.c | 2 +- newlib/libc/stdio/rewind.c | 2 +- newlib/libc/stdio/rget.c | 2 +- newlib/libc/stdio/sccl.c | 2 +- newlib/libc/stdio/setbuf.c | 2 +- newlib/libc/stdio/setbuffer.c | 4 +- newlib/libc/stdio/setvbuf.c | 6 +- newlib/libc/stdio/siprintf.c | 6 +- newlib/libc/stdio/siscanf.c | 6 +- newlib/libc/stdio/sniprintf.c | 10 +-- newlib/libc/stdio/snprintf.c | 10 +-- newlib/libc/stdio/sprintf.c | 6 +- newlib/libc/stdio/sscanf.c | 6 +- newlib/libc/stdio/stdio.c | 26 ++++---- newlib/libc/stdio/swprintf.c | 10 +-- newlib/libc/stdio/tmpnam.c | 18 ++--- newlib/libc/stdio/ungetc.c | 8 +-- newlib/libc/stdio/ungetwc.c | 6 +- newlib/libc/stdio/vasiprintf.c | 10 +-- newlib/libc/stdio/vasniprintf.c | 14 ++-- newlib/libc/stdio/vasnprintf.c | 14 ++-- newlib/libc/stdio/vasprintf.c | 10 +-- newlib/libc/stdio/vdiprintf.c | 10 +-- newlib/libc/stdio/vdprintf.c | 10 +-- newlib/libc/stdio/vfprintf.c | 50 +++++++------- newlib/libc/stdio/vfscanf.c | 34 +++++----- newlib/libc/stdio/vfwprintf.c | 30 ++++----- newlib/libc/stdio/vfwscanf.c | 26 ++++---- newlib/libc/stdio/viprintf.c | 6 +- newlib/libc/stdio/viscanf.c | 6 +- newlib/libc/stdio/vprintf.c | 6 +- newlib/libc/stdio/vscanf.c | 6 +- newlib/libc/stdio/vsiprintf.c | 10 +-- newlib/libc/stdio/vsiscanf.c | 10 +-- newlib/libc/stdio/vsniprintf.c | 14 ++-- newlib/libc/stdio/vsnprintf.c | 14 ++-- newlib/libc/stdio/vsprintf.c | 10 +-- newlib/libc/stdio/vsscanf.c | 10 +-- newlib/libc/stdio/vswprintf.c | 14 ++-- newlib/libc/stdio/vwprintf.c | 6 +- newlib/libc/stdio/wbuf.c | 6 +- newlib/libc/stdio/wprintf.c | 2 +- newlib/libc/stdio/wsetup.c | 2 +- newlib/libc/stdio64/fdopen64.c | 6 +- newlib/libc/stdio64/fgetpos64.c | 6 +- newlib/libc/stdio64/fopen64.c | 6 +- newlib/libc/stdio64/freopen64.c | 10 +-- newlib/libc/stdio64/fseeko64.c | 10 +-- newlib/libc/stdio64/fsetpos64.c | 6 +- newlib/libc/stdio64/ftello64.c | 2 +- newlib/libc/stdio64/stdio64.c | 12 ++-- newlib/libc/stdlib/__adjust.c | 6 +- newlib/libc/stdlib/__atexit.c | 6 +- newlib/libc/stdlib/__call_atexit.c | 2 +- newlib/libc/stdlib/__ten_mu.c | 2 +- newlib/libc/stdlib/assert.c | 10 +-- newlib/libc/stdlib/atoi.c | 2 +- newlib/libc/stdlib/atol.c | 2 +- newlib/libc/stdlib/atoll.c | 2 +- newlib/libc/stdlib/calloc.c | 2 +- newlib/libc/stdlib/cxa_atexit.c | 4 +- newlib/libc/stdlib/div.c | 2 +- newlib/libc/stdlib/dtoa.c | 14 ++-- newlib/libc/stdlib/dtoastub.c | 10 +-- newlib/libc/stdlib/ecvtbuf.c | 60 ++++++++--------- newlib/libc/stdlib/efgcvt.c | 32 ++++----- newlib/libc/stdlib/erand48.c | 2 +- newlib/libc/stdlib/gdtoa-gethex.c | 4 +- newlib/libc/stdlib/gdtoa-hexnan.c | 10 +-- newlib/libc/stdlib/getenv.c | 2 +- newlib/libc/stdlib/getenv_r.c | 6 +- newlib/libc/stdlib/itoa.c | 8 +-- newlib/libc/stdlib/jrand48.c | 2 +- newlib/libc/stdlib/l64a.c | 2 +- newlib/libc/stdlib/lcong48.c | 2 +- newlib/libc/stdlib/ldiv.c | 2 +- newlib/libc/stdlib/lldiv.c | 2 +- newlib/libc/stdlib/malign.c | 2 +- newlib/libc/stdlib/mblen.c | 2 +- newlib/libc/stdlib/mblen_r.c | 6 +- newlib/libc/stdlib/mbrtowc.c | 14 ++-- newlib/libc/stdlib/mbsnrtowcs.c | 18 ++--- newlib/libc/stdlib/mbsrtowcs.c | 14 ++-- newlib/libc/stdlib/mbstowcs.c | 4 +- newlib/libc/stdlib/mbstowcs_r.c | 8 +-- newlib/libc/stdlib/mbtowc.c | 4 +- newlib/libc/stdlib/mbtowc_r.c | 48 +++++++------- newlib/libc/stdlib/mprec.c | 48 +++++++------- newlib/libc/stdlib/mstats.c | 4 +- newlib/libc/stdlib/nrand48.c | 2 +- newlib/libc/stdlib/on_exit.c | 2 +- newlib/libc/stdlib/putenv_r.c | 2 +- newlib/libc/stdlib/rand48.c | 2 +- newlib/libc/stdlib/realloc.c | 2 +- newlib/libc/stdlib/reallocf.c | 6 +- newlib/libc/stdlib/seed48.c | 2 +- newlib/libc/stdlib/setenv.c | 4 +- newlib/libc/stdlib/setenv_r.c | 8 +-- newlib/libc/stdlib/srand48.c | 2 +- newlib/libc/stdlib/strtod.c | 16 ++--- newlib/libc/stdlib/strtol.c | 10 +-- newlib/libc/stdlib/strtoll.c | 10 +-- newlib/libc/stdlib/strtoul.c | 10 +-- newlib/libc/stdlib/strtoull.c | 10 +-- newlib/libc/stdlib/system.c | 8 +-- newlib/libc/stdlib/utoa.c | 8 +-- newlib/libc/stdlib/wcrtomb.c | 10 +-- newlib/libc/stdlib/wcsnrtombs.c | 18 ++--- newlib/libc/stdlib/wcsrtombs.c | 14 ++-- newlib/libc/stdlib/wcstod.c | 12 ++-- newlib/libc/stdlib/wcstol.c | 10 +-- newlib/libc/stdlib/wcstoll.c | 10 +-- newlib/libc/stdlib/wcstombs.c | 4 +- newlib/libc/stdlib/wcstombs_r.c | 8 +-- newlib/libc/stdlib/wcstoul.c | 10 +-- newlib/libc/stdlib/wcstoull.c | 10 +-- newlib/libc/stdlib/wctomb.c | 2 +- newlib/libc/stdlib/wctomb_r.c | 36 +++++----- newlib/libc/string/bcmp.c | 4 +- newlib/libc/string/bcopy.c | 4 +- newlib/libc/string/index.c | 2 +- newlib/libc/string/memccpy.c | 6 +- newlib/libc/string/memchr.c | 4 +- newlib/libc/string/memcmp.c | 4 +- newlib/libc/string/memcpy.c | 4 +- newlib/libc/string/memmem.c | 6 +- newlib/libc/string/memmove.c | 4 +- newlib/libc/string/mempcpy.c | 4 +- newlib/libc/string/memrchr.c | 4 +- newlib/libc/string/memset.c | 4 +- newlib/libc/string/rawmemchr.c | 2 +- newlib/libc/string/rindex.c | 2 +- newlib/libc/string/stpcpy.c | 2 +- newlib/libc/string/stpncpy.c | 4 +- newlib/libc/string/strcasecmp.c | 2 +- newlib/libc/string/strcasestr.c | 2 +- newlib/libc/string/strcat.c | 2 +- newlib/libc/string/strchr.c | 2 +- newlib/libc/string/strchrnul.c | 2 +- newlib/libc/string/strcmp.c | 2 +- newlib/libc/string/strcoll.c | 2 +- newlib/libc/string/strcpy.c | 2 +- newlib/libc/string/strcspn.c | 2 +- newlib/libc/string/strdup_r.c | 2 +- newlib/libc/string/strerror.c | 6 +- newlib/libc/string/strerror_r.c | 4 +- newlib/libc/string/strlcat.c | 4 +- newlib/libc/string/strlcpy.c | 4 +- newlib/libc/string/strncasecmp.c | 4 +- newlib/libc/string/strncat.c | 4 +- newlib/libc/string/strncmp.c | 4 +- newlib/libc/string/strncpy.c | 4 +- newlib/libc/string/strndup.c | 2 +- newlib/libc/string/strndup_r.c | 4 +- newlib/libc/string/strnlen.c | 2 +- newlib/libc/string/strpbrk.c | 2 +- newlib/libc/string/strrchr.c | 2 +- newlib/libc/string/strsep.c | 2 +- newlib/libc/string/strspn.c | 2 +- newlib/libc/string/strstr.c | 2 +- newlib/libc/string/strtok.c | 2 +- newlib/libc/string/strtok_r.c | 10 +-- newlib/libc/string/strxfrm.c | 4 +- newlib/libc/string/swab.c | 4 +- newlib/libc/string/u_strerr.c | 4 +- newlib/libc/string/wcpcpy.c | 2 +- newlib/libc/string/wcpncpy.c | 4 +- newlib/libc/string/wcscasecmp.c | 2 +- newlib/libc/string/wcscat.c | 2 +- newlib/libc/string/wcschr.c | 2 +- newlib/libc/string/wcscmp.c | 2 +- newlib/libc/string/wcscoll.c | 2 +- newlib/libc/string/wcscpy.c | 2 +- newlib/libc/string/wcscspn.c | 2 +- newlib/libc/string/wcslcat.c | 4 +- newlib/libc/string/wcslcpy.c | 4 +- newlib/libc/string/wcsncasecmp.c | 4 +- newlib/libc/string/wcsncat.c | 4 +- newlib/libc/string/wcsncmp.c | 4 +- newlib/libc/string/wcsncpy.c | 4 +- newlib/libc/string/wcsnlen.c | 2 +- newlib/libc/string/wcspbrk.c | 2 +- newlib/libc/string/wcsrchr.c | 2 +- newlib/libc/string/wcsspn.c | 2 +- newlib/libc/string/wcsstr.c | 2 +- newlib/libc/string/wcstok.c | 4 +- newlib/libc/string/wcswidth.c | 2 +- newlib/libc/string/wcsxfrm.c | 4 +- newlib/libc/string/wmemchr.c | 4 +- newlib/libc/string/wmemcmp.c | 4 +- newlib/libc/string/wmemcpy.c | 4 +- newlib/libc/string/wmemmove.c | 4 +- newlib/libc/string/wmempcpy.c | 4 +- newlib/libc/string/wmemset.c | 4 +- newlib/libc/string/xpg_strerror_r.c | 4 +- newlib/libc/sys/a29khif/kill.c | 2 +- newlib/libc/sys/h8300hms/misc.c | 2 +- newlib/libc/sys/h8500hms/misc.c | 2 +- newlib/libc/sys/linux/pread.c | 14 ++-- newlib/libc/sys/linux/pread64.c | 6 +- newlib/libc/sys/linux/pwrite.c | 14 ++-- newlib/libc/sys/linux/pwrite64.c | 6 +- newlib/libc/sys/sysnec810/misc.c | 2 +- newlib/libc/syscalls/sysexecve.c | 4 +- newlib/libc/syscalls/sysfcntl.c | 4 +- newlib/libc/syscalls/sysfstat.c | 2 +- newlib/libc/syscalls/sysgettod.c | 2 +- newlib/libc/syscalls/syskill.c | 2 +- newlib/libc/syscalls/syslink.c | 2 +- newlib/libc/syscalls/syslseek.c | 4 +- newlib/libc/syscalls/sysopen.c | 2 +- newlib/libc/syscalls/sysread.c | 4 +- newlib/libc/syscalls/sysstat.c | 2 +- newlib/libc/syscalls/syswrite.c | 4 +- newlib/libc/time/asctime_r.c | 2 +- newlib/libc/time/ctime_r.c | 2 +- newlib/libc/time/difftime.c | 2 +- newlib/libc/time/gmtime_r.c | 2 +- newlib/libc/time/lcltime_r.c | 2 +- newlib/libc/time/strftime.c | 6 +- newlib/libc/unix/pread.c | 14 ++-- newlib/libc/unix/pwrite.c | 14 ++-- newlib/libc/unix/ttyname_r.c | 4 +- newlib/libc/xdr/xdr.c | 80 +++++++++++------------ newlib/libc/xdr/xdr_array.c | 18 ++--- newlib/libc/xdr/xdr_float.c | 4 +- newlib/libc/xdr/xdr_float_vax.c | 4 +- newlib/libc/xdr/xdr_mem.c | 36 +++++----- newlib/libc/xdr/xdr_private.c | 2 +- newlib/libc/xdr/xdr_rec.c | 48 +++++++------- newlib/libc/xdr/xdr_reference.c | 12 ++-- newlib/libc/xdr/xdr_sizeof.c | 14 ++-- newlib/libc/xdr/xdr_stdio.c | 24 +++---- newlib/libm/mathfp/s_asine.c | 2 +- newlib/libm/mathfp/s_atan2.c | 2 +- newlib/libm/mathfp/s_atangent.c | 6 +- newlib/libm/mathfp/s_ldexp.c | 2 +- newlib/libm/mathfp/s_logarithm.c | 2 +- newlib/libm/mathfp/s_sincos.c | 4 +- newlib/libm/mathfp/s_sine.c | 2 +- newlib/libm/mathfp/s_sineh.c | 2 +- newlib/libm/mathfp/sf_asine.c | 2 +- newlib/libm/mathfp/sf_atan2.c | 2 +- newlib/libm/mathfp/sf_atangent.c | 6 +- newlib/libm/mathfp/sf_fmod.c | 2 +- newlib/libm/mathfp/sf_ldexp.c | 2 +- newlib/libm/mathfp/sf_logarithm.c | 2 +- newlib/libm/mathfp/sf_sincos.c | 4 +- newlib/libm/mathfp/sf_sine.c | 2 +- newlib/libm/mathfp/sf_sineh.c | 2 +- newlib/libm/test/convert.c | 10 +-- newlib/libm/test/dcvt.c | 42 ++++++------ newlib/libm/test/math.c | 44 ++++++------- newlib/libm/test/string.c | 10 +-- newlib/libm/test/test.c | 20 +++--- newlib/libm/test/test_ieee.c | 2 +- newlib/libm/test/test_is.c | 12 ++-- 517 files changed, 1771 insertions(+), 1773 deletions(-) diff --git a/libgloss/cr16/fstat.c b/libgloss/cr16/fstat.c index 637f87db5..73e1fa248 100644 --- a/libgloss/cr16/fstat.c +++ b/libgloss/cr16/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (_fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/cr16/isatty.c b/libgloss/cr16/isatty.c index 1cb32e5c7..604e8f097 100644 --- a/libgloss/cr16/isatty.c +++ b/libgloss/cr16/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes and return a 1. */ int _DEFUN (_isatty, (fd), diff --git a/libgloss/cr16/kill.c b/libgloss/cr16/kill.c index b37584400..43c3ec554 100644 --- a/libgloss/cr16/kill.c +++ b/libgloss/cr16/kill.c @@ -21,7 +21,7 @@ extern void _exit (int) __attribute__((__noreturn__)); */ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/cr16/stat.c b/libgloss/cr16/stat.c index f1769cdac..743fc94a9 100644 --- a/libgloss/cr16/stat.c +++ b/libgloss/cr16/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (_stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/crx/fstat.c b/libgloss/crx/fstat.c index 380fc2aaa..75f863583 100644 --- a/libgloss/crx/fstat.c +++ b/libgloss/crx/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/crx/isatty.c b/libgloss/crx/isatty.c index 927d75497..ac3d041e7 100644 --- a/libgloss/crx/isatty.c +++ b/libgloss/crx/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes and return a 1. */ int _DEFUN (isatty, (fd), diff --git a/libgloss/crx/kill.c b/libgloss/crx/kill.c index 3ed228fd2..db5018cfc 100644 --- a/libgloss/crx/kill.c +++ b/libgloss/crx/kill.c @@ -20,7 +20,7 @@ */ int _DEFUN (kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/crx/stat.c b/libgloss/crx/stat.c index 6ffef821b..9562b9097 100644 --- a/libgloss/crx/stat.c +++ b/libgloss/crx/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/frv/fstat.c b/libgloss/frv/fstat.c index 756f7b261..680c4a1c0 100644 --- a/libgloss/frv/fstat.c +++ b/libgloss/frv/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (_fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/frv/isatty.c b/libgloss/frv/isatty.c index b021b4ff8..e4c99065b 100644 --- a/libgloss/frv/isatty.c +++ b/libgloss/frv/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes and return a 1. */ int _DEFUN (_isatty, (fd), diff --git a/libgloss/frv/kill.c b/libgloss/frv/kill.c index 7c365fd06..8dda1e9a6 100644 --- a/libgloss/frv/kill.c +++ b/libgloss/frv/kill.c @@ -21,7 +21,7 @@ extern void _exit (int) __attribute__((__noreturn__)); */ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/frv/sim-time.c b/libgloss/frv/sim-time.c index c4746b482..196f855ad 100644 --- a/libgloss/frv/sim-time.c +++ b/libgloss/frv/sim-time.c @@ -66,7 +66,7 @@ _DEFUN (_times, _times (buf), */ int _DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv _AND + struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/frv/stat.c b/libgloss/frv/stat.c index 094ab4875..ceaedc216 100644 --- a/libgloss/frv/stat.c +++ b/libgloss/frv/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (_stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/fstat.c b/libgloss/fstat.c index 8082d6395..e7f913358 100644 --- a/libgloss/fstat.c +++ b/libgloss/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/ft32/fstat.c b/libgloss/ft32/fstat.c index 77058b2d1..0bd432e58 100644 --- a/libgloss/ft32/fstat.c +++ b/libgloss/ft32/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (_fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/ft32/isatty.c b/libgloss/ft32/isatty.c index 449410ebe..fd2d73760 100644 --- a/libgloss/ft32/isatty.c +++ b/libgloss/ft32/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes and return a 1. */ int _DEFUN (_isatty, (fd), diff --git a/libgloss/ft32/kill.c b/libgloss/ft32/kill.c index 765b03e78..4b2241f56 100644 --- a/libgloss/ft32/kill.c +++ b/libgloss/ft32/kill.c @@ -21,7 +21,7 @@ extern void _exit (int) __attribute__((__noreturn__)); */ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/ft32/sim-lseek.S b/libgloss/ft32/sim-lseek.S index 2dfde1625..c2a134ca1 100644 --- a/libgloss/ft32/sim-lseek.S +++ b/libgloss/ft32/sim-lseek.S @@ -23,8 +23,8 @@ */ off_t _DEFUN (_lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { errno = ESPIPE; diff --git a/libgloss/ft32/sim-lseek.c b/libgloss/ft32/sim-lseek.c index 297de2b8a..e5c08c8e7 100644 --- a/libgloss/ft32/sim-lseek.c +++ b/libgloss/ft32/sim-lseek.c @@ -23,8 +23,8 @@ */ off_t _DEFUN (_lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { /* errno = ESPIPE; */ diff --git a/libgloss/ft32/sim-time.c b/libgloss/ft32/sim-time.c index 25e72a1f4..8f417ebb7 100644 --- a/libgloss/ft32/sim-time.c +++ b/libgloss/ft32/sim-time.c @@ -34,7 +34,7 @@ _DEFUN (_times, _times (buf), */ int _DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv _AND + struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/ft32/stat.c b/libgloss/ft32/stat.c index 580e2ca6e..4d738efe2 100644 --- a/libgloss/ft32/stat.c +++ b/libgloss/ft32/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (_stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/isatty.c b/libgloss/isatty.c index 2d66cd652..675d99bc2 100644 --- a/libgloss/isatty.c +++ b/libgloss/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes, return a 1. */ int _DEFUN (isatty, (fd), diff --git a/libgloss/kill.c b/libgloss/kill.c index afc1257cf..ada45f6c8 100644 --- a/libgloss/kill.c +++ b/libgloss/kill.c @@ -19,7 +19,7 @@ */ int _DEFUN (kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/libnosys/chown.c b/libgloss/libnosys/chown.c index 67f98d59d..0ddb85d03 100644 --- a/libgloss/libnosys/chown.c +++ b/libgloss/libnosys/chown.c @@ -13,8 +13,8 @@ extern int errno; int _DEFUN (_chown, (path, owner, group), - const char *path _AND - uid_t owner _AND + const char *path, + uid_t owner, gid_t group) { errno = ENOSYS; diff --git a/libgloss/libnosys/execve.c b/libgloss/libnosys/execve.c index 01743fff9..a93641a34 100644 --- a/libgloss/libnosys/execve.c +++ b/libgloss/libnosys/execve.c @@ -12,8 +12,8 @@ extern int errno; int _DEFUN (_execve, (name, argv, env), - char *name _AND - char **argv _AND + char *name, + char **argv, char **env) { errno = ENOSYS; diff --git a/libgloss/libnosys/fstat.c b/libgloss/libnosys/fstat.c index 4e18d4216..d04b40721 100644 --- a/libgloss/libnosys/fstat.c +++ b/libgloss/libnosys/fstat.c @@ -14,7 +14,7 @@ extern int errno; int _DEFUN (_fstat, (fildes, st), - int fildes _AND + int fildes, struct stat *st) { errno = ENOSYS; diff --git a/libgloss/libnosys/gettod.c b/libgloss/libnosys/gettod.c index 4d42b4b42..5e0b2db55 100644 --- a/libgloss/libnosys/gettod.c +++ b/libgloss/libnosys/gettod.c @@ -16,7 +16,7 @@ struct timeval; int _DEFUN (_gettimeofday, (ptimeval, ptimezone), - struct timeval *ptimeval _AND + struct timeval *ptimeval, void *ptimezone) { errno = ENOSYS; diff --git a/libgloss/libnosys/kill.c b/libgloss/libnosys/kill.c index f1d12c646..c58328794 100644 --- a/libgloss/libnosys/kill.c +++ b/libgloss/libnosys/kill.c @@ -12,7 +12,7 @@ extern int errno; int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { errno = ENOSYS; diff --git a/libgloss/libnosys/link.c b/libgloss/libnosys/link.c index 35881cf7f..b27b5bca6 100644 --- a/libgloss/libnosys/link.c +++ b/libgloss/libnosys/link.c @@ -12,7 +12,7 @@ extern int errno; int _DEFUN (_link, (existing, new), - char *existing _AND + char *existing, char *new) { errno = ENOSYS; diff --git a/libgloss/libnosys/lseek.c b/libgloss/libnosys/lseek.c index 0aa89e272..f583a1461 100644 --- a/libgloss/libnosys/lseek.c +++ b/libgloss/libnosys/lseek.c @@ -12,8 +12,8 @@ extern int errno; int _DEFUN (_lseek, (file, ptr, dir), - int file _AND - int ptr _AND + int file, + int ptr, int dir) { errno = ENOSYS; diff --git a/libgloss/libnosys/open.c b/libgloss/libnosys/open.c index 2c8a6ceb9..ee8becedc 100644 --- a/libgloss/libnosys/open.c +++ b/libgloss/libnosys/open.c @@ -12,8 +12,8 @@ extern int errno; int _DEFUN (_open, (file, flags, mode), - char *file _AND - int flags _AND + char *file, + int flags, int mode) { errno = ENOSYS; diff --git a/libgloss/libnosys/read.c b/libgloss/libnosys/read.c index 1a2819c08..0ff3a9a8c 100644 --- a/libgloss/libnosys/read.c +++ b/libgloss/libnosys/read.c @@ -12,8 +12,8 @@ extern int errno; int _DEFUN (_read, (file, ptr, len), - int file _AND - char *ptr _AND + int file, + char *ptr, int len) { errno = ENOSYS; diff --git a/libgloss/libnosys/readlink.c b/libgloss/libnosys/readlink.c index 7df253c40..00f3f8982 100644 --- a/libgloss/libnosys/readlink.c +++ b/libgloss/libnosys/readlink.c @@ -13,8 +13,8 @@ extern int errno; int _DEFUN (_readlink, (path, buf, bufsize), - const char *path _AND - char *buf _AND + const char *path, + char *buf, size_t bufsize) { errno = ENOSYS; diff --git a/libgloss/libnosys/stat.c b/libgloss/libnosys/stat.c index 7c3463798..9fa7003d1 100644 --- a/libgloss/libnosys/stat.c +++ b/libgloss/libnosys/stat.c @@ -14,7 +14,7 @@ extern int errno; int _DEFUN (_stat, (file, st), - const char *file _AND + const char *file, struct stat *st) { errno = ENOSYS; diff --git a/libgloss/libnosys/symlink.c b/libgloss/libnosys/symlink.c index d9e29f2e4..cf7a15896 100644 --- a/libgloss/libnosys/symlink.c +++ b/libgloss/libnosys/symlink.c @@ -12,7 +12,7 @@ extern int errno; int _DEFUN (_symlink, (path1, path2), - const char *path1 _AND + const char *path1, const char *path2) { errno = ENOSYS; diff --git a/libgloss/libnosys/write.c b/libgloss/libnosys/write.c index 0136d74ce..0ada7702b 100644 --- a/libgloss/libnosys/write.c +++ b/libgloss/libnosys/write.c @@ -12,8 +12,8 @@ extern int errno; int _DEFUN (_write, (file, ptr, len), - int file _AND - char *ptr _AND + int file, + char *ptr, int len) { errno = ENOSYS; diff --git a/libgloss/lseek.c b/libgloss/lseek.c index 1df36f55e..42a28d966 100644 --- a/libgloss/lseek.c +++ b/libgloss/lseek.c @@ -21,8 +21,8 @@ */ off_t _DEFUN (lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { errno = ESPIPE; diff --git a/libgloss/mcore/fstat.c b/libgloss/mcore/fstat.c index 02054641b..6a2323a6e 100644 --- a/libgloss/mcore/fstat.c +++ b/libgloss/mcore/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (_fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/mcore/kill.c b/libgloss/mcore/kill.c index 43a359760..8883c8ecd 100644 --- a/libgloss/mcore/kill.c +++ b/libgloss/mcore/kill.c @@ -19,7 +19,7 @@ */ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/mcore/lseek.c b/libgloss/mcore/lseek.c index 0f236fe64..423e11e55 100644 --- a/libgloss/mcore/lseek.c +++ b/libgloss/mcore/lseek.c @@ -21,8 +21,8 @@ */ off_t _DEFUN (_lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { errno = ESPIPE; diff --git a/libgloss/mcore/open.c b/libgloss/mcore/open.c index a9e99597f..6b816e891 100644 --- a/libgloss/mcore/open.c +++ b/libgloss/mcore/open.c @@ -21,8 +21,8 @@ */ int _DEFUN (_open, (buf, flags, mode), - const char *buf _AND - int flags _AND + const char *buf, + int flags, int mode) { errno = EIO; diff --git a/libgloss/mcore/read.c b/libgloss/mcore/read.c index 499426d1b..8f394780c 100644 --- a/libgloss/mcore/read.c +++ b/libgloss/mcore/read.c @@ -22,8 +22,8 @@ extern char _DEFUN_VOID (inbyte); */ int _DEFUN (_read, (fd, buf, nbytes), - int fd _AND - char *buf _AND + int fd, + char *buf, int nbytes) { int i = 0; diff --git a/libgloss/mcore/stat.c b/libgloss/mcore/stat.c index 401a6b50d..d07042a51 100644 --- a/libgloss/mcore/stat.c +++ b/libgloss/mcore/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (_stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/mcore/write.c b/libgloss/mcore/write.c index 7f39fd1bb..189ea6222 100644 --- a/libgloss/mcore/write.c +++ b/libgloss/mcore/write.c @@ -23,8 +23,8 @@ extern int _EXFUN (outbyte, (char x)); */ int _DEFUN (_write, (fd, buf, nbytes), - int fd _AND - char *buf _AND + int fd, + char *buf, int nbytes) { int i; diff --git a/libgloss/moxie/fstat.c b/libgloss/moxie/fstat.c index 6464a861b..38dd07b34 100644 --- a/libgloss/moxie/fstat.c +++ b/libgloss/moxie/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (_fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/moxie/isatty.c b/libgloss/moxie/isatty.c index 14cb9c42c..73ade0741 100644 --- a/libgloss/moxie/isatty.c +++ b/libgloss/moxie/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes and return a 1. */ int _DEFUN (_isatty, (fd), diff --git a/libgloss/moxie/kill.c b/libgloss/moxie/kill.c index 257c491e0..d602829ce 100644 --- a/libgloss/moxie/kill.c +++ b/libgloss/moxie/kill.c @@ -21,7 +21,7 @@ extern void _exit (int) __attribute__((__noreturn__)); */ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/moxie/qemu-time.c b/libgloss/moxie/qemu-time.c index 4b0920994..1abd5a9f7 100644 --- a/libgloss/moxie/qemu-time.c +++ b/libgloss/moxie/qemu-time.c @@ -101,7 +101,7 @@ _DEFUN (time, time (t), */ int _DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv _AND + struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/moxie/sim-lseek.S b/libgloss/moxie/sim-lseek.S index 1c799f872..5e5493cd7 100644 --- a/libgloss/moxie/sim-lseek.S +++ b/libgloss/moxie/sim-lseek.S @@ -23,8 +23,8 @@ */ off_t _DEFUN (_lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { errno = ESPIPE; diff --git a/libgloss/moxie/sim-lseek.c b/libgloss/moxie/sim-lseek.c index 8e7ee50e9..d22d7226c 100644 --- a/libgloss/moxie/sim-lseek.c +++ b/libgloss/moxie/sim-lseek.c @@ -23,8 +23,8 @@ */ off_t _DEFUN (_lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { /* errno = ESPIPE; */ diff --git a/libgloss/moxie/sim-time.c b/libgloss/moxie/sim-time.c index 3e9fafb4b..d3f43d385 100644 --- a/libgloss/moxie/sim-time.c +++ b/libgloss/moxie/sim-time.c @@ -65,7 +65,7 @@ _DEFUN (_times, _times (buf), */ int _DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv _AND + struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/moxie/stat.c b/libgloss/moxie/stat.c index 0d7511ae6..01a958210 100644 --- a/libgloss/moxie/stat.c +++ b/libgloss/moxie/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (_stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/open.c b/libgloss/open.c index 468b11cd1..90787b1b9 100644 --- a/libgloss/open.c +++ b/libgloss/open.c @@ -21,8 +21,8 @@ */ int _DEFUN (open, (buf, flags, mode), - const char *buf _AND - int flags _AND + const char *buf, + int flags, int mode) { errno = EIO; diff --git a/libgloss/read.c b/libgloss/read.c index 419a8ed64..2e5e0c72c 100644 --- a/libgloss/read.c +++ b/libgloss/read.c @@ -22,8 +22,8 @@ extern char _DEFUN_VOID (inbyte); */ int _DEFUN (read, (fd, buf, nbytes), - int fd _AND - char *buf _AND + int fd, + char *buf, int nbytes) { int i = 0; diff --git a/libgloss/stat.c b/libgloss/stat.c index ebb7de3f5..5957645c6 100644 --- a/libgloss/stat.c +++ b/libgloss/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/tic6x/kill.c b/libgloss/tic6x/kill.c index 3ed228fd2..db5018cfc 100644 --- a/libgloss/tic6x/kill.c +++ b/libgloss/tic6x/kill.c @@ -20,7 +20,7 @@ */ int _DEFUN (kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/write.c b/libgloss/write.c index 292a68e53..69f452c34 100644 --- a/libgloss/write.c +++ b/libgloss/write.c @@ -23,8 +23,8 @@ extern int _EXFUN (outbyte, (char x)); */ int _DEFUN (write, (fd, buf, nbytes), - int fd _AND - char *buf _AND + int fd, + char *buf, int nbytes) { int i; diff --git a/libgloss/xc16x/misc.c b/libgloss/xc16x/misc.c index 786db36dd..2eb951a5a 100644 --- a/libgloss/xc16x/misc.c +++ b/libgloss/xc16x/misc.c @@ -31,7 +31,7 @@ int _DEFUN(_getpid,(),) } int _DEFUN(_kill,(pid, sig), - int pid _AND + int pid, int sig) { errno = ENOSYS; diff --git a/libgloss/xstormy16/fstat.c b/libgloss/xstormy16/fstat.c index 982d578cb..2926ccaab 100644 --- a/libgloss/xstormy16/fstat.c +++ b/libgloss/xstormy16/fstat.c @@ -20,7 +20,7 @@ */ int _DEFUN (_fstat, (fd, buf), - int fd _AND + int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/xstormy16/isatty.c b/libgloss/xstormy16/isatty.c index e3c32051a..0e92a9f4f 100644 --- a/libgloss/xstormy16/isatty.c +++ b/libgloss/xstormy16/isatty.c @@ -17,7 +17,7 @@ /* * isatty -- returns 1 if connected to a terminal device, * returns 0 if not. Since we're hooked up to a - * serial port, we'll say yes _AND return a 1. + * serial port, we'll say yes and return a 1. */ int _DEFUN (_isatty, (fd), diff --git a/libgloss/xstormy16/kill.c b/libgloss/xstormy16/kill.c index 0bbc0141a..2374dc29d 100644 --- a/libgloss/xstormy16/kill.c +++ b/libgloss/xstormy16/kill.c @@ -19,7 +19,7 @@ */ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/xstormy16/lseek.c b/libgloss/xstormy16/lseek.c index 640a96ea0..11dbab08e 100644 --- a/libgloss/xstormy16/lseek.c +++ b/libgloss/xstormy16/lseek.c @@ -21,8 +21,8 @@ */ off_t _DEFUN (_lseek, (fd, offset, whence), - int fd _AND - off_t offset _AND + int fd, + off_t offset, int whence) { errno = ESPIPE; diff --git a/libgloss/xstormy16/open.c b/libgloss/xstormy16/open.c index a2c318e1a..600f92982 100644 --- a/libgloss/xstormy16/open.c +++ b/libgloss/xstormy16/open.c @@ -21,8 +21,8 @@ */ int _DEFUN (_open, (buf, flags, mode), - const char *buf _AND - int flags _AND + const char *buf, + int flags, int mode) { errno = EIO; diff --git a/libgloss/xstormy16/stat.c b/libgloss/xstormy16/stat.c index c766a341c..b80b83c6c 100644 --- a/libgloss/xstormy16/stat.c +++ b/libgloss/xstormy16/stat.c @@ -21,7 +21,7 @@ */ int _DEFUN (_stat, (path, buf), - const char *path _AND + const char *path, struct stat *buf) { errno = EIO; diff --git a/newlib/libc/argz/argz_add.c b/newlib/libc/argz/argz_add.c index 1c3b17025..3194f0851 100644 --- a/newlib/libc/argz/argz_add.c +++ b/newlib/libc/argz/argz_add.c @@ -12,8 +12,8 @@ error_t _DEFUN (argz_add, (argz, argz_len, str), - char **argz _AND - size_t *argz_len _AND + char **argz, + size_t *argz_len, const char *str) { int len_to_add = 0; diff --git a/newlib/libc/argz/argz_add_sep.c b/newlib/libc/argz/argz_add_sep.c index 7dfbb4d6e..92c73716d 100644 --- a/newlib/libc/argz/argz_add_sep.c +++ b/newlib/libc/argz/argz_add_sep.c @@ -12,9 +12,9 @@ error_t _DEFUN (argz_add_sep, (argz, argz_len, str, sep), - char **argz _AND - size_t *argz_len _AND - const char *str _AND + char **argz, + size_t *argz_len, + const char *str, int sep) { char *str_argz = 0; diff --git a/newlib/libc/argz/argz_append.c b/newlib/libc/argz/argz_append.c index c6c3dbee9..a84f8e0b9 100644 --- a/newlib/libc/argz/argz_append.c +++ b/newlib/libc/argz/argz_append.c @@ -12,9 +12,9 @@ error_t _DEFUN (argz_append, (argz, argz_len, buf, buf_len), - char **argz _AND - size_t *argz_len _AND - const char *buf _AND + char **argz, + size_t *argz_len, + const char *buf, size_t buf_len) { if (buf_len) diff --git a/newlib/libc/argz/argz_count.c b/newlib/libc/argz/argz_count.c index 4761275df..33d0eecc2 100644 --- a/newlib/libc/argz/argz_count.c +++ b/newlib/libc/argz/argz_count.c @@ -11,7 +11,7 @@ size_t _DEFUN (argz_count, (argz, argz_len), - const char *argz _AND + const char *argz, size_t argz_len) { int i; diff --git a/newlib/libc/argz/argz_create.c b/newlib/libc/argz/argz_create.c index 9d7b2f13d..d4b8b0592 100644 --- a/newlib/libc/argz/argz_create.c +++ b/newlib/libc/argz/argz_create.c @@ -12,8 +12,8 @@ error_t _DEFUN (argz_create, (argv, argz, argz_len), - char *const argv[] _AND - char **argz _AND + char *const argv[], + char **argz, size_t *argz_len) { int argc = 0; diff --git a/newlib/libc/argz/argz_create_sep.c b/newlib/libc/argz/argz_create_sep.c index 38866e1d5..afff44c1e 100644 --- a/newlib/libc/argz/argz_create_sep.c +++ b/newlib/libc/argz/argz_create_sep.c @@ -12,9 +12,9 @@ error_t _DEFUN (argz_create_sep, (string, sep, argz, argz_len), - const char *string _AND - int sep _AND - char **argz _AND + const char *string, + int sep, + char **argz, size_t *argz_len) { int len = 0; diff --git a/newlib/libc/argz/argz_delete.c b/newlib/libc/argz/argz_delete.c index aa94f6d7a..a4e12273d 100644 --- a/newlib/libc/argz/argz_delete.c +++ b/newlib/libc/argz/argz_delete.c @@ -12,8 +12,8 @@ error_t _DEFUN (argz_delete, (argz, argz_len, entry), - char **argz _AND - size_t *argz_len _AND + char **argz, + size_t *argz_len, char *entry) { int len = 0; diff --git a/newlib/libc/argz/argz_extract.c b/newlib/libc/argz/argz_extract.c index a819f3953..4932de6a9 100644 --- a/newlib/libc/argz/argz_extract.c +++ b/newlib/libc/argz/argz_extract.c @@ -10,8 +10,8 @@ void _DEFUN (argz_extract, (argz, argz_len, argv), - char *argz _AND - size_t argz_len _AND + char *argz, + size_t argz_len, char **argv) { size_t i = 0; diff --git a/newlib/libc/argz/argz_insert.c b/newlib/libc/argz/argz_insert.c index d0a32eca9..5965e04a6 100644 --- a/newlib/libc/argz/argz_insert.c +++ b/newlib/libc/argz/argz_insert.c @@ -14,9 +14,9 @@ error_t _DEFUN (argz_insert, (argz, argz_len, before, entry), - char **argz _AND - size_t *argz_len _AND - char *before _AND + char **argz, + size_t *argz_len, + char *before, const char *entry) { int len = 0; diff --git a/newlib/libc/argz/argz_next.c b/newlib/libc/argz/argz_next.c index 94852f538..3f672217e 100644 --- a/newlib/libc/argz/argz_next.c +++ b/newlib/libc/argz/argz_next.c @@ -12,8 +12,8 @@ char * _DEFUN (argz_next, (argz, argz_len, entry), - char *argz _AND - size_t argz_len _AND + char *argz, + size_t argz_len, const char *entry) { if (entry) diff --git a/newlib/libc/argz/argz_replace.c b/newlib/libc/argz/argz_replace.c index b274f91b6..e6c6ead3e 100644 --- a/newlib/libc/argz/argz_replace.c +++ b/newlib/libc/argz/argz_replace.c @@ -14,10 +14,10 @@ error_t _DEFUN (argz_replace, (argz, argz_len, str, with, replace_count), - char **argz _AND - size_t *argz_len _AND - const char *str _AND - const char *with _AND + char **argz, + size_t *argz_len, + const char *str, + const char *with, unsigned *replace_count) { const int str_len = strlen(str); diff --git a/newlib/libc/argz/argz_stringify.c b/newlib/libc/argz/argz_stringify.c index be5f2cf45..72895f5e7 100644 --- a/newlib/libc/argz/argz_stringify.c +++ b/newlib/libc/argz/argz_stringify.c @@ -11,8 +11,8 @@ void _DEFUN (argz_stringify, (argz, argz_len, sep), - char *argz _AND - size_t argz_len _AND + char *argz, + size_t argz_len, int sep) { size_t i; diff --git a/newlib/libc/argz/envz_add.c b/newlib/libc/argz/envz_add.c index 3e91a5867..f01d09926 100644 --- a/newlib/libc/argz/envz_add.c +++ b/newlib/libc/argz/envz_add.c @@ -13,9 +13,9 @@ error_t _DEFUN (envz_add, (envz, envz_len, name, value), - char **envz _AND - size_t *envz_len _AND - const char *name _AND + char **envz, + size_t *envz_len, + const char *name, const char *value) { char *concat = NULL; diff --git a/newlib/libc/argz/envz_entry.c b/newlib/libc/argz/envz_entry.c index 3d1986ba7..bbe38529e 100644 --- a/newlib/libc/argz/envz_entry.c +++ b/newlib/libc/argz/envz_entry.c @@ -14,8 +14,8 @@ char * _DEFUN (envz_entry, (envz, envz_len, name), - const char *envz _AND - size_t envz_len _AND + const char *envz, + size_t envz_len, const char *name) { char *buf_ptr = (char *)envz; diff --git a/newlib/libc/argz/envz_get.c b/newlib/libc/argz/envz_get.c index b4f7c2806..62d3d0cff 100644 --- a/newlib/libc/argz/envz_get.c +++ b/newlib/libc/argz/envz_get.c @@ -14,8 +14,8 @@ char * _DEFUN (envz_get, (envz, envz_len, name), - const char *envz _AND - size_t envz_len _AND + const char *envz, + size_t envz_len, const char *name) { char *buf_ptr = (char *)envz; diff --git a/newlib/libc/argz/envz_merge.c b/newlib/libc/argz/envz_merge.c index 8a26bc3c3..9299069e4 100644 --- a/newlib/libc/argz/envz_merge.c +++ b/newlib/libc/argz/envz_merge.c @@ -13,10 +13,10 @@ error_t _DEFUN (envz_merge, (envz, envz_len, envz2, envz2_len, override), - char **envz _AND - size_t *envz_len _AND - const char *envz2 _AND - size_t envz2_len _AND + char **envz, + size_t *envz_len, + const char *envz2, + size_t envz2_len, int override) { char *entry = NULL; diff --git a/newlib/libc/argz/envz_remove.c b/newlib/libc/argz/envz_remove.c index 1882297f0..2558656aa 100644 --- a/newlib/libc/argz/envz_remove.c +++ b/newlib/libc/argz/envz_remove.c @@ -13,8 +13,8 @@ void _DEFUN (envz_remove, (envz, envz_len, name), - char **envz _AND - size_t *envz_len _AND + char **envz, + size_t *envz_len, const char *name) { char *entry = NULL; diff --git a/newlib/libc/argz/envz_strip.c b/newlib/libc/argz/envz_strip.c index e1c461091..857f8492e 100644 --- a/newlib/libc/argz/envz_strip.c +++ b/newlib/libc/argz/envz_strip.c @@ -13,7 +13,7 @@ void _DEFUN (envz_strip, (envz, envz_len), - char **envz _AND + char **envz, size_t *envz_len) { char *entry = 0; diff --git a/newlib/libc/ctype/iswctype.c b/newlib/libc/ctype/iswctype.c index bfa7b003c..89c0f9a31 100644 --- a/newlib/libc/ctype/iswctype.c +++ b/newlib/libc/ctype/iswctype.c @@ -38,7 +38,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(iswctype,(c, desc), wint_t c _AND wctype_t desc) +_DEFUN(iswctype,(c, desc), wint_t c, wctype_t desc) { switch (desc) { diff --git a/newlib/libc/ctype/jp2uc.c b/newlib/libc/ctype/jp2uc.c index f5bd7dbf2..8fbd1b083 100644 --- a/newlib/libc/ctype/jp2uc.c +++ b/newlib/libc/ctype/jp2uc.c @@ -48,7 +48,7 @@ #define JP_EUCJP 3 static wint_t -_DEFUN (__jp2uc, (c, type), wint_t c _AND int type) +_DEFUN (__jp2uc, (c, type), wint_t c, int type) { int index, adj; unsigned char byte1, byte2; diff --git a/newlib/libc/ctype/towctrans.c b/newlib/libc/ctype/towctrans.c index 5528542ff..3500cbaac 100644 --- a/newlib/libc/ctype/towctrans.c +++ b/newlib/libc/ctype/towctrans.c @@ -77,8 +77,8 @@ No supporting OS subroutines are required. wint_t _DEFUN (_towctrans_r, (r, c, w), - struct _reent *r _AND - wint_t c _AND + struct _reent *r, + wint_t c, wctrans_t w) { if (w == WCT_TOLOWER) @@ -95,7 +95,7 @@ _DEFUN (_towctrans_r, (r, c, w), #ifndef _REENT_ONLY wint_t _DEFUN (towctrans, (c, w), - wint_t c _AND + wint_t c, wctrans_t w) { return _towctrans_r (_REENT, c, w); diff --git a/newlib/libc/ctype/wctrans.c b/newlib/libc/ctype/wctrans.c index dd5b28c4b..7183c45ca 100644 --- a/newlib/libc/ctype/wctrans.c +++ b/newlib/libc/ctype/wctrans.c @@ -76,7 +76,7 @@ No supporting OS subroutines are required. wctrans_t _DEFUN (_wctrans_r, (r, c), - struct _reent *r _AND + struct _reent *r, const char *c) { if (!strcmp (c, "tolower")) diff --git a/newlib/libc/ctype/wctype.c b/newlib/libc/ctype/wctype.c index c1a70eebb..6cd9425bc 100644 --- a/newlib/libc/ctype/wctype.c +++ b/newlib/libc/ctype/wctype.c @@ -77,7 +77,7 @@ No supporting OS subroutines are required. wctype_t _DEFUN (_wctype_r, (r, c), - struct _reent *r _AND + struct _reent *r, const char *c) { switch (*c) diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c index 749269766..62bab771e 100644 --- a/newlib/libc/iconv/ces/euc.c +++ b/newlib/libc/iconv/ces/euc.c @@ -102,7 +102,7 @@ static euc_cs_desc_t euc_kr_cs_desc [] = #if defined (ICONV_FROM_UCS_CES_EUC) static _VOID_PTR _DEFUN(euc_from_ucs_init, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int i; @@ -166,7 +166,7 @@ error1: static size_t _DEFUN(euc_from_ucs_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { int i; @@ -186,9 +186,9 @@ _DEFUN(euc_from_ucs_close, (rptr, data), static size_t _DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - register ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + register ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { int i; @@ -262,7 +262,7 @@ _DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_EUC) static _VOID_PTR _DEFUN(euc_to_ucs_init, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int i; @@ -326,7 +326,7 @@ error1: static size_t _DEFUN(euc_to_ucs_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { int i; @@ -346,8 +346,8 @@ _DEFUN(euc_to_ucs_close, (rptr, data), static ucs4_t _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { int i; diff --git a/newlib/libc/iconv/ces/table-pcs.c b/newlib/libc/iconv/ces/table-pcs.c index fc46e27f2..650bf9af2 100644 --- a/newlib/libc/iconv/ces/table-pcs.c +++ b/newlib/libc/iconv/ces/table-pcs.c @@ -41,9 +41,9 @@ #if defined (ICONV_FROM_UCS_CES_TABLE_PCS) static size_t _DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { if (*outbytesleft < 1) @@ -66,7 +66,7 @@ _DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), static _VOID_PTR _DEFUN(table_pcs_from_ucs_init, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { return _iconv_from_ucs_ces_handlers_table.init (rptr, encoding); @@ -74,7 +74,7 @@ _DEFUN(table_pcs_from_ucs_init, (rptr, encoding), static size_t _DEFUN(table_pcs_from_ucs_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { return _iconv_from_ucs_ces_handlers_table.close (rptr, data); @@ -92,8 +92,8 @@ _DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data), #if defined (ICONV_TO_UCS_CES_TABLE_PCS) static ucs4_t _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { if (*inbytesleft < 1) @@ -114,7 +114,7 @@ _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), static _VOID_PTR _DEFUN(table_pcs_to_ucs_init, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { return _iconv_to_ucs_ces_handlers_table.init (rptr, encoding); @@ -122,7 +122,7 @@ _DEFUN(table_pcs_to_ucs_init, (rptr, encoding), static size_t _DEFUN(table_pcs_to_ucs_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { return _iconv_to_ucs_ces_handlers_table.close (rptr, data); diff --git a/newlib/libc/iconv/ces/table.c b/newlib/libc/iconv/ces/table.c index e43e23faa..39c358cda 100644 --- a/newlib/libc/iconv/ces/table.c +++ b/newlib/libc/iconv/ces/table.c @@ -75,7 +75,7 @@ _EXFUN(load_file, (struct _reent *rptr, _CONST char *name, int direction)); */ static size_t _DEFUN(table_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; @@ -90,7 +90,7 @@ _DEFUN(table_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_TABLE) static _VOID_PTR _DEFUN(table_init_from_ucs, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int i; @@ -128,9 +128,9 @@ _DEFUN(table_init_from_ucs, (rptr, encoding), static size_t _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; @@ -173,7 +173,7 @@ _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_TABLE) static _VOID_PTR _DEFUN(table_init_to_ucs, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int i; @@ -211,8 +211,8 @@ _DEFUN(table_init_to_ucs, (rptr, encoding), static ucs4_t _DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; @@ -304,7 +304,7 @@ _iconv_from_ucs_ces_handlers_table = */ static __inline ucs2_t _DEFUN(find_code_speed, (code, tblp), - ucs2_t code _AND + ucs2_t code, _CONST __uint16_t *tblp) { int idx = tblp[code >> 8]; @@ -327,7 +327,7 @@ _DEFUN(find_code_speed, (code, tblp), */ static __inline ucs2_t _DEFUN(find_code_speed_8bit, (code, tblp), - ucs2_t code _AND + ucs2_t code, _CONST unsigned char *tblp) { int idx; @@ -367,7 +367,7 @@ _DEFUN(find_code_speed_8bit, (code, tblp), */ static ucs2_t _DEFUN(find_code_size, (code, tblp), - ucs2_t code _AND + ucs2_t code, _CONST __uint16_t *tblp) { int first, last, cur, center; @@ -461,8 +461,8 @@ _DEFUN(find_code_size, (code, tblp), */ static _CONST iconv_ccs_desc_t * _DEFUN(load_file, (rptr, name, direction), - struct _reent *rptr _AND - _CONST char *name _AND + struct _reent *rptr, + _CONST char *name, int direction) { int fd; diff --git a/newlib/libc/iconv/ces/ucs-2-internal.c b/newlib/libc/iconv/ces/ucs-2-internal.c index 893bdd429..2aacce912 100644 --- a/newlib/libc/iconv/ces/ucs-2-internal.c +++ b/newlib/libc/iconv/ces/ucs-2-internal.c @@ -45,9 +45,9 @@ #if defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) static size_t _DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - register ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + register ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { if (in > 0x0000FFFF) @@ -67,8 +67,8 @@ _DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) static ucs4_t _DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { register ucs4_t res; diff --git a/newlib/libc/iconv/ces/ucs-2.c b/newlib/libc/iconv/ces/ucs-2.c index 6f796ca54..000a7912f 100644 --- a/newlib/libc/iconv/ces/ucs-2.c +++ b/newlib/libc/iconv/ces/ucs-2.c @@ -51,7 +51,7 @@ static _VOID_PTR _DEFUN(ucs_2_init, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int *data; @@ -69,7 +69,7 @@ _DEFUN(ucs_2_init, (rptr, encoding), static size_t _DEFUN(ucs_2_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { _free_r (rptr, data); @@ -79,9 +79,9 @@ _DEFUN(ucs_2_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UCS_2) static size_t _DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { if ((in >= 0x0000D800 && in <= 0x0000DFFF) /* Surrogate character */ @@ -106,8 +106,8 @@ _DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_2) static ucs4_t _DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { ucs4_t res; diff --git a/newlib/libc/iconv/ces/ucs-4-internal.c b/newlib/libc/iconv/ces/ucs-4-internal.c index d8df9b157..4266b2afc 100644 --- a/newlib/libc/iconv/ces/ucs-4-internal.c +++ b/newlib/libc/iconv/ces/ucs-4-internal.c @@ -45,9 +45,9 @@ #if defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL) static size_t _DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - register ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + register ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { if (in > 0x7FFFFFFF) @@ -67,8 +67,8 @@ _DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) static ucs4_t _DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { register ucs4_t res; diff --git a/newlib/libc/iconv/ces/ucs-4.c b/newlib/libc/iconv/ces/ucs-4.c index cfa7b367d..1d028c5dd 100644 --- a/newlib/libc/iconv/ces/ucs-4.c +++ b/newlib/libc/iconv/ces/ucs-4.c @@ -52,7 +52,7 @@ static _VOID_PTR _DEFUN(ucs_4_init, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int *data; @@ -70,7 +70,7 @@ _DEFUN(ucs_4_init, (rptr, encoding), static size_t _DEFUN(ucs_4_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { _free_r(rptr, data); @@ -81,9 +81,9 @@ _DEFUN(ucs_4_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UCS_4) static size_t _DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { if ((in >= 0x0000D800 && in <= 0x0000DFFF) /* Surrogate character */ @@ -108,8 +108,8 @@ _DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_4) static ucs4_t _DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { ucs4_t res; diff --git a/newlib/libc/iconv/ces/us-ascii.c b/newlib/libc/iconv/ces/us-ascii.c index 2f213a7ed..eb4dee6e3 100644 --- a/newlib/libc/iconv/ces/us-ascii.c +++ b/newlib/libc/iconv/ces/us-ascii.c @@ -41,9 +41,9 @@ #if defined (ICONV_FROM_UCS_CES_US_ASCII) static size_t _DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { if (in > 0x7F) @@ -61,8 +61,8 @@ _DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_US_ASCII) static ucs4_t _DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { ucs4_t res; diff --git a/newlib/libc/iconv/ces/utf-16.c b/newlib/libc/iconv/ces/utf-16.c index 4b2ff77a1..93cc4c341 100644 --- a/newlib/libc/iconv/ces/utf-16.c +++ b/newlib/libc/iconv/ces/utf-16.c @@ -59,7 +59,7 @@ static size_t _DEFUN(utf_16_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { _free_r(rptr, data); @@ -69,7 +69,7 @@ _DEFUN(utf_16_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UTF_16) static _VOID_PTR _DEFUN(utf_16_init_from_ucs, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int *data; @@ -89,9 +89,9 @@ _DEFUN(utf_16_init_from_ucs, (rptr, encoding), static size_t _DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - register ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + register ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { register ucs2_t *cp; @@ -171,7 +171,7 @@ _DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UTF_16) static _VOID_PTR _DEFUN(utf_16_init_to_ucs, (rptr, encoding), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *encoding) { int *data; @@ -191,8 +191,8 @@ _DEFUN(utf_16_init_to_ucs, (rptr, encoding), static ucs4_t _DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { register ucs2_t w1; diff --git a/newlib/libc/iconv/ces/utf-8.c b/newlib/libc/iconv/ces/utf-8.c index fda1e6e3b..f02dd6fcc 100644 --- a/newlib/libc/iconv/ces/utf-8.c +++ b/newlib/libc/iconv/ces/utf-8.c @@ -44,9 +44,9 @@ #if defined (ICONV_FROM_UCS_CES_UTF_8) static size_t _DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data _AND - register ucs4_t in _AND - unsigned char **outbuf _AND + _VOID_PTR data, + register ucs4_t in, + unsigned char **outbuf, size_t *outbytesleft) { register unsigned char *cp; @@ -126,8 +126,8 @@ _DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UTF_8) static ucs4_t _DEFUN(convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND + _VOID_PTR data, + _CONST unsigned char **inbuf, size_t *inbytesleft) { register _CONST unsigned char *in = *inbuf; diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c index 41497c608..278b84915 100644 --- a/newlib/libc/iconv/lib/aliasesi.c +++ b/newlib/libc/iconv/lib/aliasesi.c @@ -49,7 +49,7 @@ */ static _CONST char * _DEFUN(canonical_form, (rptr, str), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *str) { char *p, *p1; @@ -94,9 +94,9 @@ _DEFUN(canonical_form, (rptr, str), */ static char * _DEFUN(find_alias, (rptr, alias, table, len), - struct _reent *rptr _AND - _CONST char *alias _AND - _CONST char *table _AND + struct _reent *rptr, + _CONST char *alias, + _CONST char *table, int len) { _CONST char *end; @@ -148,7 +148,7 @@ search_again: */ char * _DEFUN(_iconv_resolve_encoding_name, (rptr, cname, path), - struct _reent *rptr _AND + struct _reent *rptr, _CONST char *ca) { char *p = (char *)ca; diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c index 9d9d6a717..b8000e4be 100644 --- a/newlib/libc/iconv/lib/iconv.c +++ b/newlib/libc/iconv/lib/iconv.c @@ -121,7 +121,7 @@ No supporting OS subroutine calls are required. iconv_t _DEFUN(iconv_open, (to, from), - _CONST char *to _AND + _CONST char *to, _CONST char *from) { return _iconv_open_r (_REENT, to, from); @@ -130,10 +130,10 @@ _DEFUN(iconv_open, (to, from), size_t _DEFUN(iconv, (cd, inbuf, inbytesleft, outbuf, outbytesleft), - iconv_t cd _AND - char **__restrict inbuf _AND - size_t *__restrict inbytesleft _AND - char **__restrict outbuf _AND + iconv_t cd, + char **__restrict inbuf, + size_t *__restrict inbytesleft, + char **__restrict outbuf, size_t *__restrict outbytesleft) { return _iconv_r (_REENT, cd, (_CONST char **) inbuf, inbytesleft, @@ -151,8 +151,8 @@ _DEFUN(iconv_close, (cd), iconv_t cd) #ifndef _REENT_ONLY iconv_t _DEFUN(_iconv_open_r, (rptr, to, from), - struct _reent *rptr _AND - _CONST char *to _AND + struct _reent *rptr, + _CONST char *to, _CONST char *from) { iconv_conversion_t *ic; @@ -202,11 +202,11 @@ _DEFUN(_iconv_open_r, (rptr, to, from), size_t _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), - struct _reent *rptr _AND - iconv_t cd _AND - _CONST char **inbuf _AND - size_t *inbytesleft _AND - char **outbuf _AND + struct _reent *rptr, + iconv_t cd, + _CONST char **inbuf, + size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -289,7 +289,7 @@ _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), int _DEFUN(_iconv_close_r, (rptr, cd), - struct _reent *rptr _AND + struct _reent *rptr, iconv_t cd) { int res; diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c index 1b42f2c7b..3223e1303 100644 --- a/newlib/libc/iconv/lib/iconvnls.c +++ b/newlib/libc/iconv/lib/iconvnls.c @@ -60,9 +60,9 @@ */ _CONST char * _DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), - struct _reent *rptr _AND - _CONST char *file _AND - _CONST char *dir _AND + struct _reent *rptr, + _CONST char *file, + _CONST char *dir, _CONST char *ext) { int len1, len2, len3; @@ -115,7 +115,7 @@ _DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), */ int _DEFUN(_iconv_nls_get_mb_cur_max, (cd, direction), - iconv_t cd _AND + iconv_t cd, int direction) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -138,7 +138,7 @@ _DEFUN(_iconv_nls_get_mb_cur_max, (cd, direction), */ int _DEFUN(_iconv_nls_is_stateful, (cd, direction), - iconv_t cd _AND + iconv_t cd, int direction) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -167,11 +167,11 @@ _DEFUN(_iconv_nls_is_stateful, (cd, direction), */ size_t _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), - struct _reent *rptr _AND - iconv_t cd _AND - _CONST char **inbuf _AND - size_t *inbytesleft _AND - char **outbuf _AND + struct _reent *rptr, + iconv_t cd, + _CONST char **inbuf, + size_t *inbytesleft, + char **outbuf, size_t *outbytesleft) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -221,8 +221,8 @@ _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), */ _VOID _DEFUN(_iconv_nls_get_state, (cd, ps, direction), - iconv_t cd _AND - mbstate_t *ps _AND + iconv_t cd, + mbstate_t *ps, int direction) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -248,8 +248,8 @@ _DEFUN(_iconv_nls_get_state, (cd, ps, direction), */ int _DEFUN(_iconv_nls_set_state, (cd, ps, direction), - iconv_t cd _AND - mbstate_t *ps _AND + iconv_t cd, + mbstate_t *ps, int direction) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -260,8 +260,8 @@ _DEFUN(_iconv_nls_set_state, (cd, ps, direction), /* Same as iconv_open() but don't perform name resolving */ static iconv_t _DEFUN(iconv_open1, (rptr, to, from), - struct _reent *rptr _AND - _CONST char *to _AND + struct _reent *rptr, + _CONST char *to, _CONST char *from) { iconv_conversion_t *ic; @@ -317,10 +317,10 @@ _DEFUN(iconv_open1, (rptr, to, from), */ int _DEFUN(_iconv_nls_open, (rptr, encoding, towc, tomb), - struct _reent *rptr _AND - _CONST char *encoding _AND - iconv_t *tomb _AND - iconv_t *towc _AND + struct _reent *rptr, + _CONST char *encoding, + iconv_t *tomb, + iconv_t *towc, int flag) { _CONST char *wchar_encoding; diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c index d35027f9c..7ddbc77bd 100644 --- a/newlib/libc/iconv/lib/nullconv.c +++ b/newlib/libc/iconv/lib/nullconv.c @@ -37,8 +37,8 @@ static int null_conversion_dummy_data; static _VOID_PTR _DEFUN(null_conversion_open, (rptr, to, from), - struct _reent *rptr _AND - _CONST char *to _AND + struct _reent *rptr, + _CONST char *to, _CONST char *from) { return (_VOID_PTR)&null_conversion_dummy_data; @@ -47,7 +47,7 @@ _DEFUN(null_conversion_open, (rptr, to, from), static size_t _DEFUN(null_conversion_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { return 0; @@ -57,12 +57,12 @@ _DEFUN(null_conversion_close, (rptr, data), static size_t _DEFUN(null_conversion_convert, (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft), - struct _reent *rptr _AND - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND - size_t *inbytesleft _AND - unsigned char **outbuf _AND - size_t *outbytesleft _AND + struct _reent *rptr, + _VOID_PTR data, + _CONST unsigned char **inbuf, + size_t *inbytesleft, + unsigned char **outbuf, + size_t *outbytesleft, int flags) { size_t result; @@ -94,7 +94,7 @@ _DEFUN(null_conversion_convert, static int _DEFUN(null_conversion_get_mb_cur_max, (data, direction), - _VOID_PTR data _AND + _VOID_PTR data, int direction) { return ICONV_MB_LEN_MAX; @@ -103,8 +103,8 @@ _DEFUN(null_conversion_get_mb_cur_max, (data, direction), static _VOID _DEFUN(null_conversion_get_state, (data, state, size), - _VOID_PTR data _AND - mbstate_t *state _AND + _VOID_PTR data, + mbstate_t *state, int direction) { return; @@ -113,8 +113,8 @@ _DEFUN(null_conversion_get_state, (data, state, size), static int _DEFUN(null_conversion_set_state, (data, state, direction), - _VOID_PTR data _AND - mbstate_t *state _AND + _VOID_PTR data, + mbstate_t *state, int direction) { return 0; @@ -122,7 +122,7 @@ _DEFUN(null_conversion_set_state, (data, state, direction), static int _DEFUN(null_conversion_is_stateful, (data, direction), - _VOID_PTR data _AND + _VOID_PTR data, int direction) { return 0; diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c index cc5ceb953..46ad33efe 100644 --- a/newlib/libc/iconv/lib/ucsconv.c +++ b/newlib/libc/iconv/lib/ucsconv.c @@ -46,8 +46,8 @@ _EXFUN(find_encoding_name, (_CONST char *searchee, static _VOID_PTR _DEFUN(ucs_based_conversion_open, (rptr, to, from), - struct _reent *rptr _AND - _CONST char *to _AND + struct _reent *rptr, + _CONST char *to, _CONST char *from) { iconv_ucs_conversion_t *uc; @@ -124,7 +124,7 @@ error: static size_t _DEFUN(ucs_based_conversion_close, (rptr, data), - struct _reent *rptr _AND + struct _reent *rptr, _VOID_PTR data) { iconv_ucs_conversion_t *uc; @@ -146,12 +146,12 @@ _DEFUN(ucs_based_conversion_close, (rptr, data), static size_t _DEFUN(ucs_based_conversion_convert, (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft, flags), - struct _reent *rptr _AND - _VOID_PTR data _AND - _CONST unsigned char **inbuf _AND - size_t *inbytesleft _AND - unsigned char **outbuf _AND - size_t *outbytesleft _AND + struct _reent *rptr, + _VOID_PTR data, + _CONST unsigned char **inbuf, + size_t *inbytesleft, + unsigned char **outbuf, + size_t *outbytesleft, int flags) { unsigned char outbuf1[ICONV_MB_LEN_MAX]; @@ -239,7 +239,7 @@ _DEFUN(ucs_based_conversion_convert, static int _DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), - _VOID_PTR data _AND + _VOID_PTR data, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -253,8 +253,8 @@ _DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), static _VOID _DEFUN(ucs_based_conversion_get_state, (data, state, direction), - _VOID_PTR data _AND - mbstate_t *state _AND + _VOID_PTR data, + mbstate_t *state, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -281,8 +281,8 @@ _DEFUN(ucs_based_conversion_get_state, (data, state, direction), static int _DEFUN(ucs_based_conversion_set_state, (data, state, direction), - _VOID_PTR data _AND - mbstate_t *state _AND + _VOID_PTR data, + mbstate_t *state, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -303,7 +303,7 @@ _DEFUN(ucs_based_conversion_set_state, (data, state, direction), static int _DEFUN(ucs_based_conversion_is_stateful, (data, direction), - _VOID_PTR data _AND + _VOID_PTR data, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -343,7 +343,7 @@ _iconv_ucs_conversion_handlers = static int _DEFUN(find_encoding_name, (searchee, names), - _CONST char *searchee _AND + _CONST char *searchee, _CONST char **names) { _CONST char *p; diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 5fb990700..fc832fc40 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -48,7 +48,6 @@ #ifdef _HAVE_STDC #define _PTR void * -#define _AND , #define _NOARGS void #define _CONST const #define _VOLATILE volatile @@ -77,7 +76,6 @@ #endif #else #define _PTR char * -#define _AND ; #define _NOARGS #define _CONST #define _VOLATILE diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 073189a29..87cb04b35 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -290,8 +290,8 @@ static char *currentlocale (void); char * _DEFUN(_setlocale_r, (p, category, locale), - struct _reent *p _AND - int category _AND + struct _reent *p, + int category, _CONST char *locale) { #ifndef _MB_CAPABLE @@ -991,7 +991,7 @@ __locale_ctype_ptr (void) char * _DEFUN (setlocale, (category, locale), - int category _AND + int category, _CONST char *locale) { return _setlocale_r (_REENT, category, locale); diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c index fc7dc2143..a2751af85 100644 --- a/newlib/libc/machine/microblaze/strcmp.c +++ b/newlib/libc/machine/microblaze/strcmp.c @@ -82,7 +82,7 @@ QUICKREF int _DEFUN (strcmp, (s1, s2), - _CONST char *s1 _AND + _CONST char *s1, _CONST char *s2) { diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c index 44ba382c7..e0e1d7760 100644 --- a/newlib/libc/machine/microblaze/strcpy.c +++ b/newlib/libc/machine/microblaze/strcpy.c @@ -82,7 +82,7 @@ QUICKREF char* _DEFUN (strcpy, (dst0, src0), - char *__restrict dst0 _AND + char *__restrict dst0, _CONST char *__restrict src0) { diff --git a/newlib/libc/machine/powerpc/atosfix16.c b/newlib/libc/machine/powerpc/atosfix16.c index 30379c579..5115c85e2 100644 --- a/newlib/libc/machine/powerpc/atosfix16.c +++ b/newlib/libc/machine/powerpc/atosfix16.c @@ -63,7 +63,7 @@ PORTABILITY __int16_t _DEFUN (_atosfix16_r, (reent, s), - struct _reent *reent _AND + struct _reent *reent, _CONST char *s) { return _strtosfix16_r (reent, s, NULL); diff --git a/newlib/libc/machine/powerpc/atosfix32.c b/newlib/libc/machine/powerpc/atosfix32.c index dbcac7e2f..49f4cce20 100644 --- a/newlib/libc/machine/powerpc/atosfix32.c +++ b/newlib/libc/machine/powerpc/atosfix32.c @@ -9,7 +9,7 @@ __int32_t _DEFUN (_atosfix32_r, (reent, s), - struct _reent *reent _AND + struct _reent *reent, _CONST char *s) { return _strtosfix32_r (reent, s, NULL); diff --git a/newlib/libc/machine/powerpc/atosfix64.c b/newlib/libc/machine/powerpc/atosfix64.c index 109baf7b6..b433778e7 100644 --- a/newlib/libc/machine/powerpc/atosfix64.c +++ b/newlib/libc/machine/powerpc/atosfix64.c @@ -9,7 +9,7 @@ __int64_t _DEFUN (_atosfix64_r, (reent, s), - struct _reent *reent _AND + struct _reent *reent, _CONST char *s) { return _strtosfix64_r (reent, s, NULL); diff --git a/newlib/libc/machine/powerpc/atoufix16.c b/newlib/libc/machine/powerpc/atoufix16.c index 45d130fac..5148acb7d 100644 --- a/newlib/libc/machine/powerpc/atoufix16.c +++ b/newlib/libc/machine/powerpc/atoufix16.c @@ -63,7 +63,7 @@ PORTABILITY __uint16_t _DEFUN (_atoufix16_r, (reent, s), - struct _reent *reent _AND + struct _reent *reent, _CONST char *s) { return _strtoufix16_r (reent, s, NULL); diff --git a/newlib/libc/machine/powerpc/atoufix32.c b/newlib/libc/machine/powerpc/atoufix32.c index ee29ac586..01919d406 100644 --- a/newlib/libc/machine/powerpc/atoufix32.c +++ b/newlib/libc/machine/powerpc/atoufix32.c @@ -9,7 +9,7 @@ __uint32_t _DEFUN (_atoufix32_r, (reent, s), - struct _reent *reent _AND + struct _reent *reent, _CONST char *s) { return _strtoufix32_r (reent, s, NULL); diff --git a/newlib/libc/machine/powerpc/atoufix64.c b/newlib/libc/machine/powerpc/atoufix64.c index e5eefc423..af71089a6 100644 --- a/newlib/libc/machine/powerpc/atoufix64.c +++ b/newlib/libc/machine/powerpc/atoufix64.c @@ -9,7 +9,7 @@ __uint64_t _DEFUN (_atoufix64_r, (reent, s), - struct _reent *reent _AND + struct _reent *reent, _CONST char *s) { return _strtoufix64_r (reent, s, NULL); diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c index e39887dc1..84e1171b9 100644 --- a/newlib/libc/machine/powerpc/strtosfix16.c +++ b/newlib/libc/machine/powerpc/strtosfix16.c @@ -93,8 +93,8 @@ PORTABILITY */ __int16_t _DEFUN (_strtosfix16_r, (rptr, nptr, endptr), - struct _reent *rptr _AND - _CONST char *nptr _AND + struct _reent *rptr, + _CONST char *nptr, char **endptr) { union double_union dbl; @@ -170,7 +170,7 @@ _DEFUN (_strtosfix16_r, (rptr, nptr, endptr), __int16_t _DEFUN (strtosfix16, (s, ptr, base), - _CONST char *s _AND + _CONST char *s, char **ptr) { return _strtosfix16_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtosfix32.c b/newlib/libc/machine/powerpc/strtosfix32.c index 2e22c1458..1b1487b1a 100644 --- a/newlib/libc/machine/powerpc/strtosfix32.c +++ b/newlib/libc/machine/powerpc/strtosfix32.c @@ -14,8 +14,8 @@ */ __int32_t _DEFUN (_strtosfix32_r, (rptr, nptr, endptr), - struct _reent *rptr _AND - _CONST char *nptr _AND + struct _reent *rptr, + _CONST char *nptr, char **endptr) { union double_union dbl; @@ -93,7 +93,7 @@ _DEFUN (_strtosfix32_r, (rptr, nptr, endptr), __int32_t _DEFUN (strtosfix32, (s, ptr, base), - _CONST char *s _AND + _CONST char *s, char **ptr) { return _strtosfix32_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtosfix64.c b/newlib/libc/machine/powerpc/strtosfix64.c index 3006632a4..4ba718c03 100644 --- a/newlib/libc/machine/powerpc/strtosfix64.c +++ b/newlib/libc/machine/powerpc/strtosfix64.c @@ -14,8 +14,8 @@ */ __int64_t _DEFUN (_strtosfix64_r, (rptr, nptr, endptr), - struct _reent *rptr _AND - _CONST char *nptr _AND + struct _reent *rptr, + _CONST char *nptr, char **endptr) { union long_double_union ldbl; @@ -106,7 +106,7 @@ _DEFUN (_strtosfix64_r, (rptr, nptr, endptr), __int64_t _DEFUN (strtosfix64, (s, ptr, base), - _CONST char *s _AND + _CONST char *s, char **ptr) { return _strtosfix64_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c index 3bf2d6b29..22de506e3 100644 --- a/newlib/libc/machine/powerpc/strtoufix16.c +++ b/newlib/libc/machine/powerpc/strtoufix16.c @@ -92,8 +92,8 @@ PORTABILITY */ __uint16_t _DEFUN (_strtoufix16_r, (rptr, nptr, endptr), - struct _reent *rptr _AND - _CONST char *nptr _AND + struct _reent *rptr, + _CONST char *nptr, char **endptr) { union double_union dbl; @@ -161,7 +161,7 @@ _DEFUN (_strtoufix16_r, (rptr, nptr, endptr), __uint16_t _DEFUN (strtoufix16, (s, ptr, base), - _CONST char *s _AND + _CONST char *s, char **ptr) { return _strtoufix16_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix32.c b/newlib/libc/machine/powerpc/strtoufix32.c index 6a8e0812f..05e96675f 100644 --- a/newlib/libc/machine/powerpc/strtoufix32.c +++ b/newlib/libc/machine/powerpc/strtoufix32.c @@ -14,8 +14,8 @@ */ __uint32_t _DEFUN (_strtoufix32_r, (rptr, nptr, endptr), - struct _reent *rptr _AND - _CONST char *nptr _AND + struct _reent *rptr, + _CONST char *nptr, char **endptr) { union double_union dbl; @@ -90,7 +90,7 @@ _DEFUN (_strtoufix32_r, (rptr, nptr, endptr), __uint32_t _DEFUN (strtoufix32, (s, ptr, base), - _CONST char *s _AND + _CONST char *s, char **ptr) { return _strtoufix32_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix64.c b/newlib/libc/machine/powerpc/strtoufix64.c index 539f953a4..5ef53846f 100644 --- a/newlib/libc/machine/powerpc/strtoufix64.c +++ b/newlib/libc/machine/powerpc/strtoufix64.c @@ -14,8 +14,8 @@ */ __uint64_t _DEFUN (_strtoufix64_r, (rptr, nptr, endptr), - struct _reent *rptr _AND - _CONST char *nptr _AND + struct _reent *rptr, + _CONST char *nptr, char **endptr) { union long_double_union ldbl; @@ -105,7 +105,7 @@ _DEFUN (_strtoufix64_r, (rptr, nptr, endptr), __uint64_t _DEFUN (strtoufix64, (s, ptr, base), - _CONST char *s _AND + _CONST char *s, char **ptr) { return _strtoufix64_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/ufix64toa.c b/newlib/libc/machine/powerpc/ufix64toa.c index 450e0a352..125ab67fa 100644 --- a/newlib/libc/machine/powerpc/ufix64toa.c +++ b/newlib/libc/machine/powerpc/ufix64toa.c @@ -26,12 +26,12 @@ extern char *_simdldtoa_r _PARAMS((struct _reent *, LONG_DOUBLE_UNION *, int, char * _DEFUN (_ufix64toa_r, (rptr, value, mode, ndigits, decpt, sign, rve), - struct _reent *rptr _AND - __uint64_t value _AND - int mode _AND - int ndigits _AND - int *decpt _AND - int *sign _AND + struct _reent *rptr, + __uint64_t value, + int mode, + int ndigits, + int *decpt, + int *sign, char **rve) { union long_double_union ldbl; diff --git a/newlib/libc/machine/powerpc/vec_calloc.c b/newlib/libc/machine/powerpc/vec_calloc.c index 8b2e835f0..8a10507d3 100644 --- a/newlib/libc/machine/powerpc/vec_calloc.c +++ b/newlib/libc/machine/powerpc/vec_calloc.c @@ -45,7 +45,7 @@ Supporting OS subroutines required: <>, <>, <>, _PTR _DEFUN (vec_calloc, (n, size), - size_t n _AND + size_t n, size_t size) { return _vec_calloc_r (_REENT, n, size); diff --git a/newlib/libc/machine/powerpc/vec_realloc.c b/newlib/libc/machine/powerpc/vec_realloc.c index e192e399d..7e857b55a 100644 --- a/newlib/libc/machine/powerpc/vec_realloc.c +++ b/newlib/libc/machine/powerpc/vec_realloc.c @@ -8,7 +8,7 @@ _PTR _DEFUN (vec_realloc, (ap, nbytes), - _PTR ap _AND + _PTR ap, size_t nbytes) { return _vec_realloc_r (_REENT, ap, nbytes); diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c index e0b90fcde..0c1c80e1a 100644 --- a/newlib/libc/machine/powerpc/vfprintf.c +++ b/newlib/libc/machine/powerpc/vfprintf.c @@ -272,8 +272,8 @@ static char *cvt_ufix64 _PARAMS((struct _reent *, unsigned long long, int, int int _DEFUN (VFPRINTF, (fp, fmt0, ap), - FILE * fp _AND - _CONST char *fmt0 _AND + FILE * fp, + _CONST char *fmt0, va_list ap) { CHECK_INIT (_REENT, fp); @@ -282,9 +282,9 @@ _DEFUN (VFPRINTF, (fp, fmt0, ap), int _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data _AND - FILE * fp _AND - _CONST char *fmt0 _AND + struct _reent *data, + FILE * fp, + _CONST char *fmt0, va_list ap) { register char *fmt; /* format string */ diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index 6cbc624de..b82a14088 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -183,8 +183,8 @@ typedef union int _DEFUN (vfscanf, (fp, fmt, ap), - register FILE *__restrict fp _AND - _CONST char *__restrict fmt _AND + register FILE *__restrict fp, + _CONST char *__restrict fmt, va_list ap) { CHECK_INIT(_REENT, fp); @@ -204,9 +204,9 @@ __svfscanf (fp, fmt0, ap) int _DEFUN (_vfscanf_r, (data, fp, fmt, ap), - struct _reent *data _AND - register FILE *__restrict fp _AND - _CONST char *__restrict fmt _AND + struct _reent *data, + register FILE *__restrict fp, + _CONST char *__restrict fmt, va_list ap) { return __svfscanf_r (data, fp, fmt, ap); diff --git a/newlib/libc/machine/spu/assert.c b/newlib/libc/machine/spu/assert.c index f1dd33047..e8028459c 100644 --- a/newlib/libc/machine/spu/assert.c +++ b/newlib/libc/machine/spu/assert.c @@ -11,9 +11,9 @@ /* func can be NULL, in which case no function information is given. */ void _DEFUN (__assert_func, (file, line, func, failedexpr), - const char *file _AND - int line _AND - const char *func _AND + const char *file, + int line, + const char *func, const char *failedexpr) { fprintf(stderr, @@ -32,8 +32,8 @@ _DEFUN (__assert_func, (file, line, func, failedexpr), void _DEFUN (__assert, (file, line, failedexpr), - const char *file _AND - int line _AND + const char *file, + int line, const char *failedexpr) { __assert_func (file, line, NULL, failedexpr); diff --git a/newlib/libc/machine/spu/creat.c b/newlib/libc/machine/spu/creat.c index 3cd714306..0e271c1a7 100644 --- a/newlib/libc/machine/spu/creat.c +++ b/newlib/libc/machine/spu/creat.c @@ -8,7 +8,7 @@ int _DEFUN(creat, (path, mode), - const char *path _AND + const char *path, mode_t mode) { return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode); diff --git a/newlib/libc/machine/spu/fdopen.c b/newlib/libc/machine/spu/fdopen.c index a795db8b5..b09ffad16 100644 --- a/newlib/libc/machine/spu/fdopen.c +++ b/newlib/libc/machine/spu/fdopen.c @@ -35,7 +35,7 @@ POSSIBILITY OF SUCH DAMAGE. /* Just a stub for now. */ FILE * _DEFUN (fdopen, (fd, mode), - int fd _AND + int fd, _CONST char *mode) { errno = ENOSYS; diff --git a/newlib/libc/machine/spu/fgetpos.c b/newlib/libc/machine/spu/fgetpos.c index 694400e48..bb7d780ea 100644 --- a/newlib/libc/machine/spu/fgetpos.c +++ b/newlib/libc/machine/spu/fgetpos.c @@ -45,7 +45,7 @@ typedef struct int _DEFUN (fgetpos, (fp, pos), - FILE *__restrict fp _AND + FILE *__restrict fp, _fpos_t *__restrict pos) { c99_fgetpos_t arg; diff --git a/newlib/libc/machine/spu/fgets.c b/newlib/libc/machine/spu/fgets.c index 2b0ca417e..8f2a9785f 100644 --- a/newlib/libc/machine/spu/fgets.c +++ b/newlib/libc/machine/spu/fgets.c @@ -47,8 +47,8 @@ typedef struct char * _DEFUN (fgets, (buf, n, fp), - char *__restrict buf _AND - int n _AND + char *__restrict buf, + int n, FILE *__restrict fp) { c99_fgets_t args; diff --git a/newlib/libc/machine/spu/fopen.c b/newlib/libc/machine/spu/fopen.c index 821d7c201..c41d33510 100644 --- a/newlib/libc/machine/spu/fopen.c +++ b/newlib/libc/machine/spu/fopen.c @@ -46,7 +46,7 @@ typedef struct #ifndef _REENT_ONLY FILE * _DEFUN (fopen, (file, mode), - _CONST char *__restrict file _AND + _CONST char *__restrict file, _CONST char *__restrict mode) { int ret; diff --git a/newlib/libc/machine/spu/fputs.c b/newlib/libc/machine/spu/fputs.c index 9ed796894..8cf84bb6e 100644 --- a/newlib/libc/machine/spu/fputs.c +++ b/newlib/libc/machine/spu/fputs.c @@ -47,7 +47,7 @@ typedef struct int _DEFUN (fputs, (s, fp), - char _CONST *__restrict s _AND + char _CONST *__restrict s, FILE *__restrict fp) { c99_fputs_t args; diff --git a/newlib/libc/machine/spu/fread.c b/newlib/libc/machine/spu/fread.c index eb3966c19..3ea24cc4a 100644 --- a/newlib/libc/machine/spu/fread.c +++ b/newlib/libc/machine/spu/fread.c @@ -50,9 +50,9 @@ typedef struct size_t _DEFUN (fread, (buf, size, count, fp), - _PTR __restrict buf _AND - size_t size _AND - size_t count _AND + _PTR __restrict buf, + size_t size, + size_t count, FILE *__restrict fp) { c99_fread_t args; diff --git a/newlib/libc/machine/spu/freopen.c b/newlib/libc/machine/spu/freopen.c index 53dd2bc1d..7c52abef3 100644 --- a/newlib/libc/machine/spu/freopen.c +++ b/newlib/libc/machine/spu/freopen.c @@ -48,8 +48,8 @@ typedef struct FILE * _DEFUN (freopen, (file, mode, fp), - const char *__restrict file _AND - const char *__restrict mode _AND + const char *__restrict file, + const char *__restrict mode, FILE *__restrict fp) { int ret; diff --git a/newlib/libc/machine/spu/fseek.c b/newlib/libc/machine/spu/fseek.c index dc7453325..136d5c639 100644 --- a/newlib/libc/machine/spu/fseek.c +++ b/newlib/libc/machine/spu/fseek.c @@ -48,8 +48,8 @@ typedef struct int _DEFUN (fseek, (fp, offset, whence), - register FILE *fp _AND - long offset _AND + register FILE *fp, + long offset, int whence) { c99_fseek_t args; diff --git a/newlib/libc/machine/spu/fsetpos.c b/newlib/libc/machine/spu/fsetpos.c index 3bd0dde3d..1ebbb8f63 100644 --- a/newlib/libc/machine/spu/fsetpos.c +++ b/newlib/libc/machine/spu/fsetpos.c @@ -46,7 +46,7 @@ typedef struct int _DEFUN (fsetpos, (iop, pos), - FILE * iop _AND + FILE * iop, _CONST _fpos_t * pos) { c99_fsetpos_t args; diff --git a/newlib/libc/machine/spu/fwrite.c b/newlib/libc/machine/spu/fwrite.c index 58aab9f0a..6de571069 100644 --- a/newlib/libc/machine/spu/fwrite.c +++ b/newlib/libc/machine/spu/fwrite.c @@ -50,9 +50,9 @@ typedef struct size_t _DEFUN (fwrite, (buf, size, count, fp), - _CONST _PTR __restrict buf _AND - size_t size _AND - size_t count _AND + _CONST _PTR __restrict buf, + size_t size, + size_t count, FILE * fp) { c99_fwrite_t args; diff --git a/newlib/libc/machine/spu/setbuf.c b/newlib/libc/machine/spu/setbuf.c index 84430fc73..c942bb9a9 100644 --- a/newlib/libc/machine/spu/setbuf.c +++ b/newlib/libc/machine/spu/setbuf.c @@ -47,7 +47,7 @@ typedef struct void _DEFUN (setbuf, (fp, buf), - FILE *__restrict fp _AND + FILE *__restrict fp, char *__restrict buf) { c99_setbuf_t args; diff --git a/newlib/libc/machine/spu/setvbuf.c b/newlib/libc/machine/spu/setvbuf.c index 32da292f9..a045cc37b 100644 --- a/newlib/libc/machine/spu/setvbuf.c +++ b/newlib/libc/machine/spu/setvbuf.c @@ -51,9 +51,9 @@ typedef struct int _DEFUN (setvbuf, (fp, buf, mode, size), - FILE * fp _AND - char *buf _AND - int mode _AND + FILE * fp, + char *buf, + int mode, size_t size) { c99_setvbuf_t args; diff --git a/newlib/libc/machine/spu/vfprintf.c b/newlib/libc/machine/spu/vfprintf.c index 128d0b3eb..e5ef2fa9f 100644 --- a/newlib/libc/machine/spu/vfprintf.c +++ b/newlib/libc/machine/spu/vfprintf.c @@ -58,8 +58,8 @@ typedef struct int _DEFUN (vfprintf, (fp, fmt0, ap), - FILE *__restrict fp _AND - _CONST char *__restrict fmt0 _AND + FILE *__restrict fp, + _CONST char *__restrict fmt0, va_list ap) { c99_vfprintf_t args; diff --git a/newlib/libc/machine/spu/vfscanf.c b/newlib/libc/machine/spu/vfscanf.c index 0f728969f..a497b7ba3 100644 --- a/newlib/libc/machine/spu/vfscanf.c +++ b/newlib/libc/machine/spu/vfscanf.c @@ -58,8 +58,8 @@ typedef struct int _DEFUN (vfscanf, (fp, fmt, ap), - FILE *__restrict fp _AND - _CONST char *__restrict fmt _AND + FILE *__restrict fp, + _CONST char *__restrict fmt, va_list ap) { c99_vfscanf_t args; diff --git a/newlib/libc/machine/spu/vprintf.c b/newlib/libc/machine/spu/vprintf.c index 32b86d8f2..35b12dfb5 100644 --- a/newlib/libc/machine/spu/vprintf.c +++ b/newlib/libc/machine/spu/vprintf.c @@ -24,7 +24,7 @@ typedef struct int _DEFUN (vprintf, (fmt, ap), - _CONST char *fmt _AND + _CONST char *fmt, va_list ap) { c99_vprintf_t args; diff --git a/newlib/libc/machine/spu/vscanf.c b/newlib/libc/machine/spu/vscanf.c index 4f68bfefd..29b4948dd 100644 --- a/newlib/libc/machine/spu/vscanf.c +++ b/newlib/libc/machine/spu/vscanf.c @@ -56,7 +56,7 @@ typedef struct int _DEFUN (vscanf, (fmt, ap), - _CONST char *fmt _AND + _CONST char *fmt, va_list ap) { c99_vscanf_t args; diff --git a/newlib/libc/machine/spu/vsnprintf.c b/newlib/libc/machine/spu/vsnprintf.c index cf4f5e709..f952b84c1 100644 --- a/newlib/libc/machine/spu/vsnprintf.c +++ b/newlib/libc/machine/spu/vsnprintf.c @@ -28,9 +28,9 @@ typedef struct int _DEFUN (vsnprintf, (str, size, fmt, ap), - char *__restrict str _AND - size_t size _AND - _CONST char *__restrict fmt _AND + char *__restrict str, + size_t size, + _CONST char *__restrict fmt, va_list ap) { c99_vsnprintf_t args; diff --git a/newlib/libc/machine/spu/vsprintf.c b/newlib/libc/machine/spu/vsprintf.c index 0719d38f5..1a44de479 100644 --- a/newlib/libc/machine/spu/vsprintf.c +++ b/newlib/libc/machine/spu/vsprintf.c @@ -27,8 +27,8 @@ typedef struct int _DEFUN (vsprintf, (str, fmt, ap), - char *__restrict str _AND - _CONST char *__restrict fmt _AND + char *__restrict str, + _CONST char *__restrict fmt, va_list ap) { c99_vsprintf_t args; diff --git a/newlib/libc/machine/spu/vsscanf.c b/newlib/libc/machine/spu/vsscanf.c index 2f7380ff4..38ee1f4b9 100644 --- a/newlib/libc/machine/spu/vsscanf.c +++ b/newlib/libc/machine/spu/vsscanf.c @@ -58,8 +58,8 @@ typedef struct int _DEFUN (vsscanf, (str, fmt, ap), - _CONST char *__restrict str _AND - _CONST char *__restrict fmt _AND + _CONST char *__restrict str, + _CONST char *__restrict fmt, va_list ap) { c99_vsscanf_t args; diff --git a/newlib/libc/misc/__dprintf.c b/newlib/libc/misc/__dprintf.c index eba45eaaa..6026d195c 100644 --- a/newlib/libc/misc/__dprintf.c +++ b/newlib/libc/misc/__dprintf.c @@ -178,8 +178,8 @@ parse_number (s, p) static long _DEFUN(get_number, (s, size, unsigned_p), - char *s _AND - long size _AND + char *s, + long size, int unsigned_p) { long x; @@ -221,8 +221,8 @@ _DEFUN(get_number, (s, size, unsigned_p), static void _DEFUN(print_number, (base, unsigned_p, n), - int base _AND - int unsigned_p _AND + int base, + int unsigned_p, long n) { static char chars[16] = "0123456789abcdef"; diff --git a/newlib/libc/posix/creat.c b/newlib/libc/posix/creat.c index b8a4f9a14..116f26ce3 100644 --- a/newlib/libc/posix/creat.c +++ b/newlib/libc/posix/creat.c @@ -6,7 +6,7 @@ int _DEFUN(creat, (path, mode), - const char *path _AND + const char *path, mode_t mode) { return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode); diff --git a/newlib/libc/posix/execl.c b/newlib/libc/posix/execl.c index ebb97fb9b..beb48c6ae 100644 --- a/newlib/libc/posix/execl.c +++ b/newlib/libc/posix/execl.c @@ -19,7 +19,7 @@ static char ***p_environ = &environ; int _DEFUN(execl, (path, arg0, ...), - _CONST char *path _AND + _CONST char *path, _CONST char *arg0 _DOTS) #else @@ -28,8 +28,8 @@ _DEFUN(execl, (path, arg0, ...), int _DEFUN(execl, (path, arg0, va_alist), - _CONST char *path _AND - _CONST char *arg0 _AND + _CONST char *path, + _CONST char *arg0, va_dcl) #endif diff --git a/newlib/libc/posix/execle.c b/newlib/libc/posix/execle.c index 2b22036a1..f4c759250 100644 --- a/newlib/libc/posix/execle.c +++ b/newlib/libc/posix/execle.c @@ -14,7 +14,7 @@ int _DEFUN(execle, (path, arg0, ...), - _CONST char *path _AND + _CONST char *path, _CONST char *arg0 _DOTS) #else @@ -23,8 +23,8 @@ _DEFUN(execle, (path, arg0, ...), int _DEFUN(execle, (path, arg0, va_alist), - _CONST char *path _AND - _CONST char *arg0 _AND + _CONST char *path, + _CONST char *arg0, va_dcl) #endif diff --git a/newlib/libc/posix/execlp.c b/newlib/libc/posix/execlp.c index 6212da629..6731bb905 100644 --- a/newlib/libc/posix/execlp.c +++ b/newlib/libc/posix/execlp.c @@ -14,7 +14,7 @@ int _DEFUN(execlp, (path, arg0, ...), - _CONST char *path _AND + _CONST char *path, _CONST char *arg0 _DOTS) #else @@ -23,8 +23,8 @@ _DEFUN(execlp, (path, arg0, ...), int _DEFUN(execlp, (path, arg0, va_alist), - _CONST char *path _AND - _CONST char *arg0 _AND + _CONST char *path, + _CONST char *arg0, va_dcl) #endif diff --git a/newlib/libc/posix/execv.c b/newlib/libc/posix/execv.c index 8793e2ec4..049a5381d 100644 --- a/newlib/libc/posix/execv.c +++ b/newlib/libc/posix/execv.c @@ -15,7 +15,7 @@ static char ***p_environ = &environ; int _DEFUN (execv, (path, argv), - const char *path _AND + const char *path, char * const argv[]) { return _execve (path, (char * _CONST *) argv, *p_environ); diff --git a/newlib/libc/posix/execve.c b/newlib/libc/posix/execve.c index d1355133a..c2a2144f5 100644 --- a/newlib/libc/posix/execve.c +++ b/newlib/libc/posix/execve.c @@ -11,8 +11,8 @@ int _DEFUN(execve, (path, argv, envp), - const char *path _AND - char * const argv[] _AND + const char *path, + char * const argv[], char * const envp[]) { return _execve (path, argv, envp); diff --git a/newlib/libc/posix/execvp.c b/newlib/libc/posix/execvp.c index 64310f661..db7e03456 100644 --- a/newlib/libc/posix/execvp.c +++ b/newlib/libc/posix/execvp.c @@ -22,8 +22,8 @@ static char * _DEFUN (strccpy, (s1, s2, c), - char *s1 _AND - char *s2 _AND + char *s1, + char *s2, char c) { char *dest = s1; @@ -37,7 +37,7 @@ _DEFUN (strccpy, (s1, s2, c), int _DEFUN (execvp, (file, argv), - _CONST char *file _AND + _CONST char *file, char * _CONST argv[]) { char *path = getenv ("PATH"); diff --git a/newlib/libc/posix/popen.c b/newlib/libc/posix/popen.c index f9abfac3f..bbd0fc424 100644 --- a/newlib/libc/posix/popen.c +++ b/newlib/libc/posix/popen.c @@ -110,7 +110,7 @@ static struct pid { FILE * _DEFUN(popen, (program, type), - const char *program _AND + const char *program, const char *type) { struct pid *cur; diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c index 61d36304d..8e54de7fa 100644 --- a/newlib/libc/posix/posix_spawn.c +++ b/newlib/libc/posix/posix_spawn.c @@ -295,11 +295,11 @@ do_posix_spawn(pid_t *pid, _CONST char *path, int _DEFUN(posix_spawn, (pid, path, fa, sa, argv, envp), - pid_t *pid _AND - _CONST char *path _AND - _CONST posix_spawn_file_actions_t *fa _AND - _CONST posix_spawnattr_t *sa _AND - char * _CONST argv[] _AND + pid_t *pid, + _CONST char *path, + _CONST posix_spawn_file_actions_t *fa, + _CONST posix_spawnattr_t *sa, + char * _CONST argv[], char * _CONST envp[]) { return do_posix_spawn(pid, path, fa, sa, argv, envp, 0); @@ -307,11 +307,11 @@ _DEFUN(posix_spawn, (pid, path, fa, sa, argv, envp), int _DEFUN(posix_spawnp, (pid, path, fa, sa, argv, envp), - pid_t *pid _AND - _CONST char *path _AND - _CONST posix_spawn_file_actions_t *fa _AND - _CONST posix_spawnattr_t *sa _AND - char * _CONST argv[] _AND + pid_t *pid, + _CONST char *path, + _CONST posix_spawn_file_actions_t *fa, + _CONST posix_spawnattr_t *sa, + char * _CONST argv[], char * _CONST envp[]) { return do_posix_spawn(pid, path, fa, sa, argv, envp, 1); @@ -358,10 +358,10 @@ _DEFUN(posix_spawn_file_actions_destroy, (fa), int _DEFUN(posix_spawn_file_actions_addopen, (fa, fildes, path, oflag, mode), - posix_spawn_file_actions_t * __restrict fa _AND - int fildes _AND - _CONST char * __restrict path _AND - int oflag _AND + posix_spawn_file_actions_t * __restrict fa, + int fildes, + _CONST char * __restrict path, + int oflag, mode_t mode) { posix_spawn_file_actions_entry_t *fae; @@ -393,8 +393,8 @@ _DEFUN(posix_spawn_file_actions_addopen, (fa, fildes, path, oflag, mode), int _DEFUN(posix_spawn_file_actions_adddup2, (fa, fildes, newfildes), - posix_spawn_file_actions_t *fa _AND - int fildes _AND + posix_spawn_file_actions_t *fa, + int fildes, int newfildes) { posix_spawn_file_actions_entry_t *fae; @@ -418,7 +418,7 @@ _DEFUN(posix_spawn_file_actions_adddup2, (fa, fildes, newfildes), int _DEFUN(posix_spawn_file_actions_addclose, (fa, fildes), - posix_spawn_file_actions_t *fa _AND + posix_spawn_file_actions_t *fa, int fildes) { posix_spawn_file_actions_entry_t *fae; @@ -468,7 +468,7 @@ _DEFUN(posix_spawnattr_destroy, (sa), int _DEFUN(posix_spawnattr_getflags, (sa, flags), - _CONST posix_spawnattr_t * __restrict sa _AND + _CONST posix_spawnattr_t * __restrict sa, short * __restrict flags) { *flags = (*sa)->sa_flags; @@ -477,7 +477,7 @@ _DEFUN(posix_spawnattr_getflags, (sa, flags), int _DEFUN(posix_spawnattr_getpgroup, (sa, pgroup), - _CONST posix_spawnattr_t * __restrict sa _AND + _CONST posix_spawnattr_t * __restrict sa, pid_t * __restrict pgroup) { *pgroup = (*sa)->sa_pgroup; @@ -486,7 +486,7 @@ _DEFUN(posix_spawnattr_getpgroup, (sa, pgroup), int _DEFUN(posix_spawnattr_getschedparam, (sa, schedparam), - _CONST posix_spawnattr_t * __restrict sa _AND + _CONST posix_spawnattr_t * __restrict sa, struct sched_param * __restrict schedparam) { *schedparam = (*sa)->sa_schedparam; @@ -495,7 +495,7 @@ _DEFUN(posix_spawnattr_getschedparam, (sa, schedparam), int _DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy), - _CONST posix_spawnattr_t * __restrict sa _AND + _CONST posix_spawnattr_t * __restrict sa, int * __restrict schedpolicy) { *schedpolicy = (*sa)->sa_schedpolicy; @@ -504,7 +504,7 @@ _DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy), int _DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault), - _CONST posix_spawnattr_t * __restrict sa _AND + _CONST posix_spawnattr_t * __restrict sa, sigset_t * __restrict sigdefault) { *sigdefault = (*sa)->sa_sigdefault; @@ -513,7 +513,7 @@ _DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault), int _DEFUN(posix_spawnattr_getsigmask, (sa, sigmask), - _CONST posix_spawnattr_t * __restrict sa _AND + _CONST posix_spawnattr_t * __restrict sa, sigset_t * __restrict sigmask) { *sigmask = (*sa)->sa_sigmask; @@ -522,7 +522,7 @@ _DEFUN(posix_spawnattr_getsigmask, (sa, sigmask), int _DEFUN(posix_spawnattr_setflags, (sa, flags), - posix_spawnattr_t *sa _AND + posix_spawnattr_t *sa, short flags) { (*sa)->sa_flags = flags; @@ -531,7 +531,7 @@ _DEFUN(posix_spawnattr_setflags, (sa, flags), int _DEFUN(posix_spawnattr_setpgroup, (sa, pgroup), - posix_spawnattr_t *sa _AND + posix_spawnattr_t *sa, pid_t pgroup) { (*sa)->sa_pgroup = pgroup; @@ -540,7 +540,7 @@ _DEFUN(posix_spawnattr_setpgroup, (sa, pgroup), int _DEFUN(posix_spawnattr_setschedparam, (sa, schedparam), - posix_spawnattr_t * __restrict sa _AND + posix_spawnattr_t * __restrict sa, _CONST struct sched_param * __restrict schedparam) { (*sa)->sa_schedparam = *schedparam; @@ -549,7 +549,7 @@ _DEFUN(posix_spawnattr_setschedparam, (sa, schedparam), int _DEFUN(posix_spawnattr_setschedpolicy, (sa, schedpolicy), - posix_spawnattr_t *sa _AND + posix_spawnattr_t *sa, int schedpolicy) { (*sa)->sa_schedpolicy = schedpolicy; @@ -558,7 +558,7 @@ _DEFUN(posix_spawnattr_setschedpolicy, (sa, schedpolicy), int _DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault), - posix_spawnattr_t * __restrict sa _AND + posix_spawnattr_t * __restrict sa, _CONST sigset_t * __restrict sigdefault) { (*sa)->sa_sigdefault = *sigdefault; @@ -567,7 +567,7 @@ _DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault), int _DEFUN(posix_spawnattr_setsigmask, (sa, sigmask), - posix_spawnattr_t * __restrict sa _AND + posix_spawnattr_t * __restrict sa, _CONST sigset_t * __restrict sigmask) { (*sa)->sa_sigmask = *sigmask; diff --git a/newlib/libc/posix/readdir_r.c b/newlib/libc/posix/readdir_r.c index d13775b87..a75eee9a3 100644 --- a/newlib/libc/posix/readdir_r.c +++ b/newlib/libc/posix/readdir_r.c @@ -51,8 +51,8 @@ extern int getdents (int fd, void *dp, int count); */ int _DEFUN(readdir_r, (dirp, dp, dpp), - register DIR *__restrict dirp _AND - struct dirent *__restrict dp _AND + register DIR *__restrict dirp, + struct dirent *__restrict dp, struct dirent **__restrict dpp) { struct dirent *tmpdp; diff --git a/newlib/libc/posix/scandir.c b/newlib/libc/posix/scandir.c index 8cb8ff82d..0ffe68971 100644 --- a/newlib/libc/posix/scandir.c +++ b/newlib/libc/posix/scandir.c @@ -69,9 +69,9 @@ static char sccsid[] = "@(#)scandir.c 5.10 (Berkeley) 2/23/91"; int _DEFUN(scandir, (dirname, namelist, select, dcomp), - const char *dirname _AND - struct dirent ***namelist _AND - int (*select) __P((const struct dirent *)) _AND + const char *dirname, + struct dirent ***namelist, + int (*select) __P((const struct dirent *)), int (*dcomp) __P((const struct dirent **, const struct dirent **))) { register struct dirent *d, *p, **names; @@ -170,7 +170,7 @@ cleanup: */ int _DEFUN(alphasort, (d1, d2), - const struct dirent **d1 _AND + const struct dirent **d1, const struct dirent **d2) { return(strcmp((*d1)->d_name, (*d2)->d_name)); diff --git a/newlib/libc/posix/seekdir.c b/newlib/libc/posix/seekdir.c index 3965edabf..f876d7075 100644 --- a/newlib/libc/posix/seekdir.c +++ b/newlib/libc/posix/seekdir.c @@ -47,7 +47,7 @@ static char sccsid[] = "@(#)seekdir.c 5.7 (Berkeley) 6/1/90"; */ void _DEFUN(seekdir, (dirp, loc), - DIR *dirp _AND + DIR *dirp, long loc) { #ifdef HAVE_DD_LOCK diff --git a/newlib/libc/posix/telldir.c b/newlib/libc/posix/telldir.c index 959e3b7bb..9c945fcf7 100644 --- a/newlib/libc/posix/telldir.c +++ b/newlib/libc/posix/telldir.c @@ -120,7 +120,7 @@ _DEFUN(telldir, (dirp), */ void _DEFUN(_seekdir, (dirp, loc), - register DIR *dirp _AND + register DIR *dirp, long loc) { register struct ddloc *lp; diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c index 559ca030a..cb78fba76 100644 --- a/newlib/libc/reent/execr.c +++ b/newlib/libc/reent/execr.c @@ -46,9 +46,9 @@ DESCRIPTION int _DEFUN (_execve_r, (ptr, name, argv, env), - struct _reent *ptr _AND - _CONST char *name _AND - char *_CONST argv[] _AND + struct _reent *ptr, + _CONST char *name, + char *_CONST argv[], char *_CONST env[]) { int ret; @@ -114,7 +114,7 @@ DESCRIPTION int _DEFUN (_wait_r, (ptr, status), - struct _reent *ptr _AND + struct _reent *ptr, int *status) { int ret; diff --git a/newlib/libc/reent/fcntlr.c b/newlib/libc/reent/fcntlr.c index 328b9de13..fdfe41090 100644 --- a/newlib/libc/reent/fcntlr.c +++ b/newlib/libc/reent/fcntlr.c @@ -41,9 +41,9 @@ DESCRIPTION int _DEFUN (_fcntl_r, (ptr, fd, cmd, arg), - struct _reent *ptr _AND - int fd _AND - int cmd _AND + struct _reent *ptr, + int fd, + int cmd, int arg) { int ret; diff --git a/newlib/libc/reent/fstat64r.c b/newlib/libc/reent/fstat64r.c index d9fa8b71f..06a89a5c8 100644 --- a/newlib/libc/reent/fstat64r.c +++ b/newlib/libc/reent/fstat64r.c @@ -48,8 +48,8 @@ DESCRIPTION int _DEFUN (_fstat64_r, (ptr, fd, pstat), - struct _reent *ptr _AND - int fd _AND + struct _reent *ptr, + int fd, struct stat64 *pstat) { int ret; diff --git a/newlib/libc/reent/gettimeofdayr.c b/newlib/libc/reent/gettimeofdayr.c index 007dff8da..80942afb0 100644 --- a/newlib/libc/reent/gettimeofdayr.c +++ b/newlib/libc/reent/gettimeofdayr.c @@ -53,8 +53,8 @@ DESCRIPTION int _DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone), - struct _reent *ptr _AND - struct timeval *ptimeval _AND + struct _reent *ptr, + struct timeval *ptimeval, void *ptimezone) { int ret; diff --git a/newlib/libc/reent/linkr.c b/newlib/libc/reent/linkr.c index 8cfdf2f06..59113d26e 100644 --- a/newlib/libc/reent/linkr.c +++ b/newlib/libc/reent/linkr.c @@ -44,8 +44,8 @@ DESCRIPTION int _DEFUN (_link_r, (ptr, old, new), - struct _reent *ptr _AND - _CONST char *old _AND + struct _reent *ptr, + _CONST char *old, _CONST char *new) { int ret; diff --git a/newlib/libc/reent/lseek64r.c b/newlib/libc/reent/lseek64r.c index 1241a27e4..2f16f0bca 100644 --- a/newlib/libc/reent/lseek64r.c +++ b/newlib/libc/reent/lseek64r.c @@ -42,9 +42,9 @@ DESCRIPTION _off64_t _DEFUN (_lseek64_r, (ptr, fd, pos, whence), - struct _reent *ptr _AND - int fd _AND - _off64_t pos _AND + struct _reent *ptr, + int fd, + _off64_t pos, int whence) { _off64_t ret; diff --git a/newlib/libc/reent/lseekr.c b/newlib/libc/reent/lseekr.c index cc73ab467..639158912 100644 --- a/newlib/libc/reent/lseekr.c +++ b/newlib/libc/reent/lseekr.c @@ -39,9 +39,9 @@ DESCRIPTION _off_t _DEFUN (_lseek_r, (ptr, fd, pos, whence), - struct _reent *ptr _AND - int fd _AND - _off_t pos _AND + struct _reent *ptr, + int fd, + _off_t pos, int whence) { _off_t ret; diff --git a/newlib/libc/reent/mkdirr.c b/newlib/libc/reent/mkdirr.c index eee999e19..4c2c94f9c 100644 --- a/newlib/libc/reent/mkdirr.c +++ b/newlib/libc/reent/mkdirr.c @@ -41,8 +41,8 @@ DESCRIPTION int _DEFUN (_mkdir_r, (ptr, path, mode), - struct _reent *ptr _AND - _CONST char *path _AND + struct _reent *ptr, + _CONST char *path, int mode) { int ret; diff --git a/newlib/libc/reent/openr.c b/newlib/libc/reent/openr.c index 06b203b81..f38ff8458 100644 --- a/newlib/libc/reent/openr.c +++ b/newlib/libc/reent/openr.c @@ -40,9 +40,9 @@ DESCRIPTION int _DEFUN (_open_r, (ptr, file, flags, mode), - struct _reent *ptr _AND - _CONST char *file _AND - int flags _AND + struct _reent *ptr, + _CONST char *file, + int flags, int mode) { int ret; diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c index 65e0514cf..edc6fd08b 100644 --- a/newlib/libc/reent/readr.c +++ b/newlib/libc/reent/readr.c @@ -39,9 +39,9 @@ DESCRIPTION _ssize_t _DEFUN (_read_r, (ptr, fd, buf, cnt), - struct _reent *ptr _AND - int fd _AND - _PTR buf _AND + struct _reent *ptr, + int fd, + _PTR buf, size_t cnt) { _ssize_t ret; diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c index b6c2abf02..a98c3110c 100644 --- a/newlib/libc/reent/reent.c +++ b/newlib/libc/reent/reent.c @@ -31,7 +31,7 @@ int errno; void _DEFUN (cleanup_glue, (ptr, glue), - struct _reent *ptr _AND + struct _reent *ptr, struct _glue *glue) { /* Have to reclaim these in reverse order: */ diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c index 9b42dc380..e55c2f291 100644 --- a/newlib/libc/reent/renamer.c +++ b/newlib/libc/reent/renamer.c @@ -41,8 +41,8 @@ DESCRIPTION int _DEFUN (_rename_r, (ptr, old, new), - struct _reent *ptr _AND - _CONST char *old _AND + struct _reent *ptr, + _CONST char *old, _CONST char *new) { int ret = 0; diff --git a/newlib/libc/reent/sbrkr.c b/newlib/libc/reent/sbrkr.c index 4217174b3..0bc4163c1 100644 --- a/newlib/libc/reent/sbrkr.c +++ b/newlib/libc/reent/sbrkr.c @@ -42,7 +42,7 @@ DESCRIPTION void * _DEFUN (_sbrk_r, (ptr, incr), - struct _reent *ptr _AND + struct _reent *ptr, ptrdiff_t incr) { char *ret; diff --git a/newlib/libc/reent/signalr.c b/newlib/libc/reent/signalr.c index 95dd49ed3..9229061d5 100644 --- a/newlib/libc/reent/signalr.c +++ b/newlib/libc/reent/signalr.c @@ -44,8 +44,8 @@ DESCRIPTION int _DEFUN (_kill_r, (ptr, pid, sig), - struct _reent *ptr _AND - int pid _AND + struct _reent *ptr, + int pid, int sig) { int ret; diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c index 1f175e0a9..134ca82ef 100644 --- a/newlib/libc/reent/stat64r.c +++ b/newlib/libc/reent/stat64r.c @@ -46,8 +46,8 @@ DESCRIPTION int _DEFUN (_stat64_r, (ptr, file, pstat), - struct _reent *ptr _AND - _CONST char *file _AND + struct _reent *ptr, + _CONST char *file, struct stat64 *pstat) { int ret; diff --git a/newlib/libc/reent/statr.c b/newlib/libc/reent/statr.c index 3500c88b1..2b271e10f 100644 --- a/newlib/libc/reent/statr.c +++ b/newlib/libc/reent/statr.c @@ -46,8 +46,8 @@ DESCRIPTION int _DEFUN (_stat_r, (ptr, file, pstat), - struct _reent *ptr _AND - _CONST char *file _AND + struct _reent *ptr, + _CONST char *file, struct stat *pstat) { int ret; diff --git a/newlib/libc/reent/timesr.c b/newlib/libc/reent/timesr.c index efb98b61d..dbe6a4ef0 100644 --- a/newlib/libc/reent/timesr.c +++ b/newlib/libc/reent/timesr.c @@ -45,7 +45,7 @@ DESCRIPTION clock_t _DEFUN (_times_r, (ptr, ptms), - struct _reent *ptr _AND + struct _reent *ptr, struct tms *ptms) { clock_t ret; diff --git a/newlib/libc/reent/unlinkr.c b/newlib/libc/reent/unlinkr.c index 53b8f11e3..eb000be15 100644 --- a/newlib/libc/reent/unlinkr.c +++ b/newlib/libc/reent/unlinkr.c @@ -39,7 +39,7 @@ DESCRIPTION int _DEFUN (_unlink_r, (ptr, file), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *file) { int ret; diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index 4190a9059..4e06d74ef 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -39,9 +39,9 @@ DESCRIPTION _ssize_t _DEFUN (_write_r, (ptr, fd, buf, cnt), - struct _reent *ptr _AND - int fd _AND - _CONST _PTR buf _AND + struct _reent *ptr, + int fd, + _CONST _PTR buf, size_t cnt) { _ssize_t ret; diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index 579633c12..c15ea64d2 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -57,10 +57,10 @@ No supporting OS subroutines are required. _PTR _DEFUN (bsearch, (key, base, nmemb, size, compar), - _CONST _PTR key _AND - _CONST _PTR base _AND - size_t nmemb _AND - size_t size _AND + _CONST _PTR key, + _CONST _PTR base, + size_t nmemb, + size_t size, int _EXFNPTR(compar, (const _PTR, const _PTR))) { _PTR current; diff --git a/newlib/libc/search/hash.c b/newlib/libc/search/hash.c index 5fea88a82..f20322c42 100644 --- a/newlib/libc/search/hash.c +++ b/newlib/libc/search/hash.c @@ -105,10 +105,10 @@ int hash_accesses, hash_collisions, hash_expansions, hash_overflows; extern DB * _DEFUN(__hash_open, (file, flags, mode, info, dflags), - const char *file _AND - int flags _AND - int mode _AND - int dflags _AND + const char *file, + int flags, + int mode, + int dflags, const HASHINFO *info) /* Special directives for create */ { HTAB *hashp; diff --git a/newlib/libc/search/hcreate.c b/newlib/libc/search/hcreate.c index b7be1cd6f..800211689 100644 --- a/newlib/libc/search/hcreate.c +++ b/newlib/libc/search/hcreate.c @@ -70,7 +70,7 @@ _DEFUN_VOID (hdestroy) ENTRY * _DEFUN(hsearch, (item, action), - ENTRY item _AND + ENTRY item, ACTION action) { ENTRY *retval; diff --git a/newlib/libc/search/qsort.c b/newlib/libc/search/qsort.c index 9a8e7fabe..e24a62a55 100644 --- a/newlib/libc/search/qsort.c +++ b/newlib/libc/search/qsort.c @@ -101,9 +101,9 @@ static inline void swapfunc _PARAMS((char *, char *, int, int)); static inline void _DEFUN(swapfunc, (a, b, n, swaptype), - char *a _AND - char *b _AND - int n _AND + char *a, + char *b, + int n, int swaptype) { if(swaptype <= 1) @@ -132,10 +132,10 @@ _DEFUN(swapfunc, (a, b, n, swaptype), static inline char * _DEFUN(med3, (a, b, c, cmp, thunk), - char *a _AND - char *b _AND - char *c _AND - cmp_t *cmp _AND + char *a, + char *b, + char *c, + cmp_t *cmp, void *thunk #if !defined(I_AM_QSORT_R) && !defined(I_AM_GNU_QSORT_R) __unused @@ -150,26 +150,26 @@ __unused #if defined(I_AM_QSORT_R) void _DEFUN(__bsd_qsort_r, (a, n, es, thunk, cmp), - void *a _AND - size_t n _AND - size_t es _AND - void *thunk _AND + void *a, + size_t n, + size_t es, + void *thunk, cmp_t *cmp) #elif defined(I_AM_GNU_QSORT_R) void _DEFUN(qsort_r, (a, n, es, cmp, thunk), - void *a _AND - size_t n _AND - size_t es _AND - cmp_t *cmp _AND + void *a, + size_t n, + size_t es, + cmp_t *cmp, void *thunk) #else #define thunk NULL void _DEFUN(qsort, (a, n, es, cmp), - void *a _AND - size_t n _AND - size_t es _AND + void *a, + size_t n, + size_t es, cmp_t *cmp) #endif { diff --git a/newlib/libc/search/tdelete.c b/newlib/libc/search/tdelete.c index b607b5421..a0128e98b 100644 --- a/newlib/libc/search/tdelete.c +++ b/newlib/libc/search/tdelete.c @@ -27,8 +27,8 @@ __RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); /* delete node with given key */ void * _DEFUN(tdelete, (vkey, vrootp, compar), - const void *__restrict vkey _AND /* key to be deleted */ - void **__restrict vrootp _AND /* address of the root of tree */ + const void *__restrict vkey, /* key to be deleted */ + void **__restrict vrootp, /* address of the root of tree */ int (*compar)(const void *, const void *)) { node_t **rootp = (node_t **)vrootp; diff --git a/newlib/libc/search/tdestroy.c b/newlib/libc/search/tdestroy.c index 3e7327c4d..e1418207a 100644 --- a/newlib/libc/search/tdestroy.c +++ b/newlib/libc/search/tdestroy.c @@ -41,7 +41,7 @@ trecurse(root, free_action) void _DEFUN(tdestroy, (vrootp, freefct), - void *vrootp _AND + void *vrootp, void (*freefct)(void *)) { node_t *root = (node_t *) vrootp; diff --git a/newlib/libc/search/tfind.c b/newlib/libc/search/tfind.c index 5d7c40c93..108213048 100644 --- a/newlib/libc/search/tfind.c +++ b/newlib/libc/search/tfind.c @@ -26,8 +26,8 @@ __RCSID("$NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); /* find a node, or return 0 */ void * _DEFUN(tfind, (vkey, vrootp, compar), - const void *vkey _AND /* key to be found */ - void **vrootp _AND /* address of the tree root */ + const void *vkey, /* key to be found */ + void **vrootp, /* address of the tree root */ int (*compar)(const void *, const void *)) { node_t **rootp = (node_t **)vrootp; diff --git a/newlib/libc/search/tsearch.c b/newlib/libc/search/tsearch.c index 5f41b407d..8fe265703 100644 --- a/newlib/libc/search/tsearch.c +++ b/newlib/libc/search/tsearch.c @@ -26,8 +26,8 @@ __RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $"); /* find or insert datum into search tree */ void * _DEFUN(tsearch, (vkey, vrootp, compar), - const void *vkey _AND /* key to be located */ - void **vrootp _AND /* address of tree root */ + const void *vkey, /* key to be located */ + void **vrootp, /* address of tree root */ int (*compar)(const void *, const void *)) { node_t *q; diff --git a/newlib/libc/search/twalk.c b/newlib/libc/search/twalk.c index 74ad5a615..26d6e97db 100644 --- a/newlib/libc/search/twalk.c +++ b/newlib/libc/search/twalk.c @@ -50,7 +50,7 @@ trecurse(root, action, level) /* Walk the nodes of a tree */ void _DEFUN(twalk, (vroot, action), - const void *vroot _AND /* Root of the tree to be walked */ + const void *vroot, /* Root of the tree to be walked */ void (*action)(const void *, VISIT, int)) { if (vroot != NULL && action != NULL) diff --git a/newlib/libc/signal/psignal.c b/newlib/libc/signal/psignal.c index f2cfdf3ff..f0c9b6ee6 100644 --- a/newlib/libc/signal/psignal.c +++ b/newlib/libc/signal/psignal.c @@ -35,7 +35,7 @@ Supporting OS subroutines required: <>, <>, <>, _VOID _DEFUN(psignal, (sig, s), - int sig _AND + int sig, _CONST char *s) { if (s != NULL && *s != '\0') diff --git a/newlib/libc/signal/raise.c b/newlib/libc/signal/raise.c index df3ebb50f..6f93686e6 100644 --- a/newlib/libc/signal/raise.c +++ b/newlib/libc/signal/raise.c @@ -62,7 +62,7 @@ _DEFUN (raise, (sig), int _DEFUN (_raise_r, (reent, sig), - struct _reent *reent _AND + struct _reent *reent, int sig) { return _kill_r (reent, _getpid_r (reent), sig); diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c index 5729f65e3..806abd888 100644 --- a/newlib/libc/signal/signal.c +++ b/newlib/libc/signal/signal.c @@ -109,8 +109,8 @@ _DEFUN (_init_signal_r, (ptr), _sig_func_ptr _DEFUN (_signal_r, (ptr, sig, func), - struct _reent *ptr _AND - int sig _AND + struct _reent *ptr, + int sig, _sig_func_ptr func) { _sig_func_ptr old_func; @@ -132,7 +132,7 @@ _DEFUN (_signal_r, (ptr, sig, func), int _DEFUN (_raise_r, (ptr, sig), - struct _reent *ptr _AND + struct _reent *ptr, int sig) { _sig_func_ptr func; @@ -167,7 +167,7 @@ _DEFUN (_raise_r, (ptr, sig), int _DEFUN (__sigtramp_r, (ptr, sig), - struct _reent *ptr _AND + struct _reent *ptr, int sig) { _sig_func_ptr func; @@ -206,7 +206,7 @@ _DEFUN (raise, (sig), _sig_func_ptr _DEFUN (signal, (sig, func), - int sig _AND + int sig, _sig_func_ptr func) { return _signal_r (_REENT, sig, func); diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c index 0c363d5ea..86996737f 100644 --- a/newlib/libc/stdio/asiprintf.c +++ b/newlib/libc/stdio/asiprintf.c @@ -26,8 +26,8 @@ int _DEFUN(_asiprintf_r, (ptr, strp, fmt), - struct _reent *ptr _AND - char **strp _AND + struct _reent *ptr, + char **strp, const char *fmt _DOTS) { int ret; @@ -54,7 +54,7 @@ _DEFUN(_asiprintf_r, (ptr, strp, fmt), int _DEFUN(asiprintf, (strp, fmt), - char **strp _AND + char **strp, const char *fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c index 16ccfde63..f033f1b6b 100644 --- a/newlib/libc/stdio/asniprintf.c +++ b/newlib/libc/stdio/asniprintf.c @@ -15,9 +15,9 @@ char * _DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt), - struct _reent *ptr _AND - char *buf _AND - size_t *lenp _AND + struct _reent *ptr, + char *buf, + size_t *lenp, const char *fmt _DOTS) { int ret; @@ -62,8 +62,8 @@ _DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt), char * _DEFUN(asniprintf, (buf, lenp, fmt), - char *buf _AND - size_t *lenp _AND + char *buf, + size_t *lenp, const char *fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c index 2e8d8aabb..e80ca06cb 100644 --- a/newlib/libc/stdio/asnprintf.c +++ b/newlib/libc/stdio/asnprintf.c @@ -15,9 +15,9 @@ char * _DEFUN(_asnprintf_r, (ptr, buf, lenp, fmt), - struct _reent *__restrict ptr _AND - char *buf _AND - size_t *lenp _AND + struct _reent *__restrict ptr, + char *buf, + size_t *lenp, const char *__restrict fmt _DOTS) { int ret; @@ -68,8 +68,8 @@ _EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...) char * _DEFUN(asnprintf, (buf, lenp, fmt), - char *__restrict buf _AND - size_t *__restrict lenp _AND + char *__restrict buf, + size_t *__restrict lenp, const char *__restrict fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c index bf214f9af..1e75174d4 100644 --- a/newlib/libc/stdio/asprintf.c +++ b/newlib/libc/stdio/asprintf.c @@ -26,8 +26,8 @@ int _DEFUN(_asprintf_r, (ptr, strp, fmt), - struct _reent *ptr _AND - char **__restrict strp _AND + struct _reent *ptr, + char **__restrict strp, const char *__restrict fmt _DOTS) { int ret; @@ -60,7 +60,7 @@ _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...) int _DEFUN(asprintf, (strp, fmt), - char **__restrict strp _AND + char **__restrict strp, const char *__restrict fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/diprintf.c b/newlib/libc/stdio/diprintf.c index fde6ea44c..f57cbac81 100644 --- a/newlib/libc/stdio/diprintf.c +++ b/newlib/libc/stdio/diprintf.c @@ -50,8 +50,8 @@ Supporting OS subroutines required: <>, <>. int _DEFUN(_diprintf_r, (ptr, fd, format), - struct _reent *ptr _AND - int fd _AND + struct _reent *ptr, + int fd, const char *format _DOTS) { va_list ap; @@ -67,7 +67,7 @@ _DEFUN(_diprintf_r, (ptr, fd, format), int _DEFUN(diprintf, (fd, format), - int fd _AND + int fd, const char *format _DOTS) { va_list ap; diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c index 7389eefaa..831fe208c 100644 --- a/newlib/libc/stdio/dprintf.c +++ b/newlib/libc/stdio/dprintf.c @@ -54,8 +54,8 @@ Supporting OS subroutines required: <>, <>. int _DEFUN(_dprintf_r, (ptr, fd, format), - struct _reent *ptr _AND - int fd _AND + struct _reent *ptr, + int fd, const char *__restrict format _DOTS) { va_list ap; @@ -77,7 +77,7 @@ _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...) int _DEFUN(dprintf, (fd, format), - int fd _AND + int fd, const char *__restrict format _DOTS) { va_list ap; diff --git a/newlib/libc/stdio/fclose.c b/newlib/libc/stdio/fclose.c index 3325a8920..264d2e48f 100644 --- a/newlib/libc/stdio/fclose.c +++ b/newlib/libc/stdio/fclose.c @@ -57,7 +57,7 @@ Required OS subroutines: <>, <>, <>, <>, int _DEFUN(_fclose_r, (rptr, fp), - struct _reent *rptr _AND + struct _reent *rptr, register FILE * fp) { int r; diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c index e0268ed87..7dda3c359 100644 --- a/newlib/libc/stdio/fdopen.c +++ b/newlib/libc/stdio/fdopen.c @@ -54,8 +54,8 @@ PORTABILITY FILE * _DEFUN(_fdopen_r, (ptr, fd, mode), - struct _reent *ptr _AND - int fd _AND + struct _reent *ptr, + int fd, _CONST char *mode) { register FILE *fp; @@ -124,7 +124,7 @@ _DEFUN(_fdopen_r, (ptr, fd, mode), FILE * _DEFUN(fdopen, (fd, mode), - int fd _AND + int fd, _CONST char *mode) { return _fdopen_r (_REENT, fd, mode); diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c index 199acbdc3..18d6d3e74 100644 --- a/newlib/libc/stdio/fflush.c +++ b/newlib/libc/stdio/fflush.c @@ -101,7 +101,7 @@ No supporting OS subroutines are required. directly from __srefill. */ int _DEFUN(__sflush_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE * fp) { register unsigned char *p; @@ -240,7 +240,7 @@ _DEFUN(__sflush_r, (ptr, fp), writing. */ int _DEFUN(__sflushw_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { return (fp->_flags & __SWR) ? __sflush_r (ptr, fp) : 0; @@ -251,7 +251,7 @@ _DEFUN(__sflushw_r, (ptr, fp), int _DEFUN(_fflush_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE * fp) { int ret; diff --git a/newlib/libc/stdio/fgetc.c b/newlib/libc/stdio/fgetc.c index 54322a069..45404d30e 100644 --- a/newlib/libc/stdio/fgetc.c +++ b/newlib/libc/stdio/fgetc.c @@ -86,7 +86,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_fgetc_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, FILE * fp) { int result; diff --git a/newlib/libc/stdio/fgetc_u.c b/newlib/libc/stdio/fgetc_u.c index 5bbd5a549..45ee3b1b5 100644 --- a/newlib/libc/stdio/fgetc_u.c +++ b/newlib/libc/stdio/fgetc_u.c @@ -30,7 +30,7 @@ int _DEFUN(_fgetc_unlocked_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, FILE * fp) { CHECK_INIT(ptr, fp); diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c index 3074526b4..373adfd8e 100644 --- a/newlib/libc/stdio/fgetpos.c +++ b/newlib/libc/stdio/fgetpos.c @@ -66,8 +66,8 @@ No supporting OS subroutines are required. int _DEFUN(_fgetpos_r, (ptr, fp, pos), - struct _reent * ptr _AND - FILE *__restrict fp _AND + struct _reent * ptr, + FILE *__restrict fp, _fpos_t *__restrict pos) { *pos = _ftell_r (ptr, fp); @@ -83,7 +83,7 @@ _DEFUN(_fgetpos_r, (ptr, fp, pos), int _DEFUN(fgetpos, (fp, pos), - FILE *__restrict fp _AND + FILE *__restrict fp, _fpos_t *__restrict pos) { return _fgetpos_r (_REENT, fp, pos); diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c index 54097510d..5edeef957 100644 --- a/newlib/libc/stdio/fgets.c +++ b/newlib/libc/stdio/fgets.c @@ -95,9 +95,9 @@ Supporting OS subroutines required: <>, <>, <>, char * _DEFUN(_fgets_r, (ptr, buf, n, fp), - struct _reent * ptr _AND - char *__restrict buf _AND - int n _AND + struct _reent * ptr, + char *__restrict buf, + int n, FILE *__restrict fp) { size_t len; @@ -190,8 +190,8 @@ _DEFUN(_fgets_r, (ptr, buf, n, fp), char * _DEFUN(fgets, (buf, n, fp), - char *__restrict buf _AND - int n _AND + char *__restrict buf, + int n, FILE *__restrict fp) { return _fgets_r (_REENT, buf, n, fp); diff --git a/newlib/libc/stdio/fgetwc.c b/newlib/libc/stdio/fgetwc.c index 07731487d..718b53a16 100644 --- a/newlib/libc/stdio/fgetwc.c +++ b/newlib/libc/stdio/fgetwc.c @@ -126,7 +126,7 @@ PORTABILITY wint_t _DEFUN(__fgetwc, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { wchar_t wc; @@ -173,7 +173,7 @@ _DEFUN(__fgetwc, (ptr, fp), wint_t _DEFUN(_fgetwc_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { wint_t r; diff --git a/newlib/libc/stdio/fgetwc_u.c b/newlib/libc/stdio/fgetwc_u.c index 4ccd5765c..f3a4fea61 100644 --- a/newlib/libc/stdio/fgetwc_u.c +++ b/newlib/libc/stdio/fgetwc_u.c @@ -31,7 +31,7 @@ wint_t _DEFUN(_fgetwc_unlocked_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { ORIENT(fp, 1); diff --git a/newlib/libc/stdio/fgetws.c b/newlib/libc/stdio/fgetws.c index 3dbf3ef74..8ca95d170 100644 --- a/newlib/libc/stdio/fgetws.c +++ b/newlib/libc/stdio/fgetws.c @@ -100,9 +100,9 @@ PORTABILITY wchar_t * _DEFUN(_fgetws_r, (ptr, ws, n, fp), - struct _reent *ptr _AND - wchar_t * ws _AND - int n _AND + struct _reent *ptr, + wchar_t * ws, + int n, FILE * fp) { wchar_t *wsp; @@ -173,8 +173,8 @@ error: wchar_t * _DEFUN(fgetws, (ws, n, fp), - wchar_t *__restrict ws _AND - int n _AND + wchar_t *__restrict ws, + int n, FILE *__restrict fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index 737bde102..3d928c15d 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -45,8 +45,8 @@ _NOINLINE_STATIC _VOID static _VOID #endif _DEFUN(std, (ptr, flags, file), - FILE *ptr _AND - int flags _AND + FILE *ptr, + int flags, int file) { ptr->_p = 0; @@ -125,7 +125,7 @@ struct glue_with_file { struct _glue * _DEFUN(__sfmoreglue, (d, n), - struct _reent *d _AND + struct _reent *d, register int n) { struct glue_with_file *g; diff --git a/newlib/libc/stdio/fiprintf.c b/newlib/libc/stdio/fiprintf.c index 7d417f88c..1510556b2 100644 --- a/newlib/libc/stdio/fiprintf.c +++ b/newlib/libc/stdio/fiprintf.c @@ -23,8 +23,8 @@ int _DEFUN(_fiprintf_r, (ptr, fp, fmt), - struct _reent *ptr _AND - FILE * fp _AND + struct _reent *ptr, + FILE * fp, const char *fmt _DOTS) { int ret; @@ -40,7 +40,7 @@ _DEFUN(_fiprintf_r, (ptr, fp, fmt), int _DEFUN(fiprintf, (fp, fmt), - FILE * fp _AND + FILE * fp, const char *fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/flags.c b/newlib/libc/stdio/flags.c index 518cc33f1..b8f660ec4 100644 --- a/newlib/libc/stdio/flags.c +++ b/newlib/libc/stdio/flags.c @@ -31,8 +31,8 @@ int _DEFUN(__sflags, (ptr, mode, optr), - struct _reent *ptr _AND - register char *mode _AND + struct _reent *ptr, + register char *mode, int *optr) { register int ret, m, o; diff --git a/newlib/libc/stdio/fmemopen.c b/newlib/libc/stdio/fmemopen.c index 520ba1b80..6a6153fbd 100644 --- a/newlib/libc/stdio/fmemopen.c +++ b/newlib/libc/stdio/fmemopen.c @@ -84,9 +84,9 @@ typedef struct fmemcookie { COOKIE; return number of bytes read (0 on EOF). */ static _READ_WRITE_RETURN_TYPE _DEFUN(fmemreader, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - char *buf _AND + struct _reent *ptr, + void *cookie, + char *buf, _READ_WRITE_BUFSIZE_TYPE n) { fmemcookie *c = (fmemcookie *) cookie; @@ -104,9 +104,9 @@ _DEFUN(fmemreader, (ptr, cookie, buf, n), returning the number of bytes written or EOF on failure. */ static _READ_WRITE_RETURN_TYPE _DEFUN(fmemwriter, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - const char *buf _AND + struct _reent *ptr, + void *cookie, + const char *buf, _READ_WRITE_BUFSIZE_TYPE n) { fmemcookie *c = (fmemcookie *) cookie; @@ -160,9 +160,9 @@ _DEFUN(fmemwriter, (ptr, cookie, buf, n), COOKIE; return resulting position or fail with EOF. */ static _fpos_t _DEFUN(fmemseeker, (ptr, cookie, pos, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos_t pos _AND + struct _reent *ptr, + void *cookie, + _fpos_t pos, int whence) { fmemcookie *c = (fmemcookie *) cookie; @@ -215,9 +215,9 @@ _DEFUN(fmemseeker, (ptr, cookie, pos, whence), #ifdef __LARGE64_FILES static _fpos64_t _DEFUN(fmemseeker64, (ptr, cookie, pos, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos64_t pos _AND + struct _reent *ptr, + void *cookie, + _fpos64_t pos, int whence) { _off64_t offset = (_off64_t) pos; @@ -257,7 +257,7 @@ _DEFUN(fmemseeker64, (ptr, cookie, pos, whence), /* Reclaim resources used by stream described by COOKIE. */ static int _DEFUN(fmemcloser, (ptr, cookie), - struct _reent *ptr _AND + struct _reent *ptr, void *cookie) { fmemcookie *c = (fmemcookie *) cookie; @@ -269,9 +269,9 @@ _DEFUN(fmemcloser, (ptr, cookie), Return the new stream, or fail with NULL. */ FILE * _DEFUN(_fmemopen_r, (ptr, buf, size, mode), - struct _reent *ptr _AND - void *__restrict buf _AND - size_t size _AND + struct _reent *ptr, + void *__restrict buf, + size_t size, const char *__restrict mode) { FILE *fp; @@ -362,8 +362,8 @@ _DEFUN(_fmemopen_r, (ptr, buf, size, mode), #ifndef _REENT_ONLY FILE * _DEFUN(fmemopen, (buf, size, mode), - void *__restrict buf _AND - size_t size _AND + void *__restrict buf, + size_t size, const char *__restrict mode) { return _fmemopen_r (_REENT, buf, size, mode); diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c index 2551befed..92ec70670 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -114,8 +114,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; FILE * _DEFUN(_fopen_r, (ptr, file, mode), - struct _reent *ptr _AND - _CONST char *__restrict file _AND + struct _reent *ptr, + _CONST char *__restrict file, _CONST char *__restrict mode) { register FILE *fp; @@ -164,7 +164,7 @@ _DEFUN(_fopen_r, (ptr, file, mode), FILE * _DEFUN(fopen, (file, mode), - _CONST char *file _AND + _CONST char *file, _CONST char *mode) { return _fopen_r (_REENT, file, mode); diff --git a/newlib/libc/stdio/fopencookie.c b/newlib/libc/stdio/fopencookie.c index eb9861392..4ea1ab1d1 100644 --- a/newlib/libc/stdio/fopencookie.c +++ b/newlib/libc/stdio/fopencookie.c @@ -99,9 +99,9 @@ typedef struct fccookie { static _READ_WRITE_RETURN_TYPE _DEFUN(fcreader, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - char *buf _AND + struct _reent *ptr, + void *cookie, + char *buf, _READ_WRITE_BUFSIZE_TYPE n) { int result; @@ -114,9 +114,9 @@ _DEFUN(fcreader, (ptr, cookie, buf, n), static _READ_WRITE_RETURN_TYPE _DEFUN(fcwriter, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - const char *buf _AND + struct _reent *ptr, + void *cookie, + const char *buf, _READ_WRITE_BUFSIZE_TYPE n) { int result; @@ -137,9 +137,9 @@ _DEFUN(fcwriter, (ptr, cookie, buf, n), static _fpos_t _DEFUN(fcseeker, (ptr, cookie, pos, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos_t pos _AND + struct _reent *ptr, + void *cookie, + _fpos_t pos, int whence) { fccookie *c = (fccookie *) cookie; @@ -165,9 +165,9 @@ _DEFUN(fcseeker, (ptr, cookie, pos, whence), #ifdef __LARGE64_FILES static _fpos64_t _DEFUN(fcseeker64, (ptr, cookie, pos, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos64_t pos _AND + struct _reent *ptr, + void *cookie, + _fpos64_t pos, int whence) { _off64_t offset; @@ -181,7 +181,7 @@ _DEFUN(fcseeker64, (ptr, cookie, pos, whence), static int _DEFUN(fccloser, (ptr, cookie), - struct _reent *ptr _AND + struct _reent *ptr, void *cookie) { int result = 0; @@ -198,9 +198,9 @@ _DEFUN(fccloser, (ptr, cookie), FILE * _DEFUN(_fopencookie_r, (ptr, cookie, mode, functions), - struct _reent *ptr _AND - void *cookie _AND - const char *mode _AND + struct _reent *ptr, + void *cookie, + const char *mode, cookie_io_functions_t functions) { FILE *fp; @@ -254,8 +254,8 @@ _DEFUN(_fopencookie_r, (ptr, cookie, mode, functions), #ifndef _REENT_ONLY FILE * _DEFUN(fopencookie, (cookie, mode, functions), - void *cookie _AND - const char *mode _AND + void *cookie, + const char *mode, cookie_io_functions_t functions) { return _fopencookie_r (_REENT, cookie, mode, functions); diff --git a/newlib/libc/stdio/fprintf.c b/newlib/libc/stdio/fprintf.c index fe92a5b99..6a98237a2 100644 --- a/newlib/libc/stdio/fprintf.c +++ b/newlib/libc/stdio/fprintf.c @@ -23,8 +23,8 @@ int _DEFUN(_fprintf_r, (ptr, fp, fmt), - struct _reent *ptr _AND - FILE *__restrict fp _AND + struct _reent *ptr, + FILE *__restrict fp, const char *__restrict fmt _DOTS) { int ret; @@ -46,7 +46,7 @@ _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...) int _DEFUN(fprintf, (fp, fmt), - FILE *__restrict fp _AND + FILE *__restrict fp, const char *__restrict fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/fpurge.c b/newlib/libc/stdio/fpurge.c index de621feb6..acd177a69 100644 --- a/newlib/libc/stdio/fpurge.c +++ b/newlib/libc/stdio/fpurge.c @@ -61,7 +61,7 @@ No supporting OS subroutines are required. int _DEFUN(_fpurge_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE * fp) { int t; diff --git a/newlib/libc/stdio/fputc.c b/newlib/libc/stdio/fputc.c index f9273d6ae..452bb2961 100644 --- a/newlib/libc/stdio/fputc.c +++ b/newlib/libc/stdio/fputc.c @@ -88,8 +88,8 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_fputc_r, (ptr, ch, file), - struct _reent *ptr _AND - int ch _AND + struct _reent *ptr, + int ch, FILE * file) { int result; @@ -103,7 +103,7 @@ _DEFUN(_fputc_r, (ptr, ch, file), #ifndef _REENT_ONLY int _DEFUN(fputc, (ch, file), - int ch _AND + int ch, FILE * file) { #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED) diff --git a/newlib/libc/stdio/fputc_u.c b/newlib/libc/stdio/fputc_u.c index ac64b0bc2..27690e213 100644 --- a/newlib/libc/stdio/fputc_u.c +++ b/newlib/libc/stdio/fputc_u.c @@ -30,8 +30,8 @@ int _DEFUN(_fputc_unlocked_r, (ptr, ch, file), - struct _reent *ptr _AND - int ch _AND + struct _reent *ptr, + int ch, FILE * file) { CHECK_INIT(ptr, file); @@ -41,7 +41,7 @@ _DEFUN(_fputc_unlocked_r, (ptr, ch, file), #ifndef _REENT_ONLY int _DEFUN(fputc_unlocked, (ch, file), - int ch _AND + int ch, FILE * file) { #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED) diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c index c4588265b..7adb89a04 100644 --- a/newlib/libc/stdio/fputs.c +++ b/newlib/libc/stdio/fputs.c @@ -87,8 +87,8 @@ Supporting OS subroutines required: <>, <>, <>, */ int _DEFUN(_fputs_r, (ptr, s, fp), - struct _reent * ptr _AND - char _CONST *__restrict s _AND + struct _reent * ptr, + char _CONST *__restrict s, FILE *__restrict fp) { #ifdef _FVWRITE_IN_STREAMIO @@ -136,7 +136,7 @@ error: #ifndef _REENT_ONLY int _DEFUN(fputs, (s, fp), - char _CONST *__restrict s _AND + char _CONST *__restrict s, FILE *__restrict fp) { return _fputs_r (_REENT, s, fp); diff --git a/newlib/libc/stdio/fputwc.c b/newlib/libc/stdio/fputwc.c index 5e2a9e322..4943cef99 100644 --- a/newlib/libc/stdio/fputwc.c +++ b/newlib/libc/stdio/fputwc.c @@ -129,8 +129,8 @@ PORTABILITY wint_t _DEFUN(__fputwc, (ptr, wc, fp), - struct _reent *ptr _AND - wchar_t wc _AND + struct _reent *ptr, + wchar_t wc, FILE *fp) { char buf[MB_LEN_MAX]; @@ -164,8 +164,8 @@ _DEFUN(__fputwc, (ptr, wc, fp), wint_t _DEFUN(_fputwc_r, (ptr, wc, fp), - struct _reent *ptr _AND - wchar_t wc _AND + struct _reent *ptr, + wchar_t wc, FILE *fp) { wint_t r; @@ -179,7 +179,7 @@ _DEFUN(_fputwc_r, (ptr, wc, fp), wint_t _DEFUN(fputwc, (wc, fp), - wchar_t wc _AND + wchar_t wc, FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fputwc_u.c b/newlib/libc/stdio/fputwc_u.c index 43be648f7..4d4f07a0a 100644 --- a/newlib/libc/stdio/fputwc_u.c +++ b/newlib/libc/stdio/fputwc_u.c @@ -31,8 +31,8 @@ wint_t _DEFUN(_fputwc_unlocked_r, (ptr, wc, fp), - struct _reent *ptr _AND - wchar_t wc _AND + struct _reent *ptr, + wchar_t wc, FILE *fp) { ORIENT(fp, 1); @@ -41,7 +41,7 @@ _DEFUN(_fputwc_unlocked_r, (ptr, wc, fp), wint_t _DEFUN(fputwc_unlocked, (wc, fp), - wchar_t wc _AND + wchar_t wc, FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fputws.c b/newlib/libc/stdio/fputws.c index c68241c92..8a470fcfb 100644 --- a/newlib/libc/stdio/fputws.c +++ b/newlib/libc/stdio/fputws.c @@ -95,8 +95,8 @@ PORTABILITY int _DEFUN(_fputws_r, (ptr, ws, fp), - struct _reent *ptr _AND - const wchar_t *ws _AND + struct _reent *ptr, + const wchar_t *ws, FILE *fp) { size_t nbytes; @@ -159,7 +159,7 @@ error: int _DEFUN(fputws, (ws, fp), - const wchar_t *__restrict ws _AND + const wchar_t *__restrict ws, FILE *__restrict fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index c2e60bedc..cff60efe1 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -94,10 +94,10 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef __SCLE static size_t _DEFUN(crlf_r, (ptr, fp, buf, count, eof), - struct _reent * ptr _AND - FILE * fp _AND - char * buf _AND - size_t count _AND + struct _reent * ptr, + FILE * fp, + char * buf, + size_t count, int eof) { int r; @@ -143,10 +143,10 @@ _DEFUN(crlf_r, (ptr, fp, buf, count, eof), size_t _DEFUN(_fread_r, (ptr, buf, size, count, fp), - struct _reent * ptr _AND - _PTR __restrict buf _AND - size_t size _AND - size_t count _AND + struct _reent * ptr, + _PTR __restrict buf, + size_t size, + size_t count, FILE * __restrict fp) { register size_t resid; @@ -261,9 +261,9 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), #ifndef _REENT_ONLY size_t _DEFUN(fread, (buf, size, count, fp), - _PTR __restrict buf _AND - size_t size _AND - size_t count _AND + _PTR __restrict buf, + size_t size, + size_t count, FILE *__restrict fp) { return _fread_r (_REENT, buf, size, count, fp); diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c index e5bb73a26..b9fee0c7b 100644 --- a/newlib/libc/stdio/freopen.c +++ b/newlib/libc/stdio/freopen.c @@ -76,9 +76,9 @@ Supporting OS subroutines required: <>, <>, <>, FILE * _DEFUN(_freopen_r, (ptr, file, mode, fp), - struct _reent *ptr _AND - const char *__restrict file _AND - const char *__restrict mode _AND + struct _reent *ptr, + const char *__restrict file, + const char *__restrict mode, register FILE *__restrict fp) { register int f; @@ -244,8 +244,8 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp), FILE * _DEFUN(freopen, (file, mode, fp), - _CONST char *__restrict file _AND - _CONST char *__restrict mode _AND + _CONST char *__restrict file, + _CONST char *__restrict mode, register FILE *__restrict fp) { return _freopen_r (_REENT, file, mode, fp); diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c index b5bd979d3..4b8a1e099 100644 --- a/newlib/libc/stdio/fseek.c +++ b/newlib/libc/stdio/fseek.c @@ -82,9 +82,9 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_fseek_r, (ptr, fp, offset, whence), - struct _reent *ptr _AND - register FILE *fp _AND - long offset _AND + struct _reent *ptr, + register FILE *fp, + long offset, int whence) { return _fseeko_r (ptr, fp, offset, whence); @@ -94,8 +94,8 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence), int _DEFUN(fseek, (fp, offset, whence), - register FILE *fp _AND - long offset _AND + register FILE *fp, + long offset, int whence) { return _fseek_r (_REENT, fp, offset, whence); diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c index 52f978929..58bb9511b 100644 --- a/newlib/libc/stdio/fseeko.c +++ b/newlib/libc/stdio/fseeko.c @@ -94,9 +94,9 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_fseeko_r, (ptr, fp, offset, whence), - struct _reent *ptr _AND - register FILE *fp _AND - _off_t offset _AND + struct _reent *ptr, + register FILE *fp, + _off_t offset, int whence) { _fpos_t _EXFNPTR(seekfn, (struct _reent *, _PTR, _fpos_t, int)); @@ -360,8 +360,8 @@ dumb: int _DEFUN(fseeko, (fp, offset, whence), - register FILE *fp _AND - _off_t offset _AND + register FILE *fp, + _off_t offset, int whence) { return _fseeko_r (_REENT, fp, offset, whence); diff --git a/newlib/libc/stdio/fsetlocking.c b/newlib/libc/stdio/fsetlocking.c index d62aef334..e27aa42fc 100644 --- a/newlib/libc/stdio/fsetlocking.c +++ b/newlib/libc/stdio/fsetlocking.c @@ -66,7 +66,7 @@ No supporting OS subroutines are required. int _DEFUN(__fsetlocking, (fp, type), - FILE * fp _AND + FILE * fp, int type) { int result; diff --git a/newlib/libc/stdio/fsetpos.c b/newlib/libc/stdio/fsetpos.c index a2a5d7b2e..ffc9d794c 100644 --- a/newlib/libc/stdio/fsetpos.c +++ b/newlib/libc/stdio/fsetpos.c @@ -60,8 +60,8 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_fsetpos_r, (ptr, iop, pos), - struct _reent * ptr _AND - FILE * iop _AND + struct _reent * ptr, + FILE * iop, _CONST _fpos_t * pos) { int x = _fseek_r (ptr, iop, *pos, SEEK_SET); @@ -75,7 +75,7 @@ _DEFUN(_fsetpos_r, (ptr, iop, pos), int _DEFUN(fsetpos, (iop, pos), - FILE * iop _AND + FILE * iop, _CONST _fpos_t * pos) { return _fsetpos_r (_REENT, iop, pos); diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c index 70eed84c0..1260d5ef4 100644 --- a/newlib/libc/stdio/ftell.c +++ b/newlib/libc/stdio/ftell.c @@ -84,7 +84,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; long _DEFUN(_ftell_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE * fp) { _fpos_t pos; diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c index 90c4d321e..9d04a4516 100644 --- a/newlib/libc/stdio/ftello.c +++ b/newlib/libc/stdio/ftello.c @@ -84,7 +84,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; _off_t _DEFUN(_ftello_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, register FILE * fp) { _fpos_t pos; diff --git a/newlib/libc/stdio/funopen.c b/newlib/libc/stdio/funopen.c index 58b75648a..23bed7b8e 100644 --- a/newlib/libc/stdio/funopen.c +++ b/newlib/libc/stdio/funopen.c @@ -105,9 +105,9 @@ typedef struct funcookie { static _READ_WRITE_RETURN_TYPE _DEFUN(funreader, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - char *buf _AND + struct _reent *ptr, + void *cookie, + char *buf, _READ_WRITE_BUFSIZE_TYPE n) { int result; @@ -120,9 +120,9 @@ _DEFUN(funreader, (ptr, cookie, buf, n), static _READ_WRITE_RETURN_TYPE _DEFUN(funwriter, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - const char *buf _AND + struct _reent *ptr, + void *cookie, + const char *buf, _READ_WRITE_BUFSIZE_TYPE n) { int result; @@ -135,9 +135,9 @@ _DEFUN(funwriter, (ptr, cookie, buf, n), static _fpos_t _DEFUN(funseeker, (ptr, cookie, off, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos_t off _AND + struct _reent *ptr, + void *cookie, + _fpos_t off, int whence) { funcookie *c = (funcookie *) cookie; @@ -163,9 +163,9 @@ _DEFUN(funseeker, (ptr, cookie, off, whence), #ifdef __LARGE64_FILES static _fpos64_t _DEFUN(funseeker64, (ptr, cookie, off, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos64_t off _AND + struct _reent *ptr, + void *cookie, + _fpos64_t off, int whence) { _fpos64_t result; @@ -179,7 +179,7 @@ _DEFUN(funseeker64, (ptr, cookie, off, whence), static int _DEFUN(funcloser, (ptr, cookie), - struct _reent *ptr _AND + struct _reent *ptr, void *cookie) { int result = 0; @@ -196,11 +196,11 @@ _DEFUN(funcloser, (ptr, cookie), FILE * _DEFUN(_funopen_r, (ptr, cookie, readfn, writefn, seekfn, closefn), - struct _reent *ptr _AND - const void *cookie _AND - funread readfn _AND - funwrite writefn _AND - funseek seekfn _AND + struct _reent *ptr, + const void *cookie, + funread readfn, + funwrite writefn, + funseek seekfn, funclose closefn) { FILE *fp; @@ -268,10 +268,10 @@ _DEFUN(_funopen_r, (ptr, cookie, readfn, writefn, seekfn, closefn), #ifndef _REENT_ONLY FILE * _DEFUN(funopen, (cookie, readfn, writefn, seekfn, closefn), - const void *cookie _AND - funread readfn _AND - funwrite writefn _AND - funseek seekfn _AND + const void *cookie, + funread readfn, + funwrite writefn, + funseek seekfn, funclose closefn) { return _funopen_r (_REENT, cookie, readfn, writefn, seekfn, closefn); diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 455666006..a0432a03d 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -46,8 +46,8 @@ int _DEFUN(__sfvwrite_r, (ptr, fp, uio), - struct _reent *ptr _AND - register FILE *fp _AND + struct _reent *ptr, + register FILE *fp, register struct __suio *uio) { register size_t len; diff --git a/newlib/libc/stdio/fwalk.c b/newlib/libc/stdio/fwalk.c index cceaa96c2..8b7b5b0e3 100644 --- a/newlib/libc/stdio/fwalk.c +++ b/newlib/libc/stdio/fwalk.c @@ -29,7 +29,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_fwalk, (ptr, function), - struct _reent *ptr _AND + struct _reent *ptr, register int (*function) (FILE *)) { register FILE *fp; @@ -56,7 +56,7 @@ _DEFUN(_fwalk, (ptr, function), I/O function (e.g. _fclose_r). */ int _DEFUN(_fwalk_reent, (ptr, reent_function), - struct _reent *ptr _AND + struct _reent *ptr, register int (*reent_function) (struct _reent *, FILE *)) { register FILE *fp; diff --git a/newlib/libc/stdio/fwide.c b/newlib/libc/stdio/fwide.c index a57a77c95..719a58acd 100644 --- a/newlib/libc/stdio/fwide.c +++ b/newlib/libc/stdio/fwide.c @@ -49,8 +49,8 @@ C99, POSIX.1-2001. int _DEFUN(_fwide_r, (ptr, fp, mode), - struct _reent *ptr _AND - FILE *fp _AND + struct _reent *ptr, + FILE *fp, int mode) { int ret; @@ -71,7 +71,7 @@ _DEFUN(_fwide_r, (ptr, fp, mode), int _DEFUN(fwide, (fp, mode), - FILE *fp _AND + FILE *fp, int mode) { return _fwide_r (_REENT, fp, mode); diff --git a/newlib/libc/stdio/fwprintf.c b/newlib/libc/stdio/fwprintf.c index 4b05824c4..00a8d41f9 100644 --- a/newlib/libc/stdio/fwprintf.c +++ b/newlib/libc/stdio/fwprintf.c @@ -24,8 +24,8 @@ int _DEFUN(_fwprintf_r, (ptr, fp, fmt), - struct _reent *ptr _AND - FILE *fp _AND + struct _reent *ptr, + FILE *fp, const wchar_t *fmt _DOTS) { int ret; @@ -41,7 +41,7 @@ _DEFUN(_fwprintf_r, (ptr, fp, fmt), int _DEFUN(fwprintf, (fp, fmt), - FILE *__restrict fp _AND + FILE *__restrict fp, const wchar_t *__restrict fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c index 2ba71f38a..a805eff7f 100644 --- a/newlib/libc/stdio/fwrite.c +++ b/newlib/libc/stdio/fwrite.c @@ -109,10 +109,10 @@ static char sccsid[] = "%W% (Berkeley) %G%"; size_t _DEFUN(_fwrite_r, (ptr, buf, size, count, fp), - struct _reent * ptr _AND - _CONST _PTR __restrict buf _AND - size_t size _AND - size_t count _AND + struct _reent * ptr, + _CONST _PTR __restrict buf, + size_t size, + size_t count, FILE * __restrict fp) { size_t n; @@ -171,9 +171,9 @@ ret: #ifndef _REENT_ONLY size_t _DEFUN(fwrite, (buf, size, count, fp), - _CONST _PTR __restrict buf _AND - size_t size _AND - size_t count _AND + _CONST _PTR __restrict buf, + size_t size, + size_t count, FILE * fp) { return _fwrite_r (_REENT, buf, size, count, fp); diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c index 37e345870..269bfb1d3 100644 --- a/newlib/libc/stdio/getc.c +++ b/newlib/libc/stdio/getc.c @@ -77,7 +77,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_getc_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { int result; diff --git a/newlib/libc/stdio/getc_u.c b/newlib/libc/stdio/getc_u.c index 6b71ce52d..2f9f0e818 100644 --- a/newlib/libc/stdio/getc_u.c +++ b/newlib/libc/stdio/getc_u.c @@ -70,7 +70,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_getc_unlocked_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { /* CHECK_INIT is called (eventually) by __srefill_r. */ diff --git a/newlib/libc/stdio/getdelim.c b/newlib/libc/stdio/getdelim.c index d806c02cf..4164be5c5 100644 --- a/newlib/libc/stdio/getdelim.c +++ b/newlib/libc/stdio/getdelim.c @@ -41,9 +41,9 @@ No supporting OS subroutines are directly required. ssize_t _DEFUN(__getdelim, (bufptr, n, delim, fp), - char **bufptr _AND - size_t *n _AND - int delim _AND + char **bufptr, + size_t *n, + int delim, FILE *fp) { char *buf; diff --git a/newlib/libc/stdio/getline.c b/newlib/libc/stdio/getline.c index 66ffd1990..b212a8c8f 100644 --- a/newlib/libc/stdio/getline.c +++ b/newlib/libc/stdio/getline.c @@ -38,8 +38,8 @@ extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *)); ssize_t _DEFUN(__getline, (lptr, n, fp), - char **lptr _AND - size_t *n _AND + char **lptr, + size_t *n, FILE *fp) { return __getdelim (lptr, n, '\n', fp); diff --git a/newlib/libc/stdio/gets.c b/newlib/libc/stdio/gets.c index a78d06b89..4e951efe3 100644 --- a/newlib/libc/stdio/gets.c +++ b/newlib/libc/stdio/gets.c @@ -64,7 +64,7 @@ Supporting OS subroutines required: <>, <>, <>, char * _DEFUN(_gets_r, (ptr, buf), - struct _reent *ptr _AND + struct _reent *ptr, char *buf) { register int c; diff --git a/newlib/libc/stdio/getwc.c b/newlib/libc/stdio/getwc.c index 6d88fa869..db9a43768 100644 --- a/newlib/libc/stdio/getwc.c +++ b/newlib/libc/stdio/getwc.c @@ -34,7 +34,7 @@ wint_t _DEFUN(_getwc_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, FILE *fp) { return _fgetwc_r (ptr, fp); diff --git a/newlib/libc/stdio/getwc_u.c b/newlib/libc/stdio/getwc_u.c index 613b69eca..913c3e08b 100644 --- a/newlib/libc/stdio/getwc_u.c +++ b/newlib/libc/stdio/getwc_u.c @@ -35,7 +35,7 @@ wint_t _DEFUN(_getwc_unlocked_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, FILE *fp) { return _fgetwc_unlocked_r (ptr, fp); diff --git a/newlib/libc/stdio/iprintf.c b/newlib/libc/stdio/iprintf.c index c55f7ce17..6c30c4257 100644 --- a/newlib/libc/stdio/iprintf.c +++ b/newlib/libc/stdio/iprintf.c @@ -43,7 +43,7 @@ _DEFUN(iprintf, (fmt), int _DEFUN(_iprintf_r, (ptr, fmt), - struct _reent *ptr _AND + struct _reent *ptr, const char *fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c index ab20a0838..ac1276b48 100644 --- a/newlib/libc/stdio/makebuf.c +++ b/newlib/libc/stdio/makebuf.c @@ -36,7 +36,7 @@ _VOID _DEFUN(__smakebuf_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { register _PTR p; @@ -77,9 +77,9 @@ _DEFUN(__smakebuf_r, (ptr, fp), */ int _DEFUN(__swhatbuf_r, (ptr, fp, bufsize, couldbetty), - struct _reent *ptr _AND - FILE *fp _AND - size_t *bufsize _AND + struct _reent *ptr, + FILE *fp, + size_t *bufsize, int *couldbetty) { #ifdef _FSEEK_OPTIMIZATION diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c index 3ece9ab2c..37092496b 100644 --- a/newlib/libc/stdio/mktemp.c +++ b/newlib/libc/stdio/mktemp.c @@ -140,11 +140,11 @@ Supporting OS subroutines required: <>, <>, <>, <>. static int _DEFUN(_gettemp, (ptr, path, doopen, domkdir, suffixlen, flags), - struct _reent *ptr _AND - char *path _AND - register int *doopen _AND - int domkdir _AND - size_t suffixlen _AND + struct _reent *ptr, + char *path, + register int *doopen, + int domkdir, + size_t suffixlen, int flags) { register char *start, *trv; @@ -264,7 +264,7 @@ _DEFUN(_gettemp, (ptr, path, doopen, domkdir, suffixlen, flags), int _DEFUN(_mkstemp_r, (ptr, path), - struct _reent *ptr _AND + struct _reent *ptr, char *path) { int fd; @@ -275,7 +275,7 @@ _DEFUN(_mkstemp_r, (ptr, path), #if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 4 char * _DEFUN(_mkdtemp_r, (ptr, path), - struct _reent *ptr _AND + struct _reent *ptr, char *path) { return (_gettemp (ptr, path, (int *) NULL, 1, 0, 0) ? path : NULL); @@ -283,8 +283,8 @@ _DEFUN(_mkdtemp_r, (ptr, path), int _DEFUN(_mkstemps_r, (ptr, path, len), - struct _reent *ptr _AND - char *path _AND + struct _reent *ptr, + char *path, int len) { int fd; @@ -294,8 +294,8 @@ _DEFUN(_mkstemps_r, (ptr, path, len), int _DEFUN(_mkostemp_r, (ptr, path, flags), - struct _reent *ptr _AND - char *path _AND + struct _reent *ptr, + char *path, int flags) { int fd; @@ -305,9 +305,9 @@ _DEFUN(_mkostemp_r, (ptr, path, flags), int _DEFUN(_mkostemps_r, (ptr, path, len, flags), - struct _reent *ptr _AND - char *path _AND - int len _AND + struct _reent *ptr, + char *path, + int len, int flags) { int fd; @@ -318,7 +318,7 @@ _DEFUN(_mkostemps_r, (ptr, path, len, flags), char * _DEFUN(_mktemp_r, (ptr, path), - struct _reent *ptr _AND + struct _reent *ptr, char *path) { return (_gettemp (ptr, path, (int *) NULL, 0, 0, 0) ? path : (char *) NULL); @@ -345,7 +345,7 @@ _DEFUN(mkdtemp, (path), int _DEFUN(mkstemps, (path, len), - char *path _AND + char *path, int len) { int fd; @@ -355,7 +355,7 @@ _DEFUN(mkstemps, (path, len), int _DEFUN(mkostemp, (path, flags), - char *path _AND + char *path, int flags) { int fd; @@ -365,8 +365,8 @@ _DEFUN(mkostemp, (path, flags), int _DEFUN(mkostemps, (path, len, flags), - char *path _AND - int len _AND + char *path, + int len, int flags) { int fd; diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index 663eb7149..f01e6a40b 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -183,9 +183,9 @@ static char *rcsid = "$Id$"; #ifdef STRING_ONLY int _DEFUN(__ssputs_r, (ptr, fp, buf, len), - struct _reent *ptr _AND - FILE *fp _AND - _CONST char *buf _AND + struct _reent *ptr, + FILE *fp, + _CONST char *buf, size_t len) { register int w; @@ -254,8 +254,8 @@ err: by a serial of functions like svfwprintf for wide char output. */ int _DEFUN(__ssprint_r, (ptr, fp, uio), - struct _reent *ptr _AND - FILE *fp _AND + struct _reent *ptr, + FILE *fp, register struct __suio *uio) { register size_t len; @@ -358,8 +358,8 @@ err: then reset it so that it can be reused. */ int _DEFUN(__sprint_r, (ptr, fp, uio), - struct _reent *ptr _AND - FILE *fp _AND + struct _reent *ptr, + FILE *fp, register struct __suio *uio) { register int err = 0; @@ -403,8 +403,8 @@ out: _NOINLINE_STATIC int _DEFUN(__sfputc_r, (ptr, c, fp), - struct _reent *ptr _AND - int c _AND + struct _reent *ptr, + int c, FILE *fp) { if (--fp->_w >= 0 || (fp->_w >= fp->_lbfsize && (char)c != '\n')) @@ -415,9 +415,9 @@ _DEFUN(__sfputc_r, (ptr, c, fp), int _DEFUN(__sfputs_r, (ptr, fp, buf, len), - struct _reent *ptr _AND - FILE *fp _AND - _CONST char *buf _AND + struct _reent *ptr, + FILE *fp, + _CONST char *buf, size_t len) { register int i; @@ -453,8 +453,8 @@ int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list)); #ifndef STRING_ONLY int _DEFUN(VFPRINTF, (fp, fmt0, ap), - FILE * fp _AND - _CONST char *fmt0 _AND + FILE * fp, + _CONST char *fmt0, va_list ap) { int result; @@ -482,9 +482,9 @@ _EXFUN(vfiprintf, (FILE *, const char *, __VALIST) int _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data _AND - FILE * fp _AND - _CONST char *fmt0 _AND + struct _reent *data, + FILE * fp, + _CONST char *fmt0, va_list ap) { register char *fmt; /* Format string. */ diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index 6467e5425..99c13f25e 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -145,8 +145,8 @@ Supporting OS subroutines required: int _DEFUN(VFSCANF, (fp, fmt, ap), - register FILE *fp _AND - _CONST char *fmt _AND + register FILE *fp, + _CONST char *fmt, va_list ap) { CHECK_INIT(_REENT, fp); @@ -159,8 +159,8 @@ _EXFUN(vfiscanf, (FILE *, const char *, __VALIST) int _DEFUN(__SVFSCANF, (fp, fmt0, ap), - register FILE *fp _AND - char _CONST *fmt0 _AND + register FILE *fp, + char _CONST *fmt0, va_list ap) { return __SVFSCANF_R (_REENT, fp, fmt0, ap); @@ -170,9 +170,9 @@ _DEFUN(__SVFSCANF, (fp, fmt0, ap), int _DEFUN(_VFSCANF_R, (data, fp, fmt, ap), - struct _reent *data _AND - register FILE *fp _AND - _CONST char *fmt _AND + struct _reent *data, + register FILE *fp, + _CONST char *fmt, va_list ap) { CHECK_INIT(data, fp); @@ -190,8 +190,8 @@ _EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST) So, we create our own trimmed-down version. */ int _DEFUN(_sungetc_r, (data, fp, ch), - struct _reent *data _AND - int c _AND + struct _reent *data, + int c, register FILE *fp) { if (c == EOF) @@ -239,7 +239,7 @@ _DEFUN(_sungetc_r, (data, fp, ch), /* String only version of __srefill_r for sscanf family. */ int _DEFUN(__ssrefill_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, register FILE * fp) { /* Our only hope of further input is the ungetc buffer. @@ -269,9 +269,9 @@ size_t _EXFUN (_sfread_r, (struct _reent *, _PTR buf, size_t, size_t, FILE *)); int _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), - struct _reent *rptr _AND - register FILE *fp _AND - char _CONST *fmt0 _AND + struct _reent *rptr, + register FILE *fp, + char _CONST *fmt0, va_list ap) { register u_char *fmt = (u_char *) fmt0; diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c index 9e6736f77..5dd64115b 100644 --- a/newlib/libc/stdio/open_memstream.c +++ b/newlib/libc/stdio/open_memstream.c @@ -94,9 +94,9 @@ typedef struct memstream { returning the number of bytes written or EOF on failure. */ static _READ_WRITE_RETURN_TYPE _DEFUN(memwriter, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - const char *buf _AND + struct _reent *ptr, + void *cookie, + const char *buf, _READ_WRITE_BUFSIZE_TYPE n) { memstream *c = (memstream *) cookie; @@ -148,9 +148,9 @@ _DEFUN(memwriter, (ptr, cookie, buf, n), COOKIE; return resulting position or fail with EOF. */ static _fpos_t _DEFUN(memseeker, (ptr, cookie, pos, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos_t pos _AND + struct _reent *ptr, + void *cookie, + _fpos_t pos, int whence) { memstream *c = (memstream *) cookie; @@ -216,9 +216,9 @@ _DEFUN(memseeker, (ptr, cookie, pos, whence), #ifdef __LARGE64_FILES static _fpos64_t _DEFUN(memseeker64, (ptr, cookie, pos, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos64_t pos _AND + struct _reent *ptr, + void *cookie, + _fpos64_t pos, int whence) { _off64_t offset = (_off64_t) pos; @@ -276,7 +276,7 @@ _DEFUN(memseeker64, (ptr, cookie, pos, whence), /* Reclaim resources used by stream described by COOKIE. */ static int _DEFUN(memcloser, (ptr, cookie), - struct _reent *ptr _AND + struct _reent *ptr, void *cookie) { memstream *c = (memstream *) cookie; @@ -296,9 +296,9 @@ _DEFUN(memcloser, (ptr, cookie), Return the new stream, or fail with NULL. */ static FILE * _DEFUN(internal_open_memstream_r, (ptr, buf, size, wide), - struct _reent *ptr _AND - char **buf _AND - size_t *size _AND + struct _reent *ptr, + char **buf, + size_t *size, int wide) { FILE *fp; @@ -379,8 +379,8 @@ _DEFUN(internal_open_memstream_r, (ptr, buf, size, wide), FILE * _DEFUN(_open_memstream_r, (ptr, buf, size), - struct _reent *ptr _AND - char **buf _AND + struct _reent *ptr, + char **buf, size_t *size) { return internal_open_memstream_r (ptr, buf, size, -1); @@ -388,8 +388,8 @@ _DEFUN(_open_memstream_r, (ptr, buf, size), FILE * _DEFUN(_open_wmemstream_r, (ptr, buf, size), - struct _reent *ptr _AND - wchar_t **buf _AND + struct _reent *ptr, + wchar_t **buf, size_t *size) { return internal_open_memstream_r (ptr, (char **)buf, size, 1); @@ -398,7 +398,7 @@ _DEFUN(_open_wmemstream_r, (ptr, buf, size), #ifndef _REENT_ONLY FILE * _DEFUN(open_memstream, (buf, size), - char **buf _AND + char **buf, size_t *size) { return _open_memstream_r (_REENT, buf, size); @@ -406,7 +406,7 @@ _DEFUN(open_memstream, (buf, size), FILE * _DEFUN(open_wmemstream, (buf, size), - wchar_t **buf _AND + wchar_t **buf, size_t *size) { return _open_wmemstream_r (_REENT, buf, size); diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c index 0f0259632..cd1829180 100644 --- a/newlib/libc/stdio/perror.c +++ b/newlib/libc/stdio/perror.c @@ -60,7 +60,7 @@ Supporting OS subroutines required: <>, <>, <>, _VOID _DEFUN(_perror_r, (ptr, s), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *s) { char *error; diff --git a/newlib/libc/stdio/printf.c b/newlib/libc/stdio/printf.c index d5dedf906..ba5b76850 100644 --- a/newlib/libc/stdio/printf.c +++ b/newlib/libc/stdio/printf.c @@ -24,7 +24,7 @@ int _DEFUN(_printf_r, (ptr, fmt), - struct _reent *ptr _AND + struct _reent *ptr, const char *__restrict fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/putc.c b/newlib/libc/stdio/putc.c index a00aaad08..e69841d17 100644 --- a/newlib/libc/stdio/putc.c +++ b/newlib/libc/stdio/putc.c @@ -79,8 +79,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_putc_r, (ptr, c, fp), - struct _reent *ptr _AND - int c _AND + struct _reent *ptr, + int c, register FILE *fp) { int result; @@ -94,7 +94,7 @@ _DEFUN(_putc_r, (ptr, c, fp), #ifndef _REENT_ONLY int _DEFUN(putc, (c, fp), - int c _AND + int c, register FILE *fp) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/stdio/putc_u.c b/newlib/libc/stdio/putc_u.c index f710aaf57..b53060bed 100644 --- a/newlib/libc/stdio/putc_u.c +++ b/newlib/libc/stdio/putc_u.c @@ -71,8 +71,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_putc_unlocked_r, (ptr, c, fp), - struct _reent *ptr _AND - int c _AND + struct _reent *ptr, + int c, register FILE *fp) { /* CHECK_INIT is (eventually) called by __swbuf. */ @@ -83,7 +83,7 @@ _DEFUN(_putc_unlocked_r, (ptr, c, fp), #ifndef _REENT_ONLY int _DEFUN(putc_unlocked, (c, fp), - int c _AND + int c, register FILE *fp) { /* CHECK_INIT is (eventually) called by __swbuf. */ diff --git a/newlib/libc/stdio/putchar.c b/newlib/libc/stdio/putchar.c index a4b669832..813144a2b 100644 --- a/newlib/libc/stdio/putchar.c +++ b/newlib/libc/stdio/putchar.c @@ -68,7 +68,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_putchar_r, (ptr, c), - struct _reent *ptr _AND + struct _reent *ptr, int c) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/putchar_u.c b/newlib/libc/stdio/putchar_u.c index a866c7799..e0ed8f7d7 100644 --- a/newlib/libc/stdio/putchar_u.c +++ b/newlib/libc/stdio/putchar_u.c @@ -62,7 +62,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_putchar_unlocked_r, (ptr, c), - struct _reent *ptr _AND + struct _reent *ptr, int c) { return putc_unlocked (c, _stdout_r (ptr)); diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c index 72f929eea..36cc83203 100644 --- a/newlib/libc/stdio/puts.c +++ b/newlib/libc/stdio/puts.c @@ -66,7 +66,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_puts_r, (ptr, s), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char * s) { #ifdef _FVWRITE_IN_STREAMIO diff --git a/newlib/libc/stdio/putw.c b/newlib/libc/stdio/putw.c index d4f785814..1e3c78c3e 100644 --- a/newlib/libc/stdio/putw.c +++ b/newlib/libc/stdio/putw.c @@ -50,7 +50,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(putw, (w, fp), - int w _AND + int w, register FILE *fp) { if (fwrite ((_CONST char*)&w, sizeof (w), 1, fp) != 1) diff --git a/newlib/libc/stdio/putwc.c b/newlib/libc/stdio/putwc.c index 9a84f35fb..7c31d23d8 100644 --- a/newlib/libc/stdio/putwc.c +++ b/newlib/libc/stdio/putwc.c @@ -34,8 +34,8 @@ wint_t _DEFUN(_putwc_r, (ptr, wc, fp), - struct _reent *ptr _AND - wchar_t wc _AND + struct _reent *ptr, + wchar_t wc, FILE *fp) { return _fputwc_r (ptr, wc, fp); @@ -46,7 +46,7 @@ _DEFUN(_putwc_r, (ptr, wc, fp), */ wint_t _DEFUN(putwc, (wc, fp), - wchar_t wc _AND + wchar_t wc, FILE *fp) { return fputwc (wc, fp); diff --git a/newlib/libc/stdio/putwc_u.c b/newlib/libc/stdio/putwc_u.c index bb71acc2a..cb09fd2db 100644 --- a/newlib/libc/stdio/putwc_u.c +++ b/newlib/libc/stdio/putwc_u.c @@ -35,8 +35,8 @@ wint_t _DEFUN(_putwc_unlocked_r, (ptr, wc, fp), - struct _reent *ptr _AND - wchar_t wc _AND + struct _reent *ptr, + wchar_t wc, FILE *fp) { return _fputwc_unlocked_r (ptr, wc, fp); @@ -47,7 +47,7 @@ _DEFUN(_putwc_unlocked_r, (ptr, wc, fp), */ wint_t _DEFUN(putwc_unlocked, (wc, fp), - wchar_t wc _AND + wchar_t wc, FILE *fp) { return fputwc_unlocked (wc, fp); diff --git a/newlib/libc/stdio/putwchar.c b/newlib/libc/stdio/putwchar.c index 248d5922d..66ed30ac0 100644 --- a/newlib/libc/stdio/putwchar.c +++ b/newlib/libc/stdio/putwchar.c @@ -88,7 +88,7 @@ PORTABILITY wint_t _DEFUN(_putwchar_r, (ptr, wc), - struct _reent *ptr _AND + struct _reent *ptr, wchar_t wc) { return _fputwc_r (ptr, wc, stdout); diff --git a/newlib/libc/stdio/putwchar_u.c b/newlib/libc/stdio/putwchar_u.c index 3235472a2..68c5abe26 100644 --- a/newlib/libc/stdio/putwchar_u.c +++ b/newlib/libc/stdio/putwchar_u.c @@ -35,7 +35,7 @@ wint_t _DEFUN(_putwchar_unlocked_r, (ptr, wc), - struct _reent *ptr _AND + struct _reent *ptr, wchar_t wc) { return _fputwc_unlocked_r (ptr, wc, stdout); diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c index 9d853f94d..fc738d455 100644 --- a/newlib/libc/stdio/refill.c +++ b/newlib/libc/stdio/refill.c @@ -38,7 +38,7 @@ _DEFUN(lflush, (fp), int _DEFUN(__srefill_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, register FILE * fp) { /* make sure stdio is set up */ diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c index 7b8d3060f..18c468d61 100644 --- a/newlib/libc/stdio/remove.c +++ b/newlib/libc/stdio/remove.c @@ -60,7 +60,7 @@ Supporting OS subroutine required: <>. int _DEFUN(_remove_r, (ptr, filename), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *filename) { if (_unlink_r (ptr, filename) == -1) diff --git a/newlib/libc/stdio/rename.c b/newlib/libc/stdio/rename.c index 1b807f8b2..a2b0d4188 100644 --- a/newlib/libc/stdio/rename.c +++ b/newlib/libc/stdio/rename.c @@ -55,7 +55,7 @@ Supporting OS subroutines required: <>, <>, or <>. int _DEFUN(rename, (old, new), - _CONST char *old _AND + _CONST char *old, _CONST char *new) { return _rename_r (_REENT, old, new); diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c index 417a5963d..873083b85 100644 --- a/newlib/libc/stdio/rewind.c +++ b/newlib/libc/stdio/rewind.c @@ -53,7 +53,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; _VOID _DEFUN(_rewind_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, register FILE * fp) { _CAST_VOID _fseek_r (ptr, fp, 0L, SEEK_SET); diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c index 9474bd9f6..d76f307d7 100644 --- a/newlib/libc/stdio/rget.c +++ b/newlib/libc/stdio/rget.c @@ -33,7 +33,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(__srget_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE *fp) { /* Ensure that any fake std stream is resolved before diff --git a/newlib/libc/stdio/sccl.c b/newlib/libc/stdio/sccl.c index b01801145..d0bdfd936 100644 --- a/newlib/libc/stdio/sccl.c +++ b/newlib/libc/stdio/sccl.c @@ -32,7 +32,7 @@ u_char * _DEFUN(__sccl, (tab, fmt), - register char *tab _AND + register char *tab, register u_char *fmt) { register int c, n, v; diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c index 29f5377a7..a7df3a1f4 100644 --- a/newlib/libc/stdio/setbuf.c +++ b/newlib/libc/stdio/setbuf.c @@ -66,7 +66,7 @@ Supporting OS subroutines required: <>, <>, <>, _VOID _DEFUN(setbuf, (fp, buf), - FILE *__restrict fp _AND + FILE *__restrict fp, char *__restrict buf) { _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c index 880779d13..cbcbde3db 100644 --- a/newlib/libc/stdio/setbuffer.c +++ b/newlib/libc/stdio/setbuffer.c @@ -66,8 +66,8 @@ Supporting OS subroutines required: <>, <>, <>, _VOID _DEFUN(setbuffer, (fp, buf, size), - FILE * fp _AND - char *buf _AND + FILE * fp, + char *buf, int size) { _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size); diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c index 6fa0252b0..684a8b582 100644 --- a/newlib/libc/stdio/setvbuf.c +++ b/newlib/libc/stdio/setvbuf.c @@ -89,9 +89,9 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(setvbuf, (fp, buf, mode, size), - register FILE * fp _AND - char *buf _AND - register int mode _AND + register FILE * fp, + char *buf, + register int mode, register size_t size) { int ret = 0; diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index d9559c359..861fc8d67 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -105,8 +105,8 @@ Supporting OS subroutines required: <>, <>, <>, int #ifdef _HAVE_STDC _DEFUN(_siprintf_r, (ptr, str, fmt), - struct _reent *ptr _AND - char *str _AND + struct _reent *ptr, + char *str, _CONST char *fmt _DOTS) #else _siprintf_r(ptr, str, fmt, va_alist) @@ -140,7 +140,7 @@ _siprintf_r(ptr, str, fmt, va_alist) int #ifdef _HAVE_STDC _DEFUN(siprintf, (str, fmt), - char *str _AND + char *str, _CONST char *fmt _DOTS) #else siprintf(str, fmt, va_alist) diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c index c89eb7c8d..81d60d0ba 100644 --- a/newlib/libc/stdio/siscanf.c +++ b/newlib/libc/stdio/siscanf.c @@ -88,7 +88,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef _HAVE_STDC int _DEFUN(siscanf, (str, fmt), - _CONST char *str _AND + _CONST char *str, _CONST char *fmt _DOTS) #else int @@ -124,8 +124,8 @@ siscanf(str, fmt, va_alist) #ifdef _HAVE_STDC int _DEFUN(_siscanf_r, (ptr, str, fmt), - struct _reent *ptr _AND - _CONST char *str _AND + struct _reent *ptr, + _CONST char *str, _CONST char *fmt _DOTS) #else int diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c index 98a2c2509..65e5b067f 100644 --- a/newlib/libc/stdio/sniprintf.c +++ b/newlib/libc/stdio/sniprintf.c @@ -33,9 +33,9 @@ int #ifdef _HAVE_STDC _DEFUN (_sniprintf_r, (ptr, str, size, fmt), - struct _reent *ptr _AND - char *str _AND - size_t size _AND + struct _reent *ptr, + char *str, + size_t size, _CONST char *fmt _DOTS) #else _sniprintf_r (ptr, str, size, fmt, va_alist) @@ -78,8 +78,8 @@ _sniprintf_r (ptr, str, size, fmt, va_alist) int #ifdef _HAVE_STDC _DEFUN (sniprintf, (str, size, fmt), - char *str _AND - size_t size _AND + char *str, + size_t size, _CONST char *fmt _DOTS) #else sniprintf (str, size, fmt, va_alist) diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c index d2408b2f0..2066a56ba 100644 --- a/newlib/libc/stdio/snprintf.c +++ b/newlib/libc/stdio/snprintf.c @@ -32,9 +32,9 @@ int #ifdef _HAVE_STDC _DEFUN(_snprintf_r, (ptr, str, size, fmt), - struct _reent *ptr _AND - char *__restrict str _AND - size_t size _AND + struct _reent *ptr, + char *__restrict str, + size_t size, _CONST char *__restrict fmt _DOTS) #else _snprintf_r(ptr, str, size, fmt, va_alist) @@ -83,8 +83,8 @@ _EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...) int #ifdef _HAVE_STDC _DEFUN(snprintf, (str, size, fmt), - char *__restrict str _AND - size_t size _AND + char *__restrict str, + size_t size, _CONST char *__restrict fmt _DOTS) #else snprintf(str, size, fmt, va_alist) diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index 7fc9e6821..7ed0a0fd4 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -581,8 +581,8 @@ Supporting OS subroutines required: <>, <>, <>, int #ifdef _HAVE_STDC _DEFUN(_sprintf_r, (ptr, str, fmt), - struct _reent *ptr _AND - char *__restrict str _AND + struct _reent *ptr, + char *__restrict str, _CONST char *__restrict fmt _DOTS) #else _sprintf_r(ptr, str, fmt, va_alist) @@ -622,7 +622,7 @@ _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...) int #ifdef _HAVE_STDC _DEFUN(sprintf, (str, fmt), - char *__restrict str _AND + char *__restrict str, _CONST char *__restrict fmt _DOTS) #else sprintf(str, fmt, va_alist) diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index d2d9dfe8b..bfec067e9 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -427,7 +427,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef _HAVE_STDC int _DEFUN(sscanf, (str, fmt), - _CONST char *__restrict str _AND + _CONST char *__restrict str, _CONST char * fmt _DOTS) #else int @@ -469,8 +469,8 @@ _EXFUN(siscanf, (const char *, const char *, ...) #ifdef _HAVE_STDC int _DEFUN(_sscanf_r, (ptr, str, fmt), - struct _reent *ptr _AND - _CONST char *__restrict str _AND + struct _reent *ptr, + _CONST char *__restrict str, _CONST char *__restrict fmt _DOTS) #else int diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c index a6e28f5a9..e64c061dd 100644 --- a/newlib/libc/stdio/stdio.c +++ b/newlib/libc/stdio/stdio.c @@ -31,9 +31,9 @@ _READ_WRITE_RETURN_TYPE _DEFUN(__sread, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - char *buf _AND + struct _reent *ptr, + void *cookie, + char *buf, _READ_WRITE_BUFSIZE_TYPE n) { register FILE *fp = (FILE *) cookie; @@ -64,9 +64,9 @@ _DEFUN(__sread, (ptr, cookie, buf, n), /* Dummy function used in sscanf/swscanf. */ _READ_WRITE_RETURN_TYPE _DEFUN(__seofread, (ptr, cookie, buf, len), - struct _reent *_ptr _AND - _PTR cookie _AND - char *buf _AND + struct _reent *_ptr, + _PTR cookie, + char *buf, _READ_WRITE_BUFSIZE_TYPE len) { return 0; @@ -74,9 +74,9 @@ _DEFUN(__seofread, (ptr, cookie, buf, len), _READ_WRITE_RETURN_TYPE _DEFUN(__swrite, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - char const *buf _AND + struct _reent *ptr, + void *cookie, + char const *buf, _READ_WRITE_BUFSIZE_TYPE n) { register FILE *fp = (FILE *) cookie; @@ -106,9 +106,9 @@ _DEFUN(__swrite, (ptr, cookie, buf, n), _fpos_t _DEFUN(__sseek, (ptr, cookie, offset, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos_t offset _AND + struct _reent *ptr, + void *cookie, + _fpos_t offset, int whence) { register FILE *fp = (FILE *) cookie; @@ -127,7 +127,7 @@ _DEFUN(__sseek, (ptr, cookie, offset, whence), int _DEFUN(__sclose, (ptr, cookie), - struct _reent *ptr _AND + struct _reent *ptr, void *cookie) { FILE *fp = (FILE *) cookie; diff --git a/newlib/libc/stdio/swprintf.c b/newlib/libc/stdio/swprintf.c index fe106f036..0ddc492ee 100644 --- a/newlib/libc/stdio/swprintf.c +++ b/newlib/libc/stdio/swprintf.c @@ -554,9 +554,9 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_swprintf_r, (ptr, str, size, fmt), - struct _reent *ptr _AND - wchar_t *str _AND - size_t size _AND + struct _reent *ptr, + wchar_t *str, + size_t size, _CONST wchar_t *fmt _DOTS) { int ret; @@ -595,8 +595,8 @@ _DEFUN(_swprintf_r, (ptr, str, size, fmt), int _DEFUN(swprintf, (str, size, fmt), - wchar_t *__restrict str _AND - size_t size _AND + wchar_t *__restrict str, + size_t size, _CONST wchar_t *__restrict fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c index 765d27afd..fbd60fc7c 100644 --- a/newlib/libc/stdio/tmpnam.c +++ b/newlib/libc/stdio/tmpnam.c @@ -87,11 +87,11 @@ The global pointer <> is also required. static int _DEFUN(worker, (ptr, result, part1, part2, part3, part4), - struct _reent *ptr _AND - char *result _AND - _CONST char *part1 _AND - _CONST char *part2 _AND - int part3 _AND + struct _reent *ptr, + char *result, + _CONST char *part1, + _CONST char *part2, + int part3, int *part4) { /* Generate the filename and make sure that there isn't one called @@ -119,7 +119,7 @@ _DEFUN(worker, (ptr, result, part1, part2, part3, part4), char * _DEFUN(_tmpnam_r, (p, s), - struct _reent *p _AND + struct _reent *p, char *s) { char *result; @@ -148,8 +148,8 @@ _DEFUN(_tmpnam_r, (p, s), char * _DEFUN(_tempnam_r, (p, dir, pfx), - struct _reent *p _AND - _CONST char *dir _AND + struct _reent *p, + _CONST char *dir, _CONST char *pfx) { char *filename; @@ -175,7 +175,7 @@ _DEFUN(_tempnam_r, (p, dir, pfx), char * _DEFUN(tempnam, (dir, pfx), - _CONST char *dir _AND + _CONST char *dir, _CONST char *pfx) { return _tempnam_r (_REENT, dir, pfx); diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c index da4b19d3c..98590478b 100644 --- a/newlib/libc/stdio/ungetc.c +++ b/newlib/libc/stdio/ungetc.c @@ -78,7 +78,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; /*static*/ int _DEFUN(__submore, (rptr, fp), - struct _reent *rptr _AND + struct _reent *rptr, register FILE *fp) { register int i; @@ -112,8 +112,8 @@ _DEFUN(__submore, (rptr, fp), int _DEFUN(_ungetc_r, (rptr, c, fp), - struct _reent *rptr _AND - int c _AND + struct _reent *rptr, + int c, register FILE *fp) { if (c == EOF) @@ -209,7 +209,7 @@ _DEFUN(_ungetc_r, (rptr, c, fp), #ifndef _REENT_ONLY int _DEFUN(ungetc, (c, fp), - int c _AND + int c, register FILE *fp) { return _ungetc_r (_REENT, c, fp); diff --git a/newlib/libc/stdio/ungetwc.c b/newlib/libc/stdio/ungetwc.c index 000d4bdbb..60f3e5b49 100644 --- a/newlib/libc/stdio/ungetwc.c +++ b/newlib/libc/stdio/ungetwc.c @@ -75,8 +75,8 @@ C99 wint_t _DEFUN(_ungetwc_r, (ptr, wc, fp), - struct _reent *ptr _AND - wint_t wc _AND + struct _reent *ptr, + wint_t wc, register FILE *fp) { char buf[MB_LEN_MAX]; @@ -107,7 +107,7 @@ _DEFUN(_ungetwc_r, (ptr, wc, fp), */ wint_t _DEFUN(ungetwc, (wint_t wc, FILE *fp), - wint_t wc _AND + wint_t wc, FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/vasiprintf.c b/newlib/libc/stdio/vasiprintf.c index f96de0d79..259d44b0e 100644 --- a/newlib/libc/stdio/vasiprintf.c +++ b/newlib/libc/stdio/vasiprintf.c @@ -32,8 +32,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(vasiprintf, (strp, fmt, ap), - char **strp _AND - const char *fmt _AND + char **strp, + const char *fmt, va_list ap) { return _vasiprintf_r (_REENT, strp, fmt, ap); @@ -43,9 +43,9 @@ _DEFUN(vasiprintf, (strp, fmt, ap), int _DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap), - struct _reent *ptr _AND - char **strp _AND - const char *fmt _AND + struct _reent *ptr, + char **strp, + const char *fmt, va_list ap) { int ret; diff --git a/newlib/libc/stdio/vasniprintf.c b/newlib/libc/stdio/vasniprintf.c index 56db45ec0..9bbe30c59 100644 --- a/newlib/libc/stdio/vasniprintf.c +++ b/newlib/libc/stdio/vasniprintf.c @@ -15,10 +15,10 @@ char * _DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap), - struct _reent *ptr _AND - char *buf _AND - size_t *lenp _AND - const char *fmt _AND + struct _reent *ptr, + char *buf, + size_t *lenp, + const char *fmt, va_list ap) { int ret; @@ -60,9 +60,9 @@ _DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap), char * _DEFUN(vasniprintf, (buf, lenp, fmt, ap), - char *buf _AND - size_t *lenp _AND - const char *fmt _AND + char *buf, + size_t *lenp, + const char *fmt, va_list ap) { return _vasniprintf_r (_REENT, buf, lenp, fmt, ap); diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c index 4cb43ce7a..6edb47398 100644 --- a/newlib/libc/stdio/vasnprintf.c +++ b/newlib/libc/stdio/vasnprintf.c @@ -15,10 +15,10 @@ char * _DEFUN(_vasnprintf_r, (ptr, buf, lenp, fmt, ap), - struct _reent *ptr _AND - char *buf _AND - size_t *lenp _AND - const char *fmt _AND + struct _reent *ptr, + char *buf, + size_t *lenp, + const char *fmt, va_list ap) { int ret; @@ -67,9 +67,9 @@ _EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, char * _DEFUN(vasnprintf, (buf, lenp, fmt, ap), - char *buf _AND - size_t *lenp _AND - const char *fmt _AND + char *buf, + size_t *lenp, + const char *fmt, va_list ap) { return _vasnprintf_r (_REENT, buf, lenp, fmt, ap); diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c index 5ba817d7b..c0961de01 100644 --- a/newlib/libc/stdio/vasprintf.c +++ b/newlib/libc/stdio/vasprintf.c @@ -32,8 +32,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(vasprintf, (strp, fmt, ap), - char **strp _AND - const char *fmt _AND + char **strp, + const char *fmt, va_list ap) { return _vasprintf_r (_REENT, strp, fmt, ap); @@ -49,9 +49,9 @@ _EXFUN(vasiprintf, (char **, const char *, __VALIST) int _DEFUN(_vasprintf_r, (ptr, strp, fmt, ap), - struct _reent *ptr _AND - char **strp _AND - const char *fmt _AND + struct _reent *ptr, + char **strp, + const char *fmt, va_list ap) { int ret; diff --git a/newlib/libc/stdio/vdiprintf.c b/newlib/libc/stdio/vdiprintf.c index 51bdb000e..73a3b19d1 100644 --- a/newlib/libc/stdio/vdiprintf.c +++ b/newlib/libc/stdio/vdiprintf.c @@ -14,9 +14,9 @@ int _DEFUN(_vdiprintf_r, (ptr, fd, format, ap), - struct _reent *ptr _AND - int fd _AND - const char *format _AND + struct _reent *ptr, + int fd, + const char *format, va_list ap) { char *p; @@ -37,8 +37,8 @@ _DEFUN(_vdiprintf_r, (ptr, fd, format, ap), int _DEFUN(vdiprintf, (fd, format, ap), - int fd _AND - const char *format _AND + int fd, + const char *format, va_list ap) { return _vdiprintf_r (_REENT, fd, format, ap); diff --git a/newlib/libc/stdio/vdprintf.c b/newlib/libc/stdio/vdprintf.c index c295a3959..1b50e8833 100644 --- a/newlib/libc/stdio/vdprintf.c +++ b/newlib/libc/stdio/vdprintf.c @@ -14,9 +14,9 @@ int _DEFUN(_vdprintf_r, (ptr, fd, format, ap), - struct _reent *ptr _AND - int fd _AND - const char *__restrict format _AND + struct _reent *ptr, + int fd, + const char *__restrict format, va_list ap) { char *p; @@ -43,8 +43,8 @@ _EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST) int _DEFUN(vdprintf, (fd, format, ap), - int fd _AND - const char *__restrict format _AND + int fd, + const char *__restrict format, va_list ap) { return _vdprintf_r (_REENT, fd, format, ap); diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 211cb17bb..904dfa79e 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -199,9 +199,9 @@ static char *rcsid = "$Id$"; #ifndef _FVWRITE_IN_STREAMIO int _DEFUN(__ssputs_r, (ptr, fp, buf, len), - struct _reent *ptr _AND - FILE *fp _AND - _CONST char *buf _AND + struct _reent *ptr, + FILE *fp, + _CONST char *buf, size_t len) { register int w; @@ -268,8 +268,8 @@ err: int _DEFUN(__ssprint_r, (ptr, fp, uio), - struct _reent *ptr _AND - FILE *fp _AND + struct _reent *ptr, + FILE *fp, register struct __suio *uio) { register size_t len; @@ -370,9 +370,9 @@ int __ssprint_r (struct _reent *, FILE *, register struct __suio *); #ifndef _FVWRITE_IN_STREAMIO int _DEFUN(__sfputs_r, (ptr, fp, buf, len), - struct _reent *ptr _AND - FILE *fp _AND - _CONST char *buf _AND + struct _reent *ptr, + FILE *fp, + _CONST char *buf, size_t len) { register int i; @@ -404,8 +404,8 @@ _DEFUN(__sfputs_r, (ptr, fp, buf, len), */ int _DEFUN(__sprint_r, (ptr, fp, uio), - struct _reent *ptr _AND - FILE *fp _AND + struct _reent *ptr, + FILE *fp, register struct __suio *uio) { register int err = 0; @@ -457,9 +457,9 @@ int __sprint_r (struct _reent *, FILE *, register struct __suio *); */ _NOINLINE_STATIC int _DEFUN(__sbprintf, (rptr, fp, fmt, ap), - struct _reent *rptr _AND - register FILE *fp _AND - _CONST char *fmt _AND + struct _reent *rptr, + register FILE *fp, + _CONST char *fmt, va_list ap) { int ret; @@ -649,8 +649,8 @@ int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list)); #ifndef STRING_ONLY int _DEFUN(VFPRINTF, (fp, fmt0, ap), - FILE * fp _AND - _CONST char *fmt0 _AND + FILE * fp, + _CONST char *fmt0, va_list ap) { int result; @@ -661,9 +661,9 @@ _DEFUN(VFPRINTF, (fp, fmt0, ap), int _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data _AND - FILE * fp _AND - _CONST char *fmt0 _AND + struct _reent *data, + FILE * fp, + _CONST char *fmt0, va_list ap) { register char *fmt; /* format string */ @@ -2044,13 +2044,13 @@ _CONST __ACTION __action_table[MAX_STATE][MAX_CH_CLASS] = { /* function to get positional parameter N where n = N - 1 */ static union arg_val * _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), - struct _reent *data _AND - int n _AND - char *fmt _AND - va_list *ap _AND - int *numargs_p _AND - union arg_val *args _AND - int *arg_type _AND + struct _reent *data, + int n, + char *fmt, + va_list *ap, + int *numargs_p, + union arg_val *args, + int *arg_type, char **last_fmt) { int ch; diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index b1453452c..3f67b2304 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -225,8 +225,8 @@ typedef unsigned long long u_long_long; int _DEFUN(VFSCANF, (fp, fmt, ap), - register FILE *fp _AND - _CONST char *fmt _AND + register FILE *fp, + _CONST char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -237,8 +237,8 @@ _DEFUN(VFSCANF, (fp, fmt, ap), int _DEFUN(__SVFSCANF, (fp, fmt0, ap), - register FILE *fp _AND - char _CONST *fmt0 _AND + register FILE *fp, + char _CONST *fmt0, va_list ap) { return __SVFSCANF_R (_REENT, fp, fmt0, ap); @@ -248,9 +248,9 @@ _DEFUN(__SVFSCANF, (fp, fmt0, ap), int _DEFUN(_VFSCANF_R, (data, fp, fmt, ap), - struct _reent *data _AND - register FILE *fp _AND - _CONST char *fmt _AND + struct _reent *data, + register FILE *fp, + _CONST char *fmt, va_list ap) { CHECK_INIT(data, fp); @@ -264,8 +264,8 @@ _DEFUN(_VFSCANF_R, (data, fp, fmt, ap), * So, we create our own trimmed-down version. */ int _DEFUN(_sungetc_r, (data, fp, ch), - struct _reent *data _AND - int c _AND + struct _reent *data, + int c, register FILE *fp) { if (c == EOF) @@ -322,7 +322,7 @@ _DEFUN(_sungetc_r, (data, fp, ch), /* String only version of __srefill_r for sscanf family. */ int _DEFUN(__ssrefill_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, register FILE * fp) { /* @@ -348,10 +348,10 @@ _DEFUN(__ssrefill_r, (ptr, fp), size_t _DEFUN(_sfread_r, (ptr, buf, size, count, fp), - struct _reent * ptr _AND - _PTR buf _AND - size_t size _AND - size_t count _AND + struct _reent * ptr, + _PTR buf, + size_t size, + size_t count, FILE * fp) { register size_t resid; @@ -403,9 +403,9 @@ __wctob (struct _reent *rptr, wint_t wc) int _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), - struct _reent *rptr _AND - register FILE *fp _AND - char _CONST *fmt0 _AND + struct _reent *rptr, + register FILE *fp, + char _CONST *fmt0, va_list ap) { register u_char *fmt = (u_char *) fmt0; diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index 9c421d267..7339ffe53 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -175,9 +175,9 @@ int _EXFUN(__SPRINT, (struct _reent *, FILE *, _CONST char *, size_t)); */ static int _DEFUN(__sbwprintf, (rptr, fp, fmt, ap), - struct _reent *rptr _AND - register FILE *fp _AND - _CONST wchar_t *fmt _AND + struct _reent *rptr, + register FILE *fp, + _CONST wchar_t *fmt, va_list ap) { int ret; @@ -367,8 +367,8 @@ _EXFUN(get_arg, (struct _reent *data, int n, wchar_t *fmt, #ifndef STRING_ONLY int _DEFUN(VFWPRINTF, (fp, fmt0, ap), - FILE *__restrict fp _AND - _CONST wchar_t *__restrict fmt0 _AND + FILE *__restrict fp, + _CONST wchar_t *__restrict fmt0, va_list ap) { int result; @@ -379,9 +379,9 @@ _DEFUN(VFWPRINTF, (fp, fmt0, ap), int _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data _AND - FILE * fp _AND - _CONST wchar_t *fmt0 _AND + struct _reent *data, + FILE * fp, + _CONST wchar_t *fmt0, va_list ap) { register wchar_t *fmt; /* format string */ @@ -1735,13 +1735,13 @@ wexponent(wchar_t *p0, int exp, int fmtch) /* function to get positional parameter N where n = N - 1 */ static union arg_val * _DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), - struct _reent *data _AND - int n _AND - wchar_t *fmt _AND - va_list *ap _AND - int *numargs_p _AND - union arg_val *args _AND - int *arg_type _AND + struct _reent *data, + int n, + wchar_t *fmt, + va_list *ap, + int *numargs_p, + union arg_val *args, + int *arg_type, wchar_t **last_fmt) { wchar_t ch; diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index a286464e6..715f231e3 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -227,8 +227,8 @@ static void * get_arg (int, va_list *, int *, void **); int _DEFUN(VFWSCANF, (fp, fmt, ap), - register FILE *__restrict fp _AND - _CONST wchar_t *__restrict fmt _AND + register FILE *__restrict fp, + _CONST wchar_t *__restrict fmt, va_list ap) { struct _reent *reent = _REENT; @@ -239,8 +239,8 @@ _DEFUN(VFWSCANF, (fp, fmt, ap), int _DEFUN(__SVFWSCANF, (fp, fmt0, ap), - register FILE *fp _AND - wchar_t _CONST *fmt0 _AND + register FILE *fp, + wchar_t _CONST *fmt0, va_list ap) { return __SVFWSCANF_R (_REENT, fp, fmt0, ap); @@ -250,9 +250,9 @@ _DEFUN(__SVFWSCANF, (fp, fmt0, ap), int _DEFUN(_VFWSCANF_R, (data, fp, fmt, ap), - struct _reent *data _AND - register FILE *fp _AND - _CONST wchar_t *fmt _AND + struct _reent *data, + register FILE *fp, + _CONST wchar_t *fmt, va_list ap) { CHECK_INIT(data, fp); @@ -266,8 +266,8 @@ _DEFUN(_VFWSCANF_R, (data, fp, fmt, ap), * So, we create our own trimmed-down version. */ static wint_t _DEFUN(_sungetwc_r, (data, fp, ch), - struct _reent *data _AND - wint_t wc _AND + struct _reent *data, + wint_t wc, register FILE *fp) { if (wc == WEOF) @@ -326,7 +326,7 @@ extern int __ssrefill_r _PARAMS ((struct _reent *ptr, register FILE * fp)); static size_t _DEFUN(_sfgetwc_r, (ptr, fp), - struct _reent * ptr _AND + struct _reent * ptr, FILE * fp) { wchar_t wc; @@ -342,9 +342,9 @@ _DEFUN(_sfgetwc_r, (ptr, fp), int _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), - struct _reent *rptr _AND - register FILE *fp _AND - wchar_t _CONST *fmt0 _AND + struct _reent *rptr, + register FILE *fp, + wchar_t _CONST *fmt0, va_list ap) { register wchar_t *fmt = (wchar_t *) fmt0; diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c index 85ae286bb..ef2a04e2f 100644 --- a/newlib/libc/stdio/viprintf.c +++ b/newlib/libc/stdio/viprintf.c @@ -106,7 +106,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(viprintf, (fmt, ap), - _CONST char *fmt _AND + _CONST char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -119,8 +119,8 @@ _DEFUN(viprintf, (fmt, ap), int _DEFUN(_viprintf_r, (ptr, fmt, ap), - struct _reent *ptr _AND - _CONST char *fmt _AND + struct _reent *ptr, + _CONST char *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c index 379daa232..569fad91c 100644 --- a/newlib/libc/stdio/viscanf.c +++ b/newlib/libc/stdio/viscanf.c @@ -90,7 +90,7 @@ Supporting OS subroutines required: int _DEFUN(viscanf, (fmt, ap), - _CONST char *fmt _AND + _CONST char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -103,8 +103,8 @@ _DEFUN(viscanf, (fmt, ap), int _DEFUN(_viscanf_r, (ptr, fmt, ap), - struct _reent *ptr _AND - _CONST char *fmt _AND + struct _reent *ptr, + _CONST char *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c index 00b8023b7..26671f70c 100644 --- a/newlib/libc/stdio/vprintf.c +++ b/newlib/libc/stdio/vprintf.c @@ -30,7 +30,7 @@ int _DEFUN(vprintf, (fmt, ap), - _CONST char *fmt _AND + _CONST char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -48,8 +48,8 @@ _EXFUN(viprintf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vprintf")))); int _DEFUN(_vprintf_r, (ptr, fmt, ap), - struct _reent *ptr _AND - _CONST char *__restrict fmt _AND + struct _reent *ptr, + _CONST char *__restrict fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c index 4371e23a7..2506919c4 100644 --- a/newlib/libc/stdio/vscanf.c +++ b/newlib/libc/stdio/vscanf.c @@ -31,7 +31,7 @@ int _DEFUN(vscanf, (fmt, ap), - _CONST char *fmt _AND + _CONST char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -49,8 +49,8 @@ _EXFUN(viscanf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vscanf")))); int _DEFUN(_vscanf_r, (ptr, fmt, ap), - struct _reent *ptr _AND - _CONST char *__restrict fmt _AND + struct _reent *ptr, + _CONST char *__restrict fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vsiprintf.c b/newlib/libc/stdio/vsiprintf.c index 150b4e7d0..ff83b7856 100644 --- a/newlib/libc/stdio/vsiprintf.c +++ b/newlib/libc/stdio/vsiprintf.c @@ -32,8 +32,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(vsiprintf, (str, fmt, ap), - char *str _AND - const char *fmt _AND + char *str, + const char *fmt, va_list ap) { return _vsiprintf_r (_REENT, str, fmt, ap); @@ -43,9 +43,9 @@ _DEFUN(vsiprintf, (str, fmt, ap), int _DEFUN(_vsiprintf_r, (ptr, str, fmt, ap), - struct _reent *ptr _AND - char *str _AND - const char *fmt _AND + struct _reent *ptr, + char *str, + const char *fmt, va_list ap) { int ret; diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c index 01295995e..cf5120fa3 100644 --- a/newlib/libc/stdio/vsiscanf.c +++ b/newlib/libc/stdio/vsiscanf.c @@ -36,8 +36,8 @@ int _DEFUN(vsiscanf, (str, fmt, ap), - _CONST char *str _AND - _CONST char *fmt _AND + _CONST char *str, + _CONST char *fmt, va_list ap) { return _vsiscanf_r (_REENT, str, fmt, ap); @@ -47,9 +47,9 @@ _DEFUN(vsiscanf, (str, fmt, ap), int _DEFUN(_vsiscanf_r, (ptr, str, fmt, ap), - struct _reent *ptr _AND - _CONST char *str _AND - _CONST char *fmt _AND + struct _reent *ptr, + _CONST char *str, + _CONST char *fmt, va_list ap) { FILE f; diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c index c4305c1a9..e60f779ca 100644 --- a/newlib/libc/stdio/vsniprintf.c +++ b/newlib/libc/stdio/vsniprintf.c @@ -33,9 +33,9 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(vsniprintf, (str, size, fmt, ap), - char *str _AND - size_t size _AND - const char *fmt _AND + char *str, + size_t size, + const char *fmt, va_list ap) { return _vsniprintf_r (_REENT, str, size, fmt, ap); @@ -45,10 +45,10 @@ _DEFUN(vsniprintf, (str, size, fmt, ap), int _DEFUN(_vsniprintf_r, (ptr, str, size, fmt, ap), - struct _reent *ptr _AND - char *str _AND - size_t size _AND - const char *fmt _AND + struct _reent *ptr, + char *str, + size_t size, + const char *fmt, va_list ap) { int ret; diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c index e08f267bd..dda45256a 100644 --- a/newlib/libc/stdio/vsnprintf.c +++ b/newlib/libc/stdio/vsnprintf.c @@ -33,9 +33,9 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(vsnprintf, (str, size, fmt, ap), - char *__restrict str _AND - size_t size _AND - const char *__restrict fmt _AND + char *__restrict str, + size_t size, + const char *__restrict fmt, va_list ap) { return _vsnprintf_r (_REENT, str, size, fmt, ap); @@ -51,10 +51,10 @@ _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST) int _DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap), - struct _reent *ptr _AND - char *__restrict str _AND - size_t size _AND - const char *__restrict fmt _AND + struct _reent *ptr, + char *__restrict str, + size_t size, + const char *__restrict fmt, va_list ap) { int ret; diff --git a/newlib/libc/stdio/vsprintf.c b/newlib/libc/stdio/vsprintf.c index 742cde0df..4940b974e 100644 --- a/newlib/libc/stdio/vsprintf.c +++ b/newlib/libc/stdio/vsprintf.c @@ -32,8 +32,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(vsprintf, (str, fmt, ap), - char *__restrict str _AND - const char *__restrict fmt _AND + char *__restrict str, + const char *__restrict fmt, va_list ap) { return _vsprintf_r (_REENT, str, fmt, ap); @@ -49,9 +49,9 @@ _EXFUN(vsiprintf, (char *, const char *, __VALIST) int _DEFUN(_vsprintf_r, (ptr, str, fmt, ap), - struct _reent *ptr _AND - char *__restrict str _AND - const char *__restrict fmt _AND + struct _reent *ptr, + char *__restrict str, + const char *__restrict fmt, va_list ap) { int ret; diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c index 1660fa1cf..706461d47 100644 --- a/newlib/libc/stdio/vsscanf.c +++ b/newlib/libc/stdio/vsscanf.c @@ -36,8 +36,8 @@ int _DEFUN(vsscanf, (str, fmt, ap), - _CONST char *__restrict str _AND - _CONST char *__restrict fmt _AND + _CONST char *__restrict str, + _CONST char *__restrict fmt, va_list ap) { return _vsscanf_r (_REENT, str, fmt, ap); @@ -53,9 +53,9 @@ _EXFUN(vsiscanf, (const char *, const char *, __VALIST) int _DEFUN(_vsscanf_r, (ptr, str, fmt, ap), - struct _reent *ptr _AND - _CONST char *__restrict str _AND - _CONST char *__restrict fmt _AND + struct _reent *ptr, + _CONST char *__restrict str, + _CONST char *__restrict fmt, va_list ap) { FILE f; diff --git a/newlib/libc/stdio/vswprintf.c b/newlib/libc/stdio/vswprintf.c index ac321b662..9c9127cd6 100644 --- a/newlib/libc/stdio/vswprintf.c +++ b/newlib/libc/stdio/vswprintf.c @@ -32,10 +32,10 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_vswprintf_r, (ptr, str, size, fmt, ap), - struct _reent *ptr _AND - wchar_t *str _AND - size_t size _AND - const wchar_t *fmt _AND + struct _reent *ptr, + wchar_t *str, + size_t size, + const wchar_t *fmt, va_list ap) { int ret; @@ -71,9 +71,9 @@ _DEFUN(_vswprintf_r, (ptr, str, size, fmt, ap), int _DEFUN(vswprintf, (str, size, fmt, ap), - wchar_t *__restrict str _AND - size_t size _AND - const wchar_t *__restrict fmt _AND + wchar_t *__restrict str, + size_t size, + const wchar_t *__restrict fmt, va_list ap) { return _vswprintf_r (_REENT, str, size, fmt, ap); diff --git a/newlib/libc/stdio/vwprintf.c b/newlib/libc/stdio/vwprintf.c index 51d1df3a9..191fb70c9 100644 --- a/newlib/libc/stdio/vwprintf.c +++ b/newlib/libc/stdio/vwprintf.c @@ -27,7 +27,7 @@ int _DEFUN(vwprintf, (fmt, ap), - _CONST wchar_t *__restrict fmt _AND + _CONST wchar_t *__restrict fmt, va_list ap) { struct _reent *reent = _REENT; @@ -40,8 +40,8 @@ _DEFUN(vwprintf, (fmt, ap), int _DEFUN(_vwprintf_r, (ptr, fmt, ap), - struct _reent *ptr _AND - _CONST wchar_t *fmt _AND + struct _reent *ptr, + _CONST wchar_t *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/wbuf.c b/newlib/libc/stdio/wbuf.c index f9197ea9e..13578ea33 100644 --- a/newlib/libc/stdio/wbuf.c +++ b/newlib/libc/stdio/wbuf.c @@ -34,8 +34,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(__swbuf_r, (ptr, c, fp), - struct _reent *ptr _AND - register int c _AND + struct _reent *ptr, + register int c, register FILE *fp) { register int n; @@ -89,7 +89,7 @@ _DEFUN(__swbuf_r, (ptr, c, fp), earlier dynamically built newlib libraries. */ int _DEFUN(__swbuf, (c, fp), - register int c _AND + register int c, register FILE *fp) { return __swbuf_r (_REENT, c, fp); diff --git a/newlib/libc/stdio/wprintf.c b/newlib/libc/stdio/wprintf.c index e05ba1013..99c5696df 100644 --- a/newlib/libc/stdio/wprintf.c +++ b/newlib/libc/stdio/wprintf.c @@ -25,7 +25,7 @@ int _DEFUN(_wprintf_r, (ptr, fmt), - struct _reent *ptr _AND + struct _reent *ptr, const wchar_t *fmt _DOTS) { int ret; diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c index 08ae70f2c..72280d2df 100644 --- a/newlib/libc/stdio/wsetup.c +++ b/newlib/libc/stdio/wsetup.c @@ -31,7 +31,7 @@ int _DEFUN(__swsetup_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE * fp) { /* Make sure stdio is set up. */ diff --git a/newlib/libc/stdio64/fdopen64.c b/newlib/libc/stdio64/fdopen64.c index f386583ca..1a238f732 100644 --- a/newlib/libc/stdio64/fdopen64.c +++ b/newlib/libc/stdio64/fdopen64.c @@ -36,8 +36,8 @@ extern int __sflags (); FILE * _DEFUN (_fdopen64_r, (ptr, fd, mode), - struct _reent *ptr _AND - int fd _AND + struct _reent *ptr, + int fd, _CONST char *mode) { register FILE *fp; @@ -109,7 +109,7 @@ _DEFUN (_fdopen64_r, (ptr, fd, mode), FILE * _DEFUN (fdopen64, (fd, mode), - int fd _AND + int fd, _CONST char *mode) { return _fdopen64_r (_REENT, fd, mode); diff --git a/newlib/libc/stdio64/fgetpos64.c b/newlib/libc/stdio64/fgetpos64.c index a1d0a3724..e2dd28914 100644 --- a/newlib/libc/stdio64/fgetpos64.c +++ b/newlib/libc/stdio64/fgetpos64.c @@ -46,8 +46,8 @@ No supporting OS subroutines are required. int _DEFUN (_fgetpos64_r, (ptr, fp, pos), - struct _reent * ptr _AND - FILE * fp _AND + struct _reent * ptr, + FILE * fp, _fpos64_t * pos) { *pos = (_fpos64_t)_ftello64_r (ptr, fp); @@ -63,7 +63,7 @@ _DEFUN (_fgetpos64_r, (ptr, fp, pos), int _DEFUN (fgetpos64, (fp, pos), - FILE * fp _AND + FILE * fp, _fpos64_t * pos) { return _fgetpos64_r (_REENT, fp, pos); diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c index 60ac73fda..7edb5d807 100644 --- a/newlib/libc/stdio64/fopen64.c +++ b/newlib/libc/stdio64/fopen64.c @@ -65,8 +65,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; FILE * _DEFUN (_fopen64_r, (ptr, file, mode), - struct _reent *ptr _AND - _CONST char *file _AND + struct _reent *ptr, + _CONST char *file, _CONST char *mode) { register FILE *fp; @@ -118,7 +118,7 @@ _DEFUN (_fopen64_r, (ptr, file, mode), FILE * _DEFUN (fopen64, (file, mode), - _CONST char *file _AND + _CONST char *file, _CONST char *mode) { return _fopen64_r (_REENT, file, mode); diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c index 379462c31..6e42d0e3b 100644 --- a/newlib/libc/stdio64/freopen64.c +++ b/newlib/libc/stdio64/freopen64.c @@ -76,9 +76,9 @@ Supporting OS subroutines required: <>, <>, <>, FILE * _DEFUN (_freopen64_r, (ptr, file, mode, fp), - struct _reent *ptr _AND - _CONST char *file _AND - _CONST char *mode _AND + struct _reent *ptr, + _CONST char *file, + _CONST char *mode, register FILE *fp) { register int f; @@ -248,8 +248,8 @@ _DEFUN (_freopen64_r, (ptr, file, mode, fp), FILE * _DEFUN (freopen64, (file, mode, fp), - _CONST char *file _AND - _CONST char *mode _AND + _CONST char *file, + _CONST char *mode, register FILE *fp) { return _freopen64_r (_REENT, file, mode, fp); diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c index 624e91275..8cd11fa67 100644 --- a/newlib/libc/stdio64/fseeko64.c +++ b/newlib/libc/stdio64/fseeko64.c @@ -86,9 +86,9 @@ Supporting OS subroutines required: <>, <>, <>, _off64_t _DEFUN (_fseeko64_r, (ptr, fp, offset, whence), - struct _reent *ptr _AND - register FILE *fp _AND - _off64_t offset _AND + struct _reent *ptr, + register FILE *fp, + _off64_t offset, int whence) { _fpos64_t _EXFNPTR(seekfn, (struct _reent *, void *, _fpos64_t, int)); @@ -343,8 +343,8 @@ dumb: _off64_t _DEFUN (fseeko64, (fp, offset, whence), - register FILE *fp _AND - _off64_t offset _AND + register FILE *fp, + _off64_t offset, int whence) { return _fseeko64_r (_REENT, fp, offset, whence); diff --git a/newlib/libc/stdio64/fsetpos64.c b/newlib/libc/stdio64/fsetpos64.c index 83d99627d..9cfc10733 100644 --- a/newlib/libc/stdio64/fsetpos64.c +++ b/newlib/libc/stdio64/fsetpos64.c @@ -42,8 +42,8 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN (_fsetpos64_r, (ptr, iop, pos), - struct _reent *ptr _AND - FILE * iop _AND + struct _reent *ptr, + FILE * iop, _CONST _fpos64_t * pos) { int x = _fseeko64_r (ptr, iop, (_off64_t)(*pos), SEEK_SET); @@ -57,7 +57,7 @@ _DEFUN (_fsetpos64_r, (ptr, iop, pos), int _DEFUN (fsetpos64, (iop, pos), - FILE * iop _AND + FILE * iop, _CONST _fpos64_t * pos) { return _fsetpos64_r (_REENT, iop, pos); diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c index 2441d4c1f..9a7e7edfd 100644 --- a/newlib/libc/stdio64/ftello64.c +++ b/newlib/libc/stdio64/ftello64.c @@ -77,7 +77,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; _off64_t _DEFUN (_ftello64_r, (ptr, fp), - struct _reent *ptr _AND + struct _reent *ptr, register FILE * fp) { _fpos64_t pos; diff --git a/newlib/libc/stdio64/stdio64.c b/newlib/libc/stdio64/stdio64.c index dd3b4adc9..813b919bf 100644 --- a/newlib/libc/stdio64/stdio64.c +++ b/newlib/libc/stdio64/stdio64.c @@ -27,9 +27,9 @@ #ifdef __LARGE64_FILES _fpos64_t _DEFUN(__sseek64, (ptr, cookie, offset, whence), - struct _reent *ptr _AND - void *cookie _AND - _fpos64_t offset _AND + struct _reent *ptr, + void *cookie, + _fpos64_t offset, int whence) { register FILE *fp = (FILE *) cookie; @@ -48,9 +48,9 @@ _DEFUN(__sseek64, (ptr, cookie, offset, whence), _READ_WRITE_RETURN_TYPE _DEFUN(__swrite64, (ptr, cookie, buf, n), - struct _reent *ptr _AND - void *cookie _AND - char const *buf _AND + struct _reent *ptr, + void *cookie, + char const *buf, _READ_WRITE_BUFSIZE_TYPE n) { register FILE *fp = (FILE *) cookie; diff --git a/newlib/libc/stdlib/__adjust.c b/newlib/libc/stdlib/__adjust.c index d5c70758b..7627cc7ac 100644 --- a/newlib/libc/stdlib/__adjust.c +++ b/newlib/libc/stdlib/__adjust.c @@ -10,9 +10,9 @@ double _DEFUN (__adjust, (ptr, acc, dexp, sign), - struct _reent *ptr _AND - double *acc _AND - int dexp _AND + struct _reent *ptr, + double *acc, + int dexp, int sign) /* *acc the 64 bit accumulator */ /* dexp decimal exponent */ diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c index 0f4aeb8a9..cb4a2682e 100644 --- a/newlib/libc/stdlib/__atexit.c +++ b/newlib/libc/stdlib/__atexit.c @@ -65,9 +65,9 @@ static struct _atexit _global_atexit0 = _ATEXIT_INIT; int _DEFUN (__register_exitproc, (type, fn, arg, d), - int type _AND - void (*fn) (void) _AND - void *arg _AND + int type, + void (*fn) (void), + void *arg, void *d) { struct _on_exit_args * args; diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c index 6a809cc4d..e6c1ee643 100644 --- a/newlib/libc/stdlib/__call_atexit.c +++ b/newlib/libc/stdlib/__call_atexit.c @@ -66,7 +66,7 @@ register_fini(void) void _DEFUN (__call_exitprocs, (code, d), - int code _AND _PTR d) + int code, _PTR d) { register struct _atexit *p; struct _atexit **lastp; diff --git a/newlib/libc/stdlib/__ten_mu.c b/newlib/libc/stdlib/__ten_mu.c index 637197be2..a7fe70caf 100644 --- a/newlib/libc/stdlib/__ten_mu.c +++ b/newlib/libc/stdlib/__ten_mu.c @@ -10,7 +10,7 @@ int _DEFUN (__ten_mul, (acc, digit), - double *acc _AND + double *acc, int digit) { /* diff --git a/newlib/libc/stdlib/assert.c b/newlib/libc/stdlib/assert.c index a6218746c..ba5b46197 100644 --- a/newlib/libc/stdlib/assert.c +++ b/newlib/libc/stdlib/assert.c @@ -51,9 +51,9 @@ Supporting OS subroutines required (only if enabled): <>, <>, /* func can be NULL, in which case no function information is given. */ void _DEFUN (__assert_func, (file, line, func, failedexpr), - const char *file _AND - int line _AND - const char *func _AND + const char *file, + int line, + const char *func, const char *failedexpr) { fiprintf(stderr, @@ -67,8 +67,8 @@ _DEFUN (__assert_func, (file, line, func, failedexpr), void _DEFUN (__assert, (file, line, failedexpr), - const char *file _AND - int line _AND + const char *file, + int line, const char *failedexpr) { __assert_func (file, line, NULL, failedexpr); diff --git a/newlib/libc/stdlib/atoi.c b/newlib/libc/stdlib/atoi.c index ac3b39a0e..936b381bd 100644 --- a/newlib/libc/stdlib/atoi.c +++ b/newlib/libc/stdlib/atoi.c @@ -56,7 +56,7 @@ _DEFUN (atoi, (s), int _DEFUN (_atoi_r, (s), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *s) { return (int) _strtol_r (ptr, s, NULL, 10); diff --git a/newlib/libc/stdlib/atol.c b/newlib/libc/stdlib/atol.c index 8d0e5cd0b..8c2f5560d 100644 --- a/newlib/libc/stdlib/atol.c +++ b/newlib/libc/stdlib/atol.c @@ -14,7 +14,7 @@ _DEFUN (atol, (s), _CONST char *s) #endif /* !_REENT_ONLY */ long -_DEFUN (_atol_r, (ptr, s), struct _reent *ptr _AND _CONST char *s) +_DEFUN (_atol_r, (ptr, s), struct _reent *ptr, _CONST char *s) { return _strtol_r (ptr, s, NULL, 10); } diff --git a/newlib/libc/stdlib/atoll.c b/newlib/libc/stdlib/atoll.c index 9d8a64a9c..d0d498349 100644 --- a/newlib/libc/stdlib/atoll.c +++ b/newlib/libc/stdlib/atoll.c @@ -78,7 +78,7 @@ _DEFUN(atoll, (str), long long _DEFUN(_atoll_r, (ptr, str), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *str) { return _strtoll_r(ptr, str, (char **)NULL, 10); diff --git a/newlib/libc/stdlib/calloc.c b/newlib/libc/stdlib/calloc.c index 3a723783b..dfdb7f5dc 100644 --- a/newlib/libc/stdlib/calloc.c +++ b/newlib/libc/stdlib/calloc.c @@ -47,7 +47,7 @@ Supporting OS subroutines required: <>, <>, <>, _PTR _DEFUN (calloc, (n, size), - size_t n _AND + size_t n, size_t size) { return _calloc_r (_REENT, n, size); diff --git a/newlib/libc/stdlib/cxa_atexit.c b/newlib/libc/stdlib/cxa_atexit.c index 39a59d53a..c66b28e7d 100644 --- a/newlib/libc/stdlib/cxa_atexit.c +++ b/newlib/libc/stdlib/cxa_atexit.c @@ -24,8 +24,8 @@ const void * const __cxa_atexit_dummy = &__on_exit_args; int _DEFUN (__cxa_atexit, (fn, arg, d), - void (*fn) (void *) _AND - void *arg _AND + void (*fn) (void *), + void *arg, void *d) { #ifdef _LITE_EXIT diff --git a/newlib/libc/stdlib/div.c b/newlib/libc/stdlib/div.c index a780a2d3a..4d2ffee48 100644 --- a/newlib/libc/stdlib/div.c +++ b/newlib/libc/stdlib/div.c @@ -82,7 +82,7 @@ No supporting OS subroutines are required. div_t _DEFUN (div, (num, denom), - int num _AND + int num, int denom) { div_t r; diff --git a/newlib/libc/stdlib/dtoa.c b/newlib/libc/stdlib/dtoa.c index c72ffac5e..3b8976435 100644 --- a/newlib/libc/stdlib/dtoa.c +++ b/newlib/libc/stdlib/dtoa.c @@ -35,7 +35,7 @@ static int _DEFUN (quorem, (b, S), - _Bigint * b _AND _Bigint * S) + _Bigint * b, _Bigint * S) { int n; __Long borrow, y; @@ -179,12 +179,12 @@ _DEFUN (quorem, char * _DEFUN (_dtoa_r, (ptr, _d, mode, ndigits, decpt, sign, rve), - struct _reent *ptr _AND - double _d _AND - int mode _AND - int ndigits _AND - int *decpt _AND - int *sign _AND + struct _reent *ptr, + double _d, + int mode, + int ndigits, + int *decpt, + int *sign, char **rve) { /* Arguments ndigits, decpt, sign are similar to those diff --git a/newlib/libc/stdlib/dtoastub.c b/newlib/libc/stdlib/dtoastub.c index f4929f228..a857c2452 100644 --- a/newlib/libc/stdlib/dtoastub.c +++ b/newlib/libc/stdlib/dtoastub.c @@ -10,11 +10,11 @@ char * _DEFUN (__dtoa, (d, mode, ndigits, decpt, sign, rve), - double d _AND - int mode _AND - int ndigits _AND - int *decpt _AND - int *sign _AND + double d, + int mode, + int ndigits, + int *decpt, + int *sign, char **rve) { return _dtoa_r (_REENT, d, mode, ndigits, decpt, sign, rve); diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c index ee58c9a9a..2326f55ca 100644 --- a/newlib/libc/stdlib/ecvtbuf.c +++ b/newlib/libc/stdlib/ecvtbuf.c @@ -59,12 +59,12 @@ Supporting OS subroutines required: <>, <>, <>, static void _DEFUN (print_f, (ptr, buf, invalue, ndigit, type, dot, mode), - struct _reent *ptr _AND - char *buf _AND - double invalue _AND - int ndigit _AND - char type _AND - int dot _AND + struct _reent *ptr, + char *buf, + double invalue, + int ndigit, + char type, + int dot, int mode) { int decpt; @@ -127,11 +127,11 @@ _DEFUN (print_f, (ptr, buf, invalue, ndigit, type, dot, mode), static void _DEFUN (print_e, (ptr, buf, invalue, width, type, dot), - struct _reent *ptr _AND - char *buf _AND - double invalue _AND - int width _AND - char type _AND + struct _reent *ptr, + char *buf, + double invalue, + int width, + char type, int dot) { int sign; @@ -210,10 +210,10 @@ _DEFUN (print_e, (ptr, buf, invalue, width, type, dot), char * _DEFUN (fcvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), - double invalue _AND - int ndigit _AND - int *decpt _AND - int *sign _AND + double invalue, + int ndigit, + int *decpt, + int *sign, char *fcvt_buf) { struct _reent *reent = _REENT; @@ -267,10 +267,10 @@ _DEFUN (fcvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), char * _DEFUN (ecvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), - double invalue _AND - int ndigit _AND - int *decpt _AND - int *sign _AND + double invalue, + int ndigit, + int *decpt, + int *sign, char *fcvt_buf) { struct _reent *reent = _REENT; @@ -318,11 +318,11 @@ _DEFUN (ecvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), char * _DEFUN (_gcvt, (ptr, invalue, ndigit, buf, type, dot), - struct _reent *ptr _AND - double invalue _AND - int ndigit _AND - char *buf _AND - char type _AND + struct _reent *ptr, + double invalue, + int ndigit, + char *buf, + char type, int dot) { char *save = buf; @@ -426,12 +426,12 @@ _DEFUN (_gcvt, (ptr, invalue, ndigit, buf, type, dot), char * _DEFUN (_dcvt, (ptr, buffer, invalue, precision, width, type, dot), - struct _reent *ptr _AND - char *buffer _AND - double invalue _AND - int precision _AND - int width _AND - char type _AND + struct _reent *ptr, + char *buffer, + double invalue, + int precision, + int width, + char type, int dot) { switch (type) diff --git a/newlib/libc/stdlib/efgcvt.c b/newlib/libc/stdlib/efgcvt.c index ae6424559..e354bb170 100644 --- a/newlib/libc/stdlib/efgcvt.c +++ b/newlib/libc/stdlib/efgcvt.c @@ -104,9 +104,9 @@ Supporting OS subroutines required: <>, <>, <>, char * _DEFUN (fcvt, (d, ndigit, decpt, sign), - double d _AND - int ndigit _AND - int *decpt _AND + double d, + int ndigit, + int *decpt, int *sign) { return fcvtbuf (d, ndigit, decpt, sign, NULL); @@ -114,9 +114,9 @@ _DEFUN (fcvt, (d, ndigit, decpt, sign), char * _DEFUN (fcvtf, (d, ndigit, decpt, sign), - float d _AND - int ndigit _AND - int *decpt _AND + float d, + int ndigit, + int *decpt, int *sign) { return fcvt ((float) d, ndigit, decpt, sign); @@ -125,8 +125,8 @@ _DEFUN (fcvtf, (d, ndigit, decpt, sign), char * _DEFUN (gcvtf, (d, ndigit, buf), - float d _AND - int ndigit _AND + float d, + int ndigit, char *buf) { double asd = d; @@ -136,9 +136,9 @@ _DEFUN (gcvtf, (d, ndigit, buf), char * _DEFUN (ecvt, (d, ndigit, decpt, sign), - double d _AND - int ndigit _AND - int *decpt _AND + double d, + int ndigit, + int *decpt, int *sign) { return ecvtbuf (d, ndigit, decpt, sign, NULL); @@ -146,9 +146,9 @@ _DEFUN (ecvt, (d, ndigit, decpt, sign), char * _DEFUN (ecvtf, (d, ndigit, decpt, sign), - float d _AND - int ndigit _AND - int *decpt _AND + float d, + int ndigit, + int *decpt, int *sign) { return ecvt ((double) d, ndigit, decpt, sign); @@ -157,8 +157,8 @@ _DEFUN (ecvtf, (d, ndigit, decpt, sign), char * _DEFUN (gcvt, (d, ndigit, buf), - double d _AND - int ndigit _AND + double d, + int ndigit, char *buf) { char *tbuf = buf; diff --git a/newlib/libc/stdlib/erand48.c b/newlib/libc/stdlib/erand48.c index 26b39fb5b..a62ff345a 100644 --- a/newlib/libc/stdlib/erand48.c +++ b/newlib/libc/stdlib/erand48.c @@ -15,7 +15,7 @@ double _DEFUN (_erand48_r, (r, xseed), - struct _reent *r _AND + struct _reent *r, unsigned short xseed[3]) { __dorand48(r, xseed); diff --git a/newlib/libc/stdlib/gdtoa-gethex.c b/newlib/libc/stdlib/gdtoa-gethex.c index fd3903c4f..931ced3a7 100644 --- a/newlib/libc/stdlib/gdtoa-gethex.c +++ b/newlib/libc/stdlib/gdtoa-gethex.c @@ -71,7 +71,7 @@ _DEFUN (__hexdig_fun, (c), static void _DEFUN(rshift, (b, k), - _Bigint *b _AND + _Bigint *b, int k) { __ULong *x, *x1, *xe, y; @@ -102,7 +102,7 @@ _DEFUN(rshift, (b, k), static _Bigint * _DEFUN (increment, (ptr, b), - struct _reent *ptr _AND + struct _reent *ptr, _Bigint *b) { __ULong *x, *xe; diff --git a/newlib/libc/stdlib/gdtoa-hexnan.c b/newlib/libc/stdlib/gdtoa-hexnan.c index 24e3783be..22033d90f 100644 --- a/newlib/libc/stdlib/gdtoa-hexnan.c +++ b/newlib/libc/stdlib/gdtoa-hexnan.c @@ -46,7 +46,7 @@ THIS SOFTWARE. #ifdef INFNAN_CHECK int _DEFUN (match, (sp, t), - _CONST char **sp _AND + _CONST char **sp, char *t) { int c, d; @@ -64,8 +64,8 @@ _DEFUN (match, (sp, t), static void _DEFUN (L_shift, (x, x1, i), - __ULong *x _AND - __ULong *x1 _AND + __ULong *x, + __ULong *x1, int i) { int j; @@ -81,8 +81,8 @@ _DEFUN (L_shift, (x, x1, i), int _DEFUN (hexnan, (sp, fpi, x0), - _CONST char **sp _AND - _CONST FPI *fpi _AND + _CONST char **sp, + _CONST FPI *fpi, __ULong *x0) { __ULong c, h, *x, *x1, *xe; diff --git a/newlib/libc/stdlib/getenv.c b/newlib/libc/stdlib/getenv.c index c64241ee6..2d394e240 100644 --- a/newlib/libc/stdlib/getenv.c +++ b/newlib/libc/stdlib/getenv.c @@ -65,7 +65,7 @@ variables vary from one system to another. char * _DEFUN (_findenv, (name, offset), - register _CONST char *name _AND + register _CONST char *name, int *offset) { return _findenv_r (_REENT, name, offset); diff --git a/newlib/libc/stdlib/getenv_r.c b/newlib/libc/stdlib/getenv_r.c index 7376f7407..b34c2a9b3 100644 --- a/newlib/libc/stdlib/getenv_r.c +++ b/newlib/libc/stdlib/getenv_r.c @@ -75,8 +75,8 @@ static char ***p_environ = &environ; char * _DEFUN (_findenv_r, (reent_ptr, name, offset), - struct _reent *reent_ptr _AND - register _CONST char *name _AND + struct _reent *reent_ptr, + register _CONST char *name, int *offset) { register int len; @@ -120,7 +120,7 @@ _DEFUN (_findenv_r, (reent_ptr, name, offset), char * _DEFUN (_getenv_r, (reent_ptr, name), - struct _reent *reent_ptr _AND + struct _reent *reent_ptr, _CONST char *name) { int offset; diff --git a/newlib/libc/stdlib/itoa.c b/newlib/libc/stdlib/itoa.c index 3178cd454..25e6c3516 100644 --- a/newlib/libc/stdlib/itoa.c +++ b/newlib/libc/stdlib/itoa.c @@ -31,8 +31,8 @@ No supporting OS subroutine calls are required. char * _DEFUN (__itoa, (value, str, base), - int value _AND - char *str _AND + int value, + char *str, int base) { unsigned uvalue; @@ -61,8 +61,8 @@ _DEFUN (__itoa, (value, str, base), char * _DEFUN (itoa, (value, str, base), - int value _AND - char *str _AND + int value, + char *str, int base) { return __itoa (value, str, base); diff --git a/newlib/libc/stdlib/jrand48.c b/newlib/libc/stdlib/jrand48.c index 9e2f92cb6..4f8c12bd1 100644 --- a/newlib/libc/stdlib/jrand48.c +++ b/newlib/libc/stdlib/jrand48.c @@ -15,7 +15,7 @@ long _DEFUN (_jrand48_r, (r, xseed), - struct _reent *r _AND + struct _reent *r, unsigned short xseed[3]) { __dorand48(r, xseed); diff --git a/newlib/libc/stdlib/l64a.c b/newlib/libc/stdlib/l64a.c index d415d0478..607842723 100644 --- a/newlib/libc/stdlib/l64a.c +++ b/newlib/libc/stdlib/l64a.c @@ -35,7 +35,7 @@ _DEFUN (l64a, (value), char * _DEFUN (_l64a_r, (rptr, value), - struct _reent *rptr _AND + struct _reent *rptr, long value) { char *ptr; diff --git a/newlib/libc/stdlib/lcong48.c b/newlib/libc/stdlib/lcong48.c index 548f32757..f40dede82 100644 --- a/newlib/libc/stdlib/lcong48.c +++ b/newlib/libc/stdlib/lcong48.c @@ -15,7 +15,7 @@ _VOID _DEFUN (_lcong48_r, (r, p), - struct _reent *r _AND + struct _reent *r, unsigned short p[7]) { _REENT_CHECK_RAND48(r); diff --git a/newlib/libc/stdlib/ldiv.c b/newlib/libc/stdlib/ldiv.c index 242b6bd87..00bca6286 100644 --- a/newlib/libc/stdlib/ldiv.c +++ b/newlib/libc/stdlib/ldiv.c @@ -83,7 +83,7 @@ No supporting OS subroutines are required. ldiv_t _DEFUN (ldiv, (num, denom), - long num _AND + long num, long denom) { ldiv_t r; diff --git a/newlib/libc/stdlib/lldiv.c b/newlib/libc/stdlib/lldiv.c index 61a9b50ca..8433e76bd 100644 --- a/newlib/libc/stdlib/lldiv.c +++ b/newlib/libc/stdlib/lldiv.c @@ -95,7 +95,7 @@ No supporting OS subroutines are required. */ lldiv_t _DEFUN (lldiv, (number, denom), - long long numer _AND long long denom) + long long numer, long long denom) { lldiv_t retval; diff --git a/newlib/libc/stdlib/malign.c b/newlib/libc/stdlib/malign.c index 1eded306b..d36846f98 100644 --- a/newlib/libc/stdlib/malign.c +++ b/newlib/libc/stdlib/malign.c @@ -10,7 +10,7 @@ _PTR _DEFUN (memalign, (align, nbytes), - size_t align _AND + size_t align, size_t nbytes) { return _memalign_r (_REENT, align, nbytes); diff --git a/newlib/libc/stdlib/mblen.c b/newlib/libc/stdlib/mblen.c index 30d759be0..3ea91f4ba 100644 --- a/newlib/libc/stdlib/mblen.c +++ b/newlib/libc/stdlib/mblen.c @@ -44,7 +44,7 @@ effects vary with the locale. int _DEFUN (mblen, (s, n), - const char *s _AND + const char *s, size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mblen_r.c b/newlib/libc/stdlib/mblen_r.c index 5e58e1e45..1456ceae2 100644 --- a/newlib/libc/stdlib/mblen_r.c +++ b/newlib/libc/stdlib/mblen_r.c @@ -42,9 +42,9 @@ effects vary with the locale. int _DEFUN (_mblen_r, (r, s, n, state), - struct _reent *r _AND - const char *s _AND - size_t n _AND + struct _reent *r, + const char *s, + size_t n, mbstate_t *state) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mbrtowc.c b/newlib/libc/stdlib/mbrtowc.c index 69e3acb62..4ca2143cf 100644 --- a/newlib/libc/stdlib/mbrtowc.c +++ b/newlib/libc/stdlib/mbrtowc.c @@ -9,10 +9,10 @@ size_t _DEFUN (_mbrtowc_r, (ptr, pwc, s, n, ps), - struct _reent *ptr _AND - wchar_t *pwc _AND - const char *s _AND - size_t n _AND + struct _reent *ptr, + wchar_t *pwc, + const char *s, + size_t n, mbstate_t *ps) { int retval = 0; @@ -43,9 +43,9 @@ _DEFUN (_mbrtowc_r, (ptr, pwc, s, n, ps), #ifndef _REENT_ONLY size_t _DEFUN (mbrtowc, (pwc, s, n, ps), - wchar_t *__restrict pwc _AND - const char *__restrict s _AND - size_t n _AND + wchar_t *__restrict pwc, + const char *__restrict s, + size_t n, mbstate_t *__restrict ps) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/stdlib/mbsnrtowcs.c b/newlib/libc/stdlib/mbsnrtowcs.c index 018f075ee..206a0623e 100644 --- a/newlib/libc/stdlib/mbsnrtowcs.c +++ b/newlib/libc/stdlib/mbsnrtowcs.c @@ -72,11 +72,11 @@ PORTABILITY size_t _DEFUN (_mbsnrtowcs_r, (r, dst, src, nms, len, ps), - struct _reent *r _AND - wchar_t *dst _AND - const char **src _AND - size_t nms _AND - size_t len _AND + struct _reent *r, + wchar_t *dst, + const char **src, + size_t nms, + size_t len, mbstate_t *ps) { wchar_t *ptr = dst; @@ -138,10 +138,10 @@ _DEFUN (_mbsnrtowcs_r, (r, dst, src, nms, len, ps), #ifndef _REENT_ONLY size_t _DEFUN (mbsnrtowcs, (dst, src, nms, len, ps), - wchar_t *__restrict dst _AND - const char **__restrict src _AND - size_t nms _AND - size_t len _AND + wchar_t *__restrict dst, + const char **__restrict src, + size_t nms, + size_t len, mbstate_t *__restrict ps) { return _mbsnrtowcs_r (_REENT, dst, src, nms, len, ps); diff --git a/newlib/libc/stdlib/mbsrtowcs.c b/newlib/libc/stdlib/mbsrtowcs.c index 65e46d32e..48d36d028 100644 --- a/newlib/libc/stdlib/mbsrtowcs.c +++ b/newlib/libc/stdlib/mbsrtowcs.c @@ -9,10 +9,10 @@ size_t _DEFUN (_mbsrtowcs_r, (r, dst, src, len, ps), - struct _reent *r _AND - wchar_t *dst _AND - const char **src _AND - size_t len _AND + struct _reent *r, + wchar_t *dst, + const char **src, + size_t len, mbstate_t *ps) { return _mbsnrtowcs_r (r, dst, src, (size_t) -1, len, ps); @@ -21,9 +21,9 @@ _DEFUN (_mbsrtowcs_r, (r, dst, src, len, ps), #ifndef _REENT_ONLY size_t _DEFUN (mbsrtowcs, (dst, src, len, ps), - wchar_t *__restrict dst _AND - const char **__restrict src _AND - size_t len _AND + wchar_t *__restrict dst, + const char **__restrict src, + size_t len, mbstate_t *__restrict ps) { return _mbsnrtowcs_r (_REENT, dst, src, (size_t) -1, len, ps); diff --git a/newlib/libc/stdlib/mbstowcs.c b/newlib/libc/stdlib/mbstowcs.c index 70ed9ede6..41ad7b67a 100644 --- a/newlib/libc/stdlib/mbstowcs.c +++ b/newlib/libc/stdlib/mbstowcs.c @@ -48,8 +48,8 @@ effects vary with the locale. size_t _DEFUN (mbstowcs, (pwcs, s, n), - wchar_t *__restrict pwcs _AND - const char *__restrict s _AND + wchar_t *__restrict pwcs, + const char *__restrict s, size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mbstowcs_r.c b/newlib/libc/stdlib/mbstowcs_r.c index 495049972..7c95e4aba 100644 --- a/newlib/libc/stdlib/mbstowcs_r.c +++ b/newlib/libc/stdlib/mbstowcs_r.c @@ -4,10 +4,10 @@ size_t _DEFUN (_mbstowcs_r, (reent, pwcs, s, n, state), - struct _reent *r _AND - wchar_t *__restrict pwcs _AND - const char *__restrict s _AND - size_t n _AND + struct _reent *r, + wchar_t *__restrict pwcs, + const char *__restrict s, + size_t n, mbstate_t *state) { size_t ret = 0; diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c index 0c29cf3d9..182884aab 100644 --- a/newlib/libc/stdlib/mbtowc.c +++ b/newlib/libc/stdlib/mbtowc.c @@ -51,8 +51,8 @@ effects vary with the locale. int _DEFUN (mbtowc, (pwc, s, n), - wchar_t *__restrict pwc _AND - const char *__restrict s _AND + wchar_t *__restrict pwc, + const char *__restrict s, size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index 9d782566f..cbc534a7b 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -9,10 +9,10 @@ int _DEFUN (_mbtowc_r, (r, pwc, s, n, state), - struct _reent *r _AND - wchar_t *__restrict pwc _AND - const char *__restrict s _AND - size_t n _AND + struct _reent *r, + wchar_t *__restrict pwc, + const char *__restrict s, + size_t n, mbstate_t *state) { return __MBTOWC (r, pwc, s, n, state); @@ -20,10 +20,10 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state), int _DEFUN (__ascii_mbtowc, (r, pwc, s, n, state), - struct _reent *r _AND - wchar_t *pwc _AND - const char *s _AND - size_t n _AND + struct _reent *r, + wchar_t *pwc, + const char *s, + size_t n, mbstate_t *state) { wchar_t dummy; @@ -529,10 +529,10 @@ __cp_mbtowc (int val) int _DEFUN (__utf8_mbtowc, (r, pwc, s, n, state), - struct _reent *r _AND - wchar_t *pwc _AND - const char *s _AND - size_t n _AND + struct _reent *r, + wchar_t *pwc, + const char *s, + size_t n, mbstate_t *state) { wchar_t dummy; @@ -731,10 +731,10 @@ _DEFUN (__utf8_mbtowc, (r, pwc, s, n, state), #ifndef __CYGWIN__ int _DEFUN (__sjis_mbtowc, (r, pwc, s, n, state), - struct _reent *r _AND - wchar_t *pwc _AND - const char *s _AND - size_t n _AND + struct _reent *r, + wchar_t *pwc, + const char *s, + size_t n, mbstate_t *state) { wchar_t dummy; @@ -788,10 +788,10 @@ _DEFUN (__sjis_mbtowc, (r, pwc, s, n, state), int _DEFUN (__eucjp_mbtowc, (r, pwc, s, n, state), - struct _reent *r _AND - wchar_t *pwc _AND - const char *s _AND - size_t n _AND + struct _reent *r, + wchar_t *pwc, + const char *s, + size_t n, mbstate_t *state) { wchar_t dummy; @@ -871,10 +871,10 @@ _DEFUN (__eucjp_mbtowc, (r, pwc, s, n, state), int _DEFUN (__jis_mbtowc, (r, pwc, s, n, state), - struct _reent *r _AND - wchar_t *pwc _AND - const char *s _AND - size_t n _AND + struct _reent *r, + wchar_t *pwc, + const char *s, + size_t n, mbstate_t *state) { wchar_t dummy; diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c index 2b982ef55..cb6866d50 100644 --- a/newlib/libc/stdlib/mprec.c +++ b/newlib/libc/stdlib/mprec.c @@ -94,7 +94,7 @@ */ _Bigint * -_DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k) +_DEFUN (Balloc, (ptr, k), struct _reent *ptr, int k) { int x; _Bigint *rv ; @@ -133,7 +133,7 @@ _DEFUN (Balloc, (ptr, k), struct _reent *ptr _AND int k) } void -_DEFUN (Bfree, (ptr, v), struct _reent *ptr _AND _Bigint * v) +_DEFUN (Bfree, (ptr, v), struct _reent *ptr, _Bigint * v) { _REENT_CHECK_MP(ptr); if (v) @@ -145,9 +145,9 @@ _DEFUN (Bfree, (ptr, v), struct _reent *ptr _AND _Bigint * v) _Bigint * _DEFUN (multadd, (ptr, b, m, a), - struct _reent *ptr _AND - _Bigint * b _AND - int m _AND + struct _reent *ptr, + _Bigint * b, + int m, int a) { int i, wds; @@ -192,10 +192,10 @@ _DEFUN (multadd, (ptr, b, m, a), _Bigint * _DEFUN (s2b, (ptr, s, nd0, nd, y9), - struct _reent * ptr _AND - _CONST char *s _AND - int nd0 _AND - int nd _AND + struct _reent * ptr, + _CONST char *s, + int nd0, + int nd, __ULong y9) { _Bigint *b; @@ -316,7 +316,7 @@ _DEFUN (lo0bits, (y), __ULong *y) } _Bigint * -_DEFUN (i2b, (ptr, i), struct _reent * ptr _AND int i) +_DEFUN (i2b, (ptr, i), struct _reent * ptr, int i) { _Bigint *b; @@ -327,7 +327,7 @@ _DEFUN (i2b, (ptr, i), struct _reent * ptr _AND int i) } _Bigint * -_DEFUN (mult, (ptr, a, b), struct _reent * ptr _AND _Bigint * a _AND _Bigint * b) +_DEFUN (mult, (ptr, a, b), struct _reent * ptr, _Bigint * a, _Bigint * b) { _Bigint *c; int k, wa, wb, wc; @@ -420,7 +420,7 @@ _DEFUN (mult, (ptr, a, b), struct _reent * ptr _AND _Bigint * a _AND _Bigint * b _Bigint * _DEFUN (pow5mult, - (ptr, b, k), struct _reent * ptr _AND _Bigint * b _AND int k) + (ptr, b, k), struct _reent * ptr, _Bigint * b, int k) { _Bigint *b1, *p5, *p51; int i; @@ -459,7 +459,7 @@ _DEFUN (pow5mult, } _Bigint * -_DEFUN (lshift, (ptr, b, k), struct _reent * ptr _AND _Bigint * b _AND int k) +_DEFUN (lshift, (ptr, b, k), struct _reent * ptr, _Bigint * b, int k) { int i, k1, n, n1; _Bigint *b1; @@ -519,7 +519,7 @@ _DEFUN (lshift, (ptr, b, k), struct _reent * ptr _AND _Bigint * b _AND int k) } int -_DEFUN (cmp, (a, b), _Bigint * a _AND _Bigint * b) +_DEFUN (cmp, (a, b), _Bigint * a, _Bigint * b) { __ULong *xa, *xa0, *xb, *xb0; int i, j; @@ -549,8 +549,8 @@ _DEFUN (cmp, (a, b), _Bigint * a _AND _Bigint * b) } _Bigint * -_DEFUN (diff, (ptr, a, b), struct _reent * ptr _AND - _Bigint * a _AND _Bigint * b) +_DEFUN (diff, (ptr, a, b), struct _reent * ptr, + _Bigint * a, _Bigint * b) { _Bigint *c; int i, wa, wb; @@ -680,7 +680,7 @@ _DEFUN (ulp, (_x), double _x) double _DEFUN (b2d, (a, e), - _Bigint * a _AND int *e) + _Bigint * a, int *e) { __ULong *xa, *xa0, w, y, z; int k; @@ -758,9 +758,9 @@ ret_d: _Bigint * _DEFUN (d2b, (ptr, _d, e, bits), - struct _reent * ptr _AND - double _d _AND - int *e _AND + struct _reent * ptr, + double _d, + int *e, int *bits) { @@ -911,7 +911,7 @@ _DEFUN (d2b, #undef d1 double -_DEFUN (ratio, (a, b), _Bigint * a _AND _Bigint * b) +_DEFUN (ratio, (a, b), _Bigint * a, _Bigint * b) { union double_union da, db; @@ -992,8 +992,8 @@ _DEFUN (_mprec_log10, (dig), void _DEFUN (copybits, (c, n, b), - __ULong *c _AND - int n _AND + __ULong *c, + int n, _Bigint *b) { __ULong *ce, *x, *xe; @@ -1021,7 +1021,7 @@ _DEFUN (copybits, (c, n, b), __ULong _DEFUN (any_on, (b, k), - _Bigint *b _AND + _Bigint *b, int k) { int n, nwds; diff --git a/newlib/libc/stdlib/mstats.c b/newlib/libc/stdlib/mstats.c index 88cb54c40..b7aa93b28 100644 --- a/newlib/libc/stdlib/mstats.c +++ b/newlib/libc/stdlib/mstats.c @@ -98,7 +98,7 @@ _DEFUN_VOID (malloc_stats) int _DEFUN (mallopt, (p, v), - int p _AND + int p, int v) { return _mallopt_r (_REENT, p, v); @@ -116,7 +116,7 @@ _DEFUN (mallopt, (p, v), void _DEFUN (_mstats_r, (ptr, s), - struct _reent *ptr _AND + struct _reent *ptr, char *s) { _REENT_SMALL_CHECK_INIT(ptr); diff --git a/newlib/libc/stdlib/nrand48.c b/newlib/libc/stdlib/nrand48.c index 39e9fb13c..43a6d0cfb 100644 --- a/newlib/libc/stdlib/nrand48.c +++ b/newlib/libc/stdlib/nrand48.c @@ -15,7 +15,7 @@ long _DEFUN (_nrand48_r, (r, xseed), - struct _reent *r _AND + struct _reent *r, unsigned short xseed[3]) { __dorand48 (r, xseed); diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index d22fc3728..b21cf0cb2 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -68,7 +68,7 @@ const void * const __on_exit_dummy = &__on_exit_args; int _DEFUN (on_exit, (fn, arg), - _VOID _EXFNPTR(fn, (int, _PTR)) _AND + _VOID _EXFNPTR(fn, (int, _PTR)), _PTR arg) { return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL); diff --git a/newlib/libc/stdlib/putenv_r.c b/newlib/libc/stdlib/putenv_r.c index a0f476721..a780a149e 100644 --- a/newlib/libc/stdlib/putenv_r.c +++ b/newlib/libc/stdlib/putenv_r.c @@ -32,7 +32,7 @@ with "value" which is specified by str as "name=value". */ int _DEFUN (_putenv_r, (reent_ptr, str), - struct _reent *reent_ptr _AND + struct _reent *reent_ptr, char *str) { register char *p, *equal; diff --git a/newlib/libc/stdlib/rand48.c b/newlib/libc/stdlib/rand48.c index b9bf320b2..0fc5cc0a9 100644 --- a/newlib/libc/stdlib/rand48.c +++ b/newlib/libc/stdlib/rand48.c @@ -131,7 +131,7 @@ No supporting OS subroutines are required. void _DEFUN (__dorand48, (r, xseed), - struct _reent *r _AND + struct _reent *r, unsigned short xseed[3]) { unsigned long accu; diff --git a/newlib/libc/stdlib/realloc.c b/newlib/libc/stdlib/realloc.c index 0cdbdb619..8258e211e 100644 --- a/newlib/libc/stdlib/realloc.c +++ b/newlib/libc/stdlib/realloc.c @@ -12,7 +12,7 @@ int _dummy_realloc = 1; _PTR _DEFUN (realloc, (ap, nbytes), - _PTR ap _AND + _PTR ap, size_t nbytes) { return _realloc_r (_REENT, ap, nbytes); diff --git a/newlib/libc/stdlib/reallocf.c b/newlib/libc/stdlib/reallocf.c index a9d329398..b3f1b2aab 100644 --- a/newlib/libc/stdlib/reallocf.c +++ b/newlib/libc/stdlib/reallocf.c @@ -32,8 +32,8 @@ _PTR _DEFUN (_reallocf_r, (reentptr, ptr, size), - struct _reent *reentptr _AND - _PTR ptr _AND + struct _reent *reentptr, + _PTR ptr, size_t size) { void *nptr; @@ -47,7 +47,7 @@ _DEFUN (_reallocf_r, (reentptr, ptr, size), #ifndef _REENT_ONLY _PTR _DEFUN (reallocf, (ptr, size), - _PTR ptr _AND + _PTR ptr, size_t size) { return _reallocf_r(_REENT, ptr, size); diff --git a/newlib/libc/stdlib/seed48.c b/newlib/libc/stdlib/seed48.c index 43629cc40..5f3ae2e95 100644 --- a/newlib/libc/stdlib/seed48.c +++ b/newlib/libc/stdlib/seed48.c @@ -15,7 +15,7 @@ unsigned short * _DEFUN (_seed48_r, (r, xseed), - struct _reent *r _AND + struct _reent *r, unsigned short xseed[3]) { static unsigned short sseed[3]; diff --git a/newlib/libc/stdlib/setenv.c b/newlib/libc/stdlib/setenv.c index d423678f3..7e8949417 100644 --- a/newlib/libc/stdlib/setenv.c +++ b/newlib/libc/stdlib/setenv.c @@ -33,8 +33,8 @@ extern int _unsetenv_r _PARAMS ((struct _reent *, const char *)); int _DEFUN (setenv, (name, value, rewrite), - _CONST char *name _AND - _CONST char *value _AND + _CONST char *name, + _CONST char *value, int rewrite) { return _setenv_r (_REENT, name, value, rewrite); diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c index c32c6aca9..75f21733e 100644 --- a/newlib/libc/stdlib/setenv_r.c +++ b/newlib/libc/stdlib/setenv_r.c @@ -50,9 +50,9 @@ extern char *_findenv_r _PARAMS ((struct _reent *, const char *, int *)); int _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), - struct _reent *reent_ptr _AND - _CONST char *name _AND - _CONST char *value _AND + struct _reent *reent_ptr, + _CONST char *name, + _CONST char *value, int rewrite) { static int alloced; /* if allocated space before */ @@ -134,7 +134,7 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), */ int _DEFUN (_unsetenv_r, (reent_ptr, name), - struct _reent *reent_ptr _AND + struct _reent *reent_ptr, _CONST char *name) { register char **P; diff --git a/newlib/libc/stdlib/srand48.c b/newlib/libc/stdlib/srand48.c index 69bdbfc3b..7042e834c 100644 --- a/newlib/libc/stdlib/srand48.c +++ b/newlib/libc/stdlib/srand48.c @@ -15,7 +15,7 @@ _VOID _DEFUN (_srand48_r, (r, seed), - struct _reent *r _AND + struct _reent *r, long seed) { _REENT_CHECK_RAND48(r); diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index 236daa5f6..e3c9b7f17 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -175,7 +175,7 @@ static _CONST double tinytens[] = { 1e-16, 1e-32, #ifdef Avoid_Underflow /*{*/ static double _DEFUN (sulp, (x, scale), - U x _AND + U x, int scale) { U u; @@ -198,9 +198,9 @@ _DEFUN (sulp, (x, scale), static void _DEFUN (ULtod, (L, bits, exp, k), - __ULong *L _AND - __ULong *bits _AND - Long exp _AND + __ULong *L, + __ULong *bits, + Long exp, int k) { switch(k & STRTOG_Retmask) { @@ -1253,8 +1253,8 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, double _DEFUN (_strtod_r, (ptr, s00, se), - struct _reent *ptr _AND - _CONST char *__restrict s00 _AND + struct _reent *ptr, + _CONST char *__restrict s00, char **__restrict se) { return _strtod_l (ptr, s00, se, __get_current_locale ()); @@ -1270,7 +1270,7 @@ strtod_l (const char *__restrict s00, char **__restrict se, locale_t loc) double _DEFUN (strtod, (s00, se), - _CONST char *__restrict s00 _AND char **__restrict se) + _CONST char *__restrict s00, char **__restrict se) { return _strtod_l (_REENT, s00, se, __get_current_locale ()); } @@ -1291,7 +1291,7 @@ strtof_l (const char *__restrict s00, char **__restrict se, locale_t loc) float _DEFUN (strtof, (s00, se), - _CONST char *__restrict s00 _AND + _CONST char *__restrict s00, char **__restrict se) { double val = _strtod_l (_REENT, s00, se, __get_current_locale ()); diff --git a/newlib/libc/stdlib/strtol.c b/newlib/libc/stdlib/strtol.c index ba58b6e8c..7ffa6a95d 100644 --- a/newlib/libc/stdlib/strtol.c +++ b/newlib/libc/stdlib/strtol.c @@ -213,9 +213,9 @@ _strtol_l (struct _reent *rptr, const char *__restrict nptr, long _DEFUN (_strtol_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST char *__restrict nptr _AND - char **__restrict endptr _AND + struct _reent *rptr, + _CONST char *__restrict nptr, + char **__restrict endptr, int base) { return _strtol_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -232,8 +232,8 @@ strtol_l (const char *__restrict s, char **__restrict ptr, int base, long _DEFUN (strtol, (s, ptr, base), - _CONST char *__restrict s _AND - char **__restrict ptr _AND + _CONST char *__restrict s, + char **__restrict ptr, int base) { return _strtol_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/strtoll.c b/newlib/libc/stdlib/strtoll.c index 2922452c7..51752655a 100644 --- a/newlib/libc/stdlib/strtoll.c +++ b/newlib/libc/stdlib/strtoll.c @@ -215,9 +215,9 @@ _strtoll_l (struct _reent *rptr, _CONST char *__restrict nptr, long long _DEFUN (_strtoll_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST char *__restrict nptr _AND - char **__restrict endptr _AND + struct _reent *rptr, + _CONST char *__restrict nptr, + char **__restrict endptr, int base) { return _strtoll_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -234,8 +234,8 @@ strtoll_l (const char *__restrict s, char **__restrict ptr, int base, long long _DEFUN (strtoll, (s, ptr, base), - _CONST char *__restrict s _AND - char **__restrict ptr _AND + _CONST char *__restrict s, + char **__restrict ptr, int base) { return _strtoll_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/strtoul.c b/newlib/libc/stdlib/strtoul.c index 9414661ec..e18472254 100644 --- a/newlib/libc/stdlib/strtoul.c +++ b/newlib/libc/stdlib/strtoul.c @@ -192,9 +192,9 @@ _strtoul_l (struct _reent *rptr, const char *__restrict nptr, unsigned long _DEFUN (_strtoul_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST char *__restrict nptr _AND - char **__restrict endptr _AND + struct _reent *rptr, + _CONST char *__restrict nptr, + char **__restrict endptr, int base) { return _strtoul_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -211,8 +211,8 @@ strtoul_l (const char *__restrict s, char **__restrict ptr, int base, unsigned long _DEFUN (strtoul, (s, ptr, base), - _CONST char *__restrict s _AND - char **__restrict ptr _AND + _CONST char *__restrict s, + char **__restrict ptr, int base) { return _strtoul_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/strtoull.c b/newlib/libc/stdlib/strtoull.c index aff1fc7c3..4dfb28f79 100644 --- a/newlib/libc/stdlib/strtoull.c +++ b/newlib/libc/stdlib/strtoull.c @@ -190,9 +190,9 @@ _strtoull_l (struct _reent *rptr, const char *__restrict nptr, unsigned long long _DEFUN (_strtoull_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST char *__restrict nptr _AND - char **__restrict endptr _AND + struct _reent *rptr, + _CONST char *__restrict nptr, + char **__restrict endptr, int base) { return _strtoull_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -209,8 +209,8 @@ strtoull_l (const char *__restrict s, char **__restrict ptr, int base, unsigned long long _DEFUN (strtoull, (s, ptr, base), - _CONST char *__restrict s _AND - char **__restrict ptr _AND + _CONST char *__restrict s, + char **__restrict ptr, int base) { return _strtoull_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c index 6cacfa587..f172e5de9 100644 --- a/newlib/libc/stdlib/system.c +++ b/newlib/libc/stdlib/system.c @@ -53,12 +53,12 @@ Supporting OS subroutines required: <<_exit>>, <<_execve>>, <<_fork_r>>, #include #if defined (unix) || defined (__CYGWIN__) -static int _EXFUN(do_system, (struct _reent *ptr _AND _CONST char *s)); +static int _EXFUN(do_system, (struct _reent *ptr, _CONST char *s)); #endif int _DEFUN(_system_r, (ptr, s), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *s) { #if defined(HAVE_SYSTEM) @@ -111,7 +111,7 @@ static char ***p_environ = &environ; static int _DEFUN(do_system, (ptr, s), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *s) { char *argv[4]; @@ -143,7 +143,7 @@ _DEFUN(do_system, (ptr, s), #if defined (__CYGWIN__) static int _DEFUN(do_system, (ptr, s), - struct _reent *ptr _AND + struct _reent *ptr, _CONST char *s) { char *argv[4]; diff --git a/newlib/libc/stdlib/utoa.c b/newlib/libc/stdlib/utoa.c index 75e8616ea..cc5440783 100644 --- a/newlib/libc/stdlib/utoa.c +++ b/newlib/libc/stdlib/utoa.c @@ -29,8 +29,8 @@ No supporting OS subroutine calls are required. char * _DEFUN (__utoa, (value, str, base), - unsigned value _AND - char *str _AND + unsigned value, + char *str, int base) { const char digits[] = "0123456789abcdefghijklmnopqrstuvwxyz"; @@ -68,8 +68,8 @@ _DEFUN (__utoa, (value, str, base), char * _DEFUN (utoa, (value, str, base), - unsigned value _AND - char *str _AND + unsigned value, + char *str, int base) { return __utoa (value, str, base); diff --git a/newlib/libc/stdlib/wcrtomb.c b/newlib/libc/stdlib/wcrtomb.c index df7741a8c..3b6cbd62c 100644 --- a/newlib/libc/stdlib/wcrtomb.c +++ b/newlib/libc/stdlib/wcrtomb.c @@ -8,9 +8,9 @@ size_t _DEFUN (_wcrtomb_r, (ptr, s, wc, ps), - struct _reent *ptr _AND - char *s _AND - wchar_t wc _AND + struct _reent *ptr, + char *s, + wchar_t wc, mbstate_t *ps) { int retval = 0; @@ -42,8 +42,8 @@ _DEFUN (_wcrtomb_r, (ptr, s, wc, ps), #ifndef _REENT_ONLY size_t _DEFUN (wcrtomb, (s, wc, ps), - char *__restrict s _AND - wchar_t wc _AND + char *__restrict s, + wchar_t wc, mbstate_t *__restrict ps) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/stdlib/wcsnrtombs.c b/newlib/libc/stdlib/wcsnrtombs.c index ed5f36968..3561257cb 100644 --- a/newlib/libc/stdlib/wcsnrtombs.c +++ b/newlib/libc/stdlib/wcsnrtombs.c @@ -139,11 +139,11 @@ _wcsnrtombs_l (struct _reent *r, char *dst, const wchar_t **src, size_t nwc, size_t _DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), - struct _reent *r _AND - char *dst _AND - const wchar_t **src _AND - size_t nwc _AND - size_t len _AND + struct _reent *r, + char *dst, + const wchar_t **src, + size_t nwc, + size_t len, mbstate_t *ps) { return _wcsnrtombs_l (_REENT, dst, src, nwc, len, ps, @@ -153,10 +153,10 @@ _DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), #ifndef _REENT_ONLY size_t _DEFUN (wcsnrtombs, (dst, src, nwc, len, ps), - char *__restrict dst _AND - const wchar_t **__restrict src _AND - size_t nwc _AND - size_t len _AND + char *__restrict dst, + const wchar_t **__restrict src, + size_t nwc, + size_t len, mbstate_t *__restrict ps) { return _wcsnrtombs_l (_REENT, dst, src, nwc, len, ps, diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c index 2b6777cae..ac0c9dece 100644 --- a/newlib/libc/stdlib/wcsrtombs.c +++ b/newlib/libc/stdlib/wcsrtombs.c @@ -6,10 +6,10 @@ size_t _DEFUN (_wcsrtombs_r, (r, dst, src, len, ps), - struct _reent *r _AND - char *dst _AND - const wchar_t **src _AND - size_t len _AND + struct _reent *r, + char *dst, + const wchar_t **src, + size_t len, mbstate_t *ps) { return _wcsnrtombs_r (r, dst, src, (size_t) -1, len, ps); @@ -18,9 +18,9 @@ _DEFUN (_wcsrtombs_r, (r, dst, src, len, ps), #ifndef _REENT_ONLY size_t _DEFUN (wcsrtombs, (dst, src, len, ps), - char *__restrict dst _AND - const wchar_t **__restrict src _AND - size_t len _AND + char *__restrict dst, + const wchar_t **__restrict src, + size_t len, mbstate_t *__restrict ps) { return _wcsnrtombs_r (_REENT, dst, src, (size_t) -1, len, ps); diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c index 201a2c32c..239f8d2c0 100644 --- a/newlib/libc/stdlib/wcstod.c +++ b/newlib/libc/stdlib/wcstod.c @@ -215,8 +215,8 @@ _wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr, double _DEFUN (_wcstod_r, (ptr, nptr, endptr), - struct _reent *ptr _AND - _CONST wchar_t *nptr _AND + struct _reent *ptr, + _CONST wchar_t *nptr, wchar_t **endptr) { return _wcstod_l (ptr, nptr, endptr, __get_current_locale ()); @@ -224,8 +224,8 @@ _DEFUN (_wcstod_r, (ptr, nptr, endptr), float _DEFUN (_wcstof_r, (ptr, nptr, endptr), - struct _reent *ptr _AND - _CONST wchar_t *nptr _AND + struct _reent *ptr, + _CONST wchar_t *nptr, wchar_t **endptr) { double retval = _wcstod_l (ptr, nptr, endptr, __get_current_locale ()); @@ -245,7 +245,7 @@ wcstod_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, double _DEFUN (wcstod, (nptr, endptr), - _CONST wchar_t *__restrict nptr _AND wchar_t **__restrict endptr) + _CONST wchar_t *__restrict nptr, wchar_t **__restrict endptr) { return _wcstod_l (_REENT, nptr, endptr, __get_current_locale ()); } @@ -267,7 +267,7 @@ wcstof_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, float _DEFUN (wcstof, (nptr, endptr), - _CONST wchar_t *__restrict nptr _AND + _CONST wchar_t *__restrict nptr, wchar_t **__restrict endptr) { double val = _wcstod_l (_REENT, nptr, endptr, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wcstol.c b/newlib/libc/stdlib/wcstol.c index 417a46d63..1f5fd4b3a 100644 --- a/newlib/libc/stdlib/wcstol.c +++ b/newlib/libc/stdlib/wcstol.c @@ -214,9 +214,9 @@ _wcstol_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, long _DEFUN (_wcstol_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST wchar_t *nptr _AND - wchar_t **endptr _AND + struct _reent *rptr, + _CONST wchar_t *nptr, + wchar_t **endptr, int base) { return _wcstol_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -233,8 +233,8 @@ wcstol_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, long _DEFUN (wcstol, (s, ptr, base), - _CONST wchar_t *__restrict s _AND - wchar_t **__restrict ptr _AND + _CONST wchar_t *__restrict s, + wchar_t **__restrict ptr, int base) { return _wcstol_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wcstoll.c b/newlib/libc/stdlib/wcstoll.c index 3a7a0e28d..be9500027 100644 --- a/newlib/libc/stdlib/wcstoll.c +++ b/newlib/libc/stdlib/wcstoll.c @@ -214,9 +214,9 @@ _wcstoll_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, long long _DEFUN (_wcstoll_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST wchar_t *nptr _AND - wchar_t **endptr _AND + struct _reent *rptr, + _CONST wchar_t *nptr, + wchar_t **endptr, int base) { return _wcstoll_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -233,8 +233,8 @@ wcstoll_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, long long _DEFUN (wcstoll, (s, ptr, base), - _CONST wchar_t *__restrict s _AND - wchar_t **__restrict ptr _AND + _CONST wchar_t *__restrict s, + wchar_t **__restrict ptr, int base) { return _wcstoll_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wcstombs.c b/newlib/libc/stdlib/wcstombs.c index 9e1937887..6df2dac55 100644 --- a/newlib/libc/stdlib/wcstombs.c +++ b/newlib/libc/stdlib/wcstombs.c @@ -49,8 +49,8 @@ effects vary with the locale. size_t _DEFUN (wcstombs, (s, pwcs, n), - char *__restrict s _AND - const wchar_t *__restrict pwcs _AND + char *__restrict s, + const wchar_t *__restrict pwcs, size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/wcstombs_r.c b/newlib/libc/stdlib/wcstombs_r.c index 0680cd783..d965dc228 100644 --- a/newlib/libc/stdlib/wcstombs_r.c +++ b/newlib/libc/stdlib/wcstombs_r.c @@ -4,10 +4,10 @@ size_t _DEFUN (_wcstombs_r, (reent, s, pwcs, n, state), - struct _reent *r _AND - char *__restrict s _AND - const wchar_t *__restrict pwcs _AND - size_t n _AND + struct _reent *r, + char *__restrict s, + const wchar_t *__restrict pwcs, + size_t n, mbstate_t *state) { char *ptr = s; diff --git a/newlib/libc/stdlib/wcstoul.c b/newlib/libc/stdlib/wcstoul.c index d649810ea..2470bfa71 100644 --- a/newlib/libc/stdlib/wcstoul.c +++ b/newlib/libc/stdlib/wcstoul.c @@ -193,9 +193,9 @@ _wcstoul_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, unsigned long _DEFUN (_wcstoul_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST wchar_t *nptr _AND - wchar_t **endptr _AND + struct _reent *rptr, + _CONST wchar_t *nptr, + wchar_t **endptr, int base) { return _wcstoul_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -212,8 +212,8 @@ wcstoul_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, unsigned long _DEFUN (wcstoul, (s, ptr, base), - _CONST wchar_t *__restrict s _AND - wchar_t **__restrict ptr _AND + _CONST wchar_t *__restrict s, + wchar_t **__restrict ptr, int base) { return _wcstoul_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wcstoull.c b/newlib/libc/stdlib/wcstoull.c index 4bb0cd781..55ab3cae6 100644 --- a/newlib/libc/stdlib/wcstoull.c +++ b/newlib/libc/stdlib/wcstoull.c @@ -209,9 +209,9 @@ _wcstoull_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, unsigned long long _DEFUN (_wcstoull_r, (rptr, nptr, endptr, base), - struct _reent *rptr _AND - _CONST wchar_t *nptr _AND - wchar_t **endptr _AND + struct _reent *rptr, + _CONST wchar_t *nptr, + wchar_t **endptr, int base) { return _wcstoull_l (rptr, nptr, endptr, base, __get_current_locale ()); @@ -228,8 +228,8 @@ wcstoull_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, unsigned long long _DEFUN (wcstoull, (s, ptr, base), - _CONST wchar_t *__restrict s _AND - wchar_t **__restrict ptr _AND + _CONST wchar_t *__restrict s, + wchar_t **__restrict ptr, int base) { return _wcstoull_l (_REENT, s, ptr, base, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wctomb.c b/newlib/libc/stdlib/wctomb.c index 8b267a324..b68a43ba7 100644 --- a/newlib/libc/stdlib/wctomb.c +++ b/newlib/libc/stdlib/wctomb.c @@ -47,7 +47,7 @@ effects vary with the locale. int _DEFUN (wctomb, (s, wchar), - char *s _AND + char *s, wchar_t wchar) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c index 2c018f916..7c4fac1e4 100644 --- a/newlib/libc/stdlib/wctomb_r.c +++ b/newlib/libc/stdlib/wctomb_r.c @@ -8,9 +8,9 @@ int _DEFUN (_wctomb_r, (r, s, wchar, state), - struct _reent *r _AND - char *s _AND - wchar_t _wchar _AND + struct _reent *r, + char *s, + wchar_t _wchar, mbstate_t *state) { return __WCTOMB (r, s, _wchar, state); @@ -18,9 +18,9 @@ _DEFUN (_wctomb_r, (r, s, wchar, state), int _DEFUN (__ascii_wctomb, (r, s, wchar, state), - struct _reent *r _AND - char *s _AND - wchar_t _wchar _AND + struct _reent *r, + char *s, + wchar_t _wchar, mbstate_t *state) { /* Avoids compiler warnings about comparisons that are always false @@ -51,9 +51,9 @@ _DEFUN (__ascii_wctomb, (r, s, wchar, state), int _DEFUN (__utf8_wctomb, (r, s, wchar, state), - struct _reent *r _AND - char *s _AND - wchar_t _wchar _AND + struct _reent *r, + char *s, + wchar_t _wchar, mbstate_t *state) { wint_t wchar = _wchar; @@ -145,9 +145,9 @@ _DEFUN (__utf8_wctomb, (r, s, wchar, state), #ifndef __CYGWIN__ int _DEFUN (__sjis_wctomb, (r, s, wchar, state), - struct _reent *r _AND - char *s _AND - wchar_t _wchar _AND + struct _reent *r, + char *s, + wchar_t _wchar, mbstate_t *state) { wint_t wchar = _wchar; @@ -179,9 +179,9 @@ _DEFUN (__sjis_wctomb, (r, s, wchar, state), int _DEFUN (__eucjp_wctomb, (r, s, wchar, state), - struct _reent *r _AND - char *s _AND - wchar_t _wchar _AND + struct _reent *r, + char *s, + wchar_t _wchar, mbstate_t *state) { wint_t wchar = _wchar; @@ -219,9 +219,9 @@ _DEFUN (__eucjp_wctomb, (r, s, wchar, state), int _DEFUN (__jis_wctomb, (r, s, wchar, state), - struct _reent *r _AND - char *s _AND - wchar_t _wchar _AND + struct _reent *r, + char *s, + wchar_t _wchar, mbstate_t *state) { wint_t wchar = _wchar; diff --git a/newlib/libc/string/bcmp.c b/newlib/libc/string/bcmp.c index 86aada10c..342237742 100644 --- a/newlib/libc/string/bcmp.c +++ b/newlib/libc/string/bcmp.c @@ -33,8 +33,8 @@ QUICKREF int _DEFUN (bcmp, (m1, m2, n), - _CONST void *m1 _AND - _CONST void *m2 _AND + _CONST void *m1, + _CONST void *m2, size_t n) { diff --git a/newlib/libc/string/bcopy.c b/newlib/libc/string/bcopy.c index 22a7f1bfe..1ad8b3e41 100644 --- a/newlib/libc/string/bcopy.c +++ b/newlib/libc/string/bcopy.c @@ -25,8 +25,8 @@ QUICKREF void _DEFUN (bcopy, (b1, b2, length), - _CONST void *b1 _AND - void *b2 _AND + _CONST void *b1, + void *b2, size_t length) { memmove (b2, b1, length); diff --git a/newlib/libc/string/index.c b/newlib/libc/string/index.c index 2c4b49016..756bbff3e 100644 --- a/newlib/libc/string/index.c +++ b/newlib/libc/string/index.c @@ -32,7 +32,7 @@ QUICKREF char * _DEFUN (index, (s, c), - _CONST char *s _AND + _CONST char *s, int c) { return strchr (s, c); diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c index 219aa5cfe..6e49a1c6d 100644 --- a/newlib/libc/string/memccpy.c +++ b/newlib/libc/string/memccpy.c @@ -57,9 +57,9 @@ PORTABILITY _PTR _DEFUN (memccpy, (dst0, src0, endchar, len0), - _PTR __restrict dst0 _AND - _CONST _PTR __restrict src0 _AND - int endchar0 _AND + _PTR __restrict dst0, + _CONST _PTR __restrict src0, + int endchar0, size_t len0) { diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c index 152cd718a..a6c5556d7 100644 --- a/newlib/libc/string/memchr.c +++ b/newlib/libc/string/memchr.c @@ -63,8 +63,8 @@ QUICKREF _PTR _DEFUN (memchr, (src_void, c, length), - _CONST _PTR src_void _AND - int c _AND + _CONST _PTR src_void, + int c, size_t length) { _CONST unsigned char *src = (_CONST unsigned char *) src_void; diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c index 8f86e7afd..1af9219de 100644 --- a/newlib/libc/string/memcmp.c +++ b/newlib/libc/string/memcmp.c @@ -44,8 +44,8 @@ QUICKREF int _DEFUN (memcmp, (m1, m2, n), - _CONST _PTR m1 _AND - _CONST _PTR m2 _AND + _CONST _PTR m1, + _CONST _PTR m2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index c76ab484f..3d0dca209 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -45,8 +45,8 @@ QUICKREF _PTR _DEFUN (memcpy, (dst0, src0, len0), - _PTR __restrict dst0 _AND - _CONST _PTR __restrict src0 _AND + _PTR __restrict dst0, + _CONST _PTR __restrict src0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memmem.c b/newlib/libc/string/memmem.c index 59e19d245..5588b9f59 100644 --- a/newlib/libc/string/memmem.c +++ b/newlib/libc/string/memmem.c @@ -47,9 +47,9 @@ QUICKREF void * _DEFUN (memmem, (haystack_start, haystack_len, needle_start, needle_len), - const void *haystack_start _AND - size_t haystack_len _AND - const void *needle_start _AND + const void *haystack_start, + size_t haystack_len, + const void *needle_start, size_t needle_len) { /* Abstract memory is considered to be an array of 'unsigned char' values, diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c index e6275a7e1..10a3dfd2b 100644 --- a/newlib/libc/string/memmove.c +++ b/newlib/libc/string/memmove.c @@ -51,8 +51,8 @@ QUICKREF _PTR __inhibit_loop_to_libcall _DEFUN (memmove, (dst_void, src_void, length), - _PTR dst_void _AND - _CONST _PTR src_void _AND + _PTR dst_void, + _CONST _PTR src_void, size_t length) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c index 1a8e7cd34..74c453b47 100644 --- a/newlib/libc/string/mempcpy.c +++ b/newlib/libc/string/mempcpy.c @@ -44,8 +44,8 @@ PORTABILITY _PTR _DEFUN (mempcpy, (dst0, src0, len0), - _PTR dst0 _AND - _CONST _PTR src0 _AND + _PTR dst0, + _CONST _PTR src0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c index 974cebc16..6a2c03e4e 100644 --- a/newlib/libc/string/memrchr.c +++ b/newlib/libc/string/memrchr.c @@ -63,8 +63,8 @@ QUICKREF _PTR _DEFUN (memrchr, (src_void, c, length), - _CONST _PTR src_void _AND - int c _AND + _CONST _PTR src_void, + int c, size_t length) { _CONST unsigned char *src = (_CONST unsigned char *) src_void + length - 1; diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c index 7d05478eb..284c36e2c 100644 --- a/newlib/libc/string/memset.c +++ b/newlib/libc/string/memset.c @@ -36,8 +36,8 @@ QUICKREF _PTR __inhibit_loop_to_libcall _DEFUN (memset, (m, c, n), - _PTR m _AND - int c _AND + _PTR m, + int c, size_t n) { char *s = (char *) m; diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c index c1b360dd3..51fe8e37e 100644 --- a/newlib/libc/string/rawmemchr.c +++ b/newlib/libc/string/rawmemchr.c @@ -62,7 +62,7 @@ QUICKREF _PTR _DEFUN (rawmemchr, (src_void, c), - _CONST _PTR src_void _AND + _CONST _PTR src_void, int c) { _CONST unsigned char *src = (_CONST unsigned char *) src_void; diff --git a/newlib/libc/string/rindex.c b/newlib/libc/string/rindex.c index 3284361f8..e18fcb667 100644 --- a/newlib/libc/string/rindex.c +++ b/newlib/libc/string/rindex.c @@ -32,7 +32,7 @@ QUICKREF char * _DEFUN (rindex, (s, c), - _CONST char *s _AND + _CONST char *s, int c) { return strrchr (s, c); diff --git a/newlib/libc/string/stpcpy.c b/newlib/libc/string/stpcpy.c index 6272f1da6..5e00b24a2 100644 --- a/newlib/libc/string/stpcpy.c +++ b/newlib/libc/string/stpcpy.c @@ -54,7 +54,7 @@ QUICKREF char* _DEFUN (stpcpy, (dst, src), - char *__restrict dst _AND + char *__restrict dst, _CONST char *__restrict src) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/stpncpy.c b/newlib/libc/string/stpncpy.c index aa5acd45f..9e8a12950 100644 --- a/newlib/libc/string/stpncpy.c +++ b/newlib/libc/string/stpncpy.c @@ -62,8 +62,8 @@ QUICKREF char * _DEFUN (stpncpy, (dst, src), - char *__restrict dst _AND - _CONST char *__restrict src _AND + char *__restrict dst, + _CONST char *__restrict src, size_t count) { char *ret = NULL; diff --git a/newlib/libc/string/strcasecmp.c b/newlib/libc/string/strcasecmp.c index a6c34862f..1ee8f0ebf 100644 --- a/newlib/libc/string/strcasecmp.c +++ b/newlib/libc/string/strcasecmp.c @@ -37,7 +37,7 @@ QUICKREF int _DEFUN (strcasecmp, (s1, s2), - _CONST char *s1 _AND + _CONST char *s1, _CONST char *s2) { int d = 0; diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c index 599f50227..71ade6664 100644 --- a/newlib/libc/string/strcasestr.c +++ b/newlib/libc/string/strcasestr.c @@ -91,7 +91,7 @@ QUICKREF */ char * _DEFUN (strcasestr, (s, find), - _CONST char *s _AND + _CONST char *s, _CONST char *find) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcat.c b/newlib/libc/string/strcat.c index 44b6b03f0..96de39ba2 100644 --- a/newlib/libc/string/strcat.c +++ b/newlib/libc/string/strcat.c @@ -55,7 +55,7 @@ QUICKREF char * _DEFUN (strcat, (s1, s2), - char *__restrict s1 _AND + char *__restrict s1, _CONST char *__restrict s2) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c index 7147bd457..f293612d5 100644 --- a/newlib/libc/string/strchr.c +++ b/newlib/libc/string/strchr.c @@ -53,7 +53,7 @@ QUICKREF char * _DEFUN (strchr, (s1, i), - _CONST char *s1 _AND + _CONST char *s1, int i) { _CONST unsigned char *s = (_CONST unsigned char *)s1; diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c index 3b6cd62fb..3d110b920 100644 --- a/newlib/libc/string/strchrnul.c +++ b/newlib/libc/string/strchrnul.c @@ -32,7 +32,7 @@ QUICKREF char * _DEFUN (strchrnul, (s1, i), - _CONST char *s1 _AND + _CONST char *s1, int i) { char *s = strchr(s1, i); diff --git a/newlib/libc/string/strcmp.c b/newlib/libc/string/strcmp.c index d5e9148ef..c117c38ff 100644 --- a/newlib/libc/string/strcmp.c +++ b/newlib/libc/string/strcmp.c @@ -53,7 +53,7 @@ QUICKREF int _DEFUN (strcmp, (s1, s2), - _CONST char *s1 _AND + _CONST char *s1, _CONST char *s2) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcoll.c b/newlib/libc/string/strcoll.c index 551ede65b..d95a42e2b 100644 --- a/newlib/libc/string/strcoll.c +++ b/newlib/libc/string/strcoll.c @@ -37,7 +37,7 @@ QUICKREF int _DEFUN (strcoll, (a, b), - _CONST char *a _AND + _CONST char *a, _CONST char *b) { diff --git a/newlib/libc/string/strcpy.c b/newlib/libc/string/strcpy.c index 9670d2c13..4354472d3 100644 --- a/newlib/libc/string/strcpy.c +++ b/newlib/libc/string/strcpy.c @@ -53,7 +53,7 @@ QUICKREF char* _DEFUN (strcpy, (dst0, src0), - char *dst0 _AND + char *dst0, _CONST char *src0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c index f80b61f37..f0e30c80c 100644 --- a/newlib/libc/string/strcspn.c +++ b/newlib/libc/string/strcspn.c @@ -27,7 +27,7 @@ PORTABILITY size_t _DEFUN (strcspn, (s1, s2), - _CONST char *s1 _AND + _CONST char *s1, _CONST char *s2) { _CONST char *s = s1; diff --git a/newlib/libc/string/strdup_r.c b/newlib/libc/string/strdup_r.c index ef77a58eb..474ec9668 100644 --- a/newlib/libc/string/strdup_r.c +++ b/newlib/libc/string/strdup_r.c @@ -4,7 +4,7 @@ char * _DEFUN (_strdup_r, (reent_ptr, str), - struct _reent *reent_ptr _AND + struct _reent *reent_ptr, _CONST char *str) { size_t len = strlen (str) + 1; diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c index 8da7d5185..43fa1f592 100644 --- a/newlib/libc/string/strerror.c +++ b/newlib/libc/string/strerror.c @@ -386,9 +386,9 @@ QUICKREF char * _DEFUN (_strerror_r, (ptr, errnum, internal, errptr), - struct _reent *ptr _AND - int errnum _AND - int internal _AND + struct _reent *ptr, + int errnum, + int internal, int *errptr) { char *error; diff --git a/newlib/libc/string/strerror_r.c b/newlib/libc/string/strerror_r.c index af9337563..c888f9ff3 100644 --- a/newlib/libc/string/strerror_r.c +++ b/newlib/libc/string/strerror_r.c @@ -66,8 +66,8 @@ a non-empty alternate string without assigning into its third argument. see xpg_strerror_r.c for the POSIX version. */ char * _DEFUN (strerror_r, (errnum, buffer, n), - int errnum _AND - char *buffer _AND + int errnum, + char *buffer, size_t n) { char *error = _strerror_r (_REENT, errnum, 1, NULL); diff --git a/newlib/libc/string/strlcat.c b/newlib/libc/string/strlcat.c index 0c47bd527..c606f3b30 100644 --- a/newlib/libc/string/strlcat.c +++ b/newlib/libc/string/strlcat.c @@ -43,8 +43,8 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp */ size_t _DEFUN (strlcat, (dst, src, siz), - char *dst _AND - _CONST char *src _AND + char *dst, + _CONST char *src, size_t siz) { register char *d = dst; diff --git a/newlib/libc/string/strlcpy.c b/newlib/libc/string/strlcpy.c index c31001642..300ac82c1 100644 --- a/newlib/libc/string/strlcpy.c +++ b/newlib/libc/string/strlcpy.c @@ -41,8 +41,8 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp */ size_t _DEFUN (strlcpy, (dst, src, siz), - char *dst _AND - _CONST char *src _AND + char *dst, + _CONST char *src, size_t siz) { register char *d = dst; diff --git a/newlib/libc/string/strncasecmp.c b/newlib/libc/string/strncasecmp.c index c06294232..a30fccf81 100644 --- a/newlib/libc/string/strncasecmp.c +++ b/newlib/libc/string/strncasecmp.c @@ -38,8 +38,8 @@ QUICKREF int _DEFUN (strncasecmp, (s1, s2, n), - _CONST char *s1 _AND - _CONST char *s2 _AND + _CONST char *s1, + _CONST char *s2, size_t n) { int d = 0; diff --git a/newlib/libc/string/strncat.c b/newlib/libc/string/strncat.c index 761cf87a7..f800221c6 100644 --- a/newlib/libc/string/strncat.c +++ b/newlib/libc/string/strncat.c @@ -59,8 +59,8 @@ QUICKREF char * _DEFUN (strncat, (s1, s2, n), - char *__restrict s1 _AND - _CONST char *__restrict s2 _AND + char *__restrict s1, + _CONST char *__restrict s2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strncmp.c b/newlib/libc/string/strncmp.c index 3bbe47bcc..98a31d32b 100644 --- a/newlib/libc/string/strncmp.c +++ b/newlib/libc/string/strncmp.c @@ -53,8 +53,8 @@ QUICKREF int _DEFUN (strncmp, (s1, s2, n), - _CONST char *s1 _AND - _CONST char *s2 _AND + _CONST char *s1, + _CONST char *s2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strncpy.c b/newlib/libc/string/strncpy.c index 83596f408..91b274590 100644 --- a/newlib/libc/string/strncpy.c +++ b/newlib/libc/string/strncpy.c @@ -60,8 +60,8 @@ QUICKREF char * _DEFUN (strncpy, (dst0, src0), - char *__restrict dst0 _AND - _CONST char *__restrict src0 _AND + char *__restrict dst0, + _CONST char *__restrict src0, size_t count) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strndup.c b/newlib/libc/string/strndup.c index caa1b68b7..64e9ae68e 100644 --- a/newlib/libc/string/strndup.c +++ b/newlib/libc/string/strndup.c @@ -7,7 +7,7 @@ char * _DEFUN (strndup, (str, n), - _CONST char *str _AND + _CONST char *str, size_t n) { return _strndup_r (_REENT, str, n); diff --git a/newlib/libc/string/strndup_r.c b/newlib/libc/string/strndup_r.c index 2acf63dec..c8ec072fa 100644 --- a/newlib/libc/string/strndup_r.c +++ b/newlib/libc/string/strndup_r.c @@ -4,8 +4,8 @@ char * _DEFUN (_strndup_r, (reent_ptr, str, n), - struct _reent *reent_ptr _AND - _CONST char *str _AND + struct _reent *reent_ptr, + _CONST char *str, size_t n) { _CONST char *ptr = str; diff --git a/newlib/libc/string/strnlen.c b/newlib/libc/string/strnlen.c index 07ece0d8b..4978f726d 100644 --- a/newlib/libc/string/strnlen.c +++ b/newlib/libc/string/strnlen.c @@ -31,7 +31,7 @@ PORTABILITY size_t _DEFUN (strnlen, (str, n), - _CONST char *str _AND + _CONST char *str, size_t n) { _CONST char *start = str; diff --git a/newlib/libc/string/strpbrk.c b/newlib/libc/string/strpbrk.c index 4507a86a4..f589fbdac 100644 --- a/newlib/libc/string/strpbrk.c +++ b/newlib/libc/string/strpbrk.c @@ -26,7 +26,7 @@ PORTABILITY char * _DEFUN (strpbrk, (s1, s2), - _CONST char *s1 _AND + _CONST char *s1, _CONST char *s2) { _CONST char *c = s2; diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c index 8217c6df3..721bb91dc 100644 --- a/newlib/libc/string/strrchr.c +++ b/newlib/libc/string/strrchr.c @@ -31,7 +31,7 @@ QUICKREF char * _DEFUN (strrchr, (s, i), - _CONST char *s _AND + _CONST char *s, int i) { _CONST char *last = NULL; diff --git a/newlib/libc/string/strsep.c b/newlib/libc/string/strsep.c index d3d0ad0a9..e59782795 100644 --- a/newlib/libc/string/strsep.c +++ b/newlib/libc/string/strsep.c @@ -12,7 +12,7 @@ extern char *__strtok_r (char *, const char *, char **, int); char * _DEFUN (strsep, (source_ptr, delim), - register char **source_ptr _AND + register char **source_ptr, register const char *delim) { return __strtok_r (*source_ptr, delim, source_ptr, 0); diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c index 3f43b8f82..287da4d7e 100644 --- a/newlib/libc/string/strspn.c +++ b/newlib/libc/string/strspn.c @@ -31,7 +31,7 @@ QUICKREF size_t _DEFUN (strspn, (s1, s2), - _CONST char *s1 _AND + _CONST char *s1, _CONST char *s2) { _CONST char *s = s1; diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c index 288c74466..94fe297e7 100644 --- a/newlib/libc/string/strstr.c +++ b/newlib/libc/string/strstr.c @@ -40,7 +40,7 @@ QUICKREF char * _DEFUN (strstr, (searchee, lookfor), - _CONST char *searchee _AND + _CONST char *searchee, _CONST char *lookfor) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c index a24c538e4..92c801731 100644 --- a/newlib/libc/string/strtok.c +++ b/newlib/libc/string/strtok.c @@ -80,7 +80,7 @@ extern char *__strtok_r (char *, const char *, char **, int); char * _DEFUN (strtok, (s, delim), - register char *__restrict s _AND + register char *__restrict s, register const char *__restrict delim) { struct _reent *reent = _REENT; diff --git a/newlib/libc/string/strtok_r.c b/newlib/libc/string/strtok_r.c index 6ace7008b..0d01dcaad 100644 --- a/newlib/libc/string/strtok_r.c +++ b/newlib/libc/string/strtok_r.c @@ -31,9 +31,9 @@ char * _DEFUN (__strtok_r, (s, delim, lasts, skip_leading_delim), - register char *s _AND - register const char *delim _AND - char **lasts _AND + register char *s, + register const char *delim, + char **lasts, int skip_leading_delim) { register char *spanp; @@ -91,8 +91,8 @@ cont: char * _DEFUN (strtok_r, (s, delim, lasts), - register char *__restrict s _AND - register const char *__restrict delim _AND + register char *__restrict s, + register const char *__restrict delim, char **__restrict lasts) { return __strtok_r (s, delim, lasts, 1); diff --git a/newlib/libc/string/strxfrm.c b/newlib/libc/string/strxfrm.c index de397210b..55b81b335 100644 --- a/newlib/libc/string/strxfrm.c +++ b/newlib/libc/string/strxfrm.c @@ -47,8 +47,8 @@ QUICKREF size_t _DEFUN (strxfrm, (s1, s2, n), - char *__restrict s1 _AND - _CONST char *__restrict s2 _AND + char *__restrict s1, + _CONST char *__restrict s2, size_t n) { size_t res; diff --git a/newlib/libc/string/swab.c b/newlib/libc/string/swab.c index ecf5abed9..b08066875 100644 --- a/newlib/libc/string/swab.c +++ b/newlib/libc/string/swab.c @@ -19,8 +19,8 @@ PORTABILITY void _DEFUN (swab, (b1, b2, length), - _CONST void *b1 _AND - void *b2 _AND + _CONST void *b1, + void *b2, ssize_t length) { const char *from = b1; diff --git a/newlib/libc/string/u_strerr.c b/newlib/libc/string/u_strerr.c index 2978df0cf..d3204df72 100644 --- a/newlib/libc/string/u_strerr.c +++ b/newlib/libc/string/u_strerr.c @@ -2,8 +2,8 @@ char * _DEFUN(_user_strerror, (errnum, internal, errptr), - int errnum _AND - int internal _AND + int errnum, + int internal, int *errptr) { /* prevent warning about unused parameters */ diff --git a/newlib/libc/string/wcpcpy.c b/newlib/libc/string/wcpcpy.c index f0f9c4a08..0fda226e7 100644 --- a/newlib/libc/string/wcpcpy.c +++ b/newlib/libc/string/wcpcpy.c @@ -27,7 +27,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcpcpy, (s1, s2), - wchar_t *__restrict s1 _AND + wchar_t *__restrict s1, _CONST wchar_t *__restrict s2) { while ((*s1++ = *s2++)) diff --git a/newlib/libc/string/wcpncpy.c b/newlib/libc/string/wcpncpy.c index 8f7ee796f..f643b1e43 100644 --- a/newlib/libc/string/wcpncpy.c +++ b/newlib/libc/string/wcpncpy.c @@ -34,8 +34,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcpncpy, (dst, src, count), - wchar_t *__restrict dst _AND - _CONST wchar_t *__restrict src _AND + wchar_t *__restrict dst, + _CONST wchar_t *__restrict src, size_t count) { wchar_t *ret = NULL; diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c index 26c7cc237..f23e37227 100644 --- a/newlib/libc/string/wcscasecmp.c +++ b/newlib/libc/string/wcscasecmp.c @@ -37,7 +37,7 @@ QUICKREF int _DEFUN (wcscasecmp, (s1, s2), - _CONST wchar_t *s1 _AND + _CONST wchar_t *s1, _CONST wchar_t *s2) { int d = 0; diff --git a/newlib/libc/string/wcscat.c b/newlib/libc/string/wcscat.c index 586512d0f..900c3cc52 100644 --- a/newlib/libc/string/wcscat.c +++ b/newlib/libc/string/wcscat.c @@ -62,7 +62,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcscat, (s1, s2), - wchar_t *__restrict s1 _AND + wchar_t *__restrict s1, _CONST wchar_t *__restrict s2) { wchar_t *p; diff --git a/newlib/libc/string/wcschr.c b/newlib/libc/string/wcschr.c index c705a08d5..7590009e9 100644 --- a/newlib/libc/string/wcschr.c +++ b/newlib/libc/string/wcschr.c @@ -59,7 +59,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcschr, (s, c), - _CONST wchar_t * s _AND + _CONST wchar_t * s, wchar_t c) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcscmp.c b/newlib/libc/string/wcscmp.c index 8155742b8..f14eb5d8d 100644 --- a/newlib/libc/string/wcscmp.c +++ b/newlib/libc/string/wcscmp.c @@ -68,7 +68,7 @@ No supporting OS subroutines are required. */ int _DEFUN (wcscmp, (s1, s2), - _CONST wchar_t * s1 _AND + _CONST wchar_t * s1, _CONST wchar_t * s2) { diff --git a/newlib/libc/string/wcscoll.c b/newlib/libc/string/wcscoll.c index 020f7e57f..27a12456e 100644 --- a/newlib/libc/string/wcscoll.c +++ b/newlib/libc/string/wcscoll.c @@ -34,7 +34,7 @@ PORTABILITY int _DEFUN (wcscoll, (a, b), - _CONST wchar_t *a _AND + _CONST wchar_t *a, _CONST wchar_t *b) { diff --git a/newlib/libc/string/wcscpy.c b/newlib/libc/string/wcscpy.c index 79f065ca0..2dff63996 100644 --- a/newlib/libc/string/wcscpy.c +++ b/newlib/libc/string/wcscpy.c @@ -58,7 +58,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcscpy, (s1, s2), - wchar_t *__restrict s1 _AND + wchar_t *__restrict s1, _CONST wchar_t *__restrict s2) { wchar_t *p; diff --git a/newlib/libc/string/wcscspn.c b/newlib/libc/string/wcscspn.c index 7be5f5eee..355499699 100644 --- a/newlib/libc/string/wcscspn.c +++ b/newlib/libc/string/wcscspn.c @@ -57,7 +57,7 @@ No supporting OS subroutines are required. size_t _DEFUN (wcscspn, (s, set), - _CONST wchar_t * s _AND + _CONST wchar_t * s, _CONST wchar_t * set) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcslcat.c b/newlib/libc/string/wcslcat.c index 2caa58820..1015c4c36 100644 --- a/newlib/libc/string/wcslcat.c +++ b/newlib/libc/string/wcslcat.c @@ -69,8 +69,8 @@ No supporting OS subroutines are required. */ size_t _DEFUN (wcslcat, (dst, src, siz), - wchar_t * dst _AND - _CONST wchar_t * src _AND + wchar_t * dst, + _CONST wchar_t * src, size_t siz) { wchar_t *d = dst; diff --git a/newlib/libc/string/wcslcpy.c b/newlib/libc/string/wcslcpy.c index 34352fb9d..396dda71a 100644 --- a/newlib/libc/string/wcslcpy.c +++ b/newlib/libc/string/wcslcpy.c @@ -63,8 +63,8 @@ No supporting OS subroutines are required. */ size_t _DEFUN (wcslcpy, (dst, src, siz), - wchar_t * dst _AND - _CONST wchar_t * src _AND + wchar_t * dst, + _CONST wchar_t * src, size_t siz) { wchar_t *d = dst; diff --git a/newlib/libc/string/wcsncasecmp.c b/newlib/libc/string/wcsncasecmp.c index a339bbfa5..90f310158 100644 --- a/newlib/libc/string/wcsncasecmp.c +++ b/newlib/libc/string/wcsncasecmp.c @@ -38,8 +38,8 @@ QUICKREF int _DEFUN (wcsncasecmp, (s1, s2, n), - _CONST wchar_t *s1 _AND - _CONST wchar_t *s2 _AND + _CONST wchar_t *s1, + _CONST wchar_t *s2, size_t n) { int d = 0; diff --git a/newlib/libc/string/wcsncat.c b/newlib/libc/string/wcsncat.c index 34a694790..57dc9031b 100644 --- a/newlib/libc/string/wcsncat.c +++ b/newlib/libc/string/wcsncat.c @@ -63,8 +63,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcsncat, (s1, s2, n), - wchar_t *__restrict s1 _AND - _CONST wchar_t *__restrict s2 _AND + wchar_t *__restrict s1, + _CONST wchar_t *__restrict s2, size_t n) { wchar_t *p; diff --git a/newlib/libc/string/wcsncmp.c b/newlib/libc/string/wcsncmp.c index 72c5d1291..83b899d84 100644 --- a/newlib/libc/string/wcsncmp.c +++ b/newlib/libc/string/wcsncmp.c @@ -64,8 +64,8 @@ No supporting OS subroutines are required. int _DEFUN (wcsncmp, (s1, s2, n), - _CONST wchar_t * s1 _AND - _CONST wchar_t * s2 _AND + _CONST wchar_t * s1, + _CONST wchar_t * s2, size_t n) { diff --git a/newlib/libc/string/wcsncpy.c b/newlib/libc/string/wcsncpy.c index 793e522da..d09b95df7 100644 --- a/newlib/libc/string/wcsncpy.c +++ b/newlib/libc/string/wcsncpy.c @@ -36,8 +36,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcsncpy, (s1, s2, n), - wchar_t *__restrict s1 _AND - _CONST wchar_t *__restrict s2 _AND + wchar_t *__restrict s1, + _CONST wchar_t *__restrict s2, size_t n) { wchar_t *dscan=s1; diff --git a/newlib/libc/string/wcsnlen.c b/newlib/libc/string/wcsnlen.c index 77aad65a3..e9715e749 100644 --- a/newlib/libc/string/wcsnlen.c +++ b/newlib/libc/string/wcsnlen.c @@ -53,7 +53,7 @@ PORTABILITY size_t _DEFUN(wcsnlen, (s, maxlen), - _CONST wchar_t *s _AND + _CONST wchar_t *s, size_t maxlen) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcspbrk.c b/newlib/libc/string/wcspbrk.c index 55401f1a9..b4d8230cc 100644 --- a/newlib/libc/string/wcspbrk.c +++ b/newlib/libc/string/wcspbrk.c @@ -58,7 +58,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcspbrk, (s, set), - _CONST wchar_t * s _AND + _CONST wchar_t * s, _CONST wchar_t * set) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcsrchr.c b/newlib/libc/string/wcsrchr.c index b99cb9760..68f1e28b6 100644 --- a/newlib/libc/string/wcsrchr.c +++ b/newlib/libc/string/wcsrchr.c @@ -61,7 +61,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcsrchr, (s, c), - _CONST wchar_t * s _AND + _CONST wchar_t * s, wchar_t c) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcsspn.c b/newlib/libc/string/wcsspn.c index 652d971dd..8e8ce6c69 100644 --- a/newlib/libc/string/wcsspn.c +++ b/newlib/libc/string/wcsspn.c @@ -57,7 +57,7 @@ No supporting OS subroutines are required. size_t _DEFUN (wcsspn, (s, set), - _CONST wchar_t * s _AND + _CONST wchar_t * s, _CONST wchar_t * set) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcsstr.c b/newlib/libc/string/wcsstr.c index bb6e3eda8..2fdec0f97 100644 --- a/newlib/libc/string/wcsstr.c +++ b/newlib/libc/string/wcsstr.c @@ -62,7 +62,7 @@ PORTABILITY wchar_t * _DEFUN (wcsstr, (big, little), - _CONST wchar_t *__restrict big _AND + _CONST wchar_t *__restrict big, _CONST wchar_t *__restrict little) { _CONST wchar_t *p; diff --git a/newlib/libc/string/wcstok.c b/newlib/libc/string/wcstok.c index 091f4bd3e..2467704fd 100644 --- a/newlib/libc/string/wcstok.c +++ b/newlib/libc/string/wcstok.c @@ -91,8 +91,8 @@ QUICKREF wchar_t * _DEFUN (wcstok, (s, delim, lasts), - register wchar_t *__restrict s _AND - register const wchar_t *__restrict delim _AND + register wchar_t *__restrict s, + register const wchar_t *__restrict delim, wchar_t **__restrict lasts) { register const wchar_t *spanp; diff --git a/newlib/libc/string/wcswidth.c b/newlib/libc/string/wcswidth.c index 4cb8fa812..3764883a9 100644 --- a/newlib/libc/string/wcswidth.c +++ b/newlib/libc/string/wcswidth.c @@ -35,7 +35,7 @@ PORTABILITY int _DEFUN (wcswidth, (pwcs, n), - _CONST wchar_t *pwcs _AND + _CONST wchar_t *pwcs, size_t n) { diff --git a/newlib/libc/string/wcsxfrm.c b/newlib/libc/string/wcsxfrm.c index e11516ff4..6911b21e2 100644 --- a/newlib/libc/string/wcsxfrm.c +++ b/newlib/libc/string/wcsxfrm.c @@ -37,8 +37,8 @@ PORTABILITY size_t _DEFUN (wcsxfrm, (a, b, n), - wchar_t *__restrict a _AND - _CONST wchar_t *__restrict b _AND + wchar_t *__restrict a, + _CONST wchar_t *__restrict b, size_t n) { diff --git a/newlib/libc/string/wmemchr.c b/newlib/libc/string/wmemchr.c index 097e47a03..2a6f8e1a4 100644 --- a/newlib/libc/string/wmemchr.c +++ b/newlib/libc/string/wmemchr.c @@ -64,8 +64,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmemchr, (s, c, n), - _CONST wchar_t * s _AND - wchar_t c _AND + _CONST wchar_t * s, + wchar_t c, size_t n) { size_t i; diff --git a/newlib/libc/string/wmemcmp.c b/newlib/libc/string/wmemcmp.c index a01bf32f1..bfe1e69b4 100644 --- a/newlib/libc/string/wmemcmp.c +++ b/newlib/libc/string/wmemcmp.c @@ -63,8 +63,8 @@ No supporting OS subroutines are required. int _DEFUN (wmemcmp, (s1, s2, n), - _CONST wchar_t * s1 _AND - _CONST wchar_t * s2 _AND + _CONST wchar_t * s1, + _CONST wchar_t * s2, size_t n) { size_t i; diff --git a/newlib/libc/string/wmemcpy.c b/newlib/libc/string/wmemcpy.c index 0e8d6e494..9e4fdc517 100644 --- a/newlib/libc/string/wmemcpy.c +++ b/newlib/libc/string/wmemcpy.c @@ -62,8 +62,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmemcpy, (d, s, n), - wchar_t *__restrict d _AND - _CONST wchar_t *__restrict s _AND + wchar_t *__restrict d, + _CONST wchar_t *__restrict s, size_t n) { diff --git a/newlib/libc/string/wmemmove.c b/newlib/libc/string/wmemmove.c index 18d2a2bfd..567f55afd 100644 --- a/newlib/libc/string/wmemmove.c +++ b/newlib/libc/string/wmemmove.c @@ -67,8 +67,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmemmove, (d, s, n), - wchar_t * d _AND - _CONST wchar_t * s _AND + wchar_t * d, + _CONST wchar_t * s, size_t n) { diff --git a/newlib/libc/string/wmempcpy.c b/newlib/libc/string/wmempcpy.c index a3b2ce637..f11485262 100644 --- a/newlib/libc/string/wmempcpy.c +++ b/newlib/libc/string/wmempcpy.c @@ -35,8 +35,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmempcpy, (d, s, n), - wchar_t *__restrict d _AND - _CONST wchar_t *__restrict s _AND + wchar_t *__restrict d, + _CONST wchar_t *__restrict s, size_t n) { return (wchar_t *) mempcpy (d, s, n * sizeof (wchar_t)); diff --git a/newlib/libc/string/wmemset.c b/newlib/libc/string/wmemset.c index 377fbee1f..f9ec361cd 100644 --- a/newlib/libc/string/wmemset.c +++ b/newlib/libc/string/wmemset.c @@ -60,8 +60,8 @@ No supporting OS subroutines are required. wchar_t * _DEFUN(wmemset, (s, c, n), - wchar_t *s _AND - wchar_t c _AND + wchar_t *s, + wchar_t c, size_t n) { size_t i; diff --git a/newlib/libc/string/xpg_strerror_r.c b/newlib/libc/string/xpg_strerror_r.c index e503880b0..bc1858738 100644 --- a/newlib/libc/string/xpg_strerror_r.c +++ b/newlib/libc/string/xpg_strerror_r.c @@ -5,8 +5,8 @@ int _DEFUN (__xpg_strerror_r, (errnum, buffer, n), - int errnum _AND - char *buffer _AND + int errnum, + char *buffer, size_t n) { char *error; diff --git a/newlib/libc/sys/a29khif/kill.c b/newlib/libc/sys/a29khif/kill.c index ff9fe5428..0254367e4 100644 --- a/newlib/libc/sys/a29khif/kill.c +++ b/newlib/libc/sys/a29khif/kill.c @@ -7,7 +7,7 @@ int _DEFUN (_kill, (pid, sig), - int pid _AND + int pid, int sig) { if (pid == 1 || pid < 0) diff --git a/newlib/libc/sys/h8300hms/misc.c b/newlib/libc/sys/h8300hms/misc.c index 6021b5cb6..4869af2d3 100644 --- a/newlib/libc/sys/h8300hms/misc.c +++ b/newlib/libc/sys/h8300hms/misc.c @@ -19,7 +19,7 @@ int _DEFUN(_getpid,(),) } int _DEFUN(_kill,(pid, sig), - int pid _AND + int pid, int sig) { if (pid == 0) diff --git a/newlib/libc/sys/h8500hms/misc.c b/newlib/libc/sys/h8500hms/misc.c index a791704a1..d16c797d9 100644 --- a/newlib/libc/sys/h8500hms/misc.c +++ b/newlib/libc/sys/h8500hms/misc.c @@ -20,7 +20,7 @@ int _DEFUN(_getpid,(),) } int _DEFUN(_kill,(pid, sig), - int pid _AND + int pid, int sig) { if (sig == SIGABRT) diff --git a/newlib/libc/sys/linux/pread.c b/newlib/libc/sys/linux/pread.c index ff8371e15..8a016e08a 100644 --- a/newlib/libc/sys/linux/pread.c +++ b/newlib/libc/sys/linux/pread.c @@ -7,10 +7,10 @@ ssize_t _DEFUN (_pread_r, (rptr, fd, buf, n, off), - struct _reent *rptr _AND - int fd _AND - _PTR buf _AND - size_t n _AND + struct _reent *rptr, + int fd, + _PTR buf, + size_t n, off_t off) { off_t cur_pos; @@ -34,9 +34,9 @@ _DEFUN (_pread_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (__libc_pread, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND + int fd, + _PTR buf, + size_t n, off_t off) { return _pread_r (_REENT, fd, buf, n, off); diff --git a/newlib/libc/sys/linux/pread64.c b/newlib/libc/sys/linux/pread64.c index 3ced04818..f95989b45 100644 --- a/newlib/libc/sys/linux/pread64.c +++ b/newlib/libc/sys/linux/pread64.c @@ -31,9 +31,9 @@ Supporting OS subroutine required: <>, <>. ssize_t _DEFUN (__libc_pread64, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND + int fd, + _PTR buf, + size_t n, loff_t off) { loff_t cur_pos; diff --git a/newlib/libc/sys/linux/pwrite.c b/newlib/libc/sys/linux/pwrite.c index 239463e59..c2b79ad13 100644 --- a/newlib/libc/sys/linux/pwrite.c +++ b/newlib/libc/sys/linux/pwrite.c @@ -7,10 +7,10 @@ ssize_t _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), - struct _reent *rptr _AND - int fd _AND - _CONST _PTR buf _AND - size_t n _AND + struct _reent *rptr, + int fd, + _CONST _PTR buf, + size_t n, off_t off) { off_t cur_pos; @@ -34,9 +34,9 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (__libc_pwrite, (fd, buf, n, off), - int fd _AND - _CONST _PTR buf _AND - size_t n _AND + int fd, + _CONST _PTR buf, + size_t n, off_t off) { return _pwrite_r (_REENT, fd, buf, n, off); diff --git a/newlib/libc/sys/linux/pwrite64.c b/newlib/libc/sys/linux/pwrite64.c index 876749943..d486988dd 100644 --- a/newlib/libc/sys/linux/pwrite64.c +++ b/newlib/libc/sys/linux/pwrite64.c @@ -31,9 +31,9 @@ Supporting OS subroutine required: <>, <>. ssize_t _DEFUN (__libc_pwrite64, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND + int fd, + _PTR buf, + size_t n, loff_t off) { loff_t cur_pos; diff --git a/newlib/libc/sys/sysnec810/misc.c b/newlib/libc/sys/sysnec810/misc.c index f44c03d51..354ecd81c 100644 --- a/newlib/libc/sys/sysnec810/misc.c +++ b/newlib/libc/sys/sysnec810/misc.c @@ -31,7 +31,7 @@ isatty() { int _DEFUN(_fstat,(file, st), - int file _AND + int file, struct stat *st) { st->st_mode = S_IFCHR; diff --git a/newlib/libc/syscalls/sysexecve.c b/newlib/libc/syscalls/sysexecve.c index 154c082f9..3471e893f 100644 --- a/newlib/libc/syscalls/sysexecve.c +++ b/newlib/libc/syscalls/sysexecve.c @@ -5,8 +5,8 @@ int _DEFUN (execve, (name, argv, env), - _CONST char *name _AND - char *_CONST argv[] _AND + _CONST char *name, + char *_CONST argv[], char *_CONST env[]) { return _execve_r (_REENT, name, argv, env); diff --git a/newlib/libc/syscalls/sysfcntl.c b/newlib/libc/syscalls/sysfcntl.c index 12d09a8af..b063d766f 100644 --- a/newlib/libc/syscalls/sysfcntl.c +++ b/newlib/libc/syscalls/sysfcntl.c @@ -6,8 +6,8 @@ int _DEFUN (fcntl, (fd, flag, arg), - int fd _AND - int flag _AND + int fd, + int flag, int arg) { #ifdef HAVE_FCNTL diff --git a/newlib/libc/syscalls/sysfstat.c b/newlib/libc/syscalls/sysfstat.c index 7ce2c9dfe..1ab7d62fa 100644 --- a/newlib/libc/syscalls/sysfstat.c +++ b/newlib/libc/syscalls/sysfstat.c @@ -6,7 +6,7 @@ int _DEFUN (fstat, (fd, pstat), - int fd _AND + int fd, struct stat *pstat) { return _fstat_r (_REENT, fd, pstat); diff --git a/newlib/libc/syscalls/sysgettod.c b/newlib/libc/syscalls/sysgettod.c index af6d8ab3f..f52f0045f 100644 --- a/newlib/libc/syscalls/sysgettod.c +++ b/newlib/libc/syscalls/sysgettod.c @@ -6,7 +6,7 @@ int _DEFUN (gettimeofday, (ptimeval, ptimezone), - struct timeval *ptimeval _AND + struct timeval *ptimeval, void *ptimezone) { return _gettimeofday_r (_REENT, ptimeval, ptimezone); diff --git a/newlib/libc/syscalls/syskill.c b/newlib/libc/syscalls/syskill.c index 27f16be97..03e06c07a 100644 --- a/newlib/libc/syscalls/syskill.c +++ b/newlib/libc/syscalls/syskill.c @@ -5,7 +5,7 @@ int _DEFUN (kill, (pid, sig), - int pid _AND + int pid, int sig) { return _kill_r (_REENT, pid, sig); diff --git a/newlib/libc/syscalls/syslink.c b/newlib/libc/syscalls/syslink.c index 327870769..afcf3559e 100644 --- a/newlib/libc/syscalls/syslink.c +++ b/newlib/libc/syscalls/syslink.c @@ -5,7 +5,7 @@ int _DEFUN (link, (old, new), - _CONST char *old _AND + _CONST char *old, _CONST char *new) { return _link_r (_REENT, old, new); diff --git a/newlib/libc/syscalls/syslseek.c b/newlib/libc/syscalls/syslseek.c index 275d67ce4..41cfbf745 100644 --- a/newlib/libc/syscalls/syslseek.c +++ b/newlib/libc/syscalls/syslseek.c @@ -5,8 +5,8 @@ off_t _DEFUN (lseek, (fd, pos, whence), - int fd _AND - off_t pos _AND + int fd, + off_t pos, int whence) { return _lseek_r (_REENT, fd, pos, whence); diff --git a/newlib/libc/syscalls/sysopen.c b/newlib/libc/syscalls/sysopen.c index ed0cb604a..3909564cf 100644 --- a/newlib/libc/syscalls/sysopen.c +++ b/newlib/libc/syscalls/sysopen.c @@ -11,7 +11,7 @@ int _DEFUN (open, (file, flags, ...), - const char *file _AND + const char *file, int flags _DOTS) { va_list ap; diff --git a/newlib/libc/syscalls/sysread.c b/newlib/libc/syscalls/sysread.c index bcf002d9d..e45b76336 100644 --- a/newlib/libc/syscalls/sysread.c +++ b/newlib/libc/syscalls/sysread.c @@ -5,8 +5,8 @@ _READ_WRITE_RETURN_TYPE _DEFUN (read, (fd, buf, cnt), - int fd _AND - void *buf _AND + int fd, + void *buf, size_t cnt) { return _read_r (_REENT, fd, buf, cnt); diff --git a/newlib/libc/syscalls/sysstat.c b/newlib/libc/syscalls/sysstat.c index fdf029cef..4f4cd8a78 100644 --- a/newlib/libc/syscalls/sysstat.c +++ b/newlib/libc/syscalls/sysstat.c @@ -6,7 +6,7 @@ int _DEFUN (stat, (file, pstat), - _CONST char *file _AND + _CONST char *file, struct stat *pstat) { return _stat_r (_REENT, file, pstat); diff --git a/newlib/libc/syscalls/syswrite.c b/newlib/libc/syscalls/syswrite.c index 0f080fb4d..35a1e8430 100644 --- a/newlib/libc/syscalls/syswrite.c +++ b/newlib/libc/syscalls/syswrite.c @@ -5,8 +5,8 @@ _READ_WRITE_RETURN_TYPE _DEFUN (write, (fd, buf, cnt), - int fd _AND - const void *buf _AND + int fd, + const void *buf, size_t cnt) { return _write_r (_REENT, fd, buf, cnt); diff --git a/newlib/libc/time/asctime_r.c b/newlib/libc/time/asctime_r.c index 2ec53698e..c38e32f41 100644 --- a/newlib/libc/time/asctime_r.c +++ b/newlib/libc/time/asctime_r.c @@ -7,7 +7,7 @@ char * _DEFUN (asctime_r, (tim_p, result), - _CONST struct tm *__restrict tim_p _AND + _CONST struct tm *__restrict tim_p, char *__restrict result) { static _CONST char day_name[7][3] = { diff --git a/newlib/libc/time/ctime_r.c b/newlib/libc/time/ctime_r.c index fda8cac1e..3546142dd 100644 --- a/newlib/libc/time/ctime_r.c +++ b/newlib/libc/time/ctime_r.c @@ -6,7 +6,7 @@ char * _DEFUN (ctime_r, (tim_p, result), - _CONST time_t * tim_p _AND + _CONST time_t * tim_p, char * result) { diff --git a/newlib/libc/time/difftime.c b/newlib/libc/time/difftime.c index 893fa4700..363eb6482 100644 --- a/newlib/libc/time/difftime.c +++ b/newlib/libc/time/difftime.c @@ -31,7 +31,7 @@ in all implementations. double _DEFUN (difftime, (tim1, tim2), - time_t tim1 _AND + time_t tim1, time_t tim2) { return (double)(tim1 - tim2); diff --git a/newlib/libc/time/gmtime_r.c b/newlib/libc/time/gmtime_r.c index 6475df3ba..01f95ebf7 100644 --- a/newlib/libc/time/gmtime_r.c +++ b/newlib/libc/time/gmtime_r.c @@ -47,7 +47,7 @@ struct tm * _DEFUN (gmtime_r, (tim_p, res), - _CONST time_t *__restrict tim_p _AND + _CONST time_t *__restrict tim_p, struct tm *__restrict res) { long days, rem; diff --git a/newlib/libc/time/lcltime_r.c b/newlib/libc/time/lcltime_r.c index 3342e9906..9abf683a7 100644 --- a/newlib/libc/time/lcltime_r.c +++ b/newlib/libc/time/lcltime_r.c @@ -17,7 +17,7 @@ struct tm * _DEFUN (localtime_r, (tim_p, res), - _CONST time_t *__restrict tim_p _AND + _CONST time_t *__restrict tim_p, struct tm *__restrict res) { long offset; diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index cf426d673..54df9b2e1 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -1432,9 +1432,9 @@ recurse: size_t _DEFUN (strftime, (s, maxsize, format, tim_p), - CHAR *__restrict s _AND - size_t maxsize _AND - _CONST CHAR *__restrict format _AND + CHAR *__restrict s, + size_t maxsize, + _CONST CHAR *__restrict format, _CONST struct tm *__restrict tim_p) { #ifdef _WANT_C99_TIME_FORMATS diff --git a/newlib/libc/unix/pread.c b/newlib/libc/unix/pread.c index 7d351d9d1..236044465 100644 --- a/newlib/libc/unix/pread.c +++ b/newlib/libc/unix/pread.c @@ -39,10 +39,10 @@ Supporting OS subroutine required: <>, <>. ssize_t _DEFUN (_pread_r, (rptr, fd, buf, n, off), - struct _reent *rptr _AND - int fd _AND - _PTR buf _AND - size_t n _AND + struct _reent *rptr, + int fd, + _PTR buf, + size_t n, off_t off) { off_t cur_pos; @@ -66,9 +66,9 @@ _DEFUN (_pread_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (pread, (fd, buf, n, off), - int fd _AND - _PTR buf _AND - size_t n _AND + int fd, + _PTR buf, + size_t n, off_t off) { return _pread_r (_REENT, fd, buf, n, off); diff --git a/newlib/libc/unix/pwrite.c b/newlib/libc/unix/pwrite.c index dad841243..2256a30ca 100644 --- a/newlib/libc/unix/pwrite.c +++ b/newlib/libc/unix/pwrite.c @@ -40,10 +40,10 @@ Supporting OS subroutine required: <>, <>. ssize_t _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), - struct _reent *rptr _AND - int fd _AND - _CONST _PTR buf _AND - size_t n _AND + struct _reent *rptr, + int fd, + _CONST _PTR buf, + size_t n, off_t off) { off_t cur_pos; @@ -67,9 +67,9 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (pwrite, (fd, buf, n, off), - int fd _AND - _CONST _PTR buf _AND - size_t n _AND + int fd, + _CONST _PTR buf, + size_t n, off_t off) { return _pwrite_r (_REENT, fd, buf, n, off); diff --git a/newlib/libc/unix/ttyname_r.c b/newlib/libc/unix/ttyname_r.c index 32bbd67af..673e7f543 100644 --- a/newlib/libc/unix/ttyname_r.c +++ b/newlib/libc/unix/ttyname_r.c @@ -45,8 +45,8 @@ */ int _DEFUN( ttyname_r,(fd, name, namesize), - int fd _AND - char *name _AND + int fd, + char *name, size_t namesize) { struct stat sb; diff --git a/newlib/libc/xdr/xdr.c b/newlib/libc/xdr/xdr.c index 646f9dbe0..8c637fcbf 100644 --- a/newlib/libc/xdr/xdr.c +++ b/newlib/libc/xdr/xdr.c @@ -63,7 +63,7 @@ static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; */ void _DEFUN (xdr_free, (proc, objp), - xdrproc_t proc _AND + xdrproc_t proc, void * objp) { XDR x; @@ -87,7 +87,7 @@ _DEFUN_VOID (xdr_void) */ bool_t _DEFUN (xdr_int, (xdrs, ip), - XDR * xdrs _AND + XDR * xdrs, int * ip) { #if INT_MAX < LONG_MAX @@ -122,7 +122,7 @@ _DEFUN (xdr_int, (xdrs, ip), */ bool_t _DEFUN (xdr_u_int, (xdrs, up), - XDR * xdrs _AND + XDR * xdrs, u_int * up) { #if UINT_MAX < ULONG_MAX @@ -157,7 +157,7 @@ _DEFUN (xdr_u_int, (xdrs, up), */ bool_t _DEFUN (xdr_long, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, long * lp) { if ((xdrs->x_op == XDR_ENCODE) @@ -178,7 +178,7 @@ _DEFUN (xdr_long, (xdrs, lp), */ bool_t _DEFUN (xdr_u_long, (xdrs, ulp), - XDR * xdrs _AND + XDR * xdrs, u_long * ulp) { switch (xdrs->x_op) @@ -209,7 +209,7 @@ _DEFUN (xdr_u_long, (xdrs, ulp), */ bool_t _DEFUN (xdr_int32_t, (xdrs, int32_p), - XDR * xdrs _AND + XDR * xdrs, int32_t * int32_p) { switch (xdrs->x_op) @@ -231,7 +231,7 @@ _DEFUN (xdr_int32_t, (xdrs, int32_p), */ bool_t _DEFUN (xdr_u_int32_t, (xdrs, u_int32_p), - XDR * xdrs _AND + XDR * xdrs, u_int32_t * u_int32_p) { switch (xdrs->x_op) @@ -253,7 +253,7 @@ _DEFUN (xdr_u_int32_t, (xdrs, u_int32_p), */ bool_t _DEFUN (xdr_uint32_t, (xdrs, uint32_p), - XDR * xdrs _AND + XDR * xdrs, uint32_t * uint32_p) { switch (xdrs->x_op) @@ -275,7 +275,7 @@ _DEFUN (xdr_uint32_t, (xdrs, uint32_p), */ bool_t _DEFUN (xdr_short, (xdrs, sp), - XDR * xdrs _AND + XDR * xdrs, short * sp) { long l; @@ -303,7 +303,7 @@ _DEFUN (xdr_short, (xdrs, sp), */ bool_t _DEFUN (xdr_u_short, (xdrs, usp), - XDR * xdrs _AND + XDR * xdrs, u_short * usp) { long l; @@ -332,7 +332,7 @@ _DEFUN (xdr_u_short, (xdrs, usp), */ bool_t _DEFUN (xdr_int16_t, (xdrs, int16_p), - XDR * xdrs _AND + XDR * xdrs, int16_t * int16_p) { int32_t t; @@ -360,7 +360,7 @@ _DEFUN (xdr_int16_t, (xdrs, int16_p), */ bool_t _DEFUN (xdr_u_int16_t, (xdrs, u_int16_p), - XDR * xdrs _AND + XDR * xdrs, u_int16_t * u_int16_p) { uint32_t ut; @@ -388,7 +388,7 @@ _DEFUN (xdr_u_int16_t, (xdrs, u_int16_p), */ bool_t _DEFUN (xdr_uint16_t, (xdrs, uint16_p), - XDR * xdrs _AND + XDR * xdrs, uint16_t * uint16_p) { uint32_t ut; @@ -416,7 +416,7 @@ _DEFUN (xdr_uint16_t, (xdrs, uint16_p), */ bool_t _DEFUN (xdr_int8_t, (xdrs, int8_p), - XDR * xdrs _AND + XDR * xdrs, int8_t * int8_p) { int32_t t; @@ -444,7 +444,7 @@ _DEFUN (xdr_int8_t, (xdrs, int8_p), */ bool_t _DEFUN (xdr_u_int8_t, (xdrs, u_int8_p), - XDR * xdrs _AND + XDR * xdrs, u_int8_t * u_int8_p) { uint32_t ut; @@ -472,7 +472,7 @@ _DEFUN (xdr_u_int8_t, (xdrs, u_int8_p), */ bool_t _DEFUN (xdr_uint8_t, (xdrs, uint8_p), - XDR * xdrs _AND + XDR * xdrs, uint8_t * uint8_p) { uint32_t ut; @@ -502,7 +502,7 @@ _DEFUN (xdr_uint8_t, (xdrs, uint8_p), */ bool_t _DEFUN (xdr_char, (xdrs, cp), - XDR * xdrs _AND + XDR * xdrs, char * cp) { int i; @@ -519,7 +519,7 @@ _DEFUN (xdr_char, (xdrs, cp), */ bool_t _DEFUN (xdr_u_char, (xdrs, ucp), - XDR * xdrs _AND + XDR * xdrs, u_char * ucp) { u_int u; @@ -536,7 +536,7 @@ _DEFUN (xdr_u_char, (xdrs, ucp), */ bool_t _DEFUN (xdr_bool, (xdrs, bp), - XDR * xdrs _AND + XDR * xdrs, bool_t * bp) { long lb; @@ -564,7 +564,7 @@ _DEFUN (xdr_bool, (xdrs, bp), */ bool_t _DEFUN (xdr_enum, (xdrs, ep), - XDR * xdrs _AND + XDR * xdrs, enum_t * ep) { enum sizecheck @@ -608,8 +608,8 @@ _DEFUN (xdr_enum, (xdrs, ep), */ bool_t _DEFUN (xdr_opaque, (xdrs, cp, cnt), - XDR * xdrs _AND - caddr_t cp _AND + XDR * xdrs, + caddr_t cp, u_int cnt) { u_int rndup; @@ -657,9 +657,9 @@ _DEFUN (xdr_opaque, (xdrs, cp, cnt), */ bool_t _DEFUN (xdr_bytes, (xdrs, cpp, sizep, maxsize), - XDR * xdrs _AND - char ** cpp _AND - u_int * sizep _AND + XDR * xdrs, + char ** cpp, + u_int * sizep, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ @@ -712,7 +712,7 @@ _DEFUN (xdr_bytes, (xdrs, cpp, sizep, maxsize), */ bool_t _DEFUN (xdr_netobj, (xdrs, np), - XDR * xdrs _AND + XDR * xdrs, struct netobj * np) { return (xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); @@ -735,10 +735,10 @@ _DEFUN (xdr_netobj, (xdrs, np), */ bool_t _DEFUN (xdr_union, (xdrs, dscmp, unp, choices, dfault), - XDR * xdrs _AND - enum_t * dscmp _AND - char * unp _AND - const struct xdr_discrim * choices _AND + XDR * xdrs, + enum_t * dscmp, + char * unp, + const struct xdr_discrim * choices, xdrproc_t dfault) { enum_t dscm; @@ -784,8 +784,8 @@ _DEFUN (xdr_union, (xdrs, dscmp, unp, choices, dfault), */ bool_t _DEFUN (xdr_string, (xdrs, cpp, maxsize), - XDR * xdrs _AND - char ** cpp _AND + XDR * xdrs, + char ** cpp, u_int maxsize) { char *sp = *cpp; /* sp is the actual string pointer */ @@ -862,7 +862,7 @@ _DEFUN (xdr_string, (xdrs, cpp, maxsize), */ bool_t _DEFUN (xdr_wrapstring, (xdrs, cpp), - XDR * xdrs _AND + XDR * xdrs, char ** cpp) { return xdr_string (xdrs, cpp, LASTUNSIGNED); @@ -883,7 +883,7 @@ _DEFUN (xdr_wrapstring, (xdrs, cpp), */ bool_t _DEFUN (xdr_int64_t, (xdrs, llp), - XDR * xdrs _AND + XDR * xdrs, int64_t * llp) { int32_t t1, t2; @@ -914,7 +914,7 @@ _DEFUN (xdr_int64_t, (xdrs, llp), */ bool_t _DEFUN (xdr_u_int64_t, (xdrs, ullp), - XDR * xdrs _AND + XDR * xdrs, u_int64_t * ullp) { uint32_t t1, t2; @@ -946,7 +946,7 @@ _DEFUN (xdr_u_int64_t, (xdrs, ullp), */ bool_t _DEFUN (xdr_uint64_t, (xdrs, ullp), - XDR * xdrs _AND + XDR * xdrs, uint64_t * ullp) { uint32_t t1, t2; @@ -979,7 +979,7 @@ _DEFUN (xdr_uint64_t, (xdrs, ullp), */ bool_t _DEFUN (xdr_hyper, (xdrs, llp), - XDR * xdrs _AND + XDR * xdrs, quad_t * llp) { /* @@ -995,7 +995,7 @@ _DEFUN (xdr_hyper, (xdrs, llp), */ bool_t _DEFUN (xdr_u_hyper, (xdrs, ullp), - XDR * xdrs _AND + XDR * xdrs, u_quad_t * ullp) { /* @@ -1011,7 +1011,7 @@ _DEFUN (xdr_u_hyper, (xdrs, ullp), */ bool_t _DEFUN (xdr_longlong_t, (xdrs, llp), - XDR * xdrs _AND + XDR * xdrs, quad_t * llp) { /* @@ -1027,7 +1027,7 @@ _DEFUN (xdr_longlong_t, (xdrs, llp), */ bool_t _DEFUN (xdr_u_longlong_t, (xdrs, ullp), - XDR * xdrs _AND + XDR * xdrs, u_quad_t *ullp) { /* diff --git a/newlib/libc/xdr/xdr_array.c b/newlib/libc/xdr/xdr_array.c index 98549acbb..9c9748725 100644 --- a/newlib/libc/xdr/xdr_array.c +++ b/newlib/libc/xdr/xdr_array.c @@ -55,11 +55,11 @@ */ bool_t _DEFUN (xdr_array, (xdrs, addrp, sizep, maxsize, elsize, elproc), - XDR * xdrs _AND - caddr_t * addrp _AND - u_int * sizep _AND - u_int maxsize _AND - u_int elsize _AND + XDR * xdrs, + caddr_t * addrp, + u_int * sizep, + u_int maxsize, + u_int elsize, xdrproc_t elproc) { u_int i; @@ -139,10 +139,10 @@ _DEFUN (xdr_array, (xdrs, addrp, sizep, maxsize, elsize, elproc), */ bool_t _DEFUN (xdr_vector, (xdrs, basep, nelem, elemsize, xdr_elem), - XDR * xdrs _AND - char *basep _AND - u_int nelem _AND - u_int elemsize _AND + XDR * xdrs, + char *basep, + u_int nelem, + u_int elemsize, xdrproc_t xdr_elem) { u_int i; diff --git a/newlib/libc/xdr/xdr_float.c b/newlib/libc/xdr/xdr_float.c index 00726bb43..691e92965 100644 --- a/newlib/libc/xdr/xdr_float.c +++ b/newlib/libc/xdr/xdr_float.c @@ -60,7 +60,7 @@ bool_t _DEFUN (xdr_float, (xdrs, fp), - XDR * xdrs _AND + XDR * xdrs, float *fp) { switch (xdrs->x_op) @@ -81,7 +81,7 @@ _DEFUN (xdr_float, (xdrs, fp), #if !defined(_DOUBLE_IS_32BITS) bool_t _DEFUN (xdr_double, (xdrs, dp), - XDR * xdrs _AND + XDR * xdrs, double *dp) { int32_t *i32p; diff --git a/newlib/libc/xdr/xdr_float_vax.c b/newlib/libc/xdr/xdr_float_vax.c index 323e43ed8..ed943480f 100644 --- a/newlib/libc/xdr/xdr_float_vax.c +++ b/newlib/libc/xdr/xdr_float_vax.c @@ -82,7 +82,7 @@ static struct sgl_limits bool_t _DEFUN (xdr_float, (xdrs, fp), - XDR * xdrs _AND + XDR * xdrs, float *fp) { struct ieee_single is; @@ -185,7 +185,7 @@ static struct dbl_limits bool_t _DEFUN (xdr_double, (xdrs, dp), - XDR * xdrs _AND + XDR * xdrs, double *dp) { int32_t *lp; diff --git a/newlib/libc/xdr/xdr_mem.c b/newlib/libc/xdr/xdr_mem.c index 497342d5e..b49dc3b8f 100644 --- a/newlib/libc/xdr/xdr_mem.c +++ b/newlib/libc/xdr/xdr_mem.c @@ -102,9 +102,9 @@ static _CONST struct xdr_ops xdrmem_ops_unaligned = { */ void _DEFUN (xdrmem_create, (xdrs, addr, size, op), - XDR * xdrs _AND - caddr_t addr _AND - u_int size _AND + XDR * xdrs, + caddr_t addr, + u_int size, enum xdr_op op) { xdrs->x_op = op; @@ -123,7 +123,7 @@ _DEFUN (xdrmem_destroy, (xdrs), static bool_t _DEFUN (xdrmem_getlong_aligned, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, long *lp) { if (xdrs->x_handy < sizeof (int32_t)) @@ -136,7 +136,7 @@ _DEFUN (xdrmem_getlong_aligned, (xdrs, lp), static bool_t _DEFUN (xdrmem_putlong_aligned, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, _CONST long *lp) { if (xdrs->x_handy < sizeof (int32_t)) @@ -149,7 +149,7 @@ _DEFUN (xdrmem_putlong_aligned, (xdrs, lp), static bool_t _DEFUN (xdrmem_getlong_unaligned, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, long *lp) { u_int32_t l; @@ -165,7 +165,7 @@ _DEFUN (xdrmem_getlong_unaligned, (xdrs, lp), static bool_t _DEFUN (xdrmem_putlong_unaligned, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, _CONST long *lp) { u_int32_t l; @@ -181,8 +181,8 @@ _DEFUN (xdrmem_putlong_unaligned, (xdrs, lp), static bool_t _DEFUN (xdrmem_getbytes, (xdrs, addr, len), - XDR * xdrs _AND - char *addr _AND + XDR * xdrs, + char *addr, u_int len) { if (xdrs->x_handy < len) @@ -195,8 +195,8 @@ _DEFUN (xdrmem_getbytes, (xdrs, addr, len), static bool_t _DEFUN (xdrmem_putbytes, (xdrs, addr, len), - XDR * xdrs _AND - _CONST char *addr _AND + XDR * xdrs, + _CONST char *addr, u_int len) { if (xdrs->x_handy < len) @@ -217,7 +217,7 @@ _DEFUN (xdrmem_getpos, (xdrs), static bool_t _DEFUN (xdrmem_setpos, (xdrs, pos), - XDR * xdrs _AND + XDR * xdrs, u_int pos) { caddr_t newaddr = xdrs->x_base + pos; @@ -237,7 +237,7 @@ _DEFUN (xdrmem_setpos, (xdrs, pos), static int32_t * _DEFUN (xdrmem_inline_aligned, (xdrs, len), - XDR * xdrs _AND + XDR * xdrs, u_int len) { int32_t *buf = 0; @@ -253,7 +253,7 @@ _DEFUN (xdrmem_inline_aligned, (xdrs, len), static int32_t * _DEFUN (xdrmem_inline_unaligned, (xdrs, len), - XDR * xdrs _AND + XDR * xdrs, u_int len) { return (0); @@ -261,7 +261,7 @@ _DEFUN (xdrmem_inline_unaligned, (xdrs, len), static bool_t _DEFUN (xdrmem_getint32_aligned, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, int32_t *ip) { if (xdrs->x_handy < sizeof(int32_t)) @@ -274,7 +274,7 @@ _DEFUN (xdrmem_getint32_aligned, (xdrs, ip), static bool_t _DEFUN (xdrmem_putint32_aligned, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, _CONST int32_t *ip) { if (xdrs->x_handy < sizeof(int32_t)) @@ -287,7 +287,7 @@ _DEFUN (xdrmem_putint32_aligned, (xdrs, ip), static bool_t _DEFUN (xdrmem_getint32_unaligned, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, int32_t *ip) { u_int32_t l; @@ -303,7 +303,7 @@ _DEFUN (xdrmem_getint32_unaligned, (xdrs, ip), static bool_t _DEFUN (xdrmem_putint32_unaligned, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, _CONST int32_t *ip) { u_int32_t l; diff --git a/newlib/libc/xdr/xdr_private.c b/newlib/libc/xdr/xdr_private.c index 16b37a249..ea557fa03 100644 --- a/newlib/libc/xdr/xdr_private.c +++ b/newlib/libc/xdr/xdr_private.c @@ -36,7 +36,7 @@ _DEFUN (xdr_set_vprintf, (fnptr), void _DEFUN (xdr_vwarnx, (format, ap), - _CONST char *format _AND + _CONST char *format, va_list ap) { if (xdr_vprintf) diff --git a/newlib/libc/xdr/xdr_rec.c b/newlib/libc/xdr/xdr_rec.c index eef4c4871..0caadd6d5 100644 --- a/newlib/libc/xdr/xdr_rec.c +++ b/newlib/libc/xdr/xdr_rec.c @@ -170,11 +170,11 @@ bool_t _EXFUN (__xdrrec_setnonblock, (XDR *, int)); */ void _DEFUN (xdrrec_create, (xdrs, sendsize, recvsize, tcp_handle, readit, writeit), - XDR * xdrs _AND - u_int sendsize _AND - u_int recvsize _AND - void *tcp_handle _AND - int _EXPARM (readit, (void *, void *, int)) _AND + XDR * xdrs, + u_int sendsize, + u_int recvsize, + void *tcp_handle, + int _EXPARM (readit, (void *, void *, int)), int _EXPARM (writeit, (void *, void *, int))) { RECSTREAM *rstrm; @@ -262,7 +262,7 @@ _DEFUN (xdrrec_create, (xdrs, sendsize, recvsize, tcp_handle, readit, writeit), static bool_t _DEFUN (xdrrec_getlong, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, long *lp) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -289,7 +289,7 @@ _DEFUN (xdrrec_getlong, (xdrs, lp), static bool_t _DEFUN (xdrrec_putlong, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, _CONST long *lp) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -314,8 +314,8 @@ _DEFUN (xdrrec_putlong, (xdrs, lp), static bool_t /* must manage buffers, fragments, and records */ _DEFUN (xdrrec_getbytes, (xdrs, addr, len), - XDR * xdrs _AND - char *addr _AND + XDR * xdrs, + char *addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -344,8 +344,8 @@ _DEFUN (xdrrec_getbytes, (xdrs, addr, len), static bool_t _DEFUN (xdrrec_putbytes, (xdrs, addr, len), - XDR * xdrs _AND - _CONST char *addr _AND + XDR * xdrs, + _CONST char *addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -399,7 +399,7 @@ _DEFUN (xdrrec_getpos, (xdrs), static bool_t _DEFUN (xdrrec_setpos, (xdrs, pos), - XDR * xdrs _AND + XDR * xdrs, u_int pos) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -440,7 +440,7 @@ _DEFUN (xdrrec_setpos, (xdrs, pos), static int32_t * _DEFUN (xdrrec_inline, (xdrs, len), - XDR * xdrs _AND + XDR * xdrs, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -494,7 +494,7 @@ _DEFUN (xdrrec_destroy, (xdrs), static bool_t _DEFUN (xdrrec_getint32, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, int32_t *ip) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -521,7 +521,7 @@ _DEFUN (xdrrec_getint32, (xdrs, ip), static bool_t _DEFUN (xdrrec_putint32, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, _CONST int32_t *ip) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -618,7 +618,7 @@ _DEFUN (xdrrec_eof, (xdrs), */ bool_t _DEFUN (xdrrec_endofrecord, (xdrs, sendnow), - XDR * xdrs _AND + XDR * xdrs, bool_t sendnow) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -645,8 +645,8 @@ _DEFUN (xdrrec_endofrecord, (xdrs, sendnow), */ bool_t _DEFUN (__xdrrec_getrec, (xdrs, statp, expectdata), - XDR * xdrs _AND - enum xprt_stat * statp _AND + XDR * xdrs, + enum xprt_stat * statp, bool_t expectdata) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -738,7 +738,7 @@ _DEFUN (__xdrrec_getrec, (xdrs, statp, expectdata), bool_t _DEFUN (__xdrrec_setnonblock, (xdrs, maxrec), - XDR * xdrs _AND + XDR * xdrs, int maxrec) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -755,7 +755,7 @@ _DEFUN (__xdrrec_setnonblock, (xdrs, maxrec), */ static bool_t _DEFUN (flush_out, (rstrm, eor), - RECSTREAM * rstrm _AND + RECSTREAM * rstrm, bool_t eor) { u_int32_t eormask = (eor == TRUE) ? LAST_FRAG : 0; @@ -799,8 +799,8 @@ _DEFUN (fill_input_buf, (rstrm), static bool_t /* knows nothing about records! Only about input buffers */ _DEFUN (get_input_bytes, (rstrm, addr, len), - RECSTREAM * rstrm _AND - char *addr _AND + RECSTREAM * rstrm, + char *addr, size_t len) { size_t current; @@ -861,7 +861,7 @@ _DEFUN (set_input_fragment, (rstrm), static bool_t /* consumes input bytes; knows nothing about records! */ _DEFUN (skip_input_bytes, (rstrm, cnt), - RECSTREAM * rstrm _AND + RECSTREAM * rstrm, long cnt) { size_t current; @@ -898,7 +898,7 @@ _DEFUN (fix_buf_size, (s), */ static bool_t _DEFUN (realloc_stream, (rstrm, size), - RECSTREAM * rstrm _AND + RECSTREAM * rstrm, int size) { ptrdiff_t diff; diff --git a/newlib/libc/xdr/xdr_reference.c b/newlib/libc/xdr/xdr_reference.c index 010a7e719..7a5f1d851 100644 --- a/newlib/libc/xdr/xdr_reference.c +++ b/newlib/libc/xdr/xdr_reference.c @@ -57,9 +57,9 @@ */ bool_t _DEFUN (xdr_reference, (xdrs, pp, size, proc), - XDR * xdrs _AND - caddr_t * pp _AND - u_int size _AND + XDR * xdrs, + caddr_t * pp, + u_int size, xdrproc_t proc) { caddr_t loc = *pp; @@ -118,9 +118,9 @@ _DEFUN (xdr_reference, (xdrs, pp, size, proc), */ bool_t _DEFUN (xdr_pointer, (xdrs, objpp, obj_size, xdr_obj), - XDR * xdrs _AND - char **objpp _AND - u_int obj_size _AND + XDR * xdrs, + char **objpp, + u_int obj_size, xdrproc_t xdr_obj) { bool_t more_data; diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c index 156a2e17b..34d1e6036 100644 --- a/newlib/libc/xdr/xdr_sizeof.c +++ b/newlib/libc/xdr/xdr_sizeof.c @@ -44,7 +44,7 @@ /* ARGSUSED */ static bool_t _DEFUN (x_putlong, (xdrs, longp), - XDR * xdrs _AND + XDR * xdrs, _CONST long *longp) { xdrs->x_handy += BYTES_PER_XDR_UNIT; @@ -54,8 +54,8 @@ _DEFUN (x_putlong, (xdrs, longp), /* ARGSUSED */ static bool_t _DEFUN (x_putbytes, (xdrs, bp, len), - XDR * xdrs _AND - const char *bp _AND + XDR * xdrs, + const char *bp, u_int len) { xdrs->x_handy += len; @@ -72,7 +72,7 @@ _DEFUN (x_getpostn, (xdrs), /* ARGSUSED */ static bool_t _DEFUN (x_setpostn, (xdrs, pos), - XDR * xdrs _AND + XDR * xdrs, u_int pos) { /* This is not allowed */ @@ -81,7 +81,7 @@ _DEFUN (x_setpostn, (xdrs, pos), static int32_t * _DEFUN (x_inline, (xdrs, len), - XDR * xdrs _AND + XDR * xdrs, u_int len) { if (len == 0) @@ -133,7 +133,7 @@ _DEFUN (x_destroy, (xdrs), static bool_t _DEFUN (x_putint32, (xdrs, int32p), - XDR *xdrs _AND + XDR *xdrs, _CONST int32_t *int32p) { xdrs->x_handy += BYTES_PER_XDR_UNIT; @@ -143,7 +143,7 @@ _DEFUN (x_putint32, (xdrs, int32p), unsigned long _DEFUN (xdr_sizeof, (func, data), - xdrproc_t func _AND + xdrproc_t func, _PTR data) { XDR x; diff --git a/newlib/libc/xdr/xdr_stdio.c b/newlib/libc/xdr/xdr_stdio.c index c933c68cd..5bb4b13f1 100644 --- a/newlib/libc/xdr/xdr_stdio.c +++ b/newlib/libc/xdr/xdr_stdio.c @@ -84,8 +84,8 @@ static _CONST struct xdr_ops xdrstdio_ops = { */ void _DEFUN (xdrstdio_create, (xdrs, file, op), - XDR * xdrs _AND - FILE * file _AND + XDR * xdrs, + FILE * file, enum xdr_op op) { xdrs->x_op = op; @@ -109,7 +109,7 @@ _DEFUN (xdrstdio_destroy, (xdrs), static bool_t _DEFUN (xdrstdio_getlong, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, long *lp) { u_int32_t temp; @@ -122,7 +122,7 @@ _DEFUN (xdrstdio_getlong, (xdrs, lp), static bool_t _DEFUN (xdrstdio_putlong, (xdrs, lp), - XDR * xdrs _AND + XDR * xdrs, _CONST long *lp) { u_int32_t temp = htonl ((u_int32_t) * lp); @@ -134,8 +134,8 @@ _DEFUN (xdrstdio_putlong, (xdrs, lp), static bool_t _DEFUN (xdrstdio_getbytes, (xdrs, addr, len), - XDR * xdrs _AND - char *addr _AND + XDR * xdrs, + char *addr, u_int len) { if ((len != 0) && (fread (addr, (size_t) len, 1, @@ -146,8 +146,8 @@ _DEFUN (xdrstdio_getbytes, (xdrs, addr, len), static bool_t _DEFUN (xdrstdio_putbytes, (xdrs, addr, len), - XDR * xdrs _AND - _CONST char *addr _AND + XDR * xdrs, + _CONST char *addr, u_int len) { if ((len != 0) && (fwrite (addr, (size_t) len, 1, @@ -165,7 +165,7 @@ _DEFUN (xdrstdio_getpos, (xdrs), static bool_t _DEFUN (xdrstdio_setpos, (xdrs, pos), - XDR * xdrs _AND + XDR * xdrs, u_int pos) { return ((fseek ((FILE *) xdrs->x_private, (long) pos, 0) < 0) ? @@ -175,7 +175,7 @@ _DEFUN (xdrstdio_setpos, (xdrs, pos), /* ARGSUSED */ static int32_t * _DEFUN (xdrstdio_inline, (xdrs, len), - XDR * xdrs _AND + XDR * xdrs, u_int len) { /* @@ -192,7 +192,7 @@ _DEFUN (xdrstdio_inline, (xdrs, len), static bool_t _DEFUN (xdrstdio_getint32, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, int32_t *ip) { int32_t temp; @@ -205,7 +205,7 @@ _DEFUN (xdrstdio_getint32, (xdrs, ip), static bool_t _DEFUN (xdrstdio_putint32, (xdrs, ip), - XDR *xdrs _AND + XDR *xdrs, _CONST int32_t *ip) { int32_t temp = htonl (*ip); diff --git a/newlib/libm/mathfp/s_asine.c b/newlib/libm/mathfp/s_asine.c index 3212862b8..28cfaf7a6 100644 --- a/newlib/libm/mathfp/s_asine.c +++ b/newlib/libm/mathfp/s_asine.c @@ -90,7 +90,7 @@ static const double b[] = { 1.57079632679489661923, 0.78539816339744830962 }; double _DEFUN (asine, (double, int), - double x _AND + double x, int acosine) { int flag, i; diff --git a/newlib/libm/mathfp/s_atan2.c b/newlib/libm/mathfp/s_atan2.c index 00121db4b..9f71ed9c8 100644 --- a/newlib/libm/mathfp/s_atan2.c +++ b/newlib/libm/mathfp/s_atan2.c @@ -70,7 +70,7 @@ PORTABILITY double _DEFUN (atan2, (double, double), - double v _AND + double v, double u) { return (atangent (0.0, v, u, 1)); diff --git a/newlib/libm/mathfp/s_atangent.c b/newlib/libm/mathfp/s_atangent.c index cd9db2dcd..1df39ac50 100644 --- a/newlib/libm/mathfp/s_atangent.c +++ b/newlib/libm/mathfp/s_atangent.c @@ -86,9 +86,9 @@ static const double p[] = { -0.13688768894191926929e+2, double _DEFUN (atangent, (double, double, double, int), - double x _AND - double v _AND - double u _AND + double x, + double v, + double u, int arctan2) { double f, g, R, P, Q, A, res; diff --git a/newlib/libm/mathfp/s_ldexp.c b/newlib/libm/mathfp/s_ldexp.c index 6971af697..472093071 100644 --- a/newlib/libm/mathfp/s_ldexp.c +++ b/newlib/libm/mathfp/s_ldexp.c @@ -64,7 +64,7 @@ PORTABILITY double _DEFUN (ldexp, (double, int), - double d _AND + double d, int e) { int exp; diff --git a/newlib/libm/mathfp/s_logarithm.c b/newlib/libm/mathfp/s_logarithm.c index 977a6406d..d14bf2eb4 100644 --- a/newlib/libm/mathfp/s_logarithm.c +++ b/newlib/libm/mathfp/s_logarithm.c @@ -80,7 +80,7 @@ static const double C3 = 0.43429448190325182765; double _DEFUN (logarithm, (double, int), - double x _AND + double x, int ten) { int N; diff --git a/newlib/libm/mathfp/s_sincos.c b/newlib/libm/mathfp/s_sincos.c index e313e6f1d..8fc65ac20 100644 --- a/newlib/libm/mathfp/s_sincos.c +++ b/newlib/libm/mathfp/s_sincos.c @@ -21,8 +21,8 @@ void _DEFUN (sincos, (x, sinx, cosx), - double x _AND - double *sinx _AND + double x, + double *sinx, double *cosx) { *sinx = sin (x); diff --git a/newlib/libm/mathfp/s_sine.c b/newlib/libm/mathfp/s_sine.c index f8bf52952..d5e4469a0 100644 --- a/newlib/libm/mathfp/s_sine.c +++ b/newlib/libm/mathfp/s_sine.c @@ -73,7 +73,7 @@ static const double r[] = { -0.16666666666666665052, double _DEFUN (sine, (double, int), - double x _AND + double x, int cosine) { int sgn, N; diff --git a/newlib/libm/mathfp/s_sineh.c b/newlib/libm/mathfp/s_sineh.c index 581484ac1..457003ff8 100644 --- a/newlib/libm/mathfp/s_sineh.c +++ b/newlib/libm/mathfp/s_sineh.c @@ -95,7 +95,7 @@ static const double V_OVER2_MINUS1 = 0.13830277879601902638e-4; double _DEFUN (sineh, (double, int), - double x _AND + double x, int cosineh) { double y, f, P, Q, R, res, z, w; diff --git a/newlib/libm/mathfp/sf_asine.c b/newlib/libm/mathfp/sf_asine.c index 12ba28927..a74778034 100644 --- a/newlib/libm/mathfp/sf_asine.c +++ b/newlib/libm/mathfp/sf_asine.c @@ -31,7 +31,7 @@ static const float b[] = { 1.570796326, 0.785398163 }; float _DEFUN (asinef, (float, int), - float x _AND + float x, int acosine) { int flag, i; diff --git a/newlib/libm/mathfp/sf_atan2.c b/newlib/libm/mathfp/sf_atan2.c index 69c612354..e866ecbb8 100644 --- a/newlib/libm/mathfp/sf_atan2.c +++ b/newlib/libm/mathfp/sf_atan2.c @@ -19,7 +19,7 @@ float _DEFUN (atan2f, (float, float), - float v _AND + float v, float u) { return (atangentf (0.0, v, u, 1)); diff --git a/newlib/libm/mathfp/sf_atangent.c b/newlib/libm/mathfp/sf_atangent.c index 7a8f0cebe..1865cde74 100644 --- a/newlib/libm/mathfp/sf_atangent.c +++ b/newlib/libm/mathfp/sf_atangent.c @@ -32,9 +32,9 @@ static const float p[] = { -0.4708325141, -0.5090958253e-1 }; float _DEFUN (atangentf, (float, float, float, int), - float x _AND - float v _AND - float u _AND + float x, + float v, + float u, int arctan2) { float f, g, R, P, Q, A, res; diff --git a/newlib/libm/mathfp/sf_fmod.c b/newlib/libm/mathfp/sf_fmod.c index 0ac86bbef..611725409 100644 --- a/newlib/libm/mathfp/sf_fmod.c +++ b/newlib/libm/mathfp/sf_fmod.c @@ -26,7 +26,7 @@ static const float one = 1.0, Zero[] = {0.0, -0.0,}; float _DEFUN (fmodf, (float, float), - float x _AND + float x, float y) { __int32_t n,hx,hy,hz,ix,iy,sx,i; diff --git a/newlib/libm/mathfp/sf_ldexp.c b/newlib/libm/mathfp/sf_ldexp.c index 6b6c2c00b..3a0d7a41a 100644 --- a/newlib/libm/mathfp/sf_ldexp.c +++ b/newlib/libm/mathfp/sf_ldexp.c @@ -24,7 +24,7 @@ float _DEFUN (ldexpf, (float, int), - float d _AND + float d, int e) { int exp; diff --git a/newlib/libm/mathfp/sf_logarithm.c b/newlib/libm/mathfp/sf_logarithm.c index c22ba862a..855ee0744 100644 --- a/newlib/libm/mathfp/sf_logarithm.c +++ b/newlib/libm/mathfp/sf_logarithm.c @@ -32,7 +32,7 @@ static const float C3 = 0.4342944819; float _DEFUN (logarithmf, (float, int), - float x _AND + float x, int ten) { int N; diff --git a/newlib/libm/mathfp/sf_sincos.c b/newlib/libm/mathfp/sf_sincos.c index e192b4b44..85b393dce 100644 --- a/newlib/libm/mathfp/sf_sincos.c +++ b/newlib/libm/mathfp/sf_sincos.c @@ -19,8 +19,8 @@ void _DEFUN (sincosf, (x, sinx, cosx), - float x _AND - float *sinx _AND + float x, + float *sinx, float *cosx) { *sinx = sin (x); diff --git a/newlib/libm/mathfp/sf_sine.c b/newlib/libm/mathfp/sf_sine.c index 6932de26c..24725bde1 100644 --- a/newlib/libm/mathfp/sf_sine.c +++ b/newlib/libm/mathfp/sf_sine.c @@ -33,7 +33,7 @@ static const float r[] = { -0.1666665668, float _DEFUN (sinef, (float, int), - float x _AND + float x, int cosine) { int sgn, N; diff --git a/newlib/libm/mathfp/sf_sineh.c b/newlib/libm/mathfp/sf_sineh.c index 4eee2c927..966e91362 100644 --- a/newlib/libm/mathfp/sf_sineh.c +++ b/newlib/libm/mathfp/sf_sineh.c @@ -33,7 +33,7 @@ static const float V_OVER2_MINUS1 = 0.1383027787e-4; float _DEFUN (sinehf, (float, int), - float x _AND + float x, int cosineh) { float y, f, P, Q, R, res, z, w; diff --git a/newlib/libm/test/convert.c b/newlib/libm/test/convert.c index a74828027..8420cdec7 100644 --- a/newlib/libm/test/convert.c +++ b/newlib/libm/test/convert.c @@ -50,7 +50,7 @@ _DEFUN_VOID(test_atoff) static void _DEFUN(iterate,(func, name), - void _EXFUN((*func),(void)) _AND + void _EXFUN((*func),(void)), char *name) { @@ -71,7 +71,7 @@ int_type *p = ints; static void _DEFUN(int_iterate,(func, name), - void (*func)() _AND + void (*func)(), char *name) { newfunc(name); @@ -87,8 +87,8 @@ _DEFUN(int_iterate,(func, name), void _DEFUN(test_strtol_base,(base, pi, string), - int base _AND - int_scan_type *pi _AND + int base, + int_scan_type *pi, char *string) { long r; @@ -207,7 +207,7 @@ _DEFUN_VOID(test_fcvt) static void _DEFUN(diterate,(func, name), - void (*func)() _AND + void (*func)(), char *name) { newfunc(name); diff --git a/newlib/libm/test/dcvt.c b/newlib/libm/test/dcvt.c index 2aaa1af28..922652e9f 100644 --- a/newlib/libm/test/dcvt.c +++ b/newlib/libm/test/dcvt.c @@ -40,8 +40,8 @@ double *value) static char * _DEFUN(print_nan,(buffer, value, precision), - char *buffer _AND - double value _AND + char *buffer, + double value, int precision) { size_t i; @@ -134,7 +134,7 @@ _DEFUN(renormalize,(in), static void _DEFUN(normalize,(value, in), - double value _AND + double value, cvt_info_type *in) { int j; @@ -196,9 +196,9 @@ _DEFUN(normalize,(value, in), } int _DEFUN(round,(in, start, now, ch), - cvt_info_type *in _AND - char *start _AND - char *now _AND + cvt_info_type *in, + char *start, + char *now, char ch) { double rounder = 5.0; @@ -435,11 +435,11 @@ _DEFUN(_cvtf,(in), char * _DEFUN(_dcvt,(buffer, invalue, precision, width, type, dot), - char *buffer _AND - double invalue _AND - int precision _AND - int width _AND - char type _AND + char *buffer, + double invalue, + int precision, + int width, + char type, int dot) { cvt_info_type in; @@ -534,10 +534,10 @@ _DEFUN(_dcvt,(buffer, invalue, precision, width, type, dot), char * _DEFUN(fcvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), - double invalue _AND - int ndigit _AND - int *decpt _AND - int *sign _AND + double invalue, + int ndigit, + int *decpt, + int *sign, char *fcvt_buf) { cvt_info_type in; @@ -564,10 +564,10 @@ _DEFUN(fcvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), char * _DEFUN(ecvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), - double invalue _AND - int ndigit _AND - int *decpt _AND - int *sign _AND + double invalue, + int ndigit, + int *decpt, + int *sign, char *fcvt_buf) { cvt_info_type in; @@ -597,8 +597,8 @@ _DEFUN(ecvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), char * _DEFUN(gcvt,(d,ndigit,buf), - double d _AND - int ndigit _AND + double d, + int ndigit, char *buf) { return _dcvt(buf, d, ndigit, 0, 'g', 1); diff --git a/newlib/libm/test/math.c b/newlib/libm/test/math.c index df63c2df2..50b22223a 100644 --- a/newlib/libm/test/math.c +++ b/newlib/libm/test/math.c @@ -51,7 +51,7 @@ _DEFUN(matherr,(e), void _DEFUN(translate_to,(file,r), - FILE *file _AND + FILE *file, double r) { __ieee_double_shape_type bits; @@ -61,10 +61,10 @@ void _DEFUN(translate_to,(file,r), int _DEFUN(ffcheck,( is, p, name, serrno, merror), - double is _AND - one_line_type *p _AND - char *name _AND - int serrno _AND + double is, + one_line_type *p, + char *name, + int serrno, int merror) { /* Make sure the answer isn't to far wrong from the correct value */ @@ -109,7 +109,7 @@ _DEFUN(ffcheck,( is, p, name, serrno, merror), double _DEFUN(thedouble, (msw, lsw), - long msw _AND + long msw, long lsw) { __ieee_double_shape_type x; @@ -124,13 +124,13 @@ int reduce; _DEFUN(frontline,(f, mag, p, result, merror, errno, args, name), - FILE *f _AND - int mag _AND - one_line_type *p _AND - double result _AND - int merror _AND - int errno _AND - char *args _AND + FILE *f, + int mag, + one_line_type *p, + double result, + int merror, + int errno, + char *args, char *name) { if (reduce && p->error_bit < mag) @@ -177,11 +177,11 @@ _DEFUN(frontline,(f, mag, p, result, merror, errno, args, name), } _DEFUN(finish,(f, vector, result , p, args, name), - FILE *f _AND - int vector _AND - double result _AND - one_line_type *p _AND - char *args _AND + FILE *f, + int vector, + double result, + one_line_type *p, + char *args, char *name) { int mag; @@ -195,10 +195,10 @@ _DEFUN(finish,(f, vector, result , p, args, name), int redo; _DEFUN(run_vector_1,(vector, p, func, name, args), - int vector _AND - one_line_type *p _AND - char *func _AND - char *name _AND + int vector, + one_line_type *p, + char *func, + char *name, char *args) { FILE *f; diff --git a/newlib/libm/test/string.c b/newlib/libm/test/string.c index c47047212..e97dfcc62 100644 --- a/newlib/libm/test/string.c +++ b/newlib/libm/test/string.c @@ -11,7 +11,7 @@ int errors = 0; void _DEFUN(checkit,(ok,l), - int ok _AND + int ok, int l ) { @@ -32,8 +32,8 @@ _DEFUN(checkit,(ok,l), void _DEFUN(funcqual,(a,b,l), - char *a _AND - char *b _AND + char *a, + char *b, int l) { newfunc(it); @@ -145,7 +145,7 @@ void test_string() equal(one, "abcd"); /* Zero count. */ (void) strncat(one, "gh", 2); - equal(one, "abcdgh"); /* Count _AND length equal. */ + equal(one, "abcdgh"); /* Count, length equal. */ it = "strncmp"; /* strncmp - first test as strcmp with big counts";*/ check(strncmp("", "", 99) == 0); /* Trivial case. */ @@ -494,7 +494,7 @@ void test_string() (void) memset(one+5, 0, 1); equal(one, "axxxe"); /* Zero fill. */ - equal(one+6, "gh"); /* _AND the leftover. */ + equal(one+6, "gh"); /*, the leftover. */ (void) memset(one+2, 010045, 1); equal(one, "ax\045xe"); /* Unsigned char convert. */ diff --git a/newlib/libm/test/test.c b/newlib/libm/test/test.c index 615c54aa5..b25e4b963 100644 --- a/newlib/libm/test/test.c +++ b/newlib/libm/test/test.c @@ -10,7 +10,7 @@ int inacc; int _DEFUN(main,(ac, av), - int ac _AND + int ac, char **av) { int i; @@ -93,7 +93,7 @@ int strtod_vector = 0; int _DEFUN(bigger,(a,b), - __ieee_double_shape_type *a _AND + __ieee_double_shape_type *a, __ieee_double_shape_type *b) { @@ -117,7 +117,7 @@ _DEFUN(bigger,(a,b), /* Return the first bit different between two double numbers */ int _DEFUN(mag_of_error,(is, shouldbe), - double is _AND + double is, double shouldbe) { __ieee_double_shape_type a,b; @@ -184,7 +184,7 @@ _DEFUN(mag_of_error,(is, shouldbe), void _DEFUN(test_sok,(is, shouldbe), - char *is _AND + char *is, char *shouldbe) { if (strcmp(is,shouldbe)) @@ -198,7 +198,7 @@ _DEFUN(test_sok,(is, shouldbe), } void _DEFUN(test_iok,(is, shouldbe), - int is _AND + int is, int shouldbe) { if (is != shouldbe){ @@ -216,8 +216,8 @@ _DEFUN(test_iok,(is, shouldbe), */ void _DEFUN(test_scok,(is, shouldbe, count), - char *is _AND - char *shouldbe _AND + char *is, + char *shouldbe, int count) { if (strncmp(is,shouldbe, count)) @@ -232,7 +232,7 @@ _DEFUN(test_scok,(is, shouldbe, count), void _DEFUN(test_eok,(is, shouldbe), - int is _AND + int is, int shouldbe) { if (is != shouldbe){ @@ -246,8 +246,8 @@ _DEFUN(test_eok,(is, shouldbe), void _DEFUN(test_mok,(value, shouldbe, okmag), - double value _AND - double shouldbe _AND + double value, + double shouldbe, int okmag) { __ieee_double_shape_type a,b; diff --git a/newlib/libm/test/test_ieee.c b/newlib/libm/test/test_ieee.c index a126d01e6..07c49418d 100644 --- a/newlib/libm/test/test_ieee.c +++ b/newlib/libm/test/test_ieee.c @@ -83,7 +83,7 @@ _DEFUN_VOID(test_getroundtoi) double _DEFUN(dnumber,(msw, lsw), - int msw _AND + int msw, int lsw) { diff --git a/newlib/libm/test/test_is.c b/newlib/libm/test/test_is.c index 2e99becbf..39c15c10e 100644 --- a/newlib/libm/test/test_is.c +++ b/newlib/libm/test/test_is.c @@ -1934,8 +1934,8 @@ int _DEFUN(def__toupper,(i), int i) { return _toupper(i); } extern int inacc; void _DEFUN(test_is_set,(func, name, p), - int (*func)() _AND - char *name _AND + int (*func)(), + char *name, int *p) { int i; @@ -1953,10 +1953,10 @@ _DEFUN(test_is_set,(func, name, p), } void _DEFUN(test_to_set,(func, name, p, low, high), - int (*func)() _AND - char *name _AND - int *p _AND - int low _AND + int (*func)(), + char *name, + int *p, + int low, int high) { int i; From 0bda30e1ffd23488aa4a9b73f228089463fbee1a Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:25:16 -0600 Subject: [PATCH 206/649] ansification: remove _CONST Signed-off-by: Yaakov Selkowitz --- newlib/libc/ctype/ctype_.c | 6 +- newlib/libc/ctype/ctype_.h | 2 +- newlib/libc/ctype/ctype_cp.h | 4 +- newlib/libc/ctype/ctype_iso.h | 4 +- newlib/libc/iconv/ccs/big5.c | 10 +- newlib/libc/iconv/ccs/ccs.h | 10 +- newlib/libc/iconv/ccs/ccsbi.c | 2 +- newlib/libc/iconv/ccs/ccsbi.h | 82 ++++++++-------- newlib/libc/iconv/ccs/cns11643_plane1.c | 10 +- newlib/libc/iconv/ccs/cns11643_plane14.c | 10 +- newlib/libc/iconv/ccs/cns11643_plane2.c | 10 +- newlib/libc/iconv/ccs/cp775.c | 6 +- newlib/libc/iconv/ccs/cp850.c | 6 +- newlib/libc/iconv/ccs/cp852.c | 6 +- newlib/libc/iconv/ccs/cp855.c | 6 +- newlib/libc/iconv/ccs/cp866.c | 6 +- newlib/libc/iconv/ccs/iso_8859_1.c | 6 +- newlib/libc/iconv/ccs/iso_8859_10.c | 6 +- newlib/libc/iconv/ccs/iso_8859_11.c | 6 +- newlib/libc/iconv/ccs/iso_8859_13.c | 6 +- newlib/libc/iconv/ccs/iso_8859_14.c | 6 +- newlib/libc/iconv/ccs/iso_8859_15.c | 6 +- newlib/libc/iconv/ccs/iso_8859_2.c | 6 +- newlib/libc/iconv/ccs/iso_8859_3.c | 6 +- newlib/libc/iconv/ccs/iso_8859_4.c | 6 +- newlib/libc/iconv/ccs/iso_8859_5.c | 6 +- newlib/libc/iconv/ccs/iso_8859_6.c | 6 +- newlib/libc/iconv/ccs/iso_8859_7.c | 6 +- newlib/libc/iconv/ccs/iso_8859_8.c | 6 +- newlib/libc/iconv/ccs/iso_8859_9.c | 6 +- newlib/libc/iconv/ccs/iso_ir_111.c | 6 +- newlib/libc/iconv/ccs/jis_x0201_1976.c | 6 +- newlib/libc/iconv/ccs/jis_x0208_1990.c | 10 +- newlib/libc/iconv/ccs/jis_x0212_1990.c | 10 +- newlib/libc/iconv/ccs/koi8_r.c | 6 +- newlib/libc/iconv/ccs/koi8_ru.c | 6 +- newlib/libc/iconv/ccs/koi8_u.c | 6 +- newlib/libc/iconv/ccs/koi8_uni.c | 6 +- newlib/libc/iconv/ccs/ksx1001.c | 10 +- newlib/libc/iconv/ccs/mktbl.pl | 14 +-- newlib/libc/iconv/ccs/win_1250.c | 6 +- newlib/libc/iconv/ccs/win_1251.c | 6 +- newlib/libc/iconv/ccs/win_1252.c | 6 +- newlib/libc/iconv/ccs/win_1253.c | 6 +- newlib/libc/iconv/ccs/win_1254.c | 6 +- newlib/libc/iconv/ccs/win_1255.c | 6 +- newlib/libc/iconv/ccs/win_1256.c | 6 +- newlib/libc/iconv/ccs/win_1257.c | 6 +- newlib/libc/iconv/ccs/win_1258.c | 6 +- newlib/libc/iconv/ces/cesbi.c | 68 +++++++------- newlib/libc/iconv/ces/cesbi.h | 40 ++++---- newlib/libc/iconv/ces/euc.c | 18 ++-- newlib/libc/iconv/ces/mkdeps.pl | 24 ++--- newlib/libc/iconv/ces/table-pcs.c | 10 +- newlib/libc/iconv/ces/table.c | 56 +++++------ newlib/libc/iconv/ces/ucs-2-internal.c | 6 +- newlib/libc/iconv/ces/ucs-2.c | 8 +- newlib/libc/iconv/ces/ucs-4-internal.c | 6 +- newlib/libc/iconv/ces/ucs-4.c | 8 +- newlib/libc/iconv/ces/us-ascii.c | 6 +- newlib/libc/iconv/ces/utf-16.c | 10 +- newlib/libc/iconv/ces/utf-8.c | 8 +- newlib/libc/iconv/lib/aliasesbi.c | 2 +- newlib/libc/iconv/lib/aliasesi.c | 30 +++--- newlib/libc/iconv/lib/conv.h | 18 ++-- newlib/libc/iconv/lib/iconv.c | 18 ++-- newlib/libc/iconv/lib/iconvnls.c | 32 +++---- newlib/libc/iconv/lib/local.h | 2 +- newlib/libc/iconv/lib/nullconv.c | 8 +- newlib/libc/iconv/lib/ucsconv.c | 24 ++--- newlib/libc/iconv/lib/ucsconv.h | 26 +++--- newlib/libc/include/_ansi.h | 2 - newlib/libc/include/ctype.h | 2 +- newlib/libc/include/iconv.h | 6 +- newlib/libc/include/pthread.h | 54 +++++------ newlib/libc/include/rpc/xdr.h | 10 +- newlib/libc/include/stdio.h | 4 +- newlib/libc/include/stdlib.h | 4 +- newlib/libc/include/sys/errno.h | 2 +- newlib/libc/include/sys/iconvnls.h | 12 +-- newlib/libc/include/sys/reent.h | 2 +- newlib/libc/include/unctrl.h | 4 +- newlib/libc/locale/locale.c | 4 +- newlib/libc/machine/cris/sys/errno.h | 2 +- newlib/libc/machine/microblaze/strcmp.c | 4 +- newlib/libc/machine/microblaze/strcpy.c | 6 +- newlib/libc/machine/microblaze/strlen.c | 6 +- newlib/libc/machine/powerpc/atosfix16.c | 4 +- newlib/libc/machine/powerpc/atosfix32.c | 4 +- newlib/libc/machine/powerpc/atosfix64.c | 4 +- newlib/libc/machine/powerpc/atoufix16.c | 4 +- newlib/libc/machine/powerpc/atoufix32.c | 4 +- newlib/libc/machine/powerpc/atoufix64.c | 4 +- newlib/libc/machine/powerpc/strtosfix16.c | 4 +- newlib/libc/machine/powerpc/strtosfix32.c | 4 +- newlib/libc/machine/powerpc/strtosfix64.c | 4 +- newlib/libc/machine/powerpc/strtoufix16.c | 4 +- newlib/libc/machine/powerpc/strtoufix32.c | 4 +- newlib/libc/machine/powerpc/strtoufix64.c | 4 +- newlib/libc/machine/powerpc/vfprintf.c | 8 +- newlib/libc/machine/powerpc/vfscanf.c | 10 +- newlib/libc/machine/spu/fdopen.c | 2 +- newlib/libc/machine/spu/fopen.c | 8 +- newlib/libc/machine/spu/fputs.c | 4 +- newlib/libc/machine/spu/freopen.c | 4 +- newlib/libc/machine/spu/fsetpos.c | 4 +- newlib/libc/machine/spu/fwrite.c | 4 +- newlib/libc/machine/spu/impure.c | 2 +- newlib/libc/machine/spu/perror.c | 4 +- newlib/libc/machine/spu/puts.c | 2 +- newlib/libc/machine/spu/remove.c | 2 +- newlib/libc/machine/spu/rename.c | 8 +- newlib/libc/machine/spu/sys/errno.h | 2 +- newlib/libc/machine/spu/vfprintf.c | 2 +- newlib/libc/machine/spu/vfscanf.c | 2 +- newlib/libc/machine/spu/vprintf.c | 4 +- newlib/libc/machine/spu/vscanf.c | 2 +- newlib/libc/machine/spu/vsnprintf.c | 4 +- newlib/libc/machine/spu/vsprintf.c | 2 +- newlib/libc/machine/spu/vsscanf.c | 8 +- newlib/libc/machine/xscale/strlen.c | 2 +- newlib/libc/misc/__dprintf.c | 4 +- newlib/libc/misc/unctrl.c | 4 +- newlib/libc/posix/execl.c | 14 +-- newlib/libc/posix/execle.c | 18 ++-- newlib/libc/posix/execlp.c | 14 +-- newlib/libc/posix/execv.c | 2 +- newlib/libc/posix/execvp.c | 4 +- newlib/libc/posix/posix_spawn.c | 52 +++++------ newlib/libc/reent/execr.c | 6 +- newlib/libc/reent/impure.c | 2 +- newlib/libc/reent/linkr.c | 4 +- newlib/libc/reent/mkdirr.c | 2 +- newlib/libc/reent/open64r.c | 2 +- newlib/libc/reent/openr.c | 2 +- newlib/libc/reent/renamer.c | 4 +- newlib/libc/reent/stat64r.c | 2 +- newlib/libc/reent/statr.c | 2 +- newlib/libc/reent/unlinkr.c | 2 +- newlib/libc/reent/writer.c | 2 +- newlib/libc/search/bsearch.c | 4 +- newlib/libc/signal/psignal.c | 2 +- newlib/libc/stdio/fdopen.c | 4 +- newlib/libc/stdio/fiscanf.c | 4 +- newlib/libc/stdio/fopen.c | 8 +- newlib/libc/stdio/fputs.c | 6 +- newlib/libc/stdio/freopen.c | 4 +- newlib/libc/stdio/fscanf.c | 4 +- newlib/libc/stdio/fsetpos.c | 4 +- newlib/libc/stdio/fvwrite.c | 2 +- newlib/libc/stdio/fvwrite.h | 2 +- newlib/libc/stdio/fwrite.c | 6 +- newlib/libc/stdio/fwscanf.c | 4 +- newlib/libc/stdio/iscanf.c | 4 +- newlib/libc/stdio/local.h | 24 ++--- newlib/libc/stdio/nano-vfprintf.c | 14 +-- newlib/libc/stdio/nano-vfprintf_float.c | 2 +- newlib/libc/stdio/nano-vfprintf_i.c | 4 +- newlib/libc/stdio/nano-vfprintf_local.h | 6 +- newlib/libc/stdio/nano-vfscanf.c | 8 +- newlib/libc/stdio/perror.c | 4 +- newlib/libc/stdio/puts.c | 4 +- newlib/libc/stdio/putw.c | 2 +- newlib/libc/stdio/remove.c | 4 +- newlib/libc/stdio/rename.c | 4 +- newlib/libc/stdio/scanf.c | 4 +- newlib/libc/stdio/siprintf.c | 8 +- newlib/libc/stdio/siscanf.c | 16 ++-- newlib/libc/stdio/sniprintf.c | 8 +- newlib/libc/stdio/snprintf.c | 8 +- newlib/libc/stdio/sprintf.c | 8 +- newlib/libc/stdio/sscanf.c | 16 ++-- newlib/libc/stdio/swprintf.c | 4 +- newlib/libc/stdio/swscanf.c | 4 +- newlib/libc/stdio/tmpnam.c | 14 +-- newlib/libc/stdio/vfprintf.c | 34 +++---- newlib/libc/stdio/vfscanf.c | 10 +- newlib/libc/stdio/vfwprintf.c | 16 ++-- newlib/libc/stdio/vfwscanf.c | 10 +- newlib/libc/stdio/viprintf.c | 4 +- newlib/libc/stdio/viscanf.c | 4 +- newlib/libc/stdio/vprintf.c | 4 +- newlib/libc/stdio/vscanf.c | 4 +- newlib/libc/stdio/vsiscanf.c | 8 +- newlib/libc/stdio/vsscanf.c | 8 +- newlib/libc/stdio/vswscanf.c | 4 +- newlib/libc/stdio/vwprintf.c | 4 +- newlib/libc/stdio/vwscanf.c | 4 +- newlib/libc/stdio/wscanf.c | 4 +- newlib/libc/stdio64/fdopen64.c | 4 +- newlib/libc/stdio64/fopen64.c | 8 +- newlib/libc/stdio64/freopen64.c | 8 +- newlib/libc/stdio64/fsetpos64.c | 4 +- newlib/libc/stdlib/__exp10.c | 2 +- newlib/libc/stdlib/atof.c | 2 +- newlib/libc/stdlib/atoff.c | 2 +- newlib/libc/stdlib/atoi.c | 4 +- newlib/libc/stdlib/atol.c | 4 +- newlib/libc/stdlib/atoll.c | 4 +- newlib/libc/stdlib/gdtoa-gethex.c | 6 +- newlib/libc/stdlib/gdtoa-hexnan.c | 12 +-- newlib/libc/stdlib/getenv.c | 4 +- newlib/libc/stdlib/getenv_r.c | 6 +- newlib/libc/stdlib/ldtoa.c | 108 +++++++++++----------- newlib/libc/stdlib/mprec.c | 14 +-- newlib/libc/stdlib/mprec.h | 12 +-- newlib/libc/stdlib/setenv.c | 6 +- newlib/libc/stdlib/setenv_r.c | 6 +- newlib/libc/stdlib/strtod.c | 14 +-- newlib/libc/stdlib/strtol.c | 4 +- newlib/libc/stdlib/strtoll.c | 6 +- newlib/libc/stdlib/strtoul.c | 4 +- newlib/libc/stdlib/strtoull.c | 4 +- newlib/libc/stdlib/system.c | 10 +- newlib/libc/stdlib/wcstod.c | 8 +- newlib/libc/stdlib/wcstol.c | 4 +- newlib/libc/stdlib/wcstoll.c | 4 +- newlib/libc/stdlib/wcstoul.c | 4 +- newlib/libc/stdlib/wcstoull.c | 4 +- newlib/libc/string/bcmp.c | 4 +- newlib/libc/string/bcopy.c | 2 +- newlib/libc/string/index.c | 2 +- newlib/libc/string/memccpy.c | 6 +- newlib/libc/string/memchr.c | 4 +- newlib/libc/string/memcmp.c | 4 +- newlib/libc/string/memcpy.c | 6 +- newlib/libc/string/memmove.c | 8 +- newlib/libc/string/mempcpy.c | 6 +- newlib/libc/string/memrchr.c | 4 +- newlib/libc/string/rawmemchr.c | 4 +- newlib/libc/string/rindex.c | 2 +- newlib/libc/string/stpcpy.c | 4 +- newlib/libc/string/stpncpy.c | 4 +- newlib/libc/string/strcasecmp.c | 8 +- newlib/libc/string/strcasestr.c | 4 +- newlib/libc/string/strcat.c | 2 +- newlib/libc/string/strchr.c | 4 +- newlib/libc/string/strchrnul.c | 2 +- newlib/libc/string/strcmp.c | 4 +- newlib/libc/string/strcoll.c | 4 +- newlib/libc/string/strcpy.c | 6 +- newlib/libc/string/strcspn.c | 8 +- newlib/libc/string/strdup.c | 2 +- newlib/libc/string/strdup_r.c | 2 +- newlib/libc/string/strlcat.c | 2 +- newlib/libc/string/strlcpy.c | 2 +- newlib/libc/string/strlen.c | 4 +- newlib/libc/string/strncasecmp.c | 8 +- newlib/libc/string/strncat.c | 2 +- newlib/libc/string/strncmp.c | 4 +- newlib/libc/string/strncpy.c | 8 +- newlib/libc/string/strndup.c | 2 +- newlib/libc/string/strndup_r.c | 4 +- newlib/libc/string/strnlen.c | 4 +- newlib/libc/string/strpbrk.c | 6 +- newlib/libc/string/strrchr.c | 4 +- newlib/libc/string/strspn.c | 8 +- newlib/libc/string/strstr.c | 4 +- newlib/libc/string/strxfrm.c | 2 +- newlib/libc/string/swab.c | 2 +- newlib/libc/string/wcpcpy.c | 2 +- newlib/libc/string/wcpncpy.c | 2 +- newlib/libc/string/wcscasecmp.c | 4 +- newlib/libc/string/wcscat.c | 4 +- newlib/libc/string/wcschr.c | 4 +- newlib/libc/string/wcscmp.c | 4 +- newlib/libc/string/wcscoll.c | 4 +- newlib/libc/string/wcscpy.c | 4 +- newlib/libc/string/wcscspn.c | 8 +- newlib/libc/string/wcslcat.c | 4 +- newlib/libc/string/wcslcpy.c | 4 +- newlib/libc/string/wcslen.c | 4 +- newlib/libc/string/wcsncasecmp.c | 4 +- newlib/libc/string/wcsncat.c | 4 +- newlib/libc/string/wcsncmp.c | 4 +- newlib/libc/string/wcsncpy.c | 2 +- newlib/libc/string/wcsnlen.c | 4 +- newlib/libc/string/wcspbrk.c | 8 +- newlib/libc/string/wcsrchr.c | 4 +- newlib/libc/string/wcsspn.c | 8 +- newlib/libc/string/wcsstr.c | 10 +- newlib/libc/string/wcswidth.c | 2 +- newlib/libc/string/wcsxfrm.c | 2 +- newlib/libc/string/wcwidth.c | 4 +- newlib/libc/string/wmemchr.c | 2 +- newlib/libc/string/wmemcmp.c | 4 +- newlib/libc/string/wmemcpy.c | 2 +- newlib/libc/string/wmemmove.c | 2 +- newlib/libc/string/wmempcpy.c | 2 +- newlib/libc/sys/linux/getpwent.c | 2 +- newlib/libc/sys/linux/pwrite.c | 4 +- newlib/libc/sys/linux/sys/errno.h | 2 +- newlib/libc/sys/phoenix/sys/errno.h | 2 +- newlib/libc/syscalls/sysexecve.c | 6 +- newlib/libc/syscalls/syslink.c | 4 +- newlib/libc/syscalls/sysstat.c | 2 +- newlib/libc/syscalls/sysunlink.c | 2 +- newlib/libc/time/asctime.c | 2 +- newlib/libc/time/asctime_r.c | 6 +- newlib/libc/time/ctime.c | 2 +- newlib/libc/time/ctime_r.c | 2 +- newlib/libc/time/gmtime.c | 2 +- newlib/libc/time/gmtime_r.c | 4 +- newlib/libc/time/lcltime.c | 2 +- newlib/libc/time/lcltime_r.c | 6 +- newlib/libc/time/local.h | 2 +- newlib/libc/time/mktime.c | 4 +- newlib/libc/time/month_lengths.c | 2 +- newlib/libc/time/strftime.c | 8 +- newlib/libc/time/strptime.c | 2 +- newlib/libc/time/tzcalc_limits.c | 6 +- newlib/libc/unix/getut.c | 2 +- newlib/libc/unix/pwrite.c | 4 +- newlib/libc/xdr/xdr_mem.c | 24 ++--- newlib/libc/xdr/xdr_private.c | 4 +- newlib/libc/xdr/xdr_rec.c | 14 +-- newlib/libc/xdr/xdr_sizeof.c | 4 +- newlib/libc/xdr/xdr_stdio.c | 14 +-- newlib/libm/test/string.c | 2 +- newlib/libm/test/test.c | 4 +- newlib/libm/test/test.h | 2 +- winsup/cygwin/libc/strptime.cc | 2 +- 322 files changed, 1145 insertions(+), 1147 deletions(-) diff --git a/newlib/libc/ctype/ctype_.c b/newlib/libc/ctype/ctype_.c index 9e3cdcf05..28727e8a8 100644 --- a/newlib/libc/ctype/ctype_.c +++ b/newlib/libc/ctype/ctype_.c @@ -87,7 +87,7 @@ static char sccsid[] = "@(#)ctype_.c 5.6 (Berkeley) 6/1/90"; /* No static const on Cygwin since it's referenced and potentially overwritten for compatibility with older applications. */ #ifndef __CYGWIN__ -_CONST +const #endif char _ctype_b[128 + 256] = { _CTYPE_DATA_128_255, @@ -116,7 +116,7 @@ __asm__ (" \n\ # endif # else /* !__CYGWIN__ */ -_CONST char _ctype_[1 + 256] = { +const char _ctype_[1 + 256] = { 0, _CTYPE_DATA_0_127, _CTYPE_DATA_128_255 @@ -125,7 +125,7 @@ _CONST char _ctype_[1 + 256] = { #else /* !ALLOW_NEGATIVE_CTYPE_INDEX */ -_CONST char _ctype_[1 + 256] = { +const char _ctype_[1 + 256] = { 0, _CTYPE_DATA_0_127, _CTYPE_DATA_128_255 diff --git a/newlib/libc/ctype/ctype_.h b/newlib/libc/ctype/ctype_.h index 5356d3815..a73870b3e 100644 --- a/newlib/libc/ctype/ctype_.h +++ b/newlib/libc/ctype/ctype_.h @@ -7,7 +7,7 @@ #ifdef ALLOW_NEGATIVE_CTYPE_INDEX #ifndef __CYGWIN__ - extern _CONST char _ctype_b[]; + extern const char _ctype_b[]; #else extern char _ctype_b[]; #endif diff --git a/newlib/libc/ctype/ctype_cp.h b/newlib/libc/ctype/ctype_cp.h index 004c1e2e8..9370778a2 100644 --- a/newlib/libc/ctype/ctype_cp.h +++ b/newlib/libc/ctype/ctype_cp.h @@ -473,7 +473,7 @@ #if defined(ALLOW_NEGATIVE_CTYPE_INDEX) #ifndef __CYGWIN__ -static _CONST +static const #endif char __ctype_cp[26][128 + 256] = { { _CTYPE_CP437_128_254, @@ -636,7 +636,7 @@ char __ctype_cp[26][128 + 256] = { #else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */ -static _CONST char __ctype_cp[26][1 + 256] = { +static const char __ctype_cp[26][1 + 256] = { { 0, _CTYPE_DATA_0_127, _CTYPE_CP437_128_254, diff --git a/newlib/libc/ctype/ctype_iso.h b/newlib/libc/ctype/ctype_iso.h index ed1d5d674..60087dc92 100644 --- a/newlib/libc/ctype/ctype_iso.h +++ b/newlib/libc/ctype/ctype_iso.h @@ -277,7 +277,7 @@ extern int __iso_8859_index (const char *charset_ext); #if defined(ALLOW_NEGATIVE_CTYPE_INDEX) #ifndef __CYGWIN__ -static _CONST +static const #endif char __ctype_iso[15][128 + 256] = { { _CTYPE_ISO_8859_1_128_254, @@ -374,7 +374,7 @@ char __ctype_iso[15][128 + 256] = { #else /* !defined(ALLOW_NEGATIVE_CTYPE_INDEX) */ -static _CONST char __ctype_iso[15][1 + 256] = { +static const char __ctype_iso[15][1 + 256] = { { 0, _CTYPE_DATA_0_127, _CTYPE_ISO_8859_1_128_254, diff --git a/newlib/libc/iconv/ccs/big5.c b/newlib/libc/iconv/ccs/big5.c index 45ea59b64..02b20a195 100644 --- a/newlib/libc/iconv/ccs/big5.c +++ b/newlib/libc/iconv/ccs/big5.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_BIG5) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_big5[] = { /* Heading Block */ @@ -2972,7 +2972,7 @@ to_ucs_speed_big5[] = #if defined (ICONV_TO_UCS_CCS_BIG5) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_big5[] = { 0x00B0, /* Ranges number */ @@ -5092,7 +5092,7 @@ to_ucs_size_big5[] = #if defined (ICONV_FROM_UCS_CCS_BIG5) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_big5[] = { /* Heading Block */ @@ -8407,7 +8407,7 @@ from_ucs_speed_big5[] = #if defined (ICONV_FROM_UCS_CCS_BIG5) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_big5[] = { 0x0235, /* Ranges number */ @@ -12579,7 +12579,7 @@ from_ucs_size_big5[] = * big5 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_big5 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/ccs.h b/newlib/libc/iconv/ccs/ccs.h index d17f4ab91..c640b6444 100644 --- a/newlib/libc/iconv/ccs/ccs.h +++ b/newlib/libc/iconv/ccs/ccs.h @@ -131,12 +131,12 @@ typedef struct { __uint16_t ver; /* Table version */ - _CONST char *name; /* CCS name */ + const char *name; /* CCS name */ __uint16_t bits; /* CCS's bits number */ int from_ucs_type; /* UCS -> CCS table optimization type */ - _CONST __uint16_t *from_ucs; /* UCS -> CCS table */ + const __uint16_t *from_ucs; /* UCS -> CCS table */ int to_ucs_type; /* CCS -> UCS table optimization type */ - _CONST __uint16_t *to_ucs; /* CCS -> UCS table */ + const __uint16_t *to_ucs; /* CCS -> UCS table */ } iconv_ccs_t; /* @@ -147,11 +147,11 @@ typedef struct int bits; /* CCS's bits number */ int type; /* Table type (builtin/external) */ int optimization; /* Table optimization type (speed/size) */ - _CONST __uint16_t *tbl; /* Table's data */ + const __uint16_t *tbl; /* Table's data */ } iconv_ccs_desc_t; /* Array containing all built-in CCS tables */ -extern _CONST iconv_ccs_t * +extern const iconv_ccs_t * _iconv_ccs[]; #endif /* __CCS_H__ */ diff --git a/newlib/libc/iconv/ccs/ccsbi.c b/newlib/libc/iconv/ccs/ccsbi.c index d79a2ce91..6bb489aa6 100644 --- a/newlib/libc/iconv/ccs/ccsbi.c +++ b/newlib/libc/iconv/ccs/ccsbi.c @@ -8,7 +8,7 @@ /* * The following array contains the list of built-in CCS tables. */ -_CONST iconv_ccs_t * +const iconv_ccs_t * _iconv_ccs[] = { #if defined (ICONV_TO_UCS_CCS_CP775) \ diff --git a/newlib/libc/iconv/ccs/ccsbi.h b/newlib/libc/iconv/ccs/ccsbi.h index 268cac30e..97a88a0e7 100644 --- a/newlib/libc/iconv/ccs/ccsbi.h +++ b/newlib/libc/iconv/ccs/ccsbi.h @@ -310,207 +310,207 @@ */ #if defined (ICONV_TO_UCS_CCS_BIG5) \ || defined (ICONV_FROM_UCS_CCS_BIG5) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_big5; #endif #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE1) \ || defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE1) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cns11643_plane1; #endif #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE14) \ || defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE14) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cns11643_plane14; #endif #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE2) \ || defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE2) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cns11643_plane2; #endif #if defined (ICONV_TO_UCS_CCS_CP775) \ || defined (ICONV_FROM_UCS_CCS_CP775) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cp775; #endif #if defined (ICONV_TO_UCS_CCS_CP850) \ || defined (ICONV_FROM_UCS_CCS_CP850) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cp850; #endif #if defined (ICONV_TO_UCS_CCS_CP852) \ || defined (ICONV_FROM_UCS_CCS_CP852) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cp852; #endif #if defined (ICONV_TO_UCS_CCS_CP855) \ || defined (ICONV_FROM_UCS_CCS_CP855) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cp855; #endif #if defined (ICONV_TO_UCS_CCS_CP866) \ || defined (ICONV_FROM_UCS_CCS_CP866) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_cp866; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_1) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_1) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_1; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_10) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_10) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_10; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_11) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_11) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_11; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_13) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_13) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_13; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_14) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_14) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_14; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_15) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_15) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_15; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_2) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_2) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_2; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_3) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_3) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_3; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_4) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_4) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_4; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_5) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_5) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_5; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_6) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_6) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_6; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_7) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_7) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_7; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_8) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_8) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_8; #endif #if defined (ICONV_TO_UCS_CCS_ISO_8859_9) \ || defined (ICONV_FROM_UCS_CCS_ISO_8859_9) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_8859_9; #endif #if defined (ICONV_TO_UCS_CCS_ISO_IR_111) \ || defined (ICONV_FROM_UCS_CCS_ISO_IR_111) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_iso_ir_111; #endif #if defined (ICONV_TO_UCS_CCS_JIS_X0201_1976) \ || defined (ICONV_FROM_UCS_CCS_JIS_X0201_1976) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_jis_x0201_1976; #endif #if defined (ICONV_TO_UCS_CCS_JIS_X0208_1990) \ || defined (ICONV_FROM_UCS_CCS_JIS_X0208_1990) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_jis_x0208_1990; #endif #if defined (ICONV_TO_UCS_CCS_JIS_X0212_1990) \ || defined (ICONV_FROM_UCS_CCS_JIS_X0212_1990) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_jis_x0212_1990; #endif #if defined (ICONV_TO_UCS_CCS_KOI8_R) \ || defined (ICONV_FROM_UCS_CCS_KOI8_R) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_koi8_r; #endif #if defined (ICONV_TO_UCS_CCS_KOI8_RU) \ || defined (ICONV_FROM_UCS_CCS_KOI8_RU) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_koi8_ru; #endif #if defined (ICONV_TO_UCS_CCS_KOI8_U) \ || defined (ICONV_FROM_UCS_CCS_KOI8_U) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_koi8_u; #endif #if defined (ICONV_TO_UCS_CCS_KOI8_UNI) \ || defined (ICONV_FROM_UCS_CCS_KOI8_UNI) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_koi8_uni; #endif #if defined (ICONV_TO_UCS_CCS_KSX1001) \ || defined (ICONV_FROM_UCS_CCS_KSX1001) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_ksx1001; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1250) \ || defined (ICONV_FROM_UCS_CCS_WIN_1250) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1250; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1251) \ || defined (ICONV_FROM_UCS_CCS_WIN_1251) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1251; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1252) \ || defined (ICONV_FROM_UCS_CCS_WIN_1252) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1252; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1253) \ || defined (ICONV_FROM_UCS_CCS_WIN_1253) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1253; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1254) \ || defined (ICONV_FROM_UCS_CCS_WIN_1254) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1254; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1255) \ || defined (ICONV_FROM_UCS_CCS_WIN_1255) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1255; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1256) \ || defined (ICONV_FROM_UCS_CCS_WIN_1256) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1256; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1257) \ || defined (ICONV_FROM_UCS_CCS_WIN_1257) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1257; #endif #if defined (ICONV_TO_UCS_CCS_WIN_1258) \ || defined (ICONV_FROM_UCS_CCS_WIN_1258) -extern _CONST iconv_ccs_t +extern const iconv_ccs_t _iconv_ccs_win_1258; #endif diff --git a/newlib/libc/iconv/ccs/cns11643_plane1.c b/newlib/libc/iconv/ccs/cns11643_plane1.c index 37e31a9a8..da1c0597c 100644 --- a/newlib/libc/iconv/ccs/cns11643_plane1.c +++ b/newlib/libc/iconv/ccs/cns11643_plane1.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE1) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cns11643_plane1[] = { /* Heading Block */ @@ -2213,7 +2213,7 @@ to_ucs_speed_cns11643_plane1[] = #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE1) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_cns11643_plane1[] = { 0x0042, /* Ranges number */ @@ -3118,7 +3118,7 @@ to_ucs_size_cns11643_plane1[] = #if defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE1) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_cns11643_plane1[] = { /* Heading Block */ @@ -6367,7 +6367,7 @@ from_ucs_speed_cns11643_plane1[] = #if defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE1) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_cns11643_plane1[] = { 0x017D, /* Ranges number */ @@ -11175,7 +11175,7 @@ from_ucs_size_cns11643_plane1[] = * cns11643_plane1 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cns11643_plane1 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cns11643_plane14.c b/newlib/libc/iconv/ccs/cns11643_plane14.c index 18230d5ab..507cdef65 100644 --- a/newlib/libc/iconv/ccs/cns11643_plane14.c +++ b/newlib/libc/iconv/ccs/cns11643_plane14.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE14) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cns11643_plane14[] = { /* Heading Block */ @@ -2411,7 +2411,7 @@ to_ucs_speed_cns11643_plane14[] = #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE14) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_cns11643_plane14[] = { 0x00DE, /* Ranges number */ @@ -4011,7 +4011,7 @@ to_ucs_size_cns11643_plane14[] = #if defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE14) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_cns11643_plane14[] = { /* Heading Block */ @@ -6765,7 +6765,7 @@ from_ucs_speed_cns11643_plane14[] = #if defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE14) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_cns11643_plane14[] = { 0x00C5, /* Ranges number */ @@ -10727,7 +10727,7 @@ from_ucs_size_cns11643_plane14[] = * cns11643_plane14 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cns11643_plane14 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cns11643_plane2.c b/newlib/libc/iconv/ccs/cns11643_plane2.c index c591ce38d..15c287f0b 100644 --- a/newlib/libc/iconv/ccs/cns11643_plane2.c +++ b/newlib/libc/iconv/ccs/cns11643_plane2.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE2) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cns11643_plane2[] = { /* Heading Block */ @@ -2774,7 +2774,7 @@ to_ucs_speed_cns11643_plane2[] = #if defined (ICONV_TO_UCS_CCS_CNS11643_PLANE2) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_cns11643_plane2[] = { 0x0052, /* Ranges number */ @@ -3936,7 +3936,7 @@ to_ucs_size_cns11643_plane2[] = #if defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE2) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_cns11643_plane2[] = { /* Heading Block */ @@ -6690,7 +6690,7 @@ from_ucs_speed_cns11643_plane2[] = #if defined (ICONV_FROM_UCS_CCS_CNS11643_PLANE2) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_cns11643_plane2[] = { 0x027E, /* Ranges number */ @@ -11912,7 +11912,7 @@ from_ucs_size_cns11643_plane2[] = * cns11643_plane2 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cns11643_plane2 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cp775.c b/newlib/libc/iconv/ccs/cp775.c index c35a87c11..f7c4af58c 100644 --- a/newlib/libc/iconv/ccs/cp775.c +++ b/newlib/libc/iconv/ccs/cp775.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_CP775) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cp775[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_cp775[] = #if defined (ICONV_FROM_UCS_CCS_CP775) -static _CONST unsigned char +static const unsigned char from_ucs_speed_cp775[] = { W(0x00A0), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_cp775[] = * cp775 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cp775 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cp850.c b/newlib/libc/iconv/ccs/cp850.c index 305ae85d1..57f5906d1 100644 --- a/newlib/libc/iconv/ccs/cp850.c +++ b/newlib/libc/iconv/ccs/cp850.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_CP850) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cp850[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_cp850[] = #if defined (ICONV_FROM_UCS_CCS_CP850) -static _CONST unsigned char +static const unsigned char from_ucs_speed_cp850[] = { W(0x00A0), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -284,7 +284,7 @@ from_ucs_speed_cp850[] = * cp850 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cp850 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cp852.c b/newlib/libc/iconv/ccs/cp852.c index 73a1e0f03..c622da499 100644 --- a/newlib/libc/iconv/ccs/cp852.c +++ b/newlib/libc/iconv/ccs/cp852.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_CP852) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cp852[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_cp852[] = #if defined (ICONV_FROM_UCS_CCS_CP852) -static _CONST unsigned char +static const unsigned char from_ucs_speed_cp852[] = { W(0x00A0), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -284,7 +284,7 @@ from_ucs_speed_cp852[] = * cp852 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cp852 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cp855.c b/newlib/libc/iconv/ccs/cp855.c index 2add727ea..41c52ed93 100644 --- a/newlib/libc/iconv/ccs/cp855.c +++ b/newlib/libc/iconv/ccs/cp855.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_CP855) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cp855[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_cp855[] = #if defined (ICONV_FROM_UCS_CCS_CP855) -static _CONST unsigned char +static const unsigned char from_ucs_speed_cp855[] = { W(0x00A0), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -284,7 +284,7 @@ from_ucs_speed_cp855[] = * cp855 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cp855 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/cp866.c b/newlib/libc/iconv/ccs/cp866.c index 678ea4232..c1dacd8f1 100644 --- a/newlib/libc/iconv/ccs/cp866.c +++ b/newlib/libc/iconv/ccs/cp866.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_CP866) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_cp866[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_cp866[] = #if defined (ICONV_FROM_UCS_CCS_CP866) -static _CONST unsigned char +static const unsigned char from_ucs_speed_cp866[] = { W(0x00A0), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_cp866[] = * cp866 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_cp866 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_1.c b/newlib/libc/iconv/ccs/iso_8859_1.c index a23947775..775bca654 100644 --- a/newlib/libc/iconv/ccs/iso_8859_1.c +++ b/newlib/libc/iconv/ccs/iso_8859_1.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_1) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_1[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_1[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_1) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_1[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -185,7 +185,7 @@ from_ucs_speed_iso_8859_1[] = * iso_8859_1 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_1 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_10.c b/newlib/libc/iconv/ccs/iso_8859_10.c index 1848afd66..b221a6a82 100644 --- a/newlib/libc/iconv/ccs/iso_8859_10.c +++ b/newlib/libc/iconv/ccs/iso_8859_10.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_10) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_10[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_10[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_10) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_10[] = { W(0x0138), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_10[] = * iso_8859_10 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_10 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_11.c b/newlib/libc/iconv/ccs/iso_8859_11.c index 97cc0757e..ebb5ec6d9 100644 --- a/newlib/libc/iconv/ccs/iso_8859_11.c +++ b/newlib/libc/iconv/ccs/iso_8859_11.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_11) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_11[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_11[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_11) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_11[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -218,7 +218,7 @@ from_ucs_speed_iso_8859_11[] = * iso_8859_11 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_11 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_13.c b/newlib/libc/iconv/ccs/iso_8859_13.c index 88a2a6f40..3905cef65 100644 --- a/newlib/libc/iconv/ccs/iso_8859_13.c +++ b/newlib/libc/iconv/ccs/iso_8859_13.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_13) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_13[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_13[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_13) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_13[] = { W(0x2019), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_13[] = * iso_8859_13 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_13 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_14.c b/newlib/libc/iconv/ccs/iso_8859_14.c index 28052a7b7..114d2df33 100644 --- a/newlib/libc/iconv/ccs/iso_8859_14.c +++ b/newlib/libc/iconv/ccs/iso_8859_14.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_14) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_14[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_14[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_14) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_14[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_14[] = * iso_8859_14 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_14 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_15.c b/newlib/libc/iconv/ccs/iso_8859_15.c index da3cfc3bb..52dff022b 100644 --- a/newlib/libc/iconv/ccs/iso_8859_15.c +++ b/newlib/libc/iconv/ccs/iso_8859_15.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_15) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_15[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_15[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_15) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_15[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_15[] = * iso_8859_15 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_15 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_2.c b/newlib/libc/iconv/ccs/iso_8859_2.c index 5a1966632..ecb374e4d 100644 --- a/newlib/libc/iconv/ccs/iso_8859_2.c +++ b/newlib/libc/iconv/ccs/iso_8859_2.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_2) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_2[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_2[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_2) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_2[] = { W(0x02D9), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_2[] = * iso_8859_2 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_2 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_3.c b/newlib/libc/iconv/ccs/iso_8859_3.c index a69fcb362..6f8003402 100644 --- a/newlib/libc/iconv/ccs/iso_8859_3.c +++ b/newlib/libc/iconv/ccs/iso_8859_3.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_3) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_3[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_3[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_3) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_3[] = { W(0x02D9), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_3[] = * iso_8859_3 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_3 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_4.c b/newlib/libc/iconv/ccs/iso_8859_4.c index 0cec45823..b080e2d29 100644 --- a/newlib/libc/iconv/ccs/iso_8859_4.c +++ b/newlib/libc/iconv/ccs/iso_8859_4.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_4) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_4[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_4[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_4) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_4[] = { W(0x02D9), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_4[] = * iso_8859_4 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_4 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_5.c b/newlib/libc/iconv/ccs/iso_8859_5.c index e4765ffef..b4b0c3f47 100644 --- a/newlib/libc/iconv/ccs/iso_8859_5.c +++ b/newlib/libc/iconv/ccs/iso_8859_5.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_5) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_5[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_5[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_5) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_5[] = { W(0x045F), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_5[] = * iso_8859_5 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_5 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_6.c b/newlib/libc/iconv/ccs/iso_8859_6.c index 783cf1f36..9967841f4 100644 --- a/newlib/libc/iconv/ccs/iso_8859_6.c +++ b/newlib/libc/iconv/ccs/iso_8859_6.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_6) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_6[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_6[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_6) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_6[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -218,7 +218,7 @@ from_ucs_speed_iso_8859_6[] = * iso_8859_6 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_6 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_7.c b/newlib/libc/iconv/ccs/iso_8859_7.c index e964a02e6..41d3400ce 100644 --- a/newlib/libc/iconv/ccs/iso_8859_7.c +++ b/newlib/libc/iconv/ccs/iso_8859_7.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_7) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_7[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_7[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_7) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_7[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_7[] = * iso_8859_7 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_7 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_8.c b/newlib/libc/iconv/ccs/iso_8859_8.c index bf49604db..029a4b873 100644 --- a/newlib/libc/iconv/ccs/iso_8859_8.c +++ b/newlib/libc/iconv/ccs/iso_8859_8.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_8) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_8[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_8[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_8) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_8[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_8859_8[] = * iso_8859_8 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_8 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_8859_9.c b/newlib/libc/iconv/ccs/iso_8859_9.c index 20fbb8424..b787b9815 100644 --- a/newlib/libc/iconv/ccs/iso_8859_9.c +++ b/newlib/libc/iconv/ccs/iso_8859_9.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_8859_9) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_8859_9[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_8859_9[] = #if defined (ICONV_FROM_UCS_CCS_ISO_8859_9) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_8859_9[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -218,7 +218,7 @@ from_ucs_speed_iso_8859_9[] = * iso_8859_9 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_8859_9 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/iso_ir_111.c b/newlib/libc/iconv/ccs/iso_ir_111.c index 0e9bcc4da..7d05ef4d5 100644 --- a/newlib/libc/iconv/ccs/iso_ir_111.c +++ b/newlib/libc/iconv/ccs/iso_ir_111.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_ISO_IR_111) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_iso_ir_111[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_iso_ir_111[] = #if defined (ICONV_FROM_UCS_CCS_ISO_IR_111) -static _CONST unsigned char +static const unsigned char from_ucs_speed_iso_ir_111[] = { W(0x042A), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -251,7 +251,7 @@ from_ucs_speed_iso_ir_111[] = * iso_ir_111 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_iso_ir_111 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/jis_x0201_1976.c b/newlib/libc/iconv/ccs/jis_x0201_1976.c index e5cdb5fdd..ca949861d 100644 --- a/newlib/libc/iconv/ccs/jis_x0201_1976.c +++ b/newlib/libc/iconv/ccs/jis_x0201_1976.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_JIS_X0201_1976) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_jis_x0201_1976[] = { INVALC,INVALC,INVALC,INVALC,INVALC,INVALC,INVALC,INVALC, @@ -75,7 +75,7 @@ to_ucs_speed_jis_x0201_1976[] = #if defined (ICONV_FROM_UCS_CCS_JIS_X0201_1976) -static _CONST unsigned char +static const unsigned char from_ucs_speed_jis_x0201_1976[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -185,7 +185,7 @@ from_ucs_speed_jis_x0201_1976[] = * jis_x0201_1976 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_jis_x0201_1976 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/jis_x0208_1990.c b/newlib/libc/iconv/ccs/jis_x0208_1990.c index c12d13482..070e0e4b0 100644 --- a/newlib/libc/iconv/ccs/jis_x0208_1990.c +++ b/newlib/libc/iconv/ccs/jis_x0208_1990.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_JIS_X0208_1990) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_jis_x0208_1990[] = { /* Heading Block */ @@ -2609,7 +2609,7 @@ to_ucs_speed_jis_x0208_1990[] = #if defined (ICONV_TO_UCS_CCS_JIS_X0208_1990) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_jis_x0208_1990[] = { 0x0055, /* Ranges number */ @@ -3684,7 +3684,7 @@ to_ucs_size_jis_x0208_1990[] = #if defined (ICONV_FROM_UCS_CCS_JIS_X0208_1990) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_jis_x0208_1990[] = { /* Heading Block */ @@ -6801,7 +6801,7 @@ from_ucs_speed_jis_x0208_1990[] = #if defined (ICONV_FROM_UCS_CCS_JIS_X0208_1990) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_jis_x0208_1990[] = { 0x01E9, /* Ranges number */ @@ -12125,7 +12125,7 @@ from_ucs_size_jis_x0208_1990[] = * jis_x0208_1990 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_jis_x0208_1990 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/jis_x0212_1990.c b/newlib/libc/iconv/ccs/jis_x0212_1990.c index eb8882f46..613de7d35 100644 --- a/newlib/libc/iconv/ccs/jis_x0212_1990.c +++ b/newlib/libc/iconv/ccs/jis_x0212_1990.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_JIS_X0212_1990) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_jis_x0212_1990[] = { /* Heading Block */ @@ -2312,7 +2312,7 @@ to_ucs_speed_jis_x0212_1990[] = #if defined (ICONV_TO_UCS_CCS_JIS_X0212_1990) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_jis_x0212_1990[] = { 0x0049, /* Ranges number */ @@ -3262,7 +3262,7 @@ to_ucs_size_jis_x0212_1990[] = #if defined (ICONV_FROM_UCS_CCS_JIS_X0212_1990) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_jis_x0212_1990[] = { /* Heading Block */ @@ -6214,7 +6214,7 @@ from_ucs_speed_jis_x0212_1990[] = #if defined (ICONV_FROM_UCS_CCS_JIS_X0212_1990) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_jis_x0212_1990[] = { 0x01AA, /* Ranges number */ @@ -11349,7 +11349,7 @@ from_ucs_size_jis_x0212_1990[] = * jis_x0212_1990 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_jis_x0212_1990 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/koi8_r.c b/newlib/libc/iconv/ccs/koi8_r.c index cccb7c1d5..698652e74 100644 --- a/newlib/libc/iconv/ccs/koi8_r.c +++ b/newlib/libc/iconv/ccs/koi8_r.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_KOI8_R) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_koi8_r[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_koi8_r[] = #if defined (ICONV_FROM_UCS_CCS_KOI8_R) -static _CONST unsigned char +static const unsigned char from_ucs_speed_koi8_r[] = { W(0x042A), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_koi8_r[] = * koi8_r CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_koi8_r = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/koi8_ru.c b/newlib/libc/iconv/ccs/koi8_ru.c index 704ce95b0..956dc7802 100644 --- a/newlib/libc/iconv/ccs/koi8_ru.c +++ b/newlib/libc/iconv/ccs/koi8_ru.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_KOI8_RU) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_koi8_ru[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_koi8_ru[] = #if defined (ICONV_FROM_UCS_CCS_KOI8_RU) -static _CONST unsigned char +static const unsigned char from_ucs_speed_koi8_ru[] = { W(0x042A), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -350,7 +350,7 @@ from_ucs_speed_koi8_ru[] = * koi8_ru CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_koi8_ru = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/koi8_u.c b/newlib/libc/iconv/ccs/koi8_u.c index ebe0c9172..d271e7e88 100644 --- a/newlib/libc/iconv/ccs/koi8_u.c +++ b/newlib/libc/iconv/ccs/koi8_u.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_KOI8_U) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_koi8_u[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_koi8_u[] = #if defined (ICONV_FROM_UCS_CCS_KOI8_U) -static _CONST unsigned char +static const unsigned char from_ucs_speed_koi8_u[] = { W(0x042A), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_koi8_u[] = * koi8_u CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_koi8_u = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/koi8_uni.c b/newlib/libc/iconv/ccs/koi8_uni.c index 5596c2d91..4523d1c78 100644 --- a/newlib/libc/iconv/ccs/koi8_uni.c +++ b/newlib/libc/iconv/ccs/koi8_uni.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_KOI8_UNI) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_koi8_uni[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_koi8_uni[] = #if defined (ICONV_FROM_UCS_CCS_KOI8_UNI) -static _CONST unsigned char +static const unsigned char from_ucs_speed_koi8_uni[] = { W(0x042A), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -350,7 +350,7 @@ from_ucs_speed_koi8_uni[] = * koi8_uni CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_koi8_uni = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/ksx1001.c b/newlib/libc/iconv/ccs/ksx1001.c index ad2c30d73..5690e4acc 100644 --- a/newlib/libc/iconv/ccs/ksx1001.c +++ b/newlib/libc/iconv/ccs/ksx1001.c @@ -21,7 +21,7 @@ #if defined (ICONV_TO_UCS_CCS_KSX1001) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_ksx1001[] = { /* Heading Block */ @@ -3005,7 +3005,7 @@ to_ucs_speed_ksx1001[] = #if defined (ICONV_TO_UCS_CCS_KSX1001) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t to_ucs_size_ksx1001[] = { 0x005D, /* Ranges number */ @@ -4266,7 +4266,7 @@ to_ucs_size_ksx1001[] = #if defined (ICONV_FROM_UCS_CCS_KSX1001) \ && !(defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_speed_ksx1001[] = { /* Heading Block */ @@ -9099,7 +9099,7 @@ from_ucs_speed_ksx1001[] = #if defined (ICONV_FROM_UCS_CCS_KSX1001) \ && (defined (TABLE_USE_SIZE_OPTIMIZATION)) -static _CONST __uint16_t +static const __uint16_t from_ucs_size_ksx1001[] = { 0x01B6, /* Ranges number */ @@ -15576,7 +15576,7 @@ from_ucs_size_ksx1001[] = * ksx1001 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_ksx1001 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/mktbl.pl b/newlib/libc/iconv/ccs/mktbl.pl index c3b87932b..633511e4d 100755 --- a/newlib/libc/iconv/ccs/mktbl.pl +++ b/newlib/libc/iconv/ccs/mktbl.pl @@ -343,7 +343,7 @@ if ($Source) * $CCSName CCS description table. * $Separator */ -_CONST $TypeBICCS +const $TypeBICCS $VarBICCS = { \t$MacroVer1Table, /* Table version */ @@ -807,7 +807,7 @@ sub Output8bitToUCS(;$) */ #if defined ($GuardToUCS) -static _CONST __uint16_t +static const __uint16_t ${VarToUCSSpeed}\[] = {\n\t"; } @@ -872,7 +872,7 @@ sub Output8bitFromUCS(;$) #if defined ($GuardFromUCS) -static _CONST unsigned char +static const unsigned char ${VarFromUCSSpeed}\[] = { "; @@ -995,7 +995,7 @@ sub OutputSpeed($;$) #if defined ($GuardToUCS) \\ && !($GuardSize) -static _CONST __uint16_t +static const __uint16_t ${VarToUCSSpeed}\[] = { "; @@ -1018,7 +1018,7 @@ ${VarToUCSSpeed}\[] = #if defined ($GuardFromUCS) \\ && !($GuardSize) -static _CONST __uint16_t +static const __uint16_t ${VarFromUCSSpeed}\[] = { "; @@ -1149,7 +1149,7 @@ sub OutputSize($;$) #if defined ($GuardToUCS) \\ && ($GuardSize) -static _CONST __uint16_t +static const __uint16_t ${VarToUCSSize}\[] = { "; @@ -1171,7 +1171,7 @@ ${VarToUCSSize}\[] = #if defined ($GuardFromUCS) \\ && ($GuardSize) -static _CONST __uint16_t +static const __uint16_t ${VarFromUCSSize}\[] = { "; diff --git a/newlib/libc/iconv/ccs/win_1250.c b/newlib/libc/iconv/ccs/win_1250.c index e43eb8d3e..d86d6a0ad 100644 --- a/newlib/libc/iconv/ccs/win_1250.c +++ b/newlib/libc/iconv/ccs/win_1250.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1250) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1250[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1250[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1250) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1250[] = { W(0x02D9), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_win_1250[] = * win_1250 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1250 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1251.c b/newlib/libc/iconv/ccs/win_1251.c index 7e9b4c339..195fc0a60 100644 --- a/newlib/libc/iconv/ccs/win_1251.c +++ b/newlib/libc/iconv/ccs/win_1251.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1251) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1251[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1251[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1251) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1251[] = { W(0x044F), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -284,7 +284,7 @@ from_ucs_speed_win_1251[] = * win_1251 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1251 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1252.c b/newlib/libc/iconv/ccs/win_1252.c index 659054fc4..463cabdfb 100644 --- a/newlib/libc/iconv/ccs/win_1252.c +++ b/newlib/libc/iconv/ccs/win_1252.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1252) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1252[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1252[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1252) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1252[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_win_1252[] = * win_1252 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1252 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1253.c b/newlib/libc/iconv/ccs/win_1253.c index 450813320..c9abd81da 100644 --- a/newlib/libc/iconv/ccs/win_1253.c +++ b/newlib/libc/iconv/ccs/win_1253.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1253) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1253[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1253[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1253) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1253[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_win_1253[] = * win_1253 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1253 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1254.c b/newlib/libc/iconv/ccs/win_1254.c index 3c1599add..05ed88efb 100644 --- a/newlib/libc/iconv/ccs/win_1254.c +++ b/newlib/libc/iconv/ccs/win_1254.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1254) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1254[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1254[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1254) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1254[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_win_1254[] = * win_1254 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1254 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1255.c b/newlib/libc/iconv/ccs/win_1255.c index 937afca5b..47e9c0129 100644 --- a/newlib/libc/iconv/ccs/win_1255.c +++ b/newlib/libc/iconv/ccs/win_1255.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1255) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1255[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1255[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1255) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1255[] = { W(0xFFFF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -350,7 +350,7 @@ from_ucs_speed_win_1255[] = * win_1255 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1255 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1256.c b/newlib/libc/iconv/ccs/win_1256.c index 44d451987..93a1f074d 100644 --- a/newlib/libc/iconv/ccs/win_1256.c +++ b/newlib/libc/iconv/ccs/win_1256.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1256) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1256[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1256[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1256) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1256[] = { W(0x06D2), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -350,7 +350,7 @@ from_ucs_speed_win_1256[] = * win_1256 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1256 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1257.c b/newlib/libc/iconv/ccs/win_1257.c index ad497cbf4..4f9fa39a7 100644 --- a/newlib/libc/iconv/ccs/win_1257.c +++ b/newlib/libc/iconv/ccs/win_1257.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1257) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1257[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1257[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1257) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1257[] = { W(0x02D9), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -317,7 +317,7 @@ from_ucs_speed_win_1257[] = * win_1257 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1257 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ccs/win_1258.c b/newlib/libc/iconv/ccs/win_1258.c index 7331d78d9..42ec24724 100644 --- a/newlib/libc/iconv/ccs/win_1258.c +++ b/newlib/libc/iconv/ccs/win_1258.c @@ -28,7 +28,7 @@ */ #if defined (ICONV_TO_UCS_CCS_WIN_1258) -static _CONST __uint16_t +static const __uint16_t to_ucs_speed_win_1258[] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, @@ -75,7 +75,7 @@ to_ucs_speed_win_1258[] = #if defined (ICONV_FROM_UCS_CCS_WIN_1258) -static _CONST unsigned char +static const unsigned char from_ucs_speed_win_1258[] = { W(0x00FF), /* Real 0xFF mapping. 0xFF is used to mark invalid codes */ @@ -350,7 +350,7 @@ from_ucs_speed_win_1258[] = * win_1258 CCS description table. * ====================================================================== */ -_CONST iconv_ccs_t +const iconv_ccs_t _iconv_ccs_win_1258 = { TABLE_VERSION_1, /* Table version */ diff --git a/newlib/libc/iconv/ces/cesbi.c b/newlib/libc/iconv/ces/cesbi.c index c2e6520a3..5fa5d1b4c 100644 --- a/newlib/libc/iconv/ces/cesbi.c +++ b/newlib/libc/iconv/ces/cesbi.c @@ -12,7 +12,7 @@ */ #if defined (ICONV_TO_UCS_CES_EUC) \ || defined (ICONV_FROM_UCS_CES_EUC) -static _CONST char * +static const char * iconv_ces_names_euc[] = { # if defined (_ICONV_FROM_ENCODING_EUC_JP) \ @@ -33,7 +33,7 @@ iconv_ces_names_euc[] = #if defined (ICONV_TO_UCS_CES_TABLE) \ || defined (ICONV_FROM_UCS_CES_TABLE) -static _CONST char * +static const char * iconv_ces_names_table[] = { # if defined (_ICONV_FROM_ENCODING_CP775) \ @@ -174,7 +174,7 @@ iconv_ces_names_table[] = #if defined (ICONV_TO_UCS_CES_TABLE_PCS) \ || defined (ICONV_FROM_UCS_CES_TABLE_PCS) -static _CONST char * +static const char * iconv_ces_names_table_pcs[] = { # if defined (_ICONV_FROM_ENCODING_BIG5) \ @@ -187,7 +187,7 @@ iconv_ces_names_table_pcs[] = #if defined (ICONV_TO_UCS_CES_UCS_2) \ || defined (ICONV_FROM_UCS_CES_UCS_2) -static _CONST char * +static const char * iconv_ces_names_ucs_2[] = { # if defined (_ICONV_FROM_ENCODING_UCS_2) \ @@ -208,7 +208,7 @@ iconv_ces_names_ucs_2[] = #if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) \ || defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) -static _CONST char * +static const char * iconv_ces_names_ucs_2_internal[] = { # if defined (_ICONV_FROM_ENCODING_UCS_2_INTERNAL) \ @@ -221,7 +221,7 @@ iconv_ces_names_ucs_2_internal[] = #if defined (ICONV_TO_UCS_CES_UCS_4) \ || defined (ICONV_FROM_UCS_CES_UCS_4) -static _CONST char * +static const char * iconv_ces_names_ucs_4[] = { # if defined (_ICONV_FROM_ENCODING_UCS_4) \ @@ -242,7 +242,7 @@ iconv_ces_names_ucs_4[] = #if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) \ || defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL) -static _CONST char * +static const char * iconv_ces_names_ucs_4_internal[] = { # if defined (_ICONV_FROM_ENCODING_UCS_4_INTERNAL) \ @@ -255,7 +255,7 @@ iconv_ces_names_ucs_4_internal[] = #if defined (ICONV_TO_UCS_CES_US_ASCII) \ || defined (ICONV_FROM_UCS_CES_US_ASCII) -static _CONST char * +static const char * iconv_ces_names_us_ascii[] = { # if defined (_ICONV_FROM_ENCODING_US_ASCII) \ @@ -268,7 +268,7 @@ iconv_ces_names_us_ascii[] = #if defined (ICONV_TO_UCS_CES_UTF_16) \ || defined (ICONV_FROM_UCS_CES_UTF_16) -static _CONST char * +static const char * iconv_ces_names_utf_16[] = { # if defined (_ICONV_FROM_ENCODING_UTF_16) \ @@ -289,7 +289,7 @@ iconv_ces_names_utf_16[] = #if defined (ICONV_TO_UCS_CES_UTF_8) \ || defined (ICONV_FROM_UCS_CES_UTF_8) -static _CONST char * +static const char * iconv_ces_names_utf_8[] = { # if defined (_ICONV_FROM_ENCODING_UTF_8) \ @@ -303,99 +303,99 @@ iconv_ces_names_utf_8[] = /* * The following structure contains the list of "to UCS" linked-in CES converters. */ -_CONST iconv_to_ucs_ces_t +const iconv_to_ucs_ces_t _iconv_to_ucs_ces[] = { #ifdef ICONV_TO_UCS_CES_EUC - {(_CONST char **)iconv_ces_names_euc, + {(const char **)iconv_ces_names_euc, &_iconv_to_ucs_ces_handlers_euc}, #endif #ifdef ICONV_TO_UCS_CES_TABLE - {(_CONST char **)iconv_ces_names_table, + {(const char **)iconv_ces_names_table, &_iconv_to_ucs_ces_handlers_table}, #endif #ifdef ICONV_TO_UCS_CES_TABLE_PCS - {(_CONST char **)iconv_ces_names_table_pcs, + {(const char **)iconv_ces_names_table_pcs, &_iconv_to_ucs_ces_handlers_table_pcs}, #endif #ifdef ICONV_TO_UCS_CES_UCS_2 - {(_CONST char **)iconv_ces_names_ucs_2, + {(const char **)iconv_ces_names_ucs_2, &_iconv_to_ucs_ces_handlers_ucs_2}, #endif #ifdef ICONV_TO_UCS_CES_UCS_2_INTERNAL - {(_CONST char **)iconv_ces_names_ucs_2_internal, + {(const char **)iconv_ces_names_ucs_2_internal, &_iconv_to_ucs_ces_handlers_ucs_2_internal}, #endif #ifdef ICONV_TO_UCS_CES_UCS_4 - {(_CONST char **)iconv_ces_names_ucs_4, + {(const char **)iconv_ces_names_ucs_4, &_iconv_to_ucs_ces_handlers_ucs_4}, #endif #ifdef ICONV_TO_UCS_CES_UCS_4_INTERNAL - {(_CONST char **)iconv_ces_names_ucs_4_internal, + {(const char **)iconv_ces_names_ucs_4_internal, &_iconv_to_ucs_ces_handlers_ucs_4_internal}, #endif #ifdef ICONV_TO_UCS_CES_US_ASCII - {(_CONST char **)iconv_ces_names_us_ascii, + {(const char **)iconv_ces_names_us_ascii, &_iconv_to_ucs_ces_handlers_us_ascii}, #endif #ifdef ICONV_TO_UCS_CES_UTF_16 - {(_CONST char **)iconv_ces_names_utf_16, + {(const char **)iconv_ces_names_utf_16, &_iconv_to_ucs_ces_handlers_utf_16}, #endif #ifdef ICONV_TO_UCS_CES_UTF_8 - {(_CONST char **)iconv_ces_names_utf_8, + {(const char **)iconv_ces_names_utf_8, &_iconv_to_ucs_ces_handlers_utf_8}, #endif - {(_CONST char **)NULL, + {(const char **)NULL, (iconv_to_ucs_ces_handlers_t *)NULL} }; /* * The following structure contains the list of "from UCS" linked-in CES converters. */ -_CONST iconv_from_ucs_ces_t +const iconv_from_ucs_ces_t _iconv_from_ucs_ces[] = { #ifdef ICONV_FROM_UCS_CES_EUC - {(_CONST char **)iconv_ces_names_euc, + {(const char **)iconv_ces_names_euc, &_iconv_from_ucs_ces_handlers_euc}, #endif #ifdef ICONV_FROM_UCS_CES_TABLE - {(_CONST char **)iconv_ces_names_table, + {(const char **)iconv_ces_names_table, &_iconv_from_ucs_ces_handlers_table}, #endif #ifdef ICONV_FROM_UCS_CES_TABLE_PCS - {(_CONST char **)iconv_ces_names_table_pcs, + {(const char **)iconv_ces_names_table_pcs, &_iconv_from_ucs_ces_handlers_table_pcs}, #endif #ifdef ICONV_FROM_UCS_CES_UCS_2 - {(_CONST char **)iconv_ces_names_ucs_2, + {(const char **)iconv_ces_names_ucs_2, &_iconv_from_ucs_ces_handlers_ucs_2}, #endif #ifdef ICONV_FROM_UCS_CES_UCS_2_INTERNAL - {(_CONST char **)iconv_ces_names_ucs_2_internal, + {(const char **)iconv_ces_names_ucs_2_internal, &_iconv_from_ucs_ces_handlers_ucs_2_internal}, #endif #ifdef ICONV_FROM_UCS_CES_UCS_4 - {(_CONST char **)iconv_ces_names_ucs_4, + {(const char **)iconv_ces_names_ucs_4, &_iconv_from_ucs_ces_handlers_ucs_4}, #endif #ifdef ICONV_FROM_UCS_CES_UCS_4_INTERNAL - {(_CONST char **)iconv_ces_names_ucs_4_internal, + {(const char **)iconv_ces_names_ucs_4_internal, &_iconv_from_ucs_ces_handlers_ucs_4_internal}, #endif #ifdef ICONV_FROM_UCS_CES_US_ASCII - {(_CONST char **)iconv_ces_names_us_ascii, + {(const char **)iconv_ces_names_us_ascii, &_iconv_from_ucs_ces_handlers_us_ascii}, #endif #ifdef ICONV_FROM_UCS_CES_UTF_16 - {(_CONST char **)iconv_ces_names_utf_16, + {(const char **)iconv_ces_names_utf_16, &_iconv_from_ucs_ces_handlers_utf_16}, #endif #ifdef ICONV_FROM_UCS_CES_UTF_8 - {(_CONST char **)iconv_ces_names_utf_8, + {(const char **)iconv_ces_names_utf_8, &_iconv_from_ucs_ces_handlers_utf_8}, #endif - {(_CONST char **)NULL, + {(const char **)NULL, (iconv_from_ucs_ces_handlers_t *)NULL} }; diff --git a/newlib/libc/iconv/ces/cesbi.h b/newlib/libc/iconv/ces/cesbi.h index 67e85ef3c..2b157c216 100644 --- a/newlib/libc/iconv/ces/cesbi.h +++ b/newlib/libc/iconv/ces/cesbi.h @@ -183,92 +183,92 @@ * These handlers are actually defined in correspondent CES converter files. */ #ifdef ICONV_TO_UCS_CES_EUC -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_euc; #endif #ifdef ICONV_FROM_UCS_CES_EUC -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_euc; #endif #ifdef ICONV_TO_UCS_CES_TABLE -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_table; #endif #ifdef ICONV_FROM_UCS_CES_TABLE -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_table; #endif #ifdef ICONV_TO_UCS_CES_TABLE_PCS -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_table_pcs; #endif #ifdef ICONV_FROM_UCS_CES_TABLE_PCS -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_table_pcs; #endif #ifdef ICONV_TO_UCS_CES_UCS_2 -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_2; #endif #ifdef ICONV_FROM_UCS_CES_UCS_2 -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_2; #endif #ifdef ICONV_TO_UCS_CES_UCS_2_INTERNAL -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_2_internal; #endif #ifdef ICONV_FROM_UCS_CES_UCS_2_INTERNAL -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_2_internal; #endif #ifdef ICONV_TO_UCS_CES_UCS_4 -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_4; #endif #ifdef ICONV_FROM_UCS_CES_UCS_4 -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_4; #endif #ifdef ICONV_TO_UCS_CES_UCS_4_INTERNAL -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_4_internal; #endif #ifdef ICONV_FROM_UCS_CES_UCS_4_INTERNAL -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_4_internal; #endif #ifdef ICONV_TO_UCS_CES_US_ASCII -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_us_ascii; #endif #ifdef ICONV_FROM_UCS_CES_US_ASCII -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_us_ascii; #endif #ifdef ICONV_TO_UCS_CES_UTF_16 -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_utf_16; #endif #ifdef ICONV_FROM_UCS_CES_UTF_16 -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_utf_16; #endif #ifdef ICONV_TO_UCS_CES_UTF_8 -extern _CONST iconv_to_ucs_ces_handlers_t +extern const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_utf_8; #endif #ifdef ICONV_FROM_UCS_CES_UTF_8 -extern _CONST iconv_from_ucs_ces_handlers_t +extern const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_utf_8; #endif diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c index 62bab771e..ab309a585 100644 --- a/newlib/libc/iconv/ces/euc.c +++ b/newlib/libc/iconv/ces/euc.c @@ -103,7 +103,7 @@ static euc_cs_desc_t euc_kr_cs_desc [] = static _VOID_PTR _DEFUN(euc_from_ucs_init, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int i; euc_data_t *data; @@ -263,7 +263,7 @@ _DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), static _VOID_PTR _DEFUN(euc_to_ucs_init, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int i; euc_data_t *data; @@ -347,7 +347,7 @@ _DEFUN(euc_to_ucs_close, (rptr, data), static ucs4_t _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { int i; @@ -366,8 +366,8 @@ _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), for (i = 1; d->desc[i].csname != NULL; i++) { - if (memcmp((_CONST _VOID_PTR)(*inbuf), - (_CONST _VOID_PTR)d->desc[i].prefix, + if (memcmp((const _VOID_PTR)(*inbuf), + (const _VOID_PTR)d->desc[i].prefix, d->desc[i].prefixbytes) == 0) { if (((int)*inbytesleft - d->desc[i].prefixbytes - d->desc[i].bytes) < 0) @@ -388,7 +388,7 @@ _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), res = _iconv_to_ucs_ces_handlers_table.convert_to_ucs ( d->data[i], - (_CONST unsigned char **)&inbuf1, + (const unsigned char **)&inbuf1, &inbytesleft1); if (((__int32_t)res) > 0) { @@ -419,7 +419,7 @@ _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), res = _iconv_to_ucs_ces_handlers_table.convert_to_ucs ( d->data[0], - (_CONST unsigned char **)&inbuf1, + (const unsigned char **)&inbuf1, &inbytesleft1); if (((__int32_t)res) > 0) { @@ -439,7 +439,7 @@ _DEFUN(euc_get_mb_cur_max, (data), } #if defined (ICONV_FROM_UCS_CES_EUC) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_euc = { euc_from_ucs_init, @@ -453,7 +453,7 @@ _iconv_from_ucs_ces_handlers_euc = #endif #if defined (ICONV_TO_UCS_CES_EUC) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_euc = { euc_to_ucs_init, diff --git a/newlib/libc/iconv/ces/mkdeps.pl b/newlib/libc/iconv/ces/mkdeps.pl index 92dd20dfb..d78dfe8f8 100755 --- a/newlib/libc/iconv/ces/mkdeps.pl +++ b/newlib/libc/iconv/ces/mkdeps.pl @@ -524,12 +524,12 @@ sub generate_cesbi_h($$) foreach my $ces (@ces) { print CESBI_H "#ifdef $macro_to_ucs_ces\U$ces\n"; - print CESBI_H "extern _CONST iconv_to_ucs_ces_handlers_t\n"; + print CESBI_H "extern const iconv_to_ucs_ces_handlers_t\n"; print CESBI_H "$var_to_ucs_handlers$ces;\n"; print CESBI_H "#endif\n"; print CESBI_H "#ifdef $macro_from_ucs_ces\U$ces\n"; - print CESBI_H "extern _CONST iconv_from_ucs_ces_handlers_t\n"; + print CESBI_H "extern const iconv_from_ucs_ces_handlers_t\n"; print CESBI_H "$var_from_ucs_handlers$ces;\n"; print CESBI_H "#endif\n\n"; } @@ -584,7 +584,7 @@ sub generate_aliasesbi_c($) print ALIASESBI_C "$comment_automatic\n\n"; print ALIASESBI_C "#include <_ansi.h>\n"; print ALIASESBI_C "#include \"encnames.h\"\n\n"; - print ALIASESBI_C "_CONST char *\n"; + print ALIASESBI_C "const char *\n"; print ALIASESBI_C "$var_aliases =\n"; print ALIASESBI_C "{\n"; @@ -749,7 +749,7 @@ sub generate_ccsbi_h($) { print CCSBI_H "#if defined ($macro_to_ucs_ccs\U$ccs) \\\n"; print CCSBI_H " || defined ($macro_from_ucs_ccs\U$ccs)\n"; - print CCSBI_H "extern _CONST iconv_ccs_t\n"; + print CCSBI_H "extern const iconv_ccs_t\n"; print CCSBI_H "$var_ccs$ccs;\n"; print CCSBI_H "#endif\n"; } @@ -789,7 +789,7 @@ sub generate_cesbi_c($) { print CESBI_C "#if defined ($macro_to_ucs_ces\U$ces) \\\n"; print CESBI_C " || defined ($macro_from_ucs_ces\U$ces)\n"; - print CESBI_C "static _CONST char *\n"; + print CESBI_C "static const char *\n"; print CESBI_C "$var_ces_names${ces}\[] =\n"; print CESBI_C "{\n"; my @encodings = sort @{$cesenc{$ces}}; @@ -808,36 +808,36 @@ sub generate_cesbi_c($) print CESBI_C "/*\n"; print CESBI_C " * The following structure contains the list of \"to UCS\" linked-in CES converters.\n"; print CESBI_C " */\n"; - print CESBI_C "_CONST iconv_to_ucs_ces_t\n"; + print CESBI_C "const iconv_to_ucs_ces_t\n"; print CESBI_C "_iconv_to_ucs_ces[] =\n"; print CESBI_C "{\n"; foreach my $ces (@ces) { print CESBI_C "#ifdef $macro_to_ucs_ces\U$ces\n"; - print CESBI_C " {(_CONST char **)$var_ces_names$ces,\n"; + print CESBI_C " {(const char **)$var_ces_names$ces,\n"; print CESBI_C " &$var_to_ucs_handlers$ces},\n"; print CESBI_C "#endif\n"; } - print CESBI_C " {(_CONST char **)NULL,\n"; + print CESBI_C " {(const char **)NULL,\n"; print CESBI_C " (iconv_to_ucs_ces_handlers_t *)NULL}\n"; print CESBI_C "};\n\n"; print CESBI_C "/*\n"; print CESBI_C " * The following structure contains the list of \"from UCS\" linked-in CES converters.\n"; print CESBI_C " */\n"; - print CESBI_C "_CONST iconv_from_ucs_ces_t\n"; + print CESBI_C "const iconv_from_ucs_ces_t\n"; print CESBI_C "_iconv_from_ucs_ces[] =\n"; print CESBI_C "{\n"; foreach my $ces (@ces) { print CESBI_C "#ifdef $macro_from_ucs_ces\U$ces\n"; - print CESBI_C " {(_CONST char **)$var_ces_names$ces,\n"; + print CESBI_C " {(const char **)$var_ces_names$ces,\n"; print CESBI_C " &$var_from_ucs_handlers$ces},\n"; print CESBI_C "#endif\n"; } - print CESBI_C " {(_CONST char **)NULL,\n"; + print CESBI_C " {(const char **)NULL,\n"; print CESBI_C " (iconv_from_ucs_ces_handlers_t *)NULL}\n"; print CESBI_C "};\n"; @@ -866,7 +866,7 @@ sub generate_ccsbi_c($) print CESBI_C " * The following array contains the list of built-in CCS tables.\n"; print CESBI_C " */\n"; - print CESBI_C "_CONST iconv_ccs_t *\n"; + print CESBI_C "const iconv_ccs_t *\n"; print CESBI_C "_iconv_ccs[] =\n"; print CESBI_C "{\n"; diff --git a/newlib/libc/iconv/ces/table-pcs.c b/newlib/libc/iconv/ces/table-pcs.c index 650bf9af2..1bab90986 100644 --- a/newlib/libc/iconv/ces/table-pcs.c +++ b/newlib/libc/iconv/ces/table-pcs.c @@ -67,7 +67,7 @@ _DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), static _VOID_PTR _DEFUN(table_pcs_from_ucs_init, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { return _iconv_from_ucs_ces_handlers_table.init (rptr, encoding); } @@ -93,7 +93,7 @@ _DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data), static ucs4_t _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { if (*inbytesleft < 1) @@ -115,7 +115,7 @@ _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), static _VOID_PTR _DEFUN(table_pcs_to_ucs_init, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { return _iconv_to_ucs_ces_handlers_table.init (rptr, encoding); } @@ -138,7 +138,7 @@ _DEFUN(table_pcs_to_ucs_get_mb_cur_max, (data), #endif /* ICONV_TO_UCS_CES_TABLE_PCS */ #if defined (ICONV_FROM_UCS_CES_TABLE_PCS) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_table_pcs = { table_pcs_from_ucs_init, @@ -152,7 +152,7 @@ _iconv_from_ucs_ces_handlers_table_pcs = #endif #if defined (ICONV_TO_UCS_CES_TABLE_PCS) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_table_pcs = { table_pcs_to_ucs_init, diff --git a/newlib/libc/iconv/ces/table.c b/newlib/libc/iconv/ces/table.c index 39c358cda..c02831a5b 100644 --- a/newlib/libc/iconv/ces/table.c +++ b/newlib/libc/iconv/ces/table.c @@ -57,17 +57,17 @@ */ static ucs2_t -_EXFUN(find_code_size, (ucs2_t code, _CONST __uint16_t *tblp)); +_EXFUN(find_code_size, (ucs2_t code, const __uint16_t *tblp)); static __inline ucs2_t -_EXFUN(find_code_speed, (ucs2_t code, _CONST __uint16_t *tblp)); +_EXFUN(find_code_speed, (ucs2_t code, const __uint16_t *tblp)); static __inline ucs2_t -_EXFUN(find_code_speed_8bit, (ucs2_t code, _CONST unsigned char *tblp)); +_EXFUN(find_code_speed_8bit, (ucs2_t code, const unsigned char *tblp)); #ifdef _ICONV_ENABLE_EXTERNAL_CCS -static _CONST iconv_ccs_desc_t * -_EXFUN(load_file, (struct _reent *rptr, _CONST char *name, int direction)); +static const iconv_ccs_desc_t * +_EXFUN(load_file, (struct _reent *rptr, const char *name, int direction)); #endif /* @@ -78,7 +78,7 @@ _DEFUN(table_close, (rptr, data), struct _reent *rptr, _VOID_PTR data) { - _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; + const iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; if (ccsp->type == TABLE_EXTERNAL) _free_r (rptr, (_VOID_PTR)ccsp->tbl); @@ -91,10 +91,10 @@ _DEFUN(table_close, (rptr, data), static _VOID_PTR _DEFUN(table_init_from_ucs, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int i; - _CONST iconv_ccs_t *biccsp = NULL; + const iconv_ccs_t *biccsp = NULL; iconv_ccs_desc_t *ccsp; for (i = 0; _iconv_ccs[i] != NULL; i++) @@ -133,7 +133,7 @@ _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), unsigned char **outbuf, size_t *outbytesleft) { - _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; + const iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; ucs2_t code; if (in > 0xFFFF || in == INVALC) @@ -142,7 +142,7 @@ _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), if (ccsp->bits == TABLE_8BIT) { code = find_code_speed_8bit ((ucs2_t)in, - (_CONST unsigned char *)ccsp->tbl); + (const unsigned char *)ccsp->tbl); if (code == INVALC) return (size_t)ICONV_CES_INVALID_CHARACTER; **outbuf = (unsigned char)code; @@ -174,10 +174,10 @@ _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), static _VOID_PTR _DEFUN(table_init_to_ucs, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int i; - _CONST iconv_ccs_t *biccsp = NULL; + const iconv_ccs_t *biccsp = NULL; iconv_ccs_desc_t *ccsp; for (i = 0; _iconv_ccs[i] != NULL; i++) @@ -212,10 +212,10 @@ _DEFUN(table_init_to_ucs, (rptr, encoding), static ucs4_t _DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { - _CONST iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; + const iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; ucs2_t ucs; if (ccsp->bits == TABLE_8BIT) @@ -261,7 +261,7 @@ _DEFUN(table_get_mb_cur_max, (data), #if defined (ICONV_TO_UCS_CES_TABLE) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_table = { table_init_to_ucs, @@ -275,7 +275,7 @@ _iconv_to_ucs_ces_handlers_table = #endif /* ICONV_FROM_UCS_CES_TABLE */ #if defined (ICONV_FROM_UCS_CES_TABLE) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_table = { table_init_from_ucs, @@ -297,7 +297,7 @@ _iconv_from_ucs_ces_handlers_table = * * PARAMETERS: * ucs2_t code - code whose mapping to find. - * _CONST __uint16_t *tblp - table pointer. + * const __uint16_t *tblp - table pointer. * * RETURN: * Code that corresponds to 'code'. @@ -305,7 +305,7 @@ _iconv_from_ucs_ces_handlers_table = static __inline ucs2_t _DEFUN(find_code_speed, (code, tblp), ucs2_t code, - _CONST __uint16_t *tblp) + const __uint16_t *tblp) { int idx = tblp[code >> 8]; @@ -320,7 +320,7 @@ _DEFUN(find_code_speed, (code, tblp), * * PARAMETERS: * ucs2_t code - code whose mapping to find. - * _CONST __uint16_t *tblp - table pointer. + * const __uint16_t *tblp - table pointer. * * RETURN: * Code that corresponds to 'code'. @@ -328,7 +328,7 @@ _DEFUN(find_code_speed, (code, tblp), static __inline ucs2_t _DEFUN(find_code_speed_8bit, (code, tblp), ucs2_t code, - _CONST unsigned char *tblp) + const unsigned char *tblp) { int idx; unsigned char ccs; @@ -360,7 +360,7 @@ _DEFUN(find_code_speed_8bit, (code, tblp), * * PARAMETERS: * ucs2_t code - code whose mapping to find. - * _CONST __uint16_t *tblp - table pointer. + * const __uint16_t *tblp - table pointer. * * RETURN: * Code that corresponds to 'code'. @@ -368,7 +368,7 @@ _DEFUN(find_code_speed_8bit, (code, tblp), static ucs2_t _DEFUN(find_code_size, (code, tblp), ucs2_t code, - _CONST __uint16_t *tblp) + const __uint16_t *tblp) { int first, last, cur, center; @@ -447,7 +447,7 @@ _DEFUN(find_code_size, (code, tblp), * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. - * _CONST char *name - encoding name. + * const char *name - encoding name. * int direction - conversion direction. * * DESCRIPTION: @@ -459,17 +459,17 @@ _DEFUN(find_code_size, (code, tblp), * RETURN: * iconv_ccs_desc_t * pointer is success, NULL if failure. */ -static _CONST iconv_ccs_desc_t * +static const iconv_ccs_desc_t * _DEFUN(load_file, (rptr, name, direction), struct _reent *rptr, - _CONST char *name, + const char *name, int direction) { int fd; - _CONST unsigned char *buf; + const unsigned char *buf; int tbllen, hdrlen; off_t off; - _CONST char *fname; + const char *fname; iconv_ccs_desc_t *ccsp = NULL; int nmlen = strlen(name); /* Since CCS table name length can vary - it is aligned (by adding extra @@ -487,7 +487,7 @@ _DEFUN(load_file, (rptr, name, direction), if ((fd = _open_r (rptr, fname, O_RDONLY, S_IRUSR)) == -1) goto error1; - if ((buf = (_CONST unsigned char *)_malloc_r (rptr, hdrlen)) == NULL) + if ((buf = (const unsigned char *)_malloc_r (rptr, hdrlen)) == NULL) goto error2; if (_read_r (rptr, fd, (_VOID_PTR)buf, hdrlen) != hdrlen) diff --git a/newlib/libc/iconv/ces/ucs-2-internal.c b/newlib/libc/iconv/ces/ucs-2-internal.c index 2aacce912..7aed01e88 100644 --- a/newlib/libc/iconv/ces/ucs-2-internal.c +++ b/newlib/libc/iconv/ces/ucs-2-internal.c @@ -68,7 +68,7 @@ _DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), static ucs4_t _DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { register ucs4_t res; @@ -96,7 +96,7 @@ _DEFUN(ucs_2_internal_get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_2_internal = { NULL, @@ -110,7 +110,7 @@ _iconv_to_ucs_ces_handlers_ucs_2_internal = #endif #if defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_2_internal = { NULL, diff --git a/newlib/libc/iconv/ces/ucs-2.c b/newlib/libc/iconv/ces/ucs-2.c index 000a7912f..7d03ee890 100644 --- a/newlib/libc/iconv/ces/ucs-2.c +++ b/newlib/libc/iconv/ces/ucs-2.c @@ -52,7 +52,7 @@ static _VOID_PTR _DEFUN(ucs_2_init, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int *data; @@ -107,7 +107,7 @@ _DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), static ucs4_t _DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { ucs4_t res; @@ -139,7 +139,7 @@ _DEFUN(ucs_2_get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_UCS_2) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_2 = { ucs_2_init, @@ -153,7 +153,7 @@ _iconv_to_ucs_ces_handlers_ucs_2 = #endif #if defined (ICONV_FROM_UCS_CES_UCS_2) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_2 = { ucs_2_init, diff --git a/newlib/libc/iconv/ces/ucs-4-internal.c b/newlib/libc/iconv/ces/ucs-4-internal.c index 4266b2afc..1df5f3fc6 100644 --- a/newlib/libc/iconv/ces/ucs-4-internal.c +++ b/newlib/libc/iconv/ces/ucs-4-internal.c @@ -68,7 +68,7 @@ _DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), static ucs4_t _DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { register ucs4_t res; @@ -96,7 +96,7 @@ _DEFUN(ucs_4_internal_get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_4_internal = { NULL, @@ -110,7 +110,7 @@ _iconv_to_ucs_ces_handlers_ucs_4_internal = #endif #if defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_4_internal = { NULL, diff --git a/newlib/libc/iconv/ces/ucs-4.c b/newlib/libc/iconv/ces/ucs-4.c index 1d028c5dd..8fbfa6aa1 100644 --- a/newlib/libc/iconv/ces/ucs-4.c +++ b/newlib/libc/iconv/ces/ucs-4.c @@ -53,7 +53,7 @@ static _VOID_PTR _DEFUN(ucs_4_init, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int *data; @@ -109,7 +109,7 @@ _DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), static ucs4_t _DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { ucs4_t res; @@ -141,7 +141,7 @@ _DEFUN(ucs_4_get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_UCS_4) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_ucs_4 = { ucs_4_init, @@ -155,7 +155,7 @@ _iconv_to_ucs_ces_handlers_ucs_4 = #endif #if defined (ICONV_FROM_UCS_CES_UCS_4) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_ucs_4 = { ucs_4_init, diff --git a/newlib/libc/iconv/ces/us-ascii.c b/newlib/libc/iconv/ces/us-ascii.c index eb4dee6e3..1fc7c5d89 100644 --- a/newlib/libc/iconv/ces/us-ascii.c +++ b/newlib/libc/iconv/ces/us-ascii.c @@ -62,7 +62,7 @@ _DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), static ucs4_t _DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { ucs4_t res; @@ -90,7 +90,7 @@ _DEFUN(us_ascii_get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_US_ASCII) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_us_ascii = { NULL, @@ -104,7 +104,7 @@ _iconv_to_ucs_ces_handlers_us_ascii = #endif #if defined (ICONV_FROM_UCS_CES_US_ASCII) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_us_ascii = { NULL, diff --git a/newlib/libc/iconv/ces/utf-16.c b/newlib/libc/iconv/ces/utf-16.c index 93cc4c341..fee97b0ee 100644 --- a/newlib/libc/iconv/ces/utf-16.c +++ b/newlib/libc/iconv/ces/utf-16.c @@ -70,7 +70,7 @@ _DEFUN(utf_16_close, (rptr, data), static _VOID_PTR _DEFUN(utf_16_init_from_ucs, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int *data; @@ -172,7 +172,7 @@ _DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), static _VOID_PTR _DEFUN(utf_16_init_to_ucs, (rptr, encoding), struct _reent *rptr, - _CONST char *encoding) + const char *encoding) { int *data; @@ -192,7 +192,7 @@ _DEFUN(utf_16_init_to_ucs, (rptr, encoding), static ucs4_t _DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { register ucs2_t w1; @@ -275,7 +275,7 @@ _DEFUN(utf_16_get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_UTF_16) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_utf_16 = { utf_16_init_to_ucs, @@ -289,7 +289,7 @@ _iconv_to_ucs_ces_handlers_utf_16 = #endif #if defined (ICONV_FROM_UCS_CES_UTF_16) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_utf_16 = { utf_16_init_from_ucs, diff --git a/newlib/libc/iconv/ces/utf-8.c b/newlib/libc/iconv/ces/utf-8.c index f02dd6fcc..ae778d12d 100644 --- a/newlib/libc/iconv/ces/utf-8.c +++ b/newlib/libc/iconv/ces/utf-8.c @@ -127,10 +127,10 @@ _DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), static ucs4_t _DEFUN(convert_to_ucs, (data, inbuf, inbytesleft), _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft) { - register _CONST unsigned char *in = *inbuf; + register const unsigned char *in = *inbuf; register size_t bytes; ucs4_t res; @@ -266,7 +266,7 @@ _DEFUN(get_mb_cur_max, (data), } #if defined (ICONV_TO_UCS_CES_UTF_8) -_CONST iconv_to_ucs_ces_handlers_t +const iconv_to_ucs_ces_handlers_t _iconv_to_ucs_ces_handlers_utf_8 = { NULL, @@ -280,7 +280,7 @@ _iconv_to_ucs_ces_handlers_utf_8 = #endif #if defined (ICONV_FROM_UCS_CES_UTF_8) -_CONST iconv_from_ucs_ces_handlers_t +const iconv_from_ucs_ces_handlers_t _iconv_from_ucs_ces_handlers_utf_8 = { NULL, diff --git a/newlib/libc/iconv/lib/aliasesbi.c b/newlib/libc/iconv/lib/aliasesbi.c index 36c434e16..dfd7090d0 100644 --- a/newlib/libc/iconv/lib/aliasesbi.c +++ b/newlib/libc/iconv/lib/aliasesbi.c @@ -5,7 +5,7 @@ #include <_ansi.h> #include "encnames.h" -_CONST char * +const char * _iconv_aliases = { #if defined (_ICONV_FROM_ENCODING_BIG5) \ diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c index 278b84915..1f4f70ffc 100644 --- a/newlib/libc/iconv/lib/aliasesi.c +++ b/newlib/libc/iconv/lib/aliasesi.c @@ -38,7 +38,7 @@ * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. - * _CONST char *str - string to canonize. + * const char *str - string to canonize. * * DESCRIPTION: * Converts all letters to small and substitute all '-' characters by '_' @@ -47,15 +47,15 @@ * RETURN: * Returns canonical form of 'str' if success, NULL if failure. */ -static _CONST char * +static const char * _DEFUN(canonical_form, (rptr, str), struct _reent *rptr, - _CONST char *str) + const char *str) { char *p, *p1; if (str == NULL || (p = p1 = _strdup_r (rptr, str)) == NULL) - return (_CONST char *)NULL; + return (const char *)NULL; for (; *str; str++, p++) { @@ -65,7 +65,7 @@ _DEFUN(canonical_form, (rptr, str), *p = tolower (*str); } - return (_CONST char *)p1; + return (const char *)p1; } /* @@ -73,8 +73,8 @@ _DEFUN(canonical_form, (rptr, str), * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. - * _CONST char *alias - alias by which "official" name should be found. - * _CONST char *table - aliases table. + * const char *alias - alias by which "official" name should be found. + * const char *table - aliases table. * int len - aliases table length. * * DESCRIPTION: @@ -95,15 +95,15 @@ _DEFUN(canonical_form, (rptr, str), static char * _DEFUN(find_alias, (rptr, alias, table, len), struct _reent *rptr, - _CONST char *alias, - _CONST char *table, + const char *alias, + const char *table, int len) { - _CONST char *end; - _CONST char *p; + const char *end; + const char *p; int l = strlen (alias); - _CONST char *ptable = table; - _CONST char *table_end = table + len; + const char *ptable = table; + const char *table_end = table + len; if (table == NULL || alias == NULL || *table == '\0' || *alias == '\0') return NULL; @@ -136,7 +136,7 @@ search_again: * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. - * _CONST char *ca - encoding alias to resolve. + * const char *ca - encoding alias to resolve. * * DESCRIPTION: * First, tries to find 'ca' among built-in aliases. If not found, tries to @@ -149,7 +149,7 @@ search_again: char * _DEFUN(_iconv_resolve_encoding_name, (rptr, cname, path), struct _reent *rptr, - _CONST char *ca) + const char *ca) { char *p = (char *)ca; diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h index 550f44949..f0088767e 100644 --- a/newlib/libc/iconv/lib/conv.h +++ b/newlib/libc/iconv/lib/conv.h @@ -52,8 +52,8 @@ typedef struct * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process; - * _CONST char *to - output encoding's normalized name; - * _CONST char *from - input encoding's normalized name. + * const char *to - output encoding's normalized name; + * const char *from - input encoding's normalized name. * * DESCRIPTION: * This function is called from iconv_open() to open conversion. Returns @@ -64,8 +64,8 @@ typedef struct * returns NULL and sets current thread's/process's errno. */ _VOID_PTR _EXFNPTR(open, (struct _reent *rptr, - _CONST char *to, - _CONST char *from)); + const char *to, + const char *from)); /* * close - close conversion. @@ -89,7 +89,7 @@ typedef struct * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. * _VOID_PTR data - conversion-specific data; - * _CONST unsigned char **inbuf - input data buffer; + * const unsigned char **inbuf - input data buffer; * size_t *inbytesleft - input buffer's length; * unsigned char **outbuf - output data buffer; * size_t *outbytesleft - output buffer free space; @@ -116,7 +116,7 @@ typedef struct */ size_t _EXFNPTR(convert, (struct _reent *rptr, _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, size_t *outbytesleft, @@ -199,7 +199,7 @@ typedef struct typedef struct { /* Iconv conversion handlers. */ - _CONST iconv_conversion_handlers_t *handlers; + const iconv_conversion_handlers_t *handlers; /* * Conversion-specific data (e.g., points to iconv_ucs_conversion_t @@ -210,11 +210,11 @@ typedef struct /* UCS-based conversion handlers */ -extern _CONST iconv_conversion_handlers_t +extern const iconv_conversion_handlers_t _iconv_ucs_conversion_handlers; /* Null conversion handlers */ -extern _CONST iconv_conversion_handlers_t +extern const iconv_conversion_handlers_t _iconv_null_conversion_handlers; #endif /* !__ICONV_CONVERSION_H__ */ diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c index b8000e4be..7c9b252f3 100644 --- a/newlib/libc/iconv/lib/iconv.c +++ b/newlib/libc/iconv/lib/iconv.c @@ -121,8 +121,8 @@ No supporting OS subroutine calls are required. iconv_t _DEFUN(iconv_open, (to, from), - _CONST char *to, - _CONST char *from) + const char *to, + const char *from) { return _iconv_open_r (_REENT, to, from); } @@ -136,7 +136,7 @@ _DEFUN(iconv, (cd, inbuf, inbytesleft, outbuf, outbytesleft), char **__restrict outbuf, size_t *__restrict outbytesleft) { - return _iconv_r (_REENT, cd, (_CONST char **) inbuf, inbytesleft, + return _iconv_r (_REENT, cd, (const char **) inbuf, inbytesleft, outbuf, outbytesleft); } @@ -152,18 +152,18 @@ _DEFUN(iconv_close, (cd), iconv_t cd) iconv_t _DEFUN(_iconv_open_r, (rptr, to, from), struct _reent *rptr, - _CONST char *to, - _CONST char *from) + const char *to, + const char *from) { iconv_conversion_t *ic; if (to == NULL || from == NULL || *to == '\0' || *from == '\0') return (iconv_t)-1; - if ((to = (_CONST char *)_iconv_resolve_encoding_name (rptr, to)) == NULL) + if ((to = (const char *)_iconv_resolve_encoding_name (rptr, to)) == NULL) return (iconv_t)-1; - if ((from = (_CONST char *)_iconv_resolve_encoding_name (rptr, from)) == NULL) + if ((from = (const char *)_iconv_resolve_encoding_name (rptr, from)) == NULL) { _free_r (rptr, (_VOID_PTR)to); return (iconv_t)-1; @@ -204,7 +204,7 @@ size_t _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), struct _reent *rptr, iconv_t cd, - _CONST char **inbuf, + const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) @@ -279,7 +279,7 @@ _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), return ic->handlers->convert (rptr, ic->data, - (_CONST unsigned char**)inbuf, + (const unsigned char**)inbuf, inbytesleft, (unsigned char**)outbuf, outbytesleft, diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c index 3223e1303..fa35cca1a 100644 --- a/newlib/libc/iconv/lib/iconvnls.c +++ b/newlib/libc/iconv/lib/iconvnls.c @@ -46,9 +46,9 @@ * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. - * _CONST char *file - the name of file. - * _CONST char *dir - the name of subdirectory; - * _CONST char *ext - file extension. + * const char *file - the name of file. + * const char *dir - the name of subdirectory; + * const char *ext - file extension. * * DESCRIPTION: * Function constructs patch to icionv-related file. @@ -58,12 +58,12 @@ * The pointer to file name if success, In case of error returns NULL * and sets current thread's/process's errno. */ -_CONST char * +const char * _DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), struct _reent *rptr, - _CONST char *file, - _CONST char *dir, - _CONST char *ext) + const char *file, + const char *dir, + const char *ext) { int len1, len2, len3; char *path; @@ -78,7 +78,7 @@ _DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), len3 = strlen (ext); if ((p = _malloc_r (rptr, len1 + dirlen + len2 + len3 + 3)) == NULL) - return (_CONST char *)NULL; + return (const char *)NULL; memcpy (p, path, len1); if (p[len1 - 1] != '/') @@ -95,7 +95,7 @@ _DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), } p[len1] = '\0'; - return (_CONST char *)p; + return (const char *)p; } @@ -169,7 +169,7 @@ size_t _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), struct _reent *rptr, iconv_t cd, - _CONST char **inbuf, + const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) @@ -199,7 +199,7 @@ _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), return ic->handlers->convert (rptr, ic->data, - (_CONST unsigned char**)inbuf, + (const unsigned char**)inbuf, inbytesleft, (unsigned char**)outbuf, outbytesleft, @@ -261,8 +261,8 @@ _DEFUN(_iconv_nls_set_state, (cd, ps, direction), static iconv_t _DEFUN(iconv_open1, (rptr, to, from), struct _reent *rptr, - _CONST char *to, - _CONST char *from) + const char *to, + const char *from) { iconv_conversion_t *ic; @@ -301,7 +301,7 @@ _DEFUN(iconv_open1, (rptr, to, from), * * PARAMETERS: * struct _reent *rptr - process's reent structure; - * _CONST char *encoding - encoding name; + * const char *encoding - encoding name; * iconv_t *tomb - wchar -> encoding iconv descriptor pointer; * iconv_t *towc - encoding -> wchar iconv descriptor pointer; * int flag - perform encoding name resolving flag. @@ -318,12 +318,12 @@ _DEFUN(iconv_open1, (rptr, to, from), int _DEFUN(_iconv_nls_open, (rptr, encoding, towc, tomb), struct _reent *rptr, - _CONST char *encoding, + const char *encoding, iconv_t *tomb, iconv_t *towc, int flag) { - _CONST char *wchar_encoding; + const char *wchar_encoding; if (sizeof (wchar_t) > 2 && WCHAR_MAX > 0xFFFF) wchar_encoding = "ucs_4_internal"; diff --git a/newlib/libc/iconv/lib/local.h b/newlib/libc/iconv/lib/local.h index fd386c5fb..46428ae17 100644 --- a/newlib/libc/iconv/lib/local.h +++ b/newlib/libc/iconv/lib/local.h @@ -62,7 +62,7 @@ typedef __uint32_t ucs4_t; /* The list of built-in encoding names and aliases */ -extern _CONST char * +extern const char * _iconv_aliases; #endif /* !__ICONV_LIB_LOCAL_H__ */ diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c index 7ddbc77bd..729007ab0 100644 --- a/newlib/libc/iconv/lib/nullconv.c +++ b/newlib/libc/iconv/lib/nullconv.c @@ -38,8 +38,8 @@ static int null_conversion_dummy_data; static _VOID_PTR _DEFUN(null_conversion_open, (rptr, to, from), struct _reent *rptr, - _CONST char *to, - _CONST char *from) + const char *to, + const char *from) { return (_VOID_PTR)&null_conversion_dummy_data; } @@ -59,7 +59,7 @@ _DEFUN(null_conversion_convert, (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft), struct _reent *rptr, _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, size_t *outbytesleft, @@ -129,7 +129,7 @@ _DEFUN(null_conversion_is_stateful, (data, direction), } /* Null conversion definition object */ -_CONST iconv_conversion_handlers_t +const iconv_conversion_handlers_t _iconv_null_conversion_handlers = { null_conversion_open, diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c index 46ad33efe..7cc65c86c 100644 --- a/newlib/libc/iconv/lib/ucsconv.c +++ b/newlib/libc/iconv/lib/ucsconv.c @@ -36,8 +36,8 @@ static int fake_data; static int -_EXFUN(find_encoding_name, (_CONST char *searchee, - _CONST char **names)); +_EXFUN(find_encoding_name, (const char *searchee, + const char **names)); /* @@ -47,12 +47,12 @@ _EXFUN(find_encoding_name, (_CONST char *searchee, static _VOID_PTR _DEFUN(ucs_based_conversion_open, (rptr, to, from), struct _reent *rptr, - _CONST char *to, - _CONST char *from) + const char *to, + const char *from) { iconv_ucs_conversion_t *uc; - _CONST iconv_to_ucs_ces_t *to_ucs_bices; - _CONST iconv_from_ucs_ces_t *from_ucs_bices; + const iconv_to_ucs_ces_t *to_ucs_bices; + const iconv_from_ucs_ces_t *from_ucs_bices; uc = (iconv_ucs_conversion_t *) _calloc_r (rptr, 1, sizeof (iconv_ucs_conversion_t)); @@ -148,7 +148,7 @@ _DEFUN(ucs_based_conversion_convert, (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft, flags), struct _reent *rptr, _VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, size_t *outbytesleft, @@ -163,7 +163,7 @@ _DEFUN(ucs_based_conversion_convert, { register size_t bytes; register ucs4_t ch; - _CONST unsigned char *inbuf_save = *inbuf; + const unsigned char *inbuf_save = *inbuf; size_t inbyteslef_save = *inbytesleft; if (*outbytesleft == 0) @@ -324,7 +324,7 @@ _DEFUN(ucs_based_conversion_is_stateful, (data, direction), /* UCS-based conversion definition object */ -_CONST iconv_conversion_handlers_t +const iconv_conversion_handlers_t _iconv_ucs_conversion_handlers = { ucs_based_conversion_open, @@ -343,10 +343,10 @@ _iconv_ucs_conversion_handlers = static int _DEFUN(find_encoding_name, (searchee, names), - _CONST char *searchee, - _CONST char **names) + const char *searchee, + const char **names) { - _CONST char *p; + const char *p; for (p = *names; p != NULL; p = *(names++)) if (strcmp (p, searchee) == 0) diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h index 4bf7174bf..cea6d5aa3 100644 --- a/newlib/libc/iconv/lib/ucsconv.h +++ b/newlib/libc/iconv/lib/ucsconv.h @@ -57,7 +57,7 @@ typedef struct * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process; - * _CONST char *encoding - encoding name. + * const char *encoding - encoding name. * * DESCRIPTION: * Initializes CES converter. CES converter may deal with a series of @@ -69,7 +69,7 @@ typedef struct * NULL and sets current thread's/process's errno. */ _VOID_PTR _EXFNPTR(init, (struct _reent *rptr, - _CONST char *encoding)); + const char *encoding)); /* * close - close CES converter. @@ -142,7 +142,7 @@ typedef struct * * PARAMETERS: * _VOID_PTR data - CES converter-specific data; - * _CONST unsigned char **inbuf - buffer with input character byte sequence; + * const unsigned char **inbuf - buffer with input character byte sequence; * size_t *inbytesleft - output buffer bytes count. * * DESCRIPTION: @@ -156,7 +156,7 @@ typedef struct * sequence was met, returns ICONV_CES_BAD_SEQUENCE. */ ucs4_t _EXFNPTR(convert_to_ucs, (_VOID_PTR data, - _CONST unsigned char **inbuf, + const unsigned char **inbuf, size_t *inbytesleft)); } iconv_to_ucs_ces_handlers_t; @@ -173,7 +173,7 @@ typedef struct { /* Same as in iconv_to_ucs_ces_handlers_t */ _VOID_PTR _EXFNPTR(init, (struct _reent *rptr, - _CONST char *encoding)); + const char *encoding)); /* Same as in iconv_to_ucs_ces_handlers_t */ size_t _EXFNPTR(close, (struct _reent *rptr, @@ -231,7 +231,7 @@ typedef struct typedef struct { /* CES converter handlers */ - _CONST iconv_to_ucs_ces_handlers_t *handlers; + const iconv_to_ucs_ces_handlers_t *handlers; /* "to_ucs" CES converter-specific data. */ _VOID_PTR data; @@ -247,7 +247,7 @@ typedef struct typedef struct { /* CES converter handlers */ - _CONST iconv_from_ucs_ces_handlers_t *handlers; + const iconv_from_ucs_ces_handlers_t *handlers; /* "from_ucs" CES converter-specific data. */ _VOID_PTR data; @@ -290,10 +290,10 @@ typedef struct * An array of encodings names, supported by CES converter. * The end of array should be marked by NULL pointer. */ - _CONST char **names; + const char **names; /* CES converter description structure */ - _CONST iconv_to_ucs_ces_handlers_t *handlers; + const iconv_to_ucs_ces_handlers_t *handlers; } iconv_to_ucs_ces_t; @@ -308,19 +308,19 @@ typedef struct * An array of encodings names, supported by CES converter. * The end of array should be marked by NULL pointer. */ - _CONST char **names; + const char **names; /* CES converter description structure */ - _CONST iconv_from_ucs_ces_handlers_t *handlers; + const iconv_from_ucs_ces_handlers_t *handlers; } iconv_from_ucs_ces_t; /* List of "to UCS" linked-in CES converters. */ -extern _CONST iconv_to_ucs_ces_t +extern const iconv_to_ucs_ces_t _iconv_to_ucs_ces[]; /* List of "from UCS" linked-in CES converters. */ -extern _CONST iconv_from_ucs_ces_t +extern const iconv_from_ucs_ces_t _iconv_from_ucs_ces[]; #endif /* !__ICONV_UCS_CONVERSION_H__ */ diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index fc832fc40..b0ce3bd4e 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -49,7 +49,6 @@ #ifdef _HAVE_STDC #define _PTR void * #define _NOARGS void -#define _CONST const #define _VOLATILE volatile #define _SIGNED signed #define _DOTS , ... @@ -77,7 +76,6 @@ #else #define _PTR char * #define _NOARGS -#define _CONST #define _VOLATILE #define _SIGNED #define _DOTS diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index 06458cbda..0d705e131 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -162,7 +162,7 @@ const char *__locale_ctype_ptr_l (locale_t); #endif /* !__cplusplus */ /* For C++ backward-compatibility only. */ -extern __IMPORT _CONST char _ctype_[]; +extern __IMPORT const char _ctype_[]; _END_STD_C diff --git a/newlib/libc/include/iconv.h b/newlib/libc/include/iconv.h index 4c023e9df..e19f73d85 100644 --- a/newlib/libc/include/iconv.h +++ b/newlib/libc/include/iconv.h @@ -38,7 +38,7 @@ _BEGIN_STD_C #ifndef _REENT_ONLY iconv_t -_EXFUN(iconv_open, (_CONST char *, _CONST char *)); +_EXFUN(iconv_open, (const char *, const char *)); size_t _EXFUN(iconv, (iconv_t, char **__restrict, size_t *__restrict, @@ -49,10 +49,10 @@ _EXFUN(iconv_close, (iconv_t)); #endif iconv_t -_EXFUN(_iconv_open_r, (struct _reent *, _CONST char *, _CONST char *)); +_EXFUN(_iconv_open_r, (struct _reent *, const char *, const char *)); size_t -_EXFUN(_iconv_r, (struct _reent *, iconv_t, _CONST char **, +_EXFUN(_iconv_r, (struct _reent *, iconv_t, const char **, size_t *, char **, size_t *)); int diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h index fb2fa93d8..493eafd7e 100644 --- a/newlib/libc/include/pthread.h +++ b/newlib/libc/include/pthread.h @@ -47,7 +47,7 @@ int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void), int _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr)); int _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr)); int _EXFUN(pthread_mutexattr_getpshared, - (_CONST pthread_mutexattr_t *__attr, int *__pshared)); + (const pthread_mutexattr_t *__attr, int *__pshared)); int _EXFUN(pthread_mutexattr_setpshared, (pthread_mutexattr_t *__attr, int __pshared)); @@ -56,7 +56,7 @@ int _EXFUN(pthread_mutexattr_setpshared, /* Single UNIX Specification 2 Mutex Attributes types */ int _EXFUN(pthread_mutexattr_gettype, - (_CONST pthread_mutexattr_t *__attr, int *__kind)); + (const pthread_mutexattr_t *__attr, int *__kind)); int _EXFUN(pthread_mutexattr_settype, (pthread_mutexattr_t *__attr, int __kind)); @@ -65,7 +65,7 @@ int _EXFUN(pthread_mutexattr_settype, /* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */ int _EXFUN(pthread_mutex_init, - (pthread_mutex_t *__mutex, _CONST pthread_mutexattr_t *__attr)); + (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr)); int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex)); /* This is used to statically initialize a pthread_mutex_t. Example: @@ -85,7 +85,7 @@ int _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex)); #if defined(_POSIX_TIMEOUTS) int _EXFUN(pthread_mutex_timedlock, - (pthread_mutex_t *__mutex, _CONST struct timespec *__timeout)); + (pthread_mutex_t *__mutex, const struct timespec *__timeout)); #endif /* _POSIX_TIMEOUTS */ @@ -101,14 +101,14 @@ int _EXFUN(pthread_condattr_setclock, (pthread_condattr_t *__attr, clockid_t __clock_id)); int _EXFUN(pthread_condattr_getpshared, - (_CONST pthread_condattr_t *__attr, int *__pshared)); + (const pthread_condattr_t *__attr, int *__pshared)); int _EXFUN(pthread_condattr_setpshared, (pthread_condattr_t *__attr, int __pshared)); /* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */ int _EXFUN(pthread_cond_init, - (pthread_cond_t *__cond, _CONST pthread_condattr_t *__attr)); + (pthread_cond_t *__cond, const pthread_condattr_t *__attr)); int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex)); /* This is used to statically initialize a pthread_cond_t. Example: @@ -130,7 +130,7 @@ int _EXFUN(pthread_cond_wait, int _EXFUN(pthread_cond_timedwait, (pthread_cond_t *__cond, pthread_mutex_t *__mutex, - _CONST struct timespec *__abstime)); + const struct timespec *__abstime)); #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) @@ -139,22 +139,22 @@ int _EXFUN(pthread_cond_timedwait, int _EXFUN(pthread_attr_setscope, (pthread_attr_t *__attr, int __contentionscope)); int _EXFUN(pthread_attr_getscope, - (_CONST pthread_attr_t *__attr, int *__contentionscope)); + (const pthread_attr_t *__attr, int *__contentionscope)); int _EXFUN(pthread_attr_setinheritsched, (pthread_attr_t *__attr, int __inheritsched)); int _EXFUN(pthread_attr_getinheritsched, - (_CONST pthread_attr_t *__attr, int *__inheritsched)); + (const pthread_attr_t *__attr, int *__inheritsched)); int _EXFUN(pthread_attr_setschedpolicy, (pthread_attr_t *__attr, int __policy)); int _EXFUN(pthread_attr_getschedpolicy, - (_CONST pthread_attr_t *__attr, int *__policy)); + (const pthread_attr_t *__attr, int *__policy)); #endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ int _EXFUN(pthread_attr_setschedparam, - (pthread_attr_t *__attr, _CONST struct sched_param *__param)); + (pthread_attr_t *__attr, const struct sched_param *__param)); int _EXFUN(pthread_attr_getschedparam, - (_CONST pthread_attr_t *__attr, struct sched_param *__param)); + (const pthread_attr_t *__attr, struct sched_param *__param)); #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) @@ -183,11 +183,11 @@ int pthread_setname_np(pthread_t, const char *) __nonnull((2)); int _EXFUN(pthread_mutexattr_setprotocol, (pthread_mutexattr_t *__attr, int __protocol)); int _EXFUN(pthread_mutexattr_getprotocol, - (_CONST pthread_mutexattr_t *__attr, int *__protocol)); + (const pthread_mutexattr_t *__attr, int *__protocol)); int _EXFUN(pthread_mutexattr_setprioceiling, (pthread_mutexattr_t *__attr, int __prioceiling)); int _EXFUN(pthread_mutexattr_getprioceiling, - (_CONST pthread_mutexattr_t *__attr, int *__prioceiling)); + (const pthread_mutexattr_t *__attr, int *__prioceiling)); #endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */ @@ -208,22 +208,22 @@ int _EXFUN(pthread_attr_init, (pthread_attr_t *__attr)); int _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr)); int _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr, void *__stackaddr, size_t __stacksize)); -int _EXFUN(pthread_attr_getstack, (_CONST pthread_attr_t *attr, +int _EXFUN(pthread_attr_getstack, (const pthread_attr_t *attr, void **__stackaddr, size_t *__stacksize)); int _EXFUN(pthread_attr_getstacksize, - (_CONST pthread_attr_t *__attr, size_t *__stacksize)); + (const pthread_attr_t *__attr, size_t *__stacksize)); int _EXFUN(pthread_attr_setstacksize, (pthread_attr_t *__attr, size_t __stacksize)); int _EXFUN(pthread_attr_getstackaddr, - (_CONST pthread_attr_t *__attr, void **__stackaddr)); + (const pthread_attr_t *__attr, void **__stackaddr)); int _EXFUN(pthread_attr_setstackaddr, (pthread_attr_t *__attr, void *__stackaddr)); int _EXFUN(pthread_attr_getdetachstate, - (_CONST pthread_attr_t *__attr, int *__detachstate)); + (const pthread_attr_t *__attr, int *__detachstate)); int _EXFUN(pthread_attr_setdetachstate, (pthread_attr_t *__attr, int __detachstate)); int _EXFUN(pthread_attr_getguardsize, - (_CONST pthread_attr_t *__attr, size_t *__guardsize)); + (const pthread_attr_t *__attr, size_t *__guardsize)); int _EXFUN(pthread_attr_setguardsize, (pthread_attr_t *__attr, size_t __guardsize)); @@ -253,7 +253,7 @@ int _EXFUN(pthread_getattr_np, /* Thread Creation, P1003.1c/Draft 10, p. 144 */ int _EXFUN(pthread_create, - (pthread_t *__pthread, _CONST pthread_attr_t *__attr, + (pthread_t *__pthread, const pthread_attr_t *__attr, void *(*__start_routine)( void * ), void *__arg)); /* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */ @@ -309,7 +309,7 @@ int _EXFUN(pthread_key_create, /* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */ int _EXFUN(pthread_setspecific, - (pthread_key_t __key, _CONST void *__value)); + (pthread_key_t __key, const void *__value)); void * _EXFUN(pthread_getspecific, (pthread_key_t __key)); /* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */ @@ -391,7 +391,7 @@ int _EXFUN(pthread_getcpuclockid, int _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr)); int _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr)); int _EXFUN(pthread_barrierattr_getpshared, - (_CONST pthread_barrierattr_t *__attr, int *__pshared)); + (const pthread_barrierattr_t *__attr, int *__pshared)); int _EXFUN(pthread_barrierattr_setpshared, (pthread_barrierattr_t *__attr, int __pshared)); @@ -399,7 +399,7 @@ int _EXFUN(pthread_barrierattr_setpshared, int _EXFUN(pthread_barrier_init, (pthread_barrier_t *__barrier, - _CONST pthread_barrierattr_t *__attr, unsigned __count)); + const pthread_barrierattr_t *__attr, unsigned __count)); int _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier)); int _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier)); @@ -428,22 +428,22 @@ int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock)); int _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr)); int _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr)); int _EXFUN(pthread_rwlockattr_getpshared, - (_CONST pthread_rwlockattr_t *__attr, int *__pshared)); + (const pthread_rwlockattr_t *__attr, int *__pshared)); int _EXFUN(pthread_rwlockattr_setpshared, (pthread_rwlockattr_t *__attr, int __pshared)); int _EXFUN(pthread_rwlock_init, - (pthread_rwlock_t *__rwlock, _CONST pthread_rwlockattr_t *__attr)); + (pthread_rwlock_t *__rwlock, const pthread_rwlockattr_t *__attr)); int _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock)); int _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock)); int _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock)); int _EXFUN(pthread_rwlock_timedrdlock, - (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime)); + (pthread_rwlock_t *__rwlock, const struct timespec *__abstime)); int _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock)); int _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock)); int _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock)); int _EXFUN(pthread_rwlock_timedwrlock, - (pthread_rwlock_t *__rwlock, _CONST struct timespec *__abstime)); + (pthread_rwlock_t *__rwlock, const struct timespec *__abstime)); #endif /* defined(_POSIX_READER_WRITER_LOCKS) */ diff --git a/newlib/libc/include/rpc/xdr.h b/newlib/libc/include/rpc/xdr.h index 4f93bf38e..40ddc1cdd 100644 --- a/newlib/libc/include/rpc/xdr.h +++ b/newlib/libc/include/rpc/xdr.h @@ -108,19 +108,19 @@ enum xdr_op typedef struct __rpc_xdr { enum xdr_op x_op; /* operation; fast additional param */ - _CONST struct xdr_ops + const struct xdr_ops { /* get a long from underlying stream */ bool_t _EXFNPTR (x_getlong, (struct __rpc_xdr *, long *)); /* put a long to " */ - bool_t _EXFNPTR (x_putlong, (struct __rpc_xdr *, _CONST long *)); + bool_t _EXFNPTR (x_putlong, (struct __rpc_xdr *, const long *)); /* get some bytes from " */ bool_t _EXFNPTR (x_getbytes, (struct __rpc_xdr *, char *, u_int)); /* put some bytes to " */ - bool_t _EXFNPTR (x_putbytes, (struct __rpc_xdr *, _CONST char *, u_int)); + bool_t _EXFNPTR (x_putbytes, (struct __rpc_xdr *, const char *, u_int)); /* returns bytes off from beginning */ u_int _EXFNPTR (x_getpostn, (struct __rpc_xdr *)); @@ -138,7 +138,7 @@ typedef struct __rpc_xdr bool_t _EXFNPTR (x_getint32, (struct __rpc_xdr *, int32_t *)); /* put an int32 to the underlying stream */ - bool_t _EXFNPTR (x_putint32, (struct __rpc_xdr *, _CONST int32_t *)); + bool_t _EXFNPTR (x_putint32, (struct __rpc_xdr *, const int32_t *)); } *x_ops; char *x_public; /* users' data */ @@ -320,7 +320,7 @@ extern bool_t _EXFUN (xdr_bytes, (XDR *, char **, u_int *, u_int)); extern bool_t _EXFUN (xdr_opaque, (XDR *, char *, u_int)); extern bool_t _EXFUN (xdr_string, (XDR *, char **, u_int)); extern bool_t _EXFUN (xdr_union, (XDR *, enum_t *, char *, - _CONST struct xdr_discrim *, xdrproc_t)); + const struct xdr_discrim *, xdrproc_t)); extern bool_t _EXFUN (xdr_char, (XDR *, char *)); extern bool_t _EXFUN (xdr_u_char, (XDR *, u_char *)); extern bool_t _EXFUN (xdr_vector, (XDR *, char *, u_int, u_int, xdrproc_t)); diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index b648e6201..9152bf096 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -552,7 +552,7 @@ int _EXFUN(fputs_unlocked, (const char *__restrict, FILE *__restrict)); #if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB) FILE * _EXFUN(fdopen64, (int, const char *)); FILE * _EXFUN(fopen64, (const char *, const char *)); -FILE * _EXFUN(freopen64, (_CONST char *, _CONST char *, FILE *)); +FILE * _EXFUN(freopen64, (const char *, const char *, FILE *)); _off64_t _EXFUN(ftello64, (FILE *)); _off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int)); int _EXFUN(fgetpos64, (FILE *, _fpos64_t *)); @@ -561,7 +561,7 @@ FILE * _EXFUN(tmpfile64, (void)); FILE * _EXFUN(_fdopen64_r, (struct _reent *, int, const char *)); FILE * _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *)); -FILE * _EXFUN(_freopen64_r, (struct _reent *, _CONST char *, _CONST char *, FILE *)); +FILE * _EXFUN(_freopen64_r, (struct _reent *, const char *, const char *, FILE *)); _off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *)); _off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int)); int _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *)); diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index c3c591d20..ac433db21 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -93,8 +93,8 @@ _VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((__noreturn__))); _VOID _EXFUN_NOTHROW(free,(_PTR)); char * _EXFUN(getenv,(const char *__string)); char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); -char * _EXFUN(_findenv,(_CONST char *, int *)); -char * _EXFUN(_findenv_r,(struct _reent *, _CONST char *, int *)); +char * _EXFUN(_findenv,(const char *, int *)); +char * _EXFUN(_findenv_r,(struct _reent *, const char *, int *)); #if __POSIX_VISIBLE >= 200809 extern char *suboptarg; /* getsubopt(3) external variable */ int _EXFUN(getsubopt,(char **, char * const *, char **)); diff --git a/newlib/libc/include/sys/errno.h b/newlib/libc/include/sys/errno.h index a72c37320..89fe1e052 100644 --- a/newlib/libc/include/sys/errno.h +++ b/newlib/libc/include/sys/errno.h @@ -17,7 +17,7 @@ extern int *__errno _PARAMS ((void)); /* Please don't use these variables directly. Use strerror instead. */ -extern __IMPORT _CONST char * _CONST _sys_errlist[]; +extern __IMPORT const char * const _sys_errlist[]; extern __IMPORT int _sys_nerr; #ifdef __CYGWIN__ extern __IMPORT const char * const sys_errlist[]; diff --git a/newlib/libc/include/sys/iconvnls.h b/newlib/libc/include/sys/iconvnls.h index 09ea18316..7475ed21b 100644 --- a/newlib/libc/include/sys/iconvnls.h +++ b/newlib/libc/include/sys/iconvnls.h @@ -58,20 +58,20 @@ _EXFUN(_iconv_nls_get_mb_cur_max, (iconv_t cd, int direction)); size_t _EXFUN(_iconv_nls_conv, (struct _reent *rptr, iconv_t cd, - _CONST char **inbuf, size_t *inbytesleft, + const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)); -_CONST char * -_EXFUN(_iconv_nls_construct_filename, (struct _reent *rptr, _CONST char *file, - _CONST char *dir, _CONST char *ext)); +const char * +_EXFUN(_iconv_nls_construct_filename, (struct _reent *rptr, const char *file, + const char *dir, const char *ext)); int -_EXFUN(_iconv_nls_open, (struct _reent *rptr, _CONST char *encoding, +_EXFUN(_iconv_nls_open, (struct _reent *rptr, const char *encoding, iconv_t *towc, iconv_t *fromwc, int flag)); char * -_EXFUN(_iconv_resolve_encoding_name, (struct _reent *rptr, _CONST char *ca)); +_EXFUN(_iconv_resolve_encoding_name, (struct _reent *rptr, const char *ca)); #endif /* __SYS_ICONVNLS_H__ */ diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index c045ca549..061f580fb 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -773,7 +773,7 @@ extern __FILE __sf[3]; #endif extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; -extern struct _reent *_CONST _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__; +extern struct _reent *const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__; void _reclaim_reent _PARAMS ((struct _reent *)); diff --git a/newlib/libc/include/unctrl.h b/newlib/libc/include/unctrl.h index 004075232..010812ff3 100644 --- a/newlib/libc/include/unctrl.h +++ b/newlib/libc/include/unctrl.h @@ -40,7 +40,7 @@ #define unctrl(c) __unctrl[(c) & 0xff] #define unctrllen(ch) __unctrllen[(ch) & 0xff] -extern __IMPORT _CONST char * _CONST __unctrl[256]; /* Control strings. */ -extern __IMPORT _CONST char __unctrllen[256]; /* Control strings length. */ +extern __IMPORT const char * const __unctrl[256]; /* Control strings. */ +extern __IMPORT const char __unctrllen[256]; /* Control strings length. */ #endif /* _UNCTRL_H_ */ diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 87cb04b35..f461ef162 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -292,7 +292,7 @@ char * _DEFUN(_setlocale_r, (p, category, locale), struct _reent *p, int category, - _CONST char *locale) + const char *locale) { #ifndef _MB_CAPABLE if (locale) @@ -992,7 +992,7 @@ __locale_ctype_ptr (void) char * _DEFUN (setlocale, (category, locale), int category, - _CONST char *locale) + const char *locale) { return _setlocale_r (_REENT, category, locale); } diff --git a/newlib/libc/machine/cris/sys/errno.h b/newlib/libc/machine/cris/sys/errno.h index 310388943..dc4ffe28c 100644 --- a/newlib/libc/machine/cris/sys/errno.h +++ b/newlib/libc/machine/cris/sys/errno.h @@ -21,7 +21,7 @@ extern int *__errno _PARAMS ((void)); /* Please don't use these variables directly. Use strerror instead. */ -extern _CONST char * _CONST _sys_errlist[]; +extern const char * const _sys_errlist[]; extern int _sys_nerr; #define __errno_r(ptr) ((ptr)->_errno) diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c index a2751af85..82987eade 100644 --- a/newlib/libc/machine/microblaze/strcmp.c +++ b/newlib/libc/machine/microblaze/strcmp.c @@ -82,8 +82,8 @@ QUICKREF int _DEFUN (strcmp, (s1, s2), - _CONST char *s1, - _CONST char *s2) + const char *s1, + const char *s2) { #ifndef HAVE_HW_PCMP diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c index e0e1d7760..8e2dae634 100644 --- a/newlib/libc/machine/microblaze/strcpy.c +++ b/newlib/libc/machine/microblaze/strcpy.c @@ -83,7 +83,7 @@ QUICKREF char* _DEFUN (strcpy, (dst0, src0), char *__restrict dst0, - _CONST char *__restrict src0) + const char *__restrict src0) { #ifndef HAVE_HW_PCMP @@ -97,9 +97,9 @@ _DEFUN (strcpy, (dst0, src0), return s; #else char *dst = dst0; - _CONST char *src = src0; + const char *src = src0; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If SRC or DEST is unaligned, then copy bytes. */ if (!UNALIGNED (src, dst)) diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c index ddd9e6a82..059f4463d 100644 --- a/newlib/libc/machine/microblaze/strlen.c +++ b/newlib/libc/machine/microblaze/strlen.c @@ -79,20 +79,20 @@ QUICKREF size_t _DEFUN (strlen, (str), - _CONST char *str) + const char *str) { #ifndef HAVE_HW_PCMP #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - _CONST char *start = str; + const char *start = str; while (*str) str++; return str - start; #else - _CONST char *start = str; + const char *start = str; unsigned long *aligned_addr; if (!UNALIGNED (str)) diff --git a/newlib/libc/machine/powerpc/atosfix16.c b/newlib/libc/machine/powerpc/atosfix16.c index 5115c85e2..dd5e2dfd4 100644 --- a/newlib/libc/machine/powerpc/atosfix16.c +++ b/newlib/libc/machine/powerpc/atosfix16.c @@ -64,7 +64,7 @@ PORTABILITY __int16_t _DEFUN (_atosfix16_r, (reent, s), struct _reent *reent, - _CONST char *s) + const char *s) { return _strtosfix16_r (reent, s, NULL); } @@ -72,7 +72,7 @@ _DEFUN (_atosfix16_r, (reent, s), #ifndef _REENT_ONLY __int16_t _DEFUN (atosfix16, (s), - _CONST char *s) + const char *s) { return strtosfix16 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atosfix32.c b/newlib/libc/machine/powerpc/atosfix32.c index 49f4cce20..fed308b65 100644 --- a/newlib/libc/machine/powerpc/atosfix32.c +++ b/newlib/libc/machine/powerpc/atosfix32.c @@ -10,7 +10,7 @@ __int32_t _DEFUN (_atosfix32_r, (reent, s), struct _reent *reent, - _CONST char *s) + const char *s) { return _strtosfix32_r (reent, s, NULL); } @@ -18,7 +18,7 @@ _DEFUN (_atosfix32_r, (reent, s), #ifndef _REENT_ONLY __int32_t _DEFUN (atosfix32, (s), - _CONST char *s) + const char *s) { return strtosfix32 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atosfix64.c b/newlib/libc/machine/powerpc/atosfix64.c index b433778e7..cfc421a3a 100644 --- a/newlib/libc/machine/powerpc/atosfix64.c +++ b/newlib/libc/machine/powerpc/atosfix64.c @@ -10,7 +10,7 @@ __int64_t _DEFUN (_atosfix64_r, (reent, s), struct _reent *reent, - _CONST char *s) + const char *s) { return _strtosfix64_r (reent, s, NULL); } @@ -18,7 +18,7 @@ _DEFUN (_atosfix64_r, (reent, s), #ifndef _REENT_ONLY __int64_t _DEFUN (atosfix64, (s), - _CONST char *s) + const char *s) { return strtosfix64 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atoufix16.c b/newlib/libc/machine/powerpc/atoufix16.c index 5148acb7d..84a60b252 100644 --- a/newlib/libc/machine/powerpc/atoufix16.c +++ b/newlib/libc/machine/powerpc/atoufix16.c @@ -64,7 +64,7 @@ PORTABILITY __uint16_t _DEFUN (_atoufix16_r, (reent, s), struct _reent *reent, - _CONST char *s) + const char *s) { return _strtoufix16_r (reent, s, NULL); } @@ -72,7 +72,7 @@ _DEFUN (_atoufix16_r, (reent, s), #ifndef _REENT_ONLY __uint16_t _DEFUN (atoufix16, (s), - _CONST char *s) + const char *s) { return strtoufix16 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atoufix32.c b/newlib/libc/machine/powerpc/atoufix32.c index 01919d406..fc64c75e4 100644 --- a/newlib/libc/machine/powerpc/atoufix32.c +++ b/newlib/libc/machine/powerpc/atoufix32.c @@ -10,7 +10,7 @@ __uint32_t _DEFUN (_atoufix32_r, (reent, s), struct _reent *reent, - _CONST char *s) + const char *s) { return _strtoufix32_r (reent, s, NULL); } @@ -18,7 +18,7 @@ _DEFUN (_atoufix32_r, (reent, s), #ifndef _REENT_ONLY __uint32_t _DEFUN (atoufix32, (s), - _CONST char *s) + const char *s) { return strtoufix32 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atoufix64.c b/newlib/libc/machine/powerpc/atoufix64.c index af71089a6..e8ff7773d 100644 --- a/newlib/libc/machine/powerpc/atoufix64.c +++ b/newlib/libc/machine/powerpc/atoufix64.c @@ -10,7 +10,7 @@ __uint64_t _DEFUN (_atoufix64_r, (reent, s), struct _reent *reent, - _CONST char *s) + const char *s) { return _strtoufix64_r (reent, s, NULL); } @@ -18,7 +18,7 @@ _DEFUN (_atoufix64_r, (reent, s), #ifndef _REENT_ONLY __uint64_t _DEFUN (atoufix64, (s), - _CONST char *s) + const char *s) { return strtoufix64 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c index 84e1171b9..4e998db03 100644 --- a/newlib/libc/machine/powerpc/strtosfix16.c +++ b/newlib/libc/machine/powerpc/strtosfix16.c @@ -94,7 +94,7 @@ PORTABILITY __int16_t _DEFUN (_strtosfix16_r, (rptr, nptr, endptr), struct _reent *rptr, - _CONST char *nptr, + const char *nptr, char **endptr) { union double_union dbl; @@ -170,7 +170,7 @@ _DEFUN (_strtosfix16_r, (rptr, nptr, endptr), __int16_t _DEFUN (strtosfix16, (s, ptr, base), - _CONST char *s, + const char *s, char **ptr) { return _strtosfix16_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtosfix32.c b/newlib/libc/machine/powerpc/strtosfix32.c index 1b1487b1a..e8966808e 100644 --- a/newlib/libc/machine/powerpc/strtosfix32.c +++ b/newlib/libc/machine/powerpc/strtosfix32.c @@ -15,7 +15,7 @@ __int32_t _DEFUN (_strtosfix32_r, (rptr, nptr, endptr), struct _reent *rptr, - _CONST char *nptr, + const char *nptr, char **endptr) { union double_union dbl; @@ -93,7 +93,7 @@ _DEFUN (_strtosfix32_r, (rptr, nptr, endptr), __int32_t _DEFUN (strtosfix32, (s, ptr, base), - _CONST char *s, + const char *s, char **ptr) { return _strtosfix32_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtosfix64.c b/newlib/libc/machine/powerpc/strtosfix64.c index 4ba718c03..f7344fc22 100644 --- a/newlib/libc/machine/powerpc/strtosfix64.c +++ b/newlib/libc/machine/powerpc/strtosfix64.c @@ -15,7 +15,7 @@ __int64_t _DEFUN (_strtosfix64_r, (rptr, nptr, endptr), struct _reent *rptr, - _CONST char *nptr, + const char *nptr, char **endptr) { union long_double_union ldbl; @@ -106,7 +106,7 @@ _DEFUN (_strtosfix64_r, (rptr, nptr, endptr), __int64_t _DEFUN (strtosfix64, (s, ptr, base), - _CONST char *s, + const char *s, char **ptr) { return _strtosfix64_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c index 22de506e3..0757930d4 100644 --- a/newlib/libc/machine/powerpc/strtoufix16.c +++ b/newlib/libc/machine/powerpc/strtoufix16.c @@ -93,7 +93,7 @@ PORTABILITY __uint16_t _DEFUN (_strtoufix16_r, (rptr, nptr, endptr), struct _reent *rptr, - _CONST char *nptr, + const char *nptr, char **endptr) { union double_union dbl; @@ -161,7 +161,7 @@ _DEFUN (_strtoufix16_r, (rptr, nptr, endptr), __uint16_t _DEFUN (strtoufix16, (s, ptr, base), - _CONST char *s, + const char *s, char **ptr) { return _strtoufix16_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix32.c b/newlib/libc/machine/powerpc/strtoufix32.c index 05e96675f..60f278daa 100644 --- a/newlib/libc/machine/powerpc/strtoufix32.c +++ b/newlib/libc/machine/powerpc/strtoufix32.c @@ -15,7 +15,7 @@ __uint32_t _DEFUN (_strtoufix32_r, (rptr, nptr, endptr), struct _reent *rptr, - _CONST char *nptr, + const char *nptr, char **endptr) { union double_union dbl; @@ -90,7 +90,7 @@ _DEFUN (_strtoufix32_r, (rptr, nptr, endptr), __uint32_t _DEFUN (strtoufix32, (s, ptr, base), - _CONST char *s, + const char *s, char **ptr) { return _strtoufix32_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix64.c b/newlib/libc/machine/powerpc/strtoufix64.c index 5ef53846f..509f51318 100644 --- a/newlib/libc/machine/powerpc/strtoufix64.c +++ b/newlib/libc/machine/powerpc/strtoufix64.c @@ -15,7 +15,7 @@ __uint64_t _DEFUN (_strtoufix64_r, (rptr, nptr, endptr), struct _reent *rptr, - _CONST char *nptr, + const char *nptr, char **endptr) { union long_double_union ldbl; @@ -105,7 +105,7 @@ _DEFUN (_strtoufix64_r, (rptr, nptr, endptr), __uint64_t _DEFUN (strtoufix64, (s, ptr, base), - _CONST char *s, + const char *s, char **ptr) { return _strtoufix64_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c index 0c1c80e1a..e926a7340 100644 --- a/newlib/libc/machine/powerpc/vfprintf.c +++ b/newlib/libc/machine/powerpc/vfprintf.c @@ -273,7 +273,7 @@ static char *cvt_ufix64 _PARAMS((struct _reent *, unsigned long long, int, int int _DEFUN (VFPRINTF, (fp, fmt0, ap), FILE * fp, - _CONST char *fmt0, + const char *fmt0, va_list ap) { CHECK_INIT (_REENT, fp); @@ -284,7 +284,7 @@ int _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap), struct _reent *data, FILE * fp, - _CONST char *fmt0, + const char *fmt0, va_list ap) { register char *fmt; /* format string */ @@ -350,9 +350,9 @@ _DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap), * below longer. */ #define PADSIZE 16 /* pad chunk size */ - static _CONST char blanks[PADSIZE] = + static const char blanks[PADSIZE] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; - static _CONST char zeroes[PADSIZE] = + static const char zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; /* diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index b82a14088..df5344e20 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -184,7 +184,7 @@ typedef union int _DEFUN (vfscanf, (fp, fmt, ap), register FILE *__restrict fp, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { CHECK_INIT(_REENT, fp); @@ -194,7 +194,7 @@ _DEFUN (vfscanf, (fp, fmt, ap), int __svfscanf (fp, fmt0, ap) register FILE *fp; - char _CONST *fmt0; + char const *fmt0; va_list ap; { return __svfscanf_r (_REENT, fp, fmt0, ap); @@ -206,7 +206,7 @@ int _DEFUN (_vfscanf_r, (data, fp, fmt, ap), struct _reent *data, register FILE *__restrict fp, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { return __svfscanf_r (data, fp, fmt, ap); @@ -217,7 +217,7 @@ int __svfscanf_r (rptr, fp, fmt0, ap) struct _reent *rptr; register FILE *fp; - char _CONST *fmt0; + char const *fmt0; va_list ap; { register u_char *fmt = (u_char *) fmt0; @@ -262,7 +262,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) #endif /* `basefix' is used to avoid `if' tests in the integer scanner */ - static _CONST short basefix[17] = + static const short basefix[17] = {10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; nassigned = 0; diff --git a/newlib/libc/machine/spu/fdopen.c b/newlib/libc/machine/spu/fdopen.c index b09ffad16..edec03cff 100644 --- a/newlib/libc/machine/spu/fdopen.c +++ b/newlib/libc/machine/spu/fdopen.c @@ -36,7 +36,7 @@ POSSIBILITY OF SUCH DAMAGE. FILE * _DEFUN (fdopen, (fd, mode), int fd, - _CONST char *mode) + const char *mode) { errno = ENOSYS; return NULL; diff --git a/newlib/libc/machine/spu/fopen.c b/newlib/libc/machine/spu/fopen.c index c41d33510..ffa8f6904 100644 --- a/newlib/libc/machine/spu/fopen.c +++ b/newlib/libc/machine/spu/fopen.c @@ -37,17 +37,17 @@ Author: Joel Schopp typedef struct { - _CONST char* file; + const char* file; unsigned int pad0[ 3 ]; - _CONST char* mode; + const char* mode; unsigned int pad1[ 3 ]; } c99_fopen_t; #ifndef _REENT_ONLY FILE * _DEFUN (fopen, (file, mode), - _CONST char *__restrict file, - _CONST char *__restrict mode) + const char *__restrict file, + const char *__restrict mode) { int ret; c99_fopen_t args; diff --git a/newlib/libc/machine/spu/fputs.c b/newlib/libc/machine/spu/fputs.c index 8cf84bb6e..82b72e060 100644 --- a/newlib/libc/machine/spu/fputs.c +++ b/newlib/libc/machine/spu/fputs.c @@ -37,7 +37,7 @@ Author: Joel Schopp typedef struct { - _CONST char* s; + const char* s; unsigned int pad0[ 3 ]; int fp; unsigned int pad1[ 3 ]; @@ -47,7 +47,7 @@ typedef struct int _DEFUN (fputs, (s, fp), - char _CONST *__restrict s, + char const *__restrict s, FILE *__restrict fp) { c99_fputs_t args; diff --git a/newlib/libc/machine/spu/freopen.c b/newlib/libc/machine/spu/freopen.c index 7c52abef3..0e3f15f83 100644 --- a/newlib/libc/machine/spu/freopen.c +++ b/newlib/libc/machine/spu/freopen.c @@ -37,9 +37,9 @@ Author: Joel Schopp typedef struct { - _CONST char *file; + const char *file; unsigned int pad0[ 3 ]; - _CONST char *mode; + const char *mode; unsigned int pad1[ 3 ]; int fp; } c99_freopen_t; diff --git a/newlib/libc/machine/spu/fsetpos.c b/newlib/libc/machine/spu/fsetpos.c index 1ebbb8f63..a92cca5a3 100644 --- a/newlib/libc/machine/spu/fsetpos.c +++ b/newlib/libc/machine/spu/fsetpos.c @@ -39,7 +39,7 @@ typedef struct { int fp; unsigned int pad0[ 3 ]; - _CONST _fpos_t *pos; + const _fpos_t *pos; } c99_fsetpos_t; #ifndef _REENT_ONLY @@ -47,7 +47,7 @@ typedef struct int _DEFUN (fsetpos, (iop, pos), FILE * iop, - _CONST _fpos_t * pos) + const _fpos_t * pos) { c99_fsetpos_t args; diff --git a/newlib/libc/machine/spu/fwrite.c b/newlib/libc/machine/spu/fwrite.c index 6de571069..149eb1345 100644 --- a/newlib/libc/machine/spu/fwrite.c +++ b/newlib/libc/machine/spu/fwrite.c @@ -39,7 +39,7 @@ Author: Joel Schopp typedef struct { - _CONST char* buf; + const char* buf; unsigned int pad0[ 3 ]; size_t size; unsigned int pad1[ 3 ]; @@ -50,7 +50,7 @@ typedef struct size_t _DEFUN (fwrite, (buf, size, count, fp), - _CONST _PTR __restrict buf, + const _PTR __restrict buf, size_t size, size_t count, FILE * fp) diff --git a/newlib/libc/machine/spu/impure.c b/newlib/libc/machine/spu/impure.c index 5fbe0e5f5..f9c86efdc 100644 --- a/newlib/libc/machine/spu/impure.c +++ b/newlib/libc/machine/spu/impure.c @@ -11,4 +11,4 @@ struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT(_impure_data); struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &_impure_data; -struct _reent *_CONST __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &_impure_data; +struct _reent *const __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &_impure_data; diff --git a/newlib/libc/machine/spu/perror.c b/newlib/libc/machine/spu/perror.c index 028f44a37..612467318 100644 --- a/newlib/libc/machine/spu/perror.c +++ b/newlib/libc/machine/spu/perror.c @@ -7,7 +7,7 @@ typedef struct { - _CONST char* str; + const char* str; unsigned int pad0[ 3 ]; int arg_errno; unsigned int pad1[ 3 ]; @@ -15,7 +15,7 @@ typedef struct void _DEFUN (perror, (s), - _CONST char *s) + const char *s) { c99_perror_t arg; diff --git a/newlib/libc/machine/spu/puts.c b/newlib/libc/machine/spu/puts.c index 06f4b87b6..427508969 100644 --- a/newlib/libc/machine/spu/puts.c +++ b/newlib/libc/machine/spu/puts.c @@ -6,7 +6,7 @@ int _DEFUN (puts, (s), - char _CONST * s) + char const * s) { CHECK_STD_INIT(_REENT); diff --git a/newlib/libc/machine/spu/remove.c b/newlib/libc/machine/spu/remove.c index 930a98036..1a379dedc 100644 --- a/newlib/libc/machine/spu/remove.c +++ b/newlib/libc/machine/spu/remove.c @@ -36,7 +36,7 @@ Author: Joel Schopp int remove (filename) - _CONST char *filename; + const char *filename; { /* The return value gets written over buf diff --git a/newlib/libc/machine/spu/rename.c b/newlib/libc/machine/spu/rename.c index bf58fbdc4..e60355de7 100644 --- a/newlib/libc/machine/spu/rename.c +++ b/newlib/libc/machine/spu/rename.c @@ -37,16 +37,16 @@ Author: Joel Schopp typedef struct { - _CONST char *old; + const char *old; unsigned int pad0[ 3 ]; - _CONST char *new; + const char *new; unsigned int pad1[ 3 ]; } c99_rename_t; int rename (old, new) - _CONST char *old; - _CONST char *new; + const char *old; + const char *new; { c99_rename_t args; args.old = old; diff --git a/newlib/libc/machine/spu/sys/errno.h b/newlib/libc/machine/spu/sys/errno.h index 85aafcfd5..ef087bd68 100644 --- a/newlib/libc/machine/spu/sys/errno.h +++ b/newlib/libc/machine/spu/sys/errno.h @@ -32,7 +32,7 @@ extern struct _reent _impure_data; /* Please don't use these variables directly. Use strerror instead. */ -extern _CONST char * _CONST _sys_errlist[]; +extern const char * const _sys_errlist[]; extern int _sys_nerr; #define __errno_r(ptr) ((ptr)->_errno) diff --git a/newlib/libc/machine/spu/vfprintf.c b/newlib/libc/machine/spu/vfprintf.c index e5ef2fa9f..90dcaef56 100644 --- a/newlib/libc/machine/spu/vfprintf.c +++ b/newlib/libc/machine/spu/vfprintf.c @@ -59,7 +59,7 @@ typedef struct int _DEFUN (vfprintf, (fp, fmt0, ap), FILE *__restrict fp, - _CONST char *__restrict fmt0, + const char *__restrict fmt0, va_list ap) { c99_vfprintf_t args; diff --git a/newlib/libc/machine/spu/vfscanf.c b/newlib/libc/machine/spu/vfscanf.c index a497b7ba3..c22f76db7 100644 --- a/newlib/libc/machine/spu/vfscanf.c +++ b/newlib/libc/machine/spu/vfscanf.c @@ -59,7 +59,7 @@ typedef struct int _DEFUN (vfscanf, (fp, fmt, ap), FILE *__restrict fp, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { c99_vfscanf_t args; diff --git a/newlib/libc/machine/spu/vprintf.c b/newlib/libc/machine/spu/vprintf.c index 35b12dfb5..e99144623 100644 --- a/newlib/libc/machine/spu/vprintf.c +++ b/newlib/libc/machine/spu/vprintf.c @@ -15,7 +15,7 @@ typedef struct { - _CONST char* fmt; + const char* fmt; unsigned int pad0[ 3 ]; va_list ap; } c99_vprintf_t; @@ -24,7 +24,7 @@ typedef struct int _DEFUN (vprintf, (fmt, ap), - _CONST char *fmt, + const char *fmt, va_list ap) { c99_vprintf_t args; diff --git a/newlib/libc/machine/spu/vscanf.c b/newlib/libc/machine/spu/vscanf.c index 29b4948dd..aae6bc45b 100644 --- a/newlib/libc/machine/spu/vscanf.c +++ b/newlib/libc/machine/spu/vscanf.c @@ -56,7 +56,7 @@ typedef struct int _DEFUN (vscanf, (fmt, ap), - _CONST char *fmt, + const char *fmt, va_list ap) { c99_vscanf_t args; diff --git a/newlib/libc/machine/spu/vsnprintf.c b/newlib/libc/machine/spu/vsnprintf.c index f952b84c1..b30770d68 100644 --- a/newlib/libc/machine/spu/vsnprintf.c +++ b/newlib/libc/machine/spu/vsnprintf.c @@ -19,7 +19,7 @@ typedef struct unsigned int pad0[ 3 ]; size_t size; unsigned int pad1[ 3 ]; - _CONST char* fmt; + const char* fmt; unsigned int pad2[ 3 ]; va_list ap; } c99_vsnprintf_t; @@ -30,7 +30,7 @@ int _DEFUN (vsnprintf, (str, size, fmt, ap), char *__restrict str, size_t size, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { c99_vsnprintf_t args; diff --git a/newlib/libc/machine/spu/vsprintf.c b/newlib/libc/machine/spu/vsprintf.c index 1a44de479..12461c08e 100644 --- a/newlib/libc/machine/spu/vsprintf.c +++ b/newlib/libc/machine/spu/vsprintf.c @@ -28,7 +28,7 @@ typedef struct int _DEFUN (vsprintf, (str, fmt, ap), char *__restrict str, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { c99_vsprintf_t args; diff --git a/newlib/libc/machine/spu/vsscanf.c b/newlib/libc/machine/spu/vsscanf.c index 38ee1f4b9..7725e6822 100644 --- a/newlib/libc/machine/spu/vsscanf.c +++ b/newlib/libc/machine/spu/vsscanf.c @@ -47,9 +47,9 @@ Author: Joel Schopp typedef struct { - _CONST char *str; + const char *str; unsigned int pad0[ 3 ]; - _CONST char *fmt; + const char *fmt; unsigned int pad1[ 3 ]; va_list ap; } c99_vsscanf_t; @@ -58,8 +58,8 @@ typedef struct int _DEFUN (vsscanf, (str, fmt, ap), - _CONST char *__restrict str, - _CONST char *__restrict fmt, + const char *__restrict str, + const char *__restrict fmt, va_list ap) { c99_vsscanf_t args; diff --git a/newlib/libc/machine/xscale/strlen.c b/newlib/libc/machine/xscale/strlen.c index a8bc0851d..70c9a3b44 100644 --- a/newlib/libc/machine/xscale/strlen.c +++ b/newlib/libc/machine/xscale/strlen.c @@ -10,7 +10,7 @@ size_t strlen (const char *str) { - _CONST char *start = str; + const char *start = str; /* Skip unaligned part. */ if ((long)str & 3) diff --git a/newlib/libc/misc/__dprintf.c b/newlib/libc/misc/__dprintf.c index 6026d195c..5fa30e0ab 100644 --- a/newlib/libc/misc/__dprintf.c +++ b/newlib/libc/misc/__dprintf.c @@ -23,7 +23,7 @@ static char *parse_number (); static long _EXFUN(get_number, (char *, long, int)); static void _EXFUN(print_number, (int, int, long)); static void _EXFUN(write_char, (char c)); -static void _EXFUN(write_string, (_CONST char *s)); +static void _EXFUN(write_string, (const char *s)); /* Non-zero for big-endian systems. */ static int big_endian_p; @@ -266,7 +266,7 @@ _DEFUN(write_char, (c), static void _DEFUN(write_string, (s), - _CONST char *s) + const char *s) { _write_r (_REENT, CONSOLE_FD, s, strlen (s)); } diff --git a/newlib/libc/misc/unctrl.c b/newlib/libc/misc/unctrl.c index e2cdb3861..8bca2a2a5 100644 --- a/newlib/libc/misc/unctrl.c +++ b/newlib/libc/misc/unctrl.c @@ -69,7 +69,7 @@ No supporting OS subroutines are required. static char sccsid[] = "@(#)unctrl.c 8.1 (Berkeley) 6/4/93"; #endif /* LIBC_SCCS and not lint */ -_CONST char * _CONST __unctrl[256] = { +const char * const __unctrl[256] = { "^@", "^A", "^B", "^C", "^D", "^E", "^F", "^G", "^H", "^I", "^J", "^K", "^L", "^M", "^N", "^O", "^P", "^Q", "^R", "^S", "^T", "^U", "^V", "^W", @@ -105,7 +105,7 @@ _CONST char * _CONST __unctrl[256] = { "0xf8", "0xf9", "0xfa", "0xfb", "0xfc", "0xfd", "0xfe", "0xff", }; -_CONST char __unctrllen[256] = { +const char __unctrllen[256] = { 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, diff --git a/newlib/libc/posix/execl.c b/newlib/libc/posix/execl.c index beb48c6ae..fbad9f3f8 100644 --- a/newlib/libc/posix/execl.c +++ b/newlib/libc/posix/execl.c @@ -19,8 +19,8 @@ static char ***p_environ = &environ; int _DEFUN(execl, (path, arg0, ...), - _CONST char *path, - _CONST char *arg0 _DOTS) + const char *path, + const char *arg0 _DOTS) #else @@ -28,8 +28,8 @@ _DEFUN(execl, (path, arg0, ...), int _DEFUN(execl, (path, arg0, va_alist), - _CONST char *path, - _CONST char *arg0, + const char *path, + const char *arg0, va_dcl) #endif @@ -37,16 +37,16 @@ _DEFUN(execl, (path, arg0, va_alist), { int i; va_list args; - _CONST char *argv[256]; + const char *argv[256]; va_start (args, arg0); argv[0] = arg0; i = 1; do - argv[i] = va_arg (args, _CONST char *); + argv[i] = va_arg (args, const char *); while (argv[i++] != NULL); va_end (args); - return _execve (path, (char * _CONST *) argv, *p_environ); + return _execve (path, (char * const *) argv, *p_environ); } #endif /* !_NO_EXECVE */ diff --git a/newlib/libc/posix/execle.c b/newlib/libc/posix/execle.c index f4c759250..c18555c02 100644 --- a/newlib/libc/posix/execle.c +++ b/newlib/libc/posix/execle.c @@ -14,8 +14,8 @@ int _DEFUN(execle, (path, arg0, ...), - _CONST char *path, - _CONST char *arg0 _DOTS) + const char *path, + const char *arg0 _DOTS) #else @@ -23,8 +23,8 @@ _DEFUN(execle, (path, arg0, ...), int _DEFUN(execle, (path, arg0, va_alist), - _CONST char *path, - _CONST char *arg0, + const char *path, + const char *arg0, va_dcl) #endif @@ -32,19 +32,19 @@ _DEFUN(execle, (path, arg0, va_alist), { int i; va_list args; - _CONST char * _CONST *envp; - _CONST char *argv[256]; + const char * const *envp; + const char *argv[256]; va_start (args, arg0); argv[0] = arg0; i = 1; do - argv[i] = va_arg (args, _CONST char *); + argv[i] = va_arg (args, const char *); while (argv[i++] != NULL); - envp = va_arg (args, _CONST char * _CONST *); + envp = va_arg (args, const char * const *); va_end (args); - return _execve (path, (char * _CONST *) argv, (char * _CONST *) envp); + return _execve (path, (char * const *) argv, (char * const *) envp); } #endif /* !_NO_EXECVE */ diff --git a/newlib/libc/posix/execlp.c b/newlib/libc/posix/execlp.c index 6731bb905..6b9c2f7e9 100644 --- a/newlib/libc/posix/execlp.c +++ b/newlib/libc/posix/execlp.c @@ -14,8 +14,8 @@ int _DEFUN(execlp, (path, arg0, ...), - _CONST char *path, - _CONST char *arg0 _DOTS) + const char *path, + const char *arg0 _DOTS) #else @@ -23,8 +23,8 @@ _DEFUN(execlp, (path, arg0, ...), int _DEFUN(execlp, (path, arg0, va_alist), - _CONST char *path, - _CONST char *arg0, + const char *path, + const char *arg0, va_dcl) #endif @@ -32,17 +32,17 @@ _DEFUN(execlp, (path, arg0, va_alist), { int i; va_list args; - _CONST char *argv[256]; + const char *argv[256]; va_start (args, arg0); argv[0] = arg0; i = 1; do - argv[i] = va_arg (args, _CONST char *); + argv[i] = va_arg (args, const char *); while (argv[i++] != NULL); va_end (args); - return execvp (path, (char * _CONST *) argv); + return execvp (path, (char * const *) argv); } #endif /* !_NO_EXECVE */ diff --git a/newlib/libc/posix/execv.c b/newlib/libc/posix/execv.c index 049a5381d..96220dd98 100644 --- a/newlib/libc/posix/execv.c +++ b/newlib/libc/posix/execv.c @@ -18,7 +18,7 @@ _DEFUN (execv, (path, argv), const char *path, char * const argv[]) { - return _execve (path, (char * _CONST *) argv, *p_environ); + return _execve (path, (char * const *) argv, *p_environ); } #endif /* !_NO_EXECVE */ diff --git a/newlib/libc/posix/execvp.c b/newlib/libc/posix/execvp.c index db7e03456..1c1fd3a01 100644 --- a/newlib/libc/posix/execvp.c +++ b/newlib/libc/posix/execvp.c @@ -37,8 +37,8 @@ _DEFUN (strccpy, (s1, s2, c), int _DEFUN (execvp, (file, argv), - _CONST char *file, - char * _CONST argv[]) + const char *file, + char * const argv[]) { char *path = getenv ("PATH"); char buf[MAXNAMLEN]; diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c index 8e54de7fa..cade6b005 100644 --- a/newlib/libc/posix/posix_spawn.c +++ b/newlib/libc/posix/posix_spawn.c @@ -147,7 +147,7 @@ typedef struct __posix_spawn_file_actions_entry { */ static int -process_spawnattr(_CONST posix_spawnattr_t sa) +process_spawnattr(const posix_spawnattr_t sa) { struct sigaction sigact = { .sa_flags = 0, .sa_handler = SIG_DFL }; int i; @@ -240,7 +240,7 @@ process_file_actions_entry(posix_spawn_file_actions_entry_t *fae) } static int -process_file_actions(_CONST posix_spawn_file_actions_t fa) +process_file_actions(const posix_spawn_file_actions_t fa) { posix_spawn_file_actions_entry_t *fae; int error; @@ -255,10 +255,10 @@ process_file_actions(_CONST posix_spawn_file_actions_t fa) } static int -do_posix_spawn(pid_t *pid, _CONST char *path, - _CONST posix_spawn_file_actions_t *fa, - _CONST posix_spawnattr_t *sa, - char * _CONST argv[], char * _CONST envp[], int use_env_path) +do_posix_spawn(pid_t *pid, const char *path, + const posix_spawn_file_actions_t *fa, + const posix_spawnattr_t *sa, + char * const argv[], char * const envp[], int use_env_path) { pid_t p; volatile int error = 0; @@ -296,11 +296,11 @@ do_posix_spawn(pid_t *pid, _CONST char *path, int _DEFUN(posix_spawn, (pid, path, fa, sa, argv, envp), pid_t *pid, - _CONST char *path, - _CONST posix_spawn_file_actions_t *fa, - _CONST posix_spawnattr_t *sa, - char * _CONST argv[], - char * _CONST envp[]) + const char *path, + const posix_spawn_file_actions_t *fa, + const posix_spawnattr_t *sa, + char * const argv[], + char * const envp[]) { return do_posix_spawn(pid, path, fa, sa, argv, envp, 0); } @@ -308,11 +308,11 @@ _DEFUN(posix_spawn, (pid, path, fa, sa, argv, envp), int _DEFUN(posix_spawnp, (pid, path, fa, sa, argv, envp), pid_t *pid, - _CONST char *path, - _CONST posix_spawn_file_actions_t *fa, - _CONST posix_spawnattr_t *sa, - char * _CONST argv[], - char * _CONST envp[]) + const char *path, + const posix_spawn_file_actions_t *fa, + const posix_spawnattr_t *sa, + char * const argv[], + char * const envp[]) { return do_posix_spawn(pid, path, fa, sa, argv, envp, 1); } @@ -360,7 +360,7 @@ int _DEFUN(posix_spawn_file_actions_addopen, (fa, fildes, path, oflag, mode), posix_spawn_file_actions_t * __restrict fa, int fildes, - _CONST char * __restrict path, + const char * __restrict path, int oflag, mode_t mode) { @@ -468,7 +468,7 @@ _DEFUN(posix_spawnattr_destroy, (sa), int _DEFUN(posix_spawnattr_getflags, (sa, flags), - _CONST posix_spawnattr_t * __restrict sa, + const posix_spawnattr_t * __restrict sa, short * __restrict flags) { *flags = (*sa)->sa_flags; @@ -477,7 +477,7 @@ _DEFUN(posix_spawnattr_getflags, (sa, flags), int _DEFUN(posix_spawnattr_getpgroup, (sa, pgroup), - _CONST posix_spawnattr_t * __restrict sa, + const posix_spawnattr_t * __restrict sa, pid_t * __restrict pgroup) { *pgroup = (*sa)->sa_pgroup; @@ -486,7 +486,7 @@ _DEFUN(posix_spawnattr_getpgroup, (sa, pgroup), int _DEFUN(posix_spawnattr_getschedparam, (sa, schedparam), - _CONST posix_spawnattr_t * __restrict sa, + const posix_spawnattr_t * __restrict sa, struct sched_param * __restrict schedparam) { *schedparam = (*sa)->sa_schedparam; @@ -495,7 +495,7 @@ _DEFUN(posix_spawnattr_getschedparam, (sa, schedparam), int _DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy), - _CONST posix_spawnattr_t * __restrict sa, + const posix_spawnattr_t * __restrict sa, int * __restrict schedpolicy) { *schedpolicy = (*sa)->sa_schedpolicy; @@ -504,7 +504,7 @@ _DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy), int _DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault), - _CONST posix_spawnattr_t * __restrict sa, + const posix_spawnattr_t * __restrict sa, sigset_t * __restrict sigdefault) { *sigdefault = (*sa)->sa_sigdefault; @@ -513,7 +513,7 @@ _DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault), int _DEFUN(posix_spawnattr_getsigmask, (sa, sigmask), - _CONST posix_spawnattr_t * __restrict sa, + const posix_spawnattr_t * __restrict sa, sigset_t * __restrict sigmask) { *sigmask = (*sa)->sa_sigmask; @@ -541,7 +541,7 @@ _DEFUN(posix_spawnattr_setpgroup, (sa, pgroup), int _DEFUN(posix_spawnattr_setschedparam, (sa, schedparam), posix_spawnattr_t * __restrict sa, - _CONST struct sched_param * __restrict schedparam) + const struct sched_param * __restrict schedparam) { (*sa)->sa_schedparam = *schedparam; return (0); @@ -559,7 +559,7 @@ _DEFUN(posix_spawnattr_setschedpolicy, (sa, schedpolicy), int _DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault), posix_spawnattr_t * __restrict sa, - _CONST sigset_t * __restrict sigdefault) + const sigset_t * __restrict sigdefault) { (*sa)->sa_sigdefault = *sigdefault; return (0); @@ -568,7 +568,7 @@ _DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault), int _DEFUN(posix_spawnattr_setsigmask, (sa, sigmask), posix_spawnattr_t * __restrict sa, - _CONST sigset_t * __restrict sigmask) + const sigset_t * __restrict sigmask) { (*sa)->sa_sigmask = *sigmask; return (0); diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c index cb78fba76..0dc531384 100644 --- a/newlib/libc/reent/execr.c +++ b/newlib/libc/reent/execr.c @@ -47,9 +47,9 @@ DESCRIPTION int _DEFUN (_execve_r, (ptr, name, argv, env), struct _reent *ptr, - _CONST char *name, - char *_CONST argv[], - char *_CONST env[]) + const char *name, + char *const argv[], + char *const env[]) { int ret; diff --git a/newlib/libc/reent/impure.c b/newlib/libc/reent/impure.c index f5918c88f..76f67459e 100644 --- a/newlib/libc/reent/impure.c +++ b/newlib/libc/reent/impure.c @@ -25,4 +25,4 @@ static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data = _REENT_INIT (impure extern struct _reent reent_data __attribute__ ((alias("impure_data"))); #endif struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &impure_data; -struct _reent *_CONST __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &impure_data; +struct _reent *const __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &impure_data; diff --git a/newlib/libc/reent/linkr.c b/newlib/libc/reent/linkr.c index 59113d26e..5e85f2d2e 100644 --- a/newlib/libc/reent/linkr.c +++ b/newlib/libc/reent/linkr.c @@ -45,8 +45,8 @@ DESCRIPTION int _DEFUN (_link_r, (ptr, old, new), struct _reent *ptr, - _CONST char *old, - _CONST char *new) + const char *old, + const char *new) { int ret; diff --git a/newlib/libc/reent/mkdirr.c b/newlib/libc/reent/mkdirr.c index 4c2c94f9c..dca20dc2c 100644 --- a/newlib/libc/reent/mkdirr.c +++ b/newlib/libc/reent/mkdirr.c @@ -42,7 +42,7 @@ DESCRIPTION int _DEFUN (_mkdir_r, (ptr, path, mode), struct _reent *ptr, - _CONST char *path, + const char *path, int mode) { int ret; diff --git a/newlib/libc/reent/open64r.c b/newlib/libc/reent/open64r.c index 6b39fa1fd..84bd67e34 100644 --- a/newlib/libc/reent/open64r.c +++ b/newlib/libc/reent/open64r.c @@ -44,7 +44,7 @@ DESCRIPTION int _open64_r (ptr, file, flags, mode) struct _reent *ptr; - _CONST char *file; + const char *file; int flags; int mode; { diff --git a/newlib/libc/reent/openr.c b/newlib/libc/reent/openr.c index f38ff8458..33ace75ad 100644 --- a/newlib/libc/reent/openr.c +++ b/newlib/libc/reent/openr.c @@ -41,7 +41,7 @@ DESCRIPTION int _DEFUN (_open_r, (ptr, file, flags, mode), struct _reent *ptr, - _CONST char *file, + const char *file, int flags, int mode) { diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c index e55c2f291..736c1a30f 100644 --- a/newlib/libc/reent/renamer.c +++ b/newlib/libc/reent/renamer.c @@ -42,8 +42,8 @@ DESCRIPTION int _DEFUN (_rename_r, (ptr, old, new), struct _reent *ptr, - _CONST char *old, - _CONST char *new) + const char *old, + const char *new) { int ret = 0; diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c index 134ca82ef..2077c0a2e 100644 --- a/newlib/libc/reent/stat64r.c +++ b/newlib/libc/reent/stat64r.c @@ -47,7 +47,7 @@ DESCRIPTION int _DEFUN (_stat64_r, (ptr, file, pstat), struct _reent *ptr, - _CONST char *file, + const char *file, struct stat64 *pstat) { int ret; diff --git a/newlib/libc/reent/statr.c b/newlib/libc/reent/statr.c index 2b271e10f..fb27ab0c0 100644 --- a/newlib/libc/reent/statr.c +++ b/newlib/libc/reent/statr.c @@ -47,7 +47,7 @@ DESCRIPTION int _DEFUN (_stat_r, (ptr, file, pstat), struct _reent *ptr, - _CONST char *file, + const char *file, struct stat *pstat) { int ret; diff --git a/newlib/libc/reent/unlinkr.c b/newlib/libc/reent/unlinkr.c index eb000be15..0ef0ff56e 100644 --- a/newlib/libc/reent/unlinkr.c +++ b/newlib/libc/reent/unlinkr.c @@ -40,7 +40,7 @@ DESCRIPTION int _DEFUN (_unlink_r, (ptr, file), struct _reent *ptr, - _CONST char *file) + const char *file) { int ret; diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index 4e06d74ef..4c4f95f77 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -41,7 +41,7 @@ _ssize_t _DEFUN (_write_r, (ptr, fd, buf, cnt), struct _reent *ptr, int fd, - _CONST _PTR buf, + const _PTR buf, size_t cnt) { _ssize_t ret; diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index c15ea64d2..86380a816 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -57,8 +57,8 @@ No supporting OS subroutines are required. _PTR _DEFUN (bsearch, (key, base, nmemb, size, compar), - _CONST _PTR key, - _CONST _PTR base, + const _PTR key, + const _PTR base, size_t nmemb, size_t size, int _EXFNPTR(compar, (const _PTR, const _PTR))) diff --git a/newlib/libc/signal/psignal.c b/newlib/libc/signal/psignal.c index f0c9b6ee6..6263c3f70 100644 --- a/newlib/libc/signal/psignal.c +++ b/newlib/libc/signal/psignal.c @@ -36,7 +36,7 @@ Supporting OS subroutines required: <>, <>, <>, _VOID _DEFUN(psignal, (sig, s), int sig, - _CONST char *s) + const char *s) { if (s != NULL && *s != '\0') fprintf (stderr, "%s: %s\n", s, strsignal (sig)); diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c index 7dda3c359..82b7a9bc2 100644 --- a/newlib/libc/stdio/fdopen.c +++ b/newlib/libc/stdio/fdopen.c @@ -56,7 +56,7 @@ FILE * _DEFUN(_fdopen_r, (ptr, fd, mode), struct _reent *ptr, int fd, - _CONST char *mode) + const char *mode) { register FILE *fp; int flags, oflags; @@ -125,7 +125,7 @@ _DEFUN(_fdopen_r, (ptr, fd, mode), FILE * _DEFUN(fdopen, (fd, mode), int fd, - _CONST char *mode) + const char *mode) { return _fdopen_r (_REENT, fd, mode); } diff --git a/newlib/libc/stdio/fiscanf.c b/newlib/libc/stdio/fiscanf.c index 53fee8454..7b497bddb 100644 --- a/newlib/libc/stdio/fiscanf.c +++ b/newlib/libc/stdio/fiscanf.c @@ -29,7 +29,7 @@ int #ifdef _HAVE_STDC -fiscanf(FILE *fp, _CONST char *fmt, ...) +fiscanf(FILE *fp, const char *fmt, ...) #else fiscanf(FILE *fp, fmt, va_alist) FILE *fp; @@ -54,7 +54,7 @@ fiscanf(FILE *fp, fmt, va_alist) int #ifdef _HAVE_STDC -_fiscanf_r(struct _reent *ptr, FILE *fp, _CONST char *fmt, ...) +_fiscanf_r(struct _reent *ptr, FILE *fp, const char *fmt, ...) #else _fiscanf_r(ptr, FILE *fp, fmt, va_alist) struct _reent *ptr; diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c index 92ec70670..e6b044557 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -115,8 +115,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; FILE * _DEFUN(_fopen_r, (ptr, file, mode), struct _reent *ptr, - _CONST char *__restrict file, - _CONST char *__restrict mode) + const char *__restrict file, + const char *__restrict mode) { register FILE *fp; register int f; @@ -164,8 +164,8 @@ _DEFUN(_fopen_r, (ptr, file, mode), FILE * _DEFUN(fopen, (file, mode), - _CONST char *file, - _CONST char *mode) + const char *file, + const char *mode) { return _fopen_r (_REENT, file, mode); } diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c index 7adb89a04..0fd051bad 100644 --- a/newlib/libc/stdio/fputs.c +++ b/newlib/libc/stdio/fputs.c @@ -88,7 +88,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(_fputs_r, (ptr, s, fp), struct _reent * ptr, - char _CONST *__restrict s, + char const *__restrict s, FILE *__restrict fp) { #ifdef _FVWRITE_IN_STREAMIO @@ -109,7 +109,7 @@ _DEFUN(_fputs_r, (ptr, s, fp), _newlib_flockfile_end (fp); return result; #else - _CONST char *p = s; + const char *p = s; CHECK_INIT(ptr, fp); @@ -136,7 +136,7 @@ error: #ifndef _REENT_ONLY int _DEFUN(fputs, (s, fp), - char _CONST *__restrict s, + char const *__restrict s, FILE *__restrict fp) { return _fputs_r (_REENT, s, fp); diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c index b9fee0c7b..7e70b9a98 100644 --- a/newlib/libc/stdio/freopen.c +++ b/newlib/libc/stdio/freopen.c @@ -244,8 +244,8 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp), FILE * _DEFUN(freopen, (file, mode, fp), - _CONST char *__restrict file, - _CONST char *__restrict mode, + const char *__restrict file, + const char *__restrict mode, register FILE *__restrict fp) { return _freopen_r (_REENT, file, mode, fp); diff --git a/newlib/libc/stdio/fscanf.c b/newlib/libc/stdio/fscanf.c index 87b51dd88..40705a5e7 100644 --- a/newlib/libc/stdio/fscanf.c +++ b/newlib/libc/stdio/fscanf.c @@ -29,7 +29,7 @@ int #ifdef _HAVE_STDC -fscanf(FILE *__restrict fp, _CONST char *__restrict fmt, ...) +fscanf(FILE *__restrict fp, const char *__restrict fmt, ...) #else fscanf(FILE *fp, fmt, va_alist) FILE *fp; @@ -60,7 +60,7 @@ _EXFUN(fiscanf, (FILE *, const char *, ...) int #ifdef _HAVE_STDC -_fscanf_r(struct _reent *ptr, FILE *__restrict fp, _CONST char *__restrict fmt, ...) +_fscanf_r(struct _reent *ptr, FILE *__restrict fp, const char *__restrict fmt, ...) #else _fscanf_r(ptr, FILE *fp, fmt, va_alist) struct _reent *ptr; diff --git a/newlib/libc/stdio/fsetpos.c b/newlib/libc/stdio/fsetpos.c index ffc9d794c..d765081a6 100644 --- a/newlib/libc/stdio/fsetpos.c +++ b/newlib/libc/stdio/fsetpos.c @@ -62,7 +62,7 @@ int _DEFUN(_fsetpos_r, (ptr, iop, pos), struct _reent * ptr, FILE * iop, - _CONST _fpos_t * pos) + const _fpos_t * pos) { int x = _fseek_r (ptr, iop, *pos, SEEK_SET); @@ -76,7 +76,7 @@ _DEFUN(_fsetpos_r, (ptr, iop, pos), int _DEFUN(fsetpos, (iop, pos), FILE * iop, - _CONST _fpos_t * pos) + const _fpos_t * pos) { return _fsetpos_r (_REENT, iop, pos); } diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index a0432a03d..c93888dc4 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -51,7 +51,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), register struct __suio *uio) { register size_t len; - register _CONST char *p = NULL; + register const char *p = NULL; register struct __siov *iov; register _READ_WRITE_RETURN_TYPE w, s; char *nl; diff --git a/newlib/libc/stdio/fvwrite.h b/newlib/libc/stdio/fvwrite.h index 5c078fe68..8b01a2a9d 100644 --- a/newlib/libc/stdio/fvwrite.h +++ b/newlib/libc/stdio/fvwrite.h @@ -22,7 +22,7 @@ * I/O descriptors for __sfvwrite_r(). */ struct __siov { - _CONST _PTR iov_base; + const _PTR iov_base; size_t iov_len; }; struct __suio { diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c index a805eff7f..cfaa2499a 100644 --- a/newlib/libc/stdio/fwrite.c +++ b/newlib/libc/stdio/fwrite.c @@ -110,7 +110,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; size_t _DEFUN(_fwrite_r, (ptr, buf, size, count, fp), struct _reent * ptr, - _CONST _PTR __restrict buf, + const _PTR __restrict buf, size_t size, size_t count, FILE * __restrict fp) @@ -144,7 +144,7 @@ _DEFUN(_fwrite_r, (ptr, buf, size, count, fp), return (n - uio.uio_resid) / size; #else size_t i = 0; - _CONST char *p = buf; + const char *p = buf; n = count * size; CHECK_INIT (ptr, fp); @@ -171,7 +171,7 @@ ret: #ifndef _REENT_ONLY size_t _DEFUN(fwrite, (buf, size, count, fp), - _CONST _PTR __restrict buf, + const _PTR __restrict buf, size_t size, size_t count, FILE * fp) diff --git a/newlib/libc/stdio/fwscanf.c b/newlib/libc/stdio/fwscanf.c index 8572f4185..1b86a3472 100644 --- a/newlib/libc/stdio/fwscanf.c +++ b/newlib/libc/stdio/fwscanf.c @@ -26,7 +26,7 @@ #ifndef _REENT_ONLY int -fwscanf (FILE *__restrict fp, _CONST wchar_t *__restrict fmt, ...) +fwscanf (FILE *__restrict fp, const wchar_t *__restrict fmt, ...) { int ret; va_list ap; @@ -40,7 +40,7 @@ fwscanf (FILE *__restrict fp, _CONST wchar_t *__restrict fmt, ...) #endif /* !_REENT_ONLY */ int -_fwscanf_r (struct _reent *ptr, FILE *fp, _CONST wchar_t *fmt, ...) +_fwscanf_r (struct _reent *ptr, FILE *fp, const wchar_t *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/iscanf.c b/newlib/libc/stdio/iscanf.c index f35acd2ed..aefd1a4ac 100644 --- a/newlib/libc/stdio/iscanf.c +++ b/newlib/libc/stdio/iscanf.c @@ -29,7 +29,7 @@ int #ifdef _HAVE_STDC -iscanf(_CONST char *fmt, ...) +iscanf(const char *fmt, ...) #else iscanf(fmt, va_alist) char *fmt; @@ -54,7 +54,7 @@ iscanf(fmt, va_alist) int #ifdef _HAVE_STDC -_iscanf_r(struct _reent *ptr, _CONST char *fmt, ...) +_iscanf_r(struct _reent *ptr, const char *fmt, ...) #else _iscanf_r(ptr, fmt, va_alist) struct _reent *ptr; diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 511e5e35f..b5fd1198a 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -143,14 +143,14 @@ extern wint_t _EXFUN(__fgetwc, (struct _reent *, FILE *)); extern wint_t _EXFUN(__fputwc, (struct _reent *, wchar_t, FILE *)); extern u_char *_EXFUN(__sccl, (char *, u_char *fmt)); -extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); -extern int _EXFUN(__ssvfscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); -extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); -extern int _EXFUN(__ssvfiscanf_r,(struct _reent *,FILE *, _CONST char *,va_list)); -extern int _EXFUN(__svfwscanf_r,(struct _reent *,FILE *, _CONST wchar_t *,va_list)); -extern int _EXFUN(__ssvfwscanf_r,(struct _reent *,FILE *, _CONST wchar_t *,va_list)); -extern int _EXFUN(__svfiwscanf_r,(struct _reent *,FILE *, _CONST wchar_t *,va_list)); -extern int _EXFUN(__ssvfiwscanf_r,(struct _reent *,FILE *, _CONST wchar_t *,va_list)); +extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, const char *,va_list)); +extern int _EXFUN(__ssvfscanf_r,(struct _reent *,FILE *, const char *,va_list)); +extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, const char *,va_list)); +extern int _EXFUN(__ssvfiscanf_r,(struct _reent *,FILE *, const char *,va_list)); +extern int _EXFUN(__svfwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); +extern int _EXFUN(__ssvfwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); +extern int _EXFUN(__svfiwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); +extern int _EXFUN(__ssvfiwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); int _EXFUN(_svfprintf_r,(struct _reent *, FILE *, const char *, va_list) _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); @@ -162,7 +162,7 @@ int _EXFUN(_svfwprintf_r,(struct _reent *, FILE *, const wchar_t *, int _EXFUN(_svfiwprintf_r,(struct _reent *, FILE *, const wchar_t *, va_list)); extern FILE *_EXFUN(__sfp,(struct _reent *)); -extern int _EXFUN(__sflags,(struct _reent *,_CONST char*, int*)); +extern int _EXFUN(__sflags,(struct _reent *,const char*, int*)); extern int _EXFUN(__sflush_r,(struct _reent *,FILE *)); #ifdef _STDIO_BSD_SEMANTICS extern int _EXFUN(__sflushw_r,(struct _reent *,FILE *)); @@ -347,6 +347,6 @@ typedef enum __packed { PWPOS, /* get positional parameter value for variable width or precision */ } __ACTION; -extern _CONST __CH_CLASS __chclass[256]; -extern _CONST __STATE __state_table[MAX_STATE][MAX_CH_CLASS]; -extern _CONST __ACTION __action_table[MAX_STATE][MAX_CH_CLASS]; +extern const __CH_CLASS __chclass[256]; +extern const __STATE __state_table[MAX_STATE][MAX_CH_CLASS]; +extern const __ACTION __action_table[MAX_STATE][MAX_CH_CLASS]; diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index f01e6a40b..df20783c6 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -185,7 +185,7 @@ int _DEFUN(__ssputs_r, (ptr, fp, buf, len), struct _reent *ptr, FILE *fp, - _CONST char *buf, + const char *buf, size_t len) { register int w; @@ -261,7 +261,7 @@ _DEFUN(__ssprint_r, (ptr, fp, uio), register size_t len; register int w; register struct __siov *iov; - register _CONST char *p = NULL; + register const char *p = NULL; iov = uio->uio_iov; len = 0; @@ -417,7 +417,7 @@ int _DEFUN(__sfputs_r, (ptr, fp, buf, len), struct _reent *ptr, FILE *fp, - _CONST char *buf, + const char *buf, size_t len) { register int i; @@ -448,13 +448,13 @@ _DEFUN(__sfputs_r, (ptr, fp, buf, len), } #endif /* STRING_ONLY. */ -int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list)); +int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, const char *, va_list)); #ifndef STRING_ONLY int _DEFUN(VFPRINTF, (fp, fmt0, ap), FILE * fp, - _CONST char *fmt0, + const char *fmt0, va_list ap) { int result; @@ -484,7 +484,7 @@ int _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), struct _reent *data, FILE * fp, - _CONST char *fmt0, + const char *fmt0, va_list ap) { register char *fmt; /* Format string. */ @@ -494,7 +494,7 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), struct _prt_data_t prt_data; /* All data for decoding format string. */ /* Output function pointer. */ - int (*pfunc)(struct _reent *, FILE *, _CONST char *, size_t len); + int (*pfunc)(struct _reent *, FILE *, const char *, size_t len); pfunc = __SPRINT; diff --git a/newlib/libc/stdio/nano-vfprintf_float.c b/newlib/libc/stdio/nano-vfprintf_float.c index aca24aec0..98893e97b 100644 --- a/newlib/libc/stdio/nano-vfprintf_float.c +++ b/newlib/libc/stdio/nano-vfprintf_float.c @@ -164,7 +164,7 @@ int _printf_float (struct _reent *data, struct _prt_data_t *pdata, FILE * fp, - int (*pfunc) (struct _reent *, FILE *, _CONST char *, + int (*pfunc) (struct _reent *, FILE *, const char *, size_t len), va_list * ap) { #define _fpvalue (pdata->_double_) diff --git a/newlib/libc/stdio/nano-vfprintf_i.c b/newlib/libc/stdio/nano-vfprintf_i.c index 46945b34a..f7da95251 100644 --- a/newlib/libc/stdio/nano-vfprintf_i.c +++ b/newlib/libc/stdio/nano-vfprintf_i.c @@ -51,7 +51,7 @@ _printf_common (struct _reent *data, int *realsz, FILE *fp, int (*pfunc)(struct _reent *, FILE *, - _CONST char *, size_t len)) + const char *, size_t len)) { int n; /* @@ -106,7 +106,7 @@ error: } int _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp, - int (*pfunc)(struct _reent *, FILE *, _CONST char *, size_t len), + int (*pfunc)(struct _reent *, FILE *, const char *, size_t len), va_list *ap) { /* Field size expanded by dprec. */ diff --git a/newlib/libc/stdio/nano-vfprintf_local.h b/newlib/libc/stdio/nano-vfprintf_local.h index 83b479e56..51e1df815 100644 --- a/newlib/libc/stdio/nano-vfprintf_local.h +++ b/newlib/libc/stdio/nano-vfprintf_local.h @@ -215,11 +215,11 @@ _printf_common (struct _reent *data, int *realsz, FILE *fp, int (*pfunc)(struct _reent *, FILE *, - _CONST char *, size_t len)); + const char *, size_t len)); extern int _printf_i (struct _reent *data, struct _prt_data_t *pdata, FILE *fp, - int (*pfunc)(struct _reent *, FILE *, _CONST char *, size_t len), + int (*pfunc)(struct _reent *, FILE *, const char *, size_t len), va_list *ap); /* Make _printf_float weak symbol, so it won't be linked in if target program @@ -229,6 +229,6 @@ _printf_float (struct _reent *data, struct _prt_data_t *pdata, FILE *fp, int (*pfunc)(struct _reent *, FILE *, - _CONST char *, size_t len), + const char *, size_t len), va_list *ap) _ATTRIBUTE((__weak__)); #endif diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index 99c13f25e..f530480b6 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -146,7 +146,7 @@ Supporting OS subroutines required: int _DEFUN(VFSCANF, (fp, fmt, ap), register FILE *fp, - _CONST char *fmt, + const char *fmt, va_list ap) { CHECK_INIT(_REENT, fp); @@ -160,7 +160,7 @@ _EXFUN(vfiscanf, (FILE *, const char *, __VALIST) int _DEFUN(__SVFSCANF, (fp, fmt0, ap), register FILE *fp, - char _CONST *fmt0, + char const *fmt0, va_list ap) { return __SVFSCANF_R (_REENT, fp, fmt0, ap); @@ -172,7 +172,7 @@ int _DEFUN(_VFSCANF_R, (data, fp, fmt, ap), struct _reent *data, register FILE *fp, - _CONST char *fmt, + const char *fmt, va_list ap) { CHECK_INIT(data, fp); @@ -271,7 +271,7 @@ int _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), struct _reent *rptr, register FILE *fp, - char _CONST *fmt0, + char const *fmt0, va_list ap) { register u_char *fmt = (u_char *) fmt0; diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c index cd1829180..cda8a1112 100644 --- a/newlib/libc/stdio/perror.c +++ b/newlib/libc/stdio/perror.c @@ -61,7 +61,7 @@ Supporting OS subroutines required: <>, <>, <>, _VOID _DEFUN(_perror_r, (ptr, s), struct _reent *ptr, - _CONST char *s) + const char *s) { char *error; int dummy; @@ -83,7 +83,7 @@ _DEFUN(_perror_r, (ptr, s), _VOID _DEFUN(perror, (s), - _CONST char *s) + const char *s) { _perror_r (_REENT, s); } diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c index 36cc83203..89a9485bb 100644 --- a/newlib/libc/stdio/puts.c +++ b/newlib/libc/stdio/puts.c @@ -67,7 +67,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; int _DEFUN(_puts_r, (ptr, s), struct _reent *ptr, - _CONST char * s) + const char * s) { #ifdef _FVWRITE_IN_STREAMIO int result; @@ -126,7 +126,7 @@ err: int _DEFUN(puts, (s), - char _CONST * s) + char const * s) { return _puts_r (_REENT, s); } diff --git a/newlib/libc/stdio/putw.c b/newlib/libc/stdio/putw.c index 1e3c78c3e..5377d87d3 100644 --- a/newlib/libc/stdio/putw.c +++ b/newlib/libc/stdio/putw.c @@ -53,7 +53,7 @@ _DEFUN(putw, (w, fp), int w, register FILE *fp) { - if (fwrite ((_CONST char*)&w, sizeof (w), 1, fp) != 1) + if (fwrite ((const char*)&w, sizeof (w), 1, fp) != 1) return EOF; return 0; } diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c index 18c468d61..810b282ac 100644 --- a/newlib/libc/stdio/remove.c +++ b/newlib/libc/stdio/remove.c @@ -61,7 +61,7 @@ Supporting OS subroutine required: <>. int _DEFUN(_remove_r, (ptr, filename), struct _reent *ptr, - _CONST char *filename) + const char *filename) { if (_unlink_r (ptr, filename) == -1) return -1; @@ -73,7 +73,7 @@ _DEFUN(_remove_r, (ptr, filename), int _DEFUN(remove, (filename), - _CONST char *filename) + const char *filename) { return _remove_r (_REENT, filename); } diff --git a/newlib/libc/stdio/rename.c b/newlib/libc/stdio/rename.c index a2b0d4188..a32770846 100644 --- a/newlib/libc/stdio/rename.c +++ b/newlib/libc/stdio/rename.c @@ -55,8 +55,8 @@ Supporting OS subroutines required: <>, <>, or <>. int _DEFUN(rename, (old, new), - _CONST char *old, - _CONST char *new) + const char *old, + const char *new) { return _rename_r (_REENT, old, new); } diff --git a/newlib/libc/stdio/scanf.c b/newlib/libc/stdio/scanf.c index 23e97b83d..87cbeb7b8 100644 --- a/newlib/libc/stdio/scanf.c +++ b/newlib/libc/stdio/scanf.c @@ -29,7 +29,7 @@ int #ifdef _HAVE_STDC -scanf(_CONST char *__restrict fmt, ...) +scanf(const char *__restrict fmt, ...) #else scanf(fmt, va_alist) char *fmt; @@ -61,7 +61,7 @@ _EXFUN(iscanf, (const char *, ...) int #ifdef _HAVE_STDC -_scanf_r(struct _reent *ptr, _CONST char *__restrict fmt, ...) +_scanf_r(struct _reent *ptr, const char *__restrict fmt, ...) #else _scanf_r(ptr, fmt, va_alist) struct _reent *ptr; diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index 861fc8d67..e33687563 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -107,12 +107,12 @@ int _DEFUN(_siprintf_r, (ptr, str, fmt), struct _reent *ptr, char *str, - _CONST char *fmt _DOTS) + const char *fmt _DOTS) #else _siprintf_r(ptr, str, fmt, va_alist) struct _reent *ptr; char *str; - _CONST char *fmt; + const char *fmt; va_dcl #endif { @@ -141,11 +141,11 @@ int #ifdef _HAVE_STDC _DEFUN(siprintf, (str, fmt), char *str, - _CONST char *fmt _DOTS) + const char *fmt _DOTS) #else siprintf(str, fmt, va_alist) char *str; - _CONST char *fmt; + const char *fmt; va_dcl #endif { diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c index 81d60d0ba..d5e62b40d 100644 --- a/newlib/libc/stdio/siscanf.c +++ b/newlib/libc/stdio/siscanf.c @@ -88,13 +88,13 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef _HAVE_STDC int _DEFUN(siscanf, (str, fmt), - _CONST char *str, - _CONST char *fmt _DOTS) + const char *str, + const char *fmt _DOTS) #else int siscanf(str, fmt, va_alist) - _CONST char *str; - _CONST char *fmt; + const char *str; + const char *fmt; va_dcl #endif { @@ -125,14 +125,14 @@ siscanf(str, fmt, va_alist) int _DEFUN(_siscanf_r, (ptr, str, fmt), struct _reent *ptr, - _CONST char *str, - _CONST char *fmt _DOTS) + const char *str, + const char *fmt _DOTS) #else int _siscanf_r(ptr, str, fmt, va_alist) struct _reent *ptr; - _CONST char *str; - _CONST char *fmt; + const char *str; + const char *fmt; va_dcl #endif { diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c index 65e5b067f..90e30271e 100644 --- a/newlib/libc/stdio/sniprintf.c +++ b/newlib/libc/stdio/sniprintf.c @@ -36,13 +36,13 @@ _DEFUN (_sniprintf_r, (ptr, str, size, fmt), struct _reent *ptr, char *str, size_t size, - _CONST char *fmt _DOTS) + const char *fmt _DOTS) #else _sniprintf_r (ptr, str, size, fmt, va_alist) struct _reent *ptr; char *str; size_t size; - _CONST char *fmt; + const char *fmt; va_dcl #endif { @@ -80,12 +80,12 @@ int _DEFUN (sniprintf, (str, size, fmt), char *str, size_t size, - _CONST char *fmt _DOTS) + const char *fmt _DOTS) #else sniprintf (str, size, fmt, va_alist) char *str; size_t size; - _CONST char *fmt; + const char *fmt; va_dcl #endif { diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c index 2066a56ba..aa7a6364d 100644 --- a/newlib/libc/stdio/snprintf.c +++ b/newlib/libc/stdio/snprintf.c @@ -35,13 +35,13 @@ _DEFUN(_snprintf_r, (ptr, str, size, fmt), struct _reent *ptr, char *__restrict str, size_t size, - _CONST char *__restrict fmt _DOTS) + const char *__restrict fmt _DOTS) #else _snprintf_r(ptr, str, size, fmt, va_alist) struct _reent *ptr; char *str; size_t size; - _CONST char *fmt; + const char *fmt; va_dcl #endif { @@ -85,12 +85,12 @@ int _DEFUN(snprintf, (str, size, fmt), char *__restrict str, size_t size, - _CONST char *__restrict fmt _DOTS) + const char *__restrict fmt _DOTS) #else snprintf(str, size, fmt, va_alist) char *str; size_t size; - _CONST char *fmt; + const char *fmt; va_dcl #endif { diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index 7ed0a0fd4..1948ff158 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -583,12 +583,12 @@ int _DEFUN(_sprintf_r, (ptr, str, fmt), struct _reent *ptr, char *__restrict str, - _CONST char *__restrict fmt _DOTS) + const char *__restrict fmt _DOTS) #else _sprintf_r(ptr, str, fmt, va_alist) struct _reent *ptr; char *__restrict str; - _CONST char *__restrict fmt; + const char *__restrict fmt; va_dcl #endif { @@ -623,11 +623,11 @@ int #ifdef _HAVE_STDC _DEFUN(sprintf, (str, fmt), char *__restrict str, - _CONST char *__restrict fmt _DOTS) + const char *__restrict fmt _DOTS) #else sprintf(str, fmt, va_alist) char *str; - _CONST char *fmt; + const char *fmt; va_dcl #endif { diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index bfec067e9..8a3232525 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -427,13 +427,13 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef _HAVE_STDC int _DEFUN(sscanf, (str, fmt), - _CONST char *__restrict str, - _CONST char * fmt _DOTS) + const char *__restrict str, + const char * fmt _DOTS) #else int sscanf(str, fmt, va_alist) - _CONST char *str; - _CONST char *fmt; + const char *str; + const char *fmt; va_dcl #endif { @@ -470,14 +470,14 @@ _EXFUN(siscanf, (const char *, const char *, ...) int _DEFUN(_sscanf_r, (ptr, str, fmt), struct _reent *ptr, - _CONST char *__restrict str, - _CONST char *__restrict fmt _DOTS) + const char *__restrict str, + const char *__restrict fmt _DOTS) #else int _sscanf_r(ptr, str, fmt, va_alist) struct _reent *ptr; - _CONST char *__restrict str; - _CONST char *__restrict fmt; + const char *__restrict str; + const char *__restrict fmt; va_dcl #endif { diff --git a/newlib/libc/stdio/swprintf.c b/newlib/libc/stdio/swprintf.c index 0ddc492ee..47a2657a2 100644 --- a/newlib/libc/stdio/swprintf.c +++ b/newlib/libc/stdio/swprintf.c @@ -557,7 +557,7 @@ _DEFUN(_swprintf_r, (ptr, str, size, fmt), struct _reent *ptr, wchar_t *str, size_t size, - _CONST wchar_t *fmt _DOTS) + const wchar_t *fmt _DOTS) { int ret; va_list ap; @@ -597,7 +597,7 @@ int _DEFUN(swprintf, (str, size, fmt), wchar_t *__restrict str, size_t size, - _CONST wchar_t *__restrict fmt _DOTS) + const wchar_t *__restrict fmt _DOTS) { int ret; va_list ap; diff --git a/newlib/libc/stdio/swscanf.c b/newlib/libc/stdio/swscanf.c index d52d826e3..c8ae05b42 100644 --- a/newlib/libc/stdio/swscanf.c +++ b/newlib/libc/stdio/swscanf.c @@ -415,7 +415,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifndef _REENT_ONLY int -swscanf (_CONST wchar_t *__restrict str, _CONST wchar_t *__restrict fmt, ...) +swscanf (const wchar_t *__restrict str, const wchar_t *__restrict fmt, ...) { int ret; va_list ap; @@ -437,7 +437,7 @@ swscanf (_CONST wchar_t *__restrict str, _CONST wchar_t *__restrict fmt, ...) #endif /* !_REENT_ONLY */ int -_swscanf_r (struct _reent *ptr, _CONST wchar_t *str, _CONST wchar_t *fmt, ...) +_swscanf_r (struct _reent *ptr, const wchar_t *str, const wchar_t *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c index fbd60fc7c..d794a988e 100644 --- a/newlib/libc/stdio/tmpnam.c +++ b/newlib/libc/stdio/tmpnam.c @@ -89,8 +89,8 @@ static int _DEFUN(worker, (ptr, result, part1, part2, part3, part4), struct _reent *ptr, char *result, - _CONST char *part1, - _CONST char *part2, + const char *part1, + const char *part2, int part3, int *part4) { @@ -149,12 +149,12 @@ _DEFUN(_tmpnam_r, (p, s), char * _DEFUN(_tempnam_r, (p, dir, pfx), struct _reent *p, - _CONST char *dir, - _CONST char *pfx) + const char *dir, + const char *pfx) { char *filename; int length; - _CONST char *prefix = (pfx) ? pfx : ""; + const char *prefix = (pfx) ? pfx : ""; if (dir == NULL && (dir = getenv ("TMPDIR")) == NULL) dir = P_tmpdir; @@ -175,8 +175,8 @@ _DEFUN(_tempnam_r, (p, dir, pfx), char * _DEFUN(tempnam, (dir, pfx), - _CONST char *dir, - _CONST char *pfx) + const char *dir, + const char *pfx) { return _tempnam_r (_REENT, dir, pfx); } diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 904dfa79e..6413f6be1 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -201,7 +201,7 @@ int _DEFUN(__ssputs_r, (ptr, fp, buf, len), struct _reent *ptr, FILE *fp, - _CONST char *buf, + const char *buf, size_t len) { register int w; @@ -275,7 +275,7 @@ _DEFUN(__ssprint_r, (ptr, fp, uio), register size_t len; register int w; register struct __siov *iov; - register _CONST char *p = NULL; + register const char *p = NULL; iov = uio->uio_iov; len = 0; @@ -359,7 +359,7 @@ err: } #else /* !INTEGER_ONLY */ #ifndef _FVWRITE_IN_STREAMIO -int __ssputs_r (struct _reent *, FILE *, _CONST char *, size_t); +int __ssputs_r (struct _reent *, FILE *, const char *, size_t); #endif int __ssprint_r (struct _reent *, FILE *, register struct __suio *); #endif /* !INTEGER_ONLY */ @@ -372,7 +372,7 @@ int _DEFUN(__sfputs_r, (ptr, fp, buf, len), struct _reent *ptr, FILE *fp, - _CONST char *buf, + const char *buf, size_t len) { register int i; @@ -442,7 +442,7 @@ out: } #else /* !INTEGER_ONLY */ #ifndef _FVWRITE_IN_STREAMIO -int __sfputs_r (struct _reent *, FILE *, _CONST char *buf, size_t); +int __sfputs_r (struct _reent *, FILE *, const char *buf, size_t); #endif int __sprint_r (struct _reent *, FILE *, register struct __suio *); #endif /* !INTEGER_ONLY */ @@ -459,7 +459,7 @@ _NOINLINE_STATIC int _DEFUN(__sbprintf, (rptr, fp, fmt, ap), struct _reent *rptr, register FILE *fp, - _CONST char *fmt, + const char *fmt, va_list ap) { int ret; @@ -644,13 +644,13 @@ _EXFUN(get_arg, (struct _reent *data, int n, char *fmt, # define GROUPING 0x400 /* use grouping ("'" flag) */ #endif -int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, _CONST char *, va_list)); +int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, const char *, va_list)); #ifndef STRING_ONLY int _DEFUN(VFPRINTF, (fp, fmt0, ap), FILE * fp, - _CONST char *fmt0, + const char *fmt0, va_list ap) { int result; @@ -663,7 +663,7 @@ int _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), struct _reent *data, FILE * fp, - _CONST char *fmt0, + const char *fmt0, va_list ap) { register char *fmt; /* format string */ @@ -736,9 +736,9 @@ _DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), * below longer. */ #define PADSIZE 16 /* pad chunk size */ - static _CONST char blanks[PADSIZE] = + static const char blanks[PADSIZE] = {' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' '}; - static _CONST char zeroes[PADSIZE] = + static const char zeroes[PADSIZE] = {'0','0','0','0','0','0','0','0','0','0','0','0','0','0','0','0'}; #ifdef _MB_CAPABLE @@ -1459,9 +1459,9 @@ string: #ifdef _MB_CAPABLE if (ch == 'S' || (flags & LONGINT)) { mbstate_t ps; - _CONST wchar_t *wcp; + const wchar_t *wcp; - wcp = (_CONST wchar_t *)cp; + wcp = (const wchar_t *)cp; size = m = 0; memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); @@ -1491,7 +1491,7 @@ string: fp->_flags |= __SERR; goto error; } - wcp = (_CONST wchar_t *)cp; + wcp = (const wchar_t *)cp; } if (size == 0) @@ -1974,7 +1974,7 @@ exponent(char *p0, int exp, int fmtch) the STRING_ONLY/INTEGER_ONLY versions here. */ #if defined (STRING_ONLY) && defined(INTEGER_ONLY) -_CONST __CH_CLASS __chclass[256] = { +const __CH_CLASS __chclass[256] = { /* 00-07 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, /* 08-0f */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, /* 10-17 */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, @@ -2009,7 +2009,7 @@ _CONST __CH_CLASS __chclass[256] = { /* f8-ff */ OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, OTHER, }; -_CONST __STATE __state_table[MAX_STATE][MAX_CH_CLASS] = { +const __STATE __state_table[MAX_STATE][MAX_CH_CLASS] = { /* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */ /* START */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE }, /* SFLAG */ { SFLAG, WDIG, DONE, SMOD, DONE, SDOT, VARW, SFLAG, DONE }, @@ -2024,7 +2024,7 @@ _CONST __STATE __state_table[MAX_STATE][MAX_CH_CLASS] = { /* VPDIG */ { DONE, DONE, PREC, DONE, DONE, DONE, DONE, DONE, DONE }, }; -_CONST __ACTION __action_table[MAX_STATE][MAX_CH_CLASS] = { +const __ACTION __action_table[MAX_STATE][MAX_CH_CLASS] = { /* '0' '1-9' '$' MODFR SPEC '.' '*' FLAG OTHER */ /* START */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP }, /* SFLAG */ { NOOP, NUMBER, NOOP, GETMOD, GETARG, NOOP, NOOP, NOOP, NOOP }, diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 3f67b2304..bf91dad35 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -226,7 +226,7 @@ typedef unsigned long long u_long_long; int _DEFUN(VFSCANF, (fp, fmt, ap), register FILE *fp, - _CONST char *fmt, + const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -238,7 +238,7 @@ _DEFUN(VFSCANF, (fp, fmt, ap), int _DEFUN(__SVFSCANF, (fp, fmt0, ap), register FILE *fp, - char _CONST *fmt0, + char const *fmt0, va_list ap) { return __SVFSCANF_R (_REENT, fp, fmt0, ap); @@ -250,7 +250,7 @@ int _DEFUN(_VFSCANF_R, (data, fp, fmt, ap), struct _reent *data, register FILE *fp, - _CONST char *fmt, + const char *fmt, va_list ap) { CHECK_INIT(data, fp); @@ -405,7 +405,7 @@ int _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), struct _reent *rptr, register FILE *fp, - char _CONST *fmt0, + char const *fmt0, va_list ap) { register u_char *fmt = (u_char *) fmt0; @@ -574,7 +574,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), #endif /* `basefix' is used to avoid `if' tests in the integer scanner */ - static _CONST short basefix[17] = + static const short basefix[17] = {10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; /* Macro to support positional arguments */ diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index 7339ffe53..ad684a249 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -149,7 +149,7 @@ SEEALSO # undef _NO_LONGLONG #endif -int _EXFUN(_VFWPRINTF_R, (struct _reent *, FILE *, _CONST wchar_t *, va_list)); +int _EXFUN(_VFWPRINTF_R, (struct _reent *, FILE *, const wchar_t *, va_list)); /* Defined in vfprintf.c. */ #ifdef _FVWRITE_IN_STREAMIO # ifdef STRING_ONLY @@ -164,7 +164,7 @@ int _EXFUN(__SPRINT, (struct _reent *, FILE *, register struct __suio *)); # else # define __SPRINT __sfputs_r # endif -int _EXFUN(__SPRINT, (struct _reent *, FILE *, _CONST char *, size_t)); +int _EXFUN(__SPRINT, (struct _reent *, FILE *, const char *, size_t)); #endif #ifndef STRING_ONLY #ifdef _UNBUF_STREAM_OPT @@ -177,7 +177,7 @@ static int _DEFUN(__sbwprintf, (rptr, fp, fmt, ap), struct _reent *rptr, register FILE *fp, - _CONST wchar_t *fmt, + const wchar_t *fmt, va_list ap) { int ret; @@ -368,7 +368,7 @@ _EXFUN(get_arg, (struct _reent *data, int n, wchar_t *fmt, int _DEFUN(VFWPRINTF, (fp, fmt0, ap), FILE *__restrict fp, - _CONST wchar_t *__restrict fmt0, + const wchar_t *__restrict fmt0, va_list ap) { int result; @@ -381,7 +381,7 @@ int _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap), struct _reent *data, FILE * fp, - _CONST wchar_t *fmt0, + const wchar_t *fmt0, va_list ap) { register wchar_t *fmt; /* format string */ @@ -452,10 +452,10 @@ _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap), * below longer. */ #define PADSIZE 16 /* pad chunk size */ - static _CONST wchar_t blanks[PADSIZE] = + static const wchar_t blanks[PADSIZE] = {L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' ', L' ',L' ',L' ',L' ',L' ',L' ',L' ',L' '}; - static _CONST wchar_t zeroes[PADSIZE] = + static const wchar_t zeroes[PADSIZE] = {L'0',L'0',L'0',L'0',L'0',L'0',L'0',L'0', L'0',L'0',L'0',L'0',L'0',L'0',L'0',L'0'}; @@ -519,7 +519,7 @@ _DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap), } #else #define PRINT(ptr, len) { \ - if (__SPRINT (data, fp, (_CONST char *)(ptr), (len) * sizeof (wchar_t)) == EOF) \ + if (__SPRINT (data, fp, (const char *)(ptr), (len) * sizeof (wchar_t)) == EOF) \ goto error; \ } #define PAD(howmany, with) { \ diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 715f231e3..27b06232b 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -228,7 +228,7 @@ static void * get_arg (int, va_list *, int *, void **); int _DEFUN(VFWSCANF, (fp, fmt, ap), register FILE *__restrict fp, - _CONST wchar_t *__restrict fmt, + const wchar_t *__restrict fmt, va_list ap) { struct _reent *reent = _REENT; @@ -240,7 +240,7 @@ _DEFUN(VFWSCANF, (fp, fmt, ap), int _DEFUN(__SVFWSCANF, (fp, fmt0, ap), register FILE *fp, - wchar_t _CONST *fmt0, + wchar_t const *fmt0, va_list ap) { return __SVFWSCANF_R (_REENT, fp, fmt0, ap); @@ -252,7 +252,7 @@ int _DEFUN(_VFWSCANF_R, (data, fp, fmt, ap), struct _reent *data, register FILE *fp, - _CONST wchar_t *fmt, + const wchar_t *fmt, va_list ap) { CHECK_INIT(data, fp); @@ -344,7 +344,7 @@ int _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), struct _reent *rptr, register FILE *fp, - wchar_t _CONST *fmt0, + wchar_t const *fmt0, va_list ap) { register wchar_t *fmt = (wchar_t *) fmt0; @@ -514,7 +514,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), #endif /* `basefix' is used to avoid `if' tests in the integer scanner */ - static _CONST short basefix[17] = + static const short basefix[17] = {10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}; /* Macro to support positional arguments */ diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c index ef2a04e2f..950009d4a 100644 --- a/newlib/libc/stdio/viprintf.c +++ b/newlib/libc/stdio/viprintf.c @@ -106,7 +106,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(viprintf, (fmt, ap), - _CONST char *fmt, + const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -120,7 +120,7 @@ _DEFUN(viprintf, (fmt, ap), int _DEFUN(_viprintf_r, (ptr, fmt, ap), struct _reent *ptr, - _CONST char *fmt, + const char *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c index 569fad91c..0c9b13f58 100644 --- a/newlib/libc/stdio/viscanf.c +++ b/newlib/libc/stdio/viscanf.c @@ -90,7 +90,7 @@ Supporting OS subroutines required: int _DEFUN(viscanf, (fmt, ap), - _CONST char *fmt, + const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -104,7 +104,7 @@ _DEFUN(viscanf, (fmt, ap), int _DEFUN(_viscanf_r, (ptr, fmt, ap), struct _reent *ptr, - _CONST char *fmt, + const char *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c index 26671f70c..289c46cd0 100644 --- a/newlib/libc/stdio/vprintf.c +++ b/newlib/libc/stdio/vprintf.c @@ -30,7 +30,7 @@ int _DEFUN(vprintf, (fmt, ap), - _CONST char *fmt, + const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -49,7 +49,7 @@ _EXFUN(viprintf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vprintf")))); int _DEFUN(_vprintf_r, (ptr, fmt, ap), struct _reent *ptr, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c index 2506919c4..260359a3e 100644 --- a/newlib/libc/stdio/vscanf.c +++ b/newlib/libc/stdio/vscanf.c @@ -31,7 +31,7 @@ int _DEFUN(vscanf, (fmt, ap), - _CONST char *fmt, + const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -50,7 +50,7 @@ _EXFUN(viscanf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vscanf")))); int _DEFUN(_vscanf_r, (ptr, fmt, ap), struct _reent *ptr, - _CONST char *__restrict fmt, + const char *__restrict fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c index cf5120fa3..6ad0f4a8d 100644 --- a/newlib/libc/stdio/vsiscanf.c +++ b/newlib/libc/stdio/vsiscanf.c @@ -36,8 +36,8 @@ int _DEFUN(vsiscanf, (str, fmt, ap), - _CONST char *str, - _CONST char *fmt, + const char *str, + const char *fmt, va_list ap) { return _vsiscanf_r (_REENT, str, fmt, ap); @@ -48,8 +48,8 @@ _DEFUN(vsiscanf, (str, fmt, ap), int _DEFUN(_vsiscanf_r, (ptr, str, fmt, ap), struct _reent *ptr, - _CONST char *str, - _CONST char *fmt, + const char *str, + const char *fmt, va_list ap) { FILE f; diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c index 706461d47..87d4cd161 100644 --- a/newlib/libc/stdio/vsscanf.c +++ b/newlib/libc/stdio/vsscanf.c @@ -36,8 +36,8 @@ int _DEFUN(vsscanf, (str, fmt, ap), - _CONST char *__restrict str, - _CONST char *__restrict fmt, + const char *__restrict str, + const char *__restrict fmt, va_list ap) { return _vsscanf_r (_REENT, str, fmt, ap); @@ -54,8 +54,8 @@ _EXFUN(vsiscanf, (const char *, const char *, __VALIST) int _DEFUN(_vsscanf_r, (ptr, str, fmt, ap), struct _reent *ptr, - _CONST char *__restrict str, - _CONST char *__restrict fmt, + const char *__restrict str, + const char *__restrict fmt, va_list ap) { FILE f; diff --git a/newlib/libc/stdio/vswscanf.c b/newlib/libc/stdio/vswscanf.c index 0d090f021..90393f528 100644 --- a/newlib/libc/stdio/vswscanf.c +++ b/newlib/libc/stdio/vswscanf.c @@ -37,7 +37,7 @@ #ifndef _REENT_ONLY int -vswscanf (_CONST wchar_t *__restrict str, _CONST wchar_t * __restrict fmt, +vswscanf (const wchar_t *__restrict str, const wchar_t * __restrict fmt, va_list ap) { return _vswscanf_r (_REENT, str, fmt, ap); @@ -46,7 +46,7 @@ vswscanf (_CONST wchar_t *__restrict str, _CONST wchar_t * __restrict fmt, #endif /* !_REENT_ONLY */ int -_vswscanf_r (struct _reent *ptr, _CONST wchar_t *str, _CONST wchar_t *fmt, +_vswscanf_r (struct _reent *ptr, const wchar_t *str, const wchar_t *fmt, va_list ap) { FILE f; diff --git a/newlib/libc/stdio/vwprintf.c b/newlib/libc/stdio/vwprintf.c index 191fb70c9..28381363e 100644 --- a/newlib/libc/stdio/vwprintf.c +++ b/newlib/libc/stdio/vwprintf.c @@ -27,7 +27,7 @@ int _DEFUN(vwprintf, (fmt, ap), - _CONST wchar_t *__restrict fmt, + const wchar_t *__restrict fmt, va_list ap) { struct _reent *reent = _REENT; @@ -41,7 +41,7 @@ _DEFUN(vwprintf, (fmt, ap), int _DEFUN(_vwprintf_r, (ptr, fmt, ap), struct _reent *ptr, - _CONST wchar_t *fmt, + const wchar_t *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); diff --git a/newlib/libc/stdio/vwscanf.c b/newlib/libc/stdio/vwscanf.c index e40bdede5..3945e79c8 100644 --- a/newlib/libc/stdio/vwscanf.c +++ b/newlib/libc/stdio/vwscanf.c @@ -32,7 +32,7 @@ #ifndef _REENT_ONLY int -vwscanf (_CONST wchar_t *__restrict fmt, va_list ap) +vwscanf (const wchar_t *__restrict fmt, va_list ap) { struct _reent *reent = _REENT; @@ -43,7 +43,7 @@ vwscanf (_CONST wchar_t *__restrict fmt, va_list ap) #endif /* !_REENT_ONLY */ int -_vwscanf_r (struct _reent *ptr, _CONST wchar_t *fmt, va_list ap) +_vwscanf_r (struct _reent *ptr, const wchar_t *fmt, va_list ap) { _REENT_SMALL_CHECK_INIT (ptr); return __svfwscanf_r (ptr, _stdin_r (ptr), fmt, ap); diff --git a/newlib/libc/stdio/wscanf.c b/newlib/libc/stdio/wscanf.c index f953d9f81..5a7c35a08 100644 --- a/newlib/libc/stdio/wscanf.c +++ b/newlib/libc/stdio/wscanf.c @@ -26,7 +26,7 @@ #ifndef _REENT_ONLY int -wscanf(_CONST wchar_t *__restrict fmt, ...) +wscanf(const wchar_t *__restrict fmt, ...) { int ret; va_list ap; @@ -42,7 +42,7 @@ wscanf(_CONST wchar_t *__restrict fmt, ...) #endif /* !_REENT_ONLY */ int -_wscanf_r(struct _reent *ptr, _CONST wchar_t *fmt, ...) +_wscanf_r(struct _reent *ptr, const wchar_t *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio64/fdopen64.c b/newlib/libc/stdio64/fdopen64.c index 1a238f732..f0c3c0784 100644 --- a/newlib/libc/stdio64/fdopen64.c +++ b/newlib/libc/stdio64/fdopen64.c @@ -38,7 +38,7 @@ FILE * _DEFUN (_fdopen64_r, (ptr, fd, mode), struct _reent *ptr, int fd, - _CONST char *mode) + const char *mode) { register FILE *fp; int flags, oflags; @@ -110,7 +110,7 @@ _DEFUN (_fdopen64_r, (ptr, fd, mode), FILE * _DEFUN (fdopen64, (fd, mode), int fd, - _CONST char *mode) + const char *mode) { return _fdopen64_r (_REENT, fd, mode); } diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c index 7edb5d807..6bdf61973 100644 --- a/newlib/libc/stdio64/fopen64.c +++ b/newlib/libc/stdio64/fopen64.c @@ -66,8 +66,8 @@ static char sccsid[] = "%W% (Berkeley) %G%"; FILE * _DEFUN (_fopen64_r, (ptr, file, mode), struct _reent *ptr, - _CONST char *file, - _CONST char *mode) + const char *file, + const char *mode) { register FILE *fp; register int f; @@ -118,8 +118,8 @@ _DEFUN (_fopen64_r, (ptr, file, mode), FILE * _DEFUN (fopen64, (file, mode), - _CONST char *file, - _CONST char *mode) + const char *file, + const char *mode) { return _fopen64_r (_REENT, file, mode); } diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c index 6e42d0e3b..02995b98a 100644 --- a/newlib/libc/stdio64/freopen64.c +++ b/newlib/libc/stdio64/freopen64.c @@ -77,8 +77,8 @@ Supporting OS subroutines required: <>, <>, <>, FILE * _DEFUN (_freopen64_r, (ptr, file, mode, fp), struct _reent *ptr, - _CONST char *file, - _CONST char *mode, + const char *file, + const char *mode, register FILE *fp) { register int f; @@ -248,8 +248,8 @@ _DEFUN (_freopen64_r, (ptr, file, mode, fp), FILE * _DEFUN (freopen64, (file, mode, fp), - _CONST char *file, - _CONST char *mode, + const char *file, + const char *mode, register FILE *fp) { return _freopen64_r (_REENT, file, mode, fp); diff --git a/newlib/libc/stdio64/fsetpos64.c b/newlib/libc/stdio64/fsetpos64.c index 9cfc10733..f5f6bdacf 100644 --- a/newlib/libc/stdio64/fsetpos64.c +++ b/newlib/libc/stdio64/fsetpos64.c @@ -44,7 +44,7 @@ int _DEFUN (_fsetpos64_r, (ptr, iop, pos), struct _reent *ptr, FILE * iop, - _CONST _fpos64_t * pos) + const _fpos64_t * pos) { int x = _fseeko64_r (ptr, iop, (_off64_t)(*pos), SEEK_SET); @@ -58,7 +58,7 @@ _DEFUN (_fsetpos64_r, (ptr, iop, pos), int _DEFUN (fsetpos64, (iop, pos), FILE * iop, - _CONST _fpos64_t * pos) + const _fpos64_t * pos) { return _fsetpos64_r (_REENT, iop, pos); } diff --git a/newlib/libc/stdlib/__exp10.c b/newlib/libc/stdlib/__exp10.c index 4e368b830..1ff81a680 100644 --- a/newlib/libc/stdlib/__exp10.c +++ b/newlib/libc/stdlib/__exp10.c @@ -9,7 +9,7 @@ double _DEFUN (__exp10, (x), unsigned x) { - static _CONST double powtab[] = + static const double powtab[] = {1.0, 10.0, 100.0, diff --git a/newlib/libc/stdlib/atof.c b/newlib/libc/stdlib/atof.c index 4653d4f93..7dfbd9c55 100644 --- a/newlib/libc/stdlib/atof.c +++ b/newlib/libc/stdlib/atof.c @@ -58,7 +58,7 @@ Supporting OS subroutines required: <>, <>, <>, double _DEFUN (atof, (s), - _CONST char *s) + const char *s) { return strtod (s, NULL); } diff --git a/newlib/libc/stdlib/atoff.c b/newlib/libc/stdlib/atoff.c index c97b78fb1..2966254be 100644 --- a/newlib/libc/stdlib/atoff.c +++ b/newlib/libc/stdlib/atoff.c @@ -3,7 +3,7 @@ float _DEFUN (atoff, (s), - _CONST char *s) + const char *s) { return strtof (s, NULL); } diff --git a/newlib/libc/stdlib/atoi.c b/newlib/libc/stdlib/atoi.c index 936b381bd..83ad24177 100644 --- a/newlib/libc/stdlib/atoi.c +++ b/newlib/libc/stdlib/atoi.c @@ -48,7 +48,7 @@ No supporting OS subroutines are required. #ifndef _REENT_ONLY int _DEFUN (atoi, (s), - _CONST char *s) + const char *s) { return (int) strtol (s, NULL, 10); } @@ -57,7 +57,7 @@ _DEFUN (atoi, (s), int _DEFUN (_atoi_r, (s), struct _reent *ptr, - _CONST char *s) + const char *s) { return (int) _strtol_r (ptr, s, NULL, 10); } diff --git a/newlib/libc/stdlib/atol.c b/newlib/libc/stdlib/atol.c index 8c2f5560d..cad512fbc 100644 --- a/newlib/libc/stdlib/atol.c +++ b/newlib/libc/stdlib/atol.c @@ -7,14 +7,14 @@ #ifndef _REENT_ONLY long -_DEFUN (atol, (s), _CONST char *s) +_DEFUN (atol, (s), const char *s) { return strtol (s, NULL, 10); } #endif /* !_REENT_ONLY */ long -_DEFUN (_atol_r, (ptr, s), struct _reent *ptr, _CONST char *s) +_DEFUN (_atol_r, (ptr, s), struct _reent *ptr, const char *s) { return _strtol_r (ptr, s, NULL, 10); } diff --git a/newlib/libc/stdlib/atoll.c b/newlib/libc/stdlib/atoll.c index d0d498349..e853f25eb 100644 --- a/newlib/libc/stdlib/atoll.c +++ b/newlib/libc/stdlib/atoll.c @@ -70,7 +70,7 @@ No supporting OS subroutines are required. #ifndef _REENT_ONLY long long _DEFUN(atoll, (str), - _CONST char *str) + const char *str) { return strtoll(str, (char **)NULL, 10); } @@ -79,7 +79,7 @@ _DEFUN(atoll, (str), long long _DEFUN(_atoll_r, (ptr, str), struct _reent *ptr, - _CONST char *str) + const char *str) { return _strtoll_r(ptr, str, (char **)NULL, 10); } diff --git a/newlib/libc/stdlib/gdtoa-gethex.c b/newlib/libc/stdlib/gdtoa-gethex.c index 931ced3a7..18d9cc172 100644 --- a/newlib/libc/stdlib/gdtoa-gethex.c +++ b/newlib/libc/stdlib/gdtoa-gethex.c @@ -38,7 +38,7 @@ THIS SOFTWARE. #include "gd_qnan.h" #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) -_CONST unsigned char __hexdig[256]= +const unsigned char __hexdig[256]= { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, @@ -149,7 +149,7 @@ gethex (struct _reent *ptr, const char **sp, const FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc) { _Bigint *b; - _CONST unsigned char *decpt, *s0, *s, *s1; + const unsigned char *decpt, *s0, *s, *s1; int esign, havedig, irv, k, n, nbits, up, zret; __ULong L, lostbits, *x; Long e, e1; @@ -159,7 +159,7 @@ gethex (struct _reent *ptr, const char **sp, const FPI *fpi, unsigned char decp_end = decimalpoint[decp_len - 1]; havedig = 0; - s0 = *(_CONST unsigned char **)sp + 2; + s0 = *(const unsigned char **)sp + 2; while(s0[havedig] == '0') havedig++; s0 += havedig; diff --git a/newlib/libc/stdlib/gdtoa-hexnan.c b/newlib/libc/stdlib/gdtoa-hexnan.c index 22033d90f..fa98646f6 100644 --- a/newlib/libc/stdlib/gdtoa-hexnan.c +++ b/newlib/libc/stdlib/gdtoa-hexnan.c @@ -46,11 +46,11 @@ THIS SOFTWARE. #ifdef INFNAN_CHECK int _DEFUN (match, (sp, t), - _CONST char **sp, + const char **sp, char *t) { int c, d; - _CONST char *s = *sp; + const char *s = *sp; while( (d = *t++) !=0) { if ((c = *++s) >= 'A' && c <= 'Z') @@ -81,12 +81,12 @@ _DEFUN (L_shift, (x, x1, i), int _DEFUN (hexnan, (sp, fpi, x0), - _CONST char **sp, - _CONST FPI *fpi, + const char **sp, + const FPI *fpi, __ULong *x0) { __ULong c, h, *x, *x1, *xe; - _CONST char *s; + const char *s; int havedig, hd0, i, nbits; nbits = fpi->nbits; @@ -97,7 +97,7 @@ _DEFUN (hexnan, (sp, fpi, x0), x1 = xe = x; havedig = hd0 = i = 0; s = *sp; - while((c = *(_CONST unsigned char*)++s)) { + while((c = *(const unsigned char*)++s)) { if (!(h = __get_hexdig(c))) { if (c <= ' ') { if (hd0 < havedig) { diff --git a/newlib/libc/stdlib/getenv.c b/newlib/libc/stdlib/getenv.c index 2d394e240..973a54732 100644 --- a/newlib/libc/stdlib/getenv.c +++ b/newlib/libc/stdlib/getenv.c @@ -65,7 +65,7 @@ variables vary from one system to another. char * _DEFUN (_findenv, (name, offset), - register _CONST char *name, + register const char *name, int *offset) { return _findenv_r (_REENT, name, offset); @@ -78,7 +78,7 @@ _DEFUN (_findenv, (name, offset), char * _DEFUN (getenv, (name), - _CONST char *name) + const char *name) { int offset; diff --git a/newlib/libc/stdlib/getenv_r.c b/newlib/libc/stdlib/getenv_r.c index b34c2a9b3..315d283ea 100644 --- a/newlib/libc/stdlib/getenv_r.c +++ b/newlib/libc/stdlib/getenv_r.c @@ -76,12 +76,12 @@ static char ***p_environ = &environ; char * _DEFUN (_findenv_r, (reent_ptr, name, offset), struct _reent *reent_ptr, - register _CONST char *name, + register const char *name, int *offset) { register int len; register char **p; - _CONST char *c; + const char *c; ENV_LOCK; @@ -121,7 +121,7 @@ _DEFUN (_findenv_r, (reent_ptr, name, offset), char * _DEFUN (_getenv_r, (reent_ptr, name), struct _reent *reent_ptr, - _CONST char *name) + const char *name) { int offset; diff --git a/newlib/libc/stdlib/ldtoa.c b/newlib/libc/stdlib/ldtoa.c index a44413cd6..10a7537cc 100644 --- a/newlib/libc/stdlib/ldtoa.c +++ b/newlib/libc/stdlib/ldtoa.c @@ -61,13 +61,13 @@ typedef struct unsigned short equot[NI]; } LDPARMS; -static void esub (_CONST short unsigned int *a, _CONST short unsigned int *b, +static void esub (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, LDPARMS * ldp); -static void emul (_CONST short unsigned int *a, _CONST short unsigned int *b, +static void emul (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, LDPARMS * ldp); -static void ediv (_CONST short unsigned int *a, _CONST short unsigned int *b, +static void ediv (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, LDPARMS * ldp); -static int ecmp (_CONST short unsigned int *a, _CONST short unsigned int *b); +static int ecmp (const short unsigned int *a, const short unsigned int *b); static int enormlz (short unsigned int *x); static int eshift (short unsigned int *x, int sc); static void eshup1 (register short unsigned int *x); @@ -77,7 +77,7 @@ static void eshdn1 (register short unsigned int *x); static void eshdn8 (register short unsigned int *x); static void eshdn6 (register short unsigned int *x); static void eneg (short unsigned int *x); -static void emov (register _CONST short unsigned int *a, +static void emov (register const short unsigned int *a, register short unsigned int *b); static void eclear (register short unsigned int *x); static void einfin (register short unsigned int *x, register LDPARMS * ldp); @@ -111,24 +111,24 @@ static void e113toe (short unsigned int *pe, short unsigned int *y, #if NE == 10 /* 0.0 */ -static _CONST unsigned short ezero[NE] = { 0x0000, 0x0000, 0x0000, 0x0000, +static const unsigned short ezero[NE] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, }; /* 1.0E0 */ -static _CONST unsigned short eone[NE] = { 0x0000, 0x0000, 0x0000, 0x0000, +static const unsigned short eone[NE] = { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x8000, 0x3fff, }; #else /* 0.0 */ -static _CONST unsigned short ezero[NE] = { +static const unsigned short ezero[NE] = { 0, 0000000, 0000000, 0000000, 0000000, 0000000, }; /* 1.0E0 */ -static _CONST unsigned short eone[NE] = { +static const unsigned short eone[NE] = { 0, 0000000, 0000000, 0000000, 0100000, 0x3fff, }; @@ -140,7 +140,7 @@ static _CONST unsigned short eone[NE] = { * messages is bound to the error codes defined * in mconf.h. */ -static _CONST char *_CONST ermsg[7] = { +static const char *const ermsg[7] = { "unknown", /* error code 0 */ "domain", /* error code 1 */ "singularity", /* et seq. */ @@ -432,17 +432,17 @@ static int edivm (short unsigned int *den, short unsigned int *num, LDPARMS * ldp); static int emulm (short unsigned int *a, short unsigned int *b, LDPARMS * ldp); -static int eisneg (_CONST short unsigned int *x); -static int eisinf (_CONST short unsigned int *x); -static void emovi (_CONST short unsigned int *a, short unsigned int *b); +static int eisneg (const short unsigned int *x); +static int eisinf (const short unsigned int *x); +static void emovi (const short unsigned int *a, short unsigned int *b); static void emovo (short unsigned int *a, short unsigned int *b, LDPARMS * ldp); static void emovz (register short unsigned int *a, register short unsigned int *b); static void ecleaz (register short unsigned int *xi); -static void eadd1 (_CONST short unsigned int *a, _CONST short unsigned int *b, +static void eadd1 (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, int subflg, LDPARMS * ldp); -static int eisnan (_CONST short unsigned int *x); +static int eisnan (const short unsigned int *x); static int eiisnan (short unsigned int *x); #ifdef DEC @@ -473,7 +473,7 @@ eclear (register short unsigned int *x) */ static void -emov (register _CONST short unsigned int *a, register short unsigned int *b) +emov (register const short unsigned int *a, register short unsigned int *b) { register int i; @@ -506,7 +506,7 @@ eneg (short unsigned int *x) * else return zero. */ static int -eisneg (_CONST short unsigned int *x) +eisneg (const short unsigned int *x) { #ifdef NANS @@ -524,7 +524,7 @@ eisneg (_CONST short unsigned int *x) * else return zero. */ static int -eisinf (_CONST short unsigned int *x) +eisinf (const short unsigned int *x) { if ((x[NE - 1] & 0x7fff) == 0x7fff) @@ -542,7 +542,7 @@ eisinf (_CONST short unsigned int *x) /* Check if e-type number is not a number. */ static int -eisnan (_CONST short unsigned int *x) +eisnan (const short unsigned int *x) { #ifdef NANS @@ -612,9 +612,9 @@ einfin (register short unsigned int *x, register LDPARMS * ldp) * converting it to internal format. */ static void -emovi (_CONST short unsigned int *a, short unsigned int *b) +emovi (const short unsigned int *a, short unsigned int *b) { - register _CONST unsigned short *p; + register const unsigned short *p; register unsigned short *q; int i; @@ -1421,7 +1421,7 @@ mdfin: */ static void -esub (_CONST short unsigned int *a, _CONST short unsigned int *b, +esub (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, LDPARMS * ldp) { @@ -1452,7 +1452,7 @@ esub (_CONST short unsigned int *a, _CONST short unsigned int *b, static void -eadd1 (_CONST short unsigned int *a, _CONST short unsigned int *b, +eadd1 (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, int subflg, LDPARMS * ldp) { unsigned short ai[NI], bi[NI], ci[NI]; @@ -1563,7 +1563,7 @@ done: ; ediv( a, b, c, ldp ); c = b / a */ static void -ediv (_CONST short unsigned int *a, _CONST short unsigned int *b, +ediv (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, LDPARMS * ldp) { unsigned short ai[NI], bi[NI]; @@ -1669,7 +1669,7 @@ dnzro2: ; emul( a, b, c, ldp ); c = b * a */ static void -emul (_CONST short unsigned int *a, _CONST short unsigned int *b, +emul (const short unsigned int *a, const short unsigned int *b, short unsigned int *c, LDPARMS * ldp) { unsigned short ai[NI], bi[NI]; @@ -2415,7 +2415,7 @@ toe24 (short unsigned int *x, short unsigned int *y) * -2 if either a or b is a NaN. */ static int -ecmp (_CONST short unsigned int *a, _CONST short unsigned int *b) +ecmp (const short unsigned int *a, const short unsigned int *b) { unsigned short ai[NI], bi[NI]; register unsigned short *p, *q; @@ -2627,7 +2627,7 @@ normdn: #define MAXP 4096 #if NE == 10 -static _CONST unsigned short etens[NTEN + 1][NE] = { +static const unsigned short etens[NTEN + 1][NE] = { {0x6576, 0x4a92, 0x804a, 0x153f, 0xc94c, 0x979a, 0x8a20, 0x5202, 0xc460, 0x7525,}, /* 10**4096 */ {0x6a32, 0xce52, 0x329a, 0x28ce, @@ -2656,7 +2656,7 @@ static _CONST unsigned short etens[NTEN + 1][NE] = { 0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x4002,}, /* 10**1 */ }; -static _CONST unsigned short emtens[NTEN + 1][NE] = { +static const unsigned short emtens[NTEN + 1][NE] = { {0x2030, 0xcffc, 0xa1c3, 0x8123, 0x2de3, 0x9fde, 0xd2ce, 0x04c8, 0xa6dd, 0x0ad8,}, /* 10**-4096 */ {0x8264, 0xd2cb, 0xf2ea, 0x12d4, @@ -2685,7 +2685,7 @@ static _CONST unsigned short emtens[NTEN + 1][NE] = { 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0xcccc, 0x3ffb,}, /* 10**-1 */ }; #else -static _CONST unsigned short etens[NTEN + 1][NE] = { +static const unsigned short etens[NTEN + 1][NE] = { {0xc94c, 0x979a, 0x8a20, 0x5202, 0xc460, 0x7525,}, /* 10**4096 */ {0xa74d, 0x5de4, 0xc53d, 0x3b5d, 0x9e8b, 0x5a92,}, /* 10**2048 */ {0x650d, 0x0c17, 0x8175, 0x7586, 0xc976, 0x4d48,}, @@ -2701,7 +2701,7 @@ static _CONST unsigned short etens[NTEN + 1][NE] = { {0x0000, 0x0000, 0x0000, 0x0000, 0xa000, 0x4002,}, /* 10**1 */ }; -static _CONST unsigned short emtens[NTEN + 1][NE] = { +static const unsigned short emtens[NTEN + 1][NE] = { {0x2de4, 0x9fde, 0xd2ce, 0x04c8, 0xa6dd, 0x0ad8,}, /* 10**-4096 */ {0x4925, 0x2de4, 0x3436, 0x534f, 0xceae, 0x256b,}, /* 10**-2048 */ {0x87a6, 0xc0bd, 0xda57, 0x82a5, 0xa2a6, 0x32b5,}, @@ -2973,7 +2973,7 @@ etoasc (short unsigned int *x, char *string, int ndigits, int outformat, { long digit; unsigned short y[NI], t[NI], u[NI], w[NI]; - _CONST unsigned short *p, *r, *ten; + const unsigned short *p, *r, *ten; unsigned short sign; int i, j, k, expon, rndsav, ndigs; char *s, *ss; @@ -3328,7 +3328,7 @@ asctoeg (char *ss, short unsigned int *y, int oprec, LDPARMS * ldp) int k, trail, c, rndsav; long lexp; unsigned short nsign; - _CONST unsigned short *p; + const unsigned short *p; char *sp, *s, *lstr; int lenldstr; int mflag = 0; @@ -3654,7 +3654,7 @@ aexit: * * efloor( x, y, ldp ); */ -static _CONST unsigned short bmask[] = { +static const unsigned short bmask[] = { 0xffff, 0xfffe, 0xfffc, @@ -3756,47 +3756,47 @@ eiremain (short unsigned int *den, short unsigned int *num, LDPARMS * ldp) */ #ifdef MIEEE #if !defined(__mips) -static _CONST unsigned short nan113[8] = { +static const unsigned short nan113[8] = { 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }; -static _CONST unsigned short nan64[6] = { +static const unsigned short nan64[6] = { 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }; -static _CONST unsigned short nan53[4] = { 0x7fff, 0xffff, 0xffff, 0xffff }; -static _CONST unsigned short nan24[2] = { 0x7fff, 0xffff }; +static const unsigned short nan53[4] = { 0x7fff, 0xffff, 0xffff, 0xffff }; +static const unsigned short nan24[2] = { 0x7fff, 0xffff }; #elif defined(__mips_nan2008) /* __mips */ -static _CONST unsigned short nan113[8] = { 0x7fff, 0x8000, 0, 0, 0, 0, 0, 0 }; -static _CONST unsigned short nan64[6] = { 0x7fff, 0xc000, 0, 0, 0, 0 }; -static _CONST unsigned short nan53[4] = { 0x7ff8, 0, 0, 0 }; -static _CONST unsigned short nan24[2] = { 0x7fc0, 0 }; +static const unsigned short nan113[8] = { 0x7fff, 0x8000, 0, 0, 0, 0, 0, 0 }; +static const unsigned short nan64[6] = { 0x7fff, 0xc000, 0, 0, 0, 0 }; +static const unsigned short nan53[4] = { 0x7ff8, 0, 0, 0 }; +static const unsigned short nan24[2] = { 0x7fc0, 0 }; #else /* __mips && !__mips_nan2008 */ -static _CONST unsigned short nan113[8] = { +static const unsigned short nan113[8] = { 0x7fff, 0x7fff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff }; -static _CONST unsigned short nan64[6] = { +static const unsigned short nan64[6] = { 0x7fff, 0xbfff, 0xffff, 0xffff, 0xffff, 0xffff }; -static _CONST unsigned short nan53[4] = { 0x7ff7, 0xffff, 0xffff, 0xffff }; -static _CONST unsigned short nan24[2] = { 0x7fbf, 0xffff }; +static const unsigned short nan53[4] = { 0x7ff7, 0xffff, 0xffff, 0xffff }; +static const unsigned short nan24[2] = { 0x7fbf, 0xffff }; #endif /* __mips && !__mips_nan2008 */ #else /* !MIEEE */ #if !defined(__mips) || defined(__mips_nan2008) -static _CONST unsigned short nan113[8] = { 0, 0, 0, 0, 0, 0, 0x8000, 0x7fff }; -static _CONST unsigned short nan64[6] = { 0, 0, 0, 0, 0xc000, 0x7fff }; -static _CONST unsigned short nan53[4] = { 0, 0, 0, 0x7ff8 }; -static _CONST unsigned short nan24[2] = { 0, 0x7fc0 }; +static const unsigned short nan113[8] = { 0, 0, 0, 0, 0, 0, 0x8000, 0x7fff }; +static const unsigned short nan64[6] = { 0, 0, 0, 0, 0xc000, 0x7fff }; +static const unsigned short nan53[4] = { 0, 0, 0, 0x7ff8 }; +static const unsigned short nan24[2] = { 0, 0x7fc0 }; #else /* __mips && !__mips_nan2008 */ -static _CONST unsigned short nan113[8] = { +static const unsigned short nan113[8] = { 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0xffff, 0x7fff, 0x7fff }; -static _CONST unsigned short nan64[6] = { +static const unsigned short nan64[6] = { 0xffff, 0xffff, 0xffff, 0xffff, 0xbfff, 0x7fff }; -static _CONST unsigned short nan53[4] = { 0xffff, 0xffff, 0xffff, 0x7ff7 }; -static _CONST unsigned short nan24[2] = { 0xffff, 0x7fbf }; +static const unsigned short nan53[4] = { 0xffff, 0xffff, 0xffff, 0x7ff7 }; +static const unsigned short nan24[2] = { 0xffff, 0x7fbf }; #endif /* __mips && !__mips_nan2008 */ #endif /* !MIEEE */ @@ -3805,7 +3805,7 @@ static void enan (short unsigned int *nan, int size) { int i, n; - _CONST unsigned short *p; + const unsigned short *p; switch (size) { diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c index cb6866d50..bd1c691d9 100644 --- a/newlib/libc/stdlib/mprec.c +++ b/newlib/libc/stdlib/mprec.c @@ -193,7 +193,7 @@ _DEFUN (multadd, (ptr, b, m, a), _Bigint * _DEFUN (s2b, (ptr, s, nd0, nd, y9), struct _reent * ptr, - _CONST char *s, + const char *s, int nd0, int nd, __ULong y9) @@ -424,7 +424,7 @@ _DEFUN (pow5mult, { _Bigint *b1, *p5, *p51; int i; - static _CONST int p05[3] = {5, 25, 125}; + static const int p05[3] = {5, 25, 125}; if ((i = k & 3) != 0) b = multadd (ptr, b, p05[i - 1], 0); @@ -951,7 +951,7 @@ _DEFUN (ratio, (a, b), _Bigint * a, _Bigint * b) } -_CONST double +const double tens[] = { 1e0, 1e1, 1e2, 1e3, 1e4, 1e5, 1e6, 1e7, 1e8, 1e9, @@ -961,16 +961,16 @@ _CONST double }; #if !defined(_DOUBLE_IS_32BITS) && !defined(__v800) -_CONST double bigtens[] = +const double bigtens[] = {1e16, 1e32, 1e64, 1e128, 1e256}; -_CONST double tinytens[] = +const double tinytens[] = {1e-16, 1e-32, 1e-64, 1e-128, 1e-256}; #else -_CONST double bigtens[] = +const double bigtens[] = {1e16, 1e32}; -_CONST double tinytens[] = +const double tinytens[] = {1e-16, 1e-32}; #endif diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h index 330c3981b..a98120aa4 100644 --- a/newlib/libc/stdlib/mprec.h +++ b/newlib/libc/stdlib/mprec.h @@ -401,7 +401,7 @@ _Bigint * _EXFUN(lshift,(struct _reent *p, _Bigint *b, int k)); int _EXFUN(match,(const char**, char*)); _Bigint * _EXFUN(diff,(struct _reent *p, _Bigint *a, _Bigint *b)); int _EXFUN(cmp,(_Bigint *a, _Bigint *b)); -int _EXFUN(gethex,(struct _reent *p, _CONST char **sp, _CONST struct FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc)); +int _EXFUN(gethex,(struct _reent *p, const char **sp, const struct FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc)); double _EXFUN(ratio,(_Bigint *a, _Bigint *b)); __ULong _EXFUN(any_on,(_Bigint *b, int k)); void _EXFUN(copybits,(__ULong *c, int n, _Bigint *b)); @@ -419,16 +419,16 @@ int _strtodg_l (struct _reent *p, const char *s00, char **se, unsigned char _EXFUN(__hexdig_fun,(unsigned char)); #endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ #ifdef INFNAN_CHECK -int _EXFUN(hexnan,(_CONST char **sp, _CONST struct FPI *fpi, __ULong *x0)); +int _EXFUN(hexnan,(const char **sp, const struct FPI *fpi, __ULong *x0)); #endif #define Bcopy(x,y) memcpy((char *)&x->_sign, (char *)&y->_sign, y->_wds*sizeof(__Long) + 2*sizeof(int)) -extern _CONST double tinytens[]; -extern _CONST double bigtens[]; -extern _CONST double tens[]; +extern const double tinytens[]; +extern const double bigtens[]; +extern const double tens[]; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) -extern _CONST unsigned char __hexdig[]; +extern const unsigned char __hexdig[]; #endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ diff --git a/newlib/libc/stdlib/setenv.c b/newlib/libc/stdlib/setenv.c index 7e8949417..c963a3343 100644 --- a/newlib/libc/stdlib/setenv.c +++ b/newlib/libc/stdlib/setenv.c @@ -33,8 +33,8 @@ extern int _unsetenv_r _PARAMS ((struct _reent *, const char *)); int _DEFUN (setenv, (name, value, rewrite), - _CONST char *name, - _CONST char *value, + const char *name, + const char *value, int rewrite) { return _setenv_r (_REENT, name, value, rewrite); @@ -46,7 +46,7 @@ _DEFUN (setenv, (name, value, rewrite), */ int _DEFUN (unsetenv, (name), - _CONST char *name) + const char *name) { return _unsetenv_r (_REENT, name); } diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c index 75f21733e..b3bc1fcce 100644 --- a/newlib/libc/stdlib/setenv_r.c +++ b/newlib/libc/stdlib/setenv_r.c @@ -51,8 +51,8 @@ extern char *_findenv_r _PARAMS ((struct _reent *, const char *, int *)); int _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), struct _reent *reent_ptr, - _CONST char *name, - _CONST char *value, + const char *name, + const char *value, int rewrite) { static int alloced; /* if allocated space before */ @@ -135,7 +135,7 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), int _DEFUN (_unsetenv_r, (reent_ptr, name), struct _reent *reent_ptr, - _CONST char *name) + const char *name) { register char **P; int offset; diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index e3c9b7f17..1abff4fe2 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -152,7 +152,7 @@ THIS SOFTWARE. #undef tinytens /* The factor of 2^106 in tinytens[4] helps us avoid setting the underflow */ /* flag unnecessarily. It leads to a song and dance at the end of strtod. */ -static _CONST double tinytens[] = { 1e-16, 1e-32, +static const double tinytens[] = { 1e-16, 1e-32, #ifdef _DOUBLE_IS_32BITS 0.0, 0.0, 0.0 #else @@ -243,7 +243,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, #endif int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, decpt, dsign, e, e1, esign, i, j, k, nd, nd0, nf, nz, nz0, sign; - _CONST char *s, *s0, *s1; + const char *s, *s0, *s1; double aadj, adj; U aadj1, rv, rv0; Long L; @@ -288,7 +288,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, if (*s == '0') { #ifndef NO_HEX_FP { - static _CONST FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; + static const FPI fpi = { 53, 1-1023-53+1, 2046-1023-53+1, 1, SI }; Long exp; __ULong bits[2]; switch(s[1]) { @@ -415,7 +415,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, #ifdef INFNAN_CHECK /* Check for Nan and Infinity */ __ULong bits[2]; - static _CONST FPI fpinan = /* only 52 explicit bits */ + static const FPI fpinan = /* only 52 explicit bits */ { 52, 1-1023-53+1, 2046-1023-53+1, 1, SI }; if (!decpt) switch(c) { @@ -1254,7 +1254,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, double _DEFUN (_strtod_r, (ptr, s00, se), struct _reent *ptr, - _CONST char *__restrict s00, + const char *__restrict s00, char **__restrict se) { return _strtod_l (ptr, s00, se, __get_current_locale ()); @@ -1270,7 +1270,7 @@ strtod_l (const char *__restrict s00, char **__restrict se, locale_t loc) double _DEFUN (strtod, (s00, se), - _CONST char *__restrict s00, char **__restrict se) + const char *__restrict s00, char **__restrict se) { return _strtod_l (_REENT, s00, se, __get_current_locale ()); } @@ -1291,7 +1291,7 @@ strtof_l (const char *__restrict s00, char **__restrict se, locale_t loc) float _DEFUN (strtof, (s00, se), - _CONST char *__restrict s00, + const char *__restrict s00, char **__restrict se) { double val = _strtod_l (_REENT, s00, se, __get_current_locale ()); diff --git a/newlib/libc/stdlib/strtol.c b/newlib/libc/stdlib/strtol.c index 7ffa6a95d..a366680e4 100644 --- a/newlib/libc/stdlib/strtol.c +++ b/newlib/libc/stdlib/strtol.c @@ -214,7 +214,7 @@ _strtol_l (struct _reent *rptr, const char *__restrict nptr, long _DEFUN (_strtol_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST char *__restrict nptr, + const char *__restrict nptr, char **__restrict endptr, int base) { @@ -232,7 +232,7 @@ strtol_l (const char *__restrict s, char **__restrict ptr, int base, long _DEFUN (strtol, (s, ptr, base), - _CONST char *__restrict s, + const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/strtoll.c b/newlib/libc/stdlib/strtoll.c index 51752655a..9fc832393 100644 --- a/newlib/libc/stdlib/strtoll.c +++ b/newlib/libc/stdlib/strtoll.c @@ -133,7 +133,7 @@ No supporting OS subroutines are required. * Convert a string to a long long integer. */ static long long -_strtoll_l (struct _reent *rptr, _CONST char *__restrict nptr, +_strtoll_l (struct _reent *rptr, const char *__restrict nptr, char **__restrict endptr, int base, locale_t loc) { register const unsigned char *s = (const unsigned char *)nptr; @@ -216,7 +216,7 @@ _strtoll_l (struct _reent *rptr, _CONST char *__restrict nptr, long long _DEFUN (_strtoll_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST char *__restrict nptr, + const char *__restrict nptr, char **__restrict endptr, int base) { @@ -234,7 +234,7 @@ strtoll_l (const char *__restrict s, char **__restrict ptr, int base, long long _DEFUN (strtoll, (s, ptr, base), - _CONST char *__restrict s, + const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/strtoul.c b/newlib/libc/stdlib/strtoul.c index e18472254..5a816dab1 100644 --- a/newlib/libc/stdlib/strtoul.c +++ b/newlib/libc/stdlib/strtoul.c @@ -193,7 +193,7 @@ _strtoul_l (struct _reent *rptr, const char *__restrict nptr, unsigned long _DEFUN (_strtoul_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST char *__restrict nptr, + const char *__restrict nptr, char **__restrict endptr, int base) { @@ -211,7 +211,7 @@ strtoul_l (const char *__restrict s, char **__restrict ptr, int base, unsigned long _DEFUN (strtoul, (s, ptr, base), - _CONST char *__restrict s, + const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/strtoull.c b/newlib/libc/stdlib/strtoull.c index 4dfb28f79..0f7c9e385 100644 --- a/newlib/libc/stdlib/strtoull.c +++ b/newlib/libc/stdlib/strtoull.c @@ -191,7 +191,7 @@ _strtoull_l (struct _reent *rptr, const char *__restrict nptr, unsigned long long _DEFUN (_strtoull_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST char *__restrict nptr, + const char *__restrict nptr, char **__restrict endptr, int base) { @@ -209,7 +209,7 @@ strtoull_l (const char *__restrict s, char **__restrict ptr, int base, unsigned long long _DEFUN (strtoull, (s, ptr, base), - _CONST char *__restrict s, + const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c index f172e5de9..0df7d60d3 100644 --- a/newlib/libc/stdlib/system.c +++ b/newlib/libc/stdlib/system.c @@ -53,13 +53,13 @@ Supporting OS subroutines required: <<_exit>>, <<_execve>>, <<_fork_r>>, #include #if defined (unix) || defined (__CYGWIN__) -static int _EXFUN(do_system, (struct _reent *ptr, _CONST char *s)); +static int _EXFUN(do_system, (struct _reent *ptr, const char *s)); #endif int _DEFUN(_system_r, (ptr, s), struct _reent *ptr, - _CONST char *s) + const char *s) { #if defined(HAVE_SYSTEM) return _system (s); @@ -94,7 +94,7 @@ _DEFUN(_system_r, (ptr, s), int _DEFUN(system, (s), - _CONST char *s) + const char *s) { return _system_r (_REENT, s); } @@ -112,7 +112,7 @@ static char ***p_environ = &environ; static int _DEFUN(do_system, (ptr, s), struct _reent *ptr, - _CONST char *s) + const char *s) { char *argv[4]; int pid, status; @@ -144,7 +144,7 @@ _DEFUN(do_system, (ptr, s), static int _DEFUN(do_system, (ptr, s), struct _reent *ptr, - _CONST char *s) + const char *s) { char *argv[4]; int pid, status; diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c index 239f8d2c0..8a72e6fe3 100644 --- a/newlib/libc/stdlib/wcstod.c +++ b/newlib/libc/stdlib/wcstod.c @@ -216,7 +216,7 @@ _wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr, double _DEFUN (_wcstod_r, (ptr, nptr, endptr), struct _reent *ptr, - _CONST wchar_t *nptr, + const wchar_t *nptr, wchar_t **endptr) { return _wcstod_l (ptr, nptr, endptr, __get_current_locale ()); @@ -225,7 +225,7 @@ _DEFUN (_wcstod_r, (ptr, nptr, endptr), float _DEFUN (_wcstof_r, (ptr, nptr, endptr), struct _reent *ptr, - _CONST wchar_t *nptr, + const wchar_t *nptr, wchar_t **endptr) { double retval = _wcstod_l (ptr, nptr, endptr, __get_current_locale ()); @@ -245,7 +245,7 @@ wcstod_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, double _DEFUN (wcstod, (nptr, endptr), - _CONST wchar_t *__restrict nptr, wchar_t **__restrict endptr) + const wchar_t *__restrict nptr, wchar_t **__restrict endptr) { return _wcstod_l (_REENT, nptr, endptr, __get_current_locale ()); } @@ -267,7 +267,7 @@ wcstof_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, float _DEFUN (wcstof, (nptr, endptr), - _CONST wchar_t *__restrict nptr, + const wchar_t *__restrict nptr, wchar_t **__restrict endptr) { double val = _wcstod_l (_REENT, nptr, endptr, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wcstol.c b/newlib/libc/stdlib/wcstol.c index 1f5fd4b3a..324d75ee1 100644 --- a/newlib/libc/stdlib/wcstol.c +++ b/newlib/libc/stdlib/wcstol.c @@ -215,7 +215,7 @@ _wcstol_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, long _DEFUN (_wcstol_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST wchar_t *nptr, + const wchar_t *nptr, wchar_t **endptr, int base) { @@ -233,7 +233,7 @@ wcstol_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, long _DEFUN (wcstol, (s, ptr, base), - _CONST wchar_t *__restrict s, + const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wcstoll.c b/newlib/libc/stdlib/wcstoll.c index be9500027..00db2adf0 100644 --- a/newlib/libc/stdlib/wcstoll.c +++ b/newlib/libc/stdlib/wcstoll.c @@ -215,7 +215,7 @@ _wcstoll_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, long long _DEFUN (_wcstoll_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST wchar_t *nptr, + const wchar_t *nptr, wchar_t **endptr, int base) { @@ -233,7 +233,7 @@ wcstoll_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, long long _DEFUN (wcstoll, (s, ptr, base), - _CONST wchar_t *__restrict s, + const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wcstoul.c b/newlib/libc/stdlib/wcstoul.c index 2470bfa71..5c54ec591 100644 --- a/newlib/libc/stdlib/wcstoul.c +++ b/newlib/libc/stdlib/wcstoul.c @@ -194,7 +194,7 @@ _wcstoul_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, unsigned long _DEFUN (_wcstoul_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST wchar_t *nptr, + const wchar_t *nptr, wchar_t **endptr, int base) { @@ -212,7 +212,7 @@ wcstoul_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, unsigned long _DEFUN (wcstoul, (s, ptr, base), - _CONST wchar_t *__restrict s, + const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wcstoull.c b/newlib/libc/stdlib/wcstoull.c index 55ab3cae6..4724d6150 100644 --- a/newlib/libc/stdlib/wcstoull.c +++ b/newlib/libc/stdlib/wcstoull.c @@ -210,7 +210,7 @@ _wcstoull_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, unsigned long long _DEFUN (_wcstoull_r, (rptr, nptr, endptr, base), struct _reent *rptr, - _CONST wchar_t *nptr, + const wchar_t *nptr, wchar_t **endptr, int base) { @@ -228,7 +228,7 @@ wcstoull_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, unsigned long long _DEFUN (wcstoull, (s, ptr, base), - _CONST wchar_t *__restrict s, + const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/string/bcmp.c b/newlib/libc/string/bcmp.c index 342237742..29afe828c 100644 --- a/newlib/libc/string/bcmp.c +++ b/newlib/libc/string/bcmp.c @@ -33,8 +33,8 @@ QUICKREF int _DEFUN (bcmp, (m1, m2, n), - _CONST void *m1, - _CONST void *m2, + const void *m1, + const void *m2, size_t n) { diff --git a/newlib/libc/string/bcopy.c b/newlib/libc/string/bcopy.c index 1ad8b3e41..d6cb0c97a 100644 --- a/newlib/libc/string/bcopy.c +++ b/newlib/libc/string/bcopy.c @@ -25,7 +25,7 @@ QUICKREF void _DEFUN (bcopy, (b1, b2, length), - _CONST void *b1, + const void *b1, void *b2, size_t length) { diff --git a/newlib/libc/string/index.c b/newlib/libc/string/index.c index 756bbff3e..13519b435 100644 --- a/newlib/libc/string/index.c +++ b/newlib/libc/string/index.c @@ -32,7 +32,7 @@ QUICKREF char * _DEFUN (index, (s, c), - _CONST char *s, + const char *s, int c) { return strchr (s, c); diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c index 6e49a1c6d..b03b504c1 100644 --- a/newlib/libc/string/memccpy.c +++ b/newlib/libc/string/memccpy.c @@ -58,7 +58,7 @@ PORTABILITY _PTR _DEFUN (memccpy, (dst0, src0, endchar, len0), _PTR __restrict dst0, - _CONST _PTR __restrict src0, + const _PTR __restrict src0, int endchar0, size_t len0) { @@ -82,9 +82,9 @@ _DEFUN (memccpy, (dst0, src0, endchar, len0), #else _PTR ptr = NULL; char *dst = dst0; - _CONST char *src = src0; + const char *src = src0; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; char endchar = endchar0 & 0xff; /* If the size is small, or either SRC or DST is unaligned, diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c index a6c5556d7..9660ed383 100644 --- a/newlib/libc/string/memchr.c +++ b/newlib/libc/string/memchr.c @@ -63,11 +63,11 @@ QUICKREF _PTR _DEFUN (memchr, (src_void, c, length), - _CONST _PTR src_void, + const _PTR src_void, int c, size_t length) { - _CONST unsigned char *src = (_CONST unsigned char *) src_void; + const unsigned char *src = (const unsigned char *) src_void; unsigned char d = c; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c index 1af9219de..37d653a26 100644 --- a/newlib/libc/string/memcmp.c +++ b/newlib/libc/string/memcmp.c @@ -44,8 +44,8 @@ QUICKREF int _DEFUN (memcmp, (m1, m2, n), - _CONST _PTR m1, - _CONST _PTR m2, + const _PTR m1, + const _PTR m2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index 3d0dca209..919379053 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -46,7 +46,7 @@ QUICKREF _PTR _DEFUN (memcpy, (dst0, src0, len0), _PTR __restrict dst0, - _CONST _PTR __restrict src0, + const _PTR __restrict src0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) @@ -63,9 +63,9 @@ _DEFUN (memcpy, (dst0, src0, len0), return save; #else char *dst = dst0; - _CONST char *src = src0; + const char *src = src0; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If the size is small, or either SRC or DST is unaligned, then punt into the byte copy loop. This should be rare. */ diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c index 10a3dfd2b..e50ab587a 100644 --- a/newlib/libc/string/memmove.c +++ b/newlib/libc/string/memmove.c @@ -52,12 +52,12 @@ _PTR __inhibit_loop_to_libcall _DEFUN (memmove, (dst_void, src_void, length), _PTR dst_void, - _CONST _PTR src_void, + const _PTR src_void, size_t length) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) char *dst = dst_void; - _CONST char *src = src_void; + const char *src = src_void; if (src < dst && dst < src + length) { @@ -80,9 +80,9 @@ _DEFUN (memmove, (dst_void, src_void, length), return dst_void; #else char *dst = dst_void; - _CONST char *src = src_void; + const char *src = src_void; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; if (src < dst && dst < src + length) { diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c index 74c453b47..79cbf2350 100644 --- a/newlib/libc/string/mempcpy.c +++ b/newlib/libc/string/mempcpy.c @@ -45,7 +45,7 @@ PORTABILITY _PTR _DEFUN (mempcpy, (dst0, src0, len0), _PTR dst0, - _CONST _PTR src0, + const _PTR src0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) @@ -60,9 +60,9 @@ _DEFUN (mempcpy, (dst0, src0, len0), return dst; #else char *dst = dst0; - _CONST char *src = src0; + const char *src = src0; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If the size is small, or either SRC or DST is unaligned, then punt into the byte copy loop. This should be rare. */ diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c index 6a2c03e4e..7a28e2733 100644 --- a/newlib/libc/string/memrchr.c +++ b/newlib/libc/string/memrchr.c @@ -63,11 +63,11 @@ QUICKREF _PTR _DEFUN (memrchr, (src_void, c, length), - _CONST _PTR src_void, + const _PTR src_void, int c, size_t length) { - _CONST unsigned char *src = (_CONST unsigned char *) src_void + length - 1; + const unsigned char *src = (const unsigned char *) src_void + length - 1; unsigned char d = c; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c index 51fe8e37e..b2078dc27 100644 --- a/newlib/libc/string/rawmemchr.c +++ b/newlib/libc/string/rawmemchr.c @@ -62,10 +62,10 @@ QUICKREF _PTR _DEFUN (rawmemchr, (src_void, c), - _CONST _PTR src_void, + const _PTR src_void, int c) { - _CONST unsigned char *src = (_CONST unsigned char *) src_void; + const unsigned char *src = (const unsigned char *) src_void; unsigned char d = c; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/rindex.c b/newlib/libc/string/rindex.c index e18fcb667..0c7f153cf 100644 --- a/newlib/libc/string/rindex.c +++ b/newlib/libc/string/rindex.c @@ -32,7 +32,7 @@ QUICKREF char * _DEFUN (rindex, (s, c), - _CONST char *s, + const char *s, int c) { return strrchr (s, c); diff --git a/newlib/libc/string/stpcpy.c b/newlib/libc/string/stpcpy.c index 5e00b24a2..3933036cc 100644 --- a/newlib/libc/string/stpcpy.c +++ b/newlib/libc/string/stpcpy.c @@ -55,11 +55,11 @@ QUICKREF char* _DEFUN (stpcpy, (dst, src), char *__restrict dst, - _CONST char *__restrict src) + const char *__restrict src) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If SRC or DEST is unaligned, then copy bytes. */ if (!UNALIGNED (src, dst)) diff --git a/newlib/libc/string/stpncpy.c b/newlib/libc/string/stpncpy.c index 9e8a12950..69fa8515a 100644 --- a/newlib/libc/string/stpncpy.c +++ b/newlib/libc/string/stpncpy.c @@ -63,14 +63,14 @@ QUICKREF char * _DEFUN (stpncpy, (dst, src), char *__restrict dst, - _CONST char *__restrict src, + const char *__restrict src, size_t count) { char *ret = NULL; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If SRC and DEST is aligned and count large enough, then copy words. */ if (!UNALIGNED (src, dst) && !TOO_SMALL (count)) diff --git a/newlib/libc/string/strcasecmp.c b/newlib/libc/string/strcasecmp.c index 1ee8f0ebf..4a48aa69a 100644 --- a/newlib/libc/string/strcasecmp.c +++ b/newlib/libc/string/strcasecmp.c @@ -37,14 +37,14 @@ QUICKREF int _DEFUN (strcasecmp, (s1, s2), - _CONST char *s1, - _CONST char *s2) + const char *s1, + const char *s2) { int d = 0; for ( ; ; ) { - _CONST int c1 = tolower(*s1++); - _CONST int c2 = tolower(*s2++); + const int c1 = tolower(*s1++); + const int c2 = tolower(*s2++); if (((d = c1 - c2) != 0) || (c2 == '\0')) break; } diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c index 71ade6664..1cc5f6ed7 100644 --- a/newlib/libc/string/strcasestr.c +++ b/newlib/libc/string/strcasestr.c @@ -91,8 +91,8 @@ QUICKREF */ char * _DEFUN (strcasestr, (s, find), - _CONST char *s, - _CONST char *find) + const char *s, + const char *find) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcat.c b/newlib/libc/string/strcat.c index 96de39ba2..ac9bb8e15 100644 --- a/newlib/libc/string/strcat.c +++ b/newlib/libc/string/strcat.c @@ -56,7 +56,7 @@ QUICKREF char * _DEFUN (strcat, (s1, s2), char *__restrict s1, - _CONST char *__restrict s2) + const char *__restrict s2) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) char *s = s1; diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c index f293612d5..05503d178 100644 --- a/newlib/libc/string/strchr.c +++ b/newlib/libc/string/strchr.c @@ -53,10 +53,10 @@ QUICKREF char * _DEFUN (strchr, (s1, i), - _CONST char *s1, + const char *s1, int i) { - _CONST unsigned char *s = (_CONST unsigned char *)s1; + const unsigned char *s = (const unsigned char *)s1; unsigned char c = i; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c index 3d110b920..14fd4e2ec 100644 --- a/newlib/libc/string/strchrnul.c +++ b/newlib/libc/string/strchrnul.c @@ -32,7 +32,7 @@ QUICKREF char * _DEFUN (strchrnul, (s1, i), - _CONST char *s1, + const char *s1, int i) { char *s = strchr(s1, i); diff --git a/newlib/libc/string/strcmp.c b/newlib/libc/string/strcmp.c index c117c38ff..6c1a0386d 100644 --- a/newlib/libc/string/strcmp.c +++ b/newlib/libc/string/strcmp.c @@ -53,8 +53,8 @@ QUICKREF int _DEFUN (strcmp, (s1, s2), - _CONST char *s1, - _CONST char *s2) + const char *s1, + const char *s2) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) while (*s1 != '\0' && *s1 == *s2) diff --git a/newlib/libc/string/strcoll.c b/newlib/libc/string/strcoll.c index d95a42e2b..fae999a64 100644 --- a/newlib/libc/string/strcoll.c +++ b/newlib/libc/string/strcoll.c @@ -37,8 +37,8 @@ QUICKREF int _DEFUN (strcoll, (a, b), - _CONST char *a, - _CONST char *b) + const char *a, + const char *b) { return strcmp (a, b); diff --git a/newlib/libc/string/strcpy.c b/newlib/libc/string/strcpy.c index 4354472d3..3505b800a 100644 --- a/newlib/libc/string/strcpy.c +++ b/newlib/libc/string/strcpy.c @@ -54,7 +54,7 @@ QUICKREF char* _DEFUN (strcpy, (dst0, src0), char *dst0, - _CONST char *src0) + const char *src0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) char *s = dst0; @@ -65,9 +65,9 @@ _DEFUN (strcpy, (dst0, src0), return s; #else char *dst = dst0; - _CONST char *src = src0; + const char *src = src0; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If SRC or DEST is unaligned, then copy bytes. */ if (!UNALIGNED (src, dst)) diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c index f0e30c80c..589054bae 100644 --- a/newlib/libc/string/strcspn.c +++ b/newlib/libc/string/strcspn.c @@ -27,11 +27,11 @@ PORTABILITY size_t _DEFUN (strcspn, (s1, s2), - _CONST char *s1, - _CONST char *s2) + const char *s1, + const char *s2) { - _CONST char *s = s1; - _CONST char *c; + const char *s = s1; + const char *c; while (*s1) { diff --git a/newlib/libc/string/strdup.c b/newlib/libc/string/strdup.c index dbb069264..6ea2dd570 100644 --- a/newlib/libc/string/strdup.c +++ b/newlib/libc/string/strdup.c @@ -5,7 +5,7 @@ #include char * -_DEFUN (strdup, (str), _CONST char *str) +_DEFUN (strdup, (str), const char *str) { return _strdup_r (_REENT, str); } diff --git a/newlib/libc/string/strdup_r.c b/newlib/libc/string/strdup_r.c index 474ec9668..9cdee80f4 100644 --- a/newlib/libc/string/strdup_r.c +++ b/newlib/libc/string/strdup_r.c @@ -5,7 +5,7 @@ char * _DEFUN (_strdup_r, (reent_ptr, str), struct _reent *reent_ptr, - _CONST char *str) + const char *str) { size_t len = strlen (str) + 1; char *copy = _malloc_r (reent_ptr, len); diff --git a/newlib/libc/string/strlcat.c b/newlib/libc/string/strlcat.c index c606f3b30..2f99294af 100644 --- a/newlib/libc/string/strlcat.c +++ b/newlib/libc/string/strlcat.c @@ -44,7 +44,7 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp size_t _DEFUN (strlcat, (dst, src, siz), char *dst, - _CONST char *src, + const char *src, size_t siz) { register char *d = dst; diff --git a/newlib/libc/string/strlcpy.c b/newlib/libc/string/strlcpy.c index 300ac82c1..2dffed5e3 100644 --- a/newlib/libc/string/strlcpy.c +++ b/newlib/libc/string/strlcpy.c @@ -42,7 +42,7 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp size_t _DEFUN (strlcpy, (dst, src, siz), char *dst, - _CONST char *src, + const char *src, size_t siz) { register char *d = dst; diff --git a/newlib/libc/string/strlen.c b/newlib/libc/string/strlen.c index 2e8c09f7f..df76d5fc2 100644 --- a/newlib/libc/string/strlen.c +++ b/newlib/libc/string/strlen.c @@ -50,9 +50,9 @@ QUICKREF size_t _DEFUN (strlen, (str), - _CONST char *str) + const char *str) { - _CONST char *start = str; + const char *start = str; #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) unsigned long *aligned_addr; diff --git a/newlib/libc/string/strncasecmp.c b/newlib/libc/string/strncasecmp.c index a30fccf81..2a6f6265d 100644 --- a/newlib/libc/string/strncasecmp.c +++ b/newlib/libc/string/strncasecmp.c @@ -38,15 +38,15 @@ QUICKREF int _DEFUN (strncasecmp, (s1, s2, n), - _CONST char *s1, - _CONST char *s2, + const char *s1, + const char *s2, size_t n) { int d = 0; for ( ; n != 0; n--) { - _CONST int c1 = tolower(*s1++); - _CONST int c2 = tolower(*s2++); + const int c1 = tolower(*s1++); + const int c2 = tolower(*s2++); if (((d = c1 - c2) != 0) || (c2 == '\0')) break; } diff --git a/newlib/libc/string/strncat.c b/newlib/libc/string/strncat.c index f800221c6..2411cf124 100644 --- a/newlib/libc/string/strncat.c +++ b/newlib/libc/string/strncat.c @@ -60,7 +60,7 @@ QUICKREF char * _DEFUN (strncat, (s1, s2, n), char *__restrict s1, - _CONST char *__restrict s2, + const char *__restrict s2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strncmp.c b/newlib/libc/string/strncmp.c index 98a31d32b..685d19290 100644 --- a/newlib/libc/string/strncmp.c +++ b/newlib/libc/string/strncmp.c @@ -53,8 +53,8 @@ QUICKREF int _DEFUN (strncmp, (s1, s2, n), - _CONST char *s1, - _CONST char *s2, + const char *s1, + const char *s2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strncpy.c b/newlib/libc/string/strncpy.c index 91b274590..abbe43bc7 100644 --- a/newlib/libc/string/strncpy.c +++ b/newlib/libc/string/strncpy.c @@ -61,12 +61,12 @@ QUICKREF char * _DEFUN (strncpy, (dst0, src0), char *__restrict dst0, - _CONST char *__restrict src0, + const char *__restrict src0, size_t count) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) char *dscan; - _CONST char *sscan; + const char *sscan; dscan = dst0; sscan = src0; @@ -82,9 +82,9 @@ _DEFUN (strncpy, (dst0, src0), return dst0; #else char *dst = dst0; - _CONST char *src = src0; + const char *src = src0; long *aligned_dst; - _CONST long *aligned_src; + const long *aligned_src; /* If SRC and DEST is aligned and count large enough, then copy words. */ if (!UNALIGNED (src, dst) && !TOO_SMALL (count)) diff --git a/newlib/libc/string/strndup.c b/newlib/libc/string/strndup.c index 64e9ae68e..c241ca544 100644 --- a/newlib/libc/string/strndup.c +++ b/newlib/libc/string/strndup.c @@ -7,7 +7,7 @@ char * _DEFUN (strndup, (str, n), - _CONST char *str, + const char *str, size_t n) { return _strndup_r (_REENT, str, n); diff --git a/newlib/libc/string/strndup_r.c b/newlib/libc/string/strndup_r.c index c8ec072fa..3c7e8ee4f 100644 --- a/newlib/libc/string/strndup_r.c +++ b/newlib/libc/string/strndup_r.c @@ -5,10 +5,10 @@ char * _DEFUN (_strndup_r, (reent_ptr, str, n), struct _reent *reent_ptr, - _CONST char *str, + const char *str, size_t n) { - _CONST char *ptr = str; + const char *ptr = str; size_t len; char *copy; diff --git a/newlib/libc/string/strnlen.c b/newlib/libc/string/strnlen.c index 4978f726d..42f460fea 100644 --- a/newlib/libc/string/strnlen.c +++ b/newlib/libc/string/strnlen.c @@ -31,10 +31,10 @@ PORTABILITY size_t _DEFUN (strnlen, (str, n), - _CONST char *str, + const char *str, size_t n) { - _CONST char *start = str; + const char *start = str; while (n-- > 0 && *str) str++; diff --git a/newlib/libc/string/strpbrk.c b/newlib/libc/string/strpbrk.c index f589fbdac..f70efc1ea 100644 --- a/newlib/libc/string/strpbrk.c +++ b/newlib/libc/string/strpbrk.c @@ -26,10 +26,10 @@ PORTABILITY char * _DEFUN (strpbrk, (s1, s2), - _CONST char *s1, - _CONST char *s2) + const char *s1, + const char *s2) { - _CONST char *c = s2; + const char *c = s2; if (!*s1) return (char *) NULL; diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c index 721bb91dc..4aafd509a 100644 --- a/newlib/libc/string/strrchr.c +++ b/newlib/libc/string/strrchr.c @@ -31,10 +31,10 @@ QUICKREF char * _DEFUN (strrchr, (s, i), - _CONST char *s, + const char *s, int i) { - _CONST char *last = NULL; + const char *last = NULL; if (i) { diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c index 287da4d7e..22ccd0bf8 100644 --- a/newlib/libc/string/strspn.c +++ b/newlib/libc/string/strspn.c @@ -31,11 +31,11 @@ QUICKREF size_t _DEFUN (strspn, (s1, s2), - _CONST char *s1, - _CONST char *s2) + const char *s1, + const char *s2) { - _CONST char *s = s1; - _CONST char *c; + const char *s = s1; + const char *c; while (*s1) { diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c index 94fe297e7..749edbce6 100644 --- a/newlib/libc/string/strstr.c +++ b/newlib/libc/string/strstr.c @@ -40,8 +40,8 @@ QUICKREF char * _DEFUN (strstr, (searchee, lookfor), - _CONST char *searchee, - _CONST char *lookfor) + const char *searchee, + const char *lookfor) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strxfrm.c b/newlib/libc/string/strxfrm.c index 55b81b335..13c51becf 100644 --- a/newlib/libc/string/strxfrm.c +++ b/newlib/libc/string/strxfrm.c @@ -48,7 +48,7 @@ QUICKREF size_t _DEFUN (strxfrm, (s1, s2, n), char *__restrict s1, - _CONST char *__restrict s2, + const char *__restrict s2, size_t n) { size_t res; diff --git a/newlib/libc/string/swab.c b/newlib/libc/string/swab.c index b08066875..1c14a4c48 100644 --- a/newlib/libc/string/swab.c +++ b/newlib/libc/string/swab.c @@ -19,7 +19,7 @@ PORTABILITY void _DEFUN (swab, (b1, b2, length), - _CONST void *b1, + const void *b1, void *b2, ssize_t length) { diff --git a/newlib/libc/string/wcpcpy.c b/newlib/libc/string/wcpcpy.c index 0fda226e7..942fad19c 100644 --- a/newlib/libc/string/wcpcpy.c +++ b/newlib/libc/string/wcpcpy.c @@ -28,7 +28,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcpcpy, (s1, s2), wchar_t *__restrict s1, - _CONST wchar_t *__restrict s2) + const wchar_t *__restrict s2) { while ((*s1++ = *s2++)) ; diff --git a/newlib/libc/string/wcpncpy.c b/newlib/libc/string/wcpncpy.c index f643b1e43..11f4d7c1f 100644 --- a/newlib/libc/string/wcpncpy.c +++ b/newlib/libc/string/wcpncpy.c @@ -35,7 +35,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcpncpy, (dst, src, count), wchar_t *__restrict dst, - _CONST wchar_t *__restrict src, + const wchar_t *__restrict src, size_t count) { wchar_t *ret = NULL; diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c index f23e37227..483754997 100644 --- a/newlib/libc/string/wcscasecmp.c +++ b/newlib/libc/string/wcscasecmp.c @@ -37,8 +37,8 @@ QUICKREF int _DEFUN (wcscasecmp, (s1, s2), - _CONST wchar_t *s1, - _CONST wchar_t *s2) + const wchar_t *s1, + const wchar_t *s2) { int d = 0; for ( ; ; ) diff --git a/newlib/libc/string/wcscat.c b/newlib/libc/string/wcscat.c index 900c3cc52..40b7774e5 100644 --- a/newlib/libc/string/wcscat.c +++ b/newlib/libc/string/wcscat.c @@ -63,11 +63,11 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcscat, (s1, s2), wchar_t *__restrict s1, - _CONST wchar_t *__restrict s2) + const wchar_t *__restrict s2) { wchar_t *p; wchar_t *q; - _CONST wchar_t *r; + const wchar_t *r; p = s1; while (*p) diff --git a/newlib/libc/string/wcschr.c b/newlib/libc/string/wcschr.c index 7590009e9..f883f5443 100644 --- a/newlib/libc/string/wcschr.c +++ b/newlib/libc/string/wcschr.c @@ -59,10 +59,10 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcschr, (s, c), - _CONST wchar_t * s, + const wchar_t * s, wchar_t c) { - _CONST wchar_t *p; + const wchar_t *p; p = s; do diff --git a/newlib/libc/string/wcscmp.c b/newlib/libc/string/wcscmp.c index f14eb5d8d..1fb35755c 100644 --- a/newlib/libc/string/wcscmp.c +++ b/newlib/libc/string/wcscmp.c @@ -68,8 +68,8 @@ No supporting OS subroutines are required. */ int _DEFUN (wcscmp, (s1, s2), - _CONST wchar_t * s1, - _CONST wchar_t * s2) + const wchar_t * s1, + const wchar_t * s2) { while (*s1 == *s2++) diff --git a/newlib/libc/string/wcscoll.c b/newlib/libc/string/wcscoll.c index 27a12456e..7d6b927f8 100644 --- a/newlib/libc/string/wcscoll.c +++ b/newlib/libc/string/wcscoll.c @@ -34,8 +34,8 @@ PORTABILITY int _DEFUN (wcscoll, (a, b), - _CONST wchar_t *a, - _CONST wchar_t *b) + const wchar_t *a, + const wchar_t *b) { return wcscmp (a, b); diff --git a/newlib/libc/string/wcscpy.c b/newlib/libc/string/wcscpy.c index 2dff63996..679e9c543 100644 --- a/newlib/libc/string/wcscpy.c +++ b/newlib/libc/string/wcscpy.c @@ -59,10 +59,10 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcscpy, (s1, s2), wchar_t *__restrict s1, - _CONST wchar_t *__restrict s2) + const wchar_t *__restrict s2) { wchar_t *p; - _CONST wchar_t *q; + const wchar_t *q; *s1 = '\0'; p = s1; diff --git a/newlib/libc/string/wcscspn.c b/newlib/libc/string/wcscspn.c index 355499699..54bca2fa7 100644 --- a/newlib/libc/string/wcscspn.c +++ b/newlib/libc/string/wcscspn.c @@ -57,11 +57,11 @@ No supporting OS subroutines are required. size_t _DEFUN (wcscspn, (s, set), - _CONST wchar_t * s, - _CONST wchar_t * set) + const wchar_t * s, + const wchar_t * set) { - _CONST wchar_t *p; - _CONST wchar_t *q; + const wchar_t *p; + const wchar_t *q; p = s; while (*p) diff --git a/newlib/libc/string/wcslcat.c b/newlib/libc/string/wcslcat.c index 1015c4c36..dd96d3049 100644 --- a/newlib/libc/string/wcslcat.c +++ b/newlib/libc/string/wcslcat.c @@ -70,11 +70,11 @@ No supporting OS subroutines are required. size_t _DEFUN (wcslcat, (dst, src, siz), wchar_t * dst, - _CONST wchar_t * src, + const wchar_t * src, size_t siz) { wchar_t *d = dst; - _CONST wchar_t *s = src; + const wchar_t *s = src; size_t n = siz; size_t dlen; diff --git a/newlib/libc/string/wcslcpy.c b/newlib/libc/string/wcslcpy.c index 396dda71a..a21f8c8fc 100644 --- a/newlib/libc/string/wcslcpy.c +++ b/newlib/libc/string/wcslcpy.c @@ -64,11 +64,11 @@ No supporting OS subroutines are required. size_t _DEFUN (wcslcpy, (dst, src, siz), wchar_t * dst, - _CONST wchar_t * src, + const wchar_t * src, size_t siz) { wchar_t *d = dst; - _CONST wchar_t *s = src; + const wchar_t *s = src; size_t n = siz; /* Copy as many bytes as will fit */ diff --git a/newlib/libc/string/wcslen.c b/newlib/libc/string/wcslen.c index ebef17285..c92757708 100644 --- a/newlib/libc/string/wcslen.c +++ b/newlib/libc/string/wcslen.c @@ -56,9 +56,9 @@ No supporting OS subroutines are required. size_t _DEFUN (wcslen, (s), - _CONST wchar_t * s) + const wchar_t * s) { - _CONST wchar_t *p; + const wchar_t *p; p = s; while (*p) diff --git a/newlib/libc/string/wcsncasecmp.c b/newlib/libc/string/wcsncasecmp.c index 90f310158..7abb154ee 100644 --- a/newlib/libc/string/wcsncasecmp.c +++ b/newlib/libc/string/wcsncasecmp.c @@ -38,8 +38,8 @@ QUICKREF int _DEFUN (wcsncasecmp, (s1, s2, n), - _CONST wchar_t *s1, - _CONST wchar_t *s2, + const wchar_t *s1, + const wchar_t *s2, size_t n) { int d = 0; diff --git a/newlib/libc/string/wcsncat.c b/newlib/libc/string/wcsncat.c index 57dc9031b..3c344b46e 100644 --- a/newlib/libc/string/wcsncat.c +++ b/newlib/libc/string/wcsncat.c @@ -64,12 +64,12 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcsncat, (s1, s2, n), wchar_t *__restrict s1, - _CONST wchar_t *__restrict s2, + const wchar_t *__restrict s2, size_t n) { wchar_t *p; wchar_t *q; - _CONST wchar_t *r; + const wchar_t *r; p = s1; while (*p) diff --git a/newlib/libc/string/wcsncmp.c b/newlib/libc/string/wcsncmp.c index 83b899d84..2dc7660f4 100644 --- a/newlib/libc/string/wcsncmp.c +++ b/newlib/libc/string/wcsncmp.c @@ -64,8 +64,8 @@ No supporting OS subroutines are required. int _DEFUN (wcsncmp, (s1, s2, n), - _CONST wchar_t * s1, - _CONST wchar_t * s2, + const wchar_t * s1, + const wchar_t * s2, size_t n) { diff --git a/newlib/libc/string/wcsncpy.c b/newlib/libc/string/wcsncpy.c index d09b95df7..324dad3a2 100644 --- a/newlib/libc/string/wcsncpy.c +++ b/newlib/libc/string/wcsncpy.c @@ -37,7 +37,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcsncpy, (s1, s2, n), wchar_t *__restrict s1, - _CONST wchar_t *__restrict s2, + const wchar_t *__restrict s2, size_t n) { wchar_t *dscan=s1; diff --git a/newlib/libc/string/wcsnlen.c b/newlib/libc/string/wcsnlen.c index e9715e749..cc7d66e10 100644 --- a/newlib/libc/string/wcsnlen.c +++ b/newlib/libc/string/wcsnlen.c @@ -53,10 +53,10 @@ PORTABILITY size_t _DEFUN(wcsnlen, (s, maxlen), - _CONST wchar_t *s, + const wchar_t *s, size_t maxlen) { - _CONST wchar_t *p; + const wchar_t *p; p = s; while (*p && maxlen-- > 0) diff --git a/newlib/libc/string/wcspbrk.c b/newlib/libc/string/wcspbrk.c index b4d8230cc..ecda7affe 100644 --- a/newlib/libc/string/wcspbrk.c +++ b/newlib/libc/string/wcspbrk.c @@ -58,11 +58,11 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcspbrk, (s, set), - _CONST wchar_t * s, - _CONST wchar_t * set) + const wchar_t * s, + const wchar_t * set) { - _CONST wchar_t *p; - _CONST wchar_t *q; + const wchar_t *p; + const wchar_t *q; p = s; while (*p) diff --git a/newlib/libc/string/wcsrchr.c b/newlib/libc/string/wcsrchr.c index 68f1e28b6..f12ccc202 100644 --- a/newlib/libc/string/wcsrchr.c +++ b/newlib/libc/string/wcsrchr.c @@ -61,10 +61,10 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wcsrchr, (s, c), - _CONST wchar_t * s, + const wchar_t * s, wchar_t c) { - _CONST wchar_t *p; + const wchar_t *p; p = s; while (*p) diff --git a/newlib/libc/string/wcsspn.c b/newlib/libc/string/wcsspn.c index 8e8ce6c69..196816821 100644 --- a/newlib/libc/string/wcsspn.c +++ b/newlib/libc/string/wcsspn.c @@ -57,11 +57,11 @@ No supporting OS subroutines are required. size_t _DEFUN (wcsspn, (s, set), - _CONST wchar_t * s, - _CONST wchar_t * set) + const wchar_t * s, + const wchar_t * set) { - _CONST wchar_t *p; - _CONST wchar_t *q; + const wchar_t *p; + const wchar_t *q; p = s; while (*p) diff --git a/newlib/libc/string/wcsstr.c b/newlib/libc/string/wcsstr.c index 2fdec0f97..d5a031452 100644 --- a/newlib/libc/string/wcsstr.c +++ b/newlib/libc/string/wcsstr.c @@ -62,12 +62,12 @@ PORTABILITY wchar_t * _DEFUN (wcsstr, (big, little), - _CONST wchar_t *__restrict big, - _CONST wchar_t *__restrict little) + const wchar_t *__restrict big, + const wchar_t *__restrict little) { - _CONST wchar_t *p; - _CONST wchar_t *q; - _CONST wchar_t *r; + const wchar_t *p; + const wchar_t *q; + const wchar_t *r; if (!*little) { diff --git a/newlib/libc/string/wcswidth.c b/newlib/libc/string/wcswidth.c index 3764883a9..19abfd92d 100644 --- a/newlib/libc/string/wcswidth.c +++ b/newlib/libc/string/wcswidth.c @@ -35,7 +35,7 @@ PORTABILITY int _DEFUN (wcswidth, (pwcs, n), - _CONST wchar_t *pwcs, + const wchar_t *pwcs, size_t n) { diff --git a/newlib/libc/string/wcsxfrm.c b/newlib/libc/string/wcsxfrm.c index 6911b21e2..78d7da566 100644 --- a/newlib/libc/string/wcsxfrm.c +++ b/newlib/libc/string/wcsxfrm.c @@ -38,7 +38,7 @@ PORTABILITY size_t _DEFUN (wcsxfrm, (a, b, n), wchar_t *__restrict a, - _CONST wchar_t *__restrict b, + const wchar_t *__restrict b, size_t n) { diff --git a/newlib/libc/string/wcwidth.c b/newlib/libc/string/wcwidth.c index acb15d0dc..a8c73a542 100644 --- a/newlib/libc/string/wcwidth.c +++ b/newlib/libc/string/wcwidth.c @@ -164,7 +164,7 @@ bisearch(wint_t ucs, const struct interval *table, int max) int _DEFUN (__wcwidth, (ucs), - _CONST wint_t ucs) + const wint_t ucs) { #ifdef _MB_CAPABLE /* sorted list of non-overlapping intervals of East Asian Ambiguous @@ -330,7 +330,7 @@ _DEFUN (__wcwidth, (ucs), int _DEFUN (wcwidth, (wc), - _CONST wchar_t wc) + const wchar_t wc) { wint_t wi = wc; diff --git a/newlib/libc/string/wmemchr.c b/newlib/libc/string/wmemchr.c index 2a6f8e1a4..8db2f64cc 100644 --- a/newlib/libc/string/wmemchr.c +++ b/newlib/libc/string/wmemchr.c @@ -64,7 +64,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmemchr, (s, c, n), - _CONST wchar_t * s, + const wchar_t * s, wchar_t c, size_t n) { diff --git a/newlib/libc/string/wmemcmp.c b/newlib/libc/string/wmemcmp.c index bfe1e69b4..abb9ed6ff 100644 --- a/newlib/libc/string/wmemcmp.c +++ b/newlib/libc/string/wmemcmp.c @@ -63,8 +63,8 @@ No supporting OS subroutines are required. int _DEFUN (wmemcmp, (s1, s2, n), - _CONST wchar_t * s1, - _CONST wchar_t * s2, + const wchar_t * s1, + const wchar_t * s2, size_t n) { size_t i; diff --git a/newlib/libc/string/wmemcpy.c b/newlib/libc/string/wmemcpy.c index 9e4fdc517..ad1aa24bc 100644 --- a/newlib/libc/string/wmemcpy.c +++ b/newlib/libc/string/wmemcpy.c @@ -63,7 +63,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmemcpy, (d, s, n), wchar_t *__restrict d, - _CONST wchar_t *__restrict s, + const wchar_t *__restrict s, size_t n) { diff --git a/newlib/libc/string/wmemmove.c b/newlib/libc/string/wmemmove.c index 567f55afd..22b5a987d 100644 --- a/newlib/libc/string/wmemmove.c +++ b/newlib/libc/string/wmemmove.c @@ -68,7 +68,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmemmove, (d, s, n), wchar_t * d, - _CONST wchar_t * s, + const wchar_t * s, size_t n) { diff --git a/newlib/libc/string/wmempcpy.c b/newlib/libc/string/wmempcpy.c index f11485262..7354e81da 100644 --- a/newlib/libc/string/wmempcpy.c +++ b/newlib/libc/string/wmempcpy.c @@ -36,7 +36,7 @@ No supporting OS subroutines are required. wchar_t * _DEFUN (wmempcpy, (d, s, n), wchar_t *__restrict d, - _CONST wchar_t *__restrict s, + const wchar_t *__restrict s, size_t n) { return (wchar_t *) mempcpy (d, s, n * sizeof (wchar_t)); diff --git a/newlib/libc/sys/linux/getpwent.c b/newlib/libc/sys/linux/getpwent.c index 9479021e3..adf607e02 100644 --- a/newlib/libc/sys/linux/getpwent.c +++ b/newlib/libc/sys/linux/getpwent.c @@ -4,7 +4,7 @@ struct passwd * _DEFUN (getpwnam, (name), - _CONST char *name) + const char *name) { errno = ENOSYS; return NULL; diff --git a/newlib/libc/sys/linux/pwrite.c b/newlib/libc/sys/linux/pwrite.c index c2b79ad13..2db2935ed 100644 --- a/newlib/libc/sys/linux/pwrite.c +++ b/newlib/libc/sys/linux/pwrite.c @@ -9,7 +9,7 @@ ssize_t _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), struct _reent *rptr, int fd, - _CONST _PTR buf, + const _PTR buf, size_t n, off_t off) { @@ -35,7 +35,7 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (__libc_pwrite, (fd, buf, n, off), int fd, - _CONST _PTR buf, + const _PTR buf, size_t n, off_t off) { diff --git a/newlib/libc/sys/linux/sys/errno.h b/newlib/libc/sys/linux/sys/errno.h index 82c84c944..86a6968fe 100644 --- a/newlib/libc/sys/linux/sys/errno.h +++ b/newlib/libc/sys/linux/sys/errno.h @@ -15,7 +15,7 @@ extern int *__errno _PARAMS ((void)); #endif -extern __IMPORT _CONST char * _CONST _sys_errlist[]; +extern __IMPORT const char * const _sys_errlist[]; extern __IMPORT int _sys_nerr; #define __errno_r(ptr) ((ptr)->_errno) diff --git a/newlib/libc/sys/phoenix/sys/errno.h b/newlib/libc/sys/phoenix/sys/errno.h index e3ec2a40e..82aab6d0c 100644 --- a/newlib/libc/sys/phoenix/sys/errno.h +++ b/newlib/libc/sys/phoenix/sys/errno.h @@ -34,7 +34,7 @@ extern int *__errno _PARAMS ((void)); #endif /* Don't use these variables directly. Use strerror instead. */ -extern __IMPORT _CONST char * _CONST _sys_errlist[]; +extern __IMPORT const char * const _sys_errlist[]; extern __IMPORT int _sys_nerr; #define __errno_r(ptr) ((ptr)->_errno) diff --git a/newlib/libc/syscalls/sysexecve.c b/newlib/libc/syscalls/sysexecve.c index 3471e893f..1a593117d 100644 --- a/newlib/libc/syscalls/sysexecve.c +++ b/newlib/libc/syscalls/sysexecve.c @@ -5,9 +5,9 @@ int _DEFUN (execve, (name, argv, env), - _CONST char *name, - char *_CONST argv[], - char *_CONST env[]) + const char *name, + char *const argv[], + char *const env[]) { return _execve_r (_REENT, name, argv, env); } diff --git a/newlib/libc/syscalls/syslink.c b/newlib/libc/syscalls/syslink.c index afcf3559e..188040e4e 100644 --- a/newlib/libc/syscalls/syslink.c +++ b/newlib/libc/syscalls/syslink.c @@ -5,8 +5,8 @@ int _DEFUN (link, (old, new), - _CONST char *old, - _CONST char *new) + const char *old, + const char *new) { return _link_r (_REENT, old, new); } diff --git a/newlib/libc/syscalls/sysstat.c b/newlib/libc/syscalls/sysstat.c index 4f4cd8a78..3e0287ec8 100644 --- a/newlib/libc/syscalls/sysstat.c +++ b/newlib/libc/syscalls/sysstat.c @@ -6,7 +6,7 @@ int _DEFUN (stat, (file, pstat), - _CONST char *file, + const char *file, struct stat *pstat) { return _stat_r (_REENT, file, pstat); diff --git a/newlib/libc/syscalls/sysunlink.c b/newlib/libc/syscalls/sysunlink.c index 1399a80e5..06b4fc086 100644 --- a/newlib/libc/syscalls/sysunlink.c +++ b/newlib/libc/syscalls/sysunlink.c @@ -5,7 +5,7 @@ int _DEFUN (unlink, (file), - _CONST char *file) + const char *file) { return _unlink_r (_REENT, file); } diff --git a/newlib/libc/time/asctime.c b/newlib/libc/time/asctime.c index b9345f581..cbecd94f1 100644 --- a/newlib/libc/time/asctime.c +++ b/newlib/libc/time/asctime.c @@ -49,7 +49,7 @@ ANSI C requires <>. char * _DEFUN (asctime, (tim_p), - _CONST struct tm *tim_p) + const struct tm *tim_p) { struct _reent *reent = _REENT; diff --git a/newlib/libc/time/asctime_r.c b/newlib/libc/time/asctime_r.c index c38e32f41..93e3fc27f 100644 --- a/newlib/libc/time/asctime_r.c +++ b/newlib/libc/time/asctime_r.c @@ -7,13 +7,13 @@ char * _DEFUN (asctime_r, (tim_p, result), - _CONST struct tm *__restrict tim_p, + const struct tm *__restrict tim_p, char *__restrict result) { - static _CONST char day_name[7][3] = { + static const char day_name[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - static _CONST char mon_name[12][3] = { + static const char mon_name[12][3] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; diff --git a/newlib/libc/time/ctime.c b/newlib/libc/time/ctime.c index 160eb9948..f0592f469 100644 --- a/newlib/libc/time/ctime.c +++ b/newlib/libc/time/ctime.c @@ -38,7 +38,7 @@ ANSI C requires <>. char * _DEFUN (ctime, (tim_p), - _CONST time_t * tim_p) + const time_t * tim_p) { return asctime (localtime (tim_p)); } diff --git a/newlib/libc/time/ctime_r.c b/newlib/libc/time/ctime_r.c index 3546142dd..4ab0ba77d 100644 --- a/newlib/libc/time/ctime_r.c +++ b/newlib/libc/time/ctime_r.c @@ -6,7 +6,7 @@ char * _DEFUN (ctime_r, (tim_p, result), - _CONST time_t * tim_p, + const time_t * tim_p, char * result) { diff --git a/newlib/libc/time/gmtime.c b/newlib/libc/time/gmtime.c index c62a212f7..e74a16157 100644 --- a/newlib/libc/time/gmtime.c +++ b/newlib/libc/time/gmtime.c @@ -51,7 +51,7 @@ ANSI C requires <>. struct tm * _DEFUN (gmtime, (tim_p), - _CONST time_t * tim_p) + const time_t * tim_p) { struct _reent *reent = _REENT; diff --git a/newlib/libc/time/gmtime_r.c b/newlib/libc/time/gmtime_r.c index 01f95ebf7..dcc5dd166 100644 --- a/newlib/libc/time/gmtime_r.c +++ b/newlib/libc/time/gmtime_r.c @@ -47,11 +47,11 @@ struct tm * _DEFUN (gmtime_r, (tim_p, res), - _CONST time_t *__restrict tim_p, + const time_t *__restrict tim_p, struct tm *__restrict res) { long days, rem; - _CONST time_t lcltime = *tim_p; + const time_t lcltime = *tim_p; int era, weekday, year; unsigned erayear, yearday, month, day; unsigned long eraday; diff --git a/newlib/libc/time/lcltime.c b/newlib/libc/time/lcltime.c index 0129335a5..493df80d1 100644 --- a/newlib/libc/time/lcltime.c +++ b/newlib/libc/time/lcltime.c @@ -44,7 +44,7 @@ ANSI C requires <>. struct tm * _DEFUN (localtime, (tim_p), - _CONST time_t * tim_p) + const time_t * tim_p) { struct _reent *reent = _REENT; diff --git a/newlib/libc/time/lcltime_r.c b/newlib/libc/time/lcltime_r.c index 9abf683a7..3eba498c3 100644 --- a/newlib/libc/time/lcltime_r.c +++ b/newlib/libc/time/lcltime_r.c @@ -17,14 +17,14 @@ struct tm * _DEFUN (localtime_r, (tim_p, res), - _CONST time_t *__restrict tim_p, + const time_t *__restrict tim_p, struct tm *__restrict res) { long offset; int hours, mins, secs; int year; - __tzinfo_type *_CONST tz = __gettzinfo (); - _CONST int *ip; + __tzinfo_type *const tz = __gettzinfo (); + const int *ip; res = gmtime_r (tim_p, res); diff --git a/newlib/libc/time/local.h b/newlib/libc/time/local.h index af5793af9..dd9d76666 100644 --- a/newlib/libc/time/local.h +++ b/newlib/libc/time/local.h @@ -21,7 +21,7 @@ int _EXFUN (__tzcalc_limits, (int __year)); -extern _CONST int __month_lengths[2][MONSPERYEAR]; +extern const int __month_lengths[2][MONSPERYEAR]; _VOID _EXFUN(_tzset_unlocked_r, (struct _reent *)); _VOID _EXFUN(_tzset_unlocked, (_VOID)); diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c index 4849ea407..1f0d9ba27 100644 --- a/newlib/libc/time/mktime.c +++ b/newlib/libc/time/mktime.c @@ -50,12 +50,12 @@ ANSI C requires <>. #define _SEC_IN_HOUR 3600L #define _SEC_IN_DAY 86400L -static _CONST int DAYS_IN_MONTH[12] = +static const int DAYS_IN_MONTH[12] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; #define _DAYS_IN_MONTH(x) ((x == 1) ? days_in_feb : DAYS_IN_MONTH[x]) -static _CONST int _DAYS_BEFORE_MONTH[12] = +static const int _DAYS_BEFORE_MONTH[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; #define _ISLEAP(y) (((y) % 4) == 0 && (((y) % 100) != 0 || (((y)+1900) % 400) == 0)) diff --git a/newlib/libc/time/month_lengths.c b/newlib/libc/time/month_lengths.c index 2871802f0..03fac2f07 100644 --- a/newlib/libc/time/month_lengths.c +++ b/newlib/libc/time/month_lengths.c @@ -8,7 +8,7 @@ #include "local.h" -_CONST int __month_lengths[2][MONSPERYEAR] = { +const int __month_lengths[2][MONSPERYEAR] = { {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}, {31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31} } ; diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index 54df9b2e1..4ed84fb23 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -341,7 +341,7 @@ locale, hard-coding the "C" locale settings. # error "YEAR_BASE < 0" #endif -static _CONST int dname_len[7] = +static const int dname_len[7] = {6, 6, 7, 9, 8, 6, 8}; /* Using the tm_year, tm_wday, and tm_yday components of TIM_P, return @@ -349,7 +349,7 @@ static _CONST int dname_len[7] = numbering used in "%g%G%V", avoiding overflow. */ static int _DEFUN (iso_year_adjust, (tim_p), - _CONST struct tm *tim_p) + const struct tm *tim_p) { /* Account for fact that tm_year==0 is year 1900. */ int leap = isleap (tim_p->tm_year + (YEAR_BASE @@ -1434,8 +1434,8 @@ size_t _DEFUN (strftime, (s, maxsize, format, tim_p), CHAR *__restrict s, size_t maxsize, - _CONST CHAR *__restrict format, - _CONST struct tm *__restrict tim_p) + const CHAR *__restrict format, + const struct tm *__restrict tim_p) { #ifdef _WANT_C99_TIME_FORMATS era_info_t *era_info = NULL; diff --git a/newlib/libc/time/strptime.c b/newlib/libc/time/strptime.c index 2ec001a1e..12b2ef469 100644 --- a/newlib/libc/time/strptime.c +++ b/newlib/libc/time/strptime.c @@ -45,7 +45,7 @@ #define _ctloc(x) (_CurrentTimeLocale->x) -static _CONST int _DAYS_BEFORE_MONTH[12] = +static const int _DAYS_BEFORE_MONTH[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; #define SET_MDAY 1 diff --git a/newlib/libc/time/tzcalc_limits.c b/newlib/libc/time/tzcalc_limits.c index 8a0bda3da..fe785058d 100644 --- a/newlib/libc/time/tzcalc_limits.c +++ b/newlib/libc/time/tzcalc_limits.c @@ -16,7 +16,7 @@ _DEFUN (__tzcalc_limits, (year), { int days, year_days, years; int i, j; - __tzinfo_type *_CONST tz = __gettzinfo (); + __tzinfo_type *const tz = __gettzinfo (); if (year < EPOCH_YEAR) return 0; @@ -44,9 +44,9 @@ _DEFUN (__tzcalc_limits, (year), days = year_days + tz->__tzrule[i].d; else { - _CONST int yleap = isleap(year); + const int yleap = isleap(year); int m_day, m_wday, wday_diff; - _CONST int *_CONST ip = __month_lengths[yleap]; + const int *const ip = __month_lengths[yleap]; days = year_days; diff --git a/newlib/libc/unix/getut.c b/newlib/libc/unix/getut.c index cf054cb46..c3a9b626c 100644 --- a/newlib/libc/unix/getut.c +++ b/newlib/libc/unix/getut.c @@ -31,7 +31,7 @@ endutent () } void -utmpname (_CONST char *file) +utmpname (const char *file) { utmp_file = strdup (file); } diff --git a/newlib/libc/unix/pwrite.c b/newlib/libc/unix/pwrite.c index 2256a30ca..3bf759bd0 100644 --- a/newlib/libc/unix/pwrite.c +++ b/newlib/libc/unix/pwrite.c @@ -42,7 +42,7 @@ ssize_t _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), struct _reent *rptr, int fd, - _CONST _PTR buf, + const _PTR buf, size_t n, off_t off) { @@ -68,7 +68,7 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (pwrite, (fd, buf, n, off), int fd, - _CONST _PTR buf, + const _PTR buf, size_t n, off_t off) { diff --git a/newlib/libc/xdr/xdr_mem.c b/newlib/libc/xdr/xdr_mem.c index b49dc3b8f..16d128774 100644 --- a/newlib/libc/xdr/xdr_mem.c +++ b/newlib/libc/xdr/xdr_mem.c @@ -55,22 +55,22 @@ static void _EXFUN (xdrmem_destroy, (XDR *)); static bool_t _EXFUN (xdrmem_getlong_aligned, (XDR *, long *)); -static bool_t _EXFUN (xdrmem_putlong_aligned, (XDR *, _CONST long *)); +static bool_t _EXFUN (xdrmem_putlong_aligned, (XDR *, const long *)); static bool_t _EXFUN (xdrmem_getlong_unaligned, (XDR *, long *)); -static bool_t _EXFUN (xdrmem_putlong_unaligned, (XDR *, _CONST long *)); +static bool_t _EXFUN (xdrmem_putlong_unaligned, (XDR *, const long *)); static bool_t _EXFUN (xdrmem_getbytes, (XDR *, char *, u_int)); -static bool_t _EXFUN (xdrmem_putbytes, (XDR *, _CONST char *, u_int)); +static bool_t _EXFUN (xdrmem_putbytes, (XDR *, const char *, u_int)); /* XXX: w/64-bit pointers, u_int not enough! */ static u_int _EXFUN (xdrmem_getpos, (XDR *)); static bool_t _EXFUN (xdrmem_setpos, (XDR *, u_int)); static int32_t * _EXFUN (xdrmem_inline_aligned, (XDR *, u_int)); static int32_t * _EXFUN (xdrmem_inline_unaligned, (XDR *, u_int)); static bool_t _EXFUN (xdrmem_getint32_aligned, (XDR *, int32_t *)); -static bool_t _EXFUN (xdrmem_putint32_aligned, (XDR *, _CONST int32_t *)); +static bool_t _EXFUN (xdrmem_putint32_aligned, (XDR *, const int32_t *)); static bool_t _EXFUN (xdrmem_getint32_unaligned, (XDR *, int32_t *)); -static bool_t _EXFUN (xdrmem_putint32_unaligned, (XDR *, _CONST int32_t *)); +static bool_t _EXFUN (xdrmem_putint32_unaligned, (XDR *, const int32_t *)); -static _CONST struct xdr_ops xdrmem_ops_aligned = { +static const struct xdr_ops xdrmem_ops_aligned = { xdrmem_getlong_aligned, xdrmem_putlong_aligned, xdrmem_getbytes, @@ -83,7 +83,7 @@ static _CONST struct xdr_ops xdrmem_ops_aligned = { xdrmem_putint32_aligned }; -static _CONST struct xdr_ops xdrmem_ops_unaligned = { +static const struct xdr_ops xdrmem_ops_unaligned = { xdrmem_getlong_unaligned, xdrmem_putlong_unaligned, xdrmem_getbytes, @@ -137,7 +137,7 @@ _DEFUN (xdrmem_getlong_aligned, (xdrs, lp), static bool_t _DEFUN (xdrmem_putlong_aligned, (xdrs, lp), XDR * xdrs, - _CONST long *lp) + const long *lp) { if (xdrs->x_handy < sizeof (int32_t)) return FALSE; @@ -166,7 +166,7 @@ _DEFUN (xdrmem_getlong_unaligned, (xdrs, lp), static bool_t _DEFUN (xdrmem_putlong_unaligned, (xdrs, lp), XDR * xdrs, - _CONST long *lp) + const long *lp) { u_int32_t l; @@ -196,7 +196,7 @@ _DEFUN (xdrmem_getbytes, (xdrs, addr, len), static bool_t _DEFUN (xdrmem_putbytes, (xdrs, addr, len), XDR * xdrs, - _CONST char *addr, + const char *addr, u_int len) { if (xdrs->x_handy < len) @@ -275,7 +275,7 @@ _DEFUN (xdrmem_getint32_aligned, (xdrs, ip), static bool_t _DEFUN (xdrmem_putint32_aligned, (xdrs, ip), XDR *xdrs, - _CONST int32_t *ip) + const int32_t *ip) { if (xdrs->x_handy < sizeof(int32_t)) return FALSE; @@ -304,7 +304,7 @@ _DEFUN (xdrmem_getint32_unaligned, (xdrs, ip), static bool_t _DEFUN (xdrmem_putint32_unaligned, (xdrs, ip), XDR *xdrs, - _CONST int32_t *ip) + const int32_t *ip) { u_int32_t l; diff --git a/newlib/libc/xdr/xdr_private.c b/newlib/libc/xdr/xdr_private.c index ea557fa03..79358a518 100644 --- a/newlib/libc/xdr/xdr_private.c +++ b/newlib/libc/xdr/xdr_private.c @@ -36,7 +36,7 @@ _DEFUN (xdr_set_vprintf, (fnptr), void _DEFUN (xdr_vwarnx, (format, ap), - _CONST char *format, + const char *format, va_list ap) { if (xdr_vprintf) @@ -49,7 +49,7 @@ _DEFUN (xdr_vwarnx, (format, ap), void _DEFUN (xdr_warnx, (fmt), - _CONST char *fmt _DOTS) + const char *fmt _DOTS) { va_list ap; va_start (ap, fmt); diff --git a/newlib/libc/xdr/xdr_rec.c b/newlib/libc/xdr/xdr_rec.c index 0caadd6d5..367c3cb64 100644 --- a/newlib/libc/xdr/xdr_rec.c +++ b/newlib/libc/xdr/xdr_rec.c @@ -73,17 +73,17 @@ enum xprt_stat }; static bool_t _EXFUN (xdrrec_getlong, (XDR *, long *)); -static bool_t _EXFUN (xdrrec_putlong, (XDR *, _CONST long *)); +static bool_t _EXFUN (xdrrec_putlong, (XDR *, const long *)); static bool_t _EXFUN (xdrrec_getbytes, (XDR *, char *, u_int)); -static bool_t _EXFUN (xdrrec_putbytes, (XDR *, _CONST char *, u_int)); +static bool_t _EXFUN (xdrrec_putbytes, (XDR *, const char *, u_int)); static u_int _EXFUN (xdrrec_getpos, (XDR *)); static bool_t _EXFUN (xdrrec_setpos, (XDR *, u_int)); static int32_t * _EXFUN (xdrrec_inline, (XDR *, u_int)); static void _EXFUN (xdrrec_destroy, (XDR *)); static bool_t _EXFUN (xdrrec_getint32, (XDR *, int32_t *)); -static bool_t _EXFUN (xdrrec_putint32, (XDR *, _CONST int32_t *)); +static bool_t _EXFUN (xdrrec_putint32, (XDR *, const int32_t *)); -static _CONST struct xdr_ops xdrrec_ops = { +static const struct xdr_ops xdrrec_ops = { xdrrec_getlong, xdrrec_putlong, xdrrec_getbytes, @@ -290,7 +290,7 @@ _DEFUN (xdrrec_getlong, (xdrs, lp), static bool_t _DEFUN (xdrrec_putlong, (xdrs, lp), XDR * xdrs, - _CONST long *lp) + const long *lp) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); int32_t *dest_lp = ((int32_t *) (void *) (rstrm->out_finger)); @@ -345,7 +345,7 @@ _DEFUN (xdrrec_getbytes, (xdrs, addr, len), static bool_t _DEFUN (xdrrec_putbytes, (xdrs, addr, len), XDR * xdrs, - _CONST char *addr, + const char *addr, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -522,7 +522,7 @@ _DEFUN (xdrrec_getint32, (xdrs, ip), static bool_t _DEFUN (xdrrec_putint32, (xdrs, ip), XDR *xdrs, - _CONST int32_t *ip) + const int32_t *ip) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); int32_t *dest_ip = ((int32_t *) (void *) (rstrm->out_finger)); diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c index 34d1e6036..fe7aaa723 100644 --- a/newlib/libc/xdr/xdr_sizeof.c +++ b/newlib/libc/xdr/xdr_sizeof.c @@ -45,7 +45,7 @@ static bool_t _DEFUN (x_putlong, (xdrs, longp), XDR * xdrs, - _CONST long *longp) + const long *longp) { xdrs->x_handy += BYTES_PER_XDR_UNIT; return TRUE; @@ -134,7 +134,7 @@ _DEFUN (x_destroy, (xdrs), static bool_t _DEFUN (x_putint32, (xdrs, int32p), XDR *xdrs, - _CONST int32_t *int32p) + const int32_t *int32p) { xdrs->x_handy += BYTES_PER_XDR_UNIT; return TRUE; diff --git a/newlib/libc/xdr/xdr_stdio.c b/newlib/libc/xdr/xdr_stdio.c index 5bb4b13f1..e6513e5d0 100644 --- a/newlib/libc/xdr/xdr_stdio.c +++ b/newlib/libc/xdr/xdr_stdio.c @@ -52,19 +52,19 @@ static void _EXFUN (xdrstdio_destroy, (XDR *)); static bool_t _EXFUN (xdrstdio_getlong, (XDR *, long *)); -static bool_t _EXFUN (xdrstdio_putlong, (XDR *, _CONST long *)); +static bool_t _EXFUN (xdrstdio_putlong, (XDR *, const long *)); static bool_t _EXFUN (xdrstdio_getbytes, (XDR *, char *, u_int)); -static bool_t _EXFUN (xdrstdio_putbytes, (XDR *, _CONST char *, u_int)); +static bool_t _EXFUN (xdrstdio_putbytes, (XDR *, const char *, u_int)); static u_int _EXFUN (xdrstdio_getpos, (XDR *)); static bool_t _EXFUN (xdrstdio_setpos, (XDR *, u_int)); static int32_t * _EXFUN (xdrstdio_inline, (XDR *, u_int)); static bool_t _EXFUN (xdrstdio_getint32, (XDR*, int32_t *)); -static bool_t _EXFUN (xdrstdio_putint32, (XDR*, _CONST int32_t *)); +static bool_t _EXFUN (xdrstdio_putint32, (XDR*, const int32_t *)); /* * Ops vector for stdio type XDR */ -static _CONST struct xdr_ops xdrstdio_ops = { +static const struct xdr_ops xdrstdio_ops = { xdrstdio_getlong, /* deseraialize a long int */ xdrstdio_putlong, /* seraialize a long int */ xdrstdio_getbytes, /* deserialize counted bytes */ @@ -123,7 +123,7 @@ _DEFUN (xdrstdio_getlong, (xdrs, lp), static bool_t _DEFUN (xdrstdio_putlong, (xdrs, lp), XDR * xdrs, - _CONST long *lp) + const long *lp) { u_int32_t temp = htonl ((u_int32_t) * lp); @@ -147,7 +147,7 @@ _DEFUN (xdrstdio_getbytes, (xdrs, addr, len), static bool_t _DEFUN (xdrstdio_putbytes, (xdrs, addr, len), XDR * xdrs, - _CONST char *addr, + const char *addr, u_int len) { if ((len != 0) && (fwrite (addr, (size_t) len, 1, @@ -206,7 +206,7 @@ _DEFUN (xdrstdio_getint32, (xdrs, ip), static bool_t _DEFUN (xdrstdio_putint32, (xdrs, ip), XDR *xdrs, - _CONST int32_t *ip) + const int32_t *ip) { int32_t temp = htonl (*ip); diff --git a/newlib/libm/test/string.c b/newlib/libm/test/string.c index e97dfcc62..e66117fb6 100644 --- a/newlib/libm/test/string.c +++ b/newlib/libm/test/string.c @@ -3,7 +3,7 @@ #include -_CONST char *it = ""; /* Routine name for message routines. */ +const char *it = ""; /* Routine name for message routines. */ int errors = 0; /* Complain if condition is not true. */ diff --git a/newlib/libm/test/test.c b/newlib/libm/test/test.c index b25e4b963..365c4c843 100644 --- a/newlib/libm/test/test.c +++ b/newlib/libm/test/test.c @@ -55,10 +55,10 @@ bt(); } -static _CONST char *iname = "foo"; +static const char *iname = "foo"; void _DEFUN(newfunc,(string), - _CONST char *string) + const char *string) { if (strcmp(iname, string)) { diff --git a/newlib/libm/test/test.h b/newlib/libm/test/test.h index f58fcc96d..440c3850e 100644 --- a/newlib/libm/test/test.h +++ b/newlib/libm/test/test.h @@ -142,4 +142,4 @@ void _EXFUN(test_iok, (int, int)); void _EXFUN(test_eok, (int, int)); void _EXFUN(test_sok, (char *, char*)); void _EXFUN(test_scok, (char *, char*, int)); -void _EXFUN(newfunc,(_CONST char *)); +void _EXFUN(newfunc,(const char *)); diff --git a/winsup/cygwin/libc/strptime.cc b/winsup/cygwin/libc/strptime.cc index 081aca385..4cd9256bc 100644 --- a/winsup/cygwin/libc/strptime.cc +++ b/winsup/cygwin/libc/strptime.cc @@ -68,7 +68,7 @@ __weak_alias(strptime,_strptime) #define ALT_O 0x02 #define LEGAL_ALT(x) { if (alt_format & ~(x)) return NULL; } -static _CONST int _DAYS_BEFORE_MONTH[12] = +static const int _DAYS_BEFORE_MONTH[12] = {0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334}; #define SET_MDAY 1 From 2310096fbc94133d23abd9f12d6b67e2584a51a9 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:28:42 -0600 Subject: [PATCH 207/649] ansification: remove _DOTS Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/_ansi.h | 2 -- newlib/libc/posix/execl.c | 2 +- newlib/libc/posix/execle.c | 2 +- newlib/libc/posix/execlp.c | 2 +- newlib/libc/stdio/asiprintf.c | 4 ++-- newlib/libc/stdio/asniprintf.c | 4 ++-- newlib/libc/stdio/asnprintf.c | 4 ++-- newlib/libc/stdio/asprintf.c | 4 ++-- newlib/libc/stdio/diprintf.c | 4 ++-- newlib/libc/stdio/dprintf.c | 4 ++-- newlib/libc/stdio/fiprintf.c | 4 ++-- newlib/libc/stdio/fprintf.c | 4 ++-- newlib/libc/stdio/fwprintf.c | 4 ++-- newlib/libc/stdio/iprintf.c | 4 ++-- newlib/libc/stdio/printf.c | 4 ++-- newlib/libc/stdio/siprintf.c | 4 ++-- newlib/libc/stdio/siscanf.c | 4 ++-- newlib/libc/stdio/sniprintf.c | 4 ++-- newlib/libc/stdio/snprintf.c | 4 ++-- newlib/libc/stdio/sprintf.c | 4 ++-- newlib/libc/stdio/sscanf.c | 4 ++-- newlib/libc/stdio/swprintf.c | 4 ++-- newlib/libc/stdio/wprintf.c | 4 ++-- newlib/libc/syscalls/sysopen.c | 2 +- newlib/libc/xdr/xdr_private.c | 2 +- 25 files changed, 43 insertions(+), 45 deletions(-) diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index b0ce3bd4e..a09bfac08 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -51,7 +51,6 @@ #define _NOARGS void #define _VOLATILE volatile #define _SIGNED signed -#define _DOTS , ... #define _VOID void #ifdef __CYGWIN__ #define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW @@ -78,7 +77,6 @@ #define _NOARGS #define _VOLATILE #define _SIGNED -#define _DOTS #define _VOID void #define _EXFUN(name, proto) name() #define _EXFUN_NOTHROW(name, proto) name() diff --git a/newlib/libc/posix/execl.c b/newlib/libc/posix/execl.c index fbad9f3f8..e25f21917 100644 --- a/newlib/libc/posix/execl.c +++ b/newlib/libc/posix/execl.c @@ -20,7 +20,7 @@ static char ***p_environ = &environ; int _DEFUN(execl, (path, arg0, ...), const char *path, - const char *arg0 _DOTS) + const char *arg0, ...) #else diff --git a/newlib/libc/posix/execle.c b/newlib/libc/posix/execle.c index c18555c02..67387f545 100644 --- a/newlib/libc/posix/execle.c +++ b/newlib/libc/posix/execle.c @@ -15,7 +15,7 @@ int _DEFUN(execle, (path, arg0, ...), const char *path, - const char *arg0 _DOTS) + const char *arg0, ...) #else diff --git a/newlib/libc/posix/execlp.c b/newlib/libc/posix/execlp.c index 6b9c2f7e9..f1de21f1c 100644 --- a/newlib/libc/posix/execlp.c +++ b/newlib/libc/posix/execlp.c @@ -15,7 +15,7 @@ int _DEFUN(execlp, (path, arg0, ...), const char *path, - const char *arg0 _DOTS) + const char *arg0, ...) #else diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c index 86996737f..ec60e3ed4 100644 --- a/newlib/libc/stdio/asiprintf.c +++ b/newlib/libc/stdio/asiprintf.c @@ -28,7 +28,7 @@ int _DEFUN(_asiprintf_r, (ptr, strp, fmt), struct _reent *ptr, char **strp, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; @@ -55,7 +55,7 @@ _DEFUN(_asiprintf_r, (ptr, strp, fmt), int _DEFUN(asiprintf, (strp, fmt), char **strp, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c index f033f1b6b..ba4772f08 100644 --- a/newlib/libc/stdio/asniprintf.c +++ b/newlib/libc/stdio/asniprintf.c @@ -18,7 +18,7 @@ _DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt), struct _reent *ptr, char *buf, size_t *lenp, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; @@ -64,7 +64,7 @@ char * _DEFUN(asniprintf, (buf, lenp, fmt), char *buf, size_t *lenp, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c index e80ca06cb..c9a37dbf1 100644 --- a/newlib/libc/stdio/asnprintf.c +++ b/newlib/libc/stdio/asnprintf.c @@ -18,7 +18,7 @@ _DEFUN(_asnprintf_r, (ptr, buf, lenp, fmt), struct _reent *__restrict ptr, char *buf, size_t *lenp, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; @@ -70,7 +70,7 @@ char * _DEFUN(asnprintf, (buf, lenp, fmt), char *__restrict buf, size_t *__restrict lenp, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c index 1e75174d4..b3d9122f5 100644 --- a/newlib/libc/stdio/asprintf.c +++ b/newlib/libc/stdio/asprintf.c @@ -28,7 +28,7 @@ int _DEFUN(_asprintf_r, (ptr, strp, fmt), struct _reent *ptr, char **__restrict strp, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; @@ -61,7 +61,7 @@ _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...) int _DEFUN(asprintf, (strp, fmt), char **__restrict strp, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/diprintf.c b/newlib/libc/stdio/diprintf.c index f57cbac81..0059e044b 100644 --- a/newlib/libc/stdio/diprintf.c +++ b/newlib/libc/stdio/diprintf.c @@ -52,7 +52,7 @@ int _DEFUN(_diprintf_r, (ptr, fd, format), struct _reent *ptr, int fd, - const char *format _DOTS) + const char *format, ...) { va_list ap; int n; @@ -68,7 +68,7 @@ _DEFUN(_diprintf_r, (ptr, fd, format), int _DEFUN(diprintf, (fd, format), int fd, - const char *format _DOTS) + const char *format, ...) { va_list ap; int n; diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c index 831fe208c..5fd45049b 100644 --- a/newlib/libc/stdio/dprintf.c +++ b/newlib/libc/stdio/dprintf.c @@ -56,7 +56,7 @@ int _DEFUN(_dprintf_r, (ptr, fd, format), struct _reent *ptr, int fd, - const char *__restrict format _DOTS) + const char *__restrict format, ...) { va_list ap; int n; @@ -78,7 +78,7 @@ _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...) int _DEFUN(dprintf, (fd, format), int fd, - const char *__restrict format _DOTS) + const char *__restrict format, ...) { va_list ap; int n; diff --git a/newlib/libc/stdio/fiprintf.c b/newlib/libc/stdio/fiprintf.c index 1510556b2..e86bf86e5 100644 --- a/newlib/libc/stdio/fiprintf.c +++ b/newlib/libc/stdio/fiprintf.c @@ -25,7 +25,7 @@ int _DEFUN(_fiprintf_r, (ptr, fp, fmt), struct _reent *ptr, FILE * fp, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; @@ -41,7 +41,7 @@ _DEFUN(_fiprintf_r, (ptr, fp, fmt), int _DEFUN(fiprintf, (fp, fmt), FILE * fp, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/fprintf.c b/newlib/libc/stdio/fprintf.c index 6a98237a2..9dab2cd19 100644 --- a/newlib/libc/stdio/fprintf.c +++ b/newlib/libc/stdio/fprintf.c @@ -25,7 +25,7 @@ int _DEFUN(_fprintf_r, (ptr, fp, fmt), struct _reent *ptr, FILE *__restrict fp, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; @@ -47,7 +47,7 @@ _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...) int _DEFUN(fprintf, (fp, fmt), FILE *__restrict fp, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/fwprintf.c b/newlib/libc/stdio/fwprintf.c index 00a8d41f9..b7604aafe 100644 --- a/newlib/libc/stdio/fwprintf.c +++ b/newlib/libc/stdio/fwprintf.c @@ -26,7 +26,7 @@ int _DEFUN(_fwprintf_r, (ptr, fp, fmt), struct _reent *ptr, FILE *fp, - const wchar_t *fmt _DOTS) + const wchar_t *fmt, ...) { int ret; va_list ap; @@ -42,7 +42,7 @@ _DEFUN(_fwprintf_r, (ptr, fp, fmt), int _DEFUN(fwprintf, (fp, fmt), FILE *__restrict fp, - const wchar_t *__restrict fmt _DOTS) + const wchar_t *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/iprintf.c b/newlib/libc/stdio/iprintf.c index 6c30c4257..571d826e5 100644 --- a/newlib/libc/stdio/iprintf.c +++ b/newlib/libc/stdio/iprintf.c @@ -26,7 +26,7 @@ int _DEFUN(iprintf, (fmt), - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; @@ -44,7 +44,7 @@ _DEFUN(iprintf, (fmt), int _DEFUN(_iprintf_r, (ptr, fmt), struct _reent *ptr, - const char *fmt _DOTS) + const char *fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/printf.c b/newlib/libc/stdio/printf.c index ba5b76850..73986776b 100644 --- a/newlib/libc/stdio/printf.c +++ b/newlib/libc/stdio/printf.c @@ -25,7 +25,7 @@ int _DEFUN(_printf_r, (ptr, fmt), struct _reent *ptr, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; @@ -47,7 +47,7 @@ _EXFUN(_iprintf_r, (struct _reent *, const char *, ...) int _DEFUN(printf, (fmt), - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index e33687563..2251e0912 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -107,7 +107,7 @@ int _DEFUN(_siprintf_r, (ptr, str, fmt), struct _reent *ptr, char *str, - const char *fmt _DOTS) + const char *fmt, ...) #else _siprintf_r(ptr, str, fmt, va_alist) struct _reent *ptr; @@ -141,7 +141,7 @@ int #ifdef _HAVE_STDC _DEFUN(siprintf, (str, fmt), char *str, - const char *fmt _DOTS) + const char *fmt, ...) #else siprintf(str, fmt, va_alist) char *str; diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c index d5e62b40d..bd1528b04 100644 --- a/newlib/libc/stdio/siscanf.c +++ b/newlib/libc/stdio/siscanf.c @@ -89,7 +89,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(siscanf, (str, fmt), const char *str, - const char *fmt _DOTS) + const char *fmt, ...) #else int siscanf(str, fmt, va_alist) @@ -126,7 +126,7 @@ int _DEFUN(_siscanf_r, (ptr, str, fmt), struct _reent *ptr, const char *str, - const char *fmt _DOTS) + const char *fmt, ...) #else int _siscanf_r(ptr, str, fmt, va_alist) diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c index 90e30271e..d7bb9a40e 100644 --- a/newlib/libc/stdio/sniprintf.c +++ b/newlib/libc/stdio/sniprintf.c @@ -36,7 +36,7 @@ _DEFUN (_sniprintf_r, (ptr, str, size, fmt), struct _reent *ptr, char *str, size_t size, - const char *fmt _DOTS) + const char *fmt, ...) #else _sniprintf_r (ptr, str, size, fmt, va_alist) struct _reent *ptr; @@ -80,7 +80,7 @@ int _DEFUN (sniprintf, (str, size, fmt), char *str, size_t size, - const char *fmt _DOTS) + const char *fmt, ...) #else sniprintf (str, size, fmt, va_alist) char *str; diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c index aa7a6364d..ab33dfb47 100644 --- a/newlib/libc/stdio/snprintf.c +++ b/newlib/libc/stdio/snprintf.c @@ -35,7 +35,7 @@ _DEFUN(_snprintf_r, (ptr, str, size, fmt), struct _reent *ptr, char *__restrict str, size_t size, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) #else _snprintf_r(ptr, str, size, fmt, va_alist) struct _reent *ptr; @@ -85,7 +85,7 @@ int _DEFUN(snprintf, (str, size, fmt), char *__restrict str, size_t size, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) #else snprintf(str, size, fmt, va_alist) char *str; diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index 1948ff158..35d39618f 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -583,7 +583,7 @@ int _DEFUN(_sprintf_r, (ptr, str, fmt), struct _reent *ptr, char *__restrict str, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) #else _sprintf_r(ptr, str, fmt, va_alist) struct _reent *ptr; @@ -623,7 +623,7 @@ int #ifdef _HAVE_STDC _DEFUN(sprintf, (str, fmt), char *__restrict str, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) #else sprintf(str, fmt, va_alist) char *str; diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index 8a3232525..92983b1ec 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -428,7 +428,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN(sscanf, (str, fmt), const char *__restrict str, - const char * fmt _DOTS) + const char * fmt, ...) #else int sscanf(str, fmt, va_alist) @@ -471,7 +471,7 @@ int _DEFUN(_sscanf_r, (ptr, str, fmt), struct _reent *ptr, const char *__restrict str, - const char *__restrict fmt _DOTS) + const char *__restrict fmt, ...) #else int _sscanf_r(ptr, str, fmt, va_alist) diff --git a/newlib/libc/stdio/swprintf.c b/newlib/libc/stdio/swprintf.c index 47a2657a2..427e03ed5 100644 --- a/newlib/libc/stdio/swprintf.c +++ b/newlib/libc/stdio/swprintf.c @@ -557,7 +557,7 @@ _DEFUN(_swprintf_r, (ptr, str, size, fmt), struct _reent *ptr, wchar_t *str, size_t size, - const wchar_t *fmt _DOTS) + const wchar_t *fmt, ...) { int ret; va_list ap; @@ -597,7 +597,7 @@ int _DEFUN(swprintf, (str, size, fmt), wchar_t *__restrict str, size_t size, - const wchar_t *__restrict fmt _DOTS) + const wchar_t *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/wprintf.c b/newlib/libc/stdio/wprintf.c index 99c5696df..ef212d851 100644 --- a/newlib/libc/stdio/wprintf.c +++ b/newlib/libc/stdio/wprintf.c @@ -26,7 +26,7 @@ int _DEFUN(_wprintf_r, (ptr, fmt), struct _reent *ptr, - const wchar_t *fmt _DOTS) + const wchar_t *fmt, ...) { int ret; va_list ap; @@ -42,7 +42,7 @@ _DEFUN(_wprintf_r, (ptr, fmt), int _DEFUN(wprintf, (fmt), - const wchar_t *__restrict fmt _DOTS) + const wchar_t *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/syscalls/sysopen.c b/newlib/libc/syscalls/sysopen.c index 3909564cf..36523fc67 100644 --- a/newlib/libc/syscalls/sysopen.c +++ b/newlib/libc/syscalls/sysopen.c @@ -12,7 +12,7 @@ int _DEFUN (open, (file, flags, ...), const char *file, - int flags _DOTS) + int flags, ...) { va_list ap; int ret; diff --git a/newlib/libc/xdr/xdr_private.c b/newlib/libc/xdr/xdr_private.c index 79358a518..64eac9d23 100644 --- a/newlib/libc/xdr/xdr_private.c +++ b/newlib/libc/xdr/xdr_private.c @@ -49,7 +49,7 @@ _DEFUN (xdr_vwarnx, (format, ap), void _DEFUN (xdr_warnx, (fmt), - const char *fmt _DOTS) + const char *fmt, ...) { va_list ap; va_start (ap, fmt); From e13e191b6052a62701d8fb22c3660df23d3b6ec1 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:32:27 -0600 Subject: [PATCH 208/649] ansification: remove _NOARGS Signed-off-by: Yaakov Selkowitz --- libgloss/libnosys/fork.c | 2 +- libgloss/libnosys/getpid.c | 2 +- libgloss/mcore/cmb-inbyte.c | 2 +- newlib/libc/include/_ansi.h | 4 +--- 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libgloss/libnosys/fork.c b/libgloss/libnosys/fork.c index f5795cb49..5fbf68b93 100644 --- a/libgloss/libnosys/fork.c +++ b/libgloss/libnosys/fork.c @@ -12,7 +12,7 @@ extern int errno; int _DEFUN (_fork, (), - _NOARGS) + void) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/getpid.c b/libgloss/libnosys/getpid.c index 0ea19238e..9ed416c6b 100644 --- a/libgloss/libnosys/getpid.c +++ b/libgloss/libnosys/getpid.c @@ -12,7 +12,7 @@ extern int errno; int _DEFUN (_getpid, (), - _NOARGS) + void) { errno = ENOSYS; return -1; diff --git a/libgloss/mcore/cmb-inbyte.c b/libgloss/mcore/cmb-inbyte.c index 0b0b8f5d8..839ffe605 100644 --- a/libgloss/mcore/cmb-inbyte.c +++ b/libgloss/mcore/cmb-inbyte.c @@ -16,7 +16,7 @@ int _DEFUN (inbyte, (), - _NOARGS) + void) { return -1; diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index a09bfac08..41623f7a7 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -48,7 +48,6 @@ #ifdef _HAVE_STDC #define _PTR void * -#define _NOARGS void #define _VOLATILE volatile #define _SIGNED signed #define _VOID void @@ -64,7 +63,7 @@ #define _EXFNPTR(name, proto) (* name) proto #endif #define _DEFUN(name, arglist, args) name(args) -#define _DEFUN_VOID(name) name(_NOARGS) +#define _DEFUN_VOID(name) name(void) #define _CAST_VOID (void) #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double @@ -74,7 +73,6 @@ #endif #else #define _PTR char * -#define _NOARGS #define _VOLATILE #define _SIGNED #define _VOID void From eea249da3bc81776246ad5163f5eb887afdd3659 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:41:16 -0600 Subject: [PATCH 209/649] ansification: remove _PARAMS Signed-off-by: Yaakov Selkowitz --- libgloss/aarch64/_exit.c | 2 +- libgloss/aarch64/_kill.c | 2 +- libgloss/aarch64/svc.h | 6 +- libgloss/aarch64/syscalls.c | 60 ++-- libgloss/arm/_exit.c | 4 +- libgloss/arm/_kill.c | 2 +- libgloss/arm/swi.h | 6 +- libgloss/arm/syscalls.c | 60 ++-- newlib/libc/include/_ansi.h | 6 - newlib/libc/include/malloc.h | 54 +-- newlib/libc/include/math.h | 440 +++++++++++------------ newlib/libc/include/reent.h | 50 +-- newlib/libc/include/sys/_default_fcntl.h | 18 +- newlib/libc/include/sys/errno.h | 2 +- newlib/libc/include/sys/reent.h | 2 +- newlib/libc/include/sys/timeb.h | 2 +- newlib/libc/machine/cris/sys/errno.h | 2 +- newlib/libc/machine/cris/sys/fcntl.h | 12 +- newlib/libc/machine/powerpc/ufix64toa.c | 4 +- newlib/libc/machine/powerpc/vfprintf.c | 22 +- newlib/libc/search/qsort.c | 4 +- newlib/libc/stdio/nano-vfprintf_local.h | 4 +- newlib/libc/stdio/nano-vfscanf_i.c | 2 +- newlib/libc/stdio/vfprintf.c | 8 +- newlib/libc/stdio/vfscanf.c | 2 +- newlib/libc/stdio/vfwprintf.c | 8 +- newlib/libc/stdio/vfwscanf.c | 6 +- newlib/libc/stdlib/atexit.h | 4 +- newlib/libc/stdlib/cxa_atexit.c | 2 +- newlib/libc/stdlib/exit.c | 2 +- newlib/libc/stdlib/setenv.c | 2 +- newlib/libc/stdlib/setenv_r.c | 2 +- newlib/libc/string/strerror.c | 2 +- newlib/libc/sys/arm/syscalls.c | 60 ++-- newlib/libc/sys/linux/sys/errno.h | 2 +- newlib/libc/sys/linux/sys/fcntl.h | 10 +- newlib/libc/sys/phoenix/sys/errno.h | 2 +- newlib/libc/sys/sparc64/sys/fcntl.h | 6 +- winsup/cygwin/include/cygwin/stdlib.h | 4 +- winsup/cygwin/include/fcntl.h | 4 +- winsup/cygwin/include/sys/file.h | 2 +- 41 files changed, 444 insertions(+), 450 deletions(-) diff --git a/libgloss/aarch64/_exit.c b/libgloss/aarch64/_exit.c index 1a6b01532..16564bbda 100644 --- a/libgloss/aarch64/_exit.c +++ b/libgloss/aarch64/_exit.c @@ -26,7 +26,7 @@ #include <_ansi.h> #include "svc.h" -void _exit _PARAMS ((int)); +void _exit (int); __attribute__ ((noreturn)) void _exit (int status) diff --git a/libgloss/aarch64/_kill.c b/libgloss/aarch64/_kill.c index 1d42371f0..8109ace12 100644 --- a/libgloss/aarch64/_kill.c +++ b/libgloss/aarch64/_kill.c @@ -28,7 +28,7 @@ #include #include "svc.h" -int _kill _PARAMS ((int, int)); +int _kill (int, int); int _kill (int pid, int sig) diff --git a/libgloss/aarch64/svc.h b/libgloss/aarch64/svc.h index 60bd00fca..2c3da1317 100644 --- a/libgloss/aarch64/svc.h +++ b/libgloss/aarch64/svc.h @@ -72,9 +72,9 @@ #define SH_EXT_STDOUT_STDERR_BITNUM 0x1 #if !defined (__ASSEMBLER__) -extern int _get_semihosting_exts _PARAMS ((char*, int, int)); -extern int _has_ext_exit_extended _PARAMS ((void)); -extern int _has_ext_stdout_stderr _PARAMS ((void)); +extern int _get_semihosting_exts (char*, int, int); +extern int _has_ext_exit_extended (void); +extern int _has_ext_stdout_stderr (void); #endif #if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__) diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c index 4de4e0dcc..5aeb3d0b5 100644 --- a/libgloss/aarch64/syscalls.c +++ b/libgloss/aarch64/syscalls.c @@ -47,37 +47,37 @@ (param_block_t)(unsigned long) (PTR) /* Forward prototypes. */ -int _system _PARAMS ((const char *)); -int _rename _PARAMS ((const char *, const char *)); -int _isatty _PARAMS ((int)); -clock_t _times _PARAMS ((struct tms *)); -int _gettimeofday _PARAMS ((struct timeval *, void *)); -int _unlink _PARAMS ((const char *)); -int _link _PARAMS ((void)); -int _stat _PARAMS ((const char *, struct stat *)); -int _fstat _PARAMS ((int, struct stat *)); -int _swistat _PARAMS ((int fd, struct stat * st)); -caddr_t _sbrk _PARAMS ((int)); -int _getpid _PARAMS ((int)); -int _close _PARAMS ((int)); -clock_t _clock _PARAMS ((void)); -int _swiclose _PARAMS ((int)); -int _open _PARAMS ((const char *, int, ...)); -int _swiopen _PARAMS ((const char *, int)); -int _write _PARAMS ((int, char *, int)); -int _swiwrite _PARAMS ((int, char *, int)); -int _lseek _PARAMS ((int, int, int)); -int _swilseek _PARAMS ((int, int, int)); -int _read _PARAMS ((int, char *, int)); -int _swiread _PARAMS ((int, char *, int)); -void initialise_monitor_handles _PARAMS ((void)); +int _system (const char *); +int _rename (const char *, const char *); +int _isatty (int); +clock_t _times (struct tms *); +int _gettimeofday (struct timeval *, void *); +int _unlink (const char *); +int _link (void); +int _stat (const char *, struct stat *); +int _fstat (int, struct stat *); +int _swistat (int fd, struct stat * st); +caddr_t _sbrk (int); +int _getpid (int); +int _close (int); +clock_t _clock (void); +int _swiclose (int); +int _open (const char *, int, ...); +int _swiopen (const char *, int); +int _write (int, char *, int); +int _swiwrite (int, char *, int); +int _lseek (int, int, int); +int _swilseek (int, int, int); +int _read (int, char *, int); +int _swiread (int, char *, int); +void initialise_monitor_handles (void); -static int checkerror _PARAMS ((int)); -static int error _PARAMS ((int)); -static int get_errno _PARAMS ((void)); +static int checkerror (int); +static int error (int); +static int get_errno (void); /* Semihosting utilities. */ -static void initialise_semihosting_exts _PARAMS ((void)); +static void initialise_semihosting_exts (void); /* Struct used to keep track of the file position, just so we can implement fseek(fh,x,SEEK_CUR). */ @@ -108,8 +108,8 @@ struct fdent static struct fdent openfiles[MAX_OPEN_FILES]; -static struct fdent *findslot _PARAMS ((int)); -static int newslot _PARAMS ((void)); +static struct fdent *findslot (int); +static int newslot (void); /* Register name faking - works in collusion with the linker. */ #ifdef __ILP32__ diff --git a/libgloss/arm/_exit.c b/libgloss/arm/_exit.c index ed0087637..ca2d21c43 100644 --- a/libgloss/arm/_exit.c +++ b/libgloss/arm/_exit.c @@ -1,7 +1,7 @@ #include <_ansi.h> -int _kill _PARAMS ((int, int)); -void _exit _PARAMS ((int)); +int _kill (int, int); +void _exit (int); void _exit (int status) diff --git a/libgloss/arm/_kill.c b/libgloss/arm/_kill.c index 8871d3c36..fc77e8097 100644 --- a/libgloss/arm/_kill.c +++ b/libgloss/arm/_kill.c @@ -2,7 +2,7 @@ #include #include "swi.h" -int _kill _PARAMS ((int, int)); +int _kill (int, int); int _kill (int pid, int sig) diff --git a/libgloss/arm/swi.h b/libgloss/arm/swi.h index 72cb838dc..67eb36b3f 100644 --- a/libgloss/arm/swi.h +++ b/libgloss/arm/swi.h @@ -96,9 +96,9 @@ #define SH_EXT_STDOUT_STDERR_BITNUM 0x1 #if !defined (__ASSEMBLER__) -extern int _get_semihosting_exts _PARAMS ((char*, int, int)); -extern int _has_ext_exit_extended _PARAMS ((void)); -extern int _has_ext_stdout_stderr _PARAMS ((void)); +extern int _get_semihosting_exts (char*, int, int); +extern int _has_ext_exit_extended (void); +extern int _has_ext_stdout_stderr (void); #endif #if defined(ARM_RDI_MONITOR) && !defined(__ASSEMBLER__) diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index 80713680b..b76858fc9 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -18,37 +18,37 @@ #include "swi.h" /* Forward prototypes. */ -int _system _PARAMS ((const char *)); -int _rename _PARAMS ((const char *, const char *)); -int _isatty _PARAMS ((int)); -clock_t _times _PARAMS ((struct tms *)); -int _gettimeofday _PARAMS ((struct timeval *, void *)); -int _unlink _PARAMS ((const char *)); -int _link _PARAMS ((void)); -int _stat _PARAMS ((const char *, struct stat *)); -int _fstat _PARAMS ((int, struct stat *)); -int _swistat _PARAMS ((int fd, struct stat * st)); -caddr_t _sbrk _PARAMS ((int)); -int _getpid _PARAMS ((int)); -int _close _PARAMS ((int)); -clock_t _clock _PARAMS ((void)); -int _swiclose _PARAMS ((int)); -int _open _PARAMS ((const char *, int, ...)); -int _swiopen _PARAMS ((const char *, int)); -int _write _PARAMS ((int, char *, int)); -int _swiwrite _PARAMS ((int, char *, int)); -int _lseek _PARAMS ((int, int, int)); -int _swilseek _PARAMS ((int, int, int)); -int _read _PARAMS ((int, char *, int)); -int _swiread _PARAMS ((int, char *, int)); -void initialise_monitor_handles _PARAMS ((void)); +int _system (const char *); +int _rename (const char *, const char *); +int _isatty (int); +clock_t _times (struct tms *); +int _gettimeofday (struct timeval *, void *); +int _unlink (const char *); +int _link (void); +int _stat (const char *, struct stat *); +int _fstat (int, struct stat *); +int _swistat (int fd, struct stat * st); +caddr_t _sbrk (int); +int _getpid (int); +int _close (int); +clock_t _clock (void); +int _swiclose (int); +int _open (const char *, int, ...); +int _swiopen (const char *, int); +int _write (int, char *, int); +int _swiwrite (int, char *, int); +int _lseek (int, int, int); +int _swilseek (int, int, int); +int _read (int, char *, int); +int _swiread (int, char *, int); +void initialise_monitor_handles (void); -static int checkerror _PARAMS ((int)); -static int error _PARAMS ((int)); -static int get_errno _PARAMS ((void)); +static int checkerror (int); +static int error (int); +static int get_errno (void); /* Semihosting utilities. */ -static void initialise_semihosting_exts _PARAMS ((void)); +static void initialise_semihosting_exts (void); /* Struct used to keep track of the file position, just so we can implement fseek(fh,x,SEEK_CUR). */ @@ -77,8 +77,8 @@ struct fdent static struct fdent openfiles [MAX_OPEN_FILES]; -static struct fdent* findslot _PARAMS ((int)); -static int newslot _PARAMS ((void)); +static struct fdent* findslot (int); +static int newslot (void); /* Register name faking - works in collusion with the linker. */ register char * stack_ptr asm ("sp"); diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 41623f7a7..5e2eac93a 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -68,9 +68,6 @@ #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif -#ifndef _PARAMS -#define _PARAMS(paramlist) paramlist -#endif #else #define _PTR char * #define _VOLATILE @@ -82,9 +79,6 @@ #define _DEFUN_VOID(name) name() #define _CAST_VOID #define _LONG_DOUBLE double -#ifndef _PARAMS -#define _PARAMS(paramlist) () -#endif #endif /* Support gcc's __attribute__ facility. */ diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h index 41b5efdc0..b1e0a0946 100644 --- a/newlib/libc/include/malloc.h +++ b/newlib/libc/include/malloc.h @@ -34,113 +34,113 @@ struct mallinfo { /* The routines. */ -extern _PTR malloc _PARAMS ((size_t)); +extern _PTR malloc (size_t); #ifdef __CYGWIN__ #undef _malloc_r #define _malloc_r(r, s) malloc (s) #else -extern _PTR _malloc_r _PARAMS ((struct _reent *, size_t)); +extern _PTR _malloc_r (struct _reent *, size_t); #endif -extern _VOID free _PARAMS ((_PTR)); +extern _VOID free (_PTR); #ifdef __CYGWIN__ #undef _free_r #define _free_r(r, p) free (p) #else -extern _VOID _free_r _PARAMS ((struct _reent *, _PTR)); +extern _VOID _free_r (struct _reent *, _PTR); #endif -extern _PTR realloc _PARAMS ((_PTR, size_t)); +extern _PTR realloc (_PTR, size_t); #ifdef __CYGWIN__ #undef _realloc_r #define _realloc_r(r, p, s) realloc (p, s) #else -extern _PTR _realloc_r _PARAMS ((struct _reent *, _PTR, size_t)); +extern _PTR _realloc_r (struct _reent *, _PTR, size_t); #endif -extern _PTR calloc _PARAMS ((size_t, size_t)); +extern _PTR calloc (size_t, size_t); #ifdef __CYGWIN__ #undef _calloc_r #define _calloc_r(r, s1, s2) calloc (s1, s2); #else -extern _PTR _calloc_r _PARAMS ((struct _reent *, size_t, size_t)); +extern _PTR _calloc_r (struct _reent *, size_t, size_t); #endif -extern _PTR memalign _PARAMS ((size_t, size_t)); +extern _PTR memalign (size_t, size_t); #ifdef __CYGWIN__ #undef _memalign_r #define _memalign_r(r, s1, s2) memalign (s1, s2); #else -extern _PTR _memalign_r _PARAMS ((struct _reent *, size_t, size_t)); +extern _PTR _memalign_r (struct _reent *, size_t, size_t); #endif -extern struct mallinfo mallinfo _PARAMS ((void)); +extern struct mallinfo mallinfo (void); #ifdef __CYGWIN__ #undef _mallinfo_r #define _mallinfo_r(r) mallinfo () #else -extern struct mallinfo _mallinfo_r _PARAMS ((struct _reent *)); +extern struct mallinfo _mallinfo_r (struct _reent *); #endif -extern void malloc_stats _PARAMS ((void)); +extern void malloc_stats (void); #ifdef __CYGWIN__ #undef _malloc_stats_r #define _malloc_stats_r(r) malloc_stats () #else -extern void _malloc_stats_r _PARAMS ((struct _reent *)); +extern void _malloc_stats_r (struct _reent *); #endif -extern int mallopt _PARAMS ((int, int)); +extern int mallopt (int, int); #ifdef __CYGWIN__ #undef _mallopt_r #define _mallopt_r(i1, i2) mallopt (i1, i2) #else -extern int _mallopt_r _PARAMS ((struct _reent *, int, int)); +extern int _mallopt_r (struct _reent *, int, int); #endif -extern size_t malloc_usable_size _PARAMS ((_PTR)); +extern size_t malloc_usable_size (_PTR); #ifdef __CYGWIN__ #undef _malloc_usable_size_r #define _malloc_usable_size_r(r, p) malloc_usable_size (p) #else -extern size_t _malloc_usable_size_r _PARAMS ((struct _reent *, _PTR)); +extern size_t _malloc_usable_size_r (struct _reent *, _PTR); #endif /* These aren't too useful on an embedded system, but we define them anyhow. */ -extern _PTR valloc _PARAMS ((size_t)); +extern _PTR valloc (size_t); #ifdef __CYGWIN__ #undef _valloc_r #define _valloc_r(r, s) valloc (s) #else -extern _PTR _valloc_r _PARAMS ((struct _reent *, size_t)); +extern _PTR _valloc_r (struct _reent *, size_t); #endif -extern _PTR pvalloc _PARAMS ((size_t)); +extern _PTR pvalloc (size_t); #ifdef __CYGWIN__ #undef _pvalloc_r #define _pvalloc_r(r, s) pvalloc (s) #else -extern _PTR _pvalloc_r _PARAMS ((struct _reent *, size_t)); +extern _PTR _pvalloc_r (struct _reent *, size_t); #endif -extern int malloc_trim _PARAMS ((size_t)); +extern int malloc_trim (size_t); #ifdef __CYGWIN__ #undef _malloc_trim_r #define _malloc_trim_r(r, s) malloc_trim (s) #else -extern int _malloc_trim_r _PARAMS ((struct _reent *, size_t)); +extern int _malloc_trim_r (struct _reent *, size_t); #endif /* A compatibility routine for an earlier version of the allocator. */ -extern _VOID mstats _PARAMS ((char *)); +extern _VOID mstats (char *); #ifdef __CYGWIN__ #undef _mstats_r #define _mstats_r(r, p) mstats (p) #else -extern _VOID _mstats_r _PARAMS ((struct _reent *, char *)); +extern _VOID _mstats_r (struct _reent *, char *); #endif /* SVID2/XPG mallopt options */ @@ -159,7 +159,7 @@ extern _VOID _mstats_r _PARAMS ((struct _reent *, char *)); #ifndef __CYGWIN__ /* Some systems provide this, so do too for compatibility. */ -extern void cfree _PARAMS ((_PTR)); +extern void cfree (_PTR); #endif /* __CYGWIN__ */ #ifdef __cplusplus diff --git a/newlib/libc/include/math.h b/newlib/libc/include/math.h index 2a322ee26..893a5d064 100644 --- a/newlib/libc/include/math.h +++ b/newlib/libc/include/math.h @@ -83,54 +83,54 @@ _BEGIN_STD_C /* Reentrant ANSI C functions. */ #ifndef __math_68881 -extern double atan _PARAMS((double)); -extern double cos _PARAMS((double)); -extern double sin _PARAMS((double)); -extern double tan _PARAMS((double)); -extern double tanh _PARAMS((double)); -extern double frexp _PARAMS((double, int *)); -extern double modf _PARAMS((double, double *)); -extern double ceil _PARAMS((double)); -extern double fabs _PARAMS((double)); -extern double floor _PARAMS((double)); +extern double atan (double); +extern double cos (double); +extern double sin (double); +extern double tan (double); +extern double tanh (double); +extern double frexp (double, int *); +extern double modf (double, double *); +extern double ceil (double); +extern double fabs (double); +extern double floor (double); #endif /* ! defined (__math_68881) */ /* Non reentrant ANSI C functions. */ #ifndef _REENT_ONLY #ifndef __math_68881 -extern double acos _PARAMS((double)); -extern double asin _PARAMS((double)); -extern double atan2 _PARAMS((double, double)); -extern double cosh _PARAMS((double)); -extern double sinh _PARAMS((double)); -extern double exp _PARAMS((double)); -extern double ldexp _PARAMS((double, int)); -extern double log _PARAMS((double)); -extern double log10 _PARAMS((double)); -extern double pow _PARAMS((double, double)); -extern double sqrt _PARAMS((double)); -extern double fmod _PARAMS((double, double)); +extern double acos (double); +extern double asin (double); +extern double atan2 (double, double); +extern double cosh (double); +extern double sinh (double); +extern double exp (double); +extern double ldexp (double, int); +extern double log (double); +extern double log10 (double); +extern double pow (double, double); +extern double sqrt (double); +extern double fmod (double, double); #endif /* ! defined (__math_68881) */ #endif /* ! defined (_REENT_ONLY) */ #if __MISC_VISIBLE -extern int finite _PARAMS((double)); -extern int finitef _PARAMS((float)); -extern int finitel _PARAMS((long double)); -extern int isinff _PARAMS((float)); -extern int isnanf _PARAMS((float)); +extern int finite (double); +extern int finitef (float); +extern int finitel (long double); +extern int isinff (float); +extern int isnanf (float); #ifdef __CYGWIN__ /* not implemented in newlib yet */ -extern int isinfl _PARAMS((long double)); -extern int isnanl _PARAMS((long double)); +extern int isinfl (long double); +extern int isnanl (long double); #endif #if !defined(__cplusplus) || __cplusplus < 201103L -extern int isinf _PARAMS((double)); +extern int isinf (double); #endif #endif /* __MISC_VISIBLE */ #if (__MISC_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 600)) \ && (!defined(__cplusplus) || __cplusplus < 201103L) -extern int isnan _PARAMS((double)); +extern int isnan (double); #endif #if __ISO_C_VISIBLE >= 1999 @@ -287,128 +287,128 @@ extern int __signbitd (double x); /* Non ANSI double precision functions. */ -extern double infinity _PARAMS((void)); -extern double nan _PARAMS((const char *)); -extern double copysign _PARAMS((double, double)); -extern double logb _PARAMS((double)); -extern int ilogb _PARAMS((double)); +extern double infinity (void); +extern double nan (const char *); +extern double copysign (double, double); +extern double logb (double); +extern int ilogb (double); -extern double asinh _PARAMS((double)); -extern double cbrt _PARAMS((double)); -extern double nextafter _PARAMS((double, double)); -extern double rint _PARAMS((double)); -extern double scalbn _PARAMS((double, int)); +extern double asinh (double); +extern double cbrt (double); +extern double nextafter (double, double); +extern double rint (double); +extern double scalbn (double, int); -extern double exp2 _PARAMS((double)); -extern double scalbln _PARAMS((double, long int)); -extern double tgamma _PARAMS((double)); -extern double nearbyint _PARAMS((double)); -extern long int lrint _PARAMS((double)); -extern long long int llrint _PARAMS((double)); -extern double round _PARAMS((double)); -extern long int lround _PARAMS((double)); -extern long long int llround _PARAMS((double)); -extern double trunc _PARAMS((double)); -extern double remquo _PARAMS((double, double, int *)); -extern double fdim _PARAMS((double, double)); -extern double fmax _PARAMS((double, double)); -extern double fmin _PARAMS((double, double)); -extern double fma _PARAMS((double, double, double)); +extern double exp2 (double); +extern double scalbln (double, long int); +extern double tgamma (double); +extern double nearbyint (double); +extern long int lrint (double); +extern long long int llrint (double); +extern double round (double); +extern long int lround (double); +extern long long int llround (double); +extern double trunc (double); +extern double remquo (double, double, int *); +extern double fdim (double, double); +extern double fmax (double, double); +extern double fmin (double, double); +extern double fma (double, double, double); #ifndef __math_68881 -extern double log1p _PARAMS((double)); -extern double expm1 _PARAMS((double)); +extern double log1p (double); +extern double expm1 (double); #endif /* ! defined (__math_68881) */ #ifndef _REENT_ONLY -extern double acosh _PARAMS((double)); -extern double atanh _PARAMS((double)); -extern double remainder _PARAMS((double, double)); -extern double gamma _PARAMS((double)); -extern double lgamma _PARAMS((double)); -extern double erf _PARAMS((double)); -extern double erfc _PARAMS((double)); -extern double log2 _PARAMS((double)); +extern double acosh (double); +extern double atanh (double); +extern double remainder (double, double); +extern double gamma (double); +extern double lgamma (double); +extern double erf (double); +extern double erfc (double); +extern double log2 (double); #if !defined(__cplusplus) #define log2(x) (log (x) / _M_LN2) #endif #ifndef __math_68881 -extern double hypot _PARAMS((double, double)); +extern double hypot (double, double); #endif #endif /* ! defined (_REENT_ONLY) */ /* Single precision versions of ANSI functions. */ -extern float atanf _PARAMS((float)); -extern float cosf _PARAMS((float)); -extern float sinf _PARAMS((float)); -extern float tanf _PARAMS((float)); -extern float tanhf _PARAMS((float)); -extern float frexpf _PARAMS((float, int *)); -extern float modff _PARAMS((float, float *)); -extern float ceilf _PARAMS((float)); -extern float fabsf _PARAMS((float)); -extern float floorf _PARAMS((float)); +extern float atanf (float); +extern float cosf (float); +extern float sinf (float); +extern float tanf (float); +extern float tanhf (float); +extern float frexpf (float, int *); +extern float modff (float, float *); +extern float ceilf (float); +extern float fabsf (float); +extern float floorf (float); #ifndef _REENT_ONLY -extern float acosf _PARAMS((float)); -extern float asinf _PARAMS((float)); -extern float atan2f _PARAMS((float, float)); -extern float coshf _PARAMS((float)); -extern float sinhf _PARAMS((float)); -extern float expf _PARAMS((float)); -extern float ldexpf _PARAMS((float, int)); -extern float logf _PARAMS((float)); -extern float log10f _PARAMS((float)); -extern float powf _PARAMS((float, float)); -extern float sqrtf _PARAMS((float)); -extern float fmodf _PARAMS((float, float)); +extern float acosf (float); +extern float asinf (float); +extern float atan2f (float, float); +extern float coshf (float); +extern float sinhf (float); +extern float expf (float); +extern float ldexpf (float, int); +extern float logf (float); +extern float log10f (float); +extern float powf (float, float); +extern float sqrtf (float); +extern float fmodf (float, float); #endif /* ! defined (_REENT_ONLY) */ /* Other single precision functions. */ -extern float exp2f _PARAMS((float)); -extern float scalblnf _PARAMS((float, long int)); -extern float tgammaf _PARAMS((float)); -extern float nearbyintf _PARAMS((float)); -extern long int lrintf _PARAMS((float)); -extern long long int llrintf _PARAMS((float)); -extern float roundf _PARAMS((float)); -extern long int lroundf _PARAMS((float)); -extern long long int llroundf _PARAMS((float)); -extern float truncf _PARAMS((float)); -extern float remquof _PARAMS((float, float, int *)); -extern float fdimf _PARAMS((float, float)); -extern float fmaxf _PARAMS((float, float)); -extern float fminf _PARAMS((float, float)); -extern float fmaf _PARAMS((float, float, float)); +extern float exp2f (float); +extern float scalblnf (float, long int); +extern float tgammaf (float); +extern float nearbyintf (float); +extern long int lrintf (float); +extern long long int llrintf (float); +extern float roundf (float); +extern long int lroundf (float); +extern long long int llroundf (float); +extern float truncf (float); +extern float remquof (float, float, int *); +extern float fdimf (float, float); +extern float fmaxf (float, float); +extern float fminf (float, float); +extern float fmaf (float, float, float); -extern float infinityf _PARAMS((void)); -extern float nanf _PARAMS((const char *)); -extern float copysignf _PARAMS((float, float)); -extern float logbf _PARAMS((float)); -extern int ilogbf _PARAMS((float)); +extern float infinityf (void); +extern float nanf (const char *); +extern float copysignf (float, float); +extern float logbf (float); +extern int ilogbf (float); -extern float asinhf _PARAMS((float)); -extern float cbrtf _PARAMS((float)); -extern float nextafterf _PARAMS((float, float)); -extern float rintf _PARAMS((float)); -extern float scalbnf _PARAMS((float, int)); -extern float log1pf _PARAMS((float)); -extern float expm1f _PARAMS((float)); +extern float asinhf (float); +extern float cbrtf (float); +extern float nextafterf (float, float); +extern float rintf (float); +extern float scalbnf (float, int); +extern float log1pf (float); +extern float expm1f (float); #ifndef _REENT_ONLY -extern float acoshf _PARAMS((float)); -extern float atanhf _PARAMS((float)); -extern float remainderf _PARAMS((float, float)); -extern float gammaf _PARAMS((float)); -extern float lgammaf _PARAMS((float)); -extern float erff _PARAMS((float)); -extern float erfcf _PARAMS((float)); -extern float log2f _PARAMS((float)); -extern float hypotf _PARAMS((float, float)); +extern float acoshf (float); +extern float atanhf (float); +extern float remainderf (float, float); +extern float gammaf (float); +extern float lgammaf (float); +extern float erff (float); +extern float erfcf (float); +extern float log2f (float); +extern float hypotf (float, float); #endif /* ! defined (_REENT_ONLY) */ /* Newlib doesn't fully support long double math functions so far. @@ -419,141 +419,141 @@ extern float hypotf _PARAMS((float, float)); #if defined (_LDBL_EQ_DBL) || defined (__CYGWIN__) /* Reentrant ANSI C functions. */ #ifndef __math_68881 -extern long double atanl _PARAMS((long double)); -extern long double cosl _PARAMS((long double)); -extern long double sinl _PARAMS((long double)); -extern long double tanl _PARAMS((long double)); -extern long double tanhl _PARAMS((long double)); -extern long double frexpl _PARAMS((long double, int *)); -extern long double modfl _PARAMS((long double, long double *)); -extern long double ceill _PARAMS((long double)); -extern long double fabsl _PARAMS((long double)); -extern long double floorl _PARAMS((long double)); -extern long double log1pl _PARAMS((long double)); -extern long double expm1l _PARAMS((long double)); +extern long double atanl (long double); +extern long double cosl (long double); +extern long double sinl (long double); +extern long double tanl (long double); +extern long double tanhl (long double); +extern long double frexpl (long double, int *); +extern long double modfl (long double, long double *); +extern long double ceill (long double); +extern long double fabsl (long double); +extern long double floorl (long double); +extern long double log1pl (long double); +extern long double expm1l (long double); #endif /* ! defined (__math_68881) */ /* Non reentrant ANSI C functions. */ #ifndef _REENT_ONLY #ifndef __math_68881 -extern long double acosl _PARAMS((long double)); -extern long double asinl _PARAMS((long double)); -extern long double atan2l _PARAMS((long double, long double)); -extern long double coshl _PARAMS((long double)); -extern long double sinhl _PARAMS((long double)); -extern long double expl _PARAMS((long double)); -extern long double ldexpl _PARAMS((long double, int)); -extern long double logl _PARAMS((long double)); -extern long double log10l _PARAMS((long double)); -extern long double powl _PARAMS((long double, long double)); -extern long double sqrtl _PARAMS((long double)); -extern long double fmodl _PARAMS((long double, long double)); -extern long double hypotl _PARAMS((long double, long double)); +extern long double acosl (long double); +extern long double asinl (long double); +extern long double atan2l (long double, long double); +extern long double coshl (long double); +extern long double sinhl (long double); +extern long double expl (long double); +extern long double ldexpl (long double, int); +extern long double logl (long double); +extern long double log10l (long double); +extern long double powl (long double, long double); +extern long double sqrtl (long double); +extern long double fmodl (long double, long double); +extern long double hypotl (long double, long double); #endif /* ! defined (__math_68881) */ #endif /* ! defined (_REENT_ONLY) */ -extern long double copysignl _PARAMS((long double, long double)); -extern long double nanl _PARAMS((const char *)); -extern int ilogbl _PARAMS((long double)); -extern long double asinhl _PARAMS((long double)); -extern long double cbrtl _PARAMS((long double)); -extern long double nextafterl _PARAMS((long double, long double)); -extern float nexttowardf _PARAMS((float, long double)); -extern double nexttoward _PARAMS((double, long double)); -extern long double nexttowardl _PARAMS((long double, long double)); -extern long double logbl _PARAMS((long double)); -extern long double log2l _PARAMS((long double)); -extern long double rintl _PARAMS((long double)); -extern long double scalbnl _PARAMS((long double, int)); -extern long double exp2l _PARAMS((long double)); -extern long double scalblnl _PARAMS((long double, long)); -extern long double tgammal _PARAMS((long double)); -extern long double nearbyintl _PARAMS((long double)); -extern long int lrintl _PARAMS((long double)); -extern long long int llrintl _PARAMS((long double)); -extern long double roundl _PARAMS((long double)); -extern long lroundl _PARAMS((long double)); -extern long long int llroundl _PARAMS((long double)); -extern long double truncl _PARAMS((long double)); -extern long double remquol _PARAMS((long double, long double, int *)); -extern long double fdiml _PARAMS((long double, long double)); -extern long double fmaxl _PARAMS((long double, long double)); -extern long double fminl _PARAMS((long double, long double)); -extern long double fmal _PARAMS((long double, long double, long double)); +extern long double copysignl (long double, long double); +extern long double nanl (const char *); +extern int ilogbl (long double); +extern long double asinhl (long double); +extern long double cbrtl (long double); +extern long double nextafterl (long double, long double); +extern float nexttowardf (float, long double); +extern double nexttoward (double, long double); +extern long double nexttowardl (long double, long double); +extern long double logbl (long double); +extern long double log2l (long double); +extern long double rintl (long double); +extern long double scalbnl (long double, int); +extern long double exp2l (long double); +extern long double scalblnl (long double, long); +extern long double tgammal (long double); +extern long double nearbyintl (long double); +extern long int lrintl (long double); +extern long long int llrintl (long double); +extern long double roundl (long double); +extern long lroundl (long double); +extern long long int llroundl (long double); +extern long double truncl (long double); +extern long double remquol (long double, long double, int *); +extern long double fdiml (long double, long double); +extern long double fmaxl (long double, long double); +extern long double fminl (long double, long double); +extern long double fmal (long double, long double, long double); #ifndef _REENT_ONLY -extern long double acoshl _PARAMS((long double)); -extern long double atanhl _PARAMS((long double)); -extern long double remainderl _PARAMS((long double, long double)); -extern long double lgammal _PARAMS((long double)); -extern long double erfl _PARAMS((long double)); -extern long double erfcl _PARAMS((long double)); +extern long double acoshl (long double); +extern long double atanhl (long double); +extern long double remainderl (long double, long double); +extern long double lgammal (long double); +extern long double erfl (long double); +extern long double erfcl (long double); #endif /* ! defined (_REENT_ONLY) */ #else /* !_LDBL_EQ_DBL && !__CYGWIN__ */ -extern long double hypotl _PARAMS((long double, long double)); -extern long double sqrtl _PARAMS((long double)); +extern long double hypotl (long double, long double); +extern long double sqrtl (long double); #ifdef __i386__ /* Other long double precision functions. */ -extern _LONG_DOUBLE rintl _PARAMS((_LONG_DOUBLE)); -extern long int lrintl _PARAMS((_LONG_DOUBLE)); -extern long long int llrintl _PARAMS((_LONG_DOUBLE)); +extern _LONG_DOUBLE rintl (_LONG_DOUBLE); +extern long int lrintl (_LONG_DOUBLE); +extern long long int llrintl (_LONG_DOUBLE); #endif /* __i386__ */ #endif /* !_LDBL_EQ_DBL && !__CYGWIN__ */ #endif /* __ISO_C_VISIBLE >= 1999 */ #if __MISC_VISIBLE -extern double drem _PARAMS((double, double)); -extern float dremf _PARAMS((float, float)); +extern double drem (double, double); +extern float dremf (float, float); #ifdef __CYGWIN__ -extern float dreml _PARAMS((long double, long double)); +extern float dreml (long double, long double); #endif /* __CYGWIN__ */ -extern double gamma_r _PARAMS((double, int *)); -extern double lgamma_r _PARAMS((double, int *)); -extern float gammaf_r _PARAMS((float, int *)); -extern float lgammaf_r _PARAMS((float, int *)); +extern double gamma_r (double, int *); +extern double lgamma_r (double, int *); +extern float gammaf_r (float, int *); +extern float lgammaf_r (float, int *); #endif #if __MISC_VISIBLE || __XSI_VISIBLE -extern double y0 _PARAMS((double)); -extern double y1 _PARAMS((double)); -extern double yn _PARAMS((int, double)); -extern double j0 _PARAMS((double)); -extern double j1 _PARAMS((double)); -extern double jn _PARAMS((int, double)); +extern double y0 (double); +extern double y1 (double); +extern double yn (int, double); +extern double j0 (double); +extern double j1 (double); +extern double jn (int, double); #endif #if __MISC_VISIBLE || __XSI_VISIBLE >= 600 -extern float y0f _PARAMS((float)); -extern float y1f _PARAMS((float)); -extern float ynf _PARAMS((int, float)); -extern float j0f _PARAMS((float)); -extern float j1f _PARAMS((float)); -extern float jnf _PARAMS((int, float)); +extern float y0f (float); +extern float y1f (float); +extern float ynf (int, float); +extern float j0f (float); +extern float j1f (float); +extern float jnf (int, float); #endif /* GNU extensions */ #if __GNU_VISIBLE -extern void sincos _PARAMS((double, double *, double *)); -extern void sincosf _PARAMS((float, float *, float *)); +extern void sincos (double, double *, double *); +extern void sincosf (float, float *, float *); #ifdef __CYGWIN__ -extern void sincosl _PARAMS((long double, long double *, long double *)); +extern void sincosl (long double, long double *, long double *); #endif /* __CYGWIN__ */ # ifndef exp10 -extern double exp10 _PARAMS((double)); +extern double exp10 (double); # endif # ifndef pow10 -extern double pow10 _PARAMS((double)); +extern double pow10 (double); # endif # ifndef exp10f -extern float exp10f _PARAMS((float)); +extern float exp10f (float); # endif # ifndef pow10f -extern float pow10f _PARAMS((float)); +extern float pow10f (float); # endif #ifdef __CYGWIN__ # ifndef exp10l -extern float exp10l _PARAMS((float)); +extern float exp10l (float); # endif # ifndef pow10l -extern float pow10l _PARAMS((float)); +extern float pow10l (float); # endif #endif /* __CYGWIN__ */ #endif /* __GNU_VISIBLE */ @@ -562,7 +562,7 @@ extern float pow10l _PARAMS((float)); /* The gamma functions use a global variable, signgam. */ #ifndef _REENT_ONLY #define signgam (*__signgam()) -extern int *__signgam _PARAMS((void)); +extern int *__signgam (void); #endif /* ! defined (_REENT_ONLY) */ #define __signgam_r(ptr) _REENT_SIGNGAM(ptr) @@ -587,9 +587,9 @@ struct exception }; #ifdef __cplusplus -extern int matherr _PARAMS((struct __exception *e)); +extern int matherr (struct __exception *e); #else -extern int matherr _PARAMS((struct exception *e)); +extern int matherr (struct exception *e); #endif /* Values for the type field of struct exception. */ diff --git a/newlib/libc/include/reent.h b/newlib/libc/include/reent.h index b7664b0b9..2b01fbe8f 100644 --- a/newlib/libc/include/reent.h +++ b/newlib/libc/include/reent.h @@ -136,29 +136,29 @@ struct timezone; #else /* Reentrant versions of system calls. */ -extern int _close_r _PARAMS ((struct _reent *, int)); -extern int _execve_r _PARAMS ((struct _reent *, const char *, char *const *, char *const *)); -extern int _fcntl_r _PARAMS ((struct _reent *, int, int, int)); -extern int _fork_r _PARAMS ((struct _reent *)); -extern int _fstat_r _PARAMS ((struct _reent *, int, struct stat *)); -extern int _getpid_r _PARAMS ((struct _reent *)); -extern int _isatty_r _PARAMS ((struct _reent *, int)); -extern int _kill_r _PARAMS ((struct _reent *, int, int)); -extern int _link_r _PARAMS ((struct _reent *, const char *, const char *)); -extern _off_t _lseek_r _PARAMS ((struct _reent *, int, _off_t, int)); -extern int _mkdir_r _PARAMS ((struct _reent *, const char *, int)); -extern int _open_r _PARAMS ((struct _reent *, const char *, int, int)); -extern _ssize_t _read_r _PARAMS ((struct _reent *, int, void *, size_t)); -extern int _rename_r _PARAMS ((struct _reent *, const char *, const char *)); -extern void *_sbrk_r _PARAMS ((struct _reent *, ptrdiff_t)); -extern int _stat_r _PARAMS ((struct _reent *, const char *, struct stat *)); -extern _CLOCK_T_ _times_r _PARAMS ((struct _reent *, struct tms *)); -extern int _unlink_r _PARAMS ((struct _reent *, const char *)); -extern int _wait_r _PARAMS ((struct _reent *, int *)); -extern _ssize_t _write_r _PARAMS ((struct _reent *, int, const void *, size_t)); +extern int _close_r (struct _reent *, int); +extern int _execve_r (struct _reent *, const char *, char *const *, char *const *); +extern int _fcntl_r (struct _reent *, int, int, int); +extern int _fork_r (struct _reent *); +extern int _fstat_r (struct _reent *, int, struct stat *); +extern int _getpid_r (struct _reent *); +extern int _isatty_r (struct _reent *, int); +extern int _kill_r (struct _reent *, int, int); +extern int _link_r (struct _reent *, const char *, const char *); +extern _off_t _lseek_r (struct _reent *, int, _off_t, int); +extern int _mkdir_r (struct _reent *, const char *, int); +extern int _open_r (struct _reent *, const char *, int, int); +extern _ssize_t _read_r (struct _reent *, int, void *, size_t); +extern int _rename_r (struct _reent *, const char *, const char *); +extern void *_sbrk_r (struct _reent *, ptrdiff_t); +extern int _stat_r (struct _reent *, const char *, struct stat *); +extern _CLOCK_T_ _times_r (struct _reent *, struct tms *); +extern int _unlink_r (struct _reent *, const char *); +extern int _wait_r (struct _reent *, int *); +extern _ssize_t _write_r (struct _reent *, int, const void *, size_t); /* This one is not guaranteed to be available on all targets. */ -extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *__tp, void *__tzp)); +extern int _gettimeofday_r (struct _reent *, struct timeval *__tp, void *__tzp); #ifdef __LARGE64_FILES @@ -168,10 +168,10 @@ extern int _gettimeofday_r _PARAMS ((struct _reent *, struct timeval *__tp, void #endif struct stat64; -extern _off64_t _lseek64_r _PARAMS ((struct _reent *, int, _off64_t, int)); -extern int _fstat64_r _PARAMS ((struct _reent *, int, struct stat64 *)); -extern int _open64_r _PARAMS ((struct _reent *, const char *, int, int)); -extern int _stat64_r _PARAMS ((struct _reent *, const char *, struct stat64 *)); +extern _off64_t _lseek64_r (struct _reent *, int, _off64_t, int); +extern int _fstat64_r (struct _reent *, int, struct stat64 *); +extern int _open64_r (struct _reent *, const char *, int, int); +extern int _stat64_r (struct _reent *, const char *, struct stat64 *); /* Don't pollute namespace if not building newlib. */ #if defined (__CYGWIN__) && !defined (_COMPILING_NEWLIB) diff --git a/newlib/libc/include/sys/_default_fcntl.h b/newlib/libc/include/sys/_default_fcntl.h index 006e4efd5..33b462285 100644 --- a/newlib/libc/include/sys/_default_fcntl.h +++ b/newlib/libc/include/sys/_default_fcntl.h @@ -199,27 +199,27 @@ struct eflock { #include #include /* sigh. for the mode bits for open/creat */ -extern int open _PARAMS ((const char *, int, ...)); +extern int open (const char *, int, ...); #if __ATFILE_VISIBLE -extern int openat _PARAMS ((int, const char *, int, ...)); +extern int openat (int, const char *, int, ...); #endif -extern int creat _PARAMS ((const char *, mode_t)); -extern int fcntl _PARAMS ((int, int, ...)); +extern int creat (const char *, mode_t); +extern int fcntl (int, int, ...); #if __BSD_VISIBLE -extern int flock _PARAMS ((int, int)); +extern int flock (int, int); #endif #if __GNU_VISIBLE #include -extern int futimesat _PARAMS ((int, const char *, const struct timeval *)); +extern int futimesat (int, const char *, const struct timeval *); #endif /* Provide _ prototypes for functions provided by some versions of newlib. */ #ifdef _COMPILING_NEWLIB -extern int _open _PARAMS ((const char *, int, ...)); -extern int _fcntl _PARAMS ((int, int, ...)); +extern int _open (const char *, int, ...); +extern int _fcntl (int, int, ...); #ifdef __LARGE64_FILES -extern int _open64 _PARAMS ((const char *, int, ...)); +extern int _open64 (const char *, int, ...); #endif #endif diff --git a/newlib/libc/include/sys/errno.h b/newlib/libc/include/sys/errno.h index 89fe1e052..025b461d4 100644 --- a/newlib/libc/include/sys/errno.h +++ b/newlib/libc/include/sys/errno.h @@ -12,7 +12,7 @@ extern "C" { #ifndef _REENT_ONLY #define errno (*__errno()) -extern int *__errno _PARAMS ((void)); +extern int *__errno (void); #endif /* Please don't use these variables directly. diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 061f580fb..aa352dc08 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -775,7 +775,7 @@ extern __FILE __sf[3]; extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__; extern struct _reent *const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__; -void _reclaim_reent _PARAMS ((struct _reent *)); +void _reclaim_reent (struct _reent *); /* #define _REENT_ONLY define this to get only reentrant routines */ diff --git a/newlib/libc/include/sys/timeb.h b/newlib/libc/include/sys/timeb.h index 793b48143..ccf664974 100644 --- a/newlib/libc/include/sys/timeb.h +++ b/newlib/libc/include/sys/timeb.h @@ -31,7 +31,7 @@ struct timeb short dstflag; }; -extern int ftime _PARAMS ((struct timeb *)); +extern int ftime (struct timeb *); #ifdef __cplusplus } diff --git a/newlib/libc/machine/cris/sys/errno.h b/newlib/libc/machine/cris/sys/errno.h index dc4ffe28c..3d573015d 100644 --- a/newlib/libc/machine/cris/sys/errno.h +++ b/newlib/libc/machine/cris/sys/errno.h @@ -16,7 +16,7 @@ extern "C" { #ifndef _REENT_ONLY #define errno (*__errno()) -extern int *__errno _PARAMS ((void)); +extern int *__errno (void); #endif /* Please don't use these variables directly. diff --git a/newlib/libc/machine/cris/sys/fcntl.h b/newlib/libc/machine/cris/sys/fcntl.h index 6017a190f..7630a9874 100644 --- a/newlib/libc/machine/cris/sys/fcntl.h +++ b/newlib/libc/machine/cris/sys/fcntl.h @@ -143,17 +143,17 @@ struct eflock { #include #include /* sigh. for the mode bits for open/creat */ -extern int open _PARAMS ((const char *, int, ...)); -extern int creat _PARAMS ((const char *, mode_t)); -extern int fcntl _PARAMS ((int, int, ...)); +extern int open (const char *, int, ...); +extern int creat (const char *, mode_t); +extern int fcntl (int, int, ...); /* Provide _ prototypes for functions provided by some versions of newlib. */ #ifdef _COMPILING_NEWLIB -extern int _open _PARAMS ((const char *, int, ...)); -extern int _fcntl _PARAMS ((int, int, ...)); +extern int _open (const char *, int, ...); +extern int _fcntl (int, int, ...); #ifdef __LARGE64_FILES -extern int _open64 _PARAMS ((const char *, int, ...)); +extern int _open64 (const char *, int, ...); #endif #endif diff --git a/newlib/libc/machine/powerpc/ufix64toa.c b/newlib/libc/machine/powerpc/ufix64toa.c index 125ab67fa..bf13894e6 100644 --- a/newlib/libc/machine/powerpc/ufix64toa.c +++ b/newlib/libc/machine/powerpc/ufix64toa.c @@ -15,8 +15,8 @@ #include #include "fix64.h" -extern char *_simdldtoa_r _PARAMS((struct _reent *, LONG_DOUBLE_UNION *, int, - int, int *, int *, char **)); +extern char *_simdldtoa_r (struct _reent *, LONG_DOUBLE_UNION *, int, + int, int *, int *, char **); /* * Convert an unsigned fixed-point 64-bit value to string. diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c index e926a7340..1615d4b25 100644 --- a/newlib/libc/machine/powerpc/vfprintf.c +++ b/newlib/libc/machine/powerpc/vfprintf.c @@ -223,16 +223,16 @@ __sbprintf_r(rptr, fp, fmt, ap) #define DEFPREC 6 #ifdef _NO_LONGDBL -static char *cvt _PARAMS((struct _reent *, double, int, int, char *, int *, int, int *)); +static char *cvt (struct _reent *, double, int, int, char *, int *, int, int *); #else -static char *cvt _PARAMS((struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *)); -extern int _ldcheck _PARAMS((_LONG_DOUBLE *)); +static char *cvt (struct _reent *, _LONG_DOUBLE, int, int, char *, int *, int, int *); +extern int _ldcheck (_LONG_DOUBLE *); #endif -static int exponent _PARAMS((char *, int, int)); +static int exponent (char *, int, int); #ifdef __SPE__ -static char *cvt_ufix64 _PARAMS((struct _reent *, unsigned long long, int, int *, int *)); +static char *cvt_ufix64 (struct _reent *, unsigned long long, int, int *, int *); #endif /* __SPE__ */ #else /* no FLOATING_POINT */ @@ -1247,11 +1247,11 @@ error: #ifdef FLOATING_POINT #ifdef _NO_LONGDBL -extern char *_dtoa_r _PARAMS((struct _reent *, double, int, - int, int *, int *, char **)); +extern char *_dtoa_r (struct _reent *, double, int, + int, int *, int *, char **); #else -extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int, - int, int *, int *, char **)); +extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int, + int, int *, int *, char **); #undef word0 #define word0(x) ldword0(x) #endif @@ -1358,8 +1358,8 @@ exponent(p0, exp, fmtch) #endif /* FLOATING_POINT */ #ifdef __SPE__ -extern char *_ufix64toa_r _PARAMS((struct _reent *, unsigned long long, int, - int, int *, int *, char **)); +extern char *_ufix64toa_r (struct _reent *, unsigned long long, int, + int, int *, int *, char **); static char * cvt_ufix64 (data, value, ndigits, decpt, length) struct _reent *data; diff --git a/newlib/libc/search/qsort.c b/newlib/libc/search/qsort.c index e24a62a55..6c84b95b7 100644 --- a/newlib/libc/search/qsort.c +++ b/newlib/libc/search/qsort.c @@ -77,8 +77,8 @@ typedef int cmp_t(const void *, const void *, void *); #else typedef int cmp_t(const void *, const void *); #endif -static inline char *med3 _PARAMS((char *, char *, char *, cmp_t *, void *)); -static inline void swapfunc _PARAMS((char *, char *, int, int)); +static inline char *med3 (char *, char *, char *, cmp_t *, void *); +static inline void swapfunc (char *, char *, int, int); #define min(a, b) (a) < (b) ? a : b diff --git a/newlib/libc/stdio/nano-vfprintf_local.h b/newlib/libc/stdio/nano-vfprintf_local.h index 51e1df815..f883741d2 100644 --- a/newlib/libc/stdio/nano-vfprintf_local.h +++ b/newlib/libc/stdio/nano-vfprintf_local.h @@ -88,8 +88,8 @@ # define MAXEXPLEN 7 # define DEFPREC 6 -extern char *_dtoa_r _PARAMS((struct _reent *, double, int, - int, int *, int *, char **)); +extern char *_dtoa_r (struct _reent *, double, int, + int, int *, int *, char **); # define _DTOA_R _dtoa_r # define FREXP frexp diff --git a/newlib/libc/stdio/nano-vfscanf_i.c b/newlib/libc/stdio/nano-vfscanf_i.c index aba74b0d8..fc8011717 100644 --- a/newlib/libc/stdio/nano-vfscanf_i.c +++ b/newlib/libc/stdio/nano-vfscanf_i.c @@ -95,7 +95,7 @@ _scanf_i (struct _reent *rptr, struct _scan_data_t *pdata, FILE *fp, va_list *ap) { -#define CCFN_PARAMS _PARAMS((struct _reent *, const char *, char **, int)) +#define CCFN_PARAMS (struct _reent *, const char *, char **, int) /* Conversion function (strtol/strtoul). */ u_long (*ccfn)CCFN_PARAMS=0; char *p; diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 6413f6be1..674322b31 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -510,8 +510,8 @@ _DEFUN(__sbprintf, (rptr, fp, fmt, ap), # ifdef _NO_LONGDBL -extern char *_dtoa_r _PARAMS((struct _reent *, double, int, - int, int *, int *, char **)); +extern char *_dtoa_r (struct _reent *, double, int, + int, int *, int *, char **); # define _PRINTF_FLOAT_TYPE double # define _DTOA_R _dtoa_r @@ -519,8 +519,8 @@ extern char *_dtoa_r _PARAMS((struct _reent *, double, int, # else /* !_NO_LONGDBL */ -extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int, - int, int *, int *, char **)); +extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int, + int, int *, int *, char **); extern int _EXFUN(_ldcheck,(_LONG_DOUBLE *)); diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index bf91dad35..38ef36ea5 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -554,7 +554,7 @@ _DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), while (0) #endif - #define CCFN_PARAMS _PARAMS((struct _reent *, const char *, char **, int)) + #define CCFN_PARAMS (struct _reent *, const char *, char **, int) u_long (*ccfn)CCFN_PARAMS=0; /* conversion function (strtol/strtoul) */ char ccltab[256]; /* character class table for %[...] */ char buf[BUF]; /* buffer for numeric conversions */ diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index ad684a249..1054eb942 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -228,8 +228,8 @@ _DEFUN(__sbwprintf, (rptr, fp, fmt, ap), # ifdef _NO_LONGDBL -extern char *_dtoa_r _PARAMS((struct _reent *, double, int, - int, int *, int *, char **)); +extern char *_dtoa_r (struct _reent *, double, int, + int, int *, int *, char **); # define _PRINTF_FLOAT_TYPE double # define _DTOA_R _dtoa_r @@ -237,8 +237,8 @@ extern char *_dtoa_r _PARAMS((struct _reent *, double, int, # else /* !_NO_LONGDBL */ -extern char *_ldtoa_r _PARAMS((struct _reent *, _LONG_DOUBLE, int, - int, int *, int *, char **)); +extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int, + int, int *, int *, char **); extern int _EXFUN(_ldcheck,(_LONG_DOUBLE *)); diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 27b06232b..73d8f3209 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -138,7 +138,7 @@ C99, POSIX-1.2008 #define _NO_LONGDBL #if defined _WANT_IO_LONG_DOUBLE && (LDBL_MANT_DIG > DBL_MANT_DIG) #undef _NO_LONGDBL -extern _LONG_DOUBLE _wcstold_r _PARAMS((wchar_t *s, wchar_t **sptr)); +extern _LONG_DOUBLE _wcstold_r (wchar_t *s, wchar_t **sptr); #endif #include "floatio.h" @@ -322,7 +322,7 @@ _DEFUN(_sungetwc_r, (data, fp, ch), return wc; } -extern int __ssrefill_r _PARAMS ((struct _reent *ptr, register FILE * fp)); +extern int __ssrefill_r (struct _reent *ptr, register FILE * fp); static size_t _DEFUN(_sfgetwc_r, (ptr, fp), @@ -367,7 +367,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), mbstate_t mbs; /* value to keep track of multibyte state */ - #define CCFN_PARAMS _PARAMS((struct _reent *, const wchar_t *, wchar_t **, int)) + #define CCFN_PARAMS (struct _reent *, const wchar_t *, wchar_t **, int) unsigned long (*ccfn)CCFN_PARAMS=0; /* conversion function (wcstol/wcstoul) */ wchar_t buf[BUF]; /* buffer for numeric conversions */ const wchar_t *ccls; /* character class start */ diff --git a/newlib/libc/stdlib/atexit.h b/newlib/libc/stdlib/atexit.h index e37a146a0..eadc7d13d 100644 --- a/newlib/libc/stdlib/atexit.h +++ b/newlib/libc/stdlib/atexit.h @@ -9,6 +9,6 @@ enum __atexit_types __et_cxa }; -void __call_exitprocs _PARAMS ((int, _PTR)); -int __register_exitproc _PARAMS ((int, void (*fn) (void), _PTR, _PTR)); +void __call_exitprocs (int, _PTR); +int __register_exitproc (int, void (*fn) (void), _PTR, _PTR); diff --git a/newlib/libc/stdlib/cxa_atexit.c b/newlib/libc/stdlib/cxa_atexit.c index c66b28e7d..c03894c4a 100644 --- a/newlib/libc/stdlib/cxa_atexit.c +++ b/newlib/libc/stdlib/cxa_atexit.c @@ -30,7 +30,7 @@ _DEFUN (__cxa_atexit, { #ifdef _LITE_EXIT /* Refer to comments in __atexit.c for more details of lite exit. */ - int __register_exitproc _PARAMS ((int, void (*fn) (void), _PTR, _PTR)) + int __register_exitproc (int, void (*fn) (void), _PTR, _PTR) __attribute__ ((weak)); if (!__register_exitproc) diff --git a/newlib/libc/stdlib/exit.c b/newlib/libc/stdlib/exit.c index 8d1be9d3a..481985cd1 100644 --- a/newlib/libc/stdlib/exit.c +++ b/newlib/libc/stdlib/exit.c @@ -55,7 +55,7 @@ _DEFUN (exit, (code), { #ifdef _LITE_EXIT /* Refer to comments in __atexit.c for more details of lite exit. */ - void __call_exitprocs _PARAMS ((int, _PTR)) __attribute__((weak)); + void __call_exitprocs (int, _PTR)) __attribute__((weak); if (__call_exitprocs) #endif __call_exitprocs (code, NULL); diff --git a/newlib/libc/stdlib/setenv.c b/newlib/libc/stdlib/setenv.c index c963a3343..e68e91d14 100644 --- a/newlib/libc/stdlib/setenv.c +++ b/newlib/libc/stdlib/setenv.c @@ -23,7 +23,7 @@ #include #include -extern int _unsetenv_r _PARAMS ((struct _reent *, const char *)); +extern int _unsetenv_r (struct _reent *, const char *); /* * setenv -- diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c index b3bc1fcce..31d4fc70d 100644 --- a/newlib/libc/stdlib/setenv_r.c +++ b/newlib/libc/stdlib/setenv_r.c @@ -38,7 +38,7 @@ extern char **environ; static char ***p_environ = &environ; /* _findenv_r is defined in getenv_r.c. */ -extern char *_findenv_r _PARAMS ((struct _reent *, const char *, int *)); +extern char *_findenv_r (struct _reent *, const char *, int *); /* * _setenv_r -- diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c index 43fa1f592..8d5c188f8 100644 --- a/newlib/libc/string/strerror.c +++ b/newlib/libc/string/strerror.c @@ -392,7 +392,7 @@ _DEFUN (_strerror_r, (ptr, errnum, internal, errptr), int *errptr) { char *error; - extern char *_user_strerror _PARAMS ((int, int, int *)); + extern char *_user_strerror (int, int, int *); switch (errnum) { diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c index 04dde4558..474618dd7 100644 --- a/newlib/libc/sys/arm/syscalls.c +++ b/newlib/libc/sys/arm/syscalls.c @@ -18,37 +18,37 @@ #include "swi.h" /* Forward prototypes. */ -int _system _PARAMS ((const char *)); -int _rename _PARAMS ((const char *, const char *)); -int _isatty _PARAMS ((int)); -clock_t _times _PARAMS ((struct tms *)); -int _gettimeofday _PARAMS ((struct timeval *, void *)); -void _raise _PARAMS ((void)); -int _unlink _PARAMS ((const char *)); -int _link _PARAMS ((void)); -int _stat _PARAMS ((const char *, struct stat *)); -int _fstat _PARAMS ((int, struct stat *)); -caddr_t _sbrk _PARAMS ((int)); -int _getpid _PARAMS ((int)); -int _kill _PARAMS ((int, int)); -void _exit _PARAMS ((int)); -int _close _PARAMS ((int)); -int _swiclose _PARAMS ((int)); -int _open _PARAMS ((const char *, int, ...)); -int _swiopen _PARAMS ((const char *, int)); -int _write _PARAMS ((int, char *, int)); -int _swiwrite _PARAMS ((int, char *, int)); -int _lseek _PARAMS ((int, int, int)); -int _swilseek _PARAMS ((int, int, int)); -int _read _PARAMS ((int, char *, int)); -int _swiread _PARAMS ((int, char *, int)); -void initialise_monitor_handles _PARAMS ((void)); +int _system (const char *); +int _rename (const char *, const char *); +int _isatty (int); +clock_t _times (struct tms *); +int _gettimeofday (struct timeval *, void *); +void _raise (void); +int _unlink (const char *); +int _link (void); +int _stat (const char *, struct stat *); +int _fstat (int, struct stat *); +caddr_t _sbrk (int); +int _getpid (int); +int _kill (int, int); +void _exit (int); +int _close (int); +int _swiclose (int); +int _open (const char *, int, ...); +int _swiopen (const char *, int); +int _write (int, char *, int); +int _swiwrite (int, char *, int); +int _lseek (int, int, int); +int _swilseek (int, int, int); +int _read (int, char *, int); +int _swiread (int, char *, int); +void initialise_monitor_handles (void); -static int wrap _PARAMS ((int)); -static int error _PARAMS ((int)); -static int get_errno _PARAMS ((void)); -static int remap_handle _PARAMS ((int)); -static int findslot _PARAMS ((int)); +static int wrap (int); +static int error (int); +static int get_errno (void); +static int remap_handle (int); +static int findslot (int); /* Register name faking - works in collusion with the linker. */ register char * stack_ptr asm ("sp"); diff --git a/newlib/libc/sys/linux/sys/errno.h b/newlib/libc/sys/linux/sys/errno.h index 86a6968fe..049afc18a 100644 --- a/newlib/libc/sys/linux/sys/errno.h +++ b/newlib/libc/sys/linux/sys/errno.h @@ -12,7 +12,7 @@ #ifndef _REENT_ONLY #define errno (*__errno()) -extern int *__errno _PARAMS ((void)); +extern int *__errno (void); #endif extern __IMPORT const char * const _sys_errlist[]; diff --git a/newlib/libc/sys/linux/sys/fcntl.h b/newlib/libc/sys/linux/sys/fcntl.h index 78914fd8f..0fb8ae970 100644 --- a/newlib/libc/sys/linux/sys/fcntl.h +++ b/newlib/libc/sys/linux/sys/fcntl.h @@ -13,17 +13,17 @@ #include <_ansi.h> -extern int creat _PARAMS ((const char *, mode_t)); -extern int _open _PARAMS ((const char *, int, ...)); +extern int creat (const char *, mode_t); +extern int _open (const char *, int, ...); #ifdef __KERNEL_PROTOTYPES extern int open(const char *pathname, int flags, mode_t mode); extern int fcntl(int fd, int cmd, long arg); #else -extern int open _PARAMS ((const char *, int, ...)); -extern int fcntl _PARAMS ((int, int, ...)); +extern int open (const char *, int, ...); +extern int fcntl (int, int, ...); #endif -extern int _fcntl _PARAMS ((int, int, ...)); +extern int _fcntl (int, int, ...); #endif diff --git a/newlib/libc/sys/phoenix/sys/errno.h b/newlib/libc/sys/phoenix/sys/errno.h index 82aab6d0c..6d5b001c3 100644 --- a/newlib/libc/sys/phoenix/sys/errno.h +++ b/newlib/libc/sys/phoenix/sys/errno.h @@ -30,7 +30,7 @@ #ifndef _REENT_ONLY #define errno (*__errno()) -extern int *__errno _PARAMS ((void)); +extern int *__errno (void); #endif /* Don't use these variables directly. Use strerror instead. */ diff --git a/newlib/libc/sys/sparc64/sys/fcntl.h b/newlib/libc/sys/sparc64/sys/fcntl.h index b52932b3f..67d2b4072 100644 --- a/newlib/libc/sys/sparc64/sys/fcntl.h +++ b/newlib/libc/sys/sparc64/sys/fcntl.h @@ -167,9 +167,9 @@ struct eflock { #include #include /* sigh. for the mode bits for open/creat */ -extern int open _PARAMS ((const char *, int, ...)); -extern int creat _PARAMS ((const char *, mode_t)); -extern int fcntl _PARAMS ((int, int, ...)); +extern int open (const char *, int, ...); +extern int creat (const char *, mode_t); +extern int fcntl (int, int, ...); #ifdef __cplusplus } diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h index a8eb4de31..fc8bc8486 100644 --- a/winsup/cygwin/include/cygwin/stdlib.h +++ b/winsup/cygwin/include/cygwin/stdlib.h @@ -45,9 +45,9 @@ int posix_openpt (int); #define _unsetenv_r UNUSED__unsetenv_r #endif -extern _PTR memalign _PARAMS ((size_t, size_t)); +extern _PTR memalign (size_t, size_t); #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112) -extern _PTR valloc _PARAMS ((size_t)); +extern _PTR valloc (size_t); #endif #undef _malloc_r diff --git a/winsup/cygwin/include/fcntl.h b/winsup/cygwin/include/fcntl.h index 3dad0889f..22adacaf2 100644 --- a/winsup/cygwin/include/fcntl.h +++ b/winsup/cygwin/include/fcntl.h @@ -43,8 +43,8 @@ details. */ #ifdef __cplusplus extern "C" { #endif -extern int posix_fadvise _PARAMS ((int, off_t, off_t, int)); -extern int posix_fallocate _PARAMS ((int, off_t, off_t)); +extern int posix_fadvise (int, off_t, off_t, int); +extern int posix_fallocate (int, off_t, off_t); #ifdef __cplusplus } #endif diff --git a/winsup/cygwin/include/sys/file.h b/winsup/cygwin/include/sys/file.h index 6dabeb70c..4d51fd5fe 100644 --- a/winsup/cygwin/include/sys/file.h +++ b/winsup/cygwin/include/sys/file.h @@ -44,7 +44,7 @@ extern "C" { #endif -extern int flock _PARAMS ((int, int)); +extern int flock (int, int); #ifdef __cplusplus } From 0403b9c8c40a351ba72f587add10669df225680b Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:45:02 -0600 Subject: [PATCH 210/649] ansification: remove _VOID_PTR Signed-off-by: Yaakov Selkowitz --- newlib/libc/iconv/ces/euc.c | 24 +++++++------- newlib/libc/iconv/ces/table-pcs.c | 16 ++++----- newlib/libc/iconv/ces/table.c | 40 +++++++++++----------- newlib/libc/iconv/ces/ucs-2-internal.c | 6 ++-- newlib/libc/iconv/ces/ucs-2.c | 14 ++++---- newlib/libc/iconv/ces/ucs-4-internal.c | 6 ++-- newlib/libc/iconv/ces/ucs-4.c | 14 ++++---- newlib/libc/iconv/ces/us-ascii.c | 6 ++-- newlib/libc/iconv/ces/utf-16.c | 20 +++++------ newlib/libc/iconv/ces/utf-8.c | 6 ++-- newlib/libc/iconv/lib/aliasesi.c | 2 +- newlib/libc/iconv/lib/conv.h | 28 ++++++++-------- newlib/libc/iconv/lib/iconv.c | 18 +++++----- newlib/libc/iconv/lib/iconvnls.c | 6 ++-- newlib/libc/iconv/lib/local.h | 3 -- newlib/libc/iconv/lib/nullconv.c | 16 ++++----- newlib/libc/iconv/lib/ucsconv.c | 22 ++++++------ newlib/libc/iconv/lib/ucsconv.h | 46 +++++++++++++------------- 18 files changed, 145 insertions(+), 148 deletions(-) diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c index ab309a585..fb0a50e90 100644 --- a/newlib/libc/iconv/ces/euc.c +++ b/newlib/libc/iconv/ces/euc.c @@ -62,7 +62,7 @@ typedef struct int mb_cur_max; euc_cs_desc_t *desc; - _VOID_PTR data[MAX_CS_NUM]; + void *data[MAX_CS_NUM]; } euc_data_t; #if defined (_ICONV_TO_ENCODING_EUC_JP) \ @@ -100,7 +100,7 @@ static euc_cs_desc_t euc_kr_cs_desc [] = #endif #if defined (ICONV_FROM_UCS_CES_EUC) -static _VOID_PTR +static void * _DEFUN(euc_from_ucs_init, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -160,14 +160,14 @@ error: _iconv_from_ucs_ces_handlers_table.close (rptr, data); return NULL; error1: - _free_r (rptr, (_VOID_PTR)data); + _free_r (rptr, (void *)data); return NULL; } static size_t _DEFUN(euc_from_ucs_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { int i; size_t res = 0; @@ -186,7 +186,7 @@ _DEFUN(euc_from_ucs_close, (rptr, data), static size_t _DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -260,7 +260,7 @@ _DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), #endif /* ICONV_FROM_UCS_CES_EUC */ #if defined (ICONV_TO_UCS_CES_EUC) -static _VOID_PTR +static void * _DEFUN(euc_to_ucs_init, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -320,14 +320,14 @@ error: _iconv_to_ucs_ces_handlers_table.close (rptr, data); return NULL; error1: - _free_r (rptr, (_VOID_PTR)data); + _free_r (rptr, (void *)data); return NULL; } static size_t _DEFUN(euc_to_ucs_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { int i; size_t res = 0; @@ -346,7 +346,7 @@ _DEFUN(euc_to_ucs_close, (rptr, data), static ucs4_t _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -366,8 +366,8 @@ _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), for (i = 1; d->desc[i].csname != NULL; i++) { - if (memcmp((const _VOID_PTR)(*inbuf), - (const _VOID_PTR)d->desc[i].prefix, + if (memcmp((const void *)(*inbuf), + (const void *)d->desc[i].prefix, d->desc[i].prefixbytes) == 0) { if (((int)*inbytesleft - d->desc[i].prefixbytes - d->desc[i].bytes) < 0) @@ -433,7 +433,7 @@ _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(euc_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return ((euc_data_t *)data)->mb_cur_max; } diff --git a/newlib/libc/iconv/ces/table-pcs.c b/newlib/libc/iconv/ces/table-pcs.c index 1bab90986..77b820bae 100644 --- a/newlib/libc/iconv/ces/table-pcs.c +++ b/newlib/libc/iconv/ces/table-pcs.c @@ -41,7 +41,7 @@ #if defined (ICONV_FROM_UCS_CES_TABLE_PCS) static size_t _DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -64,7 +64,7 @@ _DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), outbytesleft); } -static _VOID_PTR +static void * _DEFUN(table_pcs_from_ucs_init, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -75,14 +75,14 @@ _DEFUN(table_pcs_from_ucs_init, (rptr, encoding), static size_t _DEFUN(table_pcs_from_ucs_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { return _iconv_from_ucs_ces_handlers_table.close (rptr, data); } static int _DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return _iconv_from_ucs_ces_handlers_table.get_mb_cur_max (data); } @@ -92,7 +92,7 @@ _DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data), #if defined (ICONV_TO_UCS_CES_TABLE_PCS) static ucs4_t _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -112,7 +112,7 @@ _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), inbytesleft); } -static _VOID_PTR +static void * _DEFUN(table_pcs_to_ucs_init, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -123,14 +123,14 @@ _DEFUN(table_pcs_to_ucs_init, (rptr, encoding), static size_t _DEFUN(table_pcs_to_ucs_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { return _iconv_to_ucs_ces_handlers_table.close (rptr, data); } static int _DEFUN(table_pcs_to_ucs_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return _iconv_to_ucs_ces_handlers_table.get_mb_cur_max (data); } diff --git a/newlib/libc/iconv/ces/table.c b/newlib/libc/iconv/ces/table.c index c02831a5b..969c0944b 100644 --- a/newlib/libc/iconv/ces/table.c +++ b/newlib/libc/iconv/ces/table.c @@ -76,19 +76,19 @@ _EXFUN(load_file, (struct _reent *rptr, const char *name, int direction)); static size_t _DEFUN(table_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { const iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; if (ccsp->type == TABLE_EXTERNAL) - _free_r (rptr, (_VOID_PTR)ccsp->tbl); + _free_r (rptr, (void *)ccsp->tbl); - _free_r( rptr, (_VOID_PTR)ccsp); + _free_r( rptr, (void *)ccsp); return 0; } #if defined (ICONV_FROM_UCS_CES_TABLE) -static _VOID_PTR +static void * _DEFUN(table_init_from_ucs, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -116,11 +116,11 @@ _DEFUN(table_init_from_ucs, (rptr, encoding), ccsp->optimization = biccsp->from_ucs_type; ccsp->tbl = biccsp->from_ucs; - return (_VOID_PTR)ccsp; + return (void *)ccsp; } #ifdef _ICONV_ENABLE_EXTERNAL_CCS - return (_VOID_PTR)load_file (rptr, encoding, 1); + return (void *)load_file (rptr, encoding, 1); #else return NULL; #endif @@ -128,7 +128,7 @@ _DEFUN(table_init_from_ucs, (rptr, encoding), static size_t _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -171,7 +171,7 @@ _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), #endif /* ICONV_FROM_UCS_CES_TABLE */ #if defined (ICONV_TO_UCS_CES_TABLE) -static _VOID_PTR +static void * _DEFUN(table_init_to_ucs, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -199,11 +199,11 @@ _DEFUN(table_init_to_ucs, (rptr, encoding), ccsp->optimization = biccsp->to_ucs_type; ccsp->tbl = biccsp->to_ucs; - return (_VOID_PTR)ccsp; + return (void *)ccsp; } #ifdef _ICONV_ENABLE_EXTERNAL_CCS - return (_VOID_PTR)load_file (rptr, encoding, 0); + return (void *)load_file (rptr, encoding, 0); #else return NULL; #endif @@ -211,7 +211,7 @@ _DEFUN(table_init_to_ucs, (rptr, encoding), static ucs4_t _DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -254,7 +254,7 @@ _DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(table_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return ((iconv_ccs_desc_t *)data)->bits/8; } @@ -490,7 +490,7 @@ _DEFUN(load_file, (rptr, name, direction), if ((buf = (const unsigned char *)_malloc_r (rptr, hdrlen)) == NULL) goto error2; - if (_read_r (rptr, fd, (_VOID_PTR)buf, hdrlen) != hdrlen) + if (_read_r (rptr, fd, (void *)buf, hdrlen) != hdrlen) goto error3; if (_16BIT_ELT (EXTTABLE_VERSION_OFF) != TABLE_VERSION_1 @@ -559,33 +559,33 @@ _DEFUN(load_file, (rptr, name, direction), goto error4; if (_lseek_r (rptr, fd, off, SEEK_SET) == (off_t)-1 - || _read_r (rptr, fd, (_VOID_PTR)ccsp->tbl, tbllen) != tbllen) + || _read_r (rptr, fd, (void *)ccsp->tbl, tbllen) != tbllen) goto error5; goto normal_exit; error5: - _free_r (rptr, (_VOID_PTR)ccsp->tbl); + _free_r (rptr, (void *)ccsp->tbl); ccsp->tbl = NULL; error4: - _free_r (rptr, (_VOID_PTR)ccsp); + _free_r (rptr, (void *)ccsp); ccsp = NULL; error3: normal_exit: - _free_r (rptr, (_VOID_PTR)buf); + _free_r (rptr, (void *)buf); error2: if (_close_r (rptr, fd) == -1) { if (ccsp != NULL) { if (ccsp->tbl != NULL) - _free_r (rptr, (_VOID_PTR)ccsp->tbl); - _free_r (rptr, (_VOID_PTR)ccsp); + _free_r (rptr, (void *)ccsp->tbl); + _free_r (rptr, (void *)ccsp); } ccsp = NULL; } error1: - _free_r (rptr, (_VOID_PTR)fname); + _free_r (rptr, (void *)fname); return ccsp; } #endif diff --git a/newlib/libc/iconv/ces/ucs-2-internal.c b/newlib/libc/iconv/ces/ucs-2-internal.c index 7aed01e88..2c9169473 100644 --- a/newlib/libc/iconv/ces/ucs-2-internal.c +++ b/newlib/libc/iconv/ces/ucs-2-internal.c @@ -45,7 +45,7 @@ #if defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) static size_t _DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -67,7 +67,7 @@ _DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) static ucs4_t _DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -90,7 +90,7 @@ _DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(ucs_2_internal_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/ucs-2.c b/newlib/libc/iconv/ces/ucs-2.c index 7d03ee890..a99562eec 100644 --- a/newlib/libc/iconv/ces/ucs-2.c +++ b/newlib/libc/iconv/ces/ucs-2.c @@ -49,7 +49,7 @@ #define UCS_2BE "ucs_2be" #define UCS_2LE "ucs_2le" -static _VOID_PTR +static void * _DEFUN(ucs_2_init, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -57,20 +57,20 @@ _DEFUN(ucs_2_init, (rptr, encoding), int *data; if ((data = (int *) _malloc_r(rptr, sizeof (int))) == NULL) - return (_VOID_PTR)NULL; + return (void *)NULL; if (strcmp (encoding, UCS_2LE) == 0) *data = UCS_2_LITTLE_ENDIAN; else *data = UCS_2_BIG_ENDIAN; - return (_VOID_PTR)data; + return (void *)data; } static size_t _DEFUN(ucs_2_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { _free_r (rptr, data); return 0; @@ -79,7 +79,7 @@ _DEFUN(ucs_2_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UCS_2) static size_t _DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -106,7 +106,7 @@ _DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_2) static ucs4_t _DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -133,7 +133,7 @@ _DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(ucs_2_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/ucs-4-internal.c b/newlib/libc/iconv/ces/ucs-4-internal.c index 1df5f3fc6..a5c6d7e09 100644 --- a/newlib/libc/iconv/ces/ucs-4-internal.c +++ b/newlib/libc/iconv/ces/ucs-4-internal.c @@ -45,7 +45,7 @@ #if defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL) static size_t _DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -67,7 +67,7 @@ _DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) static ucs4_t _DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -90,7 +90,7 @@ _DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(ucs_4_internal_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/ucs-4.c b/newlib/libc/iconv/ces/ucs-4.c index 8fbfa6aa1..0009981fe 100644 --- a/newlib/libc/iconv/ces/ucs-4.c +++ b/newlib/libc/iconv/ces/ucs-4.c @@ -50,7 +50,7 @@ #define UCS_4BE "ucs_4be" #define UCS_4LE "ucs_4le" -static _VOID_PTR +static void * _DEFUN(ucs_4_init, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -58,20 +58,20 @@ _DEFUN(ucs_4_init, (rptr, encoding), int *data; if ((data = (int *)_malloc_r (rptr, sizeof(int))) == NULL) - return (_VOID_PTR)NULL; + return (void *)NULL; if (strcmp (encoding, UCS_4LE) == 0) *data = UCS_4_LITTLE_ENDIAN; else *data = UCS_4_BIG_ENDIAN; - return (_VOID_PTR)data; + return (void *)data; } static size_t _DEFUN(ucs_4_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { _free_r(rptr, data); return 0; @@ -81,7 +81,7 @@ _DEFUN(ucs_4_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UCS_4) static size_t _DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -108,7 +108,7 @@ _DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_4) static ucs4_t _DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -135,7 +135,7 @@ _DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(ucs_4_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return 4; } diff --git a/newlib/libc/iconv/ces/us-ascii.c b/newlib/libc/iconv/ces/us-ascii.c index 1fc7c5d89..e6a665070 100644 --- a/newlib/libc/iconv/ces/us-ascii.c +++ b/newlib/libc/iconv/ces/us-ascii.c @@ -41,7 +41,7 @@ #if defined (ICONV_FROM_UCS_CES_US_ASCII) static size_t _DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -61,7 +61,7 @@ _DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_US_ASCII) static ucs4_t _DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -84,7 +84,7 @@ _DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(us_ascii_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/utf-16.c b/newlib/libc/iconv/ces/utf-16.c index fee97b0ee..dd62a5dea 100644 --- a/newlib/libc/iconv/ces/utf-16.c +++ b/newlib/libc/iconv/ces/utf-16.c @@ -60,14 +60,14 @@ static size_t _DEFUN(utf_16_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { _free_r(rptr, data); return 0; } #if defined (ICONV_FROM_UCS_CES_UTF_16) -static _VOID_PTR +static void * _DEFUN(utf_16_init_from_ucs, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -75,7 +75,7 @@ _DEFUN(utf_16_init_from_ucs, (rptr, encoding), int *data; if ((data = (int *)_malloc_r (rptr, sizeof (int))) == NULL) - return (_VOID_PTR)NULL; + return (void *)NULL; if (strcmp (encoding, UTF_16LE) == 0) *data = UTF16_LITTLE_ENDIAN; @@ -84,12 +84,12 @@ _DEFUN(utf_16_init_from_ucs, (rptr, encoding), else *data = UTF16_SYSTEM_ENDIAN; - return (_VOID_PTR)data; + return (void *)data; } static size_t _DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -169,7 +169,7 @@ _DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), #endif /* ICONV_FROM_UCS_CES_UTF_16 */ #if defined (ICONV_TO_UCS_CES_UTF_16) -static _VOID_PTR +static void * _DEFUN(utf_16_init_to_ucs, (rptr, encoding), struct _reent *rptr, const char *encoding) @@ -177,7 +177,7 @@ _DEFUN(utf_16_init_to_ucs, (rptr, encoding), int *data; if ((data = (int *)_malloc_r (rptr, sizeof (int))) == NULL) - return (_VOID_PTR)NULL; + return (void *)NULL; if (strcmp (encoding, UTF_16BE) == 0) *data = UTF16_BIG_ENDIAN; @@ -186,12 +186,12 @@ _DEFUN(utf_16_init_to_ucs, (rptr, encoding), else *data = UTF16_UNDEFINED; - return (_VOID_PTR)data; + return (void *)data; } static ucs4_t _DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -269,7 +269,7 @@ _DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(utf_16_get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return 6; } diff --git a/newlib/libc/iconv/ces/utf-8.c b/newlib/libc/iconv/ces/utf-8.c index ae778d12d..5559272d7 100644 --- a/newlib/libc/iconv/ces/utf-8.c +++ b/newlib/libc/iconv/ces/utf-8.c @@ -44,7 +44,7 @@ #if defined (ICONV_FROM_UCS_CES_UTF_8) static size_t _DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), - _VOID_PTR data, + void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -126,7 +126,7 @@ _DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UTF_8) static ucs4_t _DEFUN(convert_to_ucs, (data, inbuf, inbytesleft), - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -260,7 +260,7 @@ _DEFUN(convert_to_ucs, (data, inbuf, inbytesleft), static int _DEFUN(get_mb_cur_max, (data), - _VOID_PTR data) + void *data) { return UTF8_MB_CUR_MAX; } diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c index 1f4f70ffc..7c932e65c 100644 --- a/newlib/libc/iconv/lib/aliasesi.c +++ b/newlib/libc/iconv/lib/aliasesi.c @@ -163,7 +163,7 @@ _DEFUN(_iconv_resolve_encoding_name, (rptr, cname, path), p = find_alias (rptr, ca, _iconv_aliases, strlen (_iconv_aliases)); - _free_r (rptr, (_VOID_PTR)ca); + _free_r (rptr, (void *)ca); return p; } diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h index f0088767e..59b6fe810 100644 --- a/newlib/libc/iconv/lib/conv.h +++ b/newlib/libc/iconv/lib/conv.h @@ -63,7 +63,7 @@ typedef struct * Pointer to conversion-specific data if success. In case of error * returns NULL and sets current thread's/process's errno. */ - _VOID_PTR _EXFNPTR(open, (struct _reent *rptr, + void *_EXFNPTR(open, (struct _reent *rptr, const char *to, const char *from)); @@ -72,7 +72,7 @@ typedef struct * * PARAMETRS: * struct _reent *rptr - reent structure of current thread/process; - * _VOID_PTR data - conversion-specific data. + * void *data - conversion-specific data. * * DESCRIPTION: * This function is called from iconv_close() to close conversion. @@ -82,13 +82,13 @@ typedef struct * thread's/process's errno and returns (size_t)-1 (same as iconv_open()). */ size_t _EXFNPTR(close, (struct _reent *rptr, - _VOID_PTR data)); + void *data)); /* convert - perform encoding conversion. * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process. - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * const unsigned char **inbuf - input data buffer; * size_t *inbytesleft - input buffer's length; * unsigned char **outbuf - output data buffer; @@ -115,7 +115,7 @@ typedef struct * thread's/process's errno and returns (size_t)-1 (same as iconv()). */ size_t _EXFNPTR(convert, (struct _reent *rptr, - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, @@ -126,7 +126,7 @@ typedef struct * get_state - get current shift state. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * mbstate_t *state - mbstate_t object where shift state will be written; * int direction - 0-"from", 1-"to". * @@ -135,7 +135,7 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - _VOID _EXFNPTR(get_state, (_VOID_PTR data, + _VOID _EXFNPTR(get_state, (void *data, mbstate_t *state, int direction)); @@ -143,7 +143,7 @@ typedef struct * set_state - set shift state. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * mbstate_t *state - mbstate_t object to which shift state will be set. * int direction - 0-"from", 1-"to". * @@ -154,7 +154,7 @@ typedef struct * "to" encoding is set. * Returns 0 if '*state' object has right format, -1 else. */ - int _EXFNPTR(set_state, (_VOID_PTR data, + int _EXFNPTR(set_state, (void *data, mbstate_t *state, int direction)); @@ -162,7 +162,7 @@ typedef struct * get_mb_cur_max - get maximum character length in bytes. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * int direction - 0-"from", 1-"to". * * DESCRIPTION: @@ -170,14 +170,14 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data, + int _EXFNPTR(get_mb_cur_max, (void *data, int direction)); /* * is_stateful - is encoding stateful or stateless. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * int direction - 0-"from", 1-"to". * * DESCRIPTION: @@ -185,7 +185,7 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - int _EXFNPTR(is_stateful, (_VOID_PTR data, + int _EXFNPTR(is_stateful, (void *data, int direction)); } iconv_conversion_handlers_t; @@ -205,7 +205,7 @@ typedef struct * Conversion-specific data (e.g., points to iconv_ucs_conversion_t * object if UCS-based conversion is used). */ - _VOID_PTR data; + void *data; } iconv_conversion_t; diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c index 7c9b252f3..0cf3cf5ff 100644 --- a/newlib/libc/iconv/lib/iconv.c +++ b/newlib/libc/iconv/lib/iconv.c @@ -165,7 +165,7 @@ _DEFUN(_iconv_open_r, (rptr, to, from), if ((from = (const char *)_iconv_resolve_encoding_name (rptr, from)) == NULL) { - _free_r (rptr, (_VOID_PTR)to); + _free_r (rptr, (void *)to); return (iconv_t)-1; } @@ -187,16 +187,16 @@ _DEFUN(_iconv_open_r, (rptr, to, from), ic->data = ic->handlers->open (rptr, to, from); } - _free_r (rptr, (_VOID_PTR)to); - _free_r (rptr, (_VOID_PTR)from); + _free_r (rptr, (void *)to); + _free_r (rptr, (void *)from); if (ic->data == NULL) { - _free_r (rptr, (_VOID_PTR)ic); + _free_r (rptr, (void *)ic); return (iconv_t)-1; } - return (_VOID_PTR)ic; + return (void *)ic; } @@ -211,7 +211,7 @@ _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), { iconv_conversion_t *ic = (iconv_conversion_t *)cd; - if ((_VOID_PTR)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL + if ((void *)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL || (ic->handlers != &_iconv_null_conversion_handlers && ic->handlers != &_iconv_ucs_conversion_handlers)) { @@ -249,7 +249,7 @@ _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), if (*outbytesleft >= state_null.__count) { - memcpy ((_VOID_PTR)(*outbuf), (_VOID_PTR)&state_null, state_null.__count); + memcpy ((void *)(*outbuf), (void *)&state_null, state_null.__count); *outbuf += state_null.__count; *outbytesleft -= state_null.__count; @@ -295,7 +295,7 @@ _DEFUN(_iconv_close_r, (rptr, cd), int res; iconv_conversion_t *ic = (iconv_conversion_t *)cd; - if ((_VOID_PTR)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL + if ((void *)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL || (ic->handlers != &_iconv_null_conversion_handlers && ic->handlers != &_iconv_ucs_conversion_handlers)) { @@ -305,7 +305,7 @@ _DEFUN(_iconv_close_r, (rptr, cd), res = (int)ic->handlers->close (rptr, ic->data); - _free_r (rptr, (_VOID_PTR)cd); + _free_r (rptr, (void *)cd); return res; } diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c index fa35cca1a..1996bdd8f 100644 --- a/newlib/libc/iconv/lib/iconvnls.c +++ b/newlib/libc/iconv/lib/iconvnls.c @@ -177,7 +177,7 @@ _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), iconv_conversion_t *ic = (iconv_conversion_t *)cd; int flags = ICONV_FAIL_BIT; - if ((_VOID_PTR)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL + if ((void *)cd == NULL || cd == (iconv_t)-1 || ic->data == NULL || (ic->handlers != &_iconv_null_conversion_handlers && ic->handlers != &_iconv_ucs_conversion_handlers)) { @@ -289,11 +289,11 @@ _DEFUN(iconv_open1, (rptr, to, from), if (ic->data == NULL) { - _free_r (rptr, (_VOID_PTR)ic); + _free_r (rptr, (void *)ic); return (iconv_t)-1; } - return (_VOID_PTR)ic; + return (void *)ic; } /* diff --git a/newlib/libc/iconv/lib/local.h b/newlib/libc/iconv/lib/local.h index 46428ae17..bd9dcddca 100644 --- a/newlib/libc/iconv/lib/local.h +++ b/newlib/libc/iconv/lib/local.h @@ -30,9 +30,6 @@ #include #include -/* void* type for K&R compilers compatibility */ -#define _VOID_PTR _PTR - /* Encodings aliases file */ #define ICONV_ALIASES_FNAME "encoding.aliases" /* iconv CCS data path */ diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c index 729007ab0..3c87cbb83 100644 --- a/newlib/libc/iconv/lib/nullconv.c +++ b/newlib/libc/iconv/lib/nullconv.c @@ -35,20 +35,20 @@ static int null_conversion_dummy_data; -static _VOID_PTR +static void * _DEFUN(null_conversion_open, (rptr, to, from), struct _reent *rptr, const char *to, const char *from) { - return (_VOID_PTR)&null_conversion_dummy_data; + return (void *)&null_conversion_dummy_data; } static size_t _DEFUN(null_conversion_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { return 0; } @@ -58,7 +58,7 @@ static size_t _DEFUN(null_conversion_convert, (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft), struct _reent *rptr, - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, @@ -94,7 +94,7 @@ _DEFUN(null_conversion_convert, static int _DEFUN(null_conversion_get_mb_cur_max, (data, direction), - _VOID_PTR data, + void *data, int direction) { return ICONV_MB_LEN_MAX; @@ -103,7 +103,7 @@ _DEFUN(null_conversion_get_mb_cur_max, (data, direction), static _VOID _DEFUN(null_conversion_get_state, (data, state, size), - _VOID_PTR data, + void *data, mbstate_t *state, int direction) { @@ -113,7 +113,7 @@ _DEFUN(null_conversion_get_state, (data, state, size), static int _DEFUN(null_conversion_set_state, (data, state, direction), - _VOID_PTR data, + void *data, mbstate_t *state, int direction) { @@ -122,7 +122,7 @@ _DEFUN(null_conversion_set_state, (data, state, direction), static int _DEFUN(null_conversion_is_stateful, (data, direction), - _VOID_PTR data, + void *data, int direction) { return 0; diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c index 7cc65c86c..c91007209 100644 --- a/newlib/libc/iconv/lib/ucsconv.c +++ b/newlib/libc/iconv/lib/ucsconv.c @@ -44,7 +44,7 @@ _EXFUN(find_encoding_name, (const char *searchee, * UCS-based conversion interface functions implementation. */ -static _VOID_PTR +static void * _DEFUN(ucs_based_conversion_open, (rptr, to, from), struct _reent *rptr, const char *to, @@ -97,7 +97,7 @@ _DEFUN(ucs_based_conversion_open, (rptr, to, from), goto error; } else - uc->to_ucs.data = (_VOID_PTR)&fake_data; + uc->to_ucs.data = (void *)&fake_data; /* Initialize "from UCS" CES converter */ @@ -108,7 +108,7 @@ _DEFUN(ucs_based_conversion_open, (rptr, to, from), goto error; } else - uc->from_ucs.data = (_VOID_PTR)&fake_data; + uc->from_ucs.data = (void *)&fake_data; return uc; @@ -116,7 +116,7 @@ error: if (uc->to_ucs.data != NULL && uc->to_ucs.handlers->close != NULL) uc->to_ucs.handlers->close (rptr, uc->to_ucs.data); - _free_r (rptr, (_VOID_PTR)uc); + _free_r (rptr, (void *)uc); return NULL; } @@ -125,7 +125,7 @@ error: static size_t _DEFUN(ucs_based_conversion_close, (rptr, data), struct _reent *rptr, - _VOID_PTR data) + void *data) { iconv_ucs_conversion_t *uc; size_t res = 0; @@ -137,7 +137,7 @@ _DEFUN(ucs_based_conversion_close, (rptr, data), if (uc->to_ucs.handlers->close != NULL) res |= uc->to_ucs.handlers->close (rptr, uc->to_ucs.data); - _free_r (rptr, (_VOID_PTR)data); + _free_r (rptr, (void *)data); return res; } @@ -147,7 +147,7 @@ static size_t _DEFUN(ucs_based_conversion_convert, (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft, flags), struct _reent *rptr, - _VOID_PTR data, + void *data, const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, @@ -239,7 +239,7 @@ _DEFUN(ucs_based_conversion_convert, static int _DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), - _VOID_PTR data, + void *data, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -253,7 +253,7 @@ _DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), static _VOID _DEFUN(ucs_based_conversion_get_state, (data, state, direction), - _VOID_PTR data, + void *data, mbstate_t *state, int direction) { @@ -281,7 +281,7 @@ _DEFUN(ucs_based_conversion_get_state, (data, state, direction), static int _DEFUN(ucs_based_conversion_set_state, (data, state, direction), - _VOID_PTR data, + void *data, mbstate_t *state, int direction) { @@ -303,7 +303,7 @@ _DEFUN(ucs_based_conversion_set_state, (data, state, direction), static int _DEFUN(ucs_based_conversion_is_stateful, (data, direction), - _VOID_PTR data, + void *data, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h index cea6d5aa3..d3333161c 100644 --- a/newlib/libc/iconv/lib/ucsconv.h +++ b/newlib/libc/iconv/lib/ucsconv.h @@ -68,7 +68,7 @@ typedef struct * Returns CES-specific data pointer if success. In case of error returns * NULL and sets current thread's/process's errno. */ - _VOID_PTR _EXFNPTR(init, (struct _reent *rptr, + void *_EXFNPTR(init, (struct _reent *rptr, const char *encoding)); /* @@ -76,7 +76,7 @@ typedef struct * * PARAMETERS: * struct _reent *rptr - reent structure of current thread/process; - * _VOID_PTR data - CES converter-specific data. + * void *data - CES converter-specific data. * * DESCRIPTION: * Preforms CES converter closing. * @@ -85,37 +85,37 @@ typedef struct * sets current thread's/process's errno. */ size_t _EXFNPTR(close, (struct _reent *rptr, - _VOID_PTR data)); + void *data)); /* * get_mb_cur_max - get maximum character length in bytes. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * * DESCRIPTION: * Returns encoding's maximum character length. */ - int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data)); + int _EXFNPTR(get_mb_cur_max, (void *data)); /* * get_state - get current shift state. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * mbstate_t *state - mbstate_t object where shift state will be stored; * * DESCRIPTION: * Returns encoding's current shift sequence. */ - _VOID _EXFNPTR(get_state, (_VOID_PTR data, + _VOID _EXFNPTR(get_state, (void *data, mbstate_t *state)); /* * set_state - set shift state. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * mbstate_t *state - mbstate_t value to which shift state will be set. * * DESCRIPTION: @@ -123,25 +123,25 @@ typedef struct * object is zero-object - reset current shift state. * Returns 0 if '*state' object has right format, -1 else. */ - int _EXFNPTR(set_state, (_VOID_PTR data, + int _EXFNPTR(set_state, (void *data, mbstate_t *state)); /* * is_stateful - is encoding stateful state. * * PARAMETERS: - * _VOID_PTR data - conversion-specific data; + * void *data - conversion-specific data; * * DESCRIPTION: * Returns 0 if encoding is stateless, else returns 1. */ - int _EXFNPTR(is_stateful, (_VOID_PTR data)); + int _EXFNPTR(is_stateful, (void *data)); /* * convert_to_ucs - convert character to UCS. * * PARAMETERS: - * _VOID_PTR data - CES converter-specific data; + * void *data - CES converter-specific data; * const unsigned char **inbuf - buffer with input character byte sequence; * size_t *inbytesleft - output buffer bytes count. * @@ -155,7 +155,7 @@ typedef struct * returns ICONV_CES_INVALID_CHARACTER. If invalid or incomplete bytes * sequence was met, returns ICONV_CES_BAD_SEQUENCE. */ - ucs4_t _EXFNPTR(convert_to_ucs, (_VOID_PTR data, + ucs4_t _EXFNPTR(convert_to_ucs, (void *data, const unsigned char **inbuf, size_t *inbytesleft)); } iconv_to_ucs_ces_handlers_t; @@ -172,32 +172,32 @@ typedef struct typedef struct { /* Same as in iconv_to_ucs_ces_handlers_t */ - _VOID_PTR _EXFNPTR(init, (struct _reent *rptr, + void *_EXFNPTR(init, (struct _reent *rptr, const char *encoding)); /* Same as in iconv_to_ucs_ces_handlers_t */ size_t _EXFNPTR(close, (struct _reent *rptr, - _VOID_PTR data)); + void *data)); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXFNPTR(get_mb_cur_max, (_VOID_PTR data)); + int _EXFNPTR(get_mb_cur_max, (void *data)); /* Same as in iconv_to_ucs_ces_handlers_t */ - _VOID _EXFNPTR(get_state, (_VOID_PTR data, + _VOID _EXFNPTR(get_state, (void *data, mbstate_t *state)); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXFNPTR(set_state, (_VOID_PTR data, + int _EXFNPTR(set_state, (void *data, mbstate_t *state)); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXFNPTR(is_stateful, (_VOID_PTR data)); + int _EXFNPTR(is_stateful, (void *data)); /* * convert_from_ucs - convert UCS character to destination encoding. * * PARAMETERS: - * _VOID_PTR data - CES converter-specific data; + * void *data - CES converter-specific data; * ucs4_t in - input UCS-4 character; * unsigned char **outbuf - output buffer for the result; * size_t *outbytesleft - output buffer bytes count. @@ -215,7 +215,7 @@ typedef struct * If there is no corresponding character in destination encoding, returns * ICONV_CES_INVALID_CHARACTER. */ - size_t _EXFNPTR(convert_from_ucs, (_VOID_PTR data, + size_t _EXFNPTR(convert_from_ucs, (void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft)); @@ -234,7 +234,7 @@ typedef struct const iconv_to_ucs_ces_handlers_t *handlers; /* "to_ucs" CES converter-specific data. */ - _VOID_PTR data; + void *data; } iconv_to_ucs_ces_desc_t; @@ -250,7 +250,7 @@ typedef struct const iconv_from_ucs_ces_handlers_t *handlers; /* "from_ucs" CES converter-specific data. */ - _VOID_PTR data; + void *data; } iconv_from_ucs_ces_desc_t; From e6321aa6a668376c40bc2792a3bd392e94c29ad6 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:53:22 -0600 Subject: [PATCH 211/649] ansification: remove _PTR Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/_ansi.h | 2 - newlib/libc/include/malloc.h | 34 ++++++------ newlib/libc/include/stdio.h | 56 ++++++++++---------- newlib/libc/include/stdlib.h | 38 ++++++------- newlib/libc/include/string.h | 20 +++---- newlib/libc/include/sys/reent.h | 22 ++++---- newlib/libc/machine/powerpc/machine/malloc.h | 12 ++--- newlib/libc/machine/powerpc/machine/stdlib.h | 12 ++--- newlib/libc/machine/powerpc/vec_calloc.c | 2 +- newlib/libc/machine/powerpc/vec_free.c | 2 +- newlib/libc/machine/powerpc/vec_malloc.c | 2 +- newlib/libc/machine/powerpc/vec_realloc.c | 4 +- newlib/libc/machine/powerpc/vfscanf.c | 2 +- newlib/libc/machine/spu/fread.c | 2 +- newlib/libc/machine/spu/fwrite.c | 2 +- newlib/libc/machine/xstormy16/mallocr.c | 10 ++-- newlib/libc/reent/readr.c | 2 +- newlib/libc/reent/writer.c | 2 +- newlib/libc/search/bsearch.c | 12 ++--- newlib/libc/stdio/fdopen.c | 2 +- newlib/libc/stdio/fgets.c | 6 +-- newlib/libc/stdio/fopen.c | 2 +- newlib/libc/stdio/fread.c | 10 ++-- newlib/libc/stdio/freopen.c | 2 +- newlib/libc/stdio/fseeko.c | 2 +- newlib/libc/stdio/fvwrite.c | 4 +- newlib/libc/stdio/fvwrite.h | 2 +- newlib/libc/stdio/fwrite.c | 4 +- newlib/libc/stdio/makebuf.c | 2 +- newlib/libc/stdio/nano-vfprintf.c | 4 +- newlib/libc/stdio/nano-vfprintf_local.h | 2 +- newlib/libc/stdio/nano-vfscanf.c | 2 +- newlib/libc/stdio/setvbuf.c | 2 +- newlib/libc/stdio/stdio.c | 2 +- newlib/libc/stdio/ungetc.c | 4 +- newlib/libc/stdio/vfprintf.c | 12 ++--- newlib/libc/stdio/vfscanf.c | 8 +-- newlib/libc/stdio/vfwprintf.c | 6 +-- newlib/libc/stdio/vfwscanf.c | 6 +-- newlib/libc/stdio64/fdopen64.c | 2 +- newlib/libc/stdio64/fopen64.c | 2 +- newlib/libc/stdio64/freopen64.c | 2 +- newlib/libc/stdlib/__call_atexit.c | 6 +-- newlib/libc/stdlib/atexit.h | 4 +- newlib/libc/stdlib/calloc.c | 2 +- newlib/libc/stdlib/cxa_atexit.c | 2 +- newlib/libc/stdlib/exit.c | 2 +- newlib/libc/stdlib/malign.c | 2 +- newlib/libc/stdlib/malloc.c | 4 +- newlib/libc/stdlib/msize.c | 2 +- newlib/libc/stdlib/on_exit.c | 4 +- newlib/libc/stdlib/realloc.c | 4 +- newlib/libc/stdlib/reallocf.c | 8 +-- newlib/libc/stdlib/valloc.c | 4 +- newlib/libc/string/memccpy.c | 10 ++-- newlib/libc/string/memchr.c | 4 +- newlib/libc/string/memcmp.c | 4 +- newlib/libc/string/memcpy.c | 8 +-- newlib/libc/string/memmove.c | 6 +-- newlib/libc/string/mempcpy.c | 6 +-- newlib/libc/string/memrchr.c | 4 +- newlib/libc/string/memset.c | 4 +- newlib/libc/string/rawmemchr.c | 4 +- newlib/libc/sys/linux/pread.c | 4 +- newlib/libc/sys/linux/pread64.c | 2 +- newlib/libc/sys/linux/pwrite.c | 4 +- newlib/libc/sys/linux/pwrite64.c | 2 +- newlib/libc/sys/rtems/crt0.c | 10 ++-- newlib/libc/unix/pread.c | 4 +- newlib/libc/unix/pwrite.c | 4 +- newlib/libc/xdr/xdr_sizeof.c | 2 +- winsup/cygwin/include/cygwin/stdlib.h | 4 +- 72 files changed, 228 insertions(+), 230 deletions(-) diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 5e2eac93a..e955138fe 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -47,7 +47,6 @@ #endif #ifdef _HAVE_STDC -#define _PTR void * #define _VOLATILE volatile #define _SIGNED signed #define _VOID void @@ -69,7 +68,6 @@ #define _LONG_DOUBLE long double #endif #else -#define _PTR char * #define _VOLATILE #define _SIGNED #define _VOID void diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h index b1e0a0946..f9144cdca 100644 --- a/newlib/libc/include/malloc.h +++ b/newlib/libc/include/malloc.h @@ -34,44 +34,44 @@ struct mallinfo { /* The routines. */ -extern _PTR malloc (size_t); +extern void *malloc (size_t); #ifdef __CYGWIN__ #undef _malloc_r #define _malloc_r(r, s) malloc (s) #else -extern _PTR _malloc_r (struct _reent *, size_t); +extern void *_malloc_r (struct _reent *, size_t); #endif -extern _VOID free (_PTR); +extern _VOID free (void *); #ifdef __CYGWIN__ #undef _free_r #define _free_r(r, p) free (p) #else -extern _VOID _free_r (struct _reent *, _PTR); +extern _VOID _free_r (struct _reent *, void *); #endif -extern _PTR realloc (_PTR, size_t); +extern void *realloc (void *, size_t); #ifdef __CYGWIN__ #undef _realloc_r #define _realloc_r(r, p, s) realloc (p, s) #else -extern _PTR _realloc_r (struct _reent *, _PTR, size_t); +extern void *_realloc_r (struct _reent *, void *, size_t); #endif -extern _PTR calloc (size_t, size_t); +extern void *calloc (size_t, size_t); #ifdef __CYGWIN__ #undef _calloc_r #define _calloc_r(r, s1, s2) calloc (s1, s2); #else -extern _PTR _calloc_r (struct _reent *, size_t, size_t); +extern void *_calloc_r (struct _reent *, size_t, size_t); #endif -extern _PTR memalign (size_t, size_t); +extern void *memalign (size_t, size_t); #ifdef __CYGWIN__ #undef _memalign_r #define _memalign_r(r, s1, s2) memalign (s1, s2); #else -extern _PTR _memalign_r (struct _reent *, size_t, size_t); +extern void *_memalign_r (struct _reent *, size_t, size_t); #endif extern struct mallinfo mallinfo (void); @@ -98,31 +98,31 @@ extern int mallopt (int, int); extern int _mallopt_r (struct _reent *, int, int); #endif -extern size_t malloc_usable_size (_PTR); +extern size_t malloc_usable_size (void *); #ifdef __CYGWIN__ #undef _malloc_usable_size_r #define _malloc_usable_size_r(r, p) malloc_usable_size (p) #else -extern size_t _malloc_usable_size_r (struct _reent *, _PTR); +extern size_t _malloc_usable_size_r (struct _reent *, void *); #endif /* These aren't too useful on an embedded system, but we define them anyhow. */ -extern _PTR valloc (size_t); +extern void *valloc (size_t); #ifdef __CYGWIN__ #undef _valloc_r #define _valloc_r(r, s) valloc (s) #else -extern _PTR _valloc_r (struct _reent *, size_t); +extern void *_valloc_r (struct _reent *, size_t); #endif -extern _PTR pvalloc (size_t); +extern void *pvalloc (size_t); #ifdef __CYGWIN__ #undef _pvalloc_r #define _pvalloc_r(r, s) pvalloc (s) #else -extern _PTR _pvalloc_r (struct _reent *, size_t); +extern void *_pvalloc_r (struct _reent *, size_t); #endif extern int malloc_trim (size_t); @@ -159,7 +159,7 @@ extern _VOID _mstats_r (struct _reent *, char *); #ifndef __CYGWIN__ /* Some systems provide this, so do too for compatibility. */ -extern void cfree (_PTR); +extern void cfree (void *); #endif /* __CYGWIN__ */ #ifdef __cplusplus diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 9152bf096..fe0a31827 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -220,8 +220,8 @@ int _EXFUN(putc, (int, FILE *)); int _EXFUN(putchar, (int)); int _EXFUN(puts, (const char *)); int _EXFUN(ungetc, (int, FILE *)); -size_t _EXFUN(fread, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(fwrite, (const _PTR __restrict , size_t _size, size_t _n, FILE *)); +size_t _EXFUN(fread, (void *__restrict, size_t _size, size_t _n, FILE *__restrict)); +size_t _EXFUN(fwrite, (const void *__restrict , size_t _size, size_t _n, FILE *)); #ifdef _COMPILING_NEWLIB int _EXFUN(fgetpos, (FILE *, _fpos_t *)); #else @@ -434,8 +434,8 @@ int _EXFUN(_fputc_r, (struct _reent *, int, FILE *)); int _EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *)); int _EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict)); int _EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict)); -size_t _EXFUN(_fread_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(_fread_unlocked_r, (struct _reent *, _PTR __restrict, size_t _size, size_t _n, FILE *__restrict)); +size_t _EXFUN(_fread_r, (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict)); +size_t _EXFUN(_fread_unlocked_r, (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict)); int _EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...) _ATTRIBUTE ((__format__ (__scanf__, 3, 4)))); int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int)); @@ -443,8 +443,8 @@ int _EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int)); long _EXFUN(_ftell_r, (struct _reent *, FILE *)); _off_t _EXFUN(_ftello_r,(struct _reent *, FILE *)); void _EXFUN(_rewind_r, (struct _reent *, FILE *)); -size_t _EXFUN(_fwrite_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(_fwrite_unlocked_r, (struct _reent *, const _PTR __restrict, size_t _size, size_t _n, FILE *__restrict)); +size_t _EXFUN(_fwrite_r, (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict)); +size_t _EXFUN(_fwrite_unlocked_r, (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict)); int _EXFUN(_getc_r, (struct _reent *, FILE *)); int _EXFUN(_getc_unlocked_r, (struct _reent *, FILE *)); int _EXFUN(_getchar_r, (struct _reent *)); @@ -539,8 +539,8 @@ int _EXFUN(fileno_unlocked, (FILE *)); int _EXFUN(fflush_unlocked, (FILE *)); int _EXFUN(fgetc_unlocked, (FILE *)); int _EXFUN(fputc_unlocked, (int, FILE *)); -size_t _EXFUN(fread_unlocked, (_PTR __restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(fwrite_unlocked, (const _PTR __restrict , size_t _size, size_t _n, FILE *)); +size_t _EXFUN(fread_unlocked, (void *__restrict, size_t _size, size_t _n, FILE *__restrict)); +size_t _EXFUN(fwrite_unlocked, (const void *__restrict , size_t _size, size_t _n, FILE *)); #endif #if __GNU_VISIBLE @@ -583,35 +583,35 @@ int _EXFUN(__swbuf_r, (struct _reent *, int, FILE *)); #if __BSD_VISIBLE # ifdef __LARGE64_FILES -FILE *_EXFUN(funopen,(const _PTR __cookie, - int (*__readfn)(_PTR __c, char *__buf, +FILE *_EXFUN(funopen,(const void *__cookie, + int (*__readfn)(void *__c, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - int (*__writefn)(_PTR __c, const char *__buf, + int (*__writefn)(void *__c, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - _fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence), - int (*__closefn)(_PTR __c))); -FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie, - int (*__readfn)(_PTR __c, char *__buf, + _fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence), + int (*__closefn)(void *__c))); +FILE *_EXFUN(_funopen_r,(struct _reent *, const void *__cookie, + int (*__readfn)(void *__c, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - int (*__writefn)(_PTR __c, const char *__buf, + int (*__writefn)(void *__c, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - _fpos64_t (*__seekfn)(_PTR __c, _fpos64_t __off, int __whence), - int (*__closefn)(_PTR __c))); + _fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence), + int (*__closefn)(void *__c))); # else -FILE *_EXFUN(funopen,(const _PTR __cookie, - int (*__readfn)(_PTR __cookie, char *__buf, +FILE *_EXFUN(funopen,(const void *__cookie, + int (*__readfn)(void *__cookie, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - int (*__writefn)(_PTR __cookie, const char *__buf, + int (*__writefn)(void *__cookie, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence), - int (*__closefn)(_PTR __cookie))); -FILE *_EXFUN(_funopen_r,(struct _reent *, const _PTR __cookie, - int (*__readfn)(_PTR __cookie, char *__buf, + fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence), + int (*__closefn)(void *__cookie))); +FILE *_EXFUN(_funopen_r,(struct _reent *, const void *__cookie, + int (*__readfn)(void *__cookie, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - int (*__writefn)(_PTR __cookie, const char *__buf, + int (*__writefn)(void *__cookie, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), - fpos_t (*__seekfn)(_PTR __cookie, fpos_t __off, int __whence), - int (*__closefn)(_PTR __cookie))); + fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence), + int (*__closefn)(void *__cookie))); # endif /* !__LARGE64_FILES */ # define fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \ diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index ac433db21..7213a3c16 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -54,7 +54,7 @@ typedef struct #ifndef __compar_fn_t_defined #define __compar_fn_t_defined -typedef int (*__compar_fn_t) (const _PTR, const _PTR); +typedef int (*__compar_fn_t) (const void *, const void *); #endif #define EXIT_FAILURE 1 @@ -82,15 +82,15 @@ int _EXFUN(atoi,(const char *__nptr)); int _EXFUN(_atoi_r,(struct _reent *, const char *__nptr)); long _EXFUN(atol,(const char *__nptr)); long _EXFUN(_atol_r,(struct _reent *, const char *__nptr)); -_PTR _EXFUN(bsearch,(const _PTR __key, - const _PTR __base, +void * _EXFUN(bsearch,(const void *__key, + const void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); -_PTR _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size)); +void * _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size)); div_t _EXFUN(div,(int __numer, int __denom)); _VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((__noreturn__))); -_VOID _EXFUN_NOTHROW(free,(_PTR)); +_VOID _EXFUN_NOTHROW(free,(void *)); char * _EXFUN(getenv,(const char *__string)); char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); char * _EXFUN(_findenv,(const char *, int *)); @@ -101,7 +101,7 @@ int _EXFUN(getsubopt,(char **, char * const *, char **)); #endif long _EXFUN(labs,(long)); ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); -_PTR _EXFUN_NOTHROW(malloc,(size_t __size)); +void * _EXFUN_NOTHROW(malloc,(size_t __size)); int _EXFUN(mblen,(const char *, size_t)); int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *)); int _EXFUN(mbtowc,(wchar_t *__restrict, const char *__restrict, size_t)); @@ -136,13 +136,13 @@ int _EXFUN(_mkostemps_r, (struct _reent *, char *, int, int)); int _EXFUN(_mkstemp_r, (struct _reent *, char *)); int _EXFUN(_mkstemps_r, (struct _reent *, char *, int)); char * _EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")))); -_VOID _EXFUN(qsort,(_PTR __base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); +_VOID _EXFUN(qsort,(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); int _EXFUN(rand,(_VOID)); -_PTR _EXFUN_NOTHROW(realloc,(_PTR __r, size_t __size)); +void * _EXFUN_NOTHROW(realloc,(void *__r, size_t __size)); #if __BSD_VISIBLE void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) __alloc_size(3); -_PTR _EXFUN(reallocf,(_PTR __r, size_t __size)); +void * _EXFUN(reallocf,(void *__r, size_t __size)); #endif #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 char * _EXFUN(realpath, (const char *__restrict path, char *__restrict resolved_path)); @@ -193,7 +193,7 @@ char * _EXFUN(l64a,(long __input)); char * _EXFUN(_l64a_r,(struct _reent *,long __input)); #endif #if __MISC_VISIBLE -int _EXFUN(on_exit,(_VOID (*__func)(int, _PTR),_PTR __arg)); +int _EXFUN(on_exit,(_VOID (*__func)(int, void *),void *__arg)); #endif #if __ISO_C_VISIBLE >= 1999 _VOID _EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__))); @@ -202,7 +202,7 @@ _VOID _EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__))); int _EXFUN(putenv,(char *__string)); #endif int _EXFUN(_putenv_r,(struct _reent *, char *__string)); -_PTR _EXFUN(_reallocf_r,(struct _reent *, _PTR, size_t)); +void * _EXFUN(_reallocf_r,(struct _reent *, void *, size_t)); #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); #endif @@ -273,7 +273,7 @@ unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__restrict _ #ifndef __CYGWIN__ #if __MISC_VISIBLE -_VOID _EXFUN(cfree,(_PTR)); +_VOID _EXFUN(cfree,(void *)); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 int _EXFUN(unsetenv,(const char *__string)); @@ -287,10 +287,10 @@ int _EXFUN(__nonnull ((1)) posix_memalign,(void **, size_t, size_t)); char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); #ifndef __CYGWIN__ -_PTR _EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t)); -_PTR _EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t)); -_VOID _EXFUN_NOTHROW(_free_r,(struct _reent *, _PTR)); -_PTR _EXFUN_NOTHROW(_realloc_r,(struct _reent *, _PTR, size_t)); +void * _EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t)); +void * _EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t)); +_VOID _EXFUN_NOTHROW(_free_r,(struct _reent *, void *)); +void * _EXFUN_NOTHROW(_realloc_r,(struct _reent *, void *, size_t)); _VOID _EXFUN(_mstats_r,(struct _reent *, char *)); #endif int _EXFUN(_system_r,(struct _reent *, const char *)); @@ -302,13 +302,13 @@ _VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)) version. We want that #undef qsort_r will still let you invoke the underlying function, but that requires gcc support. */ #if __GNU_VISIBLE -_VOID _EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, int (*_compar)(const _PTR, const _PTR, _PTR), _PTR __thunk)); +_VOID _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk)); #elif __BSD_VISIBLE # ifdef __GNUC__ -_VOID _EXFUN(qsort_r,(_PTR __base, size_t __nmemb, size_t __size, _PTR __thunk, int (*_compar)(_PTR, const _PTR, const _PTR))) +_VOID _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))) __asm__ (__ASMNAME ("__bsd_qsort_r")); # else -_VOID _EXFUN(__bsd_qsort_r,(_PTR __base, size_t __nmemb, size_t __size, _PTR __thunk, int (*_compar)(_PTR, const _PTR, const _PTR))); +_VOID _EXFUN(__bsd_qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))); # define qsort_r __bsd_qsort_r # endif #endif diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index b54b83335..e44ac3079 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -26,11 +26,11 @@ _BEGIN_STD_C -_PTR _EXFUN(memchr,(const _PTR, int, size_t)); -int _EXFUN(memcmp,(const _PTR, const _PTR, size_t)); -_PTR _EXFUN(memcpy,(_PTR __restrict, const _PTR __restrict, size_t)); -_PTR _EXFUN(memmove,(_PTR, const _PTR, size_t)); -_PTR _EXFUN(memset,(_PTR, int, size_t)); +void * _EXFUN(memchr,(const void *, int, size_t)); +int _EXFUN(memcmp,(const void *, const void *, size_t)); +void * _EXFUN(memcpy,(void *__restrict, const void *__restrict, size_t)); +void * _EXFUN(memmove,(void *, const void *, size_t)); +void * _EXFUN(memset,(void *, int, size_t)); char *_EXFUN(strcat,(char *__restrict, const char *__restrict)); char *_EXFUN(strchr,(const char *, int)); int _EXFUN(strcmp,(const char *, const char *)); @@ -64,13 +64,13 @@ int _EXFUN(timingsafe_bcmp,(const void *, const void *, size_t)); int _EXFUN(timingsafe_memcmp,(const void *, const void *, size_t)); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE -_PTR _EXFUN(memccpy,(_PTR __restrict, const _PTR __restrict, int, size_t)); +void * _EXFUN(memccpy,(void *__restrict, const void *__restrict, int, size_t)); #endif #if __GNU_VISIBLE -_PTR _EXFUN(mempcpy,(_PTR, const _PTR, size_t)); -_PTR _EXFUN(memmem, (const _PTR, size_t, const _PTR, size_t)); -_PTR _EXFUN(memrchr,(const _PTR, int, size_t)); -_PTR _EXFUN(rawmemchr,(const _PTR, int)); +void * _EXFUN(mempcpy,(void *, const void *, size_t)); +void * _EXFUN(memmem, (const void *, size_t, const void *, size_t)); +void * _EXFUN(memrchr,(const void *, int, size_t)); +void * _EXFUN(rawmemchr,(const void *, int)); #endif #if __POSIX_VISIBLE >= 200809 char *_EXFUN(stpcpy,(char *__restrict, const char *__restrict)); diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index aa352dc08..1381db67b 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -192,15 +192,15 @@ struct __sFILE { #endif /* operations */ - _PTR _cookie; /* cookie passed to io functions */ + void * _cookie; /* cookie passed to io functions */ - _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, void *, char *, _READ_WRITE_BUFSIZE_TYPE)); - _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, void *, const char *, _READ_WRITE_BUFSIZE_TYPE)); - _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int)); - int _EXFNPTR(_close, (struct _reent *, _PTR)); + _fpos_t _EXFNPTR(_seek, (struct _reent *, void *, _fpos_t, int)); + int _EXFNPTR(_close, (struct _reent *, void *)); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -248,15 +248,15 @@ struct __sFILE64 { struct _reent *_data; /* operations */ - _PTR _cookie; /* cookie passed to io functions */ + void * _cookie; /* cookie passed to io functions */ - _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, void *, char *, _READ_WRITE_BUFSIZE_TYPE)); - _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, _PTR, + _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, void *, const char *, _READ_WRITE_BUFSIZE_TYPE)); - _fpos_t _EXFNPTR(_seek, (struct _reent *, _PTR, _fpos_t, int)); - int _EXFNPTR(_close, (struct _reent *, _PTR)); + _fpos_t _EXFNPTR(_seek, (struct _reent *, void *, _fpos_t, int)); + int _EXFNPTR(_close, (struct _reent *, void *)); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -275,7 +275,7 @@ struct __sFILE64 { int _flags2; /* for future use */ _off64_t _offset; /* current lseek offset */ - _fpos64_t _EXFNPTR(_seek64, (struct _reent *, _PTR, _fpos64_t, int)); + _fpos64_t _EXFNPTR(_seek64, (struct _reent *, void *, _fpos64_t, int)); #ifndef __SINGLE_THREAD__ _flock_t _lock; /* for thread-safety locking */ diff --git a/newlib/libc/machine/powerpc/machine/malloc.h b/newlib/libc/machine/powerpc/machine/malloc.h index 945a9651a..6be7eac80 100644 --- a/newlib/libc/machine/powerpc/machine/malloc.h +++ b/newlib/libc/machine/powerpc/machine/malloc.h @@ -3,14 +3,14 @@ # if defined(__ALTIVEC__) -_PTR _EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); -_PTR _EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); -_VOID _EXFUN(vec_free,(_PTR)); +void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); +void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); +_VOID _EXFUN(vec_free,(void *)); #define _vec_freer _freer -_PTR _EXFUN(vec_malloc,(size_t __size)); +void *_EXFUN(vec_malloc,(size_t __size)); #define _vec_mallocr _memalign_r -_PTR _EXFUN(vec_realloc,(_PTR __r, size_t __size)); -_PTR _EXFUN(_vec_realloc_r,(struct _reent *, _PTR __r, size_t __size)); +void *_EXFUN(vec_realloc,(void *__r, size_t __size)); +void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size)); # endif /* __ALTIVEC__ */ diff --git a/newlib/libc/machine/powerpc/machine/stdlib.h b/newlib/libc/machine/powerpc/machine/stdlib.h index 1cf18371a..bc9b9cfe9 100644 --- a/newlib/libc/machine/powerpc/machine/stdlib.h +++ b/newlib/libc/machine/powerpc/machine/stdlib.h @@ -5,14 +5,14 @@ # if defined(__ALTIVEC__) -_PTR _EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); -_PTR _EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); -_VOID _EXFUN(vec_free,(_PTR)); +void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); +void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); +_VOID _EXFUN(vec_free,(void *)); #define _vec_freer _freer -_PTR _EXFUN(vec_malloc,(size_t __size)); +void *_EXFUN(vec_malloc,(size_t __size)); #define _vec_mallocr _memalign_r -_PTR _EXFUN(vec_realloc,(_PTR __r, size_t __size)); -_PTR _EXFUN(_vec_realloc_r,(struct _reent *, _PTR __r, size_t __size)); +void *_EXFUN(vec_realloc,(void *__r, size_t __size)); +void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size)); # endif /* __ALTIVEC__ */ diff --git a/newlib/libc/machine/powerpc/vec_calloc.c b/newlib/libc/machine/powerpc/vec_calloc.c index 8a10507d3..cc156bc76 100644 --- a/newlib/libc/machine/powerpc/vec_calloc.c +++ b/newlib/libc/machine/powerpc/vec_calloc.c @@ -43,7 +43,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifndef _REENT_ONLY -_PTR +void * _DEFUN (vec_calloc, (n, size), size_t n, size_t size) diff --git a/newlib/libc/machine/powerpc/vec_free.c b/newlib/libc/machine/powerpc/vec_free.c index b55c52dde..fa2ea9686 100644 --- a/newlib/libc/machine/powerpc/vec_free.c +++ b/newlib/libc/machine/powerpc/vec_free.c @@ -7,7 +7,7 @@ void _DEFUN (vec_free, (aptr), - _PTR aptr) + void *aptr) { _free_r (_REENT, aptr); } diff --git a/newlib/libc/machine/powerpc/vec_malloc.c b/newlib/libc/machine/powerpc/vec_malloc.c index 181f360f0..ad62b119f 100644 --- a/newlib/libc/machine/powerpc/vec_malloc.c +++ b/newlib/libc/machine/powerpc/vec_malloc.c @@ -95,7 +95,7 @@ Supporting OS subroutines required: <>. */ #ifndef _REENT_ONLY -_PTR +void * _DEFUN (vec_malloc, (nbytes), size_t nbytes) /* get a block */ { diff --git a/newlib/libc/machine/powerpc/vec_realloc.c b/newlib/libc/machine/powerpc/vec_realloc.c index 7e857b55a..05ee82be1 100644 --- a/newlib/libc/machine/powerpc/vec_realloc.c +++ b/newlib/libc/machine/powerpc/vec_realloc.c @@ -6,9 +6,9 @@ #ifndef _REENT_ONLY -_PTR +void * _DEFUN (vec_realloc, (ap, nbytes), - _PTR ap, + void *ap, size_t nbytes) { return _vec_realloc_r (_REENT, ap, nbytes); diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index df5344e20..b27a0b81c 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -928,7 +928,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) *p = 0; res = (*ccfn) (rptr, buf, (char **) NULL, base); if ((flags & POINTER) && !(flags & VECTOR)) - *(va_arg (ap, _PTR *)) = (_PTR) (unsigned _POINTER_INT) res; + *(va_arg (ap, void **)) = (void *) (unsigned _POINTER_INT) res; else if (flags & SHORT) { if (!(flags & VECTOR)) diff --git a/newlib/libc/machine/spu/fread.c b/newlib/libc/machine/spu/fread.c index 3ea24cc4a..8a6e9c417 100644 --- a/newlib/libc/machine/spu/fread.c +++ b/newlib/libc/machine/spu/fread.c @@ -50,7 +50,7 @@ typedef struct size_t _DEFUN (fread, (buf, size, count, fp), - _PTR __restrict buf, + void *__restrict buf, size_t size, size_t count, FILE *__restrict fp) diff --git a/newlib/libc/machine/spu/fwrite.c b/newlib/libc/machine/spu/fwrite.c index 149eb1345..0db2f549b 100644 --- a/newlib/libc/machine/spu/fwrite.c +++ b/newlib/libc/machine/spu/fwrite.c @@ -50,7 +50,7 @@ typedef struct size_t _DEFUN (fwrite, (buf, size, count, fp), - const _PTR __restrict buf, + const void *__restrict buf, size_t size, size_t count, FILE * fp) diff --git a/newlib/libc/machine/xstormy16/mallocr.c b/newlib/libc/machine/xstormy16/mallocr.c index 23e02f74c..07be53039 100644 --- a/newlib/libc/machine/xstormy16/mallocr.c +++ b/newlib/libc/machine/xstormy16/mallocr.c @@ -1,7 +1,7 @@ #include #ifdef DEFINE_MALLOC -_PTR +void * _malloc_r (struct _reent *r, size_t sz) { return malloc (sz); @@ -9,7 +9,7 @@ _malloc_r (struct _reent *r, size_t sz) #endif #ifdef DEFINE_CALLOC -_PTR +void * _calloc_r (struct _reent *r, size_t a, size_t b) { return calloc (a, b); @@ -18,15 +18,15 @@ _calloc_r (struct _reent *r, size_t a, size_t b) #ifdef DEFINE_FREE void -_free_r (struct _reent *r, _PTR x) +_free_r (struct _reent *r, void *x) { free (x); } #endif #ifdef DEFINE_REALLOC -_PTR -_realloc_r (struct _reent *r, _PTR x, size_t sz) +void * +_realloc_r (struct _reent *r, void *x, size_t sz) { return realloc (x, sz); } diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c index edc6fd08b..9a3a694cc 100644 --- a/newlib/libc/reent/readr.c +++ b/newlib/libc/reent/readr.c @@ -41,7 +41,7 @@ _ssize_t _DEFUN (_read_r, (ptr, fd, buf, cnt), struct _reent *ptr, int fd, - _PTR buf, + void *buf, size_t cnt) { _ssize_t ret; diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index 4c4f95f77..8d4b37530 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -41,7 +41,7 @@ _ssize_t _DEFUN (_write_r, (ptr, fd, buf, cnt), struct _reent *ptr, int fd, - const _PTR buf, + const void *buf, size_t cnt) { _ssize_t ret; diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index 86380a816..79a489680 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -55,15 +55,15 @@ No supporting OS subroutines are required. #include -_PTR +void * _DEFUN (bsearch, (key, base, nmemb, size, compar), - const _PTR key, - const _PTR base, + const void *key, + const void *base, size_t nmemb, size_t size, - int _EXFNPTR(compar, (const _PTR, const _PTR))) + int _EXFNPTR(compar, (const void *, const void *))) { - _PTR current; + void *current; size_t lower = 0; size_t upper = nmemb; size_t index; @@ -75,7 +75,7 @@ _DEFUN (bsearch, (key, base, nmemb, size, compar), while (lower < upper) { index = (lower + upper) / 2; - current = (_PTR) (((char *) base) + (index * size)); + current = (void *) (((char *) base) + (index * size)); result = compar (key, current); diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c index 82b7a9bc2..876a94117 100644 --- a/newlib/libc/stdio/fdopen.c +++ b/newlib/libc/stdio/fdopen.c @@ -94,7 +94,7 @@ _DEFUN(_fdopen_r, (ptr, fd, mode), _fcntl_r (ptr, fd, F_SETFL, fdflags | O_APPEND); #endif fp->_file = fd; - fp->_cookie = (_PTR) fp; + fp->_cookie = (void *) fp; #undef _read #undef _write diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c index 5edeef957..d4e0af35c 100644 --- a/newlib/libc/stdio/fgets.c +++ b/newlib/libc/stdio/fgets.c @@ -164,20 +164,20 @@ _DEFUN(_fgets_r, (ptr, buf, n, fp), */ if (len > n) len = n; - t = (unsigned char *) memchr ((_PTR) p, '\n', len); + t = (unsigned char *) memchr ((void *) p, '\n', len); if (t != 0) { len = ++t - p; fp->_r -= len; fp->_p = t; - _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len); + _CAST_VOID memcpy ((void *) s, (void *) p, len); s[len] = 0; _newlib_flockfile_exit (fp); return (buf); } fp->_r -= len; fp->_p += len; - _CAST_VOID memcpy ((_PTR) s, (_PTR) p, len); + _CAST_VOID memcpy ((void *) s, (void *) p, len); s += len; } while ((n -= len) != 0); diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c index e6b044557..57268945f 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -142,7 +142,7 @@ _DEFUN(_fopen_r, (ptr, file, mode), fp->_file = f; fp->_flags = flags; - fp->_cookie = (_PTR) fp; + fp->_cookie = (void *) fp; fp->_read = __sread; fp->_write = __swrite; fp->_seek = __sseek; diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index cff60efe1..58aa2c68d 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -144,7 +144,7 @@ _DEFUN(crlf_r, (ptr, fp, buf, count, eof), size_t _DEFUN(_fread_r, (ptr, buf, size, count, fp), struct _reent * ptr, - _PTR __restrict buf, + void *__restrict buf, size_t size, size_t count, FILE * __restrict fp) @@ -173,7 +173,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), { /* First copy any available characters from ungetc buffer. */ int copy_size = resid > fp->_r ? fp->_r : resid; - _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) copy_size); + _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) copy_size); fp->_p += copy_size; fp->_r -= copy_size; p += copy_size; @@ -222,7 +222,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), { while (resid > (r = fp->_r)) { - _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r); + _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r); fp->_p += r; /* fp->_r = 0 ... done in __srefill */ p += r; @@ -241,7 +241,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), return (total - resid) / size; } } - _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid); + _CAST_VOID memcpy ((void *) p, (void *) fp->_p, resid); fp->_r -= resid; fp->_p += resid; } @@ -261,7 +261,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), #ifndef _REENT_ONLY size_t _DEFUN(fread, (buf, size, count, fp), - _PTR __restrict buf, + void *__restrict buf, size_t size, size_t count, FILE *__restrict fp) diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c index 7e70b9a98..46cbd81ce 100644 --- a/newlib/libc/stdio/freopen.c +++ b/newlib/libc/stdio/freopen.c @@ -221,7 +221,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp), fp->_flags = flags; fp->_file = f; - fp->_cookie = (_PTR) fp; + fp->_cookie = (void *) fp; fp->_read = __sread; fp->_write = __swrite; fp->_seek = __sseek; diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c index 58bb9511b..a2ed1b5b5 100644 --- a/newlib/libc/stdio/fseeko.c +++ b/newlib/libc/stdio/fseeko.c @@ -99,7 +99,7 @@ _DEFUN(_fseeko_r, (ptr, fp, offset, whence), _off_t offset, int whence) { - _fpos_t _EXFNPTR(seekfn, (struct _reent *, _PTR, _fpos_t, int)); + _fpos_t _EXFNPTR(seekfn, (struct _reent *, void *, _fpos_t, int)); _fpos_t target; _fpos_t curoff = 0; size_t n; diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index c93888dc4..95bd34c6d 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -26,7 +26,7 @@ #include "fvwrite.h" #define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define COPY(n) _CAST_VOID memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (n)) +#define COPY(n) _CAST_VOID memmove ((void *) fp->_p, (void *) p, (size_t) (n)) #define GETIOV(extra_work) \ while (len == 0) \ @@ -219,7 +219,7 @@ _DEFUN(__sfvwrite_r, (ptr, fp, uio), GETIOV (nlknown = 0); if (!nlknown) { - nl = memchr ((_PTR) p, '\n', len); + nl = memchr ((void *) p, '\n', len); nldist = nl ? nl + 1 - p : len + 1; nlknown = 1; } diff --git a/newlib/libc/stdio/fvwrite.h b/newlib/libc/stdio/fvwrite.h index 8b01a2a9d..91cabc890 100644 --- a/newlib/libc/stdio/fvwrite.h +++ b/newlib/libc/stdio/fvwrite.h @@ -22,7 +22,7 @@ * I/O descriptors for __sfvwrite_r(). */ struct __siov { - const _PTR iov_base; + const void *iov_base; size_t iov_len; }; struct __suio { diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c index cfaa2499a..7dec80c1a 100644 --- a/newlib/libc/stdio/fwrite.c +++ b/newlib/libc/stdio/fwrite.c @@ -110,7 +110,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; size_t _DEFUN(_fwrite_r, (ptr, buf, size, count, fp), struct _reent * ptr, - const _PTR __restrict buf, + const void *__restrict buf, size_t size, size_t count, FILE * __restrict fp) @@ -171,7 +171,7 @@ ret: #ifndef _REENT_ONLY size_t _DEFUN(fwrite, (buf, size, count, fp), - const _PTR __restrict buf, + const void *__restrict buf, size_t size, size_t count, FILE * fp) diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c index ac1276b48..c76527da6 100644 --- a/newlib/libc/stdio/makebuf.c +++ b/newlib/libc/stdio/makebuf.c @@ -39,7 +39,7 @@ _DEFUN(__smakebuf_r, (ptr, fp), struct _reent *ptr, register FILE *fp) { - register _PTR p; + register void *p; int flags; size_t size; int couldbetty; diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index df20783c6..e87f374fc 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -239,7 +239,7 @@ _DEFUN(__ssputs_r, (ptr, fp, buf, len), if (len < w) w = len; - (void)memmove ((_PTR) fp->_p, (_PTR) buf, (size_t) (w)); + (void)memmove ((void *) fp->_p, (void *) buf, (size_t) (w)); fp->_w -= w; fp->_p += w; return 0; @@ -331,7 +331,7 @@ _DEFUN(__ssprint_r, (ptr, fp, uio), if (len < w) w = len; - (void)memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (w)); + (void)memmove ((void *) fp->_p, (void *) p, (size_t) (w)); fp->_w -= w; fp->_p += w; /* Pretend we copied all. */ diff --git a/newlib/libc/stdio/nano-vfprintf_local.h b/newlib/libc/stdio/nano-vfprintf_local.h index f883741d2..15ddce08e 100644 --- a/newlib/libc/stdio/nano-vfprintf_local.h +++ b/newlib/libc/stdio/nano-vfprintf_local.h @@ -114,7 +114,7 @@ extern char *_dtoa_r (struct _reent *, double, int, #define u_quad_t unsigned long typedef quad_t * quad_ptr_t; -typedef _PTR void_ptr_t; +typedef void *void_ptr_t; typedef char * char_ptr_t; typedef long * long_ptr_t; typedef int * int_ptr_t; diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index f530480b6..15e0a5e8d 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -264,7 +264,7 @@ _DEFUN(__ssrefill_r, (ptr, fp), #else int _EXFUN (_sungetc_r, (struct _reent *, int, register FILE *)); int _EXFUN (__ssrefill_r, (struct _reent *, register FILE *)); -size_t _EXFUN (_sfread_r, (struct _reent *, _PTR buf, size_t, size_t, FILE *)); +size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *)); #endif /* !STRING_ONLY. */ int diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c index 684a8b582..6ce0ee1fe 100644 --- a/newlib/libc/stdio/setvbuf.c +++ b/newlib/libc/stdio/setvbuf.c @@ -123,7 +123,7 @@ _DEFUN(setvbuf, (fp, buf, mode, size), FREEUB(reent, fp); fp->_r = fp->_lbfsize = 0; if (fp->_flags & __SMBF) - _free_r (reent, (_PTR) fp->_bf._base); + _free_r (reent, (void *) fp->_bf._base); fp->_flags &= ~(__SLBF | __SNBF | __SMBF | __SOPT | __SNPT | __SEOF); if (mode == _IONBF) diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c index e64c061dd..0e8016b12 100644 --- a/newlib/libc/stdio/stdio.c +++ b/newlib/libc/stdio/stdio.c @@ -65,7 +65,7 @@ _DEFUN(__sread, (ptr, cookie, buf, n), _READ_WRITE_RETURN_TYPE _DEFUN(__seofread, (ptr, cookie, buf, len), struct _reent *_ptr, - _PTR cookie, + void *cookie, char *buf, _READ_WRITE_BUFSIZE_TYPE len) { diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c index 98590478b..f7e12880e 100644 --- a/newlib/libc/stdio/ungetc.c +++ b/newlib/libc/stdio/ungetc.c @@ -100,10 +100,10 @@ _DEFUN(__submore, (rptr, fp), return 0; } i = fp->_ub._size; - p = (unsigned char *) _realloc_r (rptr, (_PTR) (fp->_ub._base), i << 1); + p = (unsigned char *) _realloc_r (rptr, (void *) (fp->_ub._base), i << 1); if (p == NULL) return EOF; - _CAST_VOID memcpy ((_PTR) (p + i), (_PTR) p, (size_t) i); + _CAST_VOID memcpy ((void *) (p + i), (void *) p, (size_t) i); fp->_p = p + i; fp->_ub._base = p; fp->_ub._size = i << 1; diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 674322b31..4fbac0562 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -254,7 +254,7 @@ _DEFUN(__ssputs_r, (ptr, fp, buf, len), } if (len < w) w = len; - (void)memmove ((_PTR) fp->_p, (_PTR) buf, (size_t) (w)); + (void)memmove ((void *) fp->_p, (void *) buf, (size_t) (w)); fp->_w -= w; fp->_p += w; @@ -339,7 +339,7 @@ _DEFUN(__ssprint_r, (ptr, fp, uio), } if (len < w) w = len; - (void)memmove ((_PTR) fp->_p, (_PTR) p, (size_t) (w)); + (void)memmove ((void *) fp->_p, (void *) p, (size_t) (w)); fp->_w -= w; fp->_p += w; w = len; /* pretend we copied all */ @@ -571,7 +571,7 @@ static int exponent(char *, int, int); #endif typedef quad_t * quad_ptr_t; -typedef _PTR void_ptr_t; +typedef void *void_ptr_t; typedef char * char_ptr_t; typedef long * long_ptr_t; typedef int * int_ptr_t; @@ -1175,7 +1175,7 @@ reswitch: switch (ch) { if (ch == 'C' || (flags & LONGINT)) { mbstate_t ps; - memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); + memset ((void *)&ps, '\0', sizeof (mbstate_t)); if ((size = (int)_wcrtomb_r (data, cp, (wchar_t)GET_ARG (N, ap, wint_t), &ps)) == -1) { @@ -1463,7 +1463,7 @@ string: wcp = (const wchar_t *)cp; size = m = 0; - memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); + memset ((void *)&ps, '\0', sizeof (mbstate_t)); /* Count number of bytes needed for multibyte string that will be produced from widechar @@ -1509,7 +1509,7 @@ string: cp = buf; /* Convert widechar string to multibyte string. */ - memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); + memset ((void *)&ps, '\0', sizeof (mbstate_t)); if (_wcsrtombs_r (data, cp, &wcp, size, &ps) != size) { fp->_flags |= __SERR; diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 38ef36ea5..8009699e4 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -349,7 +349,7 @@ _DEFUN(__ssrefill_r, (ptr, fp), size_t _DEFUN(_sfread_r, (ptr, buf, size, count, fp), struct _reent * ptr, - _PTR buf, + void *buf, size_t size, size_t count, FILE * fp) @@ -367,7 +367,7 @@ _DEFUN(_sfread_r, (ptr, buf, size, count, fp), while (resid > (r = fp->_r)) { - _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, (size_t) r); + _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r); fp->_p += r; fp->_r = 0; p += r; @@ -378,7 +378,7 @@ _DEFUN(_sfread_r, (ptr, buf, size, count, fp), return (total - resid) / size; } } - _CAST_VOID memcpy ((_PTR) p, (_PTR) fp->_p, resid); + _CAST_VOID memcpy ((void *) p, (void *) fp->_p, resid); fp->_r -= resid; fp->_p += resid; return count; @@ -386,7 +386,7 @@ _DEFUN(_sfread_r, (ptr, buf, size, count, fp), #else /* !STRING_ONLY || !INTEGER_ONLY */ int _EXFUN (_sungetc_r, (struct _reent *, int, register FILE *)); int _EXFUN (__ssrefill_r, (struct _reent *, register FILE *)); -size_t _EXFUN (_sfread_r, (struct _reent *, _PTR buf, size_t, size_t, FILE *)); +size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *)); #endif /* !STRING_ONLY || !INTEGER_ONLY */ static inline int diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index 1054eb942..449b628db 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -289,7 +289,7 @@ static int wexponent(wchar_t *, int, int); #endif typedef quad_t * quad_ptr_t; -typedef _PTR void_ptr_t; +typedef void *void_ptr_t; typedef char * char_ptr_t; typedef wchar_t* wchar_ptr_t; typedef long * long_ptr_t; @@ -1199,7 +1199,7 @@ string: if (prec >= 0) { char *p = arg; - memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); + memset ((void *)&ps, '\0', sizeof (mbstate_t)); while (nchars < (size_t)prec) { nconv = mbrlen (p, MB_CUR_MAX, &ps); if (nconv == 0 || nconv == (size_t)-1 || @@ -1224,7 +1224,7 @@ string: cp = malloc_buf; } else cp = buf; - memset ((_PTR)&ps, '\0', sizeof (mbstate_t)); + memset ((void *)&ps, '\0', sizeof (mbstate_t)); p = cp; while (insize != 0) { nconv = _mbrtowc_r (data, p, arg, insize, &ps); diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 73d8f3209..3ac6ecc07 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -936,7 +936,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), else mbp = GET_ARG(N, ap, char *); n = 0; - memset ((_PTR)&mbs, '\0', sizeof (mbstate_t)); + memset ((void *)&mbs, '\0', sizeof (mbstate_t)); while (width != 0 && (wi = _fgetwc_r (rptr, fp)) != WEOF) { nconv = _wcrtomb_r (rptr, mbp, wi, &mbs); @@ -1028,7 +1028,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), else mbp = GET_ARG(N, ap, char *); n = 0; - memset ((_PTR) &mbs, '\0', sizeof (mbstate_t)); + memset ((void *) &mbs, '\0', sizeof (mbstate_t)); while ((wi = _fgetwc_r (rptr, fp)) != WEOF && width != 0 && INCCL (wi)) { @@ -1117,7 +1117,7 @@ _DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), #endif else mbp = GET_ARG(N, ap, char *); - memset ((_PTR) &mbs, '\0', sizeof (mbstate_t)); + memset ((void *) &mbs, '\0', sizeof (mbstate_t)); while ((wi = _fgetwc_r (rptr, fp)) != WEOF && width != 0 && !iswspace (wi)) { diff --git a/newlib/libc/stdio64/fdopen64.c b/newlib/libc/stdio64/fdopen64.c index f0c3c0784..3c8d4fa05 100644 --- a/newlib/libc/stdio64/fdopen64.c +++ b/newlib/libc/stdio64/fdopen64.c @@ -76,7 +76,7 @@ _DEFUN (_fdopen64_r, (ptr, fd, mode), _fcntl_r (ptr, fd, F_SETFL, fdflags | O_APPEND); #endif fp->_file = fd; - fp->_cookie = (_PTR) fp; + fp->_cookie = (void *) fp; #undef _read #undef _write diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c index 6bdf61973..406afa190 100644 --- a/newlib/libc/stdio64/fopen64.c +++ b/newlib/libc/stdio64/fopen64.c @@ -93,7 +93,7 @@ _DEFUN (_fopen64_r, (ptr, file, mode), fp->_file = f; fp->_flags = flags; - fp->_cookie = (_PTR) fp; + fp->_cookie = (void *) fp; fp->_read = __sread; fp->_write = __swrite64; fp->_seek = __sseek; diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c index 02995b98a..d267899c6 100644 --- a/newlib/libc/stdio64/freopen64.c +++ b/newlib/libc/stdio64/freopen64.c @@ -222,7 +222,7 @@ _DEFUN (_freopen64_r, (ptr, file, mode, fp), fp->_flags = flags; fp->_file = f; - fp->_cookie = (_PTR) fp; + fp->_cookie = (void *) fp; fp->_read = __sread; fp->_write = __swrite64; fp->_seek = __sseek; diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c index e6c1ee643..ad70fcd33 100644 --- a/newlib/libc/stdlib/__call_atexit.c +++ b/newlib/libc/stdlib/__call_atexit.c @@ -66,7 +66,7 @@ register_fini(void) void _DEFUN (__call_exitprocs, (code, d), - int code, _PTR d) + int code, void *d) { register struct _atexit *p; struct _atexit **lastp; @@ -119,9 +119,9 @@ _DEFUN (__call_exitprocs, (code, d), if (!args || (args->_fntypes & i) == 0) fn (); else if ((args->_is_cxa & i) == 0) - (*((void (*)(int, _PTR)) fn))(code, args->_fnargs[n]); + (*((void (*)(int, void *)) fn))(code, args->_fnargs[n]); else - (*((void (*)(_PTR)) fn))(args->_fnargs[n]); + (*((void (*)(void *)) fn))(args->_fnargs[n]); /* The function we called call atexit and registered another function (or functions). Call these new functions before diff --git a/newlib/libc/stdlib/atexit.h b/newlib/libc/stdlib/atexit.h index eadc7d13d..df99963d5 100644 --- a/newlib/libc/stdlib/atexit.h +++ b/newlib/libc/stdlib/atexit.h @@ -9,6 +9,6 @@ enum __atexit_types __et_cxa }; -void __call_exitprocs (int, _PTR); -int __register_exitproc (int, void (*fn) (void), _PTR, _PTR); +void __call_exitprocs (int, void *); +int __register_exitproc (int, void (*fn) (void), void *, void *); diff --git a/newlib/libc/stdlib/calloc.c b/newlib/libc/stdlib/calloc.c index dfdb7f5dc..f853f4f3c 100644 --- a/newlib/libc/stdlib/calloc.c +++ b/newlib/libc/stdlib/calloc.c @@ -45,7 +45,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifndef _REENT_ONLY -_PTR +void * _DEFUN (calloc, (n, size), size_t n, size_t size) diff --git a/newlib/libc/stdlib/cxa_atexit.c b/newlib/libc/stdlib/cxa_atexit.c index c03894c4a..096add4fa 100644 --- a/newlib/libc/stdlib/cxa_atexit.c +++ b/newlib/libc/stdlib/cxa_atexit.c @@ -30,7 +30,7 @@ _DEFUN (__cxa_atexit, { #ifdef _LITE_EXIT /* Refer to comments in __atexit.c for more details of lite exit. */ - int __register_exitproc (int, void (*fn) (void), _PTR, _PTR) + int __register_exitproc (int, void (*fn) (void), void *, void *) __attribute__ ((weak)); if (!__register_exitproc) diff --git a/newlib/libc/stdlib/exit.c b/newlib/libc/stdlib/exit.c index 481985cd1..8fa949081 100644 --- a/newlib/libc/stdlib/exit.c +++ b/newlib/libc/stdlib/exit.c @@ -55,7 +55,7 @@ _DEFUN (exit, (code), { #ifdef _LITE_EXIT /* Refer to comments in __atexit.c for more details of lite exit. */ - void __call_exitprocs (int, _PTR)) __attribute__((weak); + void __call_exitprocs (int, void *)) __attribute__((weak); if (__call_exitprocs) #endif __call_exitprocs (code, NULL); diff --git a/newlib/libc/stdlib/malign.c b/newlib/libc/stdlib/malign.c index d36846f98..e7d56bb51 100644 --- a/newlib/libc/stdlib/malign.c +++ b/newlib/libc/stdlib/malign.c @@ -8,7 +8,7 @@ #ifndef _REENT_ONLY -_PTR +void * _DEFUN (memalign, (align, nbytes), size_t align, size_t nbytes) diff --git a/newlib/libc/stdlib/malloc.c b/newlib/libc/stdlib/malloc.c index 9cf897852..5acaa85d3 100644 --- a/newlib/libc/stdlib/malloc.c +++ b/newlib/libc/stdlib/malloc.c @@ -158,7 +158,7 @@ Supporting OS subroutines required: <>. */ #ifndef _REENT_ONLY -_PTR +void * _DEFUN (malloc, (nbytes), size_t nbytes) /* get a block */ { @@ -167,7 +167,7 @@ _DEFUN (malloc, (nbytes), void _DEFUN (free, (aptr), - _PTR aptr) + void *aptr) { _free_r (_REENT, aptr); } diff --git a/newlib/libc/stdlib/msize.c b/newlib/libc/stdlib/msize.c index e33e4aa37..8c2b221e4 100644 --- a/newlib/libc/stdlib/msize.c +++ b/newlib/libc/stdlib/msize.c @@ -10,7 +10,7 @@ size_t _DEFUN (malloc_usable_size, (ptr), - _PTR ptr) + void *ptr) { return _malloc_usable_size_r (_REENT, ptr); } diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index b21cf0cb2..329b25425 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -68,8 +68,8 @@ const void * const __on_exit_dummy = &__on_exit_args; int _DEFUN (on_exit, (fn, arg), - _VOID _EXFNPTR(fn, (int, _PTR)), - _PTR arg) + _VOID _EXFNPTR(fn, (int, void *)), + void *arg) { return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL); } diff --git a/newlib/libc/stdlib/realloc.c b/newlib/libc/stdlib/realloc.c index 8258e211e..00a88a5a2 100644 --- a/newlib/libc/stdlib/realloc.c +++ b/newlib/libc/stdlib/realloc.c @@ -10,9 +10,9 @@ int _dummy_realloc = 1; #ifndef _REENT_ONLY -_PTR +void * _DEFUN (realloc, (ap, nbytes), - _PTR ap, + void *ap, size_t nbytes) { return _realloc_r (_REENT, ap, nbytes); diff --git a/newlib/libc/stdlib/reallocf.c b/newlib/libc/stdlib/reallocf.c index b3f1b2aab..c4aaeaeaa 100644 --- a/newlib/libc/stdlib/reallocf.c +++ b/newlib/libc/stdlib/reallocf.c @@ -30,10 +30,10 @@ #include -_PTR +void * _DEFUN (_reallocf_r, (reentptr, ptr, size), struct _reent *reentptr, - _PTR ptr, + void *ptr, size_t size) { void *nptr; @@ -45,9 +45,9 @@ _DEFUN (_reallocf_r, (reentptr, ptr, size), } #ifndef _REENT_ONLY -_PTR +void * _DEFUN (reallocf, (ptr, size), - _PTR ptr, + void *ptr, size_t size) { return _reallocf_r(_REENT, ptr, size); diff --git a/newlib/libc/stdlib/valloc.c b/newlib/libc/stdlib/valloc.c index 26a44df44..83a839e31 100644 --- a/newlib/libc/stdlib/valloc.c +++ b/newlib/libc/stdlib/valloc.c @@ -8,14 +8,14 @@ #ifndef _REENT_ONLY -_PTR +void * _DEFUN (valloc, (nbytes), size_t nbytes) { return _valloc_r (_REENT, nbytes); } -_PTR +void * _DEFUN (pvalloc, (nbytes), size_t nbytes) { diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c index b03b504c1..9b94061cb 100644 --- a/newlib/libc/string/memccpy.c +++ b/newlib/libc/string/memccpy.c @@ -55,16 +55,16 @@ PORTABILITY #endif -_PTR +void * _DEFUN (memccpy, (dst0, src0, endchar, len0), - _PTR __restrict dst0, - const _PTR __restrict src0, + void *__restrict dst0, + const void *__restrict src0, int endchar0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) - _PTR ptr = NULL; + void *ptr = NULL; char *dst = (char *) dst0; char *src = (char *) src0; char endchar = endchar0 & 0xff; @@ -80,7 +80,7 @@ _DEFUN (memccpy, (dst0, src0, endchar, len0), return ptr; #else - _PTR ptr = NULL; + void *ptr = NULL; char *dst = dst0; const char *src = src0; long *aligned_dst; diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c index 9660ed383..91f0b3788 100644 --- a/newlib/libc/string/memchr.c +++ b/newlib/libc/string/memchr.c @@ -61,9 +61,9 @@ QUICKREF to fill (long)MASK. */ #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) -_PTR +void * _DEFUN (memchr, (src_void, c, length), - const _PTR src_void, + const void *src_void, int c, size_t length) { diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c index 37d653a26..c05cf5745 100644 --- a/newlib/libc/string/memcmp.c +++ b/newlib/libc/string/memcmp.c @@ -44,8 +44,8 @@ QUICKREF int _DEFUN (memcmp, (m1, m2, n), - const _PTR m1, - const _PTR m2, + const void *m1, + const void *m2, size_t n) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index 919379053..e1ae0ffe9 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -43,17 +43,17 @@ QUICKREF /* Threshhold for punting to the byte copier. */ #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) -_PTR +void * _DEFUN (memcpy, (dst0, src0, len0), - _PTR __restrict dst0, - const _PTR __restrict src0, + void *__restrict dst0, + const void *__restrict src0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) char *dst = (char *) dst0; char *src = (char *) src0; - _PTR save = dst0; + void *save = dst0; while (len0--) { diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c index e50ab587a..70adb836c 100644 --- a/newlib/libc/string/memmove.c +++ b/newlib/libc/string/memmove.c @@ -48,11 +48,11 @@ QUICKREF #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) /*SUPPRESS 20*/ -_PTR +void * __inhibit_loop_to_libcall _DEFUN (memmove, (dst_void, src_void, length), - _PTR dst_void, - const _PTR src_void, + void *dst_void, + const void *src_void, size_t length) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c index 79cbf2350..babaea006 100644 --- a/newlib/libc/string/mempcpy.c +++ b/newlib/libc/string/mempcpy.c @@ -42,10 +42,10 @@ PORTABILITY /* Threshhold for punting to the byte copier. */ #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) -_PTR +void * _DEFUN (mempcpy, (dst0, src0, len0), - _PTR dst0, - const _PTR src0, + void *dst0, + const void *src0, size_t len0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c index 7a28e2733..432f46212 100644 --- a/newlib/libc/string/memrchr.c +++ b/newlib/libc/string/memrchr.c @@ -61,9 +61,9 @@ QUICKREF to fill (long)MASK. */ #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) -_PTR +void * _DEFUN (memrchr, (src_void, c, length), - const _PTR src_void, + const void *src_void, int c, size_t length) { diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c index 284c36e2c..5ce15c5aa 100644 --- a/newlib/libc/string/memset.c +++ b/newlib/libc/string/memset.c @@ -33,10 +33,10 @@ QUICKREF #define UNALIGNED(X) ((long)X & (LBLOCKSIZE - 1)) #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) -_PTR +void * __inhibit_loop_to_libcall _DEFUN (memset, (m, c, n), - _PTR m, + void *m, int c, size_t n) { diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c index b2078dc27..881bd231a 100644 --- a/newlib/libc/string/rawmemchr.c +++ b/newlib/libc/string/rawmemchr.c @@ -60,9 +60,9 @@ QUICKREF to fill (long)MASK. */ #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) -_PTR +void * _DEFUN (rawmemchr, (src_void, c), - const _PTR src_void, + const void *src_void, int c) { const unsigned char *src = (const unsigned char *) src_void; diff --git a/newlib/libc/sys/linux/pread.c b/newlib/libc/sys/linux/pread.c index 8a016e08a..8d905598f 100644 --- a/newlib/libc/sys/linux/pread.c +++ b/newlib/libc/sys/linux/pread.c @@ -9,7 +9,7 @@ ssize_t _DEFUN (_pread_r, (rptr, fd, buf, n, off), struct _reent *rptr, int fd, - _PTR buf, + void *buf, size_t n, off_t off) { @@ -35,7 +35,7 @@ _DEFUN (_pread_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (__libc_pread, (fd, buf, n, off), int fd, - _PTR buf, + void *buf, size_t n, off_t off) { diff --git a/newlib/libc/sys/linux/pread64.c b/newlib/libc/sys/linux/pread64.c index f95989b45..20d1f9c35 100644 --- a/newlib/libc/sys/linux/pread64.c +++ b/newlib/libc/sys/linux/pread64.c @@ -32,7 +32,7 @@ Supporting OS subroutine required: <>, <>. ssize_t _DEFUN (__libc_pread64, (fd, buf, n, off), int fd, - _PTR buf, + void *buf, size_t n, loff_t off) { diff --git a/newlib/libc/sys/linux/pwrite.c b/newlib/libc/sys/linux/pwrite.c index 2db2935ed..b0ec9c233 100644 --- a/newlib/libc/sys/linux/pwrite.c +++ b/newlib/libc/sys/linux/pwrite.c @@ -9,7 +9,7 @@ ssize_t _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), struct _reent *rptr, int fd, - const _PTR buf, + const void *buf, size_t n, off_t off) { @@ -35,7 +35,7 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (__libc_pwrite, (fd, buf, n, off), int fd, - const _PTR buf, + const void *buf, size_t n, off_t off) { diff --git a/newlib/libc/sys/linux/pwrite64.c b/newlib/libc/sys/linux/pwrite64.c index d486988dd..c80a3a2d3 100644 --- a/newlib/libc/sys/linux/pwrite64.c +++ b/newlib/libc/sys/linux/pwrite64.c @@ -32,7 +32,7 @@ Supporting OS subroutine required: <>, <>. ssize_t _DEFUN (__libc_pwrite64, (fd, buf, n, off), int fd, - _PTR buf, + void *buf, size_t n, loff_t off) { diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c index 9778b985a..dca5fc8bc 100644 --- a/newlib/libc/sys/rtems/crt0.c +++ b/newlib/libc/sys/rtems/crt0.c @@ -30,7 +30,7 @@ ret func body RTEMS_STUB(void *,malloc(size_t s), { return 0; }) RTEMS_STUB(void *,realloc(void* p, size_t s), { return 0; }) RTEMS_STUB(void, free(void* ptr), { }) -RTEMS_STUB(_PTR, calloc(size_t s1, size_t s2), { return 0; }) +RTEMS_STUB(void *, calloc(size_t s1, size_t s2), { return 0; }) RTEMS_STUB(int, posix_memalign(void **p, size_t si, size_t s2), { return -1; }) /* Stubs for routines from RTEMS */ @@ -186,10 +186,10 @@ RTEMS_STUB(int, issetugid (void), { return 0; }) #endif /* stdlib.h */ -RTEMS_STUB(_PTR, _realloc_r(struct _reent *r, _PTR p, size_t s), { return 0; }) -RTEMS_STUB(_PTR, _calloc_r(struct _reent *r, size_t s1, size_t s2), { return 0; }) -RTEMS_STUB(_PTR, _malloc_r(struct _reent * r, size_t s), { return 0; }) -RTEMS_STUB(_VOID, _free_r(struct _reent *r, _PTR *p), { }) +RTEMS_STUB(void *, _realloc_r(struct _reent *r, void *p, size_t s), { return 0; }) +RTEMS_STUB(void *, _calloc_r(struct _reent *r, size_t s1, size_t s2), { return 0; }) +RTEMS_STUB(void *, _malloc_r(struct _reent * r, size_t s), { return 0; }) +RTEMS_STUB(_VOID, _free_r(struct _reent *r, void **p), { }) /* stubs for functions required by libc/stdlib */ RTEMS_STUB(void, __assert_func(const char *file, int line, const char *failedexpr), { }) diff --git a/newlib/libc/unix/pread.c b/newlib/libc/unix/pread.c index 236044465..54efe29fe 100644 --- a/newlib/libc/unix/pread.c +++ b/newlib/libc/unix/pread.c @@ -41,7 +41,7 @@ ssize_t _DEFUN (_pread_r, (rptr, fd, buf, n, off), struct _reent *rptr, int fd, - _PTR buf, + void *buf, size_t n, off_t off) { @@ -67,7 +67,7 @@ _DEFUN (_pread_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (pread, (fd, buf, n, off), int fd, - _PTR buf, + void *buf, size_t n, off_t off) { diff --git a/newlib/libc/unix/pwrite.c b/newlib/libc/unix/pwrite.c index 3bf759bd0..939d186d4 100644 --- a/newlib/libc/unix/pwrite.c +++ b/newlib/libc/unix/pwrite.c @@ -42,7 +42,7 @@ ssize_t _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), struct _reent *rptr, int fd, - const _PTR buf, + const void *buf, size_t n, off_t off) { @@ -68,7 +68,7 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), ssize_t _DEFUN (pwrite, (fd, buf, n, off), int fd, - const _PTR buf, + const void *buf, size_t n, off_t off) { diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c index fe7aaa723..b7dc6d098 100644 --- a/newlib/libc/xdr/xdr_sizeof.c +++ b/newlib/libc/xdr/xdr_sizeof.c @@ -144,7 +144,7 @@ _DEFUN (x_putint32, (xdrs, int32p), unsigned long _DEFUN (xdr_sizeof, (func, data), xdrproc_t func, - _PTR data) + void *data) { XDR x; struct xdr_ops ops; diff --git a/winsup/cygwin/include/cygwin/stdlib.h b/winsup/cygwin/include/cygwin/stdlib.h index fc8bc8486..845d2d81b 100644 --- a/winsup/cygwin/include/cygwin/stdlib.h +++ b/winsup/cygwin/include/cygwin/stdlib.h @@ -45,9 +45,9 @@ int posix_openpt (int); #define _unsetenv_r UNUSED__unsetenv_r #endif -extern _PTR memalign (size_t, size_t); +extern void *memalign (size_t, size_t); #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112) -extern _PTR valloc (size_t); +extern void *valloc (size_t); #endif #undef _malloc_r From 670b01da7f04f785df5bed9cd8e22076aa6166d5 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 20:56:37 -0600 Subject: [PATCH 212/649] ansification: remove _CAST_VOID Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/_ansi.h | 2 -- newlib/libc/include/sys/lock.h | 20 ++++++++++---------- newlib/libc/include/sys/stdio.h | 4 ++-- newlib/libc/machine/powerpc/vfscanf.c | 6 +++--- newlib/libc/stdio/fgets.c | 4 ++-- newlib/libc/stdio/findfp.c | 6 +++--- newlib/libc/stdio/fread.c | 6 +++--- newlib/libc/stdio/fvwrite.c | 2 +- newlib/libc/stdio/refill.c | 2 +- newlib/libc/stdio/rewind.c | 2 +- newlib/libc/stdio/setbuf.c | 2 +- newlib/libc/stdio/setbuffer.c | 2 +- newlib/libc/stdio/tmpfile.c | 2 +- newlib/libc/stdio/ungetc.c | 2 +- newlib/libc/stdio/vfscanf.c | 4 ++-- newlib/libc/stdio64/tmpfile64.c | 2 +- newlib/libc/string/u_strerr.c | 6 +++--- 17 files changed, 36 insertions(+), 38 deletions(-) diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index e955138fe..5e0cce4c8 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -63,7 +63,6 @@ #endif #define _DEFUN(name, arglist, args) name(args) #define _DEFUN_VOID(name) name(void) -#define _CAST_VOID (void) #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif @@ -75,7 +74,6 @@ #define _EXFUN_NOTHROW(name, proto) name() #define _DEFUN(name, arglist, args) name arglist args; #define _DEFUN_VOID(name) name() -#define _CAST_VOID #define _LONG_DOUBLE double #endif diff --git a/newlib/libc/include/sys/lock.h b/newlib/libc/include/sys/lock.h index 42f9c4cd9..528904957 100644 --- a/newlib/libc/include/sys/lock.h +++ b/newlib/libc/include/sys/lock.h @@ -13,16 +13,16 @@ typedef int _LOCK_RECURSIVE_T; #define __LOCK_INIT(class,lock) static int lock = 0; #define __LOCK_INIT_RECURSIVE(class,lock) static int lock = 0; -#define __lock_init(lock) (_CAST_VOID 0) -#define __lock_init_recursive(lock) (_CAST_VOID 0) -#define __lock_close(lock) (_CAST_VOID 0) -#define __lock_close_recursive(lock) (_CAST_VOID 0) -#define __lock_acquire(lock) (_CAST_VOID 0) -#define __lock_acquire_recursive(lock) (_CAST_VOID 0) -#define __lock_try_acquire(lock) (_CAST_VOID 0) -#define __lock_try_acquire_recursive(lock) (_CAST_VOID 0) -#define __lock_release(lock) (_CAST_VOID 0) -#define __lock_release_recursive(lock) (_CAST_VOID 0) +#define __lock_init(lock) ((void) 0) +#define __lock_init_recursive(lock) ((void) 0) +#define __lock_close(lock) ((void) 0) +#define __lock_close_recursive(lock) ((void) 0) +#define __lock_acquire(lock) ((void) 0) +#define __lock_acquire_recursive(lock) ((void) 0) +#define __lock_try_acquire(lock) ((void) 0) +#define __lock_try_acquire_recursive(lock) ((void) 0) +#define __lock_release(lock) ((void) 0) +#define __lock_release_recursive(lock) ((void) 0) #else diff --git a/newlib/libc/include/sys/stdio.h b/newlib/libc/include/sys/stdio.h index 0918fe157..91a274596 100644 --- a/newlib/libc/include/sys/stdio.h +++ b/newlib/libc/include/sys/stdio.h @@ -12,7 +12,7 @@ #ifndef __SINGLE_THREAD__ # define _flockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_acquire_recursive((fp)->_lock)) #else -# define _flockfile(fp) (_CAST_VOID 0) +# define _flockfile(fp) ((void) 0) #endif #endif @@ -20,7 +20,7 @@ #ifndef __SINGLE_THREAD__ # define _funlockfile(fp) (((fp)->_flags & __SSTR) ? 0 : __lock_release_recursive((fp)->_lock)) #else -# define _funlockfile(fp) (_CAST_VOID 0) +# define _funlockfile(fp) ((void) 0) #endif #endif diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index b27a0b81c..4a3e48c22 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -912,7 +912,7 @@ __svfscanf_r (rptr, fp, fmt0, ap) if (flags & NDIGITS) { if (p > buf) - _CAST_VOID ungetc (*(u_char *)-- p, fp); + (void) ungetc (*(u_char *)-- p, fp); goto match_failure; } c = ((u_char *) p)[-1]; @@ -1112,11 +1112,11 @@ __svfscanf_r (rptr, fp, fmt0, ap) --nread; if (c != 'e' && c != 'E') { - _CAST_VOID ungetc (c, fp); /* sign */ + (void) ungetc (c, fp); /* sign */ c = *(u_char *)-- p; --nread; } - _CAST_VOID ungetc (c, fp); + (void) ungetc (c, fp); } if ((flags & SUPPRESS) == 0) { diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c index d4e0af35c..c6ef6d3d5 100644 --- a/newlib/libc/stdio/fgets.c +++ b/newlib/libc/stdio/fgets.c @@ -170,14 +170,14 @@ _DEFUN(_fgets_r, (ptr, buf, n, fp), len = ++t - p; fp->_r -= len; fp->_p = t; - _CAST_VOID memcpy ((void *) s, (void *) p, len); + (void) memcpy ((void *) s, (void *) p, len); s[len] = 0; _newlib_flockfile_exit (fp); return (buf); } fp->_r -= len; fp->_p += len; - _CAST_VOID memcpy ((void *) s, (void *) p, len); + (void) memcpy ((void *) s, (void *) p, len); s += len; } while ((n -= len) != 0); diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index 3d928c15d..a7ea76bb5 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -230,7 +230,7 @@ _DEFUN(_cleanup_r, (ptr), if (ptr->_stderr != &__sf[2]) (*cleanup_func) (ptr, ptr->_stderr); #endif - _CAST_VOID _fwalk_reent (ptr, cleanup_func); + (void) _fwalk_reent (ptr, cleanup_func); } #ifndef _REENT_ONLY @@ -354,13 +354,13 @@ _DEFUN_VOID(__fp_lock_all) { __sfp_lock_acquire (); - _CAST_VOID _fwalk (_REENT, __fp_lock); + (void) _fwalk (_REENT, __fp_lock); } _VOID _DEFUN_VOID(__fp_unlock_all) { - _CAST_VOID _fwalk (_REENT, __fp_unlock); + (void) _fwalk (_REENT, __fp_unlock); __sfp_lock_release (); } diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index 58aa2c68d..c9180b833 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -173,7 +173,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), { /* First copy any available characters from ungetc buffer. */ int copy_size = resid > fp->_r ? fp->_r : resid; - _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) copy_size); + (void) memcpy ((void *) p, (void *) fp->_p, (size_t) copy_size); fp->_p += copy_size; fp->_r -= copy_size; p += copy_size; @@ -222,7 +222,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), { while (resid > (r = fp->_r)) { - _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r); + (void) memcpy ((void *) p, (void *) fp->_p, (size_t) r); fp->_p += r; /* fp->_r = 0 ... done in __srefill */ p += r; @@ -241,7 +241,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), return (total - resid) / size; } } - _CAST_VOID memcpy ((void *) p, (void *) fp->_p, resid); + (void) memcpy ((void *) p, (void *) fp->_p, resid); fp->_r -= resid; fp->_p += resid; } diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index 95bd34c6d..d742784e5 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -26,7 +26,7 @@ #include "fvwrite.h" #define MIN(a, b) ((a) < (b) ? (a) : (b)) -#define COPY(n) _CAST_VOID memmove ((void *) fp->_p, (void *) p, (size_t) (n)) +#define COPY(n) (void) memmove ((void *) fp->_p, (void *) p, (size_t) (n)) #define GETIOV(extra_work) \ while (len == 0) \ diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c index fc738d455..6158f3ec0 100644 --- a/newlib/libc/stdio/refill.c +++ b/newlib/libc/stdio/refill.c @@ -107,7 +107,7 @@ _DEFUN(__srefill_r, (ptr, fp), /* Ignore this file in _fwalk to avoid potential deadlock. */ short orig_flags = fp->_flags; fp->_flags = 1; - _CAST_VOID _fwalk (_GLOBAL_REENT, lflush); + (void) _fwalk (_GLOBAL_REENT, lflush); fp->_flags = orig_flags; /* Now flush this file without locking it. */ diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c index 873083b85..a09186bb0 100644 --- a/newlib/libc/stdio/rewind.c +++ b/newlib/libc/stdio/rewind.c @@ -56,7 +56,7 @@ _DEFUN(_rewind_r, (ptr, fp), struct _reent * ptr, register FILE * fp) { - _CAST_VOID _fseek_r (ptr, fp, 0L, SEEK_SET); + (void) _fseek_r (ptr, fp, 0L, SEEK_SET); clearerr (fp); } diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c index a7df3a1f4..7308ab8c2 100644 --- a/newlib/libc/stdio/setbuf.c +++ b/newlib/libc/stdio/setbuf.c @@ -69,5 +69,5 @@ _DEFUN(setbuf, (fp, buf), FILE *__restrict fp, char *__restrict buf) { - _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); + (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); } diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c index cbcbde3db..6914ca7f2 100644 --- a/newlib/libc/stdio/setbuffer.c +++ b/newlib/libc/stdio/setbuffer.c @@ -70,5 +70,5 @@ _DEFUN(setbuffer, (fp, buf, size), char *buf, int size) { - _CAST_VOID setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size); + (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, (size_t) size); } diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c index 6145ad0bc..30e9040fd 100644 --- a/newlib/libc/stdio/tmpfile.c +++ b/newlib/libc/stdio/tmpfile.c @@ -73,7 +73,7 @@ _DEFUN(_tmpfile_r, (ptr), e = ptr->_errno; if (!fp) _close_r (ptr, fd); - _CAST_VOID _remove_r (ptr, f); + (void) _remove_r (ptr, f); ptr->_errno = e; return fp; } diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c index f7e12880e..c673365b1 100644 --- a/newlib/libc/stdio/ungetc.c +++ b/newlib/libc/stdio/ungetc.c @@ -103,7 +103,7 @@ _DEFUN(__submore, (rptr, fp), p = (unsigned char *) _realloc_r (rptr, (void *) (fp->_ub._base), i << 1); if (p == NULL) return EOF; - _CAST_VOID memcpy ((void *) (p + i), (void *) p, (size_t) i); + (void) memcpy ((void *) (p + i), (void *) p, (size_t) i); fp->_p = p + i; fp->_ub._base = p; fp->_ub._size = i << 1; diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 8009699e4..d76d94b8c 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -367,7 +367,7 @@ _DEFUN(_sfread_r, (ptr, buf, size, count, fp), while (resid > (r = fp->_r)) { - _CAST_VOID memcpy ((void *) p, (void *) fp->_p, (size_t) r); + (void) memcpy ((void *) p, (void *) fp->_p, (size_t) r); fp->_p += r; fp->_r = 0; p += r; @@ -378,7 +378,7 @@ _DEFUN(_sfread_r, (ptr, buf, size, count, fp), return (total - resid) / size; } } - _CAST_VOID memcpy ((void *) p, (void *) fp->_p, resid); + (void) memcpy ((void *) p, (void *) fp->_p, resid); fp->_r -= resid; fp->_p += resid; return count; diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c index d58aa1472..58b945d5b 100644 --- a/newlib/libc/stdio64/tmpfile64.c +++ b/newlib/libc/stdio64/tmpfile64.c @@ -76,7 +76,7 @@ _DEFUN (_tmpfile64_r, (ptr), e = ptr->_errno; if (!fp) _close_r (ptr, fd); - _CAST_VOID _remove_r (ptr, f); + (void) _remove_r (ptr, f); ptr->_errno = e; return fp; } diff --git a/newlib/libc/string/u_strerr.c b/newlib/libc/string/u_strerr.c index d3204df72..174d9170f 100644 --- a/newlib/libc/string/u_strerr.c +++ b/newlib/libc/string/u_strerr.c @@ -7,9 +7,9 @@ _DEFUN(_user_strerror, (errnum, internal, errptr), int *errptr) { /* prevent warning about unused parameters */ - _CAST_VOID errnum; - _CAST_VOID internal; - _CAST_VOID errptr; + (void) errnum; + (void) internal; + (void) errptr; return 0; } From fff27f84298c8ae64879e143b068c3b2e6a11ba4 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 21:00:43 -0600 Subject: [PATCH 213/649] ansification: remove _DEFUN_VOID Signed-off-by: Yaakov Selkowitz --- libgloss/m68k/idp-inbyte.c | 2 +- libgloss/m68k/mvme-stub.c | 8 +++---- libgloss/mcore/read.c | 2 +- libgloss/read.c | 2 +- newlib/libc/include/_ansi.h | 2 -- newlib/libc/locale/locale.c | 2 +- newlib/libc/locale/localeconv.c | 2 +- newlib/libc/machine/microblaze/abort.c | 2 +- newlib/libc/machine/nds32/abort.c | 2 +- newlib/libc/machine/spu/stdio.c | 2 +- newlib/libc/machine/spu/tmpfile.c | 2 +- newlib/libc/reent/getreent.c | 2 +- newlib/libc/reent/signgam.c | 2 +- newlib/libc/search/hcreate.c | 2 +- newlib/libc/signal/signal.c | 2 +- newlib/libc/stdio/fcloseall.c | 2 +- newlib/libc/stdio/findfp.c | 14 +++++------ newlib/libc/stdio/getchar.c | 2 +- newlib/libc/stdio/getchar_u.c | 2 +- newlib/libc/stdio/getwchar.c | 2 +- newlib/libc/stdio/getwchar_u.c | 2 +- newlib/libc/stdio/tmpfile.c | 2 +- newlib/libc/stdio64/tmpfile64.c | 2 +- newlib/libc/stdlib/abort.c | 2 +- newlib/libc/stdlib/drand48.c | 2 +- newlib/libc/stdlib/lrand48.c | 2 +- newlib/libc/stdlib/mrand48.c | 2 +- newlib/libc/stdlib/mstats.c | 4 ++-- newlib/libc/stdlib/rand.c | 2 +- newlib/libc/stdlib/random.c | 2 +- newlib/libc/sys/a29khif/getpid.c | 2 +- newlib/libc/sys/linux/getlogin.c | 2 +- newlib/libc/sys/sparc64/ieee.c | 8 +++---- newlib/libc/sys/sun4/ieee.c | 8 +++---- newlib/libc/sys/sysvi386/fpx.c | 6 ++--- newlib/libc/sys/sysvnecv70/fpx.c | 6 ++--- newlib/libc/syscalls/sysfork.c | 2 +- newlib/libc/syscalls/sysgetpid.c | 2 +- newlib/libc/time/tzlock.c | 4 ++-- newlib/libc/time/tzset.c | 4 ++-- newlib/libc/xdr/xdr.c | 2 +- newlib/libc/xdr/xdr_sizeof.c | 2 +- newlib/libm/test/convert.c | 32 +++++++++++++------------- newlib/libm/test/math.c | 2 +- newlib/libm/test/math2.c | 14 +++++------ newlib/libm/test/test_ieee.c | 12 +++++----- newlib/libm/test/test_is.c | 2 +- 47 files changed, 94 insertions(+), 96 deletions(-) diff --git a/libgloss/m68k/idp-inbyte.c b/libgloss/m68k/idp-inbyte.c index 41db57fc9..c9c403cad 100644 --- a/libgloss/m68k/idp-inbyte.c +++ b/libgloss/m68k/idp-inbyte.c @@ -32,7 +32,7 @@ * from channel A */ char -_DEFUN_VOID (inbyte) +inbyte (void) { while ((READREG (DUART_SRA) & 0x01) == 0x00) ; diff --git a/libgloss/m68k/mvme-stub.c b/libgloss/m68k/mvme-stub.c index fbc4c61b5..fcf7e7bf0 100644 --- a/libgloss/m68k/mvme-stub.c +++ b/libgloss/m68k/mvme-stub.c @@ -133,7 +133,7 @@ ExceptionHook exceptionHook; /* hook variable for errors/exceptions */ /* FORWARD DECLARATIONS */ /************************/ /** static void initializeRemcomErrorFrame PARAMS ((void)); **/ -static void _DEFUN_VOID (initializeRemcomErrorFrame); +static void initializeRemcomErrorFrame (void); /************************************************************************/ /* BUFMAX defines the maximum number of characters in inbound/outbound buffers*/ @@ -203,9 +203,9 @@ jmp_buf remcomEnv; #define BREAKPOINT() asm(" trap #1"); -extern void _DEFUN_VOID (return_to_super); -extern void _DEFUN_VOID (return_to_user); -extern void _DEFUN_VOID (_catchException); +extern void return_to_super (void); +extern void return_to_user (void); +extern void _catchException (void); void _returnFromException( Frame *frame ) { diff --git a/libgloss/mcore/read.c b/libgloss/mcore/read.c index 8f394780c..d97d98d22 100644 --- a/libgloss/mcore/read.c +++ b/libgloss/mcore/read.c @@ -14,7 +14,7 @@ */ #include "glue.h" -extern char _DEFUN_VOID (inbyte); +extern char inbyte (void); /* * read -- read bytes from the serial port. Ignore fd, since diff --git a/libgloss/read.c b/libgloss/read.c index 2e5e0c72c..507c9802f 100644 --- a/libgloss/read.c +++ b/libgloss/read.c @@ -14,7 +14,7 @@ */ #include "glue.h" -extern char _DEFUN_VOID (inbyte); +extern char inbyte (void); /* * read -- read bytes from the serial port. Ignore fd, since diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 5e0cce4c8..b8d27b24e 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -62,7 +62,6 @@ #define _EXFNPTR(name, proto) (* name) proto #endif #define _DEFUN(name, arglist, args) name(args) -#define _DEFUN_VOID(name) name(void) #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif @@ -73,7 +72,6 @@ #define _EXFUN(name, proto) name() #define _EXFUN_NOTHROW(name, proto) name() #define _DEFUN(name, arglist, args) name arglist args; -#define _DEFUN_VOID(name) name() #define _LONG_DOUBLE double #endif diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index f461ef162..7080b0510 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -966,7 +966,7 @@ __get_locale_env (struct _reent *p, int category) #endif /* _MB_CAPABLE */ int -_DEFUN_VOID (__locale_mb_cur_max) +__locale_mb_cur_max (void) { #ifdef __HAVE_LOCALE_INFO__ return __get_current_ctype_locale ()->mb_cur_max[0]; diff --git a/newlib/libc/locale/localeconv.c b/newlib/libc/locale/localeconv.c index 165f6f7c3..b87f604a3 100644 --- a/newlib/libc/locale/localeconv.c +++ b/newlib/libc/locale/localeconv.c @@ -62,7 +62,7 @@ _DEFUN (_localeconv_r, (data), #ifndef _REENT_ONLY struct lconv * -_DEFUN_VOID (localeconv) +localeconv (void) { return __localeconv_l (__get_current_locale ()); } diff --git a/newlib/libc/machine/microblaze/abort.c b/newlib/libc/machine/microblaze/abort.c index 82daebe43..a2bb535e0 100644 --- a/newlib/libc/machine/microblaze/abort.c +++ b/newlib/libc/machine/microblaze/abort.c @@ -47,7 +47,7 @@ Supporting OS subroutines required: <<_exit>> and optionally, <>. #include _VOID -_DEFUN_VOID (abort) +abort (void) { #ifdef ABORT_MESSAGE write (2, "Abort called\n", sizeof ("Abort called\n")-1); diff --git a/newlib/libc/machine/nds32/abort.c b/newlib/libc/machine/nds32/abort.c index abceb4b8b..c952ce569 100644 --- a/newlib/libc/machine/nds32/abort.c +++ b/newlib/libc/machine/nds32/abort.c @@ -29,7 +29,7 @@ Supporting OS subroutines required: <<_exit>>. #include _VOID -_DEFUN_VOID (abort) +abort (void) { while (1) { diff --git a/newlib/libc/machine/spu/stdio.c b/newlib/libc/machine/spu/stdio.c index 997ccb7a0..e8b9dd9fa 100644 --- a/newlib/libc/machine/spu/stdio.c +++ b/newlib/libc/machine/spu/stdio.c @@ -82,7 +82,7 @@ _DEFUN (__sinit, (s), } _VOID -_DEFUN_VOID (__check_init) +__check_init (void) { CHECK_INIT(_REENT); } diff --git a/newlib/libc/machine/spu/tmpfile.c b/newlib/libc/machine/spu/tmpfile.c index c66f78388..e926cbc48 100644 --- a/newlib/libc/machine/spu/tmpfile.c +++ b/newlib/libc/machine/spu/tmpfile.c @@ -37,7 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY FILE * -_DEFUN_VOID (tmpfile) +tmpfile (void) { int ret; FILE* fp; diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c index 124abce2a..5fa98e96b 100644 --- a/newlib/libc/reent/getreent.c +++ b/newlib/libc/reent/getreent.c @@ -14,7 +14,7 @@ int _dummy_getreent; #endif struct _reent * -_DEFUN_VOID(__getreent) +__getreent (void) { return _impure_ptr; } diff --git a/newlib/libc/reent/signgam.c b/newlib/libc/reent/signgam.c index bfb2dea51..b1017d861 100644 --- a/newlib/libc/reent/signgam.c +++ b/newlib/libc/reent/signgam.c @@ -8,7 +8,7 @@ #ifndef _REENT_ONLY int * -_DEFUN_VOID (__signgam) +__signgam (void) { return &_REENT_SIGNGAM(_REENT); } diff --git a/newlib/libc/search/hcreate.c b/newlib/libc/search/hcreate.c index 800211689..5472de1f0 100644 --- a/newlib/libc/search/hcreate.c +++ b/newlib/libc/search/hcreate.c @@ -63,7 +63,7 @@ _DEFUN(hcreate, (nel), size_t nel) } void -_DEFUN_VOID (hdestroy) +hdestroy (void) { hdestroy_r (&htab); } diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c index 806abd888..f5fe4c0b9 100644 --- a/newlib/libc/signal/signal.c +++ b/newlib/libc/signal/signal.c @@ -213,7 +213,7 @@ _DEFUN (signal, (sig, func), } int -_DEFUN_VOID (_init_signal) +_init_signal (void) { return _init_signal_r (_REENT); } diff --git a/newlib/libc/stdio/fcloseall.c b/newlib/libc/stdio/fcloseall.c index a578e8a00..659172b32 100644 --- a/newlib/libc/stdio/fcloseall.c +++ b/newlib/libc/stdio/fcloseall.c @@ -66,7 +66,7 @@ _DEFUN(_fcloseall_r, (ptr), #ifndef _REENT_ONLY int -_DEFUN_VOID(fcloseall) +fcloseall (void) { return _fcloseall_r (_GLOBAL_REENT); } diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index a7ea76bb5..fb437515d 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -235,7 +235,7 @@ _DEFUN(_cleanup_r, (ptr), #ifndef _REENT_ONLY _VOID -_DEFUN_VOID(_cleanup) +_cleanup (void) { _cleanup_r (_GLOBAL_REENT); } @@ -304,25 +304,25 @@ __LOCK_INIT_RECURSIVE(static, __sfp_recursive_mutex); __LOCK_INIT_RECURSIVE(static, __sinit_recursive_mutex); _VOID -_DEFUN_VOID(__sfp_lock_acquire) +__sfp_lock_acquire (void) { __lock_acquire_recursive (__sfp_recursive_mutex); } _VOID -_DEFUN_VOID(__sfp_lock_release) +__sfp_lock_release (void) { __lock_release_recursive (__sfp_recursive_mutex); } _VOID -_DEFUN_VOID(__sinit_lock_acquire) +__sinit_lock_acquire (void) { __lock_acquire_recursive (__sinit_recursive_mutex); } _VOID -_DEFUN_VOID(__sinit_lock_release) +__sinit_lock_release (void) { __lock_release_recursive (__sinit_recursive_mutex); } @@ -350,7 +350,7 @@ _DEFUN(__fp_unlock, (ptr), } _VOID -_DEFUN_VOID(__fp_lock_all) +__fp_lock_all (void) { __sfp_lock_acquire (); @@ -358,7 +358,7 @@ _DEFUN_VOID(__fp_lock_all) } _VOID -_DEFUN_VOID(__fp_unlock_all) +__fp_unlock_all (void) { (void) _fwalk (_REENT, __fp_unlock); diff --git a/newlib/libc/stdio/getchar.c b/newlib/libc/stdio/getchar.c index 07ba9e64f..b3ca289ba 100644 --- a/newlib/libc/stdio/getchar.c +++ b/newlib/libc/stdio/getchar.c @@ -82,7 +82,7 @@ _DEFUN(_getchar_r, (reent), #ifndef _REENT_ONLY int -_DEFUN_VOID(getchar) +getchar (void) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/getchar_u.c b/newlib/libc/stdio/getchar_u.c index 516b4dbd2..5848d47ac 100644 --- a/newlib/libc/stdio/getchar_u.c +++ b/newlib/libc/stdio/getchar_u.c @@ -79,7 +79,7 @@ _DEFUN(_getchar_unlocked_r, (ptr), #ifndef _REENT_ONLY int -_DEFUN_VOID(getchar_unlocked) +getchar_unlocked (void) { /* CHECK_INIT is called (eventually) by __srefill_r. */ diff --git a/newlib/libc/stdio/getwchar.c b/newlib/libc/stdio/getwchar.c index 61031e5a6..f432755a0 100644 --- a/newlib/libc/stdio/getwchar.c +++ b/newlib/libc/stdio/getwchar.c @@ -103,7 +103,7 @@ _DEFUN (_getwchar_r, (ptr), * Synonym for fgetwc(stdin). */ wint_t -_DEFUN_VOID (getwchar) +getwchar (void) { _REENT_SMALL_CHECK_INIT (_REENT); return fgetwc (stdin); diff --git a/newlib/libc/stdio/getwchar_u.c b/newlib/libc/stdio/getwchar_u.c index f5c50cced..4c854f213 100644 --- a/newlib/libc/stdio/getwchar_u.c +++ b/newlib/libc/stdio/getwchar_u.c @@ -44,7 +44,7 @@ _DEFUN (_getwchar_unlocked_r, (ptr), * Synonym for fgetwc_unlocked(stdin). */ wint_t -_DEFUN_VOID (getwchar_unlocked) +getwchar_unlocked (void) { _REENT_SMALL_CHECK_INIT (_REENT); return fgetwc_unlocked (stdin); diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c index 30e9040fd..ee30523ab 100644 --- a/newlib/libc/stdio/tmpfile.c +++ b/newlib/libc/stdio/tmpfile.c @@ -81,7 +81,7 @@ _DEFUN(_tmpfile_r, (ptr), #ifndef _REENT_ONLY FILE * -_DEFUN_VOID(tmpfile) +tmpfile (void) { return _tmpfile_r (_REENT); } diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c index 58b945d5b..2012417fb 100644 --- a/newlib/libc/stdio64/tmpfile64.c +++ b/newlib/libc/stdio64/tmpfile64.c @@ -84,7 +84,7 @@ _DEFUN (_tmpfile64_r, (ptr), #ifndef _REENT_ONLY FILE * -_DEFUN_VOID (tmpfile64) +tmpfile64 (void) { return _tmpfile64_r (_REENT); } diff --git a/newlib/libc/stdlib/abort.c b/newlib/libc/stdlib/abort.c index febc07a31..ae0c2fb62 100644 --- a/newlib/libc/stdlib/abort.c +++ b/newlib/libc/stdlib/abort.c @@ -47,7 +47,7 @@ Supporting OS subroutines required: <<_exit>> and optionally, <>. #include _VOID -_DEFUN_VOID (abort) +abort (void) { #ifdef ABORT_MESSAGE write (2, "Abort called\n", sizeof ("Abort called\n")-1); diff --git a/newlib/libc/stdlib/drand48.c b/newlib/libc/stdlib/drand48.c index 89fe6af1d..6c4dca1ed 100644 --- a/newlib/libc/stdlib/drand48.c +++ b/newlib/libc/stdlib/drand48.c @@ -23,7 +23,7 @@ _DEFUN (_drand48_r, (r), #ifndef _REENT_ONLY double -_DEFUN_VOID (drand48) +drand48 (void) { return _drand48_r (_REENT); } diff --git a/newlib/libc/stdlib/lrand48.c b/newlib/libc/stdlib/lrand48.c index bfc693b75..bb3289c83 100644 --- a/newlib/libc/stdlib/lrand48.c +++ b/newlib/libc/stdlib/lrand48.c @@ -25,7 +25,7 @@ _DEFUN (_lrand48_r, (r), #ifndef _REENT_ONLY long -_DEFUN_VOID (lrand48) +lrand48 (void) { return _lrand48_r (_REENT); } diff --git a/newlib/libc/stdlib/mrand48.c b/newlib/libc/stdlib/mrand48.c index 28f4f7d2b..62b44edc9 100644 --- a/newlib/libc/stdlib/mrand48.c +++ b/newlib/libc/stdlib/mrand48.c @@ -24,7 +24,7 @@ _DEFUN (_mrand48_r, (r), #ifndef _REENT_ONLY long -_DEFUN_VOID (mrand48) +mrand48 (void) { return _mrand48_r (_REENT); } diff --git a/newlib/libc/stdlib/mstats.c b/newlib/libc/stdlib/mstats.c index b7aa93b28..92f9fb792 100644 --- a/newlib/libc/stdlib/mstats.c +++ b/newlib/libc/stdlib/mstats.c @@ -84,14 +84,14 @@ not portable. #ifndef _REENT_ONLY struct mallinfo -_DEFUN_VOID (mallinfo) +mallinfo (void) { return _mallinfo_r (_REENT); } #if !defined (_ELIX_LEVEL) || _ELIX_LEVEL >= 2 void -_DEFUN_VOID (malloc_stats) +malloc_stats (void) { _malloc_stats_r (_REENT); } diff --git a/newlib/libc/stdlib/rand.c b/newlib/libc/stdlib/rand.c index aacb0a8a4..e6ef7a1f6 100644 --- a/newlib/libc/stdlib/rand.c +++ b/newlib/libc/stdlib/rand.c @@ -68,7 +68,7 @@ _DEFUN (srand, (seed), unsigned int seed) } int -_DEFUN_VOID (rand) +rand (void) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdlib/random.c b/newlib/libc/stdlib/random.c index 7abca6da4..b3b0ca305 100644 --- a/newlib/libc/stdlib/random.c +++ b/newlib/libc/stdlib/random.c @@ -66,7 +66,7 @@ _DEFUN (srandom, (seed), unsigned int seed) } long int -_DEFUN_VOID (random) +random (void) { struct _reent *reent = _REENT; diff --git a/newlib/libc/sys/a29khif/getpid.c b/newlib/libc/sys/a29khif/getpid.c index 99d88bd39..5d95b933e 100644 --- a/newlib/libc/sys/a29khif/getpid.c +++ b/newlib/libc/sys/a29khif/getpid.c @@ -6,7 +6,7 @@ . */ int -_DEFUN_VOID (_getpid) +_getpid (void) { return 1; } diff --git a/newlib/libc/sys/linux/getlogin.c b/newlib/libc/sys/linux/getlogin.c index 3931e7731..1cc0f4e04 100644 --- a/newlib/libc/sys/linux/getlogin.c +++ b/newlib/libc/sys/linux/getlogin.c @@ -3,7 +3,7 @@ #include char * -_DEFUN_VOID (getlogin) +getlogin (void) { errno = ENOSYS; return NULL; diff --git a/newlib/libc/sys/sparc64/ieee.c b/newlib/libc/sys/sparc64/ieee.c index 28289761d..f3298e63d 100644 --- a/newlib/libc/sys/sparc64/ieee.c +++ b/newlib/libc/sys/sparc64/ieee.c @@ -3,7 +3,7 @@ fp_rnd -_DEFUN_VOID(fpgetround) +fpgetround (void) { char *out; ieee_flags("get", "direction","", &out); @@ -44,7 +44,7 @@ _DEFUN(fpsetround,(new), fp_except -_DEFUN_VOID(fpgetmask) +fpgetmask (void) { char *out; int r = 0; @@ -92,7 +92,7 @@ _DEFUN(fpsetsticky,(mask), } fp_except -_DEFUN_VOID(fpgetsticky) +fpgetsticky (void) { return fpgetmask(); } @@ -107,7 +107,7 @@ _DEFUN(fpsetroundtoi,(rdi_mode), } int -_DEFUN_VOID(fpgetroundtoi) +fpgetroundtoi (void) { return 0; diff --git a/newlib/libc/sys/sun4/ieee.c b/newlib/libc/sys/sun4/ieee.c index 28289761d..f3298e63d 100644 --- a/newlib/libc/sys/sun4/ieee.c +++ b/newlib/libc/sys/sun4/ieee.c @@ -3,7 +3,7 @@ fp_rnd -_DEFUN_VOID(fpgetround) +fpgetround (void) { char *out; ieee_flags("get", "direction","", &out); @@ -44,7 +44,7 @@ _DEFUN(fpsetround,(new), fp_except -_DEFUN_VOID(fpgetmask) +fpgetmask (void) { char *out; int r = 0; @@ -92,7 +92,7 @@ _DEFUN(fpsetsticky,(mask), } fp_except -_DEFUN_VOID(fpgetsticky) +fpgetsticky (void) { return fpgetmask(); } @@ -107,7 +107,7 @@ _DEFUN(fpsetroundtoi,(rdi_mode), } int -_DEFUN_VOID(fpgetroundtoi) +fpgetroundtoi (void) { return 0; diff --git a/newlib/libc/sys/sysvi386/fpx.c b/newlib/libc/sys/sysvi386/fpx.c index d55a1e30f..c9ff7c314 100644 --- a/newlib/libc/sys/sysvi386/fpx.c +++ b/newlib/libc/sys/sysvi386/fpx.c @@ -17,7 +17,7 @@ fp_except _DEFUN(fpsetmask,(newmask), } -fp_except _DEFUN_VOID(fpgetmask) +fp_except fpgetmask (void) { v60_tkcw_type tkcw; sysv60(0, 8, &tkcw); @@ -25,7 +25,7 @@ fp_except _DEFUN_VOID(fpgetmask) } -fp_rnd _DEFUN_VOID(fpgetround) +fp_rnd fpgetround (void) { v60_tkcw_type tkcw; sysv60(0, 8, &tkcw); @@ -49,7 +49,7 @@ fp_rnd _DEFUN(fpsetround,(rnd), -fp_rdi _DEFUN_VOID(fpgetroundtoi) +fp_rdi fpgetroundtoi (void) { v60_tkcw_type tkcw; sysv60(0, 8, &tkcw); diff --git a/newlib/libc/sys/sysvnecv70/fpx.c b/newlib/libc/sys/sysvnecv70/fpx.c index d55a1e30f..c9ff7c314 100644 --- a/newlib/libc/sys/sysvnecv70/fpx.c +++ b/newlib/libc/sys/sysvnecv70/fpx.c @@ -17,7 +17,7 @@ fp_except _DEFUN(fpsetmask,(newmask), } -fp_except _DEFUN_VOID(fpgetmask) +fp_except fpgetmask (void) { v60_tkcw_type tkcw; sysv60(0, 8, &tkcw); @@ -25,7 +25,7 @@ fp_except _DEFUN_VOID(fpgetmask) } -fp_rnd _DEFUN_VOID(fpgetround) +fp_rnd fpgetround (void) { v60_tkcw_type tkcw; sysv60(0, 8, &tkcw); @@ -49,7 +49,7 @@ fp_rnd _DEFUN(fpsetround,(rnd), -fp_rdi _DEFUN_VOID(fpgetroundtoi) +fp_rdi fpgetroundtoi (void) { v60_tkcw_type tkcw; sysv60(0, 8, &tkcw); diff --git a/newlib/libc/syscalls/sysfork.c b/newlib/libc/syscalls/sysfork.c index 21e6be0e2..282f73fe3 100644 --- a/newlib/libc/syscalls/sysfork.c +++ b/newlib/libc/syscalls/sysfork.c @@ -8,7 +8,7 @@ #include int -_DEFUN_VOID (fork) +fork (void) { return _fork_r (_REENT); } diff --git a/newlib/libc/syscalls/sysgetpid.c b/newlib/libc/syscalls/sysgetpid.c index f18783c75..22c7605e8 100644 --- a/newlib/libc/syscalls/sysgetpid.c +++ b/newlib/libc/syscalls/sysgetpid.c @@ -4,7 +4,7 @@ #include int -_DEFUN_VOID (getpid) +getpid (void) { return _getpid_r (_REENT); } diff --git a/newlib/libc/time/tzlock.c b/newlib/libc/time/tzlock.c index 24354ad0b..153dfd3a5 100644 --- a/newlib/libc/time/tzlock.c +++ b/newlib/libc/time/tzlock.c @@ -36,7 +36,7 @@ __LOCK_INIT(static, __tz_mutex); #endif _VOID -_DEFUN_VOID (__tz_lock) +__tz_lock (void) { #ifndef __SINGLE_THREAD__ __lock_acquire(__tz_mutex); @@ -44,7 +44,7 @@ _DEFUN_VOID (__tz_lock) } _VOID -_DEFUN_VOID (__tz_unlock) +__tz_unlock (void) { #ifndef __SINGLE_THREAD__ __lock_release(__tz_mutex); diff --git a/newlib/libc/time/tzset.c b/newlib/libc/time/tzset.c index 629b8f240..ca1e1d91f 100644 --- a/newlib/libc/time/tzset.c +++ b/newlib/libc/time/tzset.c @@ -62,13 +62,13 @@ Supporting OS subroutine required: None #include "local.h" _VOID -_DEFUN_VOID (_tzset_unlocked) +_tzset_unlocked (void) { _tzset_unlocked_r (_REENT); } _VOID -_DEFUN_VOID (tzset) +tzset (void) { TZ_LOCK; _tzset_unlocked_r (_REENT); diff --git a/newlib/libc/xdr/xdr.c b/newlib/libc/xdr/xdr.c index 8c637fcbf..b60a89782 100644 --- a/newlib/libc/xdr/xdr.c +++ b/newlib/libc/xdr/xdr.c @@ -76,7 +76,7 @@ _DEFUN (xdr_free, (proc, objp), * XDR nothing */ bool_t -_DEFUN_VOID (xdr_void) +xdr_void (void) { return TRUE; } diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c index b7dc6d098..427917640 100644 --- a/newlib/libc/xdr/xdr_sizeof.c +++ b/newlib/libc/xdr/xdr_sizeof.c @@ -111,7 +111,7 @@ _DEFUN (x_inline, (xdrs, len), } static int -_DEFUN_VOID (harmless) +harmless (void) { /* Always return FALSE/NULL, as the case may be */ return 0; diff --git a/newlib/libm/test/convert.c b/newlib/libm/test/convert.c index 8420cdec7..24188fa8b 100644 --- a/newlib/libm/test/convert.c +++ b/newlib/libm/test/convert.c @@ -13,7 +13,7 @@ extern double_type doubles[]; double_type *pd = doubles; void -_DEFUN_VOID(test_strtod) +test_strtod (void) { char *tail; double v; @@ -24,7 +24,7 @@ _DEFUN_VOID(test_strtod) } void -_DEFUN_VOID(test_strtof) +test_strtof (void) { char *tail; double v; @@ -35,13 +35,13 @@ _DEFUN_VOID(test_strtof) } void -_DEFUN_VOID(test_atof) +test_atof (void) { test_mok(atof(pd->string), pd->value, 64); } void -_DEFUN_VOID(test_atoff) +test_atoff (void) { test_mok(atoff(pd->string), pd->value, 32); } @@ -101,7 +101,7 @@ _DEFUN(test_strtol_base,(base, pi, string), } void -_DEFUN_VOID(test_strtol) +test_strtol (void) { test_strtol_base(8,&(p->octal), p->string); test_strtol_base(10,&(p->decimal), p->string); @@ -111,14 +111,14 @@ _DEFUN_VOID(test_strtol) } void -_DEFUN_VOID(test_atoi) +test_atoi (void) { test_iok(atoi(p->string), p->decimal.value); test_eok(errno, p->decimal.errno_val); } void -_DEFUN_VOID(test_atol) +test_atol (void) { test_iok(atol(p->string), p->decimal.value); test_eok(errno, p->decimal.errno_val); @@ -128,7 +128,7 @@ _DEFUN_VOID(test_atol) extern ddouble_type ddoubles[]; ddouble_type *pdd; void -_DEFUN_VOID(test_ecvtbuf) +test_ecvtbuf (void) { int a2,a3; char *s; @@ -140,7 +140,7 @@ _DEFUN_VOID(test_ecvtbuf) } void -_DEFUN_VOID(test_ecvt) +test_ecvt (void) { int a2,a3; char *s; @@ -158,7 +158,7 @@ _DEFUN_VOID(test_ecvt) } void -_DEFUN_VOID(test_fcvtbuf) +test_fcvtbuf (void) { int a2,a3; char *s; @@ -170,7 +170,7 @@ _DEFUN_VOID(test_fcvtbuf) } void -_DEFUN_VOID(test_gcvt) +test_gcvt (void) { char *s = gcvt(pdd->value, pdd->g1, buffer); test_scok(s, pdd->gstring, 9); @@ -181,7 +181,7 @@ _DEFUN_VOID(test_gcvt) } void -_DEFUN_VOID(test_fcvt) +test_fcvt (void) { int a2,a3; char *sd; @@ -223,7 +223,7 @@ _DEFUN(diterate,(func, name), void -_DEFUN_VOID(deltest) +deltest (void) { newfunc("rounding"); line(1); @@ -255,7 +255,7 @@ _DEFUN_VOID(deltest) /* Most of what sprint does is tested with the tests of fcvt/ecvt/gcvt, but here are some more */ void -_DEFUN_VOID(test_sprint) +test_sprint (void) { extern sprint_double_type sprint_doubles[]; sprint_double_type *s = sprint_doubles; @@ -286,7 +286,7 @@ _DEFUN_VOID(test_sprint) /* Scanf calls strtod etc tested elsewhere, but also has some pattern matching skills */ void -_DEFUN_VOID(test_scan) +test_scan (void) { int i,j; extern sprint_double_type sprint_doubles[]; @@ -340,7 +340,7 @@ _DEFUN_VOID(test_scan) } void -_DEFUN_VOID(test_cvt) +test_cvt (void) { deltest(); diff --git a/newlib/libm/test/math.c b/newlib/libm/test/math.c index 50b22223a..f58f64f79 100644 --- a/newlib/libm/test/math.c +++ b/newlib/libm/test/math.c @@ -354,7 +354,7 @@ _DEFUN(run_vector_1,(vector, p, func, name, args), } void -_DEFUN_VOID(test_math) +test_math (void) { test_acos(0); test_acosf(0); diff --git a/newlib/libm/test/math2.c b/newlib/libm/test/math2.c index 50b537646..b7108de4a 100644 --- a/newlib/libm/test/math2.c +++ b/newlib/libm/test/math2.c @@ -4,14 +4,14 @@ int -_DEFUN_VOID(randi) +randi (void) { static int next; next = (next * 1103515245) + 12345; return ((next >> 16) & 0xffff); } -double _DEFUN_VOID(randx) +double randx (void) { double res; @@ -34,7 +34,7 @@ double _DEFUN_VOID(randx) } /* Return a random double, but bias for numbers closer to 0 */ -double _DEFUN_VOID(randy) +double randy (void) { int pow; double r= randx(); @@ -43,7 +43,7 @@ double _DEFUN_VOID(randy) } void -_DEFUN_VOID(test_frexp) +test_frexp (void) { int i; double r; @@ -131,7 +131,7 @@ _DEFUN_VOID(test_frexp) */ void -_DEFUN_VOID(test_mod) +test_mod (void) { int i; @@ -176,7 +176,7 @@ _DEFUN_VOID(test_mod) Test pow by multiplying logs */ void -_DEFUN_VOID(test_pow) +test_pow (void) { unsigned int i; newfunc("pow"); @@ -224,7 +224,7 @@ _DEFUN_VOID(test_pow) void -_DEFUN_VOID(test_math2) +test_math2 (void) { test_mod(); test_frexp(); diff --git a/newlib/libm/test/test_ieee.c b/newlib/libm/test/test_ieee.c index 07c49418d..167a40c87 100644 --- a/newlib/libm/test/test_ieee.c +++ b/newlib/libm/test/test_ieee.c @@ -6,7 +6,7 @@ /* Test fp getround and fp setround */ void -_DEFUN_VOID(test_getround) +test_getround (void) { newfunc("fpgetround/fpsetround"); @@ -26,7 +26,7 @@ _DEFUN_VOID(test_getround) /* And fpset/fpgetmask */ void -_DEFUN_VOID(test_getmask) +test_getmask (void) { newfunc("fpsetmask/fpgetmask"); line(1); @@ -47,7 +47,7 @@ _DEFUN_VOID(test_getmask) } void -_DEFUN_VOID(test_getsticky) +test_getsticky (void) { newfunc("fpsetsticky/fpgetsticky"); line(1); @@ -68,7 +68,7 @@ _DEFUN_VOID(test_getsticky) } void -_DEFUN_VOID(test_getroundtoi) +test_getroundtoi (void) { newfunc("fpsetroundtoi/fpgetroundtoi"); line(1); @@ -105,7 +105,7 @@ double sub_rounded_down ; double sub_rounded_up ; double r1,r2,r3,r4; void -_DEFUN_VOID(test_round) +test_round (void) { n = dnumber(0x40000000, 0x00000008); /* near 2 */ m = dnumber(0x40400000, 0x00000003); /* near 3.4 */ @@ -163,7 +163,7 @@ _DEFUN_VOID(test_round) void -_DEFUN_VOID(test_ieee) +test_ieee (void) { fp_rnd old = fpgetround(); test_getround(); diff --git a/newlib/libm/test/test_is.c b/newlib/libm/test/test_is.c index 39c15c10e..c4c8e2fdb 100644 --- a/newlib/libm/test/test_is.c +++ b/newlib/libm/test/test_is.c @@ -1993,7 +1993,7 @@ _DEFUN(test_to_set,(func, name, p, low, high), #undef _toupper void -_DEFUN_VOID(test_is) +test_is (void) { test_is_set(def_isalnum, "isalnum define", &myalnum); test_is_set(def_isalpha, "isalpha define", &myalpha); From 67ee0cac4cfc1a0a5b4f1403584ef8222ee5a110 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 21:12:33 -0600 Subject: [PATCH 214/649] ansification: remove _VOID Signed-off-by: Yaakov Selkowitz --- libgloss/bfin/_exit.c | 2 +- libgloss/libnosys/_exit.c | 2 +- newlib/libc/iconv/lib/conv.h | 2 +- newlib/libc/iconv/lib/iconvnls.c | 2 +- newlib/libc/iconv/lib/nullconv.c | 2 +- newlib/libc/iconv/lib/ucsconv.c | 2 +- newlib/libc/iconv/lib/ucsconv.h | 4 +- newlib/libc/include/_ansi.h | 2 - newlib/libc/include/malloc.h | 8 +-- newlib/libc/include/stdio.h | 2 +- newlib/libc/include/stdlib.h | 54 ++++++++++---------- newlib/libc/include/sys/iconvnls.h | 2 +- newlib/libc/include/sys/reent.h | 2 +- newlib/libc/include/time.h | 8 +-- newlib/libc/machine/microblaze/abort.c | 2 +- newlib/libc/machine/nds32/abort.c | 2 +- newlib/libc/machine/powerpc/machine/malloc.h | 2 +- newlib/libc/machine/powerpc/machine/stdlib.h | 2 +- newlib/libc/machine/spu/clearerr.c | 2 +- newlib/libc/machine/spu/stdio.c | 6 +-- newlib/libc/signal/psignal.c | 2 +- newlib/libc/stdio/clearerr.c | 2 +- newlib/libc/stdio/clearerr_u.c | 2 +- newlib/libc/stdio/findfp.c | 22 ++++---- newlib/libc/stdio/local.h | 14 ++--- newlib/libc/stdio/makebuf.c | 2 +- newlib/libc/stdio/perror.c | 4 +- newlib/libc/stdio/rewind.c | 4 +- newlib/libc/stdio/setbuf.c | 2 +- newlib/libc/stdio/setbuffer.c | 2 +- newlib/libc/stdlib/abort.c | 2 +- newlib/libc/stdlib/atexit.c | 2 +- newlib/libc/stdlib/lcong48.c | 4 +- newlib/libc/stdlib/on_exit.c | 2 +- newlib/libc/stdlib/srand48.c | 4 +- newlib/libc/sys/linux/include/time.h | 8 +-- newlib/libc/sys/rtems/crt0.c | 2 +- newlib/libc/time/local.h | 8 +-- newlib/libc/time/tzlock.c | 4 +- newlib/libc/time/tzset.c | 4 +- newlib/libc/time/tzset_r.c | 4 +- 41 files changed, 104 insertions(+), 106 deletions(-) diff --git a/libgloss/bfin/_exit.c b/libgloss/bfin/_exit.c index d7fb9e033..e8186326a 100644 --- a/libgloss/bfin/_exit.c +++ b/libgloss/bfin/_exit.c @@ -16,7 +16,7 @@ #include <_ansi.h> -_VOID +void _DEFUN (_exit, (rc), int rc) { diff --git a/libgloss/libnosys/_exit.c b/libgloss/libnosys/_exit.c index 3fdf7f081..44d845b8c 100644 --- a/libgloss/libnosys/_exit.c +++ b/libgloss/libnosys/_exit.c @@ -5,7 +5,7 @@ #include <_ansi.h> #include <_syslist.h> -_VOID +void _DEFUN (_exit, (rc), int rc) { diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h index 59b6fe810..89da4b224 100644 --- a/newlib/libc/iconv/lib/conv.h +++ b/newlib/libc/iconv/lib/conv.h @@ -135,7 +135,7 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - _VOID _EXFNPTR(get_state, (void *data, + void _EXFNPTR(get_state, (void *data, mbstate_t *state, int direction)); diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c index 1996bdd8f..dfb6a18dd 100644 --- a/newlib/libc/iconv/lib/iconvnls.c +++ b/newlib/libc/iconv/lib/iconvnls.c @@ -219,7 +219,7 @@ _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), * shift state if 'direction' is 0 and "to" encodings's shift state * if 'direction' isn't 0. */ -_VOID +void _DEFUN(_iconv_nls_get_state, (cd, ps, direction), iconv_t cd, mbstate_t *ps, diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c index 3c87cbb83..8040c24e7 100644 --- a/newlib/libc/iconv/lib/nullconv.c +++ b/newlib/libc/iconv/lib/nullconv.c @@ -101,7 +101,7 @@ _DEFUN(null_conversion_get_mb_cur_max, (data, direction), } -static _VOID +static void _DEFUN(null_conversion_get_state, (data, state, size), void *data, mbstate_t *state, diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c index c91007209..f480aee63 100644 --- a/newlib/libc/iconv/lib/ucsconv.c +++ b/newlib/libc/iconv/lib/ucsconv.c @@ -251,7 +251,7 @@ _DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), } -static _VOID +static void _DEFUN(ucs_based_conversion_get_state, (data, state, direction), void *data, mbstate_t *state, diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h index d3333161c..391daed35 100644 --- a/newlib/libc/iconv/lib/ucsconv.h +++ b/newlib/libc/iconv/lib/ucsconv.h @@ -108,7 +108,7 @@ typedef struct * DESCRIPTION: * Returns encoding's current shift sequence. */ - _VOID _EXFNPTR(get_state, (void *data, + void _EXFNPTR(get_state, (void *data, mbstate_t *state)); /* @@ -183,7 +183,7 @@ typedef struct int _EXFNPTR(get_mb_cur_max, (void *data)); /* Same as in iconv_to_ucs_ces_handlers_t */ - _VOID _EXFNPTR(get_state, (void *data, + void _EXFNPTR(get_state, (void *data, mbstate_t *state)); /* Same as in iconv_to_ucs_ces_handlers_t */ diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index b8d27b24e..9c3a04695 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -49,7 +49,6 @@ #ifdef _HAVE_STDC #define _VOLATILE volatile #define _SIGNED signed -#define _VOID void #ifdef __CYGWIN__ #define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW #define _EXFUN(name, proto) __cdecl name proto @@ -68,7 +67,6 @@ #else #define _VOLATILE #define _SIGNED -#define _VOID void #define _EXFUN(name, proto) name() #define _EXFUN_NOTHROW(name, proto) name() #define _DEFUN(name, arglist, args) name arglist args; diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h index f9144cdca..e12a13244 100644 --- a/newlib/libc/include/malloc.h +++ b/newlib/libc/include/malloc.h @@ -42,12 +42,12 @@ extern void *malloc (size_t); extern void *_malloc_r (struct _reent *, size_t); #endif -extern _VOID free (void *); +extern void free (void *); #ifdef __CYGWIN__ #undef _free_r #define _free_r(r, p) free (p) #else -extern _VOID _free_r (struct _reent *, void *); +extern void _free_r (struct _reent *, void *); #endif extern void *realloc (void *, size_t); @@ -135,12 +135,12 @@ extern int _malloc_trim_r (struct _reent *, size_t); /* A compatibility routine for an earlier version of the allocator. */ -extern _VOID mstats (char *); +extern void mstats (char *); #ifdef __CYGWIN__ #undef _mstats_r #define _mstats_r(r, p) mstats (p) #else -extern _VOID _mstats_r (struct _reent *, char *); +extern void _mstats_r (struct _reent *, char *); #endif /* SVID2/XPG mallopt options */ diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index fe0a31827..127145083 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -259,7 +259,7 @@ off_t _EXFUN(ftello, ( FILE *)); #endif #endif #if __GNU_VISIBLE -int _EXFUN(fcloseall, (_VOID)); +int _EXFUN(fcloseall, (void)); #endif #ifndef _REENT_ONLY #if __ISO_C_VISIBLE >= 1999 diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index 7213a3c16..80f15f4e9 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -62,18 +62,18 @@ typedef int (*__compar_fn_t) (const void *, const void *); #define RAND_MAX __RAND_MAX -int _EXFUN(__locale_mb_cur_max,(_VOID)); +int _EXFUN(__locale_mb_cur_max,(void)); #define MB_CUR_MAX __locale_mb_cur_max() -_VOID _EXFUN(abort,(_VOID) _ATTRIBUTE ((__noreturn__))); +void _EXFUN(abort,(void) _ATTRIBUTE ((__noreturn__))); int _EXFUN(abs,(int)); #if __BSD_VISIBLE __uint32_t _EXFUN(arc4random, (void)); __uint32_t _EXFUN(arc4random_uniform, (__uint32_t)); void _EXFUN(arc4random_buf, (void *, size_t)); #endif -int _EXFUN(atexit,(_VOID (*__func)(_VOID))); +int _EXFUN(atexit,(void (*__func)(void))); double _EXFUN(atof,(const char *__nptr)); #if __MISC_VISIBLE float _EXFUN(atoff,(const char *__nptr)); @@ -89,8 +89,8 @@ void * _EXFUN(bsearch,(const void *__key, __compar_fn_t _compar)); void * _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size)); div_t _EXFUN(div,(int __numer, int __denom)); -_VOID _EXFUN(exit,(int __status) _ATTRIBUTE ((__noreturn__))); -_VOID _EXFUN_NOTHROW(free,(void *)); +void _EXFUN(exit,(int __status) _ATTRIBUTE ((__noreturn__))); +void _EXFUN_NOTHROW(free,(void *)); char * _EXFUN(getenv,(const char *__string)); char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); char * _EXFUN(_findenv,(const char *, int *)); @@ -136,8 +136,8 @@ int _EXFUN(_mkostemps_r, (struct _reent *, char *, int, int)); int _EXFUN(_mkstemp_r, (struct _reent *, char *)); int _EXFUN(_mkstemps_r, (struct _reent *, char *, int)); char * _EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")))); -_VOID _EXFUN(qsort,(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); -int _EXFUN(rand,(_VOID)); +void _EXFUN(qsort,(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); +int _EXFUN(rand,(void)); void * _EXFUN_NOTHROW(realloc,(void *__r, size_t __size)); #if __BSD_VISIBLE void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) @@ -151,9 +151,9 @@ char * _EXFUN(realpath, (const char *__restrict path, char *__restrict resolved_ int _EXFUN(rpmatch, (const char *response)); #endif #if __XSI_VISIBLE -_VOID _EXFUN(setkey, (const char *__key)); +void _EXFUN(setkey, (const char *__key)); #endif -_VOID _EXFUN(srand,(unsigned __seed)); +void _EXFUN(srand,(unsigned __seed)); double _EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR)); double _EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR)); #if __ISO_C_VISIBLE >= 1999 @@ -193,10 +193,10 @@ char * _EXFUN(l64a,(long __input)); char * _EXFUN(_l64a_r,(struct _reent *,long __input)); #endif #if __MISC_VISIBLE -int _EXFUN(on_exit,(_VOID (*__func)(int, void *),void *__arg)); +int _EXFUN(on_exit,(void (*__func)(int, void *),void *__arg)); #endif #if __ISO_C_VISIBLE >= 1999 -_VOID _EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__))); +void _EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__))); #endif #if __SVID_VISIBLE || __XSI_VISIBLE int _EXFUN(putenv,(char *__string)); @@ -229,17 +229,17 @@ int _EXFUN(rand_r,(unsigned *__seed)); #endif #if __SVID_VISIBLE || __XSI_VISIBLE -double _EXFUN(drand48,(_VOID)); +double _EXFUN(drand48,(void)); double _EXFUN(_drand48_r,(struct _reent *)); double _EXFUN(erand48,(unsigned short [3])); double _EXFUN(_erand48_r,(struct _reent *, unsigned short [3])); long _EXFUN(jrand48,(unsigned short [3])); long _EXFUN(_jrand48_r,(struct _reent *, unsigned short [3])); -_VOID _EXFUN(lcong48,(unsigned short [7])); -_VOID _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7])); -long _EXFUN(lrand48,(_VOID)); +void _EXFUN(lcong48,(unsigned short [7])); +void _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7])); +long _EXFUN(lrand48,(void)); long _EXFUN(_lrand48_r,(struct _reent *)); -long _EXFUN(mrand48,(_VOID)); +long _EXFUN(mrand48,(void)); long _EXFUN(_mrand48_r,(struct _reent *)); long _EXFUN(nrand48,(unsigned short [3])); long _EXFUN(_nrand48_r,(struct _reent *, unsigned short [3])); @@ -247,14 +247,14 @@ unsigned short * _EXFUN(seed48,(unsigned short [3])); unsigned short * _EXFUN(_seed48_r,(struct _reent *, unsigned short [3])); -_VOID _EXFUN(srand48,(long)); -_VOID _EXFUN(_srand48_r,(struct _reent *, long)); +void _EXFUN(srand48,(long)); +void _EXFUN(_srand48_r,(struct _reent *, long)); #endif /* __SVID_VISIBLE || __XSI_VISIBLE */ #if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE char * _EXFUN(initstate,(unsigned, char *, size_t)); -long _EXFUN(random,(_VOID)); +long _EXFUN(random,(void)); char * _EXFUN(setstate,(char *)); -_VOID _EXFUN(srandom,(unsigned)); +void _EXFUN(srandom,(unsigned)); #endif #if __ISO_C_VISIBLE >= 1999 long long _EXFUN(atoll,(const char *__nptr)); @@ -273,7 +273,7 @@ unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__restrict _ #ifndef __CYGWIN__ #if __MISC_VISIBLE -_VOID _EXFUN(cfree,(void *)); +void _EXFUN(cfree,(void *)); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 int _EXFUN(unsetenv,(const char *__string)); @@ -289,26 +289,26 @@ char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); #ifndef __CYGWIN__ void * _EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t)); void * _EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t)); -_VOID _EXFUN_NOTHROW(_free_r,(struct _reent *, void *)); +void _EXFUN_NOTHROW(_free_r,(struct _reent *, void *)); void * _EXFUN_NOTHROW(_realloc_r,(struct _reent *, void *, size_t)); -_VOID _EXFUN(_mstats_r,(struct _reent *, char *)); +void _EXFUN(_mstats_r,(struct _reent *, char *)); #endif int _EXFUN(_system_r,(struct _reent *, const char *)); -_VOID _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); +void _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); /* There are two common qsort_r variants. If you request _BSD_SOURCE, you get the BSD version; otherwise you get the GNU version. We want that #undef qsort_r will still let you invoke the underlying function, but that requires gcc support. */ #if __GNU_VISIBLE -_VOID _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk)); +void _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk)); #elif __BSD_VISIBLE # ifdef __GNUC__ -_VOID _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))) +void _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))) __asm__ (__ASMNAME ("__bsd_qsort_r")); # else -_VOID _EXFUN(__bsd_qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))); +void _EXFUN(__bsd_qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))); # define qsort_r __bsd_qsort_r # endif #endif diff --git a/newlib/libc/include/sys/iconvnls.h b/newlib/libc/include/sys/iconvnls.h index 7475ed21b..aa0b78441 100644 --- a/newlib/libc/include/sys/iconvnls.h +++ b/newlib/libc/include/sys/iconvnls.h @@ -44,7 +44,7 @@ #define ICONV_NLS_FROM 0 #define ICONV_NLS_TO 1 -_VOID +void _EXFUN(_iconv_nls_get_state, (iconv_t cd, mbstate_t *ps, int direction)); int diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 1381db67b..cfb79edd3 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -165,7 +165,7 @@ struct __sFILE_fake { /* Following is needed both in libc/stdio and libc/stdlib so we put it * here instead of libc/stdio/local.h where it was previously. */ -extern _VOID _EXFUN(__sinit,(struct _reent *)); +extern void _EXFUN(__sinit,(struct _reent *)); # define _REENT_SMALL_CHECK_INIT(ptr) \ do \ diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h index 8806b98c7..6f6ff86c8 100644 --- a/newlib/libc/include/time.h +++ b/newlib/libc/include/time.h @@ -98,9 +98,9 @@ char *strptime_l (const char *__restrict, const char *__restrict, #endif #if __POSIX_VISIBLE -_VOID _EXFUN(tzset, (_VOID)); +void _EXFUN(tzset, (void)); #endif -_VOID _EXFUN(_tzset_r, (struct _reent *)); +void _EXFUN(_tzset_r, (struct _reent *)); typedef struct __tzrule_struct { @@ -120,7 +120,7 @@ typedef struct __tzinfo_struct __tzrule_type __tzrule[2]; } __tzinfo_type; -__tzinfo_type *_EXFUN (__gettzinfo, (_VOID)); +__tzinfo_type *_EXFUN (__gettzinfo, (void)); /* getdate functions */ @@ -128,7 +128,7 @@ __tzinfo_type *_EXFUN (__gettzinfo, (_VOID)); #if __XSI_VISIBLE >= 4 #ifndef _REENT_ONLY #define getdate_err (*__getdate_err()) -int *_EXFUN(__getdate_err,(_VOID)); +int *_EXFUN(__getdate_err,(void)); struct tm * _EXFUN(getdate, (const char *)); /* getdate_err is set to one of the following values to indicate the error. diff --git a/newlib/libc/machine/microblaze/abort.c b/newlib/libc/machine/microblaze/abort.c index a2bb535e0..1af7b368f 100644 --- a/newlib/libc/machine/microblaze/abort.c +++ b/newlib/libc/machine/microblaze/abort.c @@ -46,7 +46,7 @@ Supporting OS subroutines required: <<_exit>> and optionally, <>. #include #include -_VOID +void abort (void) { #ifdef ABORT_MESSAGE diff --git a/newlib/libc/machine/nds32/abort.c b/newlib/libc/machine/nds32/abort.c index c952ce569..5fa0b6e7f 100644 --- a/newlib/libc/machine/nds32/abort.c +++ b/newlib/libc/machine/nds32/abort.c @@ -28,7 +28,7 @@ Supporting OS subroutines required: <<_exit>>. #include -_VOID +void abort (void) { while (1) diff --git a/newlib/libc/machine/powerpc/machine/malloc.h b/newlib/libc/machine/powerpc/machine/malloc.h index 6be7eac80..394ad4e4e 100644 --- a/newlib/libc/machine/powerpc/machine/malloc.h +++ b/newlib/libc/machine/powerpc/machine/malloc.h @@ -5,7 +5,7 @@ void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); -_VOID _EXFUN(vec_free,(void *)); +void _EXFUN(vec_free,(void *)); #define _vec_freer _freer void *_EXFUN(vec_malloc,(size_t __size)); #define _vec_mallocr _memalign_r diff --git a/newlib/libc/machine/powerpc/machine/stdlib.h b/newlib/libc/machine/powerpc/machine/stdlib.h index bc9b9cfe9..ea597102b 100644 --- a/newlib/libc/machine/powerpc/machine/stdlib.h +++ b/newlib/libc/machine/powerpc/machine/stdlib.h @@ -7,7 +7,7 @@ void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); -_VOID _EXFUN(vec_free,(void *)); +void _EXFUN(vec_free,(void *)); #define _vec_freer _freer void *_EXFUN(vec_malloc,(size_t __size)); #define _vec_mallocr _memalign_r diff --git a/newlib/libc/machine/spu/clearerr.c b/newlib/libc/machine/spu/clearerr.c index b4034f8ff..667667a91 100644 --- a/newlib/libc/machine/spu/clearerr.c +++ b/newlib/libc/machine/spu/clearerr.c @@ -36,7 +36,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY -_VOID +void _DEFUN (clearerr, (fp), FILE * fp) diff --git a/newlib/libc/machine/spu/stdio.c b/newlib/libc/machine/spu/stdio.c index e8b9dd9fa..14332b475 100644 --- a/newlib/libc/machine/spu/stdio.c +++ b/newlib/libc/machine/spu/stdio.c @@ -52,7 +52,7 @@ _DEFUN (__sfp, (d), return NULL; } -static _VOID +static void _DEFUN (__cleanup, (s), struct _reent *s) { @@ -64,7 +64,7 @@ _DEFUN (__cleanup, (s), } } -_VOID +void _DEFUN (__sinit, (s), struct _reent *s) { @@ -81,7 +81,7 @@ _DEFUN (__sinit, (s), s->_stderr->_fp = SPE_STDERR; } -_VOID +void __check_init (void) { CHECK_INIT(_REENT); diff --git a/newlib/libc/signal/psignal.c b/newlib/libc/signal/psignal.c index 6263c3f70..a62f8ae01 100644 --- a/newlib/libc/signal/psignal.c +++ b/newlib/libc/signal/psignal.c @@ -33,7 +33,7 @@ Supporting OS subroutines required: <>, <>, <>, #include #include -_VOID +void _DEFUN(psignal, (sig, s), int sig, const char *s) diff --git a/newlib/libc/stdio/clearerr.c b/newlib/libc/stdio/clearerr.c index 4174a7425..23e3c18e3 100644 --- a/newlib/libc/stdio/clearerr.c +++ b/newlib/libc/stdio/clearerr.c @@ -71,7 +71,7 @@ No supporting OS subroutines are required. #undef clearerr -_VOID +void _DEFUN(clearerr, (fp), FILE * fp) { diff --git a/newlib/libc/stdio/clearerr_u.c b/newlib/libc/stdio/clearerr_u.c index 00c5e8efa..7514fa2e9 100644 --- a/newlib/libc/stdio/clearerr_u.c +++ b/newlib/libc/stdio/clearerr_u.c @@ -32,7 +32,7 @@ #undef clearerr_unlocked -_VOID +void _DEFUN(clearerr_unlocked, (fp), FILE * fp) { diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index fb437515d..031b98b49 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -40,9 +40,9 @@ __FILE __sf[3]; #endif #if (defined (__OPTIMIZE_SIZE__) || defined (PREFER_SIZE_OVER_SPEED)) -_NOINLINE_STATIC _VOID +_NOINLINE_STATIC void #else -static _VOID +static void #endif _DEFUN(std, (ptr, flags, file), FILE *ptr, @@ -203,7 +203,7 @@ found: * The name `_cleanup' is, alas, fairly well known outside stdio. */ -_VOID +void _DEFUN(_cleanup_r, (ptr), struct _reent *ptr) { @@ -234,7 +234,7 @@ _DEFUN(_cleanup_r, (ptr), } #ifndef _REENT_ONLY -_VOID +void _cleanup (void) { _cleanup_r (_GLOBAL_REENT); @@ -245,7 +245,7 @@ _cleanup (void) * __sinit() is called whenever stdio's internal variables must be set up. */ -_VOID +void _DEFUN(__sinit, (s), struct _reent *s) { @@ -303,25 +303,25 @@ _DEFUN(__sinit, (s), __LOCK_INIT_RECURSIVE(static, __sfp_recursive_mutex); __LOCK_INIT_RECURSIVE(static, __sinit_recursive_mutex); -_VOID +void __sfp_lock_acquire (void) { __lock_acquire_recursive (__sfp_recursive_mutex); } -_VOID +void __sfp_lock_release (void) { __lock_release_recursive (__sfp_recursive_mutex); } -_VOID +void __sinit_lock_acquire (void) { __lock_acquire_recursive (__sinit_recursive_mutex); } -_VOID +void __sinit_lock_release (void) { __lock_release_recursive (__sinit_recursive_mutex); @@ -349,7 +349,7 @@ _DEFUN(__fp_unlock, (ptr), return 0; } -_VOID +void __fp_lock_all (void) { __sfp_lock_acquire (); @@ -357,7 +357,7 @@ __fp_lock_all (void) (void) _fwalk (_REENT, __fp_lock); } -_VOID +void __fp_unlock_all (void) { (void) _fwalk (_REENT, __fp_unlock); diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index b5fd1198a..68a36e054 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -179,9 +179,9 @@ extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(struct _reent *, void *, extern _fpos_t _EXFUN(__sseek,(struct _reent *, void *, _fpos_t, int)); extern int _EXFUN(__sclose,(struct _reent *, void *)); extern int _EXFUN(__stextmode,(int)); -extern _VOID _EXFUN(__sinit,(struct _reent *)); -extern _VOID _EXFUN(_cleanup_r,(struct _reent *)); -extern _VOID _EXFUN(__smakebuf_r,(struct _reent *, FILE *)); +extern void _EXFUN(__sinit,(struct _reent *)); +extern void _EXFUN(_cleanup_r,(struct _reent *)); +extern void _EXFUN(__smakebuf_r,(struct _reent *, FILE *)); extern int _EXFUN(__swhatbuf_r,(struct _reent *, FILE *, size_t *, int *)); extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *))); extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *))); @@ -297,10 +297,10 @@ char *_EXFUN(_llicvt,(char *, long long, char)); #define __sinit_lock_acquire() #define __sinit_lock_release() #else -_VOID _EXFUN(__sfp_lock_acquire,(_VOID)); -_VOID _EXFUN(__sfp_lock_release,(_VOID)); -_VOID _EXFUN(__sinit_lock_acquire,(_VOID)); -_VOID _EXFUN(__sinit_lock_release,(_VOID)); +void _EXFUN(__sfp_lock_acquire,(void)); +void _EXFUN(__sfp_lock_release,(void)); +void _EXFUN(__sinit_lock_acquire,(void)); +void _EXFUN(__sinit_lock_release,(void)); #endif /* Types used in positional argument support in vfprinf/vfwprintf. diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c index c76527da6..37a50d47d 100644 --- a/newlib/libc/stdio/makebuf.c +++ b/newlib/libc/stdio/makebuf.c @@ -34,7 +34,7 @@ * optimization) right after the _fstat() that finds the buffer size. */ -_VOID +void _DEFUN(__smakebuf_r, (ptr, fp), struct _reent *ptr, register FILE *fp) diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c index cda8a1112..e3e70a6f1 100644 --- a/newlib/libc/stdio/perror.c +++ b/newlib/libc/stdio/perror.c @@ -58,7 +58,7 @@ Supporting OS subroutines required: <>, <>, <>, #include #include "local.h" -_VOID +void _DEFUN(_perror_r, (ptr, s), struct _reent *ptr, const char *s) @@ -81,7 +81,7 @@ _DEFUN(_perror_r, (ptr, s), #ifndef _REENT_ONLY -_VOID +void _DEFUN(perror, (s), const char *s) { diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c index a09186bb0..745c93974 100644 --- a/newlib/libc/stdio/rewind.c +++ b/newlib/libc/stdio/rewind.c @@ -51,7 +51,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include #include -_VOID +void _DEFUN(_rewind_r, (ptr, fp), struct _reent * ptr, register FILE * fp) @@ -62,7 +62,7 @@ _DEFUN(_rewind_r, (ptr, fp), #ifndef _REENT_ONLY -_VOID +void _DEFUN(rewind, (fp), register FILE * fp) { diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c index 7308ab8c2..1538762a1 100644 --- a/newlib/libc/stdio/setbuf.c +++ b/newlib/libc/stdio/setbuf.c @@ -64,7 +64,7 @@ Supporting OS subroutines required: <>, <>, <>, #include #include "local.h" -_VOID +void _DEFUN(setbuf, (fp, buf), FILE *__restrict fp, char *__restrict buf) diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c index 6914ca7f2..2b93e7df3 100644 --- a/newlib/libc/stdio/setbuffer.c +++ b/newlib/libc/stdio/setbuffer.c @@ -64,7 +64,7 @@ Supporting OS subroutines required: <>, <>, <>, #include #include "local.h" -_VOID +void _DEFUN(setbuffer, (fp, buf, size), FILE * fp, char *buf, diff --git a/newlib/libc/stdlib/abort.c b/newlib/libc/stdlib/abort.c index ae0c2fb62..065dee5b6 100644 --- a/newlib/libc/stdlib/abort.c +++ b/newlib/libc/stdlib/abort.c @@ -46,7 +46,7 @@ Supporting OS subroutines required: <<_exit>> and optionally, <>. #include #include -_VOID +void abort (void) { #ifdef ABORT_MESSAGE diff --git a/newlib/libc/stdlib/atexit.c b/newlib/libc/stdlib/atexit.c index 78180895c..1710aff14 100644 --- a/newlib/libc/stdlib/atexit.c +++ b/newlib/libc/stdlib/atexit.c @@ -55,7 +55,7 @@ Supporting OS subroutines required: <>, <>, <>, int _DEFUN (atexit, (fn), - _VOID _EXFNPTR(fn, (_VOID))) + void _EXFNPTR(fn, (void))) { return __register_exitproc (__et_atexit, fn, NULL, NULL); } diff --git a/newlib/libc/stdlib/lcong48.c b/newlib/libc/stdlib/lcong48.c index f40dede82..a16d49ecc 100644 --- a/newlib/libc/stdlib/lcong48.c +++ b/newlib/libc/stdlib/lcong48.c @@ -13,7 +13,7 @@ #include "rand48.h" -_VOID +void _DEFUN (_lcong48_r, (r, p), struct _reent *r, unsigned short p[7]) @@ -29,7 +29,7 @@ _DEFUN (_lcong48_r, (r, p), } #ifndef _REENT_ONLY -_VOID +void _DEFUN (lcong48, (p), unsigned short p[7]) { diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index 329b25425..97d107e7d 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -68,7 +68,7 @@ const void * const __on_exit_dummy = &__on_exit_args; int _DEFUN (on_exit, (fn, arg), - _VOID _EXFNPTR(fn, (int, void *)), + void _EXFNPTR(fn, (int, void *)), void *arg) { return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL); diff --git a/newlib/libc/stdlib/srand48.c b/newlib/libc/stdlib/srand48.c index 7042e834c..1eac2a11f 100644 --- a/newlib/libc/stdlib/srand48.c +++ b/newlib/libc/stdlib/srand48.c @@ -13,7 +13,7 @@ #include "rand48.h" -_VOID +void _DEFUN (_srand48_r, (r, seed), struct _reent *r, long seed) @@ -29,7 +29,7 @@ _DEFUN (_srand48_r, (r, seed), } #ifndef _REENT_ONLY -_VOID +void _DEFUN (srand48, (seed), long seed) { diff --git a/newlib/libc/sys/linux/include/time.h b/newlib/libc/sys/linux/include/time.h index 64ade9463..e5456766e 100644 --- a/newlib/libc/sys/linux/include/time.h +++ b/newlib/libc/sys/linux/include/time.h @@ -81,8 +81,8 @@ struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); #ifndef __STRICT_ANSI__ char *_EXFUN(strptime, (const char *, const char *, struct tm *)); -_VOID _EXFUN(tzset, (_VOID)); -_VOID _EXFUN(_tzset_r, (struct _reent *)); +void _EXFUN(tzset, (void)); +void _EXFUN(_tzset_r, (struct _reent *)); typedef struct __tzrule_struct { @@ -102,13 +102,13 @@ typedef struct __tzinfo_struct __tzrule_type __tzrule[2]; } __tzinfo_type; -__tzinfo_type *_EXFUN (__gettzinfo, (_VOID)); +__tzinfo_type *_EXFUN (__gettzinfo, (void)); /* getdate functions */ #ifndef _REENT_ONLY #define getdate_err (*__getdate_err()) -int *_EXFUN(__getdate_err,(_VOID)); +int *_EXFUN(__getdate_err,(void)); struct tm * _EXFUN(getdate, (const char *)); /* getdate_err is set to one of the following values to indicate the error. diff --git a/newlib/libc/sys/rtems/crt0.c b/newlib/libc/sys/rtems/crt0.c index dca5fc8bc..ff3e7e6a3 100644 --- a/newlib/libc/sys/rtems/crt0.c +++ b/newlib/libc/sys/rtems/crt0.c @@ -189,7 +189,7 @@ RTEMS_STUB(int, issetugid (void), { return 0; }) RTEMS_STUB(void *, _realloc_r(struct _reent *r, void *p, size_t s), { return 0; }) RTEMS_STUB(void *, _calloc_r(struct _reent *r, size_t s1, size_t s2), { return 0; }) RTEMS_STUB(void *, _malloc_r(struct _reent * r, size_t s), { return 0; }) -RTEMS_STUB(_VOID, _free_r(struct _reent *r, void **p), { }) +RTEMS_STUB(void, _free_r(struct _reent *r, void **p), { }) /* stubs for functions required by libc/stdlib */ RTEMS_STUB(void, __assert_func(const char *file, int line, const char *failedexpr), { }) diff --git a/newlib/libc/time/local.h b/newlib/libc/time/local.h index dd9d76666..10c5b445d 100644 --- a/newlib/libc/time/local.h +++ b/newlib/libc/time/local.h @@ -23,8 +23,8 @@ int _EXFUN (__tzcalc_limits, (int __year)); extern const int __month_lengths[2][MONSPERYEAR]; -_VOID _EXFUN(_tzset_unlocked_r, (struct _reent *)); -_VOID _EXFUN(_tzset_unlocked, (_VOID)); +void _EXFUN(_tzset_unlocked_r, (struct _reent *)); +void _EXFUN(_tzset_unlocked, (void)); /* locks for multi-threading */ #ifdef __SINGLE_THREAD__ @@ -35,6 +35,6 @@ _VOID _EXFUN(_tzset_unlocked, (_VOID)); #define TZ_UNLOCK __tz_unlock() #endif -void _EXFUN(__tz_lock,(_VOID)); -void _EXFUN(__tz_unlock,(_VOID)); +void _EXFUN(__tz_lock,(void)); +void _EXFUN(__tz_unlock,(void)); diff --git a/newlib/libc/time/tzlock.c b/newlib/libc/time/tzlock.c index 153dfd3a5..4a3ee016f 100644 --- a/newlib/libc/time/tzlock.c +++ b/newlib/libc/time/tzlock.c @@ -35,7 +35,7 @@ until the corresponding <<__tz_unlock>> call on the same thread is made. __LOCK_INIT(static, __tz_mutex); #endif -_VOID +void __tz_lock (void) { #ifndef __SINGLE_THREAD__ @@ -43,7 +43,7 @@ __tz_lock (void) #endif } -_VOID +void __tz_unlock (void) { #ifndef __SINGLE_THREAD__ diff --git a/newlib/libc/time/tzset.c b/newlib/libc/time/tzset.c index ca1e1d91f..3b4c01c66 100644 --- a/newlib/libc/time/tzset.c +++ b/newlib/libc/time/tzset.c @@ -61,13 +61,13 @@ Supporting OS subroutine required: None #include #include "local.h" -_VOID +void _tzset_unlocked (void) { _tzset_unlocked_r (_REENT); } -_VOID +void tzset (void) { TZ_LOCK; diff --git a/newlib/libc/time/tzset_r.c b/newlib/libc/time/tzset_r.c index 6c21e822e..211ddc8af 100644 --- a/newlib/libc/time/tzset_r.c +++ b/newlib/libc/time/tzset_r.c @@ -13,7 +13,7 @@ static char __tzname_std[11]; static char __tzname_dst[11]; static char *prev_tzenv = NULL; -_VOID +void _DEFUN (_tzset_unlocked_r, (reent_ptr), struct _reent *reent_ptr) { @@ -183,7 +183,7 @@ _DEFUN (_tzset_unlocked_r, (reent_ptr), _daylight = tz->__tzrule[0].offset != tz->__tzrule[1].offset; } -_VOID +void _DEFUN (_tzset_r, (reent_ptr), struct _reent *reent_ptr) { From 44276afe2a0365d655425702205604640829668d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 21:48:55 -0600 Subject: [PATCH 215/649] ansification: remove _VOLATILE, _SIGNED Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/_ansi.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 9c3a04695..d05145b91 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -47,8 +47,6 @@ #endif #ifdef _HAVE_STDC -#define _VOLATILE volatile -#define _SIGNED signed #ifdef __CYGWIN__ #define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW #define _EXFUN(name, proto) __cdecl name proto @@ -65,8 +63,6 @@ #define _LONG_DOUBLE long double #endif #else -#define _VOLATILE -#define _SIGNED #define _EXFUN(name, proto) name() #define _EXFUN_NOTHROW(name, proto) name() #define _DEFUN(name, arglist, args) name arglist args; From 9087163804df8af6dc2ec1f675a2341c25f7795f Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 21:43:30 -0600 Subject: [PATCH 216/649] ansification: remove _DEFUN Signed-off-by: Yaakov Selkowitz --- libgloss/bfin/_exit.c | 3 +- libgloss/close.c | 3 +- libgloss/cr16/fstat.c | 3 +- libgloss/cr16/getpid.c | 3 +- libgloss/cr16/isatty.c | 3 +- libgloss/cr16/kill.c | 3 +- libgloss/cr16/putnum.c | 3 +- libgloss/cr16/stat.c | 3 +- libgloss/crx/fstat.c | 3 +- libgloss/crx/getpid.c | 3 +- libgloss/crx/isatty.c | 3 +- libgloss/crx/kill.c | 3 +- libgloss/crx/putnum.c | 3 +- libgloss/crx/stat.c | 3 +- libgloss/epiphany/_isatty.c | 2 +- libgloss/frv/fstat.c | 3 +- libgloss/frv/getpid.c | 3 +- libgloss/frv/isatty.c | 3 +- libgloss/frv/kill.c | 3 +- libgloss/frv/print.c | 3 +- libgloss/frv/putnum.c | 3 +- libgloss/frv/sim-time.c | 9 +-- libgloss/frv/stat.c | 3 +- libgloss/fstat.c | 3 +- libgloss/ft32/fstat.c | 3 +- libgloss/ft32/getpid.c | 3 +- libgloss/ft32/isatty.c | 3 +- libgloss/ft32/kill.c | 3 +- libgloss/ft32/sim-lseek.S | 3 +- libgloss/ft32/sim-lseek.c | 3 +- libgloss/ft32/sim-time.c | 6 +- libgloss/ft32/stat.c | 3 +- libgloss/getpid.c | 3 +- libgloss/isatty.c | 3 +- libgloss/kill.c | 3 +- libgloss/libnosys/_exit.c | 3 +- libgloss/libnosys/chown.c | 3 +- libgloss/libnosys/close.c | 3 +- libgloss/libnosys/execve.c | 3 +- libgloss/libnosys/fork.c | 3 +- libgloss/libnosys/fstat.c | 3 +- libgloss/libnosys/getpid.c | 3 +- libgloss/libnosys/gettod.c | 3 +- libgloss/libnosys/isatty.c | 3 +- libgloss/libnosys/kill.c | 3 +- libgloss/libnosys/link.c | 3 +- libgloss/libnosys/lseek.c | 3 +- libgloss/libnosys/open.c | 3 +- libgloss/libnosys/read.c | 3 +- libgloss/libnosys/readlink.c | 3 +- libgloss/libnosys/stat.c | 3 +- libgloss/libnosys/symlink.c | 3 +- libgloss/libnosys/times.c | 3 +- libgloss/libnosys/unlink.c | 3 +- libgloss/libnosys/wait.c | 3 +- libgloss/libnosys/write.c | 3 +- libgloss/lm32/isatty.c | 3 +- libgloss/lseek.c | 3 +- libgloss/m68k/idp-outbyte.c | 6 +- libgloss/m68k/mc68ec.c | 6 +- libgloss/mcore/close.c | 3 +- libgloss/mcore/cmb-exit.c | 3 +- libgloss/mcore/cmb-inbyte.c | 3 +- libgloss/mcore/cmb-outbyte.c | 3 +- libgloss/mcore/fstat.c | 3 +- libgloss/mcore/getpid.c | 3 +- libgloss/mcore/kill.c | 3 +- libgloss/mcore/lseek.c | 3 +- libgloss/mcore/open.c | 3 +- libgloss/mcore/print.c | 3 +- libgloss/mcore/putnum.c | 3 +- libgloss/mcore/raise.c | 3 +- libgloss/mcore/read.c | 3 +- libgloss/mcore/stat.c | 3 +- libgloss/mcore/unlink.c | 3 +- libgloss/mcore/write.c | 3 +- libgloss/moxie/fstat.c | 3 +- libgloss/moxie/getpid.c | 3 +- libgloss/moxie/isatty.c | 3 +- libgloss/moxie/kill.c | 3 +- libgloss/moxie/print.c | 3 +- libgloss/moxie/putnum.c | 3 +- libgloss/moxie/qemu-time.c | 9 +-- libgloss/moxie/sim-lseek.S | 3 +- libgloss/moxie/sim-lseek.c | 3 +- libgloss/moxie/sim-time.c | 9 +-- libgloss/moxie/stat.c | 3 +- libgloss/open.c | 3 +- libgloss/print.c | 3 +- libgloss/putnum.c | 3 +- libgloss/read.c | 3 +- libgloss/spu/getpid.c | 2 +- libgloss/stat.c | 3 +- libgloss/tic6x/getpid.c | 3 +- libgloss/tic6x/kill.c | 3 +- libgloss/unlink.c | 3 +- libgloss/write.c | 3 +- libgloss/xc16x/misc.c | 8 +- libgloss/xstormy16/close.c | 3 +- libgloss/xstormy16/fstat.c | 3 +- libgloss/xstormy16/getpid.c | 3 +- libgloss/xstormy16/isatty.c | 3 +- libgloss/xstormy16/kill.c | 3 +- libgloss/xstormy16/lseek.c | 3 +- libgloss/xstormy16/open.c | 3 +- libgloss/xstormy16/stat.c | 3 +- libgloss/xstormy16/unlink.c | 3 +- newlib/libc/argz/argz_add.c | 3 +- newlib/libc/argz/argz_add_sep.c | 3 +- newlib/libc/argz/argz_append.c | 3 +- newlib/libc/argz/argz_count.c | 3 +- newlib/libc/argz/argz_create.c | 3 +- newlib/libc/argz/argz_create_sep.c | 3 +- newlib/libc/argz/argz_delete.c | 3 +- newlib/libc/argz/argz_extract.c | 3 +- newlib/libc/argz/argz_insert.c | 3 +- newlib/libc/argz/argz_next.c | 3 +- newlib/libc/argz/argz_replace.c | 3 +- newlib/libc/argz/argz_stringify.c | 3 +- newlib/libc/argz/envz_add.c | 3 +- newlib/libc/argz/envz_entry.c | 3 +- newlib/libc/argz/envz_get.c | 3 +- newlib/libc/argz/envz_merge.c | 3 +- newlib/libc/argz/envz_remove.c | 3 +- newlib/libc/argz/envz_strip.c | 3 +- newlib/libc/ctype/isalnum.c | 2 +- newlib/libc/ctype/isalpha.c | 2 +- newlib/libc/ctype/isascii.c | 2 +- newlib/libc/ctype/isblank.c | 2 +- newlib/libc/ctype/iscntrl.c | 2 +- newlib/libc/ctype/isdigit.c | 2 +- newlib/libc/ctype/islower.c | 2 +- newlib/libc/ctype/isprint.c | 4 +- newlib/libc/ctype/ispunct.c | 2 +- newlib/libc/ctype/isspace.c | 2 +- newlib/libc/ctype/isupper.c | 2 +- newlib/libc/ctype/iswalnum.c | 2 +- newlib/libc/ctype/iswalpha.c | 2 +- newlib/libc/ctype/iswblank.c | 2 +- newlib/libc/ctype/iswcntrl.c | 2 +- newlib/libc/ctype/iswctype.c | 2 +- newlib/libc/ctype/iswdigit.c | 2 +- newlib/libc/ctype/iswgraph.c | 2 +- newlib/libc/ctype/iswlower.c | 2 +- newlib/libc/ctype/iswprint.c | 2 +- newlib/libc/ctype/iswpunct.c | 2 +- newlib/libc/ctype/iswspace.c | 2 +- newlib/libc/ctype/iswupper.c | 2 +- newlib/libc/ctype/iswxdigit.c | 2 +- newlib/libc/ctype/isxdigit.c | 2 +- newlib/libc/ctype/jp2uc.c | 4 +- newlib/libc/ctype/toascii.c | 2 +- newlib/libc/ctype/tolower.c | 2 +- newlib/libc/ctype/toupper.c | 2 +- newlib/libc/ctype/towctrans.c | 6 +- newlib/libc/ctype/towlower.c | 2 +- newlib/libc/ctype/towupper.c | 2 +- newlib/libc/ctype/wctrans.c | 6 +- newlib/libc/ctype/wctype.c | 6 +- newlib/libc/iconv/ces/euc.c | 21 ++--- newlib/libc/iconv/ces/table-pcs.c | 24 ++---- newlib/libc/iconv/ces/table.c | 30 +++---- newlib/libc/iconv/ces/ucs-2-internal.c | 9 +-- newlib/libc/iconv/ces/ucs-2.c | 15 ++-- newlib/libc/iconv/ces/ucs-4-internal.c | 9 +-- newlib/libc/iconv/ces/ucs-4.c | 15 ++-- newlib/libc/iconv/ces/us-ascii.c | 9 +-- newlib/libc/iconv/ces/utf-16.c | 18 ++--- newlib/libc/iconv/ces/utf-8.c | 9 +-- newlib/libc/iconv/lib/aliasesi.c | 9 +-- newlib/libc/iconv/lib/iconv.c | 17 ++-- newlib/libc/iconv/lib/iconvnls.c | 24 ++---- newlib/libc/iconv/lib/nullconv.c | 22 ++--- newlib/libc/iconv/lib/ucsconv.c | 25 ++---- newlib/libc/include/_ansi.h | 2 - newlib/libc/locale/locale.c | 6 +- newlib/libc/locale/localeconv.c | 3 +- newlib/libc/machine/microblaze/strcmp.c | 3 +- newlib/libc/machine/microblaze/strcpy.c | 3 +- newlib/libc/machine/microblaze/strlen.c | 3 +- newlib/libc/machine/powerpc/atosfix16.c | 6 +- newlib/libc/machine/powerpc/atosfix32.c | 6 +- newlib/libc/machine/powerpc/atosfix64.c | 6 +- newlib/libc/machine/powerpc/atoufix16.c | 6 +- newlib/libc/machine/powerpc/atoufix32.c | 6 +- newlib/libc/machine/powerpc/atoufix64.c | 6 +- newlib/libc/machine/powerpc/strtosfix16.c | 6 +- newlib/libc/machine/powerpc/strtosfix32.c | 6 +- newlib/libc/machine/powerpc/strtosfix64.c | 6 +- newlib/libc/machine/powerpc/strtoufix16.c | 6 +- newlib/libc/machine/powerpc/strtoufix32.c | 6 +- newlib/libc/machine/powerpc/strtoufix64.c | 6 +- newlib/libc/machine/powerpc/ufix64toa.c | 3 +- newlib/libc/machine/powerpc/vec_calloc.c | 3 +- newlib/libc/machine/powerpc/vec_free.c | 3 +- newlib/libc/machine/powerpc/vec_malloc.c | 3 +- newlib/libc/machine/powerpc/vec_realloc.c | 3 +- newlib/libc/machine/powerpc/vfprintf.c | 6 +- newlib/libc/machine/powerpc/vfscanf.c | 6 +- newlib/libc/machine/spu/assert.c | 6 +- newlib/libc/machine/spu/clearerr.c | 3 +- newlib/libc/machine/spu/creat.c | 3 +- newlib/libc/machine/spu/fclose.c | 3 +- newlib/libc/machine/spu/fdopen.c | 3 +- newlib/libc/machine/spu/feof.c | 3 +- newlib/libc/machine/spu/ferror.c | 3 +- newlib/libc/machine/spu/fflush.c | 3 +- newlib/libc/machine/spu/fgetc.c | 3 +- newlib/libc/machine/spu/fgetpos.c | 3 +- newlib/libc/machine/spu/fgets.c | 3 +- newlib/libc/machine/spu/fileno.c | 3 +- newlib/libc/machine/spu/fopen.c | 3 +- newlib/libc/machine/spu/fputs.c | 3 +- newlib/libc/machine/spu/fread.c | 3 +- newlib/libc/machine/spu/freopen.c | 3 +- newlib/libc/machine/spu/fseek.c | 3 +- newlib/libc/machine/spu/fsetpos.c | 3 +- newlib/libc/machine/spu/ftell.c | 3 +- newlib/libc/machine/spu/fwrite.c | 3 +- newlib/libc/machine/spu/perror.c | 3 +- newlib/libc/machine/spu/puts.c | 3 +- newlib/libc/machine/spu/rewind.c | 3 +- newlib/libc/machine/spu/setbuf.c | 3 +- newlib/libc/machine/spu/setvbuf.c | 3 +- newlib/libc/machine/spu/stdio.c | 9 +-- newlib/libc/machine/spu/tmpnam.c | 3 +- newlib/libc/machine/spu/vfprintf.c | 3 +- newlib/libc/machine/spu/vfscanf.c | 3 +- newlib/libc/machine/spu/vprintf.c | 3 +- newlib/libc/machine/spu/vscanf.c | 3 +- newlib/libc/machine/spu/vsnprintf.c | 3 +- newlib/libc/machine/spu/vsprintf.c | 3 +- newlib/libc/machine/spu/vsscanf.c | 3 +- newlib/libc/misc/__dprintf.c | 12 +-- newlib/libc/posix/_isatty.c | 2 +- newlib/libc/posix/closedir.c | 3 +- newlib/libc/posix/creat.c | 3 +- newlib/libc/posix/execl.c | 6 +- newlib/libc/posix/execle.c | 6 +- newlib/libc/posix/execlp.c | 6 +- newlib/libc/posix/execv.c | 3 +- newlib/libc/posix/execve.c | 3 +- newlib/libc/posix/execvp.c | 6 +- newlib/libc/posix/isatty.c | 2 +- newlib/libc/posix/opendir.c | 3 +- newlib/libc/posix/popen.c | 6 +- newlib/libc/posix/posix_spawn.c | 63 +++++---------- newlib/libc/posix/readdir.c | 3 +- newlib/libc/posix/readdir_r.c | 3 +- newlib/libc/posix/rewinddir.c | 3 +- newlib/libc/posix/scandir.c | 6 +- newlib/libc/posix/seekdir.c | 3 +- newlib/libc/posix/telldir.c | 9 +-- newlib/libc/reent/execr.c | 9 +-- newlib/libc/reent/fcntlr.c | 3 +- newlib/libc/reent/fstat64r.c | 3 +- newlib/libc/reent/gettimeofdayr.c | 3 +- newlib/libc/reent/linkr.c | 3 +- newlib/libc/reent/lseek64r.c | 3 +- newlib/libc/reent/lseekr.c | 3 +- newlib/libc/reent/mkdirr.c | 3 +- newlib/libc/reent/openr.c | 3 +- newlib/libc/reent/readr.c | 3 +- newlib/libc/reent/reent.c | 6 +- newlib/libc/reent/renamer.c | 3 +- newlib/libc/reent/sbrkr.c | 3 +- newlib/libc/reent/signalr.c | 6 +- newlib/libc/reent/stat64r.c | 3 +- newlib/libc/reent/statr.c | 3 +- newlib/libc/reent/timesr.c | 3 +- newlib/libc/reent/unlinkr.c | 3 +- newlib/libc/reent/writer.c | 3 +- newlib/libc/search/bsearch.c | 3 +- newlib/libc/search/hash.c | 3 +- newlib/libc/search/hcreate.c | 5 +- newlib/libc/search/qsort.c | 15 ++-- newlib/libc/search/tdelete.c | 3 +- newlib/libc/search/tdestroy.c | 3 +- newlib/libc/search/tfind.c | 3 +- newlib/libc/search/tsearch.c | 3 +- newlib/libc/search/twalk.c | 3 +- newlib/libc/signal/psignal.c | 3 +- newlib/libc/signal/raise.c | 6 +- newlib/libc/signal/signal.c | 20 ++--- newlib/libc/stdio/asiprintf.c | 6 +- newlib/libc/stdio/asniprintf.c | 6 +- newlib/libc/stdio/asnprintf.c | 6 +- newlib/libc/stdio/asprintf.c | 6 +- newlib/libc/stdio/clearerr.c | 3 +- newlib/libc/stdio/clearerr_u.c | 3 +- newlib/libc/stdio/diprintf.c | 6 +- newlib/libc/stdio/dprintf.c | 6 +- newlib/libc/stdio/fclose.c | 6 +- newlib/libc/stdio/fcloseall.c | 3 +- newlib/libc/stdio/fdopen.c | 6 +- newlib/libc/stdio/feof.c | 3 +- newlib/libc/stdio/feof_u.c | 3 +- newlib/libc/stdio/ferror.c | 3 +- newlib/libc/stdio/ferror_u.c | 3 +- newlib/libc/stdio/fflush.c | 12 +-- newlib/libc/stdio/fgetc.c | 6 +- newlib/libc/stdio/fgetc_u.c | 6 +- newlib/libc/stdio/fgetpos.c | 6 +- newlib/libc/stdio/fgets.c | 6 +- newlib/libc/stdio/fgetwc.c | 9 +-- newlib/libc/stdio/fgetwc_u.c | 6 +- newlib/libc/stdio/fgetws.c | 6 +- newlib/libc/stdio/fileno.c | 3 +- newlib/libc/stdio/fileno_u.c | 3 +- newlib/libc/stdio/findfp.c | 21 ++--- newlib/libc/stdio/fiprintf.c | 6 +- newlib/libc/stdio/flags.c | 3 +- newlib/libc/stdio/fmemopen.c | 21 ++--- newlib/libc/stdio/fopen.c | 6 +- newlib/libc/stdio/fopencookie.c | 21 ++--- newlib/libc/stdio/fprintf.c | 6 +- newlib/libc/stdio/fpurge.c | 9 +-- newlib/libc/stdio/fputc.c | 6 +- newlib/libc/stdio/fputc_u.c | 6 +- newlib/libc/stdio/fputs.c | 6 +- newlib/libc/stdio/fputwc.c | 9 +-- newlib/libc/stdio/fputwc_u.c | 6 +- newlib/libc/stdio/fputws.c | 6 +- newlib/libc/stdio/fread.c | 9 +-- newlib/libc/stdio/freopen.c | 6 +- newlib/libc/stdio/fseek.c | 6 +- newlib/libc/stdio/fseeko.c | 6 +- newlib/libc/stdio/fsetlocking.c | 3 +- newlib/libc/stdio/fsetpos.c | 6 +- newlib/libc/stdio/ftell.c | 6 +- newlib/libc/stdio/ftello.c | 6 +- newlib/libc/stdio/funopen.c | 21 ++--- newlib/libc/stdio/fvwrite.c | 3 +- newlib/libc/stdio/fwalk.c | 6 +- newlib/libc/stdio/fwide.c | 6 +- newlib/libc/stdio/fwprintf.c | 6 +- newlib/libc/stdio/fwrite.c | 6 +- newlib/libc/stdio/getc.c | 6 +- newlib/libc/stdio/getc_u.c | 6 +- newlib/libc/stdio/getchar.c | 3 +- newlib/libc/stdio/getchar_u.c | 3 +- newlib/libc/stdio/getdelim.c | 3 +- newlib/libc/stdio/getline.c | 3 +- newlib/libc/stdio/gets.c | 6 +- newlib/libc/stdio/getw.c | 3 +- newlib/libc/stdio/getwc.c | 6 +- newlib/libc/stdio/getwc_u.c | 6 +- newlib/libc/stdio/getwchar.c | 3 +- newlib/libc/stdio/getwchar_u.c | 3 +- newlib/libc/stdio/iprintf.c | 6 +- newlib/libc/stdio/makebuf.c | 6 +- newlib/libc/stdio/mktemp.c | 39 +++------ newlib/libc/stdio/nano-vfprintf.c | 21 ++--- newlib/libc/stdio/nano-vfscanf.c | 18 ++--- newlib/libc/stdio/open_memstream.c | 27 +++---- newlib/libc/stdio/perror.c | 6 +- newlib/libc/stdio/printf.c | 6 +- newlib/libc/stdio/putc.c | 6 +- newlib/libc/stdio/putc_u.c | 6 +- newlib/libc/stdio/putchar.c | 6 +- newlib/libc/stdio/putchar_u.c | 6 +- newlib/libc/stdio/puts.c | 6 +- newlib/libc/stdio/putw.c | 3 +- newlib/libc/stdio/putwc.c | 6 +- newlib/libc/stdio/putwc_u.c | 6 +- newlib/libc/stdio/putwchar.c | 6 +- newlib/libc/stdio/putwchar_u.c | 6 +- newlib/libc/stdio/refill.c | 6 +- newlib/libc/stdio/remove.c | 6 +- newlib/libc/stdio/rename.c | 3 +- newlib/libc/stdio/rewind.c | 6 +- newlib/libc/stdio/rget.c | 6 +- newlib/libc/stdio/sccl.c | 3 +- newlib/libc/stdio/setbuf.c | 3 +- newlib/libc/stdio/setbuffer.c | 3 +- newlib/libc/stdio/setlinebuf.c | 3 +- newlib/libc/stdio/setvbuf.c | 3 +- newlib/libc/stdio/siprintf.c | 6 +- newlib/libc/stdio/siscanf.c | 6 +- newlib/libc/stdio/sniprintf.c | 6 +- newlib/libc/stdio/snprintf.c | 6 +- newlib/libc/stdio/sprintf.c | 6 +- newlib/libc/stdio/sscanf.c | 6 +- newlib/libc/stdio/stdio.c | 18 ++--- newlib/libc/stdio/stdio_ext.c | 21 ++--- newlib/libc/stdio/swprintf.c | 6 +- newlib/libc/stdio/tmpfile.c | 3 +- newlib/libc/stdio/tmpnam.c | 15 ++-- newlib/libc/stdio/ungetc.c | 9 +-- newlib/libc/stdio/ungetwc.c | 6 +- newlib/libc/stdio/vasiprintf.c | 6 +- newlib/libc/stdio/vasniprintf.c | 6 +- newlib/libc/stdio/vasnprintf.c | 6 +- newlib/libc/stdio/vasprintf.c | 6 +- newlib/libc/stdio/vdiprintf.c | 6 +- newlib/libc/stdio/vdprintf.c | 6 +- newlib/libc/stdio/vfprintf.c | 24 ++---- newlib/libc/stdio/vfscanf.c | 21 ++--- newlib/libc/stdio/vfwprintf.c | 12 +-- newlib/libc/stdio/vfwscanf.c | 18 ++--- newlib/libc/stdio/viprintf.c | 6 +- newlib/libc/stdio/viscanf.c | 6 +- newlib/libc/stdio/vprintf.c | 6 +- newlib/libc/stdio/vscanf.c | 6 +- newlib/libc/stdio/vsiprintf.c | 6 +- newlib/libc/stdio/vsiscanf.c | 6 +- newlib/libc/stdio/vsniprintf.c | 6 +- newlib/libc/stdio/vsnprintf.c | 6 +- newlib/libc/stdio/vsprintf.c | 6 +- newlib/libc/stdio/vsscanf.c | 6 +- newlib/libc/stdio/vswprintf.c | 6 +- newlib/libc/stdio/vwprintf.c | 6 +- newlib/libc/stdio/wbuf.c | 6 +- newlib/libc/stdio/wprintf.c | 6 +- newlib/libc/stdio/wsetup.c | 3 +- newlib/libc/stdio64/fdopen64.c | 6 +- newlib/libc/stdio64/fgetpos64.c | 6 +- newlib/libc/stdio64/fopen64.c | 6 +- newlib/libc/stdio64/freopen64.c | 6 +- newlib/libc/stdio64/fseeko64.c | 6 +- newlib/libc/stdio64/fsetpos64.c | 6 +- newlib/libc/stdio64/ftello64.c | 6 +- newlib/libc/stdio64/stdio64.c | 6 +- newlib/libc/stdio64/tmpfile64.c | 3 +- newlib/libc/stdlib/_Exit.c | 3 +- newlib/libc/stdlib/__adjust.c | 3 +- newlib/libc/stdlib/__atexit.c | 4 +- newlib/libc/stdlib/__call_atexit.c | 3 +- newlib/libc/stdlib/__exp10.c | 3 +- newlib/libc/stdlib/__ten_mu.c | 3 +- newlib/libc/stdlib/a64l.c | 3 +- newlib/libc/stdlib/abs.c | 2 +- newlib/libc/stdlib/assert.c | 6 +- newlib/libc/stdlib/atexit.c | 4 +- newlib/libc/stdlib/atof.c | 3 +- newlib/libc/stdlib/atoff.c | 3 +- newlib/libc/stdlib/atoi.c | 6 +- newlib/libc/stdlib/atol.c | 4 +- newlib/libc/stdlib/atoll.c | 6 +- newlib/libc/stdlib/calloc.c | 3 +- newlib/libc/stdlib/cxa_atexit.c | 4 +- newlib/libc/stdlib/cxa_finalize.c | 3 +- newlib/libc/stdlib/div.c | 3 +- newlib/libc/stdlib/drand48.c | 3 +- newlib/libc/stdlib/dtoa.c | 8 +- newlib/libc/stdlib/dtoastub.c | 4 +- newlib/libc/stdlib/ecvtbuf.c | 18 ++--- newlib/libc/stdlib/efgcvt.c | 18 ++--- newlib/libc/stdlib/erand48.c | 6 +- newlib/libc/stdlib/exit.c | 3 +- newlib/libc/stdlib/gdtoa-gethex.c | 9 +-- newlib/libc/stdlib/gdtoa-hexnan.c | 9 +-- newlib/libc/stdlib/getenv.c | 6 +- newlib/libc/stdlib/getenv_r.c | 6 +- newlib/libc/stdlib/itoa.c | 6 +- newlib/libc/stdlib/jrand48.c | 6 +- newlib/libc/stdlib/l64a.c | 6 +- newlib/libc/stdlib/labs.c | 3 +- newlib/libc/stdlib/lcong48.c | 6 +- newlib/libc/stdlib/ldiv.c | 3 +- newlib/libc/stdlib/llabs.c | 3 +- newlib/libc/stdlib/lldiv.c | 3 +- newlib/libc/stdlib/lrand48.c | 3 +- newlib/libc/stdlib/malign.c | 3 +- newlib/libc/stdlib/malloc.c | 6 +- newlib/libc/stdlib/mblen.c | 3 +- newlib/libc/stdlib/mblen_r.c | 3 +- newlib/libc/stdlib/mbrtowc.c | 6 +- newlib/libc/stdlib/mbsnrtowcs.c | 6 +- newlib/libc/stdlib/mbsrtowcs.c | 6 +- newlib/libc/stdlib/mbstowcs.c | 3 +- newlib/libc/stdlib/mbstowcs_r.c | 3 +- newlib/libc/stdlib/mbtowc.c | 3 +- newlib/libc/stdlib/mbtowc_r.c | 18 ++--- newlib/libc/stdlib/mprec.c | 48 +++++------ newlib/libc/stdlib/mrand48.c | 3 +- newlib/libc/stdlib/msize.c | 3 +- newlib/libc/stdlib/mstats.c | 9 +-- newlib/libc/stdlib/mtrim.c | 3 +- newlib/libc/stdlib/nrand48.c | 6 +- newlib/libc/stdlib/on_exit.c | 4 +- newlib/libc/stdlib/putenv.c | 3 +- newlib/libc/stdlib/putenv_r.c | 3 +- newlib/libc/stdlib/rand.c | 2 +- newlib/libc/stdlib/rand48.c | 3 +- newlib/libc/stdlib/rand_r.c | 2 +- newlib/libc/stdlib/random.c | 2 +- newlib/libc/stdlib/realloc.c | 3 +- newlib/libc/stdlib/reallocf.c | 6 +- newlib/libc/stdlib/rpmatch.c | 3 +- newlib/libc/stdlib/seed48.c | 6 +- newlib/libc/stdlib/setenv.c | 6 +- newlib/libc/stdlib/setenv_r.c | 6 +- newlib/libc/stdlib/srand48.c | 6 +- newlib/libc/stdlib/strtod.c | 15 ++-- newlib/libc/stdlib/strtol.c | 6 +- newlib/libc/stdlib/strtoll.c | 6 +- newlib/libc/stdlib/strtoul.c | 6 +- newlib/libc/stdlib/strtoull.c | 6 +- newlib/libc/stdlib/system.c | 12 +-- newlib/libc/stdlib/utoa.c | 6 +- newlib/libc/stdlib/valloc.c | 6 +- newlib/libc/stdlib/wcrtomb.c | 6 +- newlib/libc/stdlib/wcsnrtombs.c | 6 +- newlib/libc/stdlib/wcsrtombs.c | 6 +- newlib/libc/stdlib/wcstod.c | 12 +-- newlib/libc/stdlib/wcstol.c | 6 +- newlib/libc/stdlib/wcstoll.c | 6 +- newlib/libc/stdlib/wcstombs.c | 3 +- newlib/libc/stdlib/wcstombs_r.c | 3 +- newlib/libc/stdlib/wcstoul.c | 6 +- newlib/libc/stdlib/wcstoull.c | 6 +- newlib/libc/stdlib/wctomb.c | 3 +- newlib/libc/stdlib/wctomb_r.c | 18 ++--- newlib/libc/string/bcmp.c | 3 +- newlib/libc/string/bcopy.c | 3 +- newlib/libc/string/gnu_basename.c | 3 +- newlib/libc/string/index.c | 3 +- newlib/libc/string/memccpy.c | 3 +- newlib/libc/string/memchr.c | 3 +- newlib/libc/string/memcmp.c | 3 +- newlib/libc/string/memcpy.c | 3 +- newlib/libc/string/memmem.c | 3 +- newlib/libc/string/memmove.c | 3 +- newlib/libc/string/mempcpy.c | 3 +- newlib/libc/string/memrchr.c | 3 +- newlib/libc/string/memset.c | 3 +- newlib/libc/string/rawmemchr.c | 3 +- newlib/libc/string/rindex.c | 3 +- newlib/libc/string/stpcpy.c | 3 +- newlib/libc/string/stpncpy.c | 3 +- newlib/libc/string/strcasecmp.c | 3 +- newlib/libc/string/strcasestr.c | 3 +- newlib/libc/string/strcat.c | 3 +- newlib/libc/string/strchr.c | 3 +- newlib/libc/string/strchrnul.c | 3 +- newlib/libc/string/strcmp.c | 3 +- newlib/libc/string/strcoll.c | 3 +- newlib/libc/string/strcpy.c | 3 +- newlib/libc/string/strcspn.c | 3 +- newlib/libc/string/strdup.c | 2 +- newlib/libc/string/strdup_r.c | 3 +- newlib/libc/string/strerror.c | 6 +- newlib/libc/string/strerror_r.c | 3 +- newlib/libc/string/strlcat.c | 3 +- newlib/libc/string/strlcpy.c | 3 +- newlib/libc/string/strlen.c | 3 +- newlib/libc/string/strlwr.c | 3 +- newlib/libc/string/strncasecmp.c | 3 +- newlib/libc/string/strncat.c | 3 +- newlib/libc/string/strncmp.c | 3 +- newlib/libc/string/strncpy.c | 3 +- newlib/libc/string/strndup.c | 3 +- newlib/libc/string/strndup_r.c | 3 +- newlib/libc/string/strnlen.c | 3 +- newlib/libc/string/strpbrk.c | 3 +- newlib/libc/string/strrchr.c | 3 +- newlib/libc/string/strsep.c | 3 +- newlib/libc/string/strsignal.c | 3 +- newlib/libc/string/strspn.c | 3 +- newlib/libc/string/strstr.c | 3 +- newlib/libc/string/strtok.c | 3 +- newlib/libc/string/strtok_r.c | 6 +- newlib/libc/string/strupr.c | 3 +- newlib/libc/string/strxfrm.c | 3 +- newlib/libc/string/swab.c | 3 +- newlib/libc/string/u_strerr.c | 3 +- newlib/libc/string/wcpcpy.c | 3 +- newlib/libc/string/wcpncpy.c | 3 +- newlib/libc/string/wcscasecmp.c | 3 +- newlib/libc/string/wcscat.c | 3 +- newlib/libc/string/wcschr.c | 3 +- newlib/libc/string/wcscmp.c | 3 +- newlib/libc/string/wcscoll.c | 3 +- newlib/libc/string/wcscpy.c | 3 +- newlib/libc/string/wcscspn.c | 3 +- newlib/libc/string/wcslcat.c | 3 +- newlib/libc/string/wcslcpy.c | 3 +- newlib/libc/string/wcslen.c | 3 +- newlib/libc/string/wcsncasecmp.c | 3 +- newlib/libc/string/wcsncat.c | 3 +- newlib/libc/string/wcsncmp.c | 3 +- newlib/libc/string/wcsncpy.c | 3 +- newlib/libc/string/wcsnlen.c | 3 +- newlib/libc/string/wcspbrk.c | 3 +- newlib/libc/string/wcsrchr.c | 3 +- newlib/libc/string/wcsspn.c | 3 +- newlib/libc/string/wcsstr.c | 3 +- newlib/libc/string/wcstok.c | 3 +- newlib/libc/string/wcswidth.c | 3 +- newlib/libc/string/wcsxfrm.c | 3 +- newlib/libc/string/wcwidth.c | 6 +- newlib/libc/string/wmemchr.c | 3 +- newlib/libc/string/wmemcmp.c | 3 +- newlib/libc/string/wmemcpy.c | 3 +- newlib/libc/string/wmemmove.c | 3 +- newlib/libc/string/wmempcpy.c | 3 +- newlib/libc/string/wmemset.c | 3 +- newlib/libc/string/xpg_strerror_r.c | 3 +- newlib/libc/sys/a29khif/kill.c | 3 +- newlib/libc/sys/h8300hms/misc.c | 8 +- newlib/libc/sys/h8500hms/misc.c | 8 +- newlib/libc/sys/linux/ctermid.c | 3 +- newlib/libc/sys/linux/getpwent.c | 9 +-- newlib/libc/sys/linux/pread.c | 6 +- newlib/libc/sys/linux/pread64.c | 3 +- newlib/libc/sys/linux/pwrite.c | 6 +- newlib/libc/sys/linux/pwrite64.c | 3 +- newlib/libc/sys/sparc64/ieee.c | 12 +-- newlib/libc/sys/sun4/ieee.c | 12 +-- newlib/libc/sys/sysnec810/misc.c | 3 +- newlib/libc/sys/sysvi386/fpx.c | 9 +-- newlib/libc/sys/sysvnecv70/fpx.c | 9 +-- newlib/libc/syscalls/sysclose.c | 3 +- newlib/libc/syscalls/sysexecve.c | 3 +- newlib/libc/syscalls/sysfcntl.c | 3 +- newlib/libc/syscalls/sysfstat.c | 3 +- newlib/libc/syscalls/sysgettod.c | 3 +- newlib/libc/syscalls/sysisatty.c | 3 +- newlib/libc/syscalls/syskill.c | 3 +- newlib/libc/syscalls/syslink.c | 3 +- newlib/libc/syscalls/syslseek.c | 3 +- newlib/libc/syscalls/sysopen.c | 3 +- newlib/libc/syscalls/sysread.c | 3 +- newlib/libc/syscalls/syssbrk.c | 3 +- newlib/libc/syscalls/sysstat.c | 3 +- newlib/libc/syscalls/systimes.c | 3 +- newlib/libc/syscalls/sysunlink.c | 3 +- newlib/libc/syscalls/syswait.c | 3 +- newlib/libc/syscalls/syswrite.c | 3 +- newlib/libc/time/asctime.c | 3 +- newlib/libc/time/asctime_r.c | 3 +- newlib/libc/time/ctime.c | 3 +- newlib/libc/time/ctime_r.c | 3 +- newlib/libc/time/difftime.c | 3 +- newlib/libc/time/gmtime.c | 3 +- newlib/libc/time/gmtime_r.c | 3 +- newlib/libc/time/lcltime.c | 3 +- newlib/libc/time/lcltime_r.c | 3 +- newlib/libc/time/mktime.c | 6 +- newlib/libc/time/strftime.c | 6 +- newlib/libc/time/time.c | 3 +- newlib/libc/time/tzcalc_limits.c | 3 +- newlib/libc/time/tzset_r.c | 6 +- newlib/libc/unix/basename.c | 3 +- newlib/libc/unix/dirname.c | 3 +- newlib/libc/unix/pread.c | 6 +- newlib/libc/unix/pwrite.c | 6 +- newlib/libc/unix/ttyname.c | 3 +- newlib/libc/unix/ttyname_r.c | 3 +- newlib/libc/xdr/xdr.c | 99 ++++++++--------------- newlib/libc/xdr/xdr_array.c | 6 +- newlib/libc/xdr/xdr_float.c | 6 +- newlib/libc/xdr/xdr_float_vax.c | 6 +- newlib/libc/xdr/xdr_mem.c | 48 ++++------- newlib/libc/xdr/xdr_private.c | 9 +-- newlib/libc/xdr/xdr_rec.c | 69 ++++++---------- newlib/libc/xdr/xdr_reference.c | 6 +- newlib/libc/xdr/xdr_sizeof.c | 24 ++---- newlib/libc/xdr/xdr_stdio.c | 33 +++----- newlib/libm/common/s_isinf.c | 3 +- newlib/libm/common/s_isinfd.c | 3 +- newlib/libm/common/s_isnand.c | 3 +- newlib/libm/common/sf_isinf.c | 6 +- newlib/libm/common/sf_isinff.c | 6 +- newlib/libm/common/sf_isnan.c | 6 +- newlib/libm/common/sf_isnanf.c | 6 +- newlib/libm/machine/i386/f_math.h | 6 +- newlib/libm/mathfp/s_acos.c | 3 +- newlib/libm/mathfp/s_asin.c | 3 +- newlib/libm/mathfp/s_asine.c | 3 +- newlib/libm/mathfp/s_atan.c | 3 +- newlib/libm/mathfp/s_atan2.c | 3 +- newlib/libm/mathfp/s_atangent.c | 3 +- newlib/libm/mathfp/s_ceil.c | 3 +- newlib/libm/mathfp/s_cos.c | 3 +- newlib/libm/mathfp/s_cosh.c | 3 +- newlib/libm/mathfp/s_exp.c | 3 +- newlib/libm/mathfp/s_exp2.c | 3 +- newlib/libm/mathfp/s_fabs.c | 3 +- newlib/libm/mathfp/s_floor.c | 3 +- newlib/libm/mathfp/s_ldexp.c | 3 +- newlib/libm/mathfp/s_log.c | 3 +- newlib/libm/mathfp/s_log10.c | 3 +- newlib/libm/mathfp/s_logarithm.c | 3 +- newlib/libm/mathfp/s_numtest.c | 3 +- newlib/libm/mathfp/s_sin.c | 3 +- newlib/libm/mathfp/s_sincos.c | 3 +- newlib/libm/mathfp/s_sine.c | 3 +- newlib/libm/mathfp/s_sineh.c | 3 +- newlib/libm/mathfp/s_sinf.c | 3 +- newlib/libm/mathfp/s_sinh.c | 3 +- newlib/libm/mathfp/s_sqrt.c | 3 +- newlib/libm/mathfp/s_tan.c | 3 +- newlib/libm/mathfp/s_tanh.c | 3 +- newlib/libm/mathfp/sf_acos.c | 3 +- newlib/libm/mathfp/sf_asin.c | 3 +- newlib/libm/mathfp/sf_asine.c | 3 +- newlib/libm/mathfp/sf_atan.c | 3 +- newlib/libm/mathfp/sf_atan2.c | 3 +- newlib/libm/mathfp/sf_atangent.c | 3 +- newlib/libm/mathfp/sf_ceil.c | 3 +- newlib/libm/mathfp/sf_cos.c | 3 +- newlib/libm/mathfp/sf_cosh.c | 3 +- newlib/libm/mathfp/sf_exp.c | 3 +- newlib/libm/mathfp/sf_exp2.c | 3 +- newlib/libm/mathfp/sf_fabs.c | 3 +- newlib/libm/mathfp/sf_floor.c | 3 +- newlib/libm/mathfp/sf_fmod.c | 3 +- newlib/libm/mathfp/sf_ldexp.c | 3 +- newlib/libm/mathfp/sf_log.c | 3 +- newlib/libm/mathfp/sf_log10.c | 3 +- newlib/libm/mathfp/sf_logarithm.c | 3 +- newlib/libm/mathfp/sf_numtest.c | 3 +- newlib/libm/mathfp/sf_sin.c | 3 +- newlib/libm/mathfp/sf_sincos.c | 3 +- newlib/libm/mathfp/sf_sine.c | 3 +- newlib/libm/mathfp/sf_sineh.c | 3 +- newlib/libm/mathfp/sf_sinh.c | 3 +- newlib/libm/mathfp/sf_sqrt.c | 3 +- newlib/libm/mathfp/sf_tan.c | 3 +- newlib/libm/mathfp/sf_tanh.c | 3 +- newlib/libm/test/convert.c | 12 +-- newlib/libm/test/dcvt.c | 33 +++----- newlib/libm/test/math.c | 33 +++----- newlib/libm/test/string.c | 6 +- newlib/libm/test/test.c | 27 +++---- newlib/libm/test/test_ieee.c | 3 +- newlib/libm/test/test_is.c | 43 +++++----- 729 files changed, 1338 insertions(+), 2605 deletions(-) diff --git a/libgloss/bfin/_exit.c b/libgloss/bfin/_exit.c index e8186326a..e55cf0849 100644 --- a/libgloss/bfin/_exit.c +++ b/libgloss/bfin/_exit.c @@ -17,8 +17,7 @@ #include <_ansi.h> void -_DEFUN (_exit, (rc), - int rc) +_exit (int rc) { while (1) asm volatile ("EXCPT 0;"); diff --git a/libgloss/close.c b/libgloss/close.c index 7aafcea46..48156aa35 100644 --- a/libgloss/close.c +++ b/libgloss/close.c @@ -18,8 +18,7 @@ * close -- We don't need to do anything, but pretend we did. */ int -_DEFUN (close ,(fd), - int fd) +close (int fd) { return (0); } diff --git a/libgloss/cr16/fstat.c b/libgloss/cr16/fstat.c index 73e1fa248..781b2a208 100644 --- a/libgloss/cr16/fstat.c +++ b/libgloss/cr16/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (_fstat, (fd, buf), - int fd, +_fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/cr16/getpid.c b/libgloss/cr16/getpid.c index d254c9b0d..efe190098 100644 --- a/libgloss/cr16/getpid.c +++ b/libgloss/cr16/getpid.c @@ -19,8 +19,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (_getpid, (), - ) +_getpid (void) { return __MYPID; } diff --git a/libgloss/cr16/isatty.c b/libgloss/cr16/isatty.c index 604e8f097..fa3cd038c 100644 --- a/libgloss/cr16/isatty.c +++ b/libgloss/cr16/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes and return a 1. */ int -_DEFUN (_isatty, (fd), - int fd) +_isatty (int fd) { return (1); } diff --git a/libgloss/cr16/kill.c b/libgloss/cr16/kill.c index 43c3ec554..f51ddb5f5 100644 --- a/libgloss/cr16/kill.c +++ b/libgloss/cr16/kill.c @@ -20,8 +20,7 @@ extern void _exit (int) __attribute__((__noreturn__)); * kill -- go out via exit... */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/cr16/putnum.c b/libgloss/cr16/putnum.c index 3317bbf0a..af7232205 100644 --- a/libgloss/cr16/putnum.c +++ b/libgloss/cr16/putnum.c @@ -18,8 +18,7 @@ * putnum -- print a 32 bit number in hex */ void -_DEFUN (putnum, (num), - unsigned int num) +putnum (unsigned int num) { char buf[9]; int cnt; diff --git a/libgloss/cr16/stat.c b/libgloss/cr16/stat.c index 743fc94a9..3900a1bce 100644 --- a/libgloss/cr16/stat.c +++ b/libgloss/cr16/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (_stat, (path, buf), - const char *path, +_stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/crx/fstat.c b/libgloss/crx/fstat.c index 75f863583..e96cc07d1 100644 --- a/libgloss/crx/fstat.c +++ b/libgloss/crx/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (fstat, (fd, buf), - int fd, +fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/crx/getpid.c b/libgloss/crx/getpid.c index 3c1a7b8b8..912ca18a5 100644 --- a/libgloss/crx/getpid.c +++ b/libgloss/crx/getpid.c @@ -19,8 +19,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (getpid, (), - ) +getpid (void) { return __MYPID; } diff --git a/libgloss/crx/isatty.c b/libgloss/crx/isatty.c index ac3d041e7..c0039a59e 100644 --- a/libgloss/crx/isatty.c +++ b/libgloss/crx/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes and return a 1. */ int -_DEFUN (isatty, (fd), - int fd) +isatty (int fd) { return (1); } diff --git a/libgloss/crx/kill.c b/libgloss/crx/kill.c index db5018cfc..98cd3c40e 100644 --- a/libgloss/crx/kill.c +++ b/libgloss/crx/kill.c @@ -19,8 +19,7 @@ * kill -- go out via exit... */ int -_DEFUN (kill, (pid, sig), - int pid, +kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/crx/putnum.c b/libgloss/crx/putnum.c index 3317bbf0a..af7232205 100644 --- a/libgloss/crx/putnum.c +++ b/libgloss/crx/putnum.c @@ -18,8 +18,7 @@ * putnum -- print a 32 bit number in hex */ void -_DEFUN (putnum, (num), - unsigned int num) +putnum (unsigned int num) { char buf[9]; int cnt; diff --git a/libgloss/crx/stat.c b/libgloss/crx/stat.c index 9562b9097..497ef83c0 100644 --- a/libgloss/crx/stat.c +++ b/libgloss/crx/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (stat, (path, buf), - const char *path, +stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/epiphany/_isatty.c b/libgloss/epiphany/_isatty.c index 9ec5060f9..cfb1bf6e4 100644 --- a/libgloss/epiphany/_isatty.c +++ b/libgloss/epiphany/_isatty.c @@ -20,7 +20,7 @@ #include int -_DEFUN(_isatty, (fd), int fd) +_isatty (int fd) { struct stat buf; diff --git a/libgloss/frv/fstat.c b/libgloss/frv/fstat.c index 680c4a1c0..99f0abfd6 100644 --- a/libgloss/frv/fstat.c +++ b/libgloss/frv/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (_fstat, (fd, buf), - int fd, +_fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/frv/getpid.c b/libgloss/frv/getpid.c index e6d568207..1809a2dde 100644 --- a/libgloss/frv/getpid.c +++ b/libgloss/frv/getpid.c @@ -18,8 +18,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (_getpid, (), - ) +_getpid (void) { return __MYPID; } diff --git a/libgloss/frv/isatty.c b/libgloss/frv/isatty.c index e4c99065b..65c02b7d6 100644 --- a/libgloss/frv/isatty.c +++ b/libgloss/frv/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes and return a 1. */ int -_DEFUN (_isatty, (fd), - int fd) +_isatty (int fd) { return (1); } diff --git a/libgloss/frv/kill.c b/libgloss/frv/kill.c index 8dda1e9a6..3be632ead 100644 --- a/libgloss/frv/kill.c +++ b/libgloss/frv/kill.c @@ -20,8 +20,7 @@ extern void _exit (int) __attribute__((__noreturn__)); * kill -- go out via exit... */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/frv/print.c b/libgloss/frv/print.c index 8c8be847a..3dc3d0fe8 100644 --- a/libgloss/frv/print.c +++ b/libgloss/frv/print.c @@ -18,8 +18,7 @@ * print -- do a raw print of a string */ void -_DEFUN (_print, (ptr), -char *ptr) +_print (char *ptr) { while (*ptr) { outbyte (*ptr++); diff --git a/libgloss/frv/putnum.c b/libgloss/frv/putnum.c index c7fa12114..a07315e13 100644 --- a/libgloss/frv/putnum.c +++ b/libgloss/frv/putnum.c @@ -18,8 +18,7 @@ * putnum -- print a 32 bit number in hex */ void -_DEFUN (_putnum, (num), - unsigned int num) +_putnum (unsigned int num) { char buf[9]; int cnt; diff --git a/libgloss/frv/sim-time.c b/libgloss/frv/sim-time.c index 196f855ad..7a6af4acb 100644 --- a/libgloss/frv/sim-time.c +++ b/libgloss/frv/sim-time.c @@ -38,8 +38,7 @@ extern time_t _sim_time (void) __asm__("_sim_time"); * time -- return current time in seconds. */ time_t -_DEFUN (time, time (t), - time_t *t) +time (time_t *t) { time_t ret = _sim_time (); @@ -53,8 +52,7 @@ _DEFUN (time, time (t), * _times -- no clock, so return an error. */ int -_DEFUN (_times, _times (buf), - struct tms *buf) +_times (struct tms *buf) { errno = EINVAL; return (-1); @@ -65,8 +63,7 @@ _DEFUN (_times, _times (buf), * microseconds. */ int -_DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv, +_gettimeofday (struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/frv/stat.c b/libgloss/frv/stat.c index ceaedc216..b471f542c 100644 --- a/libgloss/frv/stat.c +++ b/libgloss/frv/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (_stat, (path, buf), - const char *path, +_stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/fstat.c b/libgloss/fstat.c index e7f913358..c9d14d103 100644 --- a/libgloss/fstat.c +++ b/libgloss/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (fstat, (fd, buf), - int fd, +fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/ft32/fstat.c b/libgloss/ft32/fstat.c index 0bd432e58..517d13442 100644 --- a/libgloss/ft32/fstat.c +++ b/libgloss/ft32/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (_fstat, (fd, buf), - int fd, +_fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/ft32/getpid.c b/libgloss/ft32/getpid.c index 75bba424a..435d0933f 100644 --- a/libgloss/ft32/getpid.c +++ b/libgloss/ft32/getpid.c @@ -18,8 +18,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (_getpid, (), - ) +_getpid (void) { return __MYPID; } diff --git a/libgloss/ft32/isatty.c b/libgloss/ft32/isatty.c index fd2d73760..def8ff01c 100644 --- a/libgloss/ft32/isatty.c +++ b/libgloss/ft32/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes and return a 1. */ int -_DEFUN (_isatty, (fd), - int fd) +_isatty (int fd) { return (1); } diff --git a/libgloss/ft32/kill.c b/libgloss/ft32/kill.c index 4b2241f56..06ec59c61 100644 --- a/libgloss/ft32/kill.c +++ b/libgloss/ft32/kill.c @@ -20,8 +20,7 @@ extern void _exit (int) __attribute__((__noreturn__)); * kill -- go out via exit... */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/ft32/sim-lseek.S b/libgloss/ft32/sim-lseek.S index c2a134ca1..488edf3df 100644 --- a/libgloss/ft32/sim-lseek.S +++ b/libgloss/ft32/sim-lseek.S @@ -22,8 +22,7 @@ * an error. */ off_t -_DEFUN (_lseek, (fd, offset, whence), - int fd, +_lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/ft32/sim-lseek.c b/libgloss/ft32/sim-lseek.c index e5c08c8e7..d35e08272 100644 --- a/libgloss/ft32/sim-lseek.c +++ b/libgloss/ft32/sim-lseek.c @@ -22,8 +22,7 @@ * an error. */ off_t -_DEFUN (_lseek, (fd, offset, whence), - int fd, +_lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/ft32/sim-time.c b/libgloss/ft32/sim-time.c index 8f417ebb7..9d2993b88 100644 --- a/libgloss/ft32/sim-time.c +++ b/libgloss/ft32/sim-time.c @@ -21,8 +21,7 @@ * _times -- no clock, so return an error. */ int -_DEFUN (_times, _times (buf), - struct tms *buf) +_times (struct tms *buf) { errno = EINVAL; return (-1); @@ -33,8 +32,7 @@ _DEFUN (_times, _times (buf), * microseconds. */ int -_DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv, +_gettimeofday (struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/ft32/stat.c b/libgloss/ft32/stat.c index 4d738efe2..df7ef39ee 100644 --- a/libgloss/ft32/stat.c +++ b/libgloss/ft32/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (_stat, (path, buf), - const char *path, +_stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/getpid.c b/libgloss/getpid.c index 07f7f9279..9814fd539 100644 --- a/libgloss/getpid.c +++ b/libgloss/getpid.c @@ -18,8 +18,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (getpid, (), - ) +getpid (void) { return __MYPID; } diff --git a/libgloss/isatty.c b/libgloss/isatty.c index 675d99bc2..2b54861ea 100644 --- a/libgloss/isatty.c +++ b/libgloss/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes, return a 1. */ int -_DEFUN (isatty, (fd), - int fd) +isatty (int fd) { return (1); } diff --git a/libgloss/kill.c b/libgloss/kill.c index ada45f6c8..a0eaee75b 100644 --- a/libgloss/kill.c +++ b/libgloss/kill.c @@ -18,8 +18,7 @@ * kill -- go out via exit... */ int -_DEFUN (kill, (pid, sig), - int pid, +kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/libnosys/_exit.c b/libgloss/libnosys/_exit.c index 44d845b8c..731dea7f0 100644 --- a/libgloss/libnosys/_exit.c +++ b/libgloss/libnosys/_exit.c @@ -6,8 +6,7 @@ #include <_syslist.h> void -_DEFUN (_exit, (rc), - int rc) +_exit (int rc) { /* Default stub just causes a divide by 0 exception. */ int x = rc / INT_MAX; diff --git a/libgloss/libnosys/chown.c b/libgloss/libnosys/chown.c index 0ddb85d03..faea82be8 100644 --- a/libgloss/libnosys/chown.c +++ b/libgloss/libnosys/chown.c @@ -12,8 +12,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_chown, (path, owner, group), - const char *path, +_chown (const char *path, uid_t owner, gid_t group) { diff --git a/libgloss/libnosys/close.c b/libgloss/libnosys/close.c index b759b86ee..8dc3e8b6a 100644 --- a/libgloss/libnosys/close.c +++ b/libgloss/libnosys/close.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_close, (fildes), - int fildes) +_close (int fildes) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/execve.c b/libgloss/libnosys/execve.c index a93641a34..950a43c75 100644 --- a/libgloss/libnosys/execve.c +++ b/libgloss/libnosys/execve.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_execve, (name, argv, env), - char *name, +_execve (char *name, char **argv, char **env) { diff --git a/libgloss/libnosys/fork.c b/libgloss/libnosys/fork.c index 5fbf68b93..c4724a3f0 100644 --- a/libgloss/libnosys/fork.c +++ b/libgloss/libnosys/fork.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_fork, (), - void) +_fork (void) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/fstat.c b/libgloss/libnosys/fstat.c index d04b40721..c85b9f209 100644 --- a/libgloss/libnosys/fstat.c +++ b/libgloss/libnosys/fstat.c @@ -13,8 +13,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_fstat, (fildes, st), - int fildes, +_fstat (int fildes, struct stat *st) { errno = ENOSYS; diff --git a/libgloss/libnosys/getpid.c b/libgloss/libnosys/getpid.c index 9ed416c6b..f8d451e8b 100644 --- a/libgloss/libnosys/getpid.c +++ b/libgloss/libnosys/getpid.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_getpid, (), - void) +_getpid (void) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/gettod.c b/libgloss/libnosys/gettod.c index 5e0b2db55..2b5354e72 100644 --- a/libgloss/libnosys/gettod.c +++ b/libgloss/libnosys/gettod.c @@ -15,8 +15,7 @@ extern int errno; struct timeval; int -_DEFUN (_gettimeofday, (ptimeval, ptimezone), - struct timeval *ptimeval, +_gettimeofday (struct timeval *ptimeval, void *ptimezone) { errno = ENOSYS; diff --git a/libgloss/libnosys/isatty.c b/libgloss/libnosys/isatty.c index d93e17702..a175bf992 100644 --- a/libgloss/libnosys/isatty.c +++ b/libgloss/libnosys/isatty.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_isatty, (file), - int file) +_isatty (int file) { errno = ENOSYS; return 0; diff --git a/libgloss/libnosys/kill.c b/libgloss/libnosys/kill.c index c58328794..27c4f8cf6 100644 --- a/libgloss/libnosys/kill.c +++ b/libgloss/libnosys/kill.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { errno = ENOSYS; diff --git a/libgloss/libnosys/link.c b/libgloss/libnosys/link.c index b27b5bca6..0bae1ef8e 100644 --- a/libgloss/libnosys/link.c +++ b/libgloss/libnosys/link.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_link, (existing, new), - char *existing, +_link (char *existing, char *new) { errno = ENOSYS; diff --git a/libgloss/libnosys/lseek.c b/libgloss/libnosys/lseek.c index f583a1461..fcc7be411 100644 --- a/libgloss/libnosys/lseek.c +++ b/libgloss/libnosys/lseek.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_lseek, (file, ptr, dir), - int file, +_lseek (int file, int ptr, int dir) { diff --git a/libgloss/libnosys/open.c b/libgloss/libnosys/open.c index ee8becedc..0c864a5ba 100644 --- a/libgloss/libnosys/open.c +++ b/libgloss/libnosys/open.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_open, (file, flags, mode), - char *file, +_open (char *file, int flags, int mode) { diff --git a/libgloss/libnosys/read.c b/libgloss/libnosys/read.c index 0ff3a9a8c..cfc281297 100644 --- a/libgloss/libnosys/read.c +++ b/libgloss/libnosys/read.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_read, (file, ptr, len), - int file, +_read (int file, char *ptr, int len) { diff --git a/libgloss/libnosys/readlink.c b/libgloss/libnosys/readlink.c index 00f3f8982..014c956f9 100644 --- a/libgloss/libnosys/readlink.c +++ b/libgloss/libnosys/readlink.c @@ -12,8 +12,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_readlink, (path, buf, bufsize), - const char *path, +_readlink (const char *path, char *buf, size_t bufsize) { diff --git a/libgloss/libnosys/stat.c b/libgloss/libnosys/stat.c index 9fa7003d1..734f67289 100644 --- a/libgloss/libnosys/stat.c +++ b/libgloss/libnosys/stat.c @@ -13,8 +13,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_stat, (file, st), - const char *file, +_stat (const char *file, struct stat *st) { errno = ENOSYS; diff --git a/libgloss/libnosys/symlink.c b/libgloss/libnosys/symlink.c index cf7a15896..bebfbba52 100644 --- a/libgloss/libnosys/symlink.c +++ b/libgloss/libnosys/symlink.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_symlink, (path1, path2), - const char *path1, +_symlink (const char *path1, const char *path2) { errno = ENOSYS; diff --git a/libgloss/libnosys/times.c b/libgloss/libnosys/times.c index f205e50f5..908cd8d12 100644 --- a/libgloss/libnosys/times.c +++ b/libgloss/libnosys/times.c @@ -12,8 +12,7 @@ extern int errno; #include "warning.h" clock_t -_DEFUN (_times, (buf), - struct tms *buf) +_times (struct tms *buf) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/unlink.c b/libgloss/libnosys/unlink.c index c543709e4..3414bf82c 100644 --- a/libgloss/libnosys/unlink.c +++ b/libgloss/libnosys/unlink.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_unlink, (name), - char *name) +_unlink (char *name) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/wait.c b/libgloss/libnosys/wait.c index 2a785be1f..029dcbcd4 100644 --- a/libgloss/libnosys/wait.c +++ b/libgloss/libnosys/wait.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_wait, (status), - int *status) +_wait (int *status) { errno = ENOSYS; return -1; diff --git a/libgloss/libnosys/write.c b/libgloss/libnosys/write.c index 0ada7702b..33d727bbf 100644 --- a/libgloss/libnosys/write.c +++ b/libgloss/libnosys/write.c @@ -11,8 +11,7 @@ extern int errno; #include "warning.h" int -_DEFUN (_write, (file, ptr, len), - int file, +_write (int file, char *ptr, int len) { diff --git a/libgloss/lm32/isatty.c b/libgloss/lm32/isatty.c index 69833fa07..d90b4df08 100644 --- a/libgloss/lm32/isatty.c +++ b/libgloss/lm32/isatty.c @@ -33,8 +33,7 @@ * other files are not. */ int -_DEFUN (_isatty, (fd), - int fd) +_isatty (int fd) { if ((fd == 0) || (fd == 1) || (fd == 2)) return 1; diff --git a/libgloss/lseek.c b/libgloss/lseek.c index 42a28d966..2fde60d8d 100644 --- a/libgloss/lseek.c +++ b/libgloss/lseek.c @@ -20,8 +20,7 @@ * lseek -- Since a serial port is non-seekable, we return an error. */ off_t -_DEFUN (lseek, (fd, offset, whence), - int fd, +lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/m68k/idp-outbyte.c b/libgloss/m68k/idp-outbyte.c index a95dc0c53..761d679f7 100644 --- a/libgloss/m68k/idp-outbyte.c +++ b/libgloss/m68k/idp-outbyte.c @@ -32,8 +32,7 @@ * to channel A. */ static void -_DEFUN (raw_outbyte, (byte), - char byte) +raw_outbyte (char byte) { /* First, wait for the UART to finish clocking out the last character we sent, if any. Then, give it the next character to @@ -64,8 +63,7 @@ _DEFUN (raw_outbyte, (byte), * latter we put in libidp.a, which is selected by idp.ld. */ void -_DEFUN (outbyte, (byte), - char byte) +outbyte (char byte) { #ifdef GDB_MONITOR_OUTPUT raw_outbyte (0x0f); diff --git a/libgloss/m68k/mc68ec.c b/libgloss/m68k/mc68ec.c index d5ee9b5fe..76e737fe7 100644 --- a/libgloss/m68k/mc68ec.c +++ b/libgloss/m68k/mc68ec.c @@ -25,8 +25,7 @@ * prompt. It can be restarted from there. */ void -_DEFUN (_exit, (status), - int_status) +_exit (int_status) { /* Use `i' constraint to get proper immediate-operand syntax for target assembler configuration. */ @@ -38,8 +37,7 @@ _DEFUN (_exit, (status), * use the timer, but I'm waiting for docs. (sigh) */ void -_DEFUN (delay, (num), - int num) +delay (int num) { while (num--) { diff --git a/libgloss/mcore/close.c b/libgloss/mcore/close.c index b94cb602a..0a9f81141 100644 --- a/libgloss/mcore/close.c +++ b/libgloss/mcore/close.c @@ -18,8 +18,7 @@ * close -- We don't need to do anything, but pretend we did. */ int -_DEFUN (_close ,(fd), - int fd) +_close (int fd) { return (0); } diff --git a/libgloss/mcore/cmb-exit.c b/libgloss/mcore/cmb-exit.c index 0e1de85f3..84703eb0d 100644 --- a/libgloss/mcore/cmb-exit.c +++ b/libgloss/mcore/cmb-exit.c @@ -18,8 +18,7 @@ * _exit -- Just cause a breakpoint so user can see why we exited. */ void -_DEFUN (_exit, (val), - int val) +_exit (int val) { while (1) { asm("bkpt"); diff --git a/libgloss/mcore/cmb-inbyte.c b/libgloss/mcore/cmb-inbyte.c index 839ffe605..9bfbbde81 100644 --- a/libgloss/mcore/cmb-inbyte.c +++ b/libgloss/mcore/cmb-inbyte.c @@ -15,8 +15,7 @@ #include <_ansi.h> int -_DEFUN (inbyte, (), - void) +inbyte (void) { return -1; diff --git a/libgloss/mcore/cmb-outbyte.c b/libgloss/mcore/cmb-outbyte.c index ea2aaef8b..ea31cc5af 100644 --- a/libgloss/mcore/cmb-outbyte.c +++ b/libgloss/mcore/cmb-outbyte.c @@ -33,8 +33,7 @@ * outbyte -- send a byte to the UART. */ void -_DEFUN (outbyte, (ch), - char ch) +outbyte (char ch) { while (!(*SRREG & TRDY)) ; diff --git a/libgloss/mcore/fstat.c b/libgloss/mcore/fstat.c index 6a2323a6e..671f56ad9 100644 --- a/libgloss/mcore/fstat.c +++ b/libgloss/mcore/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (_fstat, (fd, buf), - int fd, +_fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/mcore/getpid.c b/libgloss/mcore/getpid.c index eee2ac030..cc9e85749 100644 --- a/libgloss/mcore/getpid.c +++ b/libgloss/mcore/getpid.c @@ -18,8 +18,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (_getpid, (), - ) +_getpid (void) { return __MYPID; } diff --git a/libgloss/mcore/kill.c b/libgloss/mcore/kill.c index 8883c8ecd..833fe89d7 100644 --- a/libgloss/mcore/kill.c +++ b/libgloss/mcore/kill.c @@ -18,8 +18,7 @@ * kill -- go out via exit... */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/mcore/lseek.c b/libgloss/mcore/lseek.c index 423e11e55..dc419c753 100644 --- a/libgloss/mcore/lseek.c +++ b/libgloss/mcore/lseek.c @@ -20,8 +20,7 @@ * lseek -- Since a serial port is non-seekable, we return an error. */ off_t -_DEFUN (_lseek, (fd, offset, whence), - int fd, +_lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/mcore/open.c b/libgloss/mcore/open.c index 6b816e891..fdc1b3081 100644 --- a/libgloss/mcore/open.c +++ b/libgloss/mcore/open.c @@ -20,8 +20,7 @@ * we return an error. */ int -_DEFUN (_open, (buf, flags, mode), - const char *buf, +_open (const char *buf, int flags, int mode) { diff --git a/libgloss/mcore/print.c b/libgloss/mcore/print.c index d0d2bcef7..f5d0dba20 100644 --- a/libgloss/mcore/print.c +++ b/libgloss/mcore/print.c @@ -18,8 +18,7 @@ * print -- do a raw print of a string */ void -_DEFUN (_print, (ptr), -char *ptr) +_print (char *ptr) { while (*ptr) { outbyte (*ptr++); diff --git a/libgloss/mcore/putnum.c b/libgloss/mcore/putnum.c index 2e37c0993..10e298b95 100644 --- a/libgloss/mcore/putnum.c +++ b/libgloss/mcore/putnum.c @@ -18,8 +18,7 @@ * putnum -- print a 32 bit number in hex */ void -_DEFUN (_putnum, (num), - unsigned int num) +_putnum (unsigned int num) { char buf[9]; int cnt; diff --git a/libgloss/mcore/raise.c b/libgloss/mcore/raise.c index 6657aa649..e39207792 100644 --- a/libgloss/mcore/raise.c +++ b/libgloss/mcore/raise.c @@ -15,8 +15,7 @@ #include "glue.h" int -_DEFUN (_raise, (sig), - int sig) +_raise (int sig) { return _kill (_getpid (), sig); } diff --git a/libgloss/mcore/read.c b/libgloss/mcore/read.c index d97d98d22..d7c5670b0 100644 --- a/libgloss/mcore/read.c +++ b/libgloss/mcore/read.c @@ -21,8 +21,7 @@ extern char inbyte (void); * we only have stdin. */ int -_DEFUN (_read, (fd, buf, nbytes), - int fd, +_read (int fd, char *buf, int nbytes) { diff --git a/libgloss/mcore/stat.c b/libgloss/mcore/stat.c index d07042a51..1e16e0e53 100644 --- a/libgloss/mcore/stat.c +++ b/libgloss/mcore/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (_stat, (path, buf), - const char *path, +_stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/mcore/unlink.c b/libgloss/mcore/unlink.c index 16dda14f2..9cbcfc53c 100644 --- a/libgloss/mcore/unlink.c +++ b/libgloss/mcore/unlink.c @@ -20,8 +20,7 @@ * we just return an error. */ int -_DEFUN (_unlink, (path), - char * path) +_unlink (char * path) { errno = EIO; return (-1); diff --git a/libgloss/mcore/write.c b/libgloss/mcore/write.c index 189ea6222..87dca10a1 100644 --- a/libgloss/mcore/write.c +++ b/libgloss/mcore/write.c @@ -22,8 +22,7 @@ extern int _EXFUN (outbyte, (char x)); * open will only return an error. */ int -_DEFUN (_write, (fd, buf, nbytes), - int fd, +_write (int fd, char *buf, int nbytes) { diff --git a/libgloss/moxie/fstat.c b/libgloss/moxie/fstat.c index 38dd07b34..78dd9328e 100644 --- a/libgloss/moxie/fstat.c +++ b/libgloss/moxie/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (_fstat, (fd, buf), - int fd, +_fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/moxie/getpid.c b/libgloss/moxie/getpid.c index 957eee746..93704ceb9 100644 --- a/libgloss/moxie/getpid.c +++ b/libgloss/moxie/getpid.c @@ -18,8 +18,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (_getpid, (), - ) +_getpid (void) { return __MYPID; } diff --git a/libgloss/moxie/isatty.c b/libgloss/moxie/isatty.c index 73ade0741..f986aa725 100644 --- a/libgloss/moxie/isatty.c +++ b/libgloss/moxie/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes and return a 1. */ int -_DEFUN (_isatty, (fd), - int fd) +_isatty (int fd) { return (1); } diff --git a/libgloss/moxie/kill.c b/libgloss/moxie/kill.c index d602829ce..623f158f4 100644 --- a/libgloss/moxie/kill.c +++ b/libgloss/moxie/kill.c @@ -20,8 +20,7 @@ extern void _exit (int) __attribute__((__noreturn__)); * kill -- go out via exit... */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/moxie/print.c b/libgloss/moxie/print.c index a20743ac6..1857258cd 100644 --- a/libgloss/moxie/print.c +++ b/libgloss/moxie/print.c @@ -18,8 +18,7 @@ * print -- do a raw print of a string */ void -_DEFUN (_print, (ptr), -char *ptr) +_print (char *ptr) { while (*ptr) { outbyte (*ptr++); diff --git a/libgloss/moxie/putnum.c b/libgloss/moxie/putnum.c index f5bac1f2b..0f7e89453 100644 --- a/libgloss/moxie/putnum.c +++ b/libgloss/moxie/putnum.c @@ -18,8 +18,7 @@ * putnum -- print a 32 bit number in hex */ void -_DEFUN (_putnum, (num), - unsigned int num) +_putnum (unsigned int num) { char buf[9]; int cnt; diff --git a/libgloss/moxie/qemu-time.c b/libgloss/moxie/qemu-time.c index 1abd5a9f7..0049c24ee 100644 --- a/libgloss/moxie/qemu-time.c +++ b/libgloss/moxie/qemu-time.c @@ -40,8 +40,7 @@ * _times -- FIXME */ int -_DEFUN (_times, _times (buf), - struct tms *buf) +_times (struct tms *buf) { errno = EINVAL; return (-1); @@ -70,8 +69,7 @@ rtc_write (unsigned char reg, unsigned char val) * time -- return current time in seconds. */ time_t -_DEFUN (time, time (t), - time_t *t) +time (time_t *t) { struct tm tm; time_t ret; @@ -100,8 +98,7 @@ _DEFUN (time, time (t), * return the microseconds. */ int -_DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv, +_gettimeofday (struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/moxie/sim-lseek.S b/libgloss/moxie/sim-lseek.S index 5e5493cd7..86fb67504 100644 --- a/libgloss/moxie/sim-lseek.S +++ b/libgloss/moxie/sim-lseek.S @@ -22,8 +22,7 @@ * an error. */ off_t -_DEFUN (_lseek, (fd, offset, whence), - int fd, +_lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/moxie/sim-lseek.c b/libgloss/moxie/sim-lseek.c index d22d7226c..dacd769af 100644 --- a/libgloss/moxie/sim-lseek.c +++ b/libgloss/moxie/sim-lseek.c @@ -22,8 +22,7 @@ * an error. */ off_t -_DEFUN (_lseek, (fd, offset, whence), - int fd, +_lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/moxie/sim-time.c b/libgloss/moxie/sim-time.c index d3f43d385..53793bfe1 100644 --- a/libgloss/moxie/sim-time.c +++ b/libgloss/moxie/sim-time.c @@ -37,8 +37,7 @@ extern time_t _sim_time (void) __asm__("_sim_time"); * time -- return current time in seconds. */ time_t -_DEFUN (time, time (t), - time_t *t) +time (time_t *t) { time_t ret = _sim_time (); @@ -52,8 +51,7 @@ _DEFUN (time, time (t), * _times -- no clock, so return an error. */ int -_DEFUN (_times, _times (buf), - struct tms *buf) +_times (struct tms *buf) { errno = EINVAL; return (-1); @@ -64,8 +62,7 @@ _DEFUN (_times, _times (buf), * microseconds. */ int -_DEFUN (_gettimeofday, _gettimeofday (tv, tz), - struct timeval *tv, +_gettimeofday (struct timeval *tv, void *tzvp) { struct timezone *tz = tzvp; diff --git a/libgloss/moxie/stat.c b/libgloss/moxie/stat.c index 01a958210..c80e8d347 100644 --- a/libgloss/moxie/stat.c +++ b/libgloss/moxie/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (_stat, (path, buf), - const char *path, +_stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/open.c b/libgloss/open.c index 90787b1b9..a0eb1717b 100644 --- a/libgloss/open.c +++ b/libgloss/open.c @@ -20,8 +20,7 @@ * we return an error. */ int -_DEFUN (open, (buf, flags, mode), - const char *buf, +open (const char *buf, int flags, int mode) { diff --git a/libgloss/print.c b/libgloss/print.c index 8f78ff2af..76d543b67 100644 --- a/libgloss/print.c +++ b/libgloss/print.c @@ -18,8 +18,7 @@ * print -- do a raw print of a string */ void -_DEFUN (print, (ptr), -char *ptr) +print (char *ptr) { while (*ptr) { outbyte (*ptr++); diff --git a/libgloss/putnum.c b/libgloss/putnum.c index 842e10f07..c368c4136 100644 --- a/libgloss/putnum.c +++ b/libgloss/putnum.c @@ -18,8 +18,7 @@ * putnum -- print a 32 bit number in hex */ void -_DEFUN (putnum, (num), - unsigned int num) +putnum (unsigned int num) { char buf[9]; int cnt; diff --git a/libgloss/read.c b/libgloss/read.c index 507c9802f..24108ce0d 100644 --- a/libgloss/read.c +++ b/libgloss/read.c @@ -21,8 +21,7 @@ extern char inbyte (void); * we only have stdin. */ int -_DEFUN (read, (fd, buf, nbytes), - int fd, +read (int fd, char *buf, int nbytes) { diff --git a/libgloss/spu/getpid.c b/libgloss/spu/getpid.c index ff2d82028..89361720f 100644 --- a/libgloss/spu/getpid.c +++ b/libgloss/spu/getpid.c @@ -31,7 +31,7 @@ Author: Andreas Neukoetter (ti95neuk@de.ibm.com) */ int -getpid () +getpid (void) { return (1); } diff --git a/libgloss/stat.c b/libgloss/stat.c index 5957645c6..4d6312830 100644 --- a/libgloss/stat.c +++ b/libgloss/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (stat, (path, buf), - const char *path, +stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/tic6x/getpid.c b/libgloss/tic6x/getpid.c index 3c1a7b8b8..912ca18a5 100644 --- a/libgloss/tic6x/getpid.c +++ b/libgloss/tic6x/getpid.c @@ -19,8 +19,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (getpid, (), - ) +getpid (void) { return __MYPID; } diff --git a/libgloss/tic6x/kill.c b/libgloss/tic6x/kill.c index db5018cfc..98cd3c40e 100644 --- a/libgloss/tic6x/kill.c +++ b/libgloss/tic6x/kill.c @@ -19,8 +19,7 @@ * kill -- go out via exit... */ int -_DEFUN (kill, (pid, sig), - int pid, +kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/unlink.c b/libgloss/unlink.c index 15ea7e8a9..76c1a4fef 100644 --- a/libgloss/unlink.c +++ b/libgloss/unlink.c @@ -20,8 +20,7 @@ * we just return an error. */ int -_DEFUN (unlink, (path), - char * path) +unlink (char * path) { errno = EIO; return (-1); diff --git a/libgloss/write.c b/libgloss/write.c index 69f452c34..4b25cfce7 100644 --- a/libgloss/write.c +++ b/libgloss/write.c @@ -22,8 +22,7 @@ extern int _EXFUN (outbyte, (char x)); * open will only return an error. */ int -_DEFUN (write, (fd, buf, nbytes), - int fd, +write (int fd, char *buf, int nbytes) { diff --git a/libgloss/xc16x/misc.c b/libgloss/xc16x/misc.c index 2eb951a5a..d96550129 100644 --- a/libgloss/xc16x/misc.c +++ b/libgloss/xc16x/misc.c @@ -17,21 +17,19 @@ /* _raise(), getpid(), and kill() are required by abort(). getpid/kill are prefixed with '_' because of MISSING_SYSCALL_NAMES. */ -int _DEFUN(_raise,(sig), - int sig) +int _raise (int sig) { errno = ENOSYS; return -1; } -int _DEFUN(_getpid,(),) +int _getpid (void) { errno = ENOSYS; return -1; } -int _DEFUN(_kill,(pid, sig), - int pid, +int _kill (int pid, int sig) { errno = ENOSYS; diff --git a/libgloss/xstormy16/close.c b/libgloss/xstormy16/close.c index 5fcfbf576..2b50e6432 100644 --- a/libgloss/xstormy16/close.c +++ b/libgloss/xstormy16/close.c @@ -18,8 +18,7 @@ * close -- We don't need to do anything, but pretend we did. */ int -_DEFUN (_close ,(fd), - int fd) +_close (int fd) { return (0); } diff --git a/libgloss/xstormy16/fstat.c b/libgloss/xstormy16/fstat.c index 2926ccaab..b962036f3 100644 --- a/libgloss/xstormy16/fstat.c +++ b/libgloss/xstormy16/fstat.c @@ -19,8 +19,7 @@ * fstat -- Since we have no file system, we just return an error. */ int -_DEFUN (_fstat, (fd, buf), - int fd, +_fstat (int fd, struct stat *buf) { buf->st_mode = S_IFCHR; /* Always pretend to be a tty */ diff --git a/libgloss/xstormy16/getpid.c b/libgloss/xstormy16/getpid.c index 0f081a11d..e49fde4a0 100644 --- a/libgloss/xstormy16/getpid.c +++ b/libgloss/xstormy16/getpid.c @@ -18,8 +18,7 @@ * getpid -- only one process, so just return 1. */ int -_DEFUN (_getpid, (), - ) +_getpid (void) { return __MYPID; } diff --git a/libgloss/xstormy16/isatty.c b/libgloss/xstormy16/isatty.c index 0e92a9f4f..f7d8fa098 100644 --- a/libgloss/xstormy16/isatty.c +++ b/libgloss/xstormy16/isatty.c @@ -20,8 +20,7 @@ * serial port, we'll say yes and return a 1. */ int -_DEFUN (_isatty, (fd), - int fd) +_isatty (int fd) { return (1); } diff --git a/libgloss/xstormy16/kill.c b/libgloss/xstormy16/kill.c index 2374dc29d..f5ccd2191 100644 --- a/libgloss/xstormy16/kill.c +++ b/libgloss/xstormy16/kill.c @@ -18,8 +18,7 @@ * kill -- go out via exit... */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if(pid == __MYPID) diff --git a/libgloss/xstormy16/lseek.c b/libgloss/xstormy16/lseek.c index 11dbab08e..c00665723 100644 --- a/libgloss/xstormy16/lseek.c +++ b/libgloss/xstormy16/lseek.c @@ -20,8 +20,7 @@ * lseek -- Since a serial port is non-seekable, we return an error. */ off_t -_DEFUN (_lseek, (fd, offset, whence), - int fd, +_lseek (int fd, off_t offset, int whence) { diff --git a/libgloss/xstormy16/open.c b/libgloss/xstormy16/open.c index 600f92982..f96484c7b 100644 --- a/libgloss/xstormy16/open.c +++ b/libgloss/xstormy16/open.c @@ -20,8 +20,7 @@ * we return an error. */ int -_DEFUN (_open, (buf, flags, mode), - const char *buf, +_open (const char *buf, int flags, int mode) { diff --git a/libgloss/xstormy16/stat.c b/libgloss/xstormy16/stat.c index b80b83c6c..7d089edfa 100644 --- a/libgloss/xstormy16/stat.c +++ b/libgloss/xstormy16/stat.c @@ -20,8 +20,7 @@ * stat -- Since we have no file system, we just return an error. */ int -_DEFUN (_stat, (path, buf), - const char *path, +_stat (const char *path, struct stat *buf) { errno = EIO; diff --git a/libgloss/xstormy16/unlink.c b/libgloss/xstormy16/unlink.c index 1c56663ea..10180ac9b 100644 --- a/libgloss/xstormy16/unlink.c +++ b/libgloss/xstormy16/unlink.c @@ -20,8 +20,7 @@ * we just return an error. */ int -_DEFUN (_unlink, (path), - char * path) +_unlink (char * path) { errno = EIO; return (-1); diff --git a/newlib/libc/argz/argz_add.c b/newlib/libc/argz/argz_add.c index 3194f0851..a1a8d3d0e 100644 --- a/newlib/libc/argz/argz_add.c +++ b/newlib/libc/argz/argz_add.c @@ -11,8 +11,7 @@ #include error_t -_DEFUN (argz_add, (argz, argz_len, str), - char **argz, +argz_add (char **argz, size_t *argz_len, const char *str) { diff --git a/newlib/libc/argz/argz_add_sep.c b/newlib/libc/argz/argz_add_sep.c index 92c73716d..f2964e672 100644 --- a/newlib/libc/argz/argz_add_sep.c +++ b/newlib/libc/argz/argz_add_sep.c @@ -11,8 +11,7 @@ #include error_t -_DEFUN (argz_add_sep, (argz, argz_len, str, sep), - char **argz, +argz_add_sep (char **argz, size_t *argz_len, const char *str, int sep) diff --git a/newlib/libc/argz/argz_append.c b/newlib/libc/argz/argz_append.c index a84f8e0b9..de0cc82ce 100644 --- a/newlib/libc/argz/argz_append.c +++ b/newlib/libc/argz/argz_append.c @@ -11,8 +11,7 @@ #include error_t -_DEFUN (argz_append, (argz, argz_len, buf, buf_len), - char **argz, +argz_append (char **argz, size_t *argz_len, const char *buf, size_t buf_len) diff --git a/newlib/libc/argz/argz_count.c b/newlib/libc/argz/argz_count.c index 33d0eecc2..4c0007ce2 100644 --- a/newlib/libc/argz/argz_count.c +++ b/newlib/libc/argz/argz_count.c @@ -10,8 +10,7 @@ #include size_t -_DEFUN (argz_count, (argz, argz_len), - const char *argz, +argz_count (const char *argz, size_t argz_len) { int i; diff --git a/newlib/libc/argz/argz_create.c b/newlib/libc/argz/argz_create.c index d4b8b0592..4ab622d28 100644 --- a/newlib/libc/argz/argz_create.c +++ b/newlib/libc/argz/argz_create.c @@ -11,8 +11,7 @@ #include error_t -_DEFUN (argz_create, (argv, argz, argz_len), - char *const argv[], +argz_create (char *const argv[], char **argz, size_t *argz_len) { diff --git a/newlib/libc/argz/argz_create_sep.c b/newlib/libc/argz/argz_create_sep.c index afff44c1e..bf578e6bb 100644 --- a/newlib/libc/argz/argz_create_sep.c +++ b/newlib/libc/argz/argz_create_sep.c @@ -11,8 +11,7 @@ #include error_t -_DEFUN (argz_create_sep, (string, sep, argz, argz_len), - const char *string, +argz_create_sep (const char *string, int sep, char **argz, size_t *argz_len) diff --git a/newlib/libc/argz/argz_delete.c b/newlib/libc/argz/argz_delete.c index a4e12273d..aa1fe4c75 100644 --- a/newlib/libc/argz/argz_delete.c +++ b/newlib/libc/argz/argz_delete.c @@ -11,8 +11,7 @@ #include error_t -_DEFUN (argz_delete, (argz, argz_len, entry), - char **argz, +argz_delete (char **argz, size_t *argz_len, char *entry) { diff --git a/newlib/libc/argz/argz_extract.c b/newlib/libc/argz/argz_extract.c index 4932de6a9..e97b76905 100644 --- a/newlib/libc/argz/argz_extract.c +++ b/newlib/libc/argz/argz_extract.c @@ -9,8 +9,7 @@ #include void -_DEFUN (argz_extract, (argz, argz_len, argv), - char *argz, +argz_extract (char *argz, size_t argz_len, char **argv) { diff --git a/newlib/libc/argz/argz_insert.c b/newlib/libc/argz/argz_insert.c index 5965e04a6..abdfeb0ea 100644 --- a/newlib/libc/argz/argz_insert.c +++ b/newlib/libc/argz/argz_insert.c @@ -13,8 +13,7 @@ #include error_t -_DEFUN (argz_insert, (argz, argz_len, before, entry), - char **argz, +argz_insert (char **argz, size_t *argz_len, char *before, const char *entry) diff --git a/newlib/libc/argz/argz_next.c b/newlib/libc/argz/argz_next.c index 3f672217e..0d6f21d70 100644 --- a/newlib/libc/argz/argz_next.c +++ b/newlib/libc/argz/argz_next.c @@ -11,8 +11,7 @@ #include char * -_DEFUN (argz_next, (argz, argz_len, entry), - char *argz, +argz_next (char *argz, size_t argz_len, const char *entry) { diff --git a/newlib/libc/argz/argz_replace.c b/newlib/libc/argz/argz_replace.c index e6c6ead3e..f2e0d52b7 100644 --- a/newlib/libc/argz/argz_replace.c +++ b/newlib/libc/argz/argz_replace.c @@ -13,8 +13,7 @@ #include "buf_findstr.h" error_t -_DEFUN (argz_replace, (argz, argz_len, str, with, replace_count), - char **argz, +argz_replace (char **argz, size_t *argz_len, const char *str, const char *with, diff --git a/newlib/libc/argz/argz_stringify.c b/newlib/libc/argz/argz_stringify.c index 72895f5e7..98f6c9bc2 100644 --- a/newlib/libc/argz/argz_stringify.c +++ b/newlib/libc/argz/argz_stringify.c @@ -10,8 +10,7 @@ #include void -_DEFUN (argz_stringify, (argz, argz_len, sep), - char *argz, +argz_stringify (char *argz, size_t argz_len, int sep) { diff --git a/newlib/libc/argz/envz_add.c b/newlib/libc/argz/envz_add.c index f01d09926..60ecf17bc 100644 --- a/newlib/libc/argz/envz_add.c +++ b/newlib/libc/argz/envz_add.c @@ -12,8 +12,7 @@ #include error_t -_DEFUN (envz_add, (envz, envz_len, name, value), - char **envz, +envz_add (char **envz, size_t *envz_len, const char *name, const char *value) diff --git a/newlib/libc/argz/envz_entry.c b/newlib/libc/argz/envz_entry.c index bbe38529e..869c332ad 100644 --- a/newlib/libc/argz/envz_entry.c +++ b/newlib/libc/argz/envz_entry.c @@ -13,8 +13,7 @@ #include "buf_findstr.h" char * -_DEFUN (envz_entry, (envz, envz_len, name), - const char *envz, +envz_entry (const char *envz, size_t envz_len, const char *name) { diff --git a/newlib/libc/argz/envz_get.c b/newlib/libc/argz/envz_get.c index 62d3d0cff..9863642c7 100644 --- a/newlib/libc/argz/envz_get.c +++ b/newlib/libc/argz/envz_get.c @@ -13,8 +13,7 @@ #include "buf_findstr.h" char * -_DEFUN (envz_get, (envz, envz_len, name), - const char *envz, +envz_get (const char *envz, size_t envz_len, const char *name) { diff --git a/newlib/libc/argz/envz_merge.c b/newlib/libc/argz/envz_merge.c index 9299069e4..3be7c1fbc 100644 --- a/newlib/libc/argz/envz_merge.c +++ b/newlib/libc/argz/envz_merge.c @@ -12,8 +12,7 @@ #include error_t -_DEFUN (envz_merge, (envz, envz_len, envz2, envz2_len, override), - char **envz, +envz_merge (char **envz, size_t *envz_len, const char *envz2, size_t envz2_len, diff --git a/newlib/libc/argz/envz_remove.c b/newlib/libc/argz/envz_remove.c index 2558656aa..8fc9e8f16 100644 --- a/newlib/libc/argz/envz_remove.c +++ b/newlib/libc/argz/envz_remove.c @@ -12,8 +12,7 @@ #include void -_DEFUN (envz_remove, (envz, envz_len, name), - char **envz, +envz_remove (char **envz, size_t *envz_len, const char *name) { diff --git a/newlib/libc/argz/envz_strip.c b/newlib/libc/argz/envz_strip.c index 857f8492e..8efa5cbb5 100644 --- a/newlib/libc/argz/envz_strip.c +++ b/newlib/libc/argz/envz_strip.c @@ -12,8 +12,7 @@ #include void -_DEFUN (envz_strip, (envz, envz_len), - char **envz, +envz_strip (char **envz, size_t *envz_len) { char *entry = 0; diff --git a/newlib/libc/ctype/isalnum.c b/newlib/libc/ctype/isalnum.c index ebb414c69..d926f97b7 100644 --- a/newlib/libc/ctype/isalnum.c +++ b/newlib/libc/ctype/isalnum.c @@ -44,7 +44,7 @@ No OS subroutines are required. #undef isalnum int -_DEFUN(isalnum,(c),int c) +isalnum (int c) { return(__CTYPE_PTR[c+1] & (_U|_L|_N)); } diff --git a/newlib/libc/ctype/isalpha.c b/newlib/libc/ctype/isalpha.c index 7a737a527..8b8e78a29 100644 --- a/newlib/libc/ctype/isalpha.c +++ b/newlib/libc/ctype/isalpha.c @@ -43,7 +43,7 @@ No supporting OS subroutines are required. #undef isalpha int -_DEFUN(isalpha,(c),int c) +isalpha (int c) { return(__CTYPE_PTR[c+1] & (_U|_L)); } diff --git a/newlib/libc/ctype/isascii.c b/newlib/libc/ctype/isascii.c index 71f299fa0..5adb81222 100644 --- a/newlib/libc/ctype/isascii.c +++ b/newlib/libc/ctype/isascii.c @@ -44,7 +44,7 @@ No supporting OS subroutines are required. #undef isascii int -_DEFUN(isascii,(c),int c) +isascii (int c) { return c >= 0 && c< 128; } diff --git a/newlib/libc/ctype/isblank.c b/newlib/libc/ctype/isblank.c index e054b947c..0ebc2192c 100644 --- a/newlib/libc/ctype/isblank.c +++ b/newlib/libc/ctype/isblank.c @@ -42,7 +42,7 @@ No supporting OS subroutines are required. #undef isblank int -_DEFUN(isblank,(c),int c) +isblank (int c) { return ((__CTYPE_PTR[c+1] & _B) || (c == '\t')); } diff --git a/newlib/libc/ctype/iscntrl.c b/newlib/libc/ctype/iscntrl.c index b57b71790..ebbdd7371 100644 --- a/newlib/libc/ctype/iscntrl.c +++ b/newlib/libc/ctype/iscntrl.c @@ -46,7 +46,7 @@ No supporting OS subroutines are required. #undef iscntrl int -_DEFUN(iscntrl,(c),int c) +iscntrl (int c) { return(__CTYPE_PTR[c+1] & _C); } diff --git a/newlib/libc/ctype/isdigit.c b/newlib/libc/ctype/isdigit.c index 5cd411b65..a5c511964 100644 --- a/newlib/libc/ctype/isdigit.c +++ b/newlib/libc/ctype/isdigit.c @@ -45,7 +45,7 @@ No supporting OS subroutines are required. #undef isdigit int -_DEFUN(isdigit,(c),int c) +isdigit (int c) { return(__CTYPE_PTR[c+1] & _N); } diff --git a/newlib/libc/ctype/islower.c b/newlib/libc/ctype/islower.c index a6fb889a1..2b3440489 100644 --- a/newlib/libc/ctype/islower.c +++ b/newlib/libc/ctype/islower.c @@ -43,7 +43,7 @@ No supporting OS subroutines are required. #undef islower int -_DEFUN(islower,(c),int c) +islower (int c) { return ((__CTYPE_PTR[c+1] & (_U|_L)) == _L); } diff --git a/newlib/libc/ctype/isprint.c b/newlib/libc/ctype/isprint.c index afabe8b1d..e34fbe28a 100644 --- a/newlib/libc/ctype/isprint.c +++ b/newlib/libc/ctype/isprint.c @@ -57,7 +57,7 @@ No supporting OS subroutines are required. #undef isgraph int -_DEFUN(isgraph,(c),int c) +isgraph (int c) { return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N)); } @@ -65,7 +65,7 @@ _DEFUN(isgraph,(c),int c) #undef isprint int -_DEFUN(isprint,(c),int c) +isprint (int c) { return(__CTYPE_PTR[c+1] & (_P|_U|_L|_N|_B)); } diff --git a/newlib/libc/ctype/ispunct.c b/newlib/libc/ctype/ispunct.c index 83796dc1c..9c5a3fcca 100644 --- a/newlib/libc/ctype/ispunct.c +++ b/newlib/libc/ctype/ispunct.c @@ -45,7 +45,7 @@ No supporting OS subroutines are required. #undef ispunct int -_DEFUN(ispunct,(c),int c) +ispunct (int c) { return(__CTYPE_PTR[c+1] & _P); } diff --git a/newlib/libc/ctype/isspace.c b/newlib/libc/ctype/isspace.c index 68dc5cb1d..0def2c0ce 100644 --- a/newlib/libc/ctype/isspace.c +++ b/newlib/libc/ctype/isspace.c @@ -44,7 +44,7 @@ No supporting OS subroutines are required. #undef isspace int -_DEFUN(isspace,(c),int c) +isspace (int c) { return(__CTYPE_PTR[c+1] & _S); } diff --git a/newlib/libc/ctype/isupper.c b/newlib/libc/ctype/isupper.c index 10fa230bd..aeed383ec 100644 --- a/newlib/libc/ctype/isupper.c +++ b/newlib/libc/ctype/isupper.c @@ -41,7 +41,7 @@ No supporting OS subroutines are required. #undef isupper int -_DEFUN(isupper,(c),int c) +isupper (int c) { return ((__CTYPE_PTR[c+1] & (_U|_L)) == _U); } diff --git a/newlib/libc/ctype/iswalnum.c b/newlib/libc/ctype/iswalnum.c index d9295434d..45273a8b2 100644 --- a/newlib/libc/ctype/iswalnum.c +++ b/newlib/libc/ctype/iswalnum.c @@ -37,7 +37,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(iswalnum,(c),wint_t c) +iswalnum (wint_t c) { return (iswalpha (c) || iswdigit (c)); } diff --git a/newlib/libc/ctype/iswalpha.c b/newlib/libc/ctype/iswalpha.c index 973aa09b4..2906cd12a 100644 --- a/newlib/libc/ctype/iswalpha.c +++ b/newlib/libc/ctype/iswalpha.c @@ -74,7 +74,7 @@ No supporting OS subroutines are required. #endif /* _MB_CAPABLE */ int -_DEFUN(iswalpha,(c), wint_t c) +iswalpha (wint_t c) { #ifdef _MB_CAPABLE unsigned const char *table; diff --git a/newlib/libc/ctype/iswblank.c b/newlib/libc/ctype/iswblank.c index b83683d94..ef91572cd 100644 --- a/newlib/libc/ctype/iswblank.c +++ b/newlib/libc/ctype/iswblank.c @@ -69,7 +69,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(iswblank,(c), wint_t c) +iswblank (wint_t c) { #ifdef _MB_CAPABLE c = _jp2uc (c); diff --git a/newlib/libc/ctype/iswcntrl.c b/newlib/libc/ctype/iswcntrl.c index c96ed343a..249a0a811 100644 --- a/newlib/libc/ctype/iswcntrl.c +++ b/newlib/libc/ctype/iswcntrl.c @@ -69,7 +69,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(iswcntrl,(c), wint_t c) +iswcntrl (wint_t c) { #ifdef _MB_CAPABLE c = _jp2uc (c); diff --git a/newlib/libc/ctype/iswctype.c b/newlib/libc/ctype/iswctype.c index 89c0f9a31..027cb8ae3 100644 --- a/newlib/libc/ctype/iswctype.c +++ b/newlib/libc/ctype/iswctype.c @@ -38,7 +38,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(iswctype,(c, desc), wint_t c, wctype_t desc) +iswctype (wint_t c, wctype_t desc) { switch (desc) { diff --git a/newlib/libc/ctype/iswdigit.c b/newlib/libc/ctype/iswdigit.c index 7926f8dc2..2b2614135 100644 --- a/newlib/libc/ctype/iswdigit.c +++ b/newlib/libc/ctype/iswdigit.c @@ -36,7 +36,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(iswdigit,(c), wint_t c) +iswdigit (wint_t c) { return (c >= (wint_t)'0' && c <= (wint_t)'9'); } diff --git a/newlib/libc/ctype/iswgraph.c b/newlib/libc/ctype/iswgraph.c index 90e1f97fa..e0df4aa3f 100644 --- a/newlib/libc/ctype/iswgraph.c +++ b/newlib/libc/ctype/iswgraph.c @@ -65,7 +65,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(iswgraph,(c),wint_t c) +iswgraph (wint_t c) { return (iswprint (c) && !iswspace (c)); } diff --git a/newlib/libc/ctype/iswlower.c b/newlib/libc/ctype/iswlower.c index 19cfdc420..8b38835f3 100644 --- a/newlib/libc/ctype/iswlower.c +++ b/newlib/libc/ctype/iswlower.c @@ -36,7 +36,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(iswlower,(c),wint_t c) +iswlower (wint_t c) { return (towupper (c) != c); } diff --git a/newlib/libc/ctype/iswprint.c b/newlib/libc/ctype/iswprint.c index 51a50019b..c6050b502 100644 --- a/newlib/libc/ctype/iswprint.c +++ b/newlib/libc/ctype/iswprint.c @@ -73,7 +73,7 @@ No supporting OS subroutines are required. #endif /* _MB_CAPABLE */ int -_DEFUN(iswprint,(c), wint_t c) +iswprint (wint_t c) { #ifdef _MB_CAPABLE unsigned const char *table; diff --git a/newlib/libc/ctype/iswpunct.c b/newlib/libc/ctype/iswpunct.c index b1069a202..8ab703846 100644 --- a/newlib/libc/ctype/iswpunct.c +++ b/newlib/libc/ctype/iswpunct.c @@ -69,7 +69,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(iswpunct,(c), wint_t c) +iswpunct (wint_t c) { return (!iswalnum (c) && iswgraph (c)); } diff --git a/newlib/libc/ctype/iswspace.c b/newlib/libc/ctype/iswspace.c index d6ba3e97d..ae3841aa5 100644 --- a/newlib/libc/ctype/iswspace.c +++ b/newlib/libc/ctype/iswspace.c @@ -69,7 +69,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(iswspace,(c), wint_t c) +iswspace (wint_t c) { #ifdef _MB_CAPABLE c = _jp2uc (c); diff --git a/newlib/libc/ctype/iswupper.c b/newlib/libc/ctype/iswupper.c index 49f009346..c4969a3ec 100644 --- a/newlib/libc/ctype/iswupper.c +++ b/newlib/libc/ctype/iswupper.c @@ -36,7 +36,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(iswupper,(c),wint_t c) +iswupper (wint_t c) { return (towlower (c) != c); } diff --git a/newlib/libc/ctype/iswxdigit.c b/newlib/libc/ctype/iswxdigit.c index 3f47962f1..436718642 100644 --- a/newlib/libc/ctype/iswxdigit.c +++ b/newlib/libc/ctype/iswxdigit.c @@ -36,7 +36,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(iswxdigit,(c), wint_t c) +iswxdigit (wint_t c) { return ((c >= (wint_t)'0' && c <= (wint_t)'9') || (c >= (wint_t)'a' && c <= (wint_t)'f') || diff --git a/newlib/libc/ctype/isxdigit.c b/newlib/libc/ctype/isxdigit.c index f5e858c94..2bfe18dbf 100644 --- a/newlib/libc/ctype/isxdigit.c +++ b/newlib/libc/ctype/isxdigit.c @@ -44,7 +44,7 @@ No supporting OS subroutines are required. #undef isxdigit int -_DEFUN(isxdigit,(c),int c) +isxdigit (int c) { return(__CTYPE_PTR[c+1] & ((_X)|(_N))); } diff --git a/newlib/libc/ctype/jp2uc.c b/newlib/libc/ctype/jp2uc.c index 8fbd1b083..29eec0ff5 100644 --- a/newlib/libc/ctype/jp2uc.c +++ b/newlib/libc/ctype/jp2uc.c @@ -48,7 +48,7 @@ #define JP_EUCJP 3 static wint_t -_DEFUN (__jp2uc, (c, type), wint_t c, int type) +__jp2uc (wint_t c, int type) { int index, adj; unsigned char byte1, byte2; @@ -152,7 +152,7 @@ _DEFUN (__jp2uc, (c, type), wint_t c, int type) } wint_t -_DEFUN (_jp2uc, (c), wint_t c) +_jp2uc (wint_t c) { if (!strcmp (__current_locale_charset (), "JIS")) c = __jp2uc (c, JP_JIS); diff --git a/newlib/libc/ctype/toascii.c b/newlib/libc/ctype/toascii.c index 450e231a3..de5b8e1c3 100644 --- a/newlib/libc/ctype/toascii.c +++ b/newlib/libc/ctype/toascii.c @@ -41,7 +41,7 @@ No supporting OS subroutines are required. #undef toascii int -_DEFUN(toascii,(c),int c) +toascii (int c) { return (c)&0177; } diff --git a/newlib/libc/ctype/tolower.c b/newlib/libc/ctype/tolower.c index 5ebd3cd96..aae2ce09e 100644 --- a/newlib/libc/ctype/tolower.c +++ b/newlib/libc/ctype/tolower.c @@ -62,7 +62,7 @@ No supporting OS subroutines are required. #undef tolower int -_DEFUN(tolower,(c),int c) +tolower (int c) { #if defined (_MB_EXTENDED_CHARSETS_ISO) || defined (_MB_EXTENDED_CHARSETS_WINDOWS) if ((unsigned char) c <= 0x7f) diff --git a/newlib/libc/ctype/toupper.c b/newlib/libc/ctype/toupper.c index d9089a95b..61951b00b 100644 --- a/newlib/libc/ctype/toupper.c +++ b/newlib/libc/ctype/toupper.c @@ -62,7 +62,7 @@ No supporting OS subroutines are required. #undef toupper int -_DEFUN(toupper,(c),int c) +toupper (int c) { #if defined (_MB_EXTENDED_CHARSETS_ISO) || defined (_MB_EXTENDED_CHARSETS_WINDOWS) if ((unsigned char) c <= 0x7f) diff --git a/newlib/libc/ctype/towctrans.c b/newlib/libc/ctype/towctrans.c index 3500cbaac..edbdfce41 100644 --- a/newlib/libc/ctype/towctrans.c +++ b/newlib/libc/ctype/towctrans.c @@ -76,8 +76,7 @@ No supporting OS subroutines are required. #include "local.h" wint_t -_DEFUN (_towctrans_r, (r, c, w), - struct _reent *r, +_towctrans_r (struct _reent *r, wint_t c, wctrans_t w) { @@ -94,8 +93,7 @@ _DEFUN (_towctrans_r, (r, c, w), #ifndef _REENT_ONLY wint_t -_DEFUN (towctrans, (c, w), - wint_t c, +towctrans (wint_t c, wctrans_t w) { return _towctrans_r (_REENT, c, w); diff --git a/newlib/libc/ctype/towlower.c b/newlib/libc/ctype/towlower.c index 4485fdef4..db390dbdf 100644 --- a/newlib/libc/ctype/towlower.c +++ b/newlib/libc/ctype/towlower.c @@ -73,7 +73,7 @@ No supporting OS subroutines are required. #include "local.h" wint_t -_DEFUN(towlower,(c), wint_t c) +towlower (wint_t c) { #ifdef _MB_CAPABLE c = _jp2uc (c); diff --git a/newlib/libc/ctype/towupper.c b/newlib/libc/ctype/towupper.c index 06d12ea99..306f72bd5 100644 --- a/newlib/libc/ctype/towupper.c +++ b/newlib/libc/ctype/towupper.c @@ -73,7 +73,7 @@ No supporting OS subroutines are required. #include "local.h" wint_t -_DEFUN(towupper,(c), wint_t c) +towupper (wint_t c) { #ifdef _MB_CAPABLE c = _jp2uc (c); diff --git a/newlib/libc/ctype/wctrans.c b/newlib/libc/ctype/wctrans.c index 7183c45ca..4a58df152 100644 --- a/newlib/libc/ctype/wctrans.c +++ b/newlib/libc/ctype/wctrans.c @@ -75,8 +75,7 @@ No supporting OS subroutines are required. #include "local.h" wctrans_t -_DEFUN (_wctrans_r, (r, c), - struct _reent *r, +_wctrans_r (struct _reent *r, const char *c) { if (!strcmp (c, "tolower")) @@ -92,8 +91,7 @@ _DEFUN (_wctrans_r, (r, c), #ifndef _REENT_ONLY wctrans_t -_DEFUN (wctrans, (c), - const char *c) +wctrans (const char *c) { return _wctrans_r (_REENT, c); } diff --git a/newlib/libc/ctype/wctype.c b/newlib/libc/ctype/wctype.c index 6cd9425bc..5f2ae7a25 100644 --- a/newlib/libc/ctype/wctype.c +++ b/newlib/libc/ctype/wctype.c @@ -76,8 +76,7 @@ No supporting OS subroutines are required. #include "local.h" wctype_t -_DEFUN (_wctype_r, (r, c), - struct _reent *r, +_wctype_r (struct _reent *r, const char *c) { switch (*c) @@ -135,8 +134,7 @@ _DEFUN (_wctype_r, (r, c), #ifndef _REENT_ONLY wctype_t -_DEFUN (wctype, (c), - const char *c) +wctype (const char *c) { return _wctype_r (_REENT, c); } diff --git a/newlib/libc/iconv/ces/euc.c b/newlib/libc/iconv/ces/euc.c index fb0a50e90..29d36f941 100644 --- a/newlib/libc/iconv/ces/euc.c +++ b/newlib/libc/iconv/ces/euc.c @@ -101,8 +101,7 @@ static euc_cs_desc_t euc_kr_cs_desc [] = #if defined (ICONV_FROM_UCS_CES_EUC) static void * -_DEFUN(euc_from_ucs_init, (rptr, encoding), - struct _reent *rptr, +euc_from_ucs_init (struct _reent *rptr, const char *encoding) { int i; @@ -165,8 +164,7 @@ error1: } static size_t -_DEFUN(euc_from_ucs_close, (rptr, data), - struct _reent *rptr, +euc_from_ucs_close (struct _reent *rptr, void *data) { int i; @@ -185,8 +183,7 @@ _DEFUN(euc_from_ucs_close, (rptr, data), } static size_t -_DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +euc_convert_from_ucs (void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -261,8 +258,7 @@ _DEFUN(euc_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_EUC) static void * -_DEFUN(euc_to_ucs_init, (rptr, encoding), - struct _reent *rptr, +euc_to_ucs_init (struct _reent *rptr, const char *encoding) { int i; @@ -325,8 +321,7 @@ error1: } static size_t -_DEFUN(euc_to_ucs_close, (rptr, data), - struct _reent *rptr, +euc_to_ucs_close (struct _reent *rptr, void *data) { int i; @@ -345,8 +340,7 @@ _DEFUN(euc_to_ucs_close, (rptr, data), } static ucs4_t -_DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +euc_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -432,8 +426,7 @@ _DEFUN(euc_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_EUC */ static int -_DEFUN(euc_get_mb_cur_max, (data), - void *data) +euc_get_mb_cur_max (void *data) { return ((euc_data_t *)data)->mb_cur_max; } diff --git a/newlib/libc/iconv/ces/table-pcs.c b/newlib/libc/iconv/ces/table-pcs.c index 77b820bae..45cfe6267 100644 --- a/newlib/libc/iconv/ces/table-pcs.c +++ b/newlib/libc/iconv/ces/table-pcs.c @@ -40,8 +40,7 @@ #if defined (ICONV_FROM_UCS_CES_TABLE_PCS) static size_t -_DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +table_pcs_convert_from_ucs (void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -65,24 +64,21 @@ _DEFUN(table_pcs_convert_from_ucs, (data, in, outbuf, outbytesleft), } static void * -_DEFUN(table_pcs_from_ucs_init, (rptr, encoding), - struct _reent *rptr, +table_pcs_from_ucs_init (struct _reent *rptr, const char *encoding) { return _iconv_from_ucs_ces_handlers_table.init (rptr, encoding); } static size_t -_DEFUN(table_pcs_from_ucs_close, (rptr, data), - struct _reent *rptr, +table_pcs_from_ucs_close (struct _reent *rptr, void *data) { return _iconv_from_ucs_ces_handlers_table.close (rptr, data); } static int -_DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data), - void *data) +table_pcs_from_ucs_get_mb_cur_max (void *data) { return _iconv_from_ucs_ces_handlers_table.get_mb_cur_max (data); } @@ -91,8 +87,7 @@ _DEFUN(table_pcs_from_ucs_get_mb_cur_max, (data), #if defined (ICONV_TO_UCS_CES_TABLE_PCS) static ucs4_t -_DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +table_pcs_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -113,24 +108,21 @@ _DEFUN(table_pcs_convert_to_ucs, (data, inbuf, inbytesleft), } static void * -_DEFUN(table_pcs_to_ucs_init, (rptr, encoding), - struct _reent *rptr, +table_pcs_to_ucs_init (struct _reent *rptr, const char *encoding) { return _iconv_to_ucs_ces_handlers_table.init (rptr, encoding); } static size_t -_DEFUN(table_pcs_to_ucs_close, (rptr, data), - struct _reent *rptr, +table_pcs_to_ucs_close (struct _reent *rptr, void *data) { return _iconv_to_ucs_ces_handlers_table.close (rptr, data); } static int -_DEFUN(table_pcs_to_ucs_get_mb_cur_max, (data), - void *data) +table_pcs_to_ucs_get_mb_cur_max (void *data) { return _iconv_to_ucs_ces_handlers_table.get_mb_cur_max (data); } diff --git a/newlib/libc/iconv/ces/table.c b/newlib/libc/iconv/ces/table.c index 969c0944b..2b844d558 100644 --- a/newlib/libc/iconv/ces/table.c +++ b/newlib/libc/iconv/ces/table.c @@ -74,8 +74,7 @@ _EXFUN(load_file, (struct _reent *rptr, const char *name, int direction)); * Interface data and functions implementation. */ static size_t -_DEFUN(table_close, (rptr, data), - struct _reent *rptr, +table_close (struct _reent *rptr, void *data) { const iconv_ccs_desc_t *ccsp = (iconv_ccs_desc_t *)data; @@ -89,8 +88,7 @@ _DEFUN(table_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_TABLE) static void * -_DEFUN(table_init_from_ucs, (rptr, encoding), - struct _reent *rptr, +table_init_from_ucs (struct _reent *rptr, const char *encoding) { int i; @@ -127,8 +125,7 @@ _DEFUN(table_init_from_ucs, (rptr, encoding), } static size_t -_DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +table_convert_from_ucs (void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -172,8 +169,7 @@ _DEFUN(table_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_TABLE) static void * -_DEFUN(table_init_to_ucs, (rptr, encoding), - struct _reent *rptr, +table_init_to_ucs (struct _reent *rptr, const char *encoding) { int i; @@ -210,8 +206,7 @@ _DEFUN(table_init_to_ucs, (rptr, encoding), } static ucs4_t -_DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +table_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -253,8 +248,7 @@ _DEFUN(table_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_TABLE */ static int -_DEFUN(table_get_mb_cur_max, (data), - void *data) +table_get_mb_cur_max (void *data) { return ((iconv_ccs_desc_t *)data)->bits/8; } @@ -303,8 +297,7 @@ _iconv_from_ucs_ces_handlers_table = * Code that corresponds to 'code'. */ static __inline ucs2_t -_DEFUN(find_code_speed, (code, tblp), - ucs2_t code, +find_code_speed (ucs2_t code, const __uint16_t *tblp) { int idx = tblp[code >> 8]; @@ -326,8 +319,7 @@ _DEFUN(find_code_speed, (code, tblp), * Code that corresponds to 'code'. */ static __inline ucs2_t -_DEFUN(find_code_speed_8bit, (code, tblp), - ucs2_t code, +find_code_speed_8bit (ucs2_t code, const unsigned char *tblp) { int idx; @@ -366,8 +358,7 @@ _DEFUN(find_code_speed_8bit, (code, tblp), * Code that corresponds to 'code'. */ static ucs2_t -_DEFUN(find_code_size, (code, tblp), - ucs2_t code, +find_code_size (ucs2_t code, const __uint16_t *tblp) { int first, last, cur, center; @@ -460,8 +451,7 @@ _DEFUN(find_code_size, (code, tblp), * iconv_ccs_desc_t * pointer is success, NULL if failure. */ static const iconv_ccs_desc_t * -_DEFUN(load_file, (rptr, name, direction), - struct _reent *rptr, +load_file (struct _reent *rptr, const char *name, int direction) { diff --git a/newlib/libc/iconv/ces/ucs-2-internal.c b/newlib/libc/iconv/ces/ucs-2-internal.c index 2c9169473..3473444cf 100644 --- a/newlib/libc/iconv/ces/ucs-2-internal.c +++ b/newlib/libc/iconv/ces/ucs-2-internal.c @@ -44,8 +44,7 @@ #if defined (ICONV_FROM_UCS_CES_UCS_2_INTERNAL) static size_t -_DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +ucs_2_internal_convert_from_ucs (void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -66,8 +65,7 @@ _DEFUN(ucs_2_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_2_INTERNAL) static ucs4_t -_DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +ucs_2_internal_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -89,8 +87,7 @@ _DEFUN(ucs_2_internal_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_UCS_2_INTERNAL */ static int -_DEFUN(ucs_2_internal_get_mb_cur_max, (data), - void *data) +ucs_2_internal_get_mb_cur_max (void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/ucs-2.c b/newlib/libc/iconv/ces/ucs-2.c index a99562eec..5e965b080 100644 --- a/newlib/libc/iconv/ces/ucs-2.c +++ b/newlib/libc/iconv/ces/ucs-2.c @@ -50,8 +50,7 @@ #define UCS_2LE "ucs_2le" static void * -_DEFUN(ucs_2_init, (rptr, encoding), - struct _reent *rptr, +ucs_2_init (struct _reent *rptr, const char *encoding) { int *data; @@ -68,8 +67,7 @@ _DEFUN(ucs_2_init, (rptr, encoding), } static size_t -_DEFUN(ucs_2_close, (rptr, data), - struct _reent *rptr, +ucs_2_close (struct _reent *rptr, void *data) { _free_r (rptr, data); @@ -78,8 +76,7 @@ _DEFUN(ucs_2_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UCS_2) static size_t -_DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +ucs_2_convert_from_ucs (void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -105,8 +102,7 @@ _DEFUN(ucs_2_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_2) static ucs4_t -_DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +ucs_2_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -132,8 +128,7 @@ _DEFUN(ucs_2_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_UCS_2 */ static int -_DEFUN(ucs_2_get_mb_cur_max, (data), - void *data) +ucs_2_get_mb_cur_max (void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/ucs-4-internal.c b/newlib/libc/iconv/ces/ucs-4-internal.c index a5c6d7e09..d10952c55 100644 --- a/newlib/libc/iconv/ces/ucs-4-internal.c +++ b/newlib/libc/iconv/ces/ucs-4-internal.c @@ -44,8 +44,7 @@ #if defined (ICONV_FROM_UCS_CES_UCS_4_INTERNAL) static size_t -_DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +ucs_4_internal_convert_from_ucs (void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -66,8 +65,7 @@ _DEFUN(ucs_4_internal_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_4_INTERNAL) static ucs4_t -_DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +ucs_4_internal_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -89,8 +87,7 @@ _DEFUN(ucs_4_internal_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_UCS_4_INTERNAL */ static int -_DEFUN(ucs_4_internal_get_mb_cur_max, (data), - void *data) +ucs_4_internal_get_mb_cur_max (void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/ucs-4.c b/newlib/libc/iconv/ces/ucs-4.c index 0009981fe..290cc71f8 100644 --- a/newlib/libc/iconv/ces/ucs-4.c +++ b/newlib/libc/iconv/ces/ucs-4.c @@ -51,8 +51,7 @@ #define UCS_4LE "ucs_4le" static void * -_DEFUN(ucs_4_init, (rptr, encoding), - struct _reent *rptr, +ucs_4_init (struct _reent *rptr, const char *encoding) { int *data; @@ -69,8 +68,7 @@ _DEFUN(ucs_4_init, (rptr, encoding), } static size_t -_DEFUN(ucs_4_close, (rptr, data), - struct _reent *rptr, +ucs_4_close (struct _reent *rptr, void *data) { _free_r(rptr, data); @@ -80,8 +78,7 @@ _DEFUN(ucs_4_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UCS_4) static size_t -_DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +ucs_4_convert_from_ucs (void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -107,8 +104,7 @@ _DEFUN(ucs_4_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UCS_4) static ucs4_t -_DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +ucs_4_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -134,8 +130,7 @@ _DEFUN(ucs_4_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_UCS_4 */ static int -_DEFUN(ucs_4_get_mb_cur_max, (data), - void *data) +ucs_4_get_mb_cur_max (void *data) { return 4; } diff --git a/newlib/libc/iconv/ces/us-ascii.c b/newlib/libc/iconv/ces/us-ascii.c index e6a665070..164679178 100644 --- a/newlib/libc/iconv/ces/us-ascii.c +++ b/newlib/libc/iconv/ces/us-ascii.c @@ -40,8 +40,7 @@ #if defined (ICONV_FROM_UCS_CES_US_ASCII) static size_t -_DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +us_ascii_convert_from_ucs (void *data, ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -60,8 +59,7 @@ _DEFUN(us_ascii_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_US_ASCII) static ucs4_t -_DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +us_ascii_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -83,8 +81,7 @@ _DEFUN(us_ascii_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_US_ASCII */ static int -_DEFUN(us_ascii_get_mb_cur_max, (data), - void *data) +us_ascii_get_mb_cur_max (void *data) { return 2; } diff --git a/newlib/libc/iconv/ces/utf-16.c b/newlib/libc/iconv/ces/utf-16.c index dd62a5dea..a3491bb3c 100644 --- a/newlib/libc/iconv/ces/utf-16.c +++ b/newlib/libc/iconv/ces/utf-16.c @@ -58,8 +58,7 @@ #define UTF_16LE "utf_16le" static size_t -_DEFUN(utf_16_close, (rptr, data), - struct _reent *rptr, +utf_16_close (struct _reent *rptr, void *data) { _free_r(rptr, data); @@ -68,8 +67,7 @@ _DEFUN(utf_16_close, (rptr, data), #if defined (ICONV_FROM_UCS_CES_UTF_16) static void * -_DEFUN(utf_16_init_from_ucs, (rptr, encoding), - struct _reent *rptr, +utf_16_init_from_ucs (struct _reent *rptr, const char *encoding) { int *data; @@ -88,8 +86,7 @@ _DEFUN(utf_16_init_from_ucs, (rptr, encoding), } static size_t -_DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +utf_16_convert_from_ucs (void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -170,8 +167,7 @@ _DEFUN(utf_16_convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UTF_16) static void * -_DEFUN(utf_16_init_to_ucs, (rptr, encoding), - struct _reent *rptr, +utf_16_init_to_ucs (struct _reent *rptr, const char *encoding) { int *data; @@ -190,8 +186,7 @@ _DEFUN(utf_16_init_to_ucs, (rptr, encoding), } static ucs4_t -_DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +utf_16_convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -268,8 +263,7 @@ _DEFUN(utf_16_convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_UTF_16 */ static int -_DEFUN(utf_16_get_mb_cur_max, (data), - void *data) +utf_16_get_mb_cur_max (void *data) { return 6; } diff --git a/newlib/libc/iconv/ces/utf-8.c b/newlib/libc/iconv/ces/utf-8.c index 5559272d7..116f25925 100644 --- a/newlib/libc/iconv/ces/utf-8.c +++ b/newlib/libc/iconv/ces/utf-8.c @@ -43,8 +43,7 @@ #if defined (ICONV_FROM_UCS_CES_UTF_8) static size_t -_DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), - void *data, +convert_from_ucs (void *data, register ucs4_t in, unsigned char **outbuf, size_t *outbytesleft) @@ -125,8 +124,7 @@ _DEFUN(convert_from_ucs, (data, in, outbuf, outbytesleft), #if defined (ICONV_TO_UCS_CES_UTF_8) static ucs4_t -_DEFUN(convert_to_ucs, (data, inbuf, inbytesleft), - void *data, +convert_to_ucs (void *data, const unsigned char **inbuf, size_t *inbytesleft) { @@ -259,8 +257,7 @@ _DEFUN(convert_to_ucs, (data, inbuf, inbytesleft), #endif /* ICONV_TO_UCS_CES_UTF_8 */ static int -_DEFUN(get_mb_cur_max, (data), - void *data) +get_mb_cur_max (void *data) { return UTF8_MB_CUR_MAX; } diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c index 7c932e65c..d04cebb57 100644 --- a/newlib/libc/iconv/lib/aliasesi.c +++ b/newlib/libc/iconv/lib/aliasesi.c @@ -48,8 +48,7 @@ * Returns canonical form of 'str' if success, NULL if failure. */ static const char * -_DEFUN(canonical_form, (rptr, str), - struct _reent *rptr, +canonical_form (struct _reent *rptr, const char *str) { char *p, *p1; @@ -93,8 +92,7 @@ _DEFUN(canonical_form, (rptr, str), * and sets current thread's/process's errno. */ static char * -_DEFUN(find_alias, (rptr, alias, table, len), - struct _reent *rptr, +find_alias (struct _reent *rptr, const char *alias, const char *table, int len) @@ -147,8 +145,7 @@ search_again: * and sets current thread's/process's errno. */ char * -_DEFUN(_iconv_resolve_encoding_name, (rptr, cname, path), - struct _reent *rptr, +_iconv_resolve_encoding_name (struct _reent *rptr, const char *ca) { char *p = (char *)ca; diff --git a/newlib/libc/iconv/lib/iconv.c b/newlib/libc/iconv/lib/iconv.c index 0cf3cf5ff..02c749d7f 100644 --- a/newlib/libc/iconv/lib/iconv.c +++ b/newlib/libc/iconv/lib/iconv.c @@ -120,8 +120,7 @@ No supporting OS subroutine calls are required. */ iconv_t -_DEFUN(iconv_open, (to, from), - const char *to, +iconv_open (const char *to, const char *from) { return _iconv_open_r (_REENT, to, from); @@ -129,8 +128,7 @@ _DEFUN(iconv_open, (to, from), size_t -_DEFUN(iconv, (cd, inbuf, inbytesleft, outbuf, outbytesleft), - iconv_t cd, +iconv (iconv_t cd, char **__restrict inbuf, size_t *__restrict inbytesleft, char **__restrict outbuf, @@ -142,7 +140,7 @@ _DEFUN(iconv, (cd, inbuf, inbytesleft, outbuf, outbytesleft), int -_DEFUN(iconv_close, (cd), iconv_t cd) +iconv_close (iconv_t cd) { return _iconv_close_r (_REENT, cd); } @@ -150,8 +148,7 @@ _DEFUN(iconv_close, (cd), iconv_t cd) #ifndef _REENT_ONLY iconv_t -_DEFUN(_iconv_open_r, (rptr, to, from), - struct _reent *rptr, +_iconv_open_r (struct _reent *rptr, const char *to, const char *from) { @@ -201,8 +198,7 @@ _DEFUN(_iconv_open_r, (rptr, to, from), size_t -_DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), - struct _reent *rptr, +_iconv_r (struct _reent *rptr, iconv_t cd, const char **inbuf, size_t *inbytesleft, @@ -288,8 +284,7 @@ _DEFUN(_iconv_r, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), int -_DEFUN(_iconv_close_r, (rptr, cd), - struct _reent *rptr, +_iconv_close_r (struct _reent *rptr, iconv_t cd) { int res; diff --git a/newlib/libc/iconv/lib/iconvnls.c b/newlib/libc/iconv/lib/iconvnls.c index dfb6a18dd..ed8f3a7ba 100644 --- a/newlib/libc/iconv/lib/iconvnls.c +++ b/newlib/libc/iconv/lib/iconvnls.c @@ -59,8 +59,7 @@ * and sets current thread's/process's errno. */ const char * -_DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), - struct _reent *rptr, +_iconv_nls_construct_filename (struct _reent *rptr, const char *file, const char *dir, const char *ext) @@ -114,8 +113,7 @@ _DEFUN(_iconv_nls_construct_filename, (rptr, file, ext), * "to" encoding's value if 'direction' isn't 0. */ int -_DEFUN(_iconv_nls_get_mb_cur_max, (cd, direction), - iconv_t cd, +_iconv_nls_get_mb_cur_max (iconv_t cd, int direction) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -137,8 +135,7 @@ _DEFUN(_iconv_nls_get_mb_cur_max, (cd, direction), */ int -_DEFUN(_iconv_nls_is_stateful, (cd, direction), - iconv_t cd, +_iconv_nls_is_stateful (iconv_t cd, int direction) { iconv_conversion_t *ic = (iconv_conversion_t *)cd; @@ -166,8 +163,7 @@ _DEFUN(_iconv_nls_is_stateful, (cd, direction), * Same as _iconv_r. */ size_t -_DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), - struct _reent *rptr, +_iconv_nls_conv (struct _reent *rptr, iconv_t cd, const char **inbuf, size_t *inbytesleft, @@ -220,8 +216,7 @@ _DEFUN(_iconv_nls_conv, (rptr, cd, inbuf, inbytesleft, outbuf, outbytesleft), * if 'direction' isn't 0. */ void -_DEFUN(_iconv_nls_get_state, (cd, ps, direction), - iconv_t cd, +_iconv_nls_get_state (iconv_t cd, mbstate_t *ps, int direction) { @@ -247,8 +242,7 @@ _DEFUN(_iconv_nls_get_state, (cd, ps, direction), * 0 if success, -1 if failure. */ int -_DEFUN(_iconv_nls_set_state, (cd, ps, direction), - iconv_t cd, +_iconv_nls_set_state (iconv_t cd, mbstate_t *ps, int direction) { @@ -259,8 +253,7 @@ _DEFUN(_iconv_nls_set_state, (cd, ps, direction), /* Same as iconv_open() but don't perform name resolving */ static iconv_t -_DEFUN(iconv_open1, (rptr, to, from), - struct _reent *rptr, +iconv_open1 (struct _reent *rptr, const char *to, const char *from) { @@ -316,8 +309,7 @@ _DEFUN(iconv_open1, (rptr, to, from), * If successful - return 0, else set errno and return -1. */ int -_DEFUN(_iconv_nls_open, (rptr, encoding, towc, tomb), - struct _reent *rptr, +_iconv_nls_open (struct _reent *rptr, const char *encoding, iconv_t *tomb, iconv_t *towc, diff --git a/newlib/libc/iconv/lib/nullconv.c b/newlib/libc/iconv/lib/nullconv.c index 8040c24e7..e75d83376 100644 --- a/newlib/libc/iconv/lib/nullconv.c +++ b/newlib/libc/iconv/lib/nullconv.c @@ -36,8 +36,7 @@ static int null_conversion_dummy_data; static void * -_DEFUN(null_conversion_open, (rptr, to, from), - struct _reent *rptr, +null_conversion_open (struct _reent *rptr, const char *to, const char *from) { @@ -46,8 +45,7 @@ _DEFUN(null_conversion_open, (rptr, to, from), static size_t -_DEFUN(null_conversion_close, (rptr, data), - struct _reent *rptr, +null_conversion_close (struct _reent *rptr, void *data) { return 0; @@ -55,9 +53,7 @@ _DEFUN(null_conversion_close, (rptr, data), static size_t -_DEFUN(null_conversion_convert, - (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft), - struct _reent *rptr, +null_conversion_convert (struct _reent *rptr, void *data, const unsigned char **inbuf, size_t *inbytesleft, @@ -93,8 +89,7 @@ _DEFUN(null_conversion_convert, static int -_DEFUN(null_conversion_get_mb_cur_max, (data, direction), - void *data, +null_conversion_get_mb_cur_max (void *data, int direction) { return ICONV_MB_LEN_MAX; @@ -102,8 +97,7 @@ _DEFUN(null_conversion_get_mb_cur_max, (data, direction), static void -_DEFUN(null_conversion_get_state, (data, state, size), - void *data, +null_conversion_get_state (void *data, mbstate_t *state, int direction) { @@ -112,8 +106,7 @@ _DEFUN(null_conversion_get_state, (data, state, size), static int -_DEFUN(null_conversion_set_state, (data, state, direction), - void *data, +null_conversion_set_state (void *data, mbstate_t *state, int direction) { @@ -121,8 +114,7 @@ _DEFUN(null_conversion_set_state, (data, state, direction), } static int -_DEFUN(null_conversion_is_stateful, (data, direction), - void *data, +null_conversion_is_stateful (void *data, int direction) { return 0; diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c index f480aee63..8c3d19073 100644 --- a/newlib/libc/iconv/lib/ucsconv.c +++ b/newlib/libc/iconv/lib/ucsconv.c @@ -45,8 +45,7 @@ _EXFUN(find_encoding_name, (const char *searchee, */ static void * -_DEFUN(ucs_based_conversion_open, (rptr, to, from), - struct _reent *rptr, +ucs_based_conversion_open (struct _reent *rptr, const char *to, const char *from) { @@ -123,8 +122,7 @@ error: static size_t -_DEFUN(ucs_based_conversion_close, (rptr, data), - struct _reent *rptr, +ucs_based_conversion_close (struct _reent *rptr, void *data) { iconv_ucs_conversion_t *uc; @@ -144,9 +142,7 @@ _DEFUN(ucs_based_conversion_close, (rptr, data), static size_t -_DEFUN(ucs_based_conversion_convert, - (rptr, data, inbuf, inbytesleft, outbuf, outbytesleft, flags), - struct _reent *rptr, +ucs_based_conversion_convert (struct _reent *rptr, void *data, const unsigned char **inbuf, size_t *inbytesleft, @@ -238,8 +234,7 @@ _DEFUN(ucs_based_conversion_convert, static int -_DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), - void *data, +ucs_based_conversion_get_mb_cur_max (void *data, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -252,8 +247,7 @@ _DEFUN(ucs_based_conversion_get_mb_cur_max, (data, direction), static void -_DEFUN(ucs_based_conversion_get_state, (data, state, direction), - void *data, +ucs_based_conversion_get_state (void *data, mbstate_t *state, int direction) { @@ -280,8 +274,7 @@ _DEFUN(ucs_based_conversion_get_state, (data, state, direction), static int -_DEFUN(ucs_based_conversion_set_state, (data, state, direction), - void *data, +ucs_based_conversion_set_state (void *data, mbstate_t *state, int direction) { @@ -302,8 +295,7 @@ _DEFUN(ucs_based_conversion_set_state, (data, state, direction), } static int -_DEFUN(ucs_based_conversion_is_stateful, (data, direction), - void *data, +ucs_based_conversion_is_stateful (void *data, int direction) { iconv_ucs_conversion_t *uc = (iconv_ucs_conversion_t *)data; @@ -342,8 +334,7 @@ _iconv_ucs_conversion_handlers = */ static int -_DEFUN(find_encoding_name, (searchee, names), - const char *searchee, +find_encoding_name (const char *searchee, const char **names) { const char *p; diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index d05145b91..951617520 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -58,14 +58,12 @@ #define _EXPARM(name, proto) (* name) proto #define _EXFNPTR(name, proto) (* name) proto #endif -#define _DEFUN(name, arglist, args) name(args) #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif #else #define _EXFUN(name, proto) name() #define _EXFUN_NOTHROW(name, proto) name() -#define _DEFUN(name, arglist, args) name arglist args; #define _LONG_DOUBLE double #endif diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index 7080b0510..baa5451a6 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -289,8 +289,7 @@ static char *currentlocale (void); #endif /* _MB_CAPABLE */ char * -_DEFUN(_setlocale_r, (p, category, locale), - struct _reent *p, +_setlocale_r (struct _reent *p, int category, const char *locale) { @@ -990,8 +989,7 @@ __locale_ctype_ptr (void) #ifndef _REENT_ONLY char * -_DEFUN (setlocale, (category, locale), - int category, +setlocale (int category, const char *locale) { return _setlocale_r (_REENT, category, locale); diff --git a/newlib/libc/locale/localeconv.c b/newlib/libc/locale/localeconv.c index b87f604a3..5f34a785f 100644 --- a/newlib/libc/locale/localeconv.c +++ b/newlib/libc/locale/localeconv.c @@ -51,8 +51,7 @@ __localeconv_l (struct __locale_t *locale) } struct lconv * -_DEFUN (_localeconv_r, (data), - struct _reent *data) +_localeconv_r (struct _reent *data) { /* Note that we always fall back to the global locale, even in case of specifying a reent. Otherwise a call to _localeconv_r would just diff --git a/newlib/libc/machine/microblaze/strcmp.c b/newlib/libc/machine/microblaze/strcmp.c index 82987eade..434195e2c 100644 --- a/newlib/libc/machine/microblaze/strcmp.c +++ b/newlib/libc/machine/microblaze/strcmp.c @@ -81,8 +81,7 @@ QUICKREF #endif int -_DEFUN (strcmp, (s1, s2), - const char *s1, +strcmp (const char *s1, const char *s2) { diff --git a/newlib/libc/machine/microblaze/strcpy.c b/newlib/libc/machine/microblaze/strcpy.c index 8e2dae634..62072fa28 100644 --- a/newlib/libc/machine/microblaze/strcpy.c +++ b/newlib/libc/machine/microblaze/strcpy.c @@ -81,8 +81,7 @@ QUICKREF #endif char* -_DEFUN (strcpy, (dst0, src0), - char *__restrict dst0, +strcpy (char *__restrict dst0, const char *__restrict src0) { diff --git a/newlib/libc/machine/microblaze/strlen.c b/newlib/libc/machine/microblaze/strlen.c index 059f4463d..acb4464bc 100644 --- a/newlib/libc/machine/microblaze/strlen.c +++ b/newlib/libc/machine/microblaze/strlen.c @@ -78,8 +78,7 @@ QUICKREF #endif size_t -_DEFUN (strlen, (str), - const char *str) +strlen (const char *str) { #ifndef HAVE_HW_PCMP diff --git a/newlib/libc/machine/powerpc/atosfix16.c b/newlib/libc/machine/powerpc/atosfix16.c index dd5e2dfd4..b069d71d1 100644 --- a/newlib/libc/machine/powerpc/atosfix16.c +++ b/newlib/libc/machine/powerpc/atosfix16.c @@ -62,8 +62,7 @@ PORTABILITY #include <_ansi.h> __int16_t -_DEFUN (_atosfix16_r, (reent, s), - struct _reent *reent, +_atosfix16_r (struct _reent *reent, const char *s) { return _strtosfix16_r (reent, s, NULL); @@ -71,8 +70,7 @@ _DEFUN (_atosfix16_r, (reent, s), #ifndef _REENT_ONLY __int16_t -_DEFUN (atosfix16, (s), - const char *s) +atosfix16 (const char *s) { return strtosfix16 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atosfix32.c b/newlib/libc/machine/powerpc/atosfix32.c index fed308b65..e1915b25a 100644 --- a/newlib/libc/machine/powerpc/atosfix32.c +++ b/newlib/libc/machine/powerpc/atosfix32.c @@ -8,8 +8,7 @@ #include <_ansi.h> __int32_t -_DEFUN (_atosfix32_r, (reent, s), - struct _reent *reent, +_atosfix32_r (struct _reent *reent, const char *s) { return _strtosfix32_r (reent, s, NULL); @@ -17,8 +16,7 @@ _DEFUN (_atosfix32_r, (reent, s), #ifndef _REENT_ONLY __int32_t -_DEFUN (atosfix32, (s), - const char *s) +atosfix32 (const char *s) { return strtosfix32 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atosfix64.c b/newlib/libc/machine/powerpc/atosfix64.c index cfc421a3a..5340b1ee2 100644 --- a/newlib/libc/machine/powerpc/atosfix64.c +++ b/newlib/libc/machine/powerpc/atosfix64.c @@ -8,8 +8,7 @@ #include <_ansi.h> __int64_t -_DEFUN (_atosfix64_r, (reent, s), - struct _reent *reent, +_atosfix64_r (struct _reent *reent, const char *s) { return _strtosfix64_r (reent, s, NULL); @@ -17,8 +16,7 @@ _DEFUN (_atosfix64_r, (reent, s), #ifndef _REENT_ONLY __int64_t -_DEFUN (atosfix64, (s), - const char *s) +atosfix64 (const char *s) { return strtosfix64 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atoufix16.c b/newlib/libc/machine/powerpc/atoufix16.c index 84a60b252..4cc833862 100644 --- a/newlib/libc/machine/powerpc/atoufix16.c +++ b/newlib/libc/machine/powerpc/atoufix16.c @@ -62,8 +62,7 @@ PORTABILITY #include <_ansi.h> __uint16_t -_DEFUN (_atoufix16_r, (reent, s), - struct _reent *reent, +_atoufix16_r (struct _reent *reent, const char *s) { return _strtoufix16_r (reent, s, NULL); @@ -71,8 +70,7 @@ _DEFUN (_atoufix16_r, (reent, s), #ifndef _REENT_ONLY __uint16_t -_DEFUN (atoufix16, (s), - const char *s) +atoufix16 (const char *s) { return strtoufix16 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atoufix32.c b/newlib/libc/machine/powerpc/atoufix32.c index fc64c75e4..aa2333af6 100644 --- a/newlib/libc/machine/powerpc/atoufix32.c +++ b/newlib/libc/machine/powerpc/atoufix32.c @@ -8,8 +8,7 @@ #include <_ansi.h> __uint32_t -_DEFUN (_atoufix32_r, (reent, s), - struct _reent *reent, +_atoufix32_r (struct _reent *reent, const char *s) { return _strtoufix32_r (reent, s, NULL); @@ -17,8 +16,7 @@ _DEFUN (_atoufix32_r, (reent, s), #ifndef _REENT_ONLY __uint32_t -_DEFUN (atoufix32, (s), - const char *s) +atoufix32 (const char *s) { return strtoufix32 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/atoufix64.c b/newlib/libc/machine/powerpc/atoufix64.c index e8ff7773d..cf9517e95 100644 --- a/newlib/libc/machine/powerpc/atoufix64.c +++ b/newlib/libc/machine/powerpc/atoufix64.c @@ -8,8 +8,7 @@ #include <_ansi.h> __uint64_t -_DEFUN (_atoufix64_r, (reent, s), - struct _reent *reent, +_atoufix64_r (struct _reent *reent, const char *s) { return _strtoufix64_r (reent, s, NULL); @@ -17,8 +16,7 @@ _DEFUN (_atoufix64_r, (reent, s), #ifndef _REENT_ONLY __uint64_t -_DEFUN (atoufix64, (s), - const char *s) +atoufix64 (const char *s) { return strtoufix64 (s, NULL); } diff --git a/newlib/libc/machine/powerpc/strtosfix16.c b/newlib/libc/machine/powerpc/strtosfix16.c index 4e998db03..3fba45409 100644 --- a/newlib/libc/machine/powerpc/strtosfix16.c +++ b/newlib/libc/machine/powerpc/strtosfix16.c @@ -92,8 +92,7 @@ PORTABILITY * Ignores `locale' stuff. */ __int16_t -_DEFUN (_strtosfix16_r, (rptr, nptr, endptr), - struct _reent *rptr, +_strtosfix16_r (struct _reent *rptr, const char *nptr, char **endptr) { @@ -169,8 +168,7 @@ _DEFUN (_strtosfix16_r, (rptr, nptr, endptr), #ifndef _REENT_ONLY __int16_t -_DEFUN (strtosfix16, (s, ptr, base), - const char *s, +strtosfix16 (const char *s, char **ptr) { return _strtosfix16_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtosfix32.c b/newlib/libc/machine/powerpc/strtosfix32.c index e8966808e..b21de9ea1 100644 --- a/newlib/libc/machine/powerpc/strtosfix32.c +++ b/newlib/libc/machine/powerpc/strtosfix32.c @@ -13,8 +13,7 @@ * Ignores `locale' stuff. */ __int32_t -_DEFUN (_strtosfix32_r, (rptr, nptr, endptr), - struct _reent *rptr, +_strtosfix32_r (struct _reent *rptr, const char *nptr, char **endptr) { @@ -92,8 +91,7 @@ _DEFUN (_strtosfix32_r, (rptr, nptr, endptr), #ifndef _REENT_ONLY __int32_t -_DEFUN (strtosfix32, (s, ptr, base), - const char *s, +strtosfix32 (const char *s, char **ptr) { return _strtosfix32_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtosfix64.c b/newlib/libc/machine/powerpc/strtosfix64.c index f7344fc22..16032128f 100644 --- a/newlib/libc/machine/powerpc/strtosfix64.c +++ b/newlib/libc/machine/powerpc/strtosfix64.c @@ -13,8 +13,7 @@ * Ignores `locale' stuff. */ __int64_t -_DEFUN (_strtosfix64_r, (rptr, nptr, endptr), - struct _reent *rptr, +_strtosfix64_r (struct _reent *rptr, const char *nptr, char **endptr) { @@ -105,8 +104,7 @@ _DEFUN (_strtosfix64_r, (rptr, nptr, endptr), #ifndef _REENT_ONLY __int64_t -_DEFUN (strtosfix64, (s, ptr, base), - const char *s, +strtosfix64 (const char *s, char **ptr) { return _strtosfix64_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix16.c b/newlib/libc/machine/powerpc/strtoufix16.c index 0757930d4..9b16268bb 100644 --- a/newlib/libc/machine/powerpc/strtoufix16.c +++ b/newlib/libc/machine/powerpc/strtoufix16.c @@ -91,8 +91,7 @@ PORTABILITY * Ignores `locale' stuff. */ __uint16_t -_DEFUN (_strtoufix16_r, (rptr, nptr, endptr), - struct _reent *rptr, +_strtoufix16_r (struct _reent *rptr, const char *nptr, char **endptr) { @@ -160,8 +159,7 @@ _DEFUN (_strtoufix16_r, (rptr, nptr, endptr), #ifndef _REENT_ONLY __uint16_t -_DEFUN (strtoufix16, (s, ptr, base), - const char *s, +strtoufix16 (const char *s, char **ptr) { return _strtoufix16_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix32.c b/newlib/libc/machine/powerpc/strtoufix32.c index 60f278daa..7d03f8c9b 100644 --- a/newlib/libc/machine/powerpc/strtoufix32.c +++ b/newlib/libc/machine/powerpc/strtoufix32.c @@ -13,8 +13,7 @@ * Ignores `locale' stuff. */ __uint32_t -_DEFUN (_strtoufix32_r, (rptr, nptr, endptr), - struct _reent *rptr, +_strtoufix32_r (struct _reent *rptr, const char *nptr, char **endptr) { @@ -89,8 +88,7 @@ _DEFUN (_strtoufix32_r, (rptr, nptr, endptr), #ifndef _REENT_ONLY __uint32_t -_DEFUN (strtoufix32, (s, ptr, base), - const char *s, +strtoufix32 (const char *s, char **ptr) { return _strtoufix32_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/strtoufix64.c b/newlib/libc/machine/powerpc/strtoufix64.c index 509f51318..a2f0484b3 100644 --- a/newlib/libc/machine/powerpc/strtoufix64.c +++ b/newlib/libc/machine/powerpc/strtoufix64.c @@ -13,8 +13,7 @@ * Ignores `locale' stuff. */ __uint64_t -_DEFUN (_strtoufix64_r, (rptr, nptr, endptr), - struct _reent *rptr, +_strtoufix64_r (struct _reent *rptr, const char *nptr, char **endptr) { @@ -104,8 +103,7 @@ _DEFUN (_strtoufix64_r, (rptr, nptr, endptr), #ifndef _REENT_ONLY __uint64_t -_DEFUN (strtoufix64, (s, ptr, base), - const char *s, +strtoufix64 (const char *s, char **ptr) { return _strtoufix64_r (_REENT, s, ptr); diff --git a/newlib/libc/machine/powerpc/ufix64toa.c b/newlib/libc/machine/powerpc/ufix64toa.c index bf13894e6..c829b9b33 100644 --- a/newlib/libc/machine/powerpc/ufix64toa.c +++ b/newlib/libc/machine/powerpc/ufix64toa.c @@ -25,8 +25,7 @@ extern char *_simdldtoa_r (struct _reent *, LONG_DOUBLE_UNION *, int, */ char * -_DEFUN (_ufix64toa_r, (rptr, value, mode, ndigits, decpt, sign, rve), - struct _reent *rptr, +_ufix64toa_r (struct _reent *rptr, __uint64_t value, int mode, int ndigits, diff --git a/newlib/libc/machine/powerpc/vec_calloc.c b/newlib/libc/machine/powerpc/vec_calloc.c index cc156bc76..7a90d571c 100644 --- a/newlib/libc/machine/powerpc/vec_calloc.c +++ b/newlib/libc/machine/powerpc/vec_calloc.c @@ -44,8 +44,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifndef _REENT_ONLY void * -_DEFUN (vec_calloc, (n, size), - size_t n, +vec_calloc (size_t n, size_t size) { return _vec_calloc_r (_REENT, n, size); diff --git a/newlib/libc/machine/powerpc/vec_free.c b/newlib/libc/machine/powerpc/vec_free.c index fa2ea9686..c893e5ab4 100644 --- a/newlib/libc/machine/powerpc/vec_free.c +++ b/newlib/libc/machine/powerpc/vec_free.c @@ -6,8 +6,7 @@ #ifndef _REENT_ONLY void -_DEFUN (vec_free, (aptr), - void *aptr) +vec_free (void *aptr) { _free_r (_REENT, aptr); } diff --git a/newlib/libc/machine/powerpc/vec_malloc.c b/newlib/libc/machine/powerpc/vec_malloc.c index ad62b119f..b62fe0762 100644 --- a/newlib/libc/machine/powerpc/vec_malloc.c +++ b/newlib/libc/machine/powerpc/vec_malloc.c @@ -96,8 +96,7 @@ Supporting OS subroutines required: <>. */ #ifndef _REENT_ONLY void * -_DEFUN (vec_malloc, (nbytes), - size_t nbytes) /* get a block */ +vec_malloc (size_t nbytes) /* get a block */ { return _memalign_r (_REENT, 16, nbytes); } diff --git a/newlib/libc/machine/powerpc/vec_realloc.c b/newlib/libc/machine/powerpc/vec_realloc.c index 05ee82be1..db6f32060 100644 --- a/newlib/libc/machine/powerpc/vec_realloc.c +++ b/newlib/libc/machine/powerpc/vec_realloc.c @@ -7,8 +7,7 @@ #ifndef _REENT_ONLY void * -_DEFUN (vec_realloc, (ap, nbytes), - void *ap, +vec_realloc (void *ap, size_t nbytes) { return _vec_realloc_r (_REENT, ap, nbytes); diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c index 1615d4b25..2cae2aaa1 100644 --- a/newlib/libc/machine/powerpc/vfprintf.c +++ b/newlib/libc/machine/powerpc/vfprintf.c @@ -271,8 +271,7 @@ static char *cvt_ufix64 (struct _reent *, unsigned long long, int, int *, int * #define FIXEDPOINT 0x400 /* fixed-point */ int -_DEFUN (VFPRINTF, (fp, fmt0, ap), - FILE * fp, +VFPRINTF (FILE * fp, const char *fmt0, va_list ap) { @@ -281,8 +280,7 @@ _DEFUN (VFPRINTF, (fp, fmt0, ap), } int -_DEFUN (_VFPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data, +_VFPRINTF_R (struct _reent *data, FILE * fp, const char *fmt0, va_list ap) diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index 4a3e48c22..f0443bf4a 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -182,8 +182,7 @@ typedef union #ifndef _REENT_ONLY int -_DEFUN (vfscanf, (fp, fmt, ap), - register FILE *__restrict fp, +vfscanf (register FILE *__restrict fp, const char *__restrict fmt, va_list ap) { @@ -203,8 +202,7 @@ __svfscanf (fp, fmt0, ap) #endif /* !_REENT_ONLY */ int -_DEFUN (_vfscanf_r, (data, fp, fmt, ap), - struct _reent *data, +_vfscanf_r (struct _reent *data, register FILE *__restrict fp, const char *__restrict fmt, va_list ap) diff --git a/newlib/libc/machine/spu/assert.c b/newlib/libc/machine/spu/assert.c index e8028459c..90e94eb5d 100644 --- a/newlib/libc/machine/spu/assert.c +++ b/newlib/libc/machine/spu/assert.c @@ -10,8 +10,7 @@ /* func can be NULL, in which case no function information is given. */ void -_DEFUN (__assert_func, (file, line, func, failedexpr), - const char *file, +__assert_func (const char *file, int line, const char *func, const char *failedexpr) @@ -31,8 +30,7 @@ _DEFUN (__assert_func, (file, line, func, failedexpr), } void -_DEFUN (__assert, (file, line, failedexpr), - const char *file, +__assert (const char *file, int line, const char *failedexpr) { diff --git a/newlib/libc/machine/spu/clearerr.c b/newlib/libc/machine/spu/clearerr.c index 667667a91..27f726a64 100644 --- a/newlib/libc/machine/spu/clearerr.c +++ b/newlib/libc/machine/spu/clearerr.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY void -_DEFUN (clearerr, (fp), - FILE * fp) +clearerr (FILE * fp) { int ret; diff --git a/newlib/libc/machine/spu/creat.c b/newlib/libc/machine/spu/creat.c index 0e271c1a7..5b8c603f5 100644 --- a/newlib/libc/machine/spu/creat.c +++ b/newlib/libc/machine/spu/creat.c @@ -7,8 +7,7 @@ #include int -_DEFUN(creat, (path, mode), - const char *path, +creat (const char *path, mode_t mode) { return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode); diff --git a/newlib/libc/machine/spu/fclose.c b/newlib/libc/machine/spu/fclose.c index 4e1b8253b..6a3e5073f 100644 --- a/newlib/libc/machine/spu/fclose.c +++ b/newlib/libc/machine/spu/fclose.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY int -_DEFUN (fclose, (fp), - FILE * fp) +fclose (FILE * fp) { int ret; diff --git a/newlib/libc/machine/spu/fdopen.c b/newlib/libc/machine/spu/fdopen.c index edec03cff..6244e50df 100644 --- a/newlib/libc/machine/spu/fdopen.c +++ b/newlib/libc/machine/spu/fdopen.c @@ -34,8 +34,7 @@ POSSIBILITY OF SUCH DAMAGE. #ifndef _REENT_ONLY /* Just a stub for now. */ FILE * -_DEFUN (fdopen, (fd, mode), - int fd, +fdopen (int fd, const char *mode) { errno = ENOSYS; diff --git a/newlib/libc/machine/spu/feof.c b/newlib/libc/machine/spu/feof.c index 25e3a8f82..8e874148f 100644 --- a/newlib/libc/machine/spu/feof.c +++ b/newlib/libc/machine/spu/feof.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY int -_DEFUN (feof, (fp), - FILE * fp) +feof (FILE * fp) { int result; diff --git a/newlib/libc/machine/spu/ferror.c b/newlib/libc/machine/spu/ferror.c index ac747eff4..be7970fb6 100644 --- a/newlib/libc/machine/spu/ferror.c +++ b/newlib/libc/machine/spu/ferror.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY int -_DEFUN (ferror, (fp), - FILE * fp) +ferror (FILE * fp) { int result; diff --git a/newlib/libc/machine/spu/fflush.c b/newlib/libc/machine/spu/fflush.c index 7037f4990..6b45ac4a1 100644 --- a/newlib/libc/machine/spu/fflush.c +++ b/newlib/libc/machine/spu/fflush.c @@ -36,8 +36,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY int -_DEFUN (fflush, (fp), - FILE * fp) +fflush (FILE * fp) { int result; diff --git a/newlib/libc/machine/spu/fgetc.c b/newlib/libc/machine/spu/fgetc.c index 815203228..8e191cfcb 100644 --- a/newlib/libc/machine/spu/fgetc.c +++ b/newlib/libc/machine/spu/fgetc.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY int -_DEFUN (fgetc, (fp), - FILE * fp) +fgetc (FILE * fp) { int result; diff --git a/newlib/libc/machine/spu/fgetpos.c b/newlib/libc/machine/spu/fgetpos.c index bb7d780ea..68d41ac0e 100644 --- a/newlib/libc/machine/spu/fgetpos.c +++ b/newlib/libc/machine/spu/fgetpos.c @@ -44,8 +44,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (fgetpos, (fp, pos), - FILE *__restrict fp, +fgetpos (FILE *__restrict fp, _fpos_t *__restrict pos) { c99_fgetpos_t arg; diff --git a/newlib/libc/machine/spu/fgets.c b/newlib/libc/machine/spu/fgets.c index 8f2a9785f..cde29da34 100644 --- a/newlib/libc/machine/spu/fgets.c +++ b/newlib/libc/machine/spu/fgets.c @@ -46,8 +46,7 @@ typedef struct #ifndef _REENT_ONLY char * -_DEFUN (fgets, (buf, n, fp), - char *__restrict buf, +fgets (char *__restrict buf, int n, FILE *__restrict fp) { diff --git a/newlib/libc/machine/spu/fileno.c b/newlib/libc/machine/spu/fileno.c index 867a6b8f3..cbf9e50c4 100644 --- a/newlib/libc/machine/spu/fileno.c +++ b/newlib/libc/machine/spu/fileno.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY int -_DEFUN (fileno, (fp), - FILE *fp) +fileno (FILE *fp) { int ret; diff --git a/newlib/libc/machine/spu/fopen.c b/newlib/libc/machine/spu/fopen.c index ffa8f6904..13ecdad1e 100644 --- a/newlib/libc/machine/spu/fopen.c +++ b/newlib/libc/machine/spu/fopen.c @@ -45,8 +45,7 @@ typedef struct #ifndef _REENT_ONLY FILE * -_DEFUN (fopen, (file, mode), - const char *__restrict file, +fopen (const char *__restrict file, const char *__restrict mode) { int ret; diff --git a/newlib/libc/machine/spu/fputs.c b/newlib/libc/machine/spu/fputs.c index 82b72e060..898418606 100644 --- a/newlib/libc/machine/spu/fputs.c +++ b/newlib/libc/machine/spu/fputs.c @@ -46,8 +46,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (fputs, (s, fp), - char const *__restrict s, +fputs (char const *__restrict s, FILE *__restrict fp) { c99_fputs_t args; diff --git a/newlib/libc/machine/spu/fread.c b/newlib/libc/machine/spu/fread.c index 8a6e9c417..12b6bb782 100644 --- a/newlib/libc/machine/spu/fread.c +++ b/newlib/libc/machine/spu/fread.c @@ -49,8 +49,7 @@ typedef struct #ifndef _REENT_ONLY size_t -_DEFUN (fread, (buf, size, count, fp), - void *__restrict buf, +fread (void *__restrict buf, size_t size, size_t count, FILE *__restrict fp) diff --git a/newlib/libc/machine/spu/freopen.c b/newlib/libc/machine/spu/freopen.c index 0e3f15f83..8babcfe27 100644 --- a/newlib/libc/machine/spu/freopen.c +++ b/newlib/libc/machine/spu/freopen.c @@ -47,8 +47,7 @@ typedef struct #ifndef _REENT_ONLY FILE * -_DEFUN (freopen, (file, mode, fp), - const char *__restrict file, +freopen (const char *__restrict file, const char *__restrict mode, FILE *__restrict fp) { diff --git a/newlib/libc/machine/spu/fseek.c b/newlib/libc/machine/spu/fseek.c index 136d5c639..df33ed85c 100644 --- a/newlib/libc/machine/spu/fseek.c +++ b/newlib/libc/machine/spu/fseek.c @@ -47,8 +47,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (fseek, (fp, offset, whence), - register FILE *fp, +fseek (register FILE *fp, long offset, int whence) { diff --git a/newlib/libc/machine/spu/fsetpos.c b/newlib/libc/machine/spu/fsetpos.c index a92cca5a3..87daa4c18 100644 --- a/newlib/libc/machine/spu/fsetpos.c +++ b/newlib/libc/machine/spu/fsetpos.c @@ -45,8 +45,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (fsetpos, (iop, pos), - FILE * iop, +fsetpos (FILE * iop, const _fpos_t * pos) { c99_fsetpos_t args; diff --git a/newlib/libc/machine/spu/ftell.c b/newlib/libc/machine/spu/ftell.c index 4782e5ea3..8e56983e5 100644 --- a/newlib/libc/machine/spu/ftell.c +++ b/newlib/libc/machine/spu/ftell.c @@ -38,8 +38,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY long -_DEFUN (ftell, (fp), - FILE * fp) +ftell (FILE * fp) { long ret; diff --git a/newlib/libc/machine/spu/fwrite.c b/newlib/libc/machine/spu/fwrite.c index 0db2f549b..84572af1d 100644 --- a/newlib/libc/machine/spu/fwrite.c +++ b/newlib/libc/machine/spu/fwrite.c @@ -49,8 +49,7 @@ typedef struct } c99_fwrite_t; size_t -_DEFUN (fwrite, (buf, size, count, fp), - const void *__restrict buf, +fwrite (const void *__restrict buf, size_t size, size_t count, FILE * fp) diff --git a/newlib/libc/machine/spu/perror.c b/newlib/libc/machine/spu/perror.c index 612467318..eae1419a1 100644 --- a/newlib/libc/machine/spu/perror.c +++ b/newlib/libc/machine/spu/perror.c @@ -14,8 +14,7 @@ typedef struct } c99_perror_t; void -_DEFUN (perror, (s), - const char *s) +perror (const char *s) { c99_perror_t arg; diff --git a/newlib/libc/machine/spu/puts.c b/newlib/libc/machine/spu/puts.c index 427508969..27bd2bd52 100644 --- a/newlib/libc/machine/spu/puts.c +++ b/newlib/libc/machine/spu/puts.c @@ -5,8 +5,7 @@ #ifndef _REENT_ONLY int -_DEFUN (puts, (s), - char const * s) +puts (char const * s) { CHECK_STD_INIT(_REENT); diff --git a/newlib/libc/machine/spu/rewind.c b/newlib/libc/machine/spu/rewind.c index 8d1a0a90f..e075fc7ee 100644 --- a/newlib/libc/machine/spu/rewind.c +++ b/newlib/libc/machine/spu/rewind.c @@ -37,8 +37,7 @@ Author: Joel Schopp #ifndef _REENT_ONLY void -_DEFUN (rewind, (fp), - FILE * fp) +rewind (FILE * fp) { int ret; diff --git a/newlib/libc/machine/spu/setbuf.c b/newlib/libc/machine/spu/setbuf.c index c942bb9a9..427d5dc8d 100644 --- a/newlib/libc/machine/spu/setbuf.c +++ b/newlib/libc/machine/spu/setbuf.c @@ -46,8 +46,7 @@ typedef struct #ifndef _REENT_ONLY void -_DEFUN (setbuf, (fp, buf), - FILE *__restrict fp, +setbuf (FILE *__restrict fp, char *__restrict buf) { c99_setbuf_t args; diff --git a/newlib/libc/machine/spu/setvbuf.c b/newlib/libc/machine/spu/setvbuf.c index a045cc37b..91c1cf3bf 100644 --- a/newlib/libc/machine/spu/setvbuf.c +++ b/newlib/libc/machine/spu/setvbuf.c @@ -50,8 +50,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (setvbuf, (fp, buf, mode, size), - FILE * fp, +setvbuf (FILE * fp, char *buf, int mode, size_t size) diff --git a/newlib/libc/machine/spu/stdio.c b/newlib/libc/machine/spu/stdio.c index 14332b475..2a308b8aa 100644 --- a/newlib/libc/machine/spu/stdio.c +++ b/newlib/libc/machine/spu/stdio.c @@ -39,8 +39,7 @@ Author: Kazunori Asayama static FILE __fp[SPE_FOPEN_MAX]; FILE * -_DEFUN (__sfp, (d), - struct _reent *d) +__sfp (struct _reent *d) { int i; for (i = 0; i < SPE_FOPEN_MAX; i++) { @@ -53,8 +52,7 @@ _DEFUN (__sfp, (d), } static void -_DEFUN (__cleanup, (s), - struct _reent *s) +__cleanup (struct _reent *s) { int i; for (i = 0; i < SPE_FOPEN_MAX; i++) { @@ -65,8 +63,7 @@ _DEFUN (__cleanup, (s), } void -_DEFUN (__sinit, (s), - struct _reent *s) +__sinit (struct _reent *s) { s->__cleanup = __cleanup; s->__sdidinit = 1; diff --git a/newlib/libc/machine/spu/tmpnam.c b/newlib/libc/machine/spu/tmpnam.c index 5cbf2793b..898a1a70f 100644 --- a/newlib/libc/machine/spu/tmpnam.c +++ b/newlib/libc/machine/spu/tmpnam.c @@ -35,8 +35,7 @@ Author: Joel Schopp #include "c99ppe.h" char * -_DEFUN (tmpnam, (s), - char *s) +tmpnam (char *s) { /* The return value gets written over buf */ diff --git a/newlib/libc/machine/spu/vfprintf.c b/newlib/libc/machine/spu/vfprintf.c index 90dcaef56..6e436421b 100644 --- a/newlib/libc/machine/spu/vfprintf.c +++ b/newlib/libc/machine/spu/vfprintf.c @@ -57,8 +57,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vfprintf, (fp, fmt0, ap), - FILE *__restrict fp, +vfprintf (FILE *__restrict fp, const char *__restrict fmt0, va_list ap) { diff --git a/newlib/libc/machine/spu/vfscanf.c b/newlib/libc/machine/spu/vfscanf.c index c22f76db7..9af12e91a 100644 --- a/newlib/libc/machine/spu/vfscanf.c +++ b/newlib/libc/machine/spu/vfscanf.c @@ -57,8 +57,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vfscanf, (fp, fmt, ap), - FILE *__restrict fp, +vfscanf (FILE *__restrict fp, const char *__restrict fmt, va_list ap) { diff --git a/newlib/libc/machine/spu/vprintf.c b/newlib/libc/machine/spu/vprintf.c index e99144623..29cac0c8d 100644 --- a/newlib/libc/machine/spu/vprintf.c +++ b/newlib/libc/machine/spu/vprintf.c @@ -23,8 +23,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vprintf, (fmt, ap), - const char *fmt, +vprintf (const char *fmt, va_list ap) { c99_vprintf_t args; diff --git a/newlib/libc/machine/spu/vscanf.c b/newlib/libc/machine/spu/vscanf.c index aae6bc45b..39348905d 100644 --- a/newlib/libc/machine/spu/vscanf.c +++ b/newlib/libc/machine/spu/vscanf.c @@ -55,8 +55,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vscanf, (fmt, ap), - const char *fmt, +vscanf (const char *fmt, va_list ap) { c99_vscanf_t args; diff --git a/newlib/libc/machine/spu/vsnprintf.c b/newlib/libc/machine/spu/vsnprintf.c index b30770d68..81ba7bef2 100644 --- a/newlib/libc/machine/spu/vsnprintf.c +++ b/newlib/libc/machine/spu/vsnprintf.c @@ -27,8 +27,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vsnprintf, (str, size, fmt, ap), - char *__restrict str, +vsnprintf (char *__restrict str, size_t size, const char *__restrict fmt, va_list ap) diff --git a/newlib/libc/machine/spu/vsprintf.c b/newlib/libc/machine/spu/vsprintf.c index 12461c08e..8b0e414de 100644 --- a/newlib/libc/machine/spu/vsprintf.c +++ b/newlib/libc/machine/spu/vsprintf.c @@ -26,8 +26,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vsprintf, (str, fmt, ap), - char *__restrict str, +vsprintf (char *__restrict str, const char *__restrict fmt, va_list ap) { diff --git a/newlib/libc/machine/spu/vsscanf.c b/newlib/libc/machine/spu/vsscanf.c index 7725e6822..a94b152d2 100644 --- a/newlib/libc/machine/spu/vsscanf.c +++ b/newlib/libc/machine/spu/vsscanf.c @@ -57,8 +57,7 @@ typedef struct #ifndef _REENT_ONLY int -_DEFUN (vsscanf, (str, fmt, ap), - const char *__restrict str, +vsscanf (const char *__restrict str, const char *__restrict fmt, va_list ap) { diff --git a/newlib/libc/misc/__dprintf.c b/newlib/libc/misc/__dprintf.c index 5fa30e0ab..592d714c2 100644 --- a/newlib/libc/misc/__dprintf.c +++ b/newlib/libc/misc/__dprintf.c @@ -177,8 +177,7 @@ parse_number (s, p) /* Fetch the number at S of SIZE bytes. */ static long -_DEFUN(get_number, (s, size, unsigned_p), - char *s, +get_number (char *s, long size, int unsigned_p) { @@ -220,8 +219,7 @@ _DEFUN(get_number, (s, size, unsigned_p), /* Print X in base BASE. */ static void -_DEFUN(print_number, (base, unsigned_p, n), - int base, +print_number (int base, int unsigned_p, long n) { @@ -254,8 +252,7 @@ _DEFUN(print_number, (base, unsigned_p, n), stdio is working. */ static void -_DEFUN(write_char, (c), - char c) +write_char (char c) { _write_r (_REENT, CONSOLE_FD, &c, 1); } @@ -265,8 +262,7 @@ _DEFUN(write_char, (c), stdio is working. */ static void -_DEFUN(write_string, (s), - const char *s) +write_string (const char *s) { _write_r (_REENT, CONSOLE_FD, s, strlen (s)); } diff --git a/newlib/libc/posix/_isatty.c b/newlib/libc/posix/_isatty.c index 7d6ccae7c..c4dcc1f9c 100644 --- a/newlib/libc/posix/_isatty.c +++ b/newlib/libc/posix/_isatty.c @@ -6,7 +6,7 @@ #include int -_DEFUN(_isatty, (fd), int fd) +_isatty (int fd) { struct stat buf; diff --git a/newlib/libc/posix/closedir.c b/newlib/libc/posix/closedir.c index 7801da043..032636d09 100644 --- a/newlib/libc/posix/closedir.c +++ b/newlib/libc/posix/closedir.c @@ -49,8 +49,7 @@ extern void _cleanupdir (DIR *dirp); * close a directory. */ int -_DEFUN(closedir, (dirp), - register DIR *dirp) +closedir (register DIR *dirp) { int rc; diff --git a/newlib/libc/posix/creat.c b/newlib/libc/posix/creat.c index 116f26ce3..fab807375 100644 --- a/newlib/libc/posix/creat.c +++ b/newlib/libc/posix/creat.c @@ -5,8 +5,7 @@ #include int -_DEFUN(creat, (path, mode), - const char *path, +creat (const char *path, mode_t mode) { return open (path, O_WRONLY | O_CREAT | O_TRUNC, mode); diff --git a/newlib/libc/posix/execl.c b/newlib/libc/posix/execl.c index e25f21917..6ba95e2dc 100644 --- a/newlib/libc/posix/execl.c +++ b/newlib/libc/posix/execl.c @@ -18,8 +18,7 @@ static char ***p_environ = &environ; #include int -_DEFUN(execl, (path, arg0, ...), - const char *path, +execl (const char *path, const char *arg0, ...) #else @@ -27,8 +26,7 @@ _DEFUN(execl, (path, arg0, ...), #include int -_DEFUN(execl, (path, arg0, va_alist), - const char *path, +execl (const char *path, const char *arg0, va_dcl) diff --git a/newlib/libc/posix/execle.c b/newlib/libc/posix/execle.c index 67387f545..641bdac72 100644 --- a/newlib/libc/posix/execle.c +++ b/newlib/libc/posix/execle.c @@ -13,8 +13,7 @@ #include int -_DEFUN(execle, (path, arg0, ...), - const char *path, +execle (const char *path, const char *arg0, ...) #else @@ -22,8 +21,7 @@ _DEFUN(execle, (path, arg0, ...), #include int -_DEFUN(execle, (path, arg0, va_alist), - const char *path, +execle (const char *path, const char *arg0, va_dcl) diff --git a/newlib/libc/posix/execlp.c b/newlib/libc/posix/execlp.c index f1de21f1c..41b300d8f 100644 --- a/newlib/libc/posix/execlp.c +++ b/newlib/libc/posix/execlp.c @@ -13,8 +13,7 @@ #include int -_DEFUN(execlp, (path, arg0, ...), - const char *path, +execlp (const char *path, const char *arg0, ...) #else @@ -22,8 +21,7 @@ _DEFUN(execlp, (path, arg0, ...), #include int -_DEFUN(execlp, (path, arg0, va_alist), - const char *path, +execlp (const char *path, const char *arg0, va_dcl) diff --git a/newlib/libc/posix/execv.c b/newlib/libc/posix/execv.c index 96220dd98..6a1052c26 100644 --- a/newlib/libc/posix/execv.c +++ b/newlib/libc/posix/execv.c @@ -14,8 +14,7 @@ static char ***p_environ = &environ; int -_DEFUN (execv, (path, argv), - const char *path, +execv (const char *path, char * const argv[]) { return _execve (path, (char * const *) argv, *p_environ); diff --git a/newlib/libc/posix/execve.c b/newlib/libc/posix/execve.c index c2a2144f5..99c145426 100644 --- a/newlib/libc/posix/execve.c +++ b/newlib/libc/posix/execve.c @@ -10,8 +10,7 @@ int -_DEFUN(execve, (path, argv, envp), - const char *path, +execve (const char *path, char * const argv[], char * const envp[]) { diff --git a/newlib/libc/posix/execvp.c b/newlib/libc/posix/execvp.c index 1c1fd3a01..be7e71cea 100644 --- a/newlib/libc/posix/execvp.c +++ b/newlib/libc/posix/execvp.c @@ -21,8 +21,7 @@ */ static char * -_DEFUN (strccpy, (s1, s2, c), - char *s1, +strccpy (char *s1, char *s2, char c) { @@ -36,8 +35,7 @@ _DEFUN (strccpy, (s1, s2, c), } int -_DEFUN (execvp, (file, argv), - const char *file, +execvp (const char *file, char * const argv[]) { char *path = getenv ("PATH"); diff --git a/newlib/libc/posix/isatty.c b/newlib/libc/posix/isatty.c index afd5ec85e..8a6740a55 100644 --- a/newlib/libc/posix/isatty.c +++ b/newlib/libc/posix/isatty.c @@ -4,7 +4,7 @@ #include int -_DEFUN(isatty, (fd), int fd) +isatty (int fd) { return _isatty (fd); } diff --git a/newlib/libc/posix/opendir.c b/newlib/libc/posix/opendir.c index ca764e156..1416f1053 100644 --- a/newlib/libc/posix/opendir.c +++ b/newlib/libc/posix/opendir.c @@ -47,8 +47,7 @@ static char sccsid[] = "@(#)opendir.c 5.11 (Berkeley) 2/23/91"; * open a directory. */ DIR * -_DEFUN(opendir, (name), - const char *name) +opendir (const char *name) { register DIR *dirp; register int fd; diff --git a/newlib/libc/posix/popen.c b/newlib/libc/posix/popen.c index bbd0fc424..04aca4c9f 100644 --- a/newlib/libc/posix/popen.c +++ b/newlib/libc/posix/popen.c @@ -109,8 +109,7 @@ static struct pid { } *pidlist; FILE * -_DEFUN(popen, (program, type), - const char *program, +popen (const char *program, const char *type) { struct pid *cur; @@ -197,8 +196,7 @@ _DEFUN(popen, (program, type), * if already `pclosed', or waitpid returns an error. */ int -_DEFUN(pclose, (iop), - FILE *iop) +pclose (FILE *iop) { register struct pid *cur, *last; int pstat; diff --git a/newlib/libc/posix/posix_spawn.c b/newlib/libc/posix/posix_spawn.c index cade6b005..19c5cd0fe 100644 --- a/newlib/libc/posix/posix_spawn.c +++ b/newlib/libc/posix/posix_spawn.c @@ -294,8 +294,7 @@ do_posix_spawn(pid_t *pid, const char *path, } int -_DEFUN(posix_spawn, (pid, path, fa, sa, argv, envp), - pid_t *pid, +posix_spawn (pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa, const posix_spawnattr_t *sa, @@ -306,8 +305,7 @@ _DEFUN(posix_spawn, (pid, path, fa, sa, argv, envp), } int -_DEFUN(posix_spawnp, (pid, path, fa, sa, argv, envp), - pid_t *pid, +posix_spawnp (pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa, const posix_spawnattr_t *sa, @@ -322,8 +320,7 @@ _DEFUN(posix_spawnp, (pid, path, fa, sa, argv, envp), */ int -_DEFUN(posix_spawn_file_actions_init, (ret), - posix_spawn_file_actions_t *ret) +posix_spawn_file_actions_init (posix_spawn_file_actions_t *ret) { posix_spawn_file_actions_t fa; @@ -337,8 +334,7 @@ _DEFUN(posix_spawn_file_actions_init, (ret), } int -_DEFUN(posix_spawn_file_actions_destroy, (fa), - posix_spawn_file_actions_t *fa) +posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *fa) { posix_spawn_file_actions_entry_t *fae; @@ -357,8 +353,7 @@ _DEFUN(posix_spawn_file_actions_destroy, (fa), } int -_DEFUN(posix_spawn_file_actions_addopen, (fa, fildes, path, oflag, mode), - posix_spawn_file_actions_t * __restrict fa, +posix_spawn_file_actions_addopen (posix_spawn_file_actions_t * __restrict fa, int fildes, const char * __restrict path, int oflag, @@ -392,8 +387,7 @@ _DEFUN(posix_spawn_file_actions_addopen, (fa, fildes, path, oflag, mode), } int -_DEFUN(posix_spawn_file_actions_adddup2, (fa, fildes, newfildes), - posix_spawn_file_actions_t *fa, +posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *fa, int fildes, int newfildes) { @@ -417,8 +411,7 @@ _DEFUN(posix_spawn_file_actions_adddup2, (fa, fildes, newfildes), } int -_DEFUN(posix_spawn_file_actions_addclose, (fa, fildes), - posix_spawn_file_actions_t *fa, +posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *fa, int fildes) { posix_spawn_file_actions_entry_t *fae; @@ -444,8 +437,7 @@ _DEFUN(posix_spawn_file_actions_addclose, (fa, fildes), */ int -_DEFUN(posix_spawnattr_init, (ret), - posix_spawnattr_t *ret) +posix_spawnattr_init (posix_spawnattr_t *ret) { posix_spawnattr_t sa; @@ -459,16 +451,14 @@ _DEFUN(posix_spawnattr_init, (ret), } int -_DEFUN(posix_spawnattr_destroy, (sa), - posix_spawnattr_t *sa) +posix_spawnattr_destroy (posix_spawnattr_t *sa) { free(*sa); return (0); } int -_DEFUN(posix_spawnattr_getflags, (sa, flags), - const posix_spawnattr_t * __restrict sa, +posix_spawnattr_getflags (const posix_spawnattr_t * __restrict sa, short * __restrict flags) { *flags = (*sa)->sa_flags; @@ -476,8 +466,7 @@ _DEFUN(posix_spawnattr_getflags, (sa, flags), } int -_DEFUN(posix_spawnattr_getpgroup, (sa, pgroup), - const posix_spawnattr_t * __restrict sa, +posix_spawnattr_getpgroup (const posix_spawnattr_t * __restrict sa, pid_t * __restrict pgroup) { *pgroup = (*sa)->sa_pgroup; @@ -485,8 +474,7 @@ _DEFUN(posix_spawnattr_getpgroup, (sa, pgroup), } int -_DEFUN(posix_spawnattr_getschedparam, (sa, schedparam), - const posix_spawnattr_t * __restrict sa, +posix_spawnattr_getschedparam (const posix_spawnattr_t * __restrict sa, struct sched_param * __restrict schedparam) { *schedparam = (*sa)->sa_schedparam; @@ -494,8 +482,7 @@ _DEFUN(posix_spawnattr_getschedparam, (sa, schedparam), } int -_DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy), - const posix_spawnattr_t * __restrict sa, +posix_spawnattr_getschedpolicy (const posix_spawnattr_t * __restrict sa, int * __restrict schedpolicy) { *schedpolicy = (*sa)->sa_schedpolicy; @@ -503,8 +490,7 @@ _DEFUN(posix_spawnattr_getschedpolicy, (sa, schedpolicy), } int -_DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault), - const posix_spawnattr_t * __restrict sa, +posix_spawnattr_getsigdefault (const posix_spawnattr_t * __restrict sa, sigset_t * __restrict sigdefault) { *sigdefault = (*sa)->sa_sigdefault; @@ -512,8 +498,7 @@ _DEFUN(posix_spawnattr_getsigdefault, (sa, sigdefault), } int -_DEFUN(posix_spawnattr_getsigmask, (sa, sigmask), - const posix_spawnattr_t * __restrict sa, +posix_spawnattr_getsigmask (const posix_spawnattr_t * __restrict sa, sigset_t * __restrict sigmask) { *sigmask = (*sa)->sa_sigmask; @@ -521,8 +506,7 @@ _DEFUN(posix_spawnattr_getsigmask, (sa, sigmask), } int -_DEFUN(posix_spawnattr_setflags, (sa, flags), - posix_spawnattr_t *sa, +posix_spawnattr_setflags (posix_spawnattr_t *sa, short flags) { (*sa)->sa_flags = flags; @@ -530,8 +514,7 @@ _DEFUN(posix_spawnattr_setflags, (sa, flags), } int -_DEFUN(posix_spawnattr_setpgroup, (sa, pgroup), - posix_spawnattr_t *sa, +posix_spawnattr_setpgroup (posix_spawnattr_t *sa, pid_t pgroup) { (*sa)->sa_pgroup = pgroup; @@ -539,8 +522,7 @@ _DEFUN(posix_spawnattr_setpgroup, (sa, pgroup), } int -_DEFUN(posix_spawnattr_setschedparam, (sa, schedparam), - posix_spawnattr_t * __restrict sa, +posix_spawnattr_setschedparam (posix_spawnattr_t * __restrict sa, const struct sched_param * __restrict schedparam) { (*sa)->sa_schedparam = *schedparam; @@ -548,8 +530,7 @@ _DEFUN(posix_spawnattr_setschedparam, (sa, schedparam), } int -_DEFUN(posix_spawnattr_setschedpolicy, (sa, schedpolicy), - posix_spawnattr_t *sa, +posix_spawnattr_setschedpolicy (posix_spawnattr_t *sa, int schedpolicy) { (*sa)->sa_schedpolicy = schedpolicy; @@ -557,8 +538,7 @@ _DEFUN(posix_spawnattr_setschedpolicy, (sa, schedpolicy), } int -_DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault), - posix_spawnattr_t * __restrict sa, +posix_spawnattr_setsigdefault (posix_spawnattr_t * __restrict sa, const sigset_t * __restrict sigdefault) { (*sa)->sa_sigdefault = *sigdefault; @@ -566,8 +546,7 @@ _DEFUN(posix_spawnattr_setsigdefault, (sa, sigdefault), } int -_DEFUN(posix_spawnattr_setsigmask, (sa, sigmask), - posix_spawnattr_t * __restrict sa, +posix_spawnattr_setsigmask (posix_spawnattr_t * __restrict sa, const sigset_t * __restrict sigmask) { (*sa)->sa_sigmask = *sigmask; diff --git a/newlib/libc/posix/readdir.c b/newlib/libc/posix/readdir.c index 3e620e328..40608f93c 100644 --- a/newlib/libc/posix/readdir.c +++ b/newlib/libc/posix/readdir.c @@ -45,8 +45,7 @@ extern int getdents (int fd, void *dp, int count); * get next entry in a directory. */ struct dirent * -_DEFUN(readdir, (dirp), - register DIR *dirp) +readdir (register DIR *dirp) { register struct dirent *dp; diff --git a/newlib/libc/posix/readdir_r.c b/newlib/libc/posix/readdir_r.c index a75eee9a3..8f4a98293 100644 --- a/newlib/libc/posix/readdir_r.c +++ b/newlib/libc/posix/readdir_r.c @@ -50,8 +50,7 @@ extern int getdents (int fd, void *dp, int count); * get next entry in a directory using supplied dirent structure. */ int -_DEFUN(readdir_r, (dirp, dp, dpp), - register DIR *__restrict dirp, +readdir_r (register DIR *__restrict dirp, struct dirent *__restrict dp, struct dirent **__restrict dpp) { diff --git a/newlib/libc/posix/rewinddir.c b/newlib/libc/posix/rewinddir.c index f9ca9f7d4..930b79afc 100644 --- a/newlib/libc/posix/rewinddir.c +++ b/newlib/libc/posix/rewinddir.c @@ -42,8 +42,7 @@ static char sccsid[] = "@(#)rewinddir.c 5.1 (Berkeley) 5/25/90"; #include void -_DEFUN(rewinddir, (dirp), - DIR *dirp) +rewinddir (DIR *dirp) { #ifdef HAVE_DD_LOCK __lock_acquire_recursive(dirp->dd_lock); diff --git a/newlib/libc/posix/scandir.c b/newlib/libc/posix/scandir.c index 0ffe68971..d95cff378 100644 --- a/newlib/libc/posix/scandir.c +++ b/newlib/libc/posix/scandir.c @@ -68,8 +68,7 @@ static char sccsid[] = "@(#)scandir.c 5.10 (Berkeley) 2/23/91"; #endif int -_DEFUN(scandir, (dirname, namelist, select, dcomp), - const char *dirname, +scandir (const char *dirname, struct dirent ***namelist, int (*select) __P((const struct dirent *)), int (*dcomp) __P((const struct dirent **, const struct dirent **))) @@ -169,8 +168,7 @@ cleanup: * Alphabetic order comparison routine for those who want it. */ int -_DEFUN(alphasort, (d1, d2), - const struct dirent **d1, +alphasort (const struct dirent **d1, const struct dirent **d2) { return(strcmp((*d1)->d_name, (*d2)->d_name)); diff --git a/newlib/libc/posix/seekdir.c b/newlib/libc/posix/seekdir.c index f876d7075..6ffeb1415 100644 --- a/newlib/libc/posix/seekdir.c +++ b/newlib/libc/posix/seekdir.c @@ -46,8 +46,7 @@ static char sccsid[] = "@(#)seekdir.c 5.7 (Berkeley) 6/1/90"; * _seekdir is in telldir.c so that it can share opaque data structures. */ void -_DEFUN(seekdir, (dirp, loc), - DIR *dirp, +seekdir (DIR *dirp, long loc) { #ifdef HAVE_DD_LOCK diff --git a/newlib/libc/posix/telldir.c b/newlib/libc/posix/telldir.c index 9c945fcf7..af86d8d4f 100644 --- a/newlib/libc/posix/telldir.c +++ b/newlib/libc/posix/telldir.c @@ -81,8 +81,7 @@ __LOCK_INIT(static, __dd_hash_mutex); #if !defined(_ELIX_LEVEL) || (_ELIX_LEVEL >= 2) long -_DEFUN(telldir, (dirp), - DIR *dirp) +telldir (DIR *dirp) { register int index; register struct ddloc *lp; @@ -119,8 +118,7 @@ _DEFUN(telldir, (dirp), * Only values returned by "telldir" should be passed to seekdir. */ void -_DEFUN(_seekdir, (dirp, loc), - register DIR *dirp, +_seekdir (register DIR *dirp, long loc) { register struct ddloc *lp; @@ -173,8 +171,7 @@ found: /* clean out any hash entries from a closed directory */ void -_DEFUN(_cleanupdir, (dirp), - register DIR *dirp) +_cleanupdir (register DIR *dirp) { int i; diff --git a/newlib/libc/reent/execr.c b/newlib/libc/reent/execr.c index 0dc531384..59b61223e 100644 --- a/newlib/libc/reent/execr.c +++ b/newlib/libc/reent/execr.c @@ -45,8 +45,7 @@ DESCRIPTION */ int -_DEFUN (_execve_r, (ptr, name, argv, env), - struct _reent *ptr, +_execve_r (struct _reent *ptr, const char *name, char *const argv[], char *const env[]) @@ -81,8 +80,7 @@ DESCRIPTION #ifndef NO_FORK int -_DEFUN (_fork_r, (ptr), - struct _reent *ptr) +_fork_r (struct _reent *ptr) { int ret; @@ -113,8 +111,7 @@ DESCRIPTION */ int -_DEFUN (_wait_r, (ptr, status), - struct _reent *ptr, +_wait_r (struct _reent *ptr, int *status) { int ret; diff --git a/newlib/libc/reent/fcntlr.c b/newlib/libc/reent/fcntlr.c index fdfe41090..cd19d226f 100644 --- a/newlib/libc/reent/fcntlr.c +++ b/newlib/libc/reent/fcntlr.c @@ -40,8 +40,7 @@ DESCRIPTION */ int -_DEFUN (_fcntl_r, (ptr, fd, cmd, arg), - struct _reent *ptr, +_fcntl_r (struct _reent *ptr, int fd, int cmd, int arg) diff --git a/newlib/libc/reent/fstat64r.c b/newlib/libc/reent/fstat64r.c index 06a89a5c8..c546f5c1d 100644 --- a/newlib/libc/reent/fstat64r.c +++ b/newlib/libc/reent/fstat64r.c @@ -47,8 +47,7 @@ DESCRIPTION */ int -_DEFUN (_fstat64_r, (ptr, fd, pstat), - struct _reent *ptr, +_fstat64_r (struct _reent *ptr, int fd, struct stat64 *pstat) { diff --git a/newlib/libc/reent/gettimeofdayr.c b/newlib/libc/reent/gettimeofdayr.c index 80942afb0..9b982a993 100644 --- a/newlib/libc/reent/gettimeofdayr.c +++ b/newlib/libc/reent/gettimeofdayr.c @@ -52,8 +52,7 @@ DESCRIPTION */ int -_DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone), - struct _reent *ptr, +_gettimeofday_r (struct _reent *ptr, struct timeval *ptimeval, void *ptimezone) { diff --git a/newlib/libc/reent/linkr.c b/newlib/libc/reent/linkr.c index 5e85f2d2e..b22da5f94 100644 --- a/newlib/libc/reent/linkr.c +++ b/newlib/libc/reent/linkr.c @@ -43,8 +43,7 @@ DESCRIPTION */ int -_DEFUN (_link_r, (ptr, old, new), - struct _reent *ptr, +_link_r (struct _reent *ptr, const char *old, const char *new) { diff --git a/newlib/libc/reent/lseek64r.c b/newlib/libc/reent/lseek64r.c index 2f16f0bca..40769fb6d 100644 --- a/newlib/libc/reent/lseek64r.c +++ b/newlib/libc/reent/lseek64r.c @@ -41,8 +41,7 @@ DESCRIPTION */ _off64_t -_DEFUN (_lseek64_r, (ptr, fd, pos, whence), - struct _reent *ptr, +_lseek64_r (struct _reent *ptr, int fd, _off64_t pos, int whence) diff --git a/newlib/libc/reent/lseekr.c b/newlib/libc/reent/lseekr.c index 639158912..ac2daaab9 100644 --- a/newlib/libc/reent/lseekr.c +++ b/newlib/libc/reent/lseekr.c @@ -38,8 +38,7 @@ DESCRIPTION */ _off_t -_DEFUN (_lseek_r, (ptr, fd, pos, whence), - struct _reent *ptr, +_lseek_r (struct _reent *ptr, int fd, _off_t pos, int whence) diff --git a/newlib/libc/reent/mkdirr.c b/newlib/libc/reent/mkdirr.c index dca20dc2c..fd72df64c 100644 --- a/newlib/libc/reent/mkdirr.c +++ b/newlib/libc/reent/mkdirr.c @@ -40,8 +40,7 @@ DESCRIPTION #include int -_DEFUN (_mkdir_r, (ptr, path, mode), - struct _reent *ptr, +_mkdir_r (struct _reent *ptr, const char *path, int mode) { diff --git a/newlib/libc/reent/openr.c b/newlib/libc/reent/openr.c index 33ace75ad..c6a7db5de 100644 --- a/newlib/libc/reent/openr.c +++ b/newlib/libc/reent/openr.c @@ -39,8 +39,7 @@ DESCRIPTION */ int -_DEFUN (_open_r, (ptr, file, flags, mode), - struct _reent *ptr, +_open_r (struct _reent *ptr, const char *file, int flags, int mode) diff --git a/newlib/libc/reent/readr.c b/newlib/libc/reent/readr.c index 9a3a694cc..7fccefd32 100644 --- a/newlib/libc/reent/readr.c +++ b/newlib/libc/reent/readr.c @@ -38,8 +38,7 @@ DESCRIPTION */ _ssize_t -_DEFUN (_read_r, (ptr, fd, buf, cnt), - struct _reent *ptr, +_read_r (struct _reent *ptr, int fd, void *buf, size_t cnt) diff --git a/newlib/libc/reent/reent.c b/newlib/libc/reent/reent.c index a98c3110c..7c57e2019 100644 --- a/newlib/libc/reent/reent.c +++ b/newlib/libc/reent/reent.c @@ -30,8 +30,7 @@ int errno; /* Interim cleanup code */ void -_DEFUN (cleanup_glue, (ptr, glue), - struct _reent *ptr, +cleanup_glue (struct _reent *ptr, struct _glue *glue) { /* Have to reclaim these in reverse order: */ @@ -42,8 +41,7 @@ _DEFUN (cleanup_glue, (ptr, glue), } void -_DEFUN (_reclaim_reent, (ptr), - struct _reent *ptr) +_reclaim_reent (struct _reent *ptr) { if (ptr != _impure_ptr) { diff --git a/newlib/libc/reent/renamer.c b/newlib/libc/reent/renamer.c index 736c1a30f..5420dc4a0 100644 --- a/newlib/libc/reent/renamer.c +++ b/newlib/libc/reent/renamer.c @@ -40,8 +40,7 @@ DESCRIPTION */ int -_DEFUN (_rename_r, (ptr, old, new), - struct _reent *ptr, +_rename_r (struct _reent *ptr, const char *old, const char *new) { diff --git a/newlib/libc/reent/sbrkr.c b/newlib/libc/reent/sbrkr.c index 0bc4163c1..21c4bd913 100644 --- a/newlib/libc/reent/sbrkr.c +++ b/newlib/libc/reent/sbrkr.c @@ -41,8 +41,7 @@ DESCRIPTION */ void * -_DEFUN (_sbrk_r, (ptr, incr), - struct _reent *ptr, +_sbrk_r (struct _reent *ptr, ptrdiff_t incr) { char *ret; diff --git a/newlib/libc/reent/signalr.c b/newlib/libc/reent/signalr.c index 9229061d5..345910e4b 100644 --- a/newlib/libc/reent/signalr.c +++ b/newlib/libc/reent/signalr.c @@ -43,8 +43,7 @@ DESCRIPTION */ int -_DEFUN (_kill_r, (ptr, pid, sig), - struct _reent *ptr, +_kill_r (struct _reent *ptr, int pid, int sig) { @@ -78,8 +77,7 @@ DESCRIPTION */ int -_DEFUN (_getpid_r, (ptr), - struct _reent *ptr) +_getpid_r (struct _reent *ptr) { int ret; ret = _getpid (); diff --git a/newlib/libc/reent/stat64r.c b/newlib/libc/reent/stat64r.c index 2077c0a2e..b64736ef2 100644 --- a/newlib/libc/reent/stat64r.c +++ b/newlib/libc/reent/stat64r.c @@ -45,8 +45,7 @@ DESCRIPTION */ int -_DEFUN (_stat64_r, (ptr, file, pstat), - struct _reent *ptr, +_stat64_r (struct _reent *ptr, const char *file, struct stat64 *pstat) { diff --git a/newlib/libc/reent/statr.c b/newlib/libc/reent/statr.c index fb27ab0c0..9388e0246 100644 --- a/newlib/libc/reent/statr.c +++ b/newlib/libc/reent/statr.c @@ -45,8 +45,7 @@ DESCRIPTION */ int -_DEFUN (_stat_r, (ptr, file, pstat), - struct _reent *ptr, +_stat_r (struct _reent *ptr, const char *file, struct stat *pstat) { diff --git a/newlib/libc/reent/timesr.c b/newlib/libc/reent/timesr.c index dbe6a4ef0..bb890035a 100644 --- a/newlib/libc/reent/timesr.c +++ b/newlib/libc/reent/timesr.c @@ -44,8 +44,7 @@ DESCRIPTION */ clock_t -_DEFUN (_times_r, (ptr, ptms), - struct _reent *ptr, +_times_r (struct _reent *ptr, struct tms *ptms) { clock_t ret; diff --git a/newlib/libc/reent/unlinkr.c b/newlib/libc/reent/unlinkr.c index 0ef0ff56e..41bac0194 100644 --- a/newlib/libc/reent/unlinkr.c +++ b/newlib/libc/reent/unlinkr.c @@ -38,8 +38,7 @@ DESCRIPTION */ int -_DEFUN (_unlink_r, (ptr, file), - struct _reent *ptr, +_unlink_r (struct _reent *ptr, const char *file) { int ret; diff --git a/newlib/libc/reent/writer.c b/newlib/libc/reent/writer.c index 8d4b37530..704aba18b 100644 --- a/newlib/libc/reent/writer.c +++ b/newlib/libc/reent/writer.c @@ -38,8 +38,7 @@ DESCRIPTION */ _ssize_t -_DEFUN (_write_r, (ptr, fd, buf, cnt), - struct _reent *ptr, +_write_r (struct _reent *ptr, int fd, const void *buf, size_t cnt) diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index 79a489680..2f1dc9d77 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -56,8 +56,7 @@ No supporting OS subroutines are required. #include void * -_DEFUN (bsearch, (key, base, nmemb, size, compar), - const void *key, +bsearch (const void *key, const void *base, size_t nmemb, size_t size, diff --git a/newlib/libc/search/hash.c b/newlib/libc/search/hash.c index f20322c42..af2be9aa8 100644 --- a/newlib/libc/search/hash.c +++ b/newlib/libc/search/hash.c @@ -104,8 +104,7 @@ int hash_accesses, hash_collisions, hash_expansions, hash_overflows; /* OPEN/CLOSE */ extern DB * -_DEFUN(__hash_open, (file, flags, mode, info, dflags), - const char *file, +__hash_open (const char *file, int flags, int mode, int dflags, diff --git a/newlib/libc/search/hcreate.c b/newlib/libc/search/hcreate.c index 5472de1f0..7664353cc 100644 --- a/newlib/libc/search/hcreate.c +++ b/newlib/libc/search/hcreate.c @@ -57,7 +57,7 @@ __RCSID("$NetBSD: hcreate.c,v 1.2 2001/02/19 21:26:04 ross Exp $"); static struct hsearch_data htab; int -_DEFUN(hcreate, (nel), size_t nel) +hcreate (size_t nel) { return hcreate_r (nel, &htab); } @@ -69,8 +69,7 @@ hdestroy (void) } ENTRY * -_DEFUN(hsearch, (item, action), - ENTRY item, +hsearch (ENTRY item, ACTION action) { ENTRY *retval; diff --git a/newlib/libc/search/qsort.c b/newlib/libc/search/qsort.c index 6c84b95b7..db3f58951 100644 --- a/newlib/libc/search/qsort.c +++ b/newlib/libc/search/qsort.c @@ -100,8 +100,7 @@ static inline void swapfunc (char *, char *, int, int); es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; static inline void -_DEFUN(swapfunc, (a, b, n, swaptype), - char *a, +swapfunc (char *a, char *b, int n, int swaptype) @@ -131,8 +130,7 @@ _DEFUN(swapfunc, (a, b, n, swaptype), #endif static inline char * -_DEFUN(med3, (a, b, c, cmp, thunk), - char *a, +med3 (char *a, char *b, char *c, cmp_t *cmp, @@ -149,16 +147,14 @@ __unused #if defined(I_AM_QSORT_R) void -_DEFUN(__bsd_qsort_r, (a, n, es, thunk, cmp), - void *a, +__bsd_qsort_r (void *a, size_t n, size_t es, void *thunk, cmp_t *cmp) #elif defined(I_AM_GNU_QSORT_R) void -_DEFUN(qsort_r, (a, n, es, cmp, thunk), - void *a, +qsort_r (void *a, size_t n, size_t es, cmp_t *cmp, @@ -166,8 +162,7 @@ _DEFUN(qsort_r, (a, n, es, cmp, thunk), #else #define thunk NULL void -_DEFUN(qsort, (a, n, es, cmp), - void *a, +qsort (void *a, size_t n, size_t es, cmp_t *cmp) diff --git a/newlib/libc/search/tdelete.c b/newlib/libc/search/tdelete.c index a0128e98b..a595200db 100644 --- a/newlib/libc/search/tdelete.c +++ b/newlib/libc/search/tdelete.c @@ -26,8 +26,7 @@ __RCSID("$NetBSD: tdelete.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); /* delete node with given key */ void * -_DEFUN(tdelete, (vkey, vrootp, compar), - const void *__restrict vkey, /* key to be deleted */ +tdelete (const void *__restrict vkey, /* key to be deleted */ void **__restrict vrootp, /* address of the root of tree */ int (*compar)(const void *, const void *)) { diff --git a/newlib/libc/search/tdestroy.c b/newlib/libc/search/tdestroy.c index e1418207a..04c6b7052 100644 --- a/newlib/libc/search/tdestroy.c +++ b/newlib/libc/search/tdestroy.c @@ -40,8 +40,7 @@ trecurse(root, free_action) } void -_DEFUN(tdestroy, (vrootp, freefct), - void *vrootp, +tdestroy (void *vrootp, void (*freefct)(void *)) { node_t *root = (node_t *) vrootp; diff --git a/newlib/libc/search/tfind.c b/newlib/libc/search/tfind.c index 108213048..670f41fca 100644 --- a/newlib/libc/search/tfind.c +++ b/newlib/libc/search/tfind.c @@ -25,8 +25,7 @@ __RCSID("$NetBSD: tfind.c,v 1.2 1999/09/16 11:45:37 lukem Exp $"); /* find a node, or return 0 */ void * -_DEFUN(tfind, (vkey, vrootp, compar), - const void *vkey, /* key to be found */ +tfind (const void *vkey, /* key to be found */ void **vrootp, /* address of the tree root */ int (*compar)(const void *, const void *)) { diff --git a/newlib/libc/search/tsearch.c b/newlib/libc/search/tsearch.c index 8fe265703..82d69447f 100644 --- a/newlib/libc/search/tsearch.c +++ b/newlib/libc/search/tsearch.c @@ -25,8 +25,7 @@ __RCSID("$NetBSD: tsearch.c,v 1.3 1999/09/16 11:45:37 lukem Exp $"); /* find or insert datum into search tree */ void * -_DEFUN(tsearch, (vkey, vrootp, compar), - const void *vkey, /* key to be located */ +tsearch (const void *vkey, /* key to be located */ void **vrootp, /* address of tree root */ int (*compar)(const void *, const void *)) { diff --git a/newlib/libc/search/twalk.c b/newlib/libc/search/twalk.c index 26d6e97db..02ef52242 100644 --- a/newlib/libc/search/twalk.c +++ b/newlib/libc/search/twalk.c @@ -49,8 +49,7 @@ trecurse(root, action, level) /* Walk the nodes of a tree */ void -_DEFUN(twalk, (vroot, action), - const void *vroot, /* Root of the tree to be walked */ +twalk (const void *vroot, /* Root of the tree to be walked */ void (*action)(const void *, VISIT, int)) { if (vroot != NULL && action != NULL) diff --git a/newlib/libc/signal/psignal.c b/newlib/libc/signal/psignal.c index a62f8ae01..602714f49 100644 --- a/newlib/libc/signal/psignal.c +++ b/newlib/libc/signal/psignal.c @@ -34,8 +34,7 @@ Supporting OS subroutines required: <>, <>, <>, #include void -_DEFUN(psignal, (sig, s), - int sig, +psignal (int sig, const char *s) { if (s != NULL && *s != '\0') diff --git a/newlib/libc/signal/raise.c b/newlib/libc/signal/raise.c index 6f93686e6..c678c6e2d 100644 --- a/newlib/libc/signal/raise.c +++ b/newlib/libc/signal/raise.c @@ -52,8 +52,7 @@ int _dummy_raise; #ifndef _REENT_ONLY int -_DEFUN (raise, (sig), - int sig) +raise (int sig) { return _raise_r (_REENT, sig); } @@ -61,8 +60,7 @@ _DEFUN (raise, (sig), #endif int -_DEFUN (_raise_r, (reent, sig), - struct _reent *reent, +_raise_r (struct _reent *reent, int sig) { return _kill_r (reent, _getpid_r (reent), sig); diff --git a/newlib/libc/signal/signal.c b/newlib/libc/signal/signal.c index f5fe4c0b9..0110287d8 100644 --- a/newlib/libc/signal/signal.c +++ b/newlib/libc/signal/signal.c @@ -89,8 +89,7 @@ int _dummy_simulated_signal; #include <_syslist.h> int -_DEFUN (_init_signal_r, (ptr), - struct _reent *ptr) +_init_signal_r (struct _reent *ptr) { int i; @@ -108,8 +107,7 @@ _DEFUN (_init_signal_r, (ptr), } _sig_func_ptr -_DEFUN (_signal_r, (ptr, sig, func), - struct _reent *ptr, +_signal_r (struct _reent *ptr, int sig, _sig_func_ptr func) { @@ -131,8 +129,7 @@ _DEFUN (_signal_r, (ptr, sig, func), } int -_DEFUN (_raise_r, (ptr, sig), - struct _reent *ptr, +_raise_r (struct _reent *ptr, int sig) { _sig_func_ptr func; @@ -166,8 +163,7 @@ _DEFUN (_raise_r, (ptr, sig), } int -_DEFUN (__sigtramp_r, (ptr, sig), - struct _reent *ptr, +__sigtramp_r (struct _reent *ptr, int sig) { _sig_func_ptr func; @@ -198,15 +194,13 @@ _DEFUN (__sigtramp_r, (ptr, sig), #ifndef _REENT_ONLY int -_DEFUN (raise, (sig), - int sig) +raise (int sig) { return _raise_r (_REENT, sig); } _sig_func_ptr -_DEFUN (signal, (sig, func), - int sig, +signal (int sig, _sig_func_ptr func) { return _signal_r (_REENT, sig, func); @@ -219,7 +213,7 @@ _init_signal (void) } int -_DEFUN (__sigtramp, (sig), int sig) +__sigtramp (int sig) { return __sigtramp_r (_REENT, sig); } diff --git a/newlib/libc/stdio/asiprintf.c b/newlib/libc/stdio/asiprintf.c index ec60e3ed4..ce6d0a972 100644 --- a/newlib/libc/stdio/asiprintf.c +++ b/newlib/libc/stdio/asiprintf.c @@ -25,8 +25,7 @@ #include "local.h" int -_DEFUN(_asiprintf_r, (ptr, strp, fmt), - struct _reent *ptr, +_asiprintf_r (struct _reent *ptr, char **strp, const char *fmt, ...) { @@ -53,8 +52,7 @@ _DEFUN(_asiprintf_r, (ptr, strp, fmt), #ifndef _REENT_ONLY int -_DEFUN(asiprintf, (strp, fmt), - char **strp, +asiprintf (char **strp, const char *fmt, ...) { int ret; diff --git a/newlib/libc/stdio/asniprintf.c b/newlib/libc/stdio/asniprintf.c index ba4772f08..0bfe00d9b 100644 --- a/newlib/libc/stdio/asniprintf.c +++ b/newlib/libc/stdio/asniprintf.c @@ -14,8 +14,7 @@ #include "local.h" char * -_DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt), - struct _reent *ptr, +_asniprintf_r (struct _reent *ptr, char *buf, size_t *lenp, const char *fmt, ...) @@ -61,8 +60,7 @@ _DEFUN(_asniprintf_r, (ptr, buf, lenp, fmt), #ifndef _REENT_ONLY char * -_DEFUN(asniprintf, (buf, lenp, fmt), - char *buf, +asniprintf (char *buf, size_t *lenp, const char *fmt, ...) { diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c index c9a37dbf1..34639dc09 100644 --- a/newlib/libc/stdio/asnprintf.c +++ b/newlib/libc/stdio/asnprintf.c @@ -14,8 +14,7 @@ #include "local.h" char * -_DEFUN(_asnprintf_r, (ptr, buf, lenp, fmt), - struct _reent *__restrict ptr, +_asnprintf_r (struct _reent *__restrict ptr, char *buf, size_t *lenp, const char *__restrict fmt, ...) @@ -67,8 +66,7 @@ _EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...) #ifndef _REENT_ONLY char * -_DEFUN(asnprintf, (buf, lenp, fmt), - char *__restrict buf, +asnprintf (char *__restrict buf, size_t *__restrict lenp, const char *__restrict fmt, ...) { diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c index b3d9122f5..330491ebe 100644 --- a/newlib/libc/stdio/asprintf.c +++ b/newlib/libc/stdio/asprintf.c @@ -25,8 +25,7 @@ #include "local.h" int -_DEFUN(_asprintf_r, (ptr, strp, fmt), - struct _reent *ptr, +_asprintf_r (struct _reent *ptr, char **__restrict strp, const char *__restrict fmt, ...) { @@ -59,8 +58,7 @@ _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...) #ifndef _REENT_ONLY int -_DEFUN(asprintf, (strp, fmt), - char **__restrict strp, +asprintf (char **__restrict strp, const char *__restrict fmt, ...) { int ret; diff --git a/newlib/libc/stdio/clearerr.c b/newlib/libc/stdio/clearerr.c index 23e3c18e3..be83d6dd9 100644 --- a/newlib/libc/stdio/clearerr.c +++ b/newlib/libc/stdio/clearerr.c @@ -72,8 +72,7 @@ No supporting OS subroutines are required. #undef clearerr void -_DEFUN(clearerr, (fp), - FILE * fp) +clearerr (FILE * fp) { CHECK_INIT(_REENT, fp); _newlib_flockfile_start (fp); diff --git a/newlib/libc/stdio/clearerr_u.c b/newlib/libc/stdio/clearerr_u.c index 7514fa2e9..4952f777c 100644 --- a/newlib/libc/stdio/clearerr_u.c +++ b/newlib/libc/stdio/clearerr_u.c @@ -33,8 +33,7 @@ #undef clearerr_unlocked void -_DEFUN(clearerr_unlocked, (fp), - FILE * fp) +clearerr_unlocked (FILE * fp) { CHECK_INIT(_REENT, fp); __sclearerr (fp); diff --git a/newlib/libc/stdio/diprintf.c b/newlib/libc/stdio/diprintf.c index 0059e044b..8ac58354a 100644 --- a/newlib/libc/stdio/diprintf.c +++ b/newlib/libc/stdio/diprintf.c @@ -49,8 +49,7 @@ Supporting OS subroutines required: <>, <>. #include int -_DEFUN(_diprintf_r, (ptr, fd, format), - struct _reent *ptr, +_diprintf_r (struct _reent *ptr, int fd, const char *format, ...) { @@ -66,8 +65,7 @@ _DEFUN(_diprintf_r, (ptr, fd, format), #ifndef _REENT_ONLY int -_DEFUN(diprintf, (fd, format), - int fd, +diprintf (int fd, const char *format, ...) { va_list ap; diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c index 5fd45049b..1493e1f18 100644 --- a/newlib/libc/stdio/dprintf.c +++ b/newlib/libc/stdio/dprintf.c @@ -53,8 +53,7 @@ Supporting OS subroutines required: <>, <>. #include "local.h" int -_DEFUN(_dprintf_r, (ptr, fd, format), - struct _reent *ptr, +_dprintf_r (struct _reent *ptr, int fd, const char *__restrict format, ...) { @@ -76,8 +75,7 @@ _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...) #ifndef _REENT_ONLY int -_DEFUN(dprintf, (fd, format), - int fd, +dprintf (int fd, const char *__restrict format, ...) { va_list ap; diff --git a/newlib/libc/stdio/fclose.c b/newlib/libc/stdio/fclose.c index 264d2e48f..1c36057a7 100644 --- a/newlib/libc/stdio/fclose.c +++ b/newlib/libc/stdio/fclose.c @@ -56,8 +56,7 @@ Required OS subroutines: <>, <>, <>, <>, #include "local.h" int -_DEFUN(_fclose_r, (rptr, fp), - struct _reent *rptr, +_fclose_r (struct _reent *rptr, register FILE * fp) { int r; @@ -121,8 +120,7 @@ _DEFUN(_fclose_r, (rptr, fp), #ifndef _REENT_ONLY int -_DEFUN(fclose, (fp), - register FILE * fp) +fclose (register FILE * fp) { return _fclose_r(_REENT, fp); } diff --git a/newlib/libc/stdio/fcloseall.c b/newlib/libc/stdio/fcloseall.c index 659172b32..2e78b4b3c 100644 --- a/newlib/libc/stdio/fcloseall.c +++ b/newlib/libc/stdio/fcloseall.c @@ -57,8 +57,7 @@ Required OS subroutines: <>, <>, <>, <>, #include "local.h" int -_DEFUN(_fcloseall_r, (ptr), - struct _reent *ptr) +_fcloseall_r (struct _reent *ptr) { return _fwalk_reent (ptr, _fclose_r); } diff --git a/newlib/libc/stdio/fdopen.c b/newlib/libc/stdio/fdopen.c index 876a94117..854c0183d 100644 --- a/newlib/libc/stdio/fdopen.c +++ b/newlib/libc/stdio/fdopen.c @@ -53,8 +53,7 @@ PORTABILITY #include <_syslist.h> FILE * -_DEFUN(_fdopen_r, (ptr, fd, mode), - struct _reent *ptr, +_fdopen_r (struct _reent *ptr, int fd, const char *mode) { @@ -123,8 +122,7 @@ _DEFUN(_fdopen_r, (ptr, fd, mode), #ifndef _REENT_ONLY FILE * -_DEFUN(fdopen, (fd, mode), - int fd, +fdopen (int fd, const char *mode) { return _fdopen_r (_REENT, fd, mode); diff --git a/newlib/libc/stdio/feof.c b/newlib/libc/stdio/feof.c index 617ce58df..879417936 100644 --- a/newlib/libc/stdio/feof.c +++ b/newlib/libc/stdio/feof.c @@ -65,8 +65,7 @@ No supporting OS subroutines are required. #undef feof int -_DEFUN(feof, (fp), - FILE * fp) +feof (FILE * fp) { int result; CHECK_INIT(_REENT, fp); diff --git a/newlib/libc/stdio/feof_u.c b/newlib/libc/stdio/feof_u.c index 48fc4af47..e9238e113 100644 --- a/newlib/libc/stdio/feof_u.c +++ b/newlib/libc/stdio/feof_u.c @@ -32,8 +32,7 @@ #undef feof_unlocked int -_DEFUN(feof_unlocked, (fp), - FILE * fp) +feof_unlocked (FILE * fp) { CHECK_INIT(_REENT, fp); return __sfeof (fp); diff --git a/newlib/libc/stdio/ferror.c b/newlib/libc/stdio/ferror.c index f99df2311..3bff52045 100644 --- a/newlib/libc/stdio/ferror.c +++ b/newlib/libc/stdio/ferror.c @@ -74,8 +74,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef ferror int -_DEFUN(ferror, (fp), - FILE * fp) +ferror (FILE * fp) { int result; CHECK_INIT(_REENT, fp); diff --git a/newlib/libc/stdio/ferror_u.c b/newlib/libc/stdio/ferror_u.c index 9b9edba24..ae1e278fd 100644 --- a/newlib/libc/stdio/ferror_u.c +++ b/newlib/libc/stdio/ferror_u.c @@ -33,8 +33,7 @@ #undef ferror_unlocked int -_DEFUN(ferror_unlocked, (fp), - FILE * fp) +ferror_unlocked (FILE * fp) { CHECK_INIT(_REENT, fp); return __sferror (fp); diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c index 18d6d3e74..e958af9fc 100644 --- a/newlib/libc/stdio/fflush.c +++ b/newlib/libc/stdio/fflush.c @@ -100,8 +100,7 @@ No supporting OS subroutines are required. /* Core function which does not lock file pointer. This gets called directly from __srefill. */ int -_DEFUN(__sflush_r, (ptr, fp), - struct _reent *ptr, +__sflush_r (struct _reent *ptr, register FILE * fp) { register unsigned char *p; @@ -239,8 +238,7 @@ _DEFUN(__sflush_r, (ptr, fp), and we don't want to move the underlying file pointer unless we're writing. */ int -_DEFUN(__sflushw_r, (ptr, fp), - struct _reent *ptr, +__sflushw_r (struct _reent *ptr, register FILE *fp) { return (fp->_flags & __SWR) ? __sflush_r (ptr, fp) : 0; @@ -250,8 +248,7 @@ _DEFUN(__sflushw_r, (ptr, fp), #endif /* __IMPL_UNLOCKED__ */ int -_DEFUN(_fflush_r, (ptr, fp), - struct _reent *ptr, +_fflush_r (struct _reent *ptr, register FILE * fp) { int ret; @@ -286,8 +283,7 @@ _DEFUN(_fflush_r, (ptr, fp), #ifndef _REENT_ONLY int -_DEFUN(fflush, (fp), - register FILE * fp) +fflush (register FILE * fp) { if (fp == NULL) return _fwalk_reent (_GLOBAL_REENT, _fflush_r); diff --git a/newlib/libc/stdio/fgetc.c b/newlib/libc/stdio/fgetc.c index 45404d30e..7d0d4842c 100644 --- a/newlib/libc/stdio/fgetc.c +++ b/newlib/libc/stdio/fgetc.c @@ -85,8 +85,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" int -_DEFUN(_fgetc_r, (ptr, fp), - struct _reent * ptr, +_fgetc_r (struct _reent * ptr, FILE * fp) { int result; @@ -100,8 +99,7 @@ _DEFUN(_fgetc_r, (ptr, fp), #ifndef _REENT_ONLY int -_DEFUN(fgetc, (fp), - FILE * fp) +fgetc (FILE * fp) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) int result; diff --git a/newlib/libc/stdio/fgetc_u.c b/newlib/libc/stdio/fgetc_u.c index 45ee3b1b5..9a5719c29 100644 --- a/newlib/libc/stdio/fgetc_u.c +++ b/newlib/libc/stdio/fgetc_u.c @@ -29,8 +29,7 @@ #include "local.h" int -_DEFUN(_fgetc_unlocked_r, (ptr, fp), - struct _reent * ptr, +_fgetc_unlocked_r (struct _reent * ptr, FILE * fp) { CHECK_INIT(ptr, fp); @@ -40,8 +39,7 @@ _DEFUN(_fgetc_unlocked_r, (ptr, fp), #ifndef _REENT_ONLY int -_DEFUN(fgetc_unlocked, (fp), - FILE * fp) +fgetc_unlocked (FILE * fp) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fgetpos.c b/newlib/libc/stdio/fgetpos.c index 373adfd8e..b4f681281 100644 --- a/newlib/libc/stdio/fgetpos.c +++ b/newlib/libc/stdio/fgetpos.c @@ -65,8 +65,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(_fgetpos_r, (ptr, fp, pos), - struct _reent * ptr, +_fgetpos_r (struct _reent * ptr, FILE *__restrict fp, _fpos_t *__restrict pos) { @@ -82,8 +81,7 @@ _DEFUN(_fgetpos_r, (ptr, fp, pos), #ifndef _REENT_ONLY int -_DEFUN(fgetpos, (fp, pos), - FILE *__restrict fp, +fgetpos (FILE *__restrict fp, _fpos_t *__restrict pos) { return _fgetpos_r (_REENT, fp, pos); diff --git a/newlib/libc/stdio/fgets.c b/newlib/libc/stdio/fgets.c index c6ef6d3d5..7adfb2179 100644 --- a/newlib/libc/stdio/fgets.c +++ b/newlib/libc/stdio/fgets.c @@ -94,8 +94,7 @@ Supporting OS subroutines required: <>, <>, <>, */ char * -_DEFUN(_fgets_r, (ptr, buf, n, fp), - struct _reent * ptr, +_fgets_r (struct _reent * ptr, char *__restrict buf, int n, FILE *__restrict fp) @@ -189,8 +188,7 @@ _DEFUN(_fgets_r, (ptr, buf, n, fp), #ifndef _REENT_ONLY char * -_DEFUN(fgets, (buf, n, fp), - char *__restrict buf, +fgets (char *__restrict buf, int n, FILE *__restrict fp) { diff --git a/newlib/libc/stdio/fgetwc.c b/newlib/libc/stdio/fgetwc.c index 718b53a16..522697e9b 100644 --- a/newlib/libc/stdio/fgetwc.c +++ b/newlib/libc/stdio/fgetwc.c @@ -125,8 +125,7 @@ PORTABILITY #include "local.h" wint_t -_DEFUN(__fgetwc, (ptr, fp), - struct _reent *ptr, +__fgetwc (struct _reent *ptr, register FILE *fp) { wchar_t wc; @@ -172,8 +171,7 @@ _DEFUN(__fgetwc, (ptr, fp), } wint_t -_DEFUN(_fgetwc_r, (ptr, fp), - struct _reent *ptr, +_fgetwc_r (struct _reent *ptr, register FILE *fp) { wint_t r; @@ -186,8 +184,7 @@ _DEFUN(_fgetwc_r, (ptr, fp), } wint_t -_DEFUN(fgetwc, (fp), - FILE *fp) +fgetwc (FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fgetwc_u.c b/newlib/libc/stdio/fgetwc_u.c index f3a4fea61..cbb97360b 100644 --- a/newlib/libc/stdio/fgetwc_u.c +++ b/newlib/libc/stdio/fgetwc_u.c @@ -30,8 +30,7 @@ #include "local.h" wint_t -_DEFUN(_fgetwc_unlocked_r, (ptr, fp), - struct _reent *ptr, +_fgetwc_unlocked_r (struct _reent *ptr, register FILE *fp) { ORIENT(fp, 1); @@ -39,8 +38,7 @@ _DEFUN(_fgetwc_unlocked_r, (ptr, fp), } wint_t -_DEFUN(fgetwc_unlocked, (fp), - FILE *fp) +fgetwc_unlocked (FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fgetws.c b/newlib/libc/stdio/fgetws.c index 8ca95d170..c942806c6 100644 --- a/newlib/libc/stdio/fgetws.c +++ b/newlib/libc/stdio/fgetws.c @@ -99,8 +99,7 @@ PORTABILITY #endif wchar_t * -_DEFUN(_fgetws_r, (ptr, ws, n, fp), - struct _reent *ptr, +_fgetws_r (struct _reent *ptr, wchar_t * ws, int n, FILE * fp) @@ -172,8 +171,7 @@ error: } wchar_t * -_DEFUN(fgetws, (ws, n, fp), - wchar_t *__restrict ws, +fgetws (wchar_t *__restrict ws, int n, FILE *__restrict fp) { diff --git a/newlib/libc/stdio/fileno.c b/newlib/libc/stdio/fileno.c index 949a381f8..ceb83f834 100644 --- a/newlib/libc/stdio/fileno.c +++ b/newlib/libc/stdio/fileno.c @@ -63,8 +63,7 @@ Supporting OS subroutines required: none. #include "local.h" int -_DEFUN(fileno, (f), - FILE * f) +fileno (FILE * f) { int result; CHECK_INIT (_REENT, f); diff --git a/newlib/libc/stdio/fileno_u.c b/newlib/libc/stdio/fileno_u.c index 468d1127e..830a07d2b 100644 --- a/newlib/libc/stdio/fileno_u.c +++ b/newlib/libc/stdio/fileno_u.c @@ -30,8 +30,7 @@ #include "local.h" int -_DEFUN(fileno_unlocked, (f), - FILE * f) +fileno_unlocked (FILE * f) { int result; CHECK_INIT (_REENT, f); diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index 031b98b49..cf924536f 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -44,8 +44,7 @@ _NOINLINE_STATIC void #else static void #endif -_DEFUN(std, (ptr, flags, file), - FILE *ptr, +std (FILE *ptr, int flags, int file) { @@ -124,8 +123,7 @@ struct glue_with_file { }; struct _glue * -_DEFUN(__sfmoreglue, (d, n), - struct _reent *d, +__sfmoreglue (struct _reent *d, register int n) { struct glue_with_file *g; @@ -146,8 +144,7 @@ _DEFUN(__sfmoreglue, (d, n), */ FILE * -_DEFUN(__sfp, (d), - struct _reent *d) +__sfp (struct _reent *d) { FILE *fp; int n; @@ -204,8 +201,7 @@ found: */ void -_DEFUN(_cleanup_r, (ptr), - struct _reent *ptr) +_cleanup_r (struct _reent *ptr) { int (*cleanup_func) (struct _reent *, FILE *); #ifdef _STDIO_BSD_SEMANTICS @@ -246,8 +242,7 @@ _cleanup (void) */ void -_DEFUN(__sinit, (s), - struct _reent *s) +__sinit (struct _reent *s) { __sinit_lock_acquire (); @@ -329,8 +324,7 @@ __sinit_lock_release (void) /* Walkable file locking routine. */ static int -_DEFUN(__fp_lock, (ptr), - FILE * ptr) +__fp_lock (FILE * ptr) { if (!(ptr->_flags2 & __SNLK)) _flockfile (ptr); @@ -340,8 +334,7 @@ _DEFUN(__fp_lock, (ptr), /* Walkable file unlocking routine. */ static int -_DEFUN(__fp_unlock, (ptr), - FILE * ptr) +__fp_unlock (FILE * ptr) { if (!(ptr->_flags2 & __SNLK)) _funlockfile (ptr); diff --git a/newlib/libc/stdio/fiprintf.c b/newlib/libc/stdio/fiprintf.c index e86bf86e5..ff0946287 100644 --- a/newlib/libc/stdio/fiprintf.c +++ b/newlib/libc/stdio/fiprintf.c @@ -22,8 +22,7 @@ #include int -_DEFUN(_fiprintf_r, (ptr, fp, fmt), - struct _reent *ptr, +_fiprintf_r (struct _reent *ptr, FILE * fp, const char *fmt, ...) { @@ -39,8 +38,7 @@ _DEFUN(_fiprintf_r, (ptr, fp, fmt), #ifndef _REENT_ONLY int -_DEFUN(fiprintf, (fp, fmt), - FILE * fp, +fiprintf (FILE * fp, const char *fmt, ...) { int ret; diff --git a/newlib/libc/stdio/flags.c b/newlib/libc/stdio/flags.c index b8f660ec4..71fc1f60a 100644 --- a/newlib/libc/stdio/flags.c +++ b/newlib/libc/stdio/flags.c @@ -30,8 +30,7 @@ */ int -_DEFUN(__sflags, (ptr, mode, optr), - struct _reent *ptr, +__sflags (struct _reent *ptr, register char *mode, int *optr) { diff --git a/newlib/libc/stdio/fmemopen.c b/newlib/libc/stdio/fmemopen.c index 6a6153fbd..0d043520e 100644 --- a/newlib/libc/stdio/fmemopen.c +++ b/newlib/libc/stdio/fmemopen.c @@ -83,8 +83,7 @@ typedef struct fmemcookie { /* Read up to non-zero N bytes into BUF from stream described by COOKIE; return number of bytes read (0 on EOF). */ static _READ_WRITE_RETURN_TYPE -_DEFUN(fmemreader, (ptr, cookie, buf, n), - struct _reent *ptr, +fmemreader (struct _reent *ptr, void *cookie, char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -103,8 +102,7 @@ _DEFUN(fmemreader, (ptr, cookie, buf, n), /* Write up to non-zero N bytes of BUF into the stream described by COOKIE, returning the number of bytes written or EOF on failure. */ static _READ_WRITE_RETURN_TYPE -_DEFUN(fmemwriter, (ptr, cookie, buf, n), - struct _reent *ptr, +fmemwriter (struct _reent *ptr, void *cookie, const char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -159,8 +157,7 @@ _DEFUN(fmemwriter, (ptr, cookie, buf, n), /* Seek to position POS relative to WHENCE within stream described by COOKIE; return resulting position or fail with EOF. */ static _fpos_t -_DEFUN(fmemseeker, (ptr, cookie, pos, whence), - struct _reent *ptr, +fmemseeker (struct _reent *ptr, void *cookie, _fpos_t pos, int whence) @@ -214,8 +211,7 @@ _DEFUN(fmemseeker, (ptr, cookie, pos, whence), COOKIE; return resulting position or fail with EOF. */ #ifdef __LARGE64_FILES static _fpos64_t -_DEFUN(fmemseeker64, (ptr, cookie, pos, whence), - struct _reent *ptr, +fmemseeker64 (struct _reent *ptr, void *cookie, _fpos64_t pos, int whence) @@ -256,8 +252,7 @@ _DEFUN(fmemseeker64, (ptr, cookie, pos, whence), /* Reclaim resources used by stream described by COOKIE. */ static int -_DEFUN(fmemcloser, (ptr, cookie), - struct _reent *ptr, +fmemcloser (struct _reent *ptr, void *cookie) { fmemcookie *c = (fmemcookie *) cookie; @@ -268,8 +263,7 @@ _DEFUN(fmemcloser, (ptr, cookie), /* Open a memstream around buffer BUF of SIZE bytes, using MODE. Return the new stream, or fail with NULL. */ FILE * -_DEFUN(_fmemopen_r, (ptr, buf, size, mode), - struct _reent *ptr, +_fmemopen_r (struct _reent *ptr, void *__restrict buf, size_t size, const char *__restrict mode) @@ -361,8 +355,7 @@ _DEFUN(_fmemopen_r, (ptr, buf, size, mode), #ifndef _REENT_ONLY FILE * -_DEFUN(fmemopen, (buf, size, mode), - void *__restrict buf, +fmemopen (void *__restrict buf, size_t size, const char *__restrict mode) { diff --git a/newlib/libc/stdio/fopen.c b/newlib/libc/stdio/fopen.c index 57268945f..022992b8d 100644 --- a/newlib/libc/stdio/fopen.c +++ b/newlib/libc/stdio/fopen.c @@ -113,8 +113,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include "local.h" FILE * -_DEFUN(_fopen_r, (ptr, file, mode), - struct _reent *ptr, +_fopen_r (struct _reent *ptr, const char *__restrict file, const char *__restrict mode) { @@ -163,8 +162,7 @@ _DEFUN(_fopen_r, (ptr, file, mode), #ifndef _REENT_ONLY FILE * -_DEFUN(fopen, (file, mode), - const char *file, +fopen (const char *file, const char *mode) { return _fopen_r (_REENT, file, mode); diff --git a/newlib/libc/stdio/fopencookie.c b/newlib/libc/stdio/fopencookie.c index 4ea1ab1d1..0861528e0 100644 --- a/newlib/libc/stdio/fopencookie.c +++ b/newlib/libc/stdio/fopencookie.c @@ -98,8 +98,7 @@ typedef struct fccookie { } fccookie; static _READ_WRITE_RETURN_TYPE -_DEFUN(fcreader, (ptr, cookie, buf, n), - struct _reent *ptr, +fcreader (struct _reent *ptr, void *cookie, char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -113,8 +112,7 @@ _DEFUN(fcreader, (ptr, cookie, buf, n), } static _READ_WRITE_RETURN_TYPE -_DEFUN(fcwriter, (ptr, cookie, buf, n), - struct _reent *ptr, +fcwriter (struct _reent *ptr, void *cookie, const char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -136,8 +134,7 @@ _DEFUN(fcwriter, (ptr, cookie, buf, n), } static _fpos_t -_DEFUN(fcseeker, (ptr, cookie, pos, whence), - struct _reent *ptr, +fcseeker (struct _reent *ptr, void *cookie, _fpos_t pos, int whence) @@ -164,8 +161,7 @@ _DEFUN(fcseeker, (ptr, cookie, pos, whence), #ifdef __LARGE64_FILES static _fpos64_t -_DEFUN(fcseeker64, (ptr, cookie, pos, whence), - struct _reent *ptr, +fcseeker64 (struct _reent *ptr, void *cookie, _fpos64_t pos, int whence) @@ -180,8 +176,7 @@ _DEFUN(fcseeker64, (ptr, cookie, pos, whence), #endif /* __LARGE64_FILES */ static int -_DEFUN(fccloser, (ptr, cookie), - struct _reent *ptr, +fccloser (struct _reent *ptr, void *cookie) { int result = 0; @@ -197,8 +192,7 @@ _DEFUN(fccloser, (ptr, cookie), } FILE * -_DEFUN(_fopencookie_r, (ptr, cookie, mode, functions), - struct _reent *ptr, +_fopencookie_r (struct _reent *ptr, void *cookie, const char *mode, cookie_io_functions_t functions) @@ -253,8 +247,7 @@ _DEFUN(_fopencookie_r, (ptr, cookie, mode, functions), #ifndef _REENT_ONLY FILE * -_DEFUN(fopencookie, (cookie, mode, functions), - void *cookie, +fopencookie (void *cookie, const char *mode, cookie_io_functions_t functions) { diff --git a/newlib/libc/stdio/fprintf.c b/newlib/libc/stdio/fprintf.c index 9dab2cd19..4c03b1a02 100644 --- a/newlib/libc/stdio/fprintf.c +++ b/newlib/libc/stdio/fprintf.c @@ -22,8 +22,7 @@ #include int -_DEFUN(_fprintf_r, (ptr, fp, fmt), - struct _reent *ptr, +_fprintf_r (struct _reent *ptr, FILE *__restrict fp, const char *__restrict fmt, ...) { @@ -45,8 +44,7 @@ _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...) #ifndef _REENT_ONLY int -_DEFUN(fprintf, (fp, fmt), - FILE *__restrict fp, +fprintf (FILE *__restrict fp, const char *__restrict fmt, ...) { int ret; diff --git a/newlib/libc/stdio/fpurge.c b/newlib/libc/stdio/fpurge.c index acd177a69..2e4f61ec9 100644 --- a/newlib/libc/stdio/fpurge.c +++ b/newlib/libc/stdio/fpurge.c @@ -60,8 +60,7 @@ No supporting OS subroutines are required. /* Discard I/O from a single file. */ int -_DEFUN(_fpurge_r, (ptr, fp), - struct _reent *ptr, +_fpurge_r (struct _reent *ptr, register FILE * fp) { int t; @@ -93,8 +92,7 @@ _DEFUN(_fpurge_r, (ptr, fp), #ifndef _REENT_ONLY int -_DEFUN(fpurge, (fp), - register FILE * fp) +fpurge (register FILE * fp) { return _fpurge_r (_REENT, fp); } @@ -102,8 +100,7 @@ _DEFUN(fpurge, (fp), #ifndef __rtems__ void -_DEFUN(__fpurge, (fp), - register FILE * fp) +__fpurge (register FILE * fp) { _fpurge_r (_REENT, fp); } diff --git a/newlib/libc/stdio/fputc.c b/newlib/libc/stdio/fputc.c index 452bb2961..1385cadea 100644 --- a/newlib/libc/stdio/fputc.c +++ b/newlib/libc/stdio/fputc.c @@ -87,8 +87,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" int -_DEFUN(_fputc_r, (ptr, ch, file), - struct _reent *ptr, +_fputc_r (struct _reent *ptr, int ch, FILE * file) { @@ -102,8 +101,7 @@ _DEFUN(_fputc_r, (ptr, ch, file), #ifndef _REENT_ONLY int -_DEFUN(fputc, (ch, file), - int ch, +fputc (int ch, FILE * file) { #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED) diff --git a/newlib/libc/stdio/fputc_u.c b/newlib/libc/stdio/fputc_u.c index 27690e213..9e16069bc 100644 --- a/newlib/libc/stdio/fputc_u.c +++ b/newlib/libc/stdio/fputc_u.c @@ -29,8 +29,7 @@ #include "local.h" int -_DEFUN(_fputc_unlocked_r, (ptr, ch, file), - struct _reent *ptr, +_fputc_unlocked_r (struct _reent *ptr, int ch, FILE * file) { @@ -40,8 +39,7 @@ _DEFUN(_fputc_unlocked_r, (ptr, ch, file), #ifndef _REENT_ONLY int -_DEFUN(fputc_unlocked, (ch, file), - int ch, +fputc_unlocked (int ch, FILE * file) { #if !defined(__OPTIMIZE_SIZE__) && !defined(PREFER_SIZE_OVER_SPEED) diff --git a/newlib/libc/stdio/fputs.c b/newlib/libc/stdio/fputs.c index 0fd051bad..7a1eadb12 100644 --- a/newlib/libc/stdio/fputs.c +++ b/newlib/libc/stdio/fputs.c @@ -86,8 +86,7 @@ Supporting OS subroutines required: <>, <>, <>, * Write the given string to the given file. */ int -_DEFUN(_fputs_r, (ptr, s, fp), - struct _reent * ptr, +_fputs_r (struct _reent * ptr, char const *__restrict s, FILE *__restrict fp) { @@ -135,8 +134,7 @@ error: #ifndef _REENT_ONLY int -_DEFUN(fputs, (s, fp), - char const *__restrict s, +fputs (char const *__restrict s, FILE *__restrict fp) { return _fputs_r (_REENT, s, fp); diff --git a/newlib/libc/stdio/fputwc.c b/newlib/libc/stdio/fputwc.c index 4943cef99..9a4e80d52 100644 --- a/newlib/libc/stdio/fputwc.c +++ b/newlib/libc/stdio/fputwc.c @@ -128,8 +128,7 @@ PORTABILITY #include "local.h" wint_t -_DEFUN(__fputwc, (ptr, wc, fp), - struct _reent *ptr, +__fputwc (struct _reent *ptr, wchar_t wc, FILE *fp) { @@ -163,8 +162,7 @@ _DEFUN(__fputwc, (ptr, wc, fp), } wint_t -_DEFUN(_fputwc_r, (ptr, wc, fp), - struct _reent *ptr, +_fputwc_r (struct _reent *ptr, wchar_t wc, FILE *fp) { @@ -178,8 +176,7 @@ _DEFUN(_fputwc_r, (ptr, wc, fp), } wint_t -_DEFUN(fputwc, (wc, fp), - wchar_t wc, +fputwc (wchar_t wc, FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fputwc_u.c b/newlib/libc/stdio/fputwc_u.c index 4d4f07a0a..d4e51532a 100644 --- a/newlib/libc/stdio/fputwc_u.c +++ b/newlib/libc/stdio/fputwc_u.c @@ -30,8 +30,7 @@ #include "local.h" wint_t -_DEFUN(_fputwc_unlocked_r, (ptr, wc, fp), - struct _reent *ptr, +_fputwc_unlocked_r (struct _reent *ptr, wchar_t wc, FILE *fp) { @@ -40,8 +39,7 @@ _DEFUN(_fputwc_unlocked_r, (ptr, wc, fp), } wint_t -_DEFUN(fputwc_unlocked, (wc, fp), - wchar_t wc, +fputwc_unlocked (wchar_t wc, FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fputws.c b/newlib/libc/stdio/fputws.c index 8a470fcfb..92f2cbf6a 100644 --- a/newlib/libc/stdio/fputws.c +++ b/newlib/libc/stdio/fputws.c @@ -94,8 +94,7 @@ PORTABILITY #endif int -_DEFUN(_fputws_r, (ptr, ws, fp), - struct _reent *ptr, +_fputws_r (struct _reent *ptr, const wchar_t *ws, FILE *fp) { @@ -158,8 +157,7 @@ error: } int -_DEFUN(fputws, (ws, fp), - const wchar_t *__restrict ws, +fputws (const wchar_t *__restrict ws, FILE *__restrict fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/fread.c b/newlib/libc/stdio/fread.c index c9180b833..b358d2b4a 100644 --- a/newlib/libc/stdio/fread.c +++ b/newlib/libc/stdio/fread.c @@ -93,8 +93,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef __SCLE static size_t -_DEFUN(crlf_r, (ptr, fp, buf, count, eof), - struct _reent * ptr, +crlf_r (struct _reent * ptr, FILE * fp, char * buf, size_t count, @@ -142,8 +141,7 @@ _DEFUN(crlf_r, (ptr, fp, buf, count, eof), #endif size_t -_DEFUN(_fread_r, (ptr, buf, size, count, fp), - struct _reent * ptr, +_fread_r (struct _reent * ptr, void *__restrict buf, size_t size, size_t count, @@ -260,8 +258,7 @@ _DEFUN(_fread_r, (ptr, buf, size, count, fp), #ifndef _REENT_ONLY size_t -_DEFUN(fread, (buf, size, count, fp), - void *__restrict buf, +fread (void *__restrict buf, size_t size, size_t count, FILE *__restrict fp) diff --git a/newlib/libc/stdio/freopen.c b/newlib/libc/stdio/freopen.c index 46cbd81ce..0af1c1ecd 100644 --- a/newlib/libc/stdio/freopen.c +++ b/newlib/libc/stdio/freopen.c @@ -75,8 +75,7 @@ Supporting OS subroutines required: <>, <>, <>, */ FILE * -_DEFUN(_freopen_r, (ptr, file, mode, fp), - struct _reent *ptr, +_freopen_r (struct _reent *ptr, const char *__restrict file, const char *__restrict mode, register FILE *__restrict fp) @@ -243,8 +242,7 @@ _DEFUN(_freopen_r, (ptr, file, mode, fp), #ifndef _REENT_ONLY FILE * -_DEFUN(freopen, (file, mode, fp), - const char *__restrict file, +freopen (const char *__restrict file, const char *__restrict mode, register FILE *__restrict fp) { diff --git a/newlib/libc/stdio/fseek.c b/newlib/libc/stdio/fseek.c index 4b8a1e099..9b3ea986c 100644 --- a/newlib/libc/stdio/fseek.c +++ b/newlib/libc/stdio/fseek.c @@ -81,8 +81,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" int -_DEFUN(_fseek_r, (ptr, fp, offset, whence), - struct _reent *ptr, +_fseek_r (struct _reent *ptr, register FILE *fp, long offset, int whence) @@ -93,8 +92,7 @@ _DEFUN(_fseek_r, (ptr, fp, offset, whence), #ifndef _REENT_ONLY int -_DEFUN(fseek, (fp, offset, whence), - register FILE *fp, +fseek (register FILE *fp, long offset, int whence) { diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c index a2ed1b5b5..7ca86161c 100644 --- a/newlib/libc/stdio/fseeko.c +++ b/newlib/libc/stdio/fseeko.c @@ -93,8 +93,7 @@ Supporting OS subroutines required: <>, <>, <>, */ int -_DEFUN(_fseeko_r, (ptr, fp, offset, whence), - struct _reent *ptr, +_fseeko_r (struct _reent *ptr, register FILE *fp, _off_t offset, int whence) @@ -359,8 +358,7 @@ dumb: #ifndef _REENT_ONLY int -_DEFUN(fseeko, (fp, offset, whence), - register FILE *fp, +fseeko (register FILE *fp, _off_t offset, int whence) { diff --git a/newlib/libc/stdio/fsetlocking.c b/newlib/libc/stdio/fsetlocking.c index e27aa42fc..062b93a92 100644 --- a/newlib/libc/stdio/fsetlocking.c +++ b/newlib/libc/stdio/fsetlocking.c @@ -65,8 +65,7 @@ No supporting OS subroutines are required. #include "local.h" int -_DEFUN(__fsetlocking, (fp, type), - FILE * fp, +__fsetlocking (FILE * fp, int type) { int result; diff --git a/newlib/libc/stdio/fsetpos.c b/newlib/libc/stdio/fsetpos.c index d765081a6..b5334e251 100644 --- a/newlib/libc/stdio/fsetpos.c +++ b/newlib/libc/stdio/fsetpos.c @@ -59,8 +59,7 @@ Supporting OS subroutines required: <>, <>, <>, #include int -_DEFUN(_fsetpos_r, (ptr, iop, pos), - struct _reent * ptr, +_fsetpos_r (struct _reent * ptr, FILE * iop, const _fpos_t * pos) { @@ -74,8 +73,7 @@ _DEFUN(_fsetpos_r, (ptr, iop, pos), #ifndef _REENT_ONLY int -_DEFUN(fsetpos, (iop, pos), - FILE * iop, +fsetpos (FILE * iop, const _fpos_t * pos) { return _fsetpos_r (_REENT, iop, pos); diff --git a/newlib/libc/stdio/ftell.c b/newlib/libc/stdio/ftell.c index 1260d5ef4..e4a246199 100644 --- a/newlib/libc/stdio/ftell.c +++ b/newlib/libc/stdio/ftell.c @@ -83,8 +83,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include "local.h" long -_DEFUN(_ftell_r, (ptr, fp), - struct _reent *ptr, +_ftell_r (struct _reent *ptr, register FILE * fp) { _fpos_t pos; @@ -101,8 +100,7 @@ _DEFUN(_ftell_r, (ptr, fp), #ifndef _REENT_ONLY long -_DEFUN(ftell, (fp), - register FILE * fp) +ftell (register FILE * fp) { return _ftell_r (_REENT, fp); } diff --git a/newlib/libc/stdio/ftello.c b/newlib/libc/stdio/ftello.c index 9d04a4516..d083b9359 100644 --- a/newlib/libc/stdio/ftello.c +++ b/newlib/libc/stdio/ftello.c @@ -83,8 +83,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include "local.h" _off_t -_DEFUN(_ftello_r, (ptr, fp), - struct _reent * ptr, +_ftello_r (struct _reent * ptr, register FILE * fp) { _fpos_t pos; @@ -153,8 +152,7 @@ _DEFUN(_ftello_r, (ptr, fp), #ifndef _REENT_ONLY _off_t -_DEFUN(ftello, (fp), - register FILE * fp) +ftello (register FILE * fp) { return _ftello_r (_REENT, fp); } diff --git a/newlib/libc/stdio/funopen.c b/newlib/libc/stdio/funopen.c index 23bed7b8e..a1c0d767d 100644 --- a/newlib/libc/stdio/funopen.c +++ b/newlib/libc/stdio/funopen.c @@ -104,8 +104,7 @@ typedef struct funcookie { } funcookie; static _READ_WRITE_RETURN_TYPE -_DEFUN(funreader, (ptr, cookie, buf, n), - struct _reent *ptr, +funreader (struct _reent *ptr, void *cookie, char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -119,8 +118,7 @@ _DEFUN(funreader, (ptr, cookie, buf, n), } static _READ_WRITE_RETURN_TYPE -_DEFUN(funwriter, (ptr, cookie, buf, n), - struct _reent *ptr, +funwriter (struct _reent *ptr, void *cookie, const char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -134,8 +132,7 @@ _DEFUN(funwriter, (ptr, cookie, buf, n), } static _fpos_t -_DEFUN(funseeker, (ptr, cookie, off, whence), - struct _reent *ptr, +funseeker (struct _reent *ptr, void *cookie, _fpos_t off, int whence) @@ -162,8 +159,7 @@ _DEFUN(funseeker, (ptr, cookie, off, whence), #ifdef __LARGE64_FILES static _fpos64_t -_DEFUN(funseeker64, (ptr, cookie, off, whence), - struct _reent *ptr, +funseeker64 (struct _reent *ptr, void *cookie, _fpos64_t off, int whence) @@ -178,8 +174,7 @@ _DEFUN(funseeker64, (ptr, cookie, off, whence), #endif /* __LARGE64_FILES */ static int -_DEFUN(funcloser, (ptr, cookie), - struct _reent *ptr, +funcloser (struct _reent *ptr, void *cookie) { int result = 0; @@ -195,8 +190,7 @@ _DEFUN(funcloser, (ptr, cookie), } FILE * -_DEFUN(_funopen_r, (ptr, cookie, readfn, writefn, seekfn, closefn), - struct _reent *ptr, +_funopen_r (struct _reent *ptr, const void *cookie, funread readfn, funwrite writefn, @@ -267,8 +261,7 @@ _DEFUN(_funopen_r, (ptr, cookie, readfn, writefn, seekfn, closefn), #ifndef _REENT_ONLY FILE * -_DEFUN(funopen, (cookie, readfn, writefn, seekfn, closefn), - const void *cookie, +funopen (const void *cookie, funread readfn, funwrite writefn, funseek seekfn, diff --git a/newlib/libc/stdio/fvwrite.c b/newlib/libc/stdio/fvwrite.c index d742784e5..3e3a0c6a2 100644 --- a/newlib/libc/stdio/fvwrite.c +++ b/newlib/libc/stdio/fvwrite.c @@ -45,8 +45,7 @@ */ int -_DEFUN(__sfvwrite_r, (ptr, fp, uio), - struct _reent *ptr, +__sfvwrite_r (struct _reent *ptr, register FILE *fp, register struct __suio *uio) { diff --git a/newlib/libc/stdio/fwalk.c b/newlib/libc/stdio/fwalk.c index 8b7b5b0e3..b4b285a64 100644 --- a/newlib/libc/stdio/fwalk.c +++ b/newlib/libc/stdio/fwalk.c @@ -28,8 +28,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include "local.h" int -_DEFUN(_fwalk, (ptr, function), - struct _reent *ptr, +_fwalk (struct _reent *ptr, register int (*function) (FILE *)) { register FILE *fp; @@ -55,8 +54,7 @@ _DEFUN(_fwalk, (ptr, function), /* Special version of __fwalk where the function pointer is a reentrant I/O function (e.g. _fclose_r). */ int -_DEFUN(_fwalk_reent, (ptr, reent_function), - struct _reent *ptr, +_fwalk_reent (struct _reent *ptr, register int (*reent_function) (struct _reent *, FILE *)) { register FILE *fp; diff --git a/newlib/libc/stdio/fwide.c b/newlib/libc/stdio/fwide.c index 719a58acd..9b5a3d12a 100644 --- a/newlib/libc/stdio/fwide.c +++ b/newlib/libc/stdio/fwide.c @@ -48,8 +48,7 @@ C99, POSIX.1-2001. #include "local.h" int -_DEFUN(_fwide_r, (ptr, fp, mode), - struct _reent *ptr, +_fwide_r (struct _reent *ptr, FILE *fp, int mode) { @@ -70,8 +69,7 @@ _DEFUN(_fwide_r, (ptr, fp, mode), } int -_DEFUN(fwide, (fp, mode), - FILE *fp, +fwide (FILE *fp, int mode) { return _fwide_r (_REENT, fp, mode); diff --git a/newlib/libc/stdio/fwprintf.c b/newlib/libc/stdio/fwprintf.c index b7604aafe..d4047dcc4 100644 --- a/newlib/libc/stdio/fwprintf.c +++ b/newlib/libc/stdio/fwprintf.c @@ -23,8 +23,7 @@ #include int -_DEFUN(_fwprintf_r, (ptr, fp, fmt), - struct _reent *ptr, +_fwprintf_r (struct _reent *ptr, FILE *fp, const wchar_t *fmt, ...) { @@ -40,8 +39,7 @@ _DEFUN(_fwprintf_r, (ptr, fp, fmt), #ifndef _REENT_ONLY int -_DEFUN(fwprintf, (fp, fmt), - FILE *__restrict fp, +fwprintf (FILE *__restrict fp, const wchar_t *__restrict fmt, ...) { int ret; diff --git a/newlib/libc/stdio/fwrite.c b/newlib/libc/stdio/fwrite.c index 7dec80c1a..aa14421db 100644 --- a/newlib/libc/stdio/fwrite.c +++ b/newlib/libc/stdio/fwrite.c @@ -108,8 +108,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; */ size_t -_DEFUN(_fwrite_r, (ptr, buf, size, count, fp), - struct _reent * ptr, +_fwrite_r (struct _reent * ptr, const void *__restrict buf, size_t size, size_t count, @@ -170,8 +169,7 @@ ret: #ifndef _REENT_ONLY size_t -_DEFUN(fwrite, (buf, size, count, fp), - const void *__restrict buf, +fwrite (const void *__restrict buf, size_t size, size_t count, FILE * fp) diff --git a/newlib/libc/stdio/getc.c b/newlib/libc/stdio/getc.c index 269bfb1d3..3c62f0bd9 100644 --- a/newlib/libc/stdio/getc.c +++ b/newlib/libc/stdio/getc.c @@ -76,8 +76,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef getc int -_DEFUN(_getc_r, (ptr, fp), - struct _reent *ptr, +_getc_r (struct _reent *ptr, register FILE *fp) { int result; @@ -91,8 +90,7 @@ _DEFUN(_getc_r, (ptr, fp), #ifndef _REENT_ONLY int -_DEFUN(getc, (fp), - register FILE *fp) +getc (register FILE *fp) { int result; struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/getc_u.c b/newlib/libc/stdio/getc_u.c index 2f9f0e818..fb37ba4b1 100644 --- a/newlib/libc/stdio/getc_u.c +++ b/newlib/libc/stdio/getc_u.c @@ -69,8 +69,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef getc_unlocked int -_DEFUN(_getc_unlocked_r, (ptr, fp), - struct _reent *ptr, +_getc_unlocked_r (struct _reent *ptr, register FILE *fp) { /* CHECK_INIT is called (eventually) by __srefill_r. */ @@ -81,8 +80,7 @@ _DEFUN(_getc_unlocked_r, (ptr, fp), #ifndef _REENT_ONLY int -_DEFUN(getc_unlocked, (fp), - register FILE *fp) +getc_unlocked (register FILE *fp) { return __sgetc_r (_REENT, fp); } diff --git a/newlib/libc/stdio/getchar.c b/newlib/libc/stdio/getchar.c index b3ca289ba..7e0b74848 100644 --- a/newlib/libc/stdio/getchar.c +++ b/newlib/libc/stdio/getchar.c @@ -72,8 +72,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef getchar int -_DEFUN(_getchar_r, (reent), - struct _reent *reent) +_getchar_r (struct _reent *reent) { _REENT_SMALL_CHECK_INIT (reent); return _getc_r (reent, _stdin_r (reent)); diff --git a/newlib/libc/stdio/getchar_u.c b/newlib/libc/stdio/getchar_u.c index 5848d47ac..e45176dfa 100644 --- a/newlib/libc/stdio/getchar_u.c +++ b/newlib/libc/stdio/getchar_u.c @@ -70,8 +70,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef getchar_unlocked int -_DEFUN(_getchar_unlocked_r, (ptr), - struct _reent *ptr) +_getchar_unlocked_r (struct _reent *ptr) { return _getc_unlocked_r (ptr, _stdin_r (ptr)); } diff --git a/newlib/libc/stdio/getdelim.c b/newlib/libc/stdio/getdelim.c index 4164be5c5..90cd5d47f 100644 --- a/newlib/libc/stdio/getdelim.c +++ b/newlib/libc/stdio/getdelim.c @@ -40,8 +40,7 @@ No supporting OS subroutines are directly required. #define DEFAULT_LINE_SIZE 128 ssize_t -_DEFUN(__getdelim, (bufptr, n, delim, fp), - char **bufptr, +__getdelim (char **bufptr, size_t *n, int delim, FILE *fp) diff --git a/newlib/libc/stdio/getline.c b/newlib/libc/stdio/getline.c index b212a8c8f..857e980ad 100644 --- a/newlib/libc/stdio/getline.c +++ b/newlib/libc/stdio/getline.c @@ -37,8 +37,7 @@ No supporting OS subroutines are directly required. extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *)); ssize_t -_DEFUN(__getline, (lptr, n, fp), - char **lptr, +__getline (char **lptr, size_t *n, FILE *fp) { diff --git a/newlib/libc/stdio/gets.c b/newlib/libc/stdio/gets.c index 4e951efe3..a510ec0f0 100644 --- a/newlib/libc/stdio/gets.c +++ b/newlib/libc/stdio/gets.c @@ -63,8 +63,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" char * -_DEFUN(_gets_r, (ptr, buf), - struct _reent *ptr, +_gets_r (struct _reent *ptr, char *buf) { register int c; @@ -94,8 +93,7 @@ _DEFUN(_gets_r, (ptr, buf), #ifndef _REENT_ONLY char * -_DEFUN(gets, (buf), - char *buf) +gets (char *buf) { return _gets_r (_REENT, buf); } diff --git a/newlib/libc/stdio/getw.c b/newlib/libc/stdio/getw.c index 4585d9f37..a1b72e482 100644 --- a/newlib/libc/stdio/getw.c +++ b/newlib/libc/stdio/getw.c @@ -54,8 +54,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include int -_DEFUN(getw, (fp), - register FILE *fp) +getw (register FILE *fp) { int result; if (fread ((char*)&result, sizeof (result), 1, fp) != 1) diff --git a/newlib/libc/stdio/getwc.c b/newlib/libc/stdio/getwc.c index db9a43768..15b397455 100644 --- a/newlib/libc/stdio/getwc.c +++ b/newlib/libc/stdio/getwc.c @@ -33,8 +33,7 @@ #undef getwc wint_t -_DEFUN(_getwc_r, (ptr, fp), - struct _reent *ptr, +_getwc_r (struct _reent *ptr, FILE *fp) { return _fgetwc_r (ptr, fp); @@ -45,8 +44,7 @@ _DEFUN(_getwc_r, (ptr, fp), * macro, may evaluate `fp' more than once. */ wint_t -_DEFUN(getwc, (fp), - FILE *fp) +getwc (FILE *fp) { return fgetwc(fp); } diff --git a/newlib/libc/stdio/getwc_u.c b/newlib/libc/stdio/getwc_u.c index 913c3e08b..366ab0f36 100644 --- a/newlib/libc/stdio/getwc_u.c +++ b/newlib/libc/stdio/getwc_u.c @@ -34,8 +34,7 @@ #undef getwc_unlocked wint_t -_DEFUN(_getwc_unlocked_r, (ptr, fp), - struct _reent *ptr, +_getwc_unlocked_r (struct _reent *ptr, FILE *fp) { return _fgetwc_unlocked_r (ptr, fp); @@ -46,8 +45,7 @@ _DEFUN(_getwc_unlocked_r, (ptr, fp), * a macro, may evaluate `fp' more than once. */ wint_t -_DEFUN(getwc_unlocked, (fp), - FILE *fp) +getwc_unlocked (FILE *fp) { return fgetwc_unlocked(fp); } diff --git a/newlib/libc/stdio/getwchar.c b/newlib/libc/stdio/getwchar.c index f432755a0..148539241 100644 --- a/newlib/libc/stdio/getwchar.c +++ b/newlib/libc/stdio/getwchar.c @@ -93,8 +93,7 @@ PORTABILITY #undef getwchar wint_t -_DEFUN (_getwchar_r, (ptr), - struct _reent *ptr) +_getwchar_r (struct _reent *ptr) { return _fgetwc_r (ptr, stdin); } diff --git a/newlib/libc/stdio/getwchar_u.c b/newlib/libc/stdio/getwchar_u.c index 4c854f213..c1f8d2da5 100644 --- a/newlib/libc/stdio/getwchar_u.c +++ b/newlib/libc/stdio/getwchar_u.c @@ -34,8 +34,7 @@ #undef getwchar_unlocked wint_t -_DEFUN (_getwchar_unlocked_r, (ptr), - struct _reent *ptr) +_getwchar_unlocked_r (struct _reent *ptr) { return _fgetwc_unlocked_r (ptr, stdin); } diff --git a/newlib/libc/stdio/iprintf.c b/newlib/libc/stdio/iprintf.c index 571d826e5..507d15415 100644 --- a/newlib/libc/stdio/iprintf.c +++ b/newlib/libc/stdio/iprintf.c @@ -25,8 +25,7 @@ #ifndef _REENT_ONLY int -_DEFUN(iprintf, (fmt), - const char *fmt, ...) +iprintf (const char *fmt, ...) { int ret; va_list ap; @@ -42,8 +41,7 @@ _DEFUN(iprintf, (fmt), #endif /* ! _REENT_ONLY */ int -_DEFUN(_iprintf_r, (ptr, fmt), - struct _reent *ptr, +_iprintf_r (struct _reent *ptr, const char *fmt, ...) { int ret; diff --git a/newlib/libc/stdio/makebuf.c b/newlib/libc/stdio/makebuf.c index 37a50d47d..f2da70ad6 100644 --- a/newlib/libc/stdio/makebuf.c +++ b/newlib/libc/stdio/makebuf.c @@ -35,8 +35,7 @@ */ void -_DEFUN(__smakebuf_r, (ptr, fp), - struct _reent *ptr, +__smakebuf_r (struct _reent *ptr, register FILE *fp) { register void *p; @@ -76,8 +75,7 @@ _DEFUN(__smakebuf_r, (ptr, fp), * Internal routine to determine `proper' buffering for a file. */ int -_DEFUN(__swhatbuf_r, (ptr, fp, bufsize, couldbetty), - struct _reent *ptr, +__swhatbuf_r (struct _reent *ptr, FILE *fp, size_t *bufsize, int *couldbetty) diff --git a/newlib/libc/stdio/mktemp.c b/newlib/libc/stdio/mktemp.c index 37092496b..9b85eb93e 100644 --- a/newlib/libc/stdio/mktemp.c +++ b/newlib/libc/stdio/mktemp.c @@ -139,8 +139,7 @@ Supporting OS subroutines required: <>, <>, <>, <>. #include static int -_DEFUN(_gettemp, (ptr, path, doopen, domkdir, suffixlen, flags), - struct _reent *ptr, +_gettemp (struct _reent *ptr, char *path, register int *doopen, int domkdir, @@ -263,8 +262,7 @@ _DEFUN(_gettemp, (ptr, path, doopen, domkdir, suffixlen, flags), #endif int -_DEFUN(_mkstemp_r, (ptr, path), - struct _reent *ptr, +_mkstemp_r (struct _reent *ptr, char *path) { int fd; @@ -274,16 +272,14 @@ _DEFUN(_mkstemp_r, (ptr, path), #if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 4 char * -_DEFUN(_mkdtemp_r, (ptr, path), - struct _reent *ptr, +_mkdtemp_r (struct _reent *ptr, char *path) { return (_gettemp (ptr, path, (int *) NULL, 1, 0, 0) ? path : NULL); } int -_DEFUN(_mkstemps_r, (ptr, path, len), - struct _reent *ptr, +_mkstemps_r (struct _reent *ptr, char *path, int len) { @@ -293,8 +289,7 @@ _DEFUN(_mkstemps_r, (ptr, path, len), } int -_DEFUN(_mkostemp_r, (ptr, path, flags), - struct _reent *ptr, +_mkostemp_r (struct _reent *ptr, char *path, int flags) { @@ -304,8 +299,7 @@ _DEFUN(_mkostemp_r, (ptr, path, flags), } int -_DEFUN(_mkostemps_r, (ptr, path, len, flags), - struct _reent *ptr, +_mkostemps_r (struct _reent *ptr, char *path, int len, int flags) @@ -317,8 +311,7 @@ _DEFUN(_mkostemps_r, (ptr, path, len, flags), #endif /* _ELIX_LEVEL */ char * -_DEFUN(_mktemp_r, (ptr, path), - struct _reent *ptr, +_mktemp_r (struct _reent *ptr, char *path) { return (_gettemp (ptr, path, (int *) NULL, 0, 0, 0) ? path : (char *) NULL); @@ -327,8 +320,7 @@ _DEFUN(_mktemp_r, (ptr, path), #ifndef _REENT_ONLY int -_DEFUN(mkstemp, (path), - char *path) +mkstemp (char *path) { int fd; @@ -337,15 +329,13 @@ _DEFUN(mkstemp, (path), # if !defined _ELIX_LEVEL || _ELIX_LEVEL >= 4 char * -_DEFUN(mkdtemp, (path), - char *path) +mkdtemp (char *path) { return (_gettemp (_REENT, path, (int *) NULL, 1, 0, 0) ? path : NULL); } int -_DEFUN(mkstemps, (path, len), - char *path, +mkstemps (char *path, int len) { int fd; @@ -354,8 +344,7 @@ _DEFUN(mkstemps, (path, len), } int -_DEFUN(mkostemp, (path, flags), - char *path, +mkostemp (char *path, int flags) { int fd; @@ -364,8 +353,7 @@ _DEFUN(mkostemp, (path, flags), } int -_DEFUN(mkostemps, (path, len, flags), - char *path, +mkostemps (char *path, int len, int flags) { @@ -376,8 +364,7 @@ _DEFUN(mkostemps, (path, len, flags), # endif /* _ELIX_LEVEL */ char * -_DEFUN(mktemp, (path), - char *path) +mktemp (char *path) { return (_gettemp (_REENT, path, (int *) NULL, 0, 0, 0) ? path : (char *) NULL); } diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index e87f374fc..1c5a07516 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -182,8 +182,7 @@ static char *rcsid = "$Id$"; and vfwprintf. */ #ifdef STRING_ONLY int -_DEFUN(__ssputs_r, (ptr, fp, buf, len), - struct _reent *ptr, +__ssputs_r (struct _reent *ptr, FILE *fp, const char *buf, size_t len) @@ -253,8 +252,7 @@ err: char output, but __ssprint_r cannot be discarded because it is used by a serial of functions like svfwprintf for wide char output. */ int -_DEFUN(__ssprint_r, (ptr, fp, uio), - struct _reent *ptr, +__ssprint_r (struct _reent *ptr, FILE *fp, register struct __suio *uio) { @@ -357,8 +355,7 @@ err: /* Flush out all the vectors defined by the given uio, then reset it so that it can be reused. */ int -_DEFUN(__sprint_r, (ptr, fp, uio), - struct _reent *ptr, +__sprint_r (struct _reent *ptr, FILE *fp, register struct __suio *uio) { @@ -402,8 +399,7 @@ out: } _NOINLINE_STATIC int -_DEFUN(__sfputc_r, (ptr, c, fp), - struct _reent *ptr, +__sfputc_r (struct _reent *ptr, int c, FILE *fp) { @@ -414,8 +410,7 @@ _DEFUN(__sfputc_r, (ptr, c, fp), } int -_DEFUN(__sfputs_r, (ptr, fp, buf, len), - struct _reent *ptr, +__sfputs_r (struct _reent *ptr, FILE *fp, const char *buf, size_t len) @@ -452,8 +447,7 @@ int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, const char *, va_list)); #ifndef STRING_ONLY int -_DEFUN(VFPRINTF, (fp, fmt0, ap), - FILE * fp, +VFPRINTF (FILE * fp, const char *fmt0, va_list ap) { @@ -481,8 +475,7 @@ _EXFUN(vfiprintf, (FILE *, const char *, __VALIST) #endif int -_DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data, +_VFPRINTF_R (struct _reent *data, FILE * fp, const char *fmt0, va_list ap) diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index 15e0a5e8d..e8a9325ec 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -144,8 +144,7 @@ Supporting OS subroutines required: #ifndef _REENT_ONLY int -_DEFUN(VFSCANF, (fp, fmt, ap), - register FILE *fp, +VFSCANF (register FILE *fp, const char *fmt, va_list ap) { @@ -158,8 +157,7 @@ _EXFUN(vfiscanf, (FILE *, const char *, __VALIST) _ATTRIBUTE ((__alias__("vfscanf")))); int -_DEFUN(__SVFSCANF, (fp, fmt0, ap), - register FILE *fp, +__SVFSCANF (register FILE *fp, char const *fmt0, va_list ap) { @@ -169,8 +167,7 @@ _DEFUN(__SVFSCANF, (fp, fmt0, ap), #endif int -_DEFUN(_VFSCANF_R, (data, fp, fmt, ap), - struct _reent *data, +_VFSCANF_R (struct _reent *data, register FILE *fp, const char *fmt, va_list ap) @@ -189,8 +186,7 @@ _EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST) regular ungetc which will drag in file I/O items we don't need. So, we create our own trimmed-down version. */ int -_DEFUN(_sungetc_r, (data, fp, ch), - struct _reent *data, +_sungetc_r (struct _reent *data, int c, register FILE *fp) { @@ -238,8 +234,7 @@ _DEFUN(_sungetc_r, (data, fp, ch), /* String only version of __srefill_r for sscanf family. */ int -_DEFUN(__ssrefill_r, (ptr, fp), - struct _reent * ptr, +__ssrefill_r (struct _reent * ptr, register FILE * fp) { /* Our only hope of further input is the ungetc buffer. @@ -268,8 +263,7 @@ size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *)); #endif /* !STRING_ONLY. */ int -_DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), - struct _reent *rptr, +__SVFSCANF_R (struct _reent *rptr, register FILE *fp, char const *fmt0, va_list ap) diff --git a/newlib/libc/stdio/open_memstream.c b/newlib/libc/stdio/open_memstream.c index 5dd64115b..afa4a6d62 100644 --- a/newlib/libc/stdio/open_memstream.c +++ b/newlib/libc/stdio/open_memstream.c @@ -93,8 +93,7 @@ typedef struct memstream { /* Write up to non-zero N bytes of BUF into the stream described by COOKIE, returning the number of bytes written or EOF on failure. */ static _READ_WRITE_RETURN_TYPE -_DEFUN(memwriter, (ptr, cookie, buf, n), - struct _reent *ptr, +memwriter (struct _reent *ptr, void *cookie, const char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -147,8 +146,7 @@ _DEFUN(memwriter, (ptr, cookie, buf, n), /* Seek to position POS relative to WHENCE within stream described by COOKIE; return resulting position or fail with EOF. */ static _fpos_t -_DEFUN(memseeker, (ptr, cookie, pos, whence), - struct _reent *ptr, +memseeker (struct _reent *ptr, void *cookie, _fpos_t pos, int whence) @@ -215,8 +213,7 @@ _DEFUN(memseeker, (ptr, cookie, pos, whence), COOKIE; return resulting position or fail with EOF. */ #ifdef __LARGE64_FILES static _fpos64_t -_DEFUN(memseeker64, (ptr, cookie, pos, whence), - struct _reent *ptr, +memseeker64 (struct _reent *ptr, void *cookie, _fpos64_t pos, int whence) @@ -275,8 +272,7 @@ _DEFUN(memseeker64, (ptr, cookie, pos, whence), /* Reclaim resources used by stream described by COOKIE. */ static int -_DEFUN(memcloser, (ptr, cookie), - struct _reent *ptr, +memcloser (struct _reent *ptr, void *cookie) { memstream *c = (memstream *) cookie; @@ -295,8 +291,7 @@ _DEFUN(memcloser, (ptr, cookie), /* Open a memstream that tracks a dynamic buffer in BUF and SIZE. Return the new stream, or fail with NULL. */ static FILE * -_DEFUN(internal_open_memstream_r, (ptr, buf, size, wide), - struct _reent *ptr, +internal_open_memstream_r (struct _reent *ptr, char **buf, size_t *size, int wide) @@ -378,8 +373,7 @@ _DEFUN(internal_open_memstream_r, (ptr, buf, size, wide), } FILE * -_DEFUN(_open_memstream_r, (ptr, buf, size), - struct _reent *ptr, +_open_memstream_r (struct _reent *ptr, char **buf, size_t *size) { @@ -387,8 +381,7 @@ _DEFUN(_open_memstream_r, (ptr, buf, size), } FILE * -_DEFUN(_open_wmemstream_r, (ptr, buf, size), - struct _reent *ptr, +_open_wmemstream_r (struct _reent *ptr, wchar_t **buf, size_t *size) { @@ -397,16 +390,14 @@ _DEFUN(_open_wmemstream_r, (ptr, buf, size), #ifndef _REENT_ONLY FILE * -_DEFUN(open_memstream, (buf, size), - char **buf, +open_memstream (char **buf, size_t *size) { return _open_memstream_r (_REENT, buf, size); } FILE * -_DEFUN(open_wmemstream, (buf, size), - wchar_t **buf, +open_wmemstream (wchar_t **buf, size_t *size) { return _open_wmemstream_r (_REENT, buf, size); diff --git a/newlib/libc/stdio/perror.c b/newlib/libc/stdio/perror.c index e3e70a6f1..d98e17e19 100644 --- a/newlib/libc/stdio/perror.c +++ b/newlib/libc/stdio/perror.c @@ -59,8 +59,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" void -_DEFUN(_perror_r, (ptr, s), - struct _reent *ptr, +_perror_r (struct _reent *ptr, const char *s) { char *error; @@ -82,8 +81,7 @@ _DEFUN(_perror_r, (ptr, s), #ifndef _REENT_ONLY void -_DEFUN(perror, (s), - const char *s) +perror (const char *s) { _perror_r (_REENT, s); } diff --git a/newlib/libc/stdio/printf.c b/newlib/libc/stdio/printf.c index 73986776b..a323f5ad0 100644 --- a/newlib/libc/stdio/printf.c +++ b/newlib/libc/stdio/printf.c @@ -23,8 +23,7 @@ #include "local.h" int -_DEFUN(_printf_r, (ptr, fmt), - struct _reent *ptr, +_printf_r (struct _reent *ptr, const char *__restrict fmt, ...) { int ret; @@ -46,8 +45,7 @@ _EXFUN(_iprintf_r, (struct _reent *, const char *, ...) #ifndef _REENT_ONLY int -_DEFUN(printf, (fmt), - const char *__restrict fmt, ...) +printf (const char *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/putc.c b/newlib/libc/stdio/putc.c index e69841d17..d4adc5a50 100644 --- a/newlib/libc/stdio/putc.c +++ b/newlib/libc/stdio/putc.c @@ -78,8 +78,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef putc int -_DEFUN(_putc_r, (ptr, c, fp), - struct _reent *ptr, +_putc_r (struct _reent *ptr, int c, register FILE *fp) { @@ -93,8 +92,7 @@ _DEFUN(_putc_r, (ptr, c, fp), #ifndef _REENT_ONLY int -_DEFUN(putc, (c, fp), - int c, +putc (int c, register FILE *fp) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/stdio/putc_u.c b/newlib/libc/stdio/putc_u.c index b53060bed..de4ac2833 100644 --- a/newlib/libc/stdio/putc_u.c +++ b/newlib/libc/stdio/putc_u.c @@ -70,8 +70,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef putc_unlocked int -_DEFUN(_putc_unlocked_r, (ptr, c, fp), - struct _reent *ptr, +_putc_unlocked_r (struct _reent *ptr, int c, register FILE *fp) { @@ -82,8 +81,7 @@ _DEFUN(_putc_unlocked_r, (ptr, c, fp), #ifndef _REENT_ONLY int -_DEFUN(putc_unlocked, (c, fp), - int c, +putc_unlocked (int c, register FILE *fp) { /* CHECK_INIT is (eventually) called by __swbuf. */ diff --git a/newlib/libc/stdio/putchar.c b/newlib/libc/stdio/putchar.c index 813144a2b..c52d38799 100644 --- a/newlib/libc/stdio/putchar.c +++ b/newlib/libc/stdio/putchar.c @@ -67,8 +67,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef putchar int -_DEFUN(_putchar_r, (ptr, c), - struct _reent *ptr, +_putchar_r (struct _reent *ptr, int c) { _REENT_SMALL_CHECK_INIT (ptr); @@ -78,8 +77,7 @@ _DEFUN(_putchar_r, (ptr, c), #ifndef _REENT_ONLY int -_DEFUN(putchar, (c), - int c) +putchar (int c) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/putchar_u.c b/newlib/libc/stdio/putchar_u.c index e0ed8f7d7..8f16bfbc6 100644 --- a/newlib/libc/stdio/putchar_u.c +++ b/newlib/libc/stdio/putchar_u.c @@ -61,8 +61,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #undef putchar_unlocked int -_DEFUN(_putchar_unlocked_r, (ptr, c), - struct _reent *ptr, +_putchar_unlocked_r (struct _reent *ptr, int c) { return putc_unlocked (c, _stdout_r (ptr)); @@ -71,8 +70,7 @@ _DEFUN(_putchar_unlocked_r, (ptr, c), #ifndef _REENT_ONLY int -_DEFUN(putchar_unlocked, (c), - int c) +putchar_unlocked (int c) { /* CHECK_INIT is (eventually) called by __swbuf. */ diff --git a/newlib/libc/stdio/puts.c b/newlib/libc/stdio/puts.c index 89a9485bb..f612ece6d 100644 --- a/newlib/libc/stdio/puts.c +++ b/newlib/libc/stdio/puts.c @@ -65,8 +65,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; */ int -_DEFUN(_puts_r, (ptr, s), - struct _reent *ptr, +_puts_r (struct _reent *ptr, const char * s) { #ifdef _FVWRITE_IN_STREAMIO @@ -125,8 +124,7 @@ err: #ifndef _REENT_ONLY int -_DEFUN(puts, (s), - char const * s) +puts (char const * s) { return _puts_r (_REENT, s); } diff --git a/newlib/libc/stdio/putw.c b/newlib/libc/stdio/putw.c index 5377d87d3..a7907bef7 100644 --- a/newlib/libc/stdio/putw.c +++ b/newlib/libc/stdio/putw.c @@ -49,8 +49,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include int -_DEFUN(putw, (w, fp), - int w, +putw (int w, register FILE *fp) { if (fwrite ((const char*)&w, sizeof (w), 1, fp) != 1) diff --git a/newlib/libc/stdio/putwc.c b/newlib/libc/stdio/putwc.c index 7c31d23d8..a6c3100d7 100644 --- a/newlib/libc/stdio/putwc.c +++ b/newlib/libc/stdio/putwc.c @@ -33,8 +33,7 @@ #undef putwc wint_t -_DEFUN(_putwc_r, (ptr, wc, fp), - struct _reent *ptr, +_putwc_r (struct _reent *ptr, wchar_t wc, FILE *fp) { @@ -45,8 +44,7 @@ _DEFUN(_putwc_r, (ptr, wc, fp), * macro, may evaluate `fp' more than once. */ wint_t -_DEFUN(putwc, (wc, fp), - wchar_t wc, +putwc (wchar_t wc, FILE *fp) { return fputwc (wc, fp); diff --git a/newlib/libc/stdio/putwc_u.c b/newlib/libc/stdio/putwc_u.c index cb09fd2db..0ec11f04e 100644 --- a/newlib/libc/stdio/putwc_u.c +++ b/newlib/libc/stdio/putwc_u.c @@ -34,8 +34,7 @@ #undef putwc_unlocked wint_t -_DEFUN(_putwc_unlocked_r, (ptr, wc, fp), - struct _reent *ptr, +_putwc_unlocked_r (struct _reent *ptr, wchar_t wc, FILE *fp) { @@ -46,8 +45,7 @@ _DEFUN(_putwc_unlocked_r, (ptr, wc, fp), * if it is a macro, may evaluate `fp' more than once. */ wint_t -_DEFUN(putwc_unlocked, (wc, fp), - wchar_t wc, +putwc_unlocked (wchar_t wc, FILE *fp) { return fputwc_unlocked (wc, fp); diff --git a/newlib/libc/stdio/putwchar.c b/newlib/libc/stdio/putwchar.c index 66ed30ac0..238cb5016 100644 --- a/newlib/libc/stdio/putwchar.c +++ b/newlib/libc/stdio/putwchar.c @@ -87,8 +87,7 @@ PORTABILITY #undef putwchar wint_t -_DEFUN(_putwchar_r, (ptr, wc), - struct _reent *ptr, +_putwchar_r (struct _reent *ptr, wchar_t wc) { return _fputwc_r (ptr, wc, stdout); @@ -98,8 +97,7 @@ _DEFUN(_putwchar_r, (ptr, wc), * Synonym for fputwc(wc, stdout). */ wint_t -_DEFUN(putwchar, (wc), - wchar_t wc) +putwchar (wchar_t wc) { _REENT_SMALL_CHECK_INIT (_REENT); return fputwc (wc, stdout); diff --git a/newlib/libc/stdio/putwchar_u.c b/newlib/libc/stdio/putwchar_u.c index 68c5abe26..a5e6a57da 100644 --- a/newlib/libc/stdio/putwchar_u.c +++ b/newlib/libc/stdio/putwchar_u.c @@ -34,8 +34,7 @@ #undef putwchar_unlocked wint_t -_DEFUN(_putwchar_unlocked_r, (ptr, wc), - struct _reent *ptr, +_putwchar_unlocked_r (struct _reent *ptr, wchar_t wc) { return _fputwc_unlocked_r (ptr, wc, stdout); @@ -45,8 +44,7 @@ _DEFUN(_putwchar_unlocked_r, (ptr, wc), * Synonym for fputwc_unlocked(wc, stdout). */ wint_t -_DEFUN(putwchar_unlocked, (wc), - wchar_t wc) +putwchar_unlocked (wchar_t wc) { _REENT_SMALL_CHECK_INIT (_REENT); return fputwc_unlocked (wc, stdout); diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c index 6158f3ec0..87a715b84 100644 --- a/newlib/libc/stdio/refill.c +++ b/newlib/libc/stdio/refill.c @@ -23,8 +23,7 @@ #include "local.h" static int -_DEFUN(lflush, (fp), - FILE *fp) +lflush (FILE *fp) { if ((fp->_flags & (__SLBF | __SWR)) == (__SLBF | __SWR)) return fflush (fp); @@ -37,8 +36,7 @@ _DEFUN(lflush, (fp), */ int -_DEFUN(__srefill_r, (ptr, fp), - struct _reent * ptr, +__srefill_r (struct _reent * ptr, register FILE * fp) { /* make sure stdio is set up */ diff --git a/newlib/libc/stdio/remove.c b/newlib/libc/stdio/remove.c index 810b282ac..a10582832 100644 --- a/newlib/libc/stdio/remove.c +++ b/newlib/libc/stdio/remove.c @@ -59,8 +59,7 @@ Supporting OS subroutine required: <>. #include int -_DEFUN(_remove_r, (ptr, filename), - struct _reent *ptr, +_remove_r (struct _reent *ptr, const char *filename) { if (_unlink_r (ptr, filename) == -1) @@ -72,8 +71,7 @@ _DEFUN(_remove_r, (ptr, filename), #ifndef _REENT_ONLY int -_DEFUN(remove, (filename), - const char *filename) +remove (const char *filename) { return _remove_r (_REENT, filename); } diff --git a/newlib/libc/stdio/rename.c b/newlib/libc/stdio/rename.c index a32770846..b3c745a10 100644 --- a/newlib/libc/stdio/rename.c +++ b/newlib/libc/stdio/rename.c @@ -54,8 +54,7 @@ Supporting OS subroutines required: <>, <>, or <>. #ifndef _REENT_ONLY int -_DEFUN(rename, (old, new), - const char *old, +rename (const char *old, const char *new) { return _rename_r (_REENT, old, new); diff --git a/newlib/libc/stdio/rewind.c b/newlib/libc/stdio/rewind.c index 745c93974..a65847d5e 100644 --- a/newlib/libc/stdio/rewind.c +++ b/newlib/libc/stdio/rewind.c @@ -52,8 +52,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include void -_DEFUN(_rewind_r, (ptr, fp), - struct _reent * ptr, +_rewind_r (struct _reent * ptr, register FILE * fp) { (void) _fseek_r (ptr, fp, 0L, SEEK_SET); @@ -63,8 +62,7 @@ _DEFUN(_rewind_r, (ptr, fp), #ifndef _REENT_ONLY void -_DEFUN(rewind, (fp), - register FILE * fp) +rewind (register FILE * fp) { _rewind_r (_REENT, fp); } diff --git a/newlib/libc/stdio/rget.c b/newlib/libc/stdio/rget.c index d76f307d7..656e5661b 100644 --- a/newlib/libc/stdio/rget.c +++ b/newlib/libc/stdio/rget.c @@ -32,8 +32,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; */ int -_DEFUN(__srget_r, (ptr, fp), - struct _reent *ptr, +__srget_r (struct _reent *ptr, register FILE *fp) { /* Ensure that any fake std stream is resolved before @@ -52,8 +51,7 @@ _DEFUN(__srget_r, (ptr, fp), required for backward compatibility with applications built against earlier dynamically built newlib libraries. */ int -_DEFUN(__srget, (fp), - register FILE *fp) +__srget (register FILE *fp) { return __srget_r (_REENT, fp); } diff --git a/newlib/libc/stdio/sccl.c b/newlib/libc/stdio/sccl.c index d0bdfd936..c1bf2b189 100644 --- a/newlib/libc/stdio/sccl.c +++ b/newlib/libc/stdio/sccl.c @@ -31,8 +31,7 @@ */ u_char * -_DEFUN(__sccl, (tab, fmt), - register char *tab, +__sccl (register char *tab, register u_char *fmt) { register int c, n, v; diff --git a/newlib/libc/stdio/setbuf.c b/newlib/libc/stdio/setbuf.c index 1538762a1..f5471866d 100644 --- a/newlib/libc/stdio/setbuf.c +++ b/newlib/libc/stdio/setbuf.c @@ -65,8 +65,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" void -_DEFUN(setbuf, (fp, buf), - FILE *__restrict fp, +setbuf (FILE *__restrict fp, char *__restrict buf) { (void) setvbuf (fp, buf, buf ? _IOFBF : _IONBF, BUFSIZ); diff --git a/newlib/libc/stdio/setbuffer.c b/newlib/libc/stdio/setbuffer.c index 2b93e7df3..35d17da3b 100644 --- a/newlib/libc/stdio/setbuffer.c +++ b/newlib/libc/stdio/setbuffer.c @@ -65,8 +65,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" void -_DEFUN(setbuffer, (fp, buf, size), - FILE * fp, +setbuffer (FILE * fp, char *buf, int size) { diff --git a/newlib/libc/stdio/setlinebuf.c b/newlib/libc/stdio/setlinebuf.c index d8cb013d9..d623b3014 100644 --- a/newlib/libc/stdio/setlinebuf.c +++ b/newlib/libc/stdio/setlinebuf.c @@ -56,8 +56,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" int -_DEFUN(setlinebuf, (fp), - FILE * fp) +setlinebuf (FILE * fp) { return (setvbuf (fp, (char *) NULL, _IOLBF, (size_t) 0)); } diff --git a/newlib/libc/stdio/setvbuf.c b/newlib/libc/stdio/setvbuf.c index 6ce0ee1fe..63c9970e4 100644 --- a/newlib/libc/stdio/setvbuf.c +++ b/newlib/libc/stdio/setvbuf.c @@ -88,8 +88,7 @@ Supporting OS subroutines required: <>, <>, <>, */ int -_DEFUN(setvbuf, (fp, buf, mode, size), - register FILE * fp, +setvbuf (register FILE * fp, char *buf, register int mode, register size_t size) diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index 2251e0912..6ec24777e 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -104,8 +104,7 @@ Supporting OS subroutines required: <>, <>, <>, int #ifdef _HAVE_STDC -_DEFUN(_siprintf_r, (ptr, str, fmt), - struct _reent *ptr, +_siprintf_r (struct _reent *ptr, char *str, const char *fmt, ...) #else @@ -139,8 +138,7 @@ _siprintf_r(ptr, str, fmt, va_alist) int #ifdef _HAVE_STDC -_DEFUN(siprintf, (str, fmt), - char *str, +siprintf (char *str, const char *fmt, ...) #else siprintf(str, fmt, va_alist) diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c index bd1528b04..9b45ecdbb 100644 --- a/newlib/libc/stdio/siscanf.c +++ b/newlib/libc/stdio/siscanf.c @@ -87,8 +87,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef _HAVE_STDC int -_DEFUN(siscanf, (str, fmt), - const char *str, +siscanf (const char *str, const char *fmt, ...) #else int @@ -123,8 +122,7 @@ siscanf(str, fmt, va_alist) #ifdef _HAVE_STDC int -_DEFUN(_siscanf_r, (ptr, str, fmt), - struct _reent *ptr, +_siscanf_r (struct _reent *ptr, const char *str, const char *fmt, ...) #else diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c index d7bb9a40e..d13278437 100644 --- a/newlib/libc/stdio/sniprintf.c +++ b/newlib/libc/stdio/sniprintf.c @@ -32,8 +32,7 @@ int #ifdef _HAVE_STDC -_DEFUN (_sniprintf_r, (ptr, str, size, fmt), - struct _reent *ptr, +_sniprintf_r (struct _reent *ptr, char *str, size_t size, const char *fmt, ...) @@ -77,8 +76,7 @@ _sniprintf_r (ptr, str, size, fmt, va_alist) int #ifdef _HAVE_STDC -_DEFUN (sniprintf, (str, size, fmt), - char *str, +sniprintf (char *str, size_t size, const char *fmt, ...) #else diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c index ab33dfb47..d5ba7085c 100644 --- a/newlib/libc/stdio/snprintf.c +++ b/newlib/libc/stdio/snprintf.c @@ -31,8 +31,7 @@ int #ifdef _HAVE_STDC -_DEFUN(_snprintf_r, (ptr, str, size, fmt), - struct _reent *ptr, +_snprintf_r (struct _reent *ptr, char *__restrict str, size_t size, const char *__restrict fmt, ...) @@ -82,8 +81,7 @@ _EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...) int #ifdef _HAVE_STDC -_DEFUN(snprintf, (str, size, fmt), - char *__restrict str, +snprintf (char *__restrict str, size_t size, const char *__restrict fmt, ...) #else diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index 35d39618f..bbb9753b9 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -580,8 +580,7 @@ Supporting OS subroutines required: <>, <>, <>, int #ifdef _HAVE_STDC -_DEFUN(_sprintf_r, (ptr, str, fmt), - struct _reent *ptr, +_sprintf_r (struct _reent *ptr, char *__restrict str, const char *__restrict fmt, ...) #else @@ -621,8 +620,7 @@ _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...) int #ifdef _HAVE_STDC -_DEFUN(sprintf, (str, fmt), - char *__restrict str, +sprintf (char *__restrict str, const char *__restrict fmt, ...) #else sprintf(str, fmt, va_alist) diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index 92983b1ec..a04f9b65c 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -426,8 +426,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef _HAVE_STDC int -_DEFUN(sscanf, (str, fmt), - const char *__restrict str, +sscanf (const char *__restrict str, const char * fmt, ...) #else int @@ -468,8 +467,7 @@ _EXFUN(siscanf, (const char *, const char *, ...) #ifdef _HAVE_STDC int -_DEFUN(_sscanf_r, (ptr, str, fmt), - struct _reent *ptr, +_sscanf_r (struct _reent *ptr, const char *__restrict str, const char *__restrict fmt, ...) #else diff --git a/newlib/libc/stdio/stdio.c b/newlib/libc/stdio/stdio.c index 0e8016b12..a72fb74d0 100644 --- a/newlib/libc/stdio/stdio.c +++ b/newlib/libc/stdio/stdio.c @@ -30,8 +30,7 @@ */ _READ_WRITE_RETURN_TYPE -_DEFUN(__sread, (ptr, cookie, buf, n), - struct _reent *ptr, +__sread (struct _reent *ptr, void *cookie, char *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -63,8 +62,7 @@ _DEFUN(__sread, (ptr, cookie, buf, n), /* Dummy function used in sscanf/swscanf. */ _READ_WRITE_RETURN_TYPE -_DEFUN(__seofread, (ptr, cookie, buf, len), - struct _reent *_ptr, +__seofread (struct _reent *_ptr, void *cookie, char *buf, _READ_WRITE_BUFSIZE_TYPE len) @@ -73,8 +71,7 @@ _DEFUN(__seofread, (ptr, cookie, buf, len), } _READ_WRITE_RETURN_TYPE -_DEFUN(__swrite, (ptr, cookie, buf, n), - struct _reent *ptr, +__swrite (struct _reent *ptr, void *cookie, char const *buf, _READ_WRITE_BUFSIZE_TYPE n) @@ -105,8 +102,7 @@ _DEFUN(__swrite, (ptr, cookie, buf, n), } _fpos_t -_DEFUN(__sseek, (ptr, cookie, offset, whence), - struct _reent *ptr, +__sseek (struct _reent *ptr, void *cookie, _fpos_t offset, int whence) @@ -126,8 +122,7 @@ _DEFUN(__sseek, (ptr, cookie, offset, whence), } int -_DEFUN(__sclose, (ptr, cookie), - struct _reent *ptr, +__sclose (struct _reent *ptr, void *cookie) { FILE *fp = (FILE *) cookie; @@ -137,8 +132,7 @@ _DEFUN(__sclose, (ptr, cookie), #ifdef __SCLE int -_DEFUN(__stextmode, (fd), - int fd) +__stextmode (int fd) { #ifdef __CYGWIN__ extern int _cygwin_istext_for_stdio (int); diff --git a/newlib/libc/stdio/stdio_ext.c b/newlib/libc/stdio/stdio_ext.c index 98f2ccaa9..857091fd7 100644 --- a/newlib/libc/stdio/stdio_ext.c +++ b/newlib/libc/stdio/stdio_ext.c @@ -62,50 +62,43 @@ No supporting OS subroutines are required. /* Subroutine versions of the inline or macro functions. */ size_t -_DEFUN(__fbufsize, (fp), - FILE * fp) +__fbufsize (FILE * fp) { return (size_t) fp->_bf._size; } size_t -_DEFUN(__fpending, (fp), - FILE * fp) +__fpending (FILE * fp) { return fp->_p - fp->_bf._base; } int -_DEFUN(__flbf, (fp), - FILE * fp) +__flbf (FILE * fp) { return (fp->_flags & __SLBF) != 0; } int -_DEFUN(__freadable, (fp), - FILE * fp) +__freadable (FILE * fp) { return (fp->_flags & (__SRD | __SRW)) != 0; } int -_DEFUN(__fwritable, (fp), - FILE * fp) +__fwritable (FILE * fp) { return (fp->_flags & (__SWR | __SRW)) != 0; } int -_DEFUN(__freading, (fp), - FILE * fp) +__freading (FILE * fp) { return (fp->_flags & __SRD) != 0; } int -_DEFUN(__fwriting, (fp), - FILE * fp) +__fwriting (FILE * fp) { return (fp->_flags & __SWR) != 0; } diff --git a/newlib/libc/stdio/swprintf.c b/newlib/libc/stdio/swprintf.c index 427e03ed5..fa3b43e7a 100644 --- a/newlib/libc/stdio/swprintf.c +++ b/newlib/libc/stdio/swprintf.c @@ -553,8 +553,7 @@ Supporting OS subroutines required: <>, <>, <>, * a variable set to _REENT. */ int -_DEFUN(_swprintf_r, (ptr, str, size, fmt), - struct _reent *ptr, +_swprintf_r (struct _reent *ptr, wchar_t *str, size_t size, const wchar_t *fmt, ...) @@ -594,8 +593,7 @@ _DEFUN(_swprintf_r, (ptr, str, size, fmt), #ifndef _REENT_ONLY int -_DEFUN(swprintf, (str, size, fmt), - wchar_t *__restrict str, +swprintf (wchar_t *__restrict str, size_t size, const wchar_t *__restrict fmt, ...) { diff --git a/newlib/libc/stdio/tmpfile.c b/newlib/libc/stdio/tmpfile.c index ee30523ab..f209a3edf 100644 --- a/newlib/libc/stdio/tmpfile.c +++ b/newlib/libc/stdio/tmpfile.c @@ -50,8 +50,7 @@ Supporting OS subroutines required: <>, <>, <>, #endif FILE * -_DEFUN(_tmpfile_r, (ptr), - struct _reent *ptr) +_tmpfile_r (struct _reent *ptr) { FILE *fp; int e; diff --git a/newlib/libc/stdio/tmpnam.c b/newlib/libc/stdio/tmpnam.c index d794a988e..3bd5b6a58 100644 --- a/newlib/libc/stdio/tmpnam.c +++ b/newlib/libc/stdio/tmpnam.c @@ -86,8 +86,7 @@ The global pointer <> is also required. another one. Return nonzero if successful, otherwise zero. */ static int -_DEFUN(worker, (ptr, result, part1, part2, part3, part4), - struct _reent *ptr, +worker (struct _reent *ptr, char *result, const char *part1, const char *part2, @@ -118,8 +117,7 @@ _DEFUN(worker, (ptr, result, part1, part2, part3, part4), } char * -_DEFUN(_tmpnam_r, (p, s), - struct _reent *p, +_tmpnam_r (struct _reent *p, char *s) { char *result; @@ -147,8 +145,7 @@ _DEFUN(_tmpnam_r, (p, s), } char * -_DEFUN(_tempnam_r, (p, dir, pfx), - struct _reent *p, +_tempnam_r (struct _reent *p, const char *dir, const char *pfx) { @@ -174,16 +171,14 @@ _DEFUN(_tempnam_r, (p, dir, pfx), #ifndef _REENT_ONLY char * -_DEFUN(tempnam, (dir, pfx), - const char *dir, +tempnam (const char *dir, const char *pfx) { return _tempnam_r (_REENT, dir, pfx); } char * -_DEFUN(tmpnam, (s), - char *s) +tmpnam (char *s) { return _tmpnam_r (_REENT, s); } diff --git a/newlib/libc/stdio/ungetc.c b/newlib/libc/stdio/ungetc.c index c673365b1..444577585 100644 --- a/newlib/libc/stdio/ungetc.c +++ b/newlib/libc/stdio/ungetc.c @@ -77,8 +77,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; /*static*/ int -_DEFUN(__submore, (rptr, fp), - struct _reent *rptr, +__submore (struct _reent *rptr, register FILE *fp) { register int i; @@ -111,8 +110,7 @@ _DEFUN(__submore, (rptr, fp), } int -_DEFUN(_ungetc_r, (rptr, c, fp), - struct _reent *rptr, +_ungetc_r (struct _reent *rptr, int c, register FILE *fp) { @@ -208,8 +206,7 @@ _DEFUN(_ungetc_r, (rptr, c, fp), #ifndef _REENT_ONLY int -_DEFUN(ungetc, (c, fp), - int c, +ungetc (int c, register FILE *fp) { return _ungetc_r (_REENT, c, fp); diff --git a/newlib/libc/stdio/ungetwc.c b/newlib/libc/stdio/ungetwc.c index 60f3e5b49..16d37f2d1 100644 --- a/newlib/libc/stdio/ungetwc.c +++ b/newlib/libc/stdio/ungetwc.c @@ -74,8 +74,7 @@ C99 #include "local.h" wint_t -_DEFUN(_ungetwc_r, (ptr, wc, fp), - struct _reent *ptr, +_ungetwc_r (struct _reent *ptr, wint_t wc, register FILE *fp) { @@ -106,8 +105,7 @@ _DEFUN(_ungetwc_r, (ptr, wc, fp), * MT-safe version. */ wint_t -_DEFUN(ungetwc, (wint_t wc, FILE *fp), - wint_t wc, +ungetwc (wint_t wc, FILE *fp) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdio/vasiprintf.c b/newlib/libc/stdio/vasiprintf.c index 259d44b0e..c7c5e35e4 100644 --- a/newlib/libc/stdio/vasiprintf.c +++ b/newlib/libc/stdio/vasiprintf.c @@ -31,8 +31,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifndef _REENT_ONLY int -_DEFUN(vasiprintf, (strp, fmt, ap), - char **strp, +vasiprintf (char **strp, const char *fmt, va_list ap) { @@ -42,8 +41,7 @@ _DEFUN(vasiprintf, (strp, fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_vasiprintf_r, (ptr, strp, fmt, ap), - struct _reent *ptr, +_vasiprintf_r (struct _reent *ptr, char **strp, const char *fmt, va_list ap) diff --git a/newlib/libc/stdio/vasniprintf.c b/newlib/libc/stdio/vasniprintf.c index 9bbe30c59..edfbd2242 100644 --- a/newlib/libc/stdio/vasniprintf.c +++ b/newlib/libc/stdio/vasniprintf.c @@ -14,8 +14,7 @@ #include "local.h" char * -_DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap), - struct _reent *ptr, +_vasniprintf_r (struct _reent *ptr, char *buf, size_t *lenp, const char *fmt, @@ -59,8 +58,7 @@ _DEFUN(_vasniprintf_r, (ptr, buf, lenp, fmt, ap), #ifndef _REENT_ONLY char * -_DEFUN(vasniprintf, (buf, lenp, fmt, ap), - char *buf, +vasniprintf (char *buf, size_t *lenp, const char *fmt, va_list ap) diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c index 6edb47398..5bc0ec634 100644 --- a/newlib/libc/stdio/vasnprintf.c +++ b/newlib/libc/stdio/vasnprintf.c @@ -14,8 +14,7 @@ #include "local.h" char * -_DEFUN(_vasnprintf_r, (ptr, buf, lenp, fmt, ap), - struct _reent *ptr, +_vasnprintf_r (struct _reent *ptr, char *buf, size_t *lenp, const char *fmt, @@ -66,8 +65,7 @@ _EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, #ifndef _REENT_ONLY char * -_DEFUN(vasnprintf, (buf, lenp, fmt, ap), - char *buf, +vasnprintf (char *buf, size_t *lenp, const char *fmt, va_list ap) diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c index c0961de01..4acbc0479 100644 --- a/newlib/libc/stdio/vasprintf.c +++ b/newlib/libc/stdio/vasprintf.c @@ -31,8 +31,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifndef _REENT_ONLY int -_DEFUN(vasprintf, (strp, fmt, ap), - char **strp, +vasprintf (char **strp, const char *fmt, va_list ap) { @@ -48,8 +47,7 @@ _EXFUN(vasiprintf, (char **, const char *, __VALIST) #endif /* !_REENT_ONLY */ int -_DEFUN(_vasprintf_r, (ptr, strp, fmt, ap), - struct _reent *ptr, +_vasprintf_r (struct _reent *ptr, char **strp, const char *fmt, va_list ap) diff --git a/newlib/libc/stdio/vdiprintf.c b/newlib/libc/stdio/vdiprintf.c index 73a3b19d1..22a71b326 100644 --- a/newlib/libc/stdio/vdiprintf.c +++ b/newlib/libc/stdio/vdiprintf.c @@ -13,8 +13,7 @@ #include "local.h" int -_DEFUN(_vdiprintf_r, (ptr, fd, format, ap), - struct _reent *ptr, +_vdiprintf_r (struct _reent *ptr, int fd, const char *format, va_list ap) @@ -36,8 +35,7 @@ _DEFUN(_vdiprintf_r, (ptr, fd, format, ap), #ifndef _REENT_ONLY int -_DEFUN(vdiprintf, (fd, format, ap), - int fd, +vdiprintf (int fd, const char *format, va_list ap) { diff --git a/newlib/libc/stdio/vdprintf.c b/newlib/libc/stdio/vdprintf.c index 1b50e8833..6261f6217 100644 --- a/newlib/libc/stdio/vdprintf.c +++ b/newlib/libc/stdio/vdprintf.c @@ -13,8 +13,7 @@ #include "local.h" int -_DEFUN(_vdprintf_r, (ptr, fd, format, ap), - struct _reent *ptr, +_vdprintf_r (struct _reent *ptr, int fd, const char *__restrict format, va_list ap) @@ -42,8 +41,7 @@ _EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST) #ifndef _REENT_ONLY int -_DEFUN(vdprintf, (fd, format, ap), - int fd, +vdprintf (int fd, const char *__restrict format, va_list ap) { diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 4fbac0562..6649e2b61 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -198,8 +198,7 @@ static char *rcsid = "$Id$"; #ifdef INTEGER_ONLY #ifndef _FVWRITE_IN_STREAMIO int -_DEFUN(__ssputs_r, (ptr, fp, buf, len), - struct _reent *ptr, +__ssputs_r (struct _reent *ptr, FILE *fp, const char *buf, size_t len) @@ -267,8 +266,7 @@ err: #endif int -_DEFUN(__ssprint_r, (ptr, fp, uio), - struct _reent *ptr, +__ssprint_r (struct _reent *ptr, FILE *fp, register struct __suio *uio) { @@ -369,8 +367,7 @@ int __ssprint_r (struct _reent *, FILE *, register struct __suio *); #ifndef _FVWRITE_IN_STREAMIO int -_DEFUN(__sfputs_r, (ptr, fp, buf, len), - struct _reent *ptr, +__sfputs_r (struct _reent *ptr, FILE *fp, const char *buf, size_t len) @@ -403,8 +400,7 @@ _DEFUN(__sfputs_r, (ptr, fp, buf, len), * then reset it so that it can be reused. */ int -_DEFUN(__sprint_r, (ptr, fp, uio), - struct _reent *ptr, +__sprint_r (struct _reent *ptr, FILE *fp, register struct __suio *uio) { @@ -456,8 +452,7 @@ int __sprint_r (struct _reent *, FILE *, register struct __suio *); * Make sure to avoid inlining. */ _NOINLINE_STATIC int -_DEFUN(__sbprintf, (rptr, fp, fmt, ap), - struct _reent *rptr, +__sbprintf (struct _reent *rptr, register FILE *fp, const char *fmt, va_list ap) @@ -648,8 +643,7 @@ int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, const char *, va_list)); #ifndef STRING_ONLY int -_DEFUN(VFPRINTF, (fp, fmt0, ap), - FILE * fp, +VFPRINTF (FILE * fp, const char *fmt0, va_list ap) { @@ -660,8 +654,7 @@ _DEFUN(VFPRINTF, (fp, fmt0, ap), #endif /* STRING_ONLY */ int -_DEFUN(_VFPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data, +_VFPRINTF_R (struct _reent *data, FILE * fp, const char *fmt0, va_list ap) @@ -2043,8 +2036,7 @@ const __ACTION __action_table[MAX_STATE][MAX_CH_CLASS] = { /* function to get positional parameter N where n = N - 1 */ static union arg_val * -_DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), - struct _reent *data, +get_arg (struct _reent *data, int n, char *fmt, va_list *ap, diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index d76d94b8c..097fd801c 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -224,8 +224,7 @@ typedef unsigned long long u_long_long; #ifndef _REENT_ONLY int -_DEFUN(VFSCANF, (fp, fmt, ap), - register FILE *fp, +VFSCANF (register FILE *fp, const char *fmt, va_list ap) { @@ -236,8 +235,7 @@ _DEFUN(VFSCANF, (fp, fmt, ap), } int -_DEFUN(__SVFSCANF, (fp, fmt0, ap), - register FILE *fp, +__SVFSCANF (register FILE *fp, char const *fmt0, va_list ap) { @@ -247,8 +245,7 @@ _DEFUN(__SVFSCANF, (fp, fmt0, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_VFSCANF_R, (data, fp, fmt, ap), - struct _reent *data, +_VFSCANF_R (struct _reent *data, register FILE *fp, const char *fmt, va_list ap) @@ -263,8 +260,7 @@ _DEFUN(_VFSCANF_R, (data, fp, fmt, ap), * regular ungetc which will drag in file I/O items we don't need. * So, we create our own trimmed-down version. */ int -_DEFUN(_sungetc_r, (data, fp, ch), - struct _reent *data, +_sungetc_r (struct _reent *data, int c, register FILE *fp) { @@ -321,8 +317,7 @@ _DEFUN(_sungetc_r, (data, fp, ch), /* String only version of __srefill_r for sscanf family. */ int -_DEFUN(__ssrefill_r, (ptr, fp), - struct _reent * ptr, +__ssrefill_r (struct _reent * ptr, register FILE * fp) { /* @@ -347,8 +342,7 @@ _DEFUN(__ssrefill_r, (ptr, fp), } size_t -_DEFUN(_sfread_r, (ptr, buf, size, count, fp), - struct _reent * ptr, +_sfread_r (struct _reent * ptr, void *buf, size_t size, size_t count, @@ -402,8 +396,7 @@ __wctob (struct _reent *rptr, wint_t wc) } int -_DEFUN(__SVFSCANF_R, (rptr, fp, fmt0, ap), - struct _reent *rptr, +__SVFSCANF_R (struct _reent *rptr, register FILE *fp, char const *fmt0, va_list ap) diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index 449b628db..dd78eb015 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -174,8 +174,7 @@ int _EXFUN(__SPRINT, (struct _reent *, FILE *, const char *, size_t)); * worries about ungetc buffers and so forth. */ static int -_DEFUN(__sbwprintf, (rptr, fp, fmt, ap), - struct _reent *rptr, +__sbwprintf (struct _reent *rptr, register FILE *fp, const wchar_t *fmt, va_list ap) @@ -366,8 +365,7 @@ _EXFUN(get_arg, (struct _reent *data, int n, wchar_t *fmt, #ifndef STRING_ONLY int -_DEFUN(VFWPRINTF, (fp, fmt0, ap), - FILE *__restrict fp, +VFWPRINTF (FILE *__restrict fp, const wchar_t *__restrict fmt0, va_list ap) { @@ -378,8 +376,7 @@ _DEFUN(VFWPRINTF, (fp, fmt0, ap), #endif /* STRING_ONLY */ int -_DEFUN(_VFWPRINTF_R, (data, fp, fmt0, ap), - struct _reent *data, +_VFWPRINTF_R (struct _reent *data, FILE * fp, const wchar_t *fmt0, va_list ap) @@ -1734,8 +1731,7 @@ wexponent(wchar_t *p0, int exp, int fmtch) /* function to get positional parameter N where n = N - 1 */ static union arg_val * -_DEFUN(get_arg, (data, n, fmt, ap, numargs_p, args, arg_type, last_fmt), - struct _reent *data, +get_arg (struct _reent *data, int n, wchar_t *fmt, va_list *ap, diff --git a/newlib/libc/stdio/vfwscanf.c b/newlib/libc/stdio/vfwscanf.c index 3ac6ecc07..c3470a15c 100644 --- a/newlib/libc/stdio/vfwscanf.c +++ b/newlib/libc/stdio/vfwscanf.c @@ -226,8 +226,7 @@ static void * get_arg (int, va_list *, int *, void **); #ifndef _REENT_ONLY int -_DEFUN(VFWSCANF, (fp, fmt, ap), - register FILE *__restrict fp, +VFWSCANF (register FILE *__restrict fp, const wchar_t *__restrict fmt, va_list ap) { @@ -238,8 +237,7 @@ _DEFUN(VFWSCANF, (fp, fmt, ap), } int -_DEFUN(__SVFWSCANF, (fp, fmt0, ap), - register FILE *fp, +__SVFWSCANF (register FILE *fp, wchar_t const *fmt0, va_list ap) { @@ -249,8 +247,7 @@ _DEFUN(__SVFWSCANF, (fp, fmt0, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_VFWSCANF_R, (data, fp, fmt, ap), - struct _reent *data, +_VFWSCANF_R (struct _reent *data, register FILE *fp, const wchar_t *fmt, va_list ap) @@ -265,8 +262,7 @@ _DEFUN(_VFWSCANF_R, (data, fp, fmt, ap), * regular ungetwc which will drag in file I/O items we don't need. * So, we create our own trimmed-down version. */ static wint_t -_DEFUN(_sungetwc_r, (data, fp, ch), - struct _reent *data, +_sungetwc_r (struct _reent *data, wint_t wc, register FILE *fp) { @@ -325,8 +321,7 @@ _DEFUN(_sungetwc_r, (data, fp, ch), extern int __ssrefill_r (struct _reent *ptr, register FILE * fp); static size_t -_DEFUN(_sfgetwc_r, (ptr, fp), - struct _reent * ptr, +_sfgetwc_r (struct _reent * ptr, FILE * fp) { wchar_t wc; @@ -341,8 +336,7 @@ _DEFUN(_sfgetwc_r, (ptr, fp), #endif /* STRING_ONLY */ int -_DEFUN(__SVFWSCANF_R, (rptr, fp, fmt0, ap), - struct _reent *rptr, +__SVFWSCANF_R (struct _reent *rptr, register FILE *fp, wchar_t const *fmt0, va_list ap) diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c index 950009d4a..9678815f1 100644 --- a/newlib/libc/stdio/viprintf.c +++ b/newlib/libc/stdio/viprintf.c @@ -105,8 +105,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifndef _REENT_ONLY int -_DEFUN(viprintf, (fmt, ap), - const char *fmt, +viprintf (const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -118,8 +117,7 @@ _DEFUN(viprintf, (fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_viprintf_r, (ptr, fmt, ap), - struct _reent *ptr, +_viprintf_r (struct _reent *ptr, const char *fmt, va_list ap) { diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c index 0c9b13f58..e5ad1dbbd 100644 --- a/newlib/libc/stdio/viscanf.c +++ b/newlib/libc/stdio/viscanf.c @@ -89,8 +89,7 @@ Supporting OS subroutines required: #ifndef _REENT_ONLY int -_DEFUN(viscanf, (fmt, ap), - const char *fmt, +viscanf (const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -102,8 +101,7 @@ _DEFUN(viscanf, (fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_viscanf_r, (ptr, fmt, ap), - struct _reent *ptr, +_viscanf_r (struct _reent *ptr, const char *fmt, va_list ap) { diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c index 289c46cd0..79c324d55 100644 --- a/newlib/libc/stdio/vprintf.c +++ b/newlib/libc/stdio/vprintf.c @@ -29,8 +29,7 @@ #ifndef _REENT_ONLY int -_DEFUN(vprintf, (fmt, ap), - const char *fmt, +vprintf (const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -47,8 +46,7 @@ _EXFUN(viprintf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vprintf")))); #endif /* !_REENT_ONLY */ int -_DEFUN(_vprintf_r, (ptr, fmt, ap), - struct _reent *ptr, +_vprintf_r (struct _reent *ptr, const char *__restrict fmt, va_list ap) { diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c index 260359a3e..be329ded4 100644 --- a/newlib/libc/stdio/vscanf.c +++ b/newlib/libc/stdio/vscanf.c @@ -30,8 +30,7 @@ #ifndef _REENT_ONLY int -_DEFUN(vscanf, (fmt, ap), - const char *fmt, +vscanf (const char *fmt, va_list ap) { struct _reent *reent = _REENT; @@ -48,8 +47,7 @@ _EXFUN(viscanf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vscanf")))); #endif /* !_REENT_ONLY */ int -_DEFUN(_vscanf_r, (ptr, fmt, ap), - struct _reent *ptr, +_vscanf_r (struct _reent *ptr, const char *__restrict fmt, va_list ap) { diff --git a/newlib/libc/stdio/vsiprintf.c b/newlib/libc/stdio/vsiprintf.c index ff83b7856..74eae0253 100644 --- a/newlib/libc/stdio/vsiprintf.c +++ b/newlib/libc/stdio/vsiprintf.c @@ -31,8 +31,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifndef _REENT_ONLY int -_DEFUN(vsiprintf, (str, fmt, ap), - char *str, +vsiprintf (char *str, const char *fmt, va_list ap) { @@ -42,8 +41,7 @@ _DEFUN(vsiprintf, (str, fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_vsiprintf_r, (ptr, str, fmt, ap), - struct _reent *ptr, +_vsiprintf_r (struct _reent *ptr, char *str, const char *fmt, va_list ap) diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c index 6ad0f4a8d..5679df056 100644 --- a/newlib/libc/stdio/vsiscanf.c +++ b/newlib/libc/stdio/vsiscanf.c @@ -35,8 +35,7 @@ #ifndef _REENT_ONLY int -_DEFUN(vsiscanf, (str, fmt, ap), - const char *str, +vsiscanf (const char *str, const char *fmt, va_list ap) { @@ -46,8 +45,7 @@ _DEFUN(vsiscanf, (str, fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_vsiscanf_r, (ptr, str, fmt, ap), - struct _reent *ptr, +_vsiscanf_r (struct _reent *ptr, const char *str, const char *fmt, va_list ap) diff --git a/newlib/libc/stdio/vsniprintf.c b/newlib/libc/stdio/vsniprintf.c index e60f779ca..6036c8cb8 100644 --- a/newlib/libc/stdio/vsniprintf.c +++ b/newlib/libc/stdio/vsniprintf.c @@ -32,8 +32,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifndef _REENT_ONLY int -_DEFUN(vsniprintf, (str, size, fmt, ap), - char *str, +vsniprintf (char *str, size_t size, const char *fmt, va_list ap) @@ -44,8 +43,7 @@ _DEFUN(vsniprintf, (str, size, fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_vsniprintf_r, (ptr, str, size, fmt, ap), - struct _reent *ptr, +_vsniprintf_r (struct _reent *ptr, char *str, size_t size, const char *fmt, diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c index dda45256a..02b5443bf 100644 --- a/newlib/libc/stdio/vsnprintf.c +++ b/newlib/libc/stdio/vsnprintf.c @@ -32,8 +32,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifndef _REENT_ONLY int -_DEFUN(vsnprintf, (str, size, fmt, ap), - char *__restrict str, +vsnprintf (char *__restrict str, size_t size, const char *__restrict fmt, va_list ap) @@ -50,8 +49,7 @@ _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST) #endif /* !_REENT_ONLY */ int -_DEFUN(_vsnprintf_r, (ptr, str, size, fmt, ap), - struct _reent *ptr, +_vsnprintf_r (struct _reent *ptr, char *__restrict str, size_t size, const char *__restrict fmt, diff --git a/newlib/libc/stdio/vsprintf.c b/newlib/libc/stdio/vsprintf.c index 4940b974e..7344a3854 100644 --- a/newlib/libc/stdio/vsprintf.c +++ b/newlib/libc/stdio/vsprintf.c @@ -31,8 +31,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifndef _REENT_ONLY int -_DEFUN(vsprintf, (str, fmt, ap), - char *__restrict str, +vsprintf (char *__restrict str, const char *__restrict fmt, va_list ap) { @@ -48,8 +47,7 @@ _EXFUN(vsiprintf, (char *, const char *, __VALIST) #endif /* !_REENT_ONLY */ int -_DEFUN(_vsprintf_r, (ptr, str, fmt, ap), - struct _reent *ptr, +_vsprintf_r (struct _reent *ptr, char *__restrict str, const char *__restrict fmt, va_list ap) diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c index 87d4cd161..61c65cd5e 100644 --- a/newlib/libc/stdio/vsscanf.c +++ b/newlib/libc/stdio/vsscanf.c @@ -35,8 +35,7 @@ #ifndef _REENT_ONLY int -_DEFUN(vsscanf, (str, fmt, ap), - const char *__restrict str, +vsscanf (const char *__restrict str, const char *__restrict fmt, va_list ap) { @@ -52,8 +51,7 @@ _EXFUN(vsiscanf, (const char *, const char *, __VALIST) #endif /* !_REENT_ONLY */ int -_DEFUN(_vsscanf_r, (ptr, str, fmt, ap), - struct _reent *ptr, +_vsscanf_r (struct _reent *ptr, const char *__restrict str, const char *__restrict fmt, va_list ap) diff --git a/newlib/libc/stdio/vswprintf.c b/newlib/libc/stdio/vswprintf.c index 9c9127cd6..5297a27cf 100644 --- a/newlib/libc/stdio/vswprintf.c +++ b/newlib/libc/stdio/vswprintf.c @@ -31,8 +31,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #include "local.h" int -_DEFUN(_vswprintf_r, (ptr, str, size, fmt, ap), - struct _reent *ptr, +_vswprintf_r (struct _reent *ptr, wchar_t *str, size_t size, const wchar_t *fmt, @@ -70,8 +69,7 @@ _DEFUN(_vswprintf_r, (ptr, str, size, fmt, ap), #ifndef _REENT_ONLY int -_DEFUN(vswprintf, (str, size, fmt, ap), - wchar_t *__restrict str, +vswprintf (wchar_t *__restrict str, size_t size, const wchar_t *__restrict fmt, va_list ap) diff --git a/newlib/libc/stdio/vwprintf.c b/newlib/libc/stdio/vwprintf.c index 28381363e..d1b7d4cd0 100644 --- a/newlib/libc/stdio/vwprintf.c +++ b/newlib/libc/stdio/vwprintf.c @@ -26,8 +26,7 @@ #ifndef _REENT_ONLY int -_DEFUN(vwprintf, (fmt, ap), - const wchar_t *__restrict fmt, +vwprintf (const wchar_t *__restrict fmt, va_list ap) { struct _reent *reent = _REENT; @@ -39,8 +38,7 @@ _DEFUN(vwprintf, (fmt, ap), #endif /* !_REENT_ONLY */ int -_DEFUN(_vwprintf_r, (ptr, fmt, ap), - struct _reent *ptr, +_vwprintf_r (struct _reent *ptr, const wchar_t *fmt, va_list ap) { diff --git a/newlib/libc/stdio/wbuf.c b/newlib/libc/stdio/wbuf.c index 13578ea33..034d8ebcc 100644 --- a/newlib/libc/stdio/wbuf.c +++ b/newlib/libc/stdio/wbuf.c @@ -33,8 +33,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; */ int -_DEFUN(__swbuf_r, (ptr, c, fp), - struct _reent *ptr, +__swbuf_r (struct _reent *ptr, register int c, register FILE *fp) { @@ -88,8 +87,7 @@ _DEFUN(__swbuf_r, (ptr, c, fp), required for backward compatibility with applications built against earlier dynamically built newlib libraries. */ int -_DEFUN(__swbuf, (c, fp), - register int c, +__swbuf (register int c, register FILE *fp) { return __swbuf_r (_REENT, c, fp); diff --git a/newlib/libc/stdio/wprintf.c b/newlib/libc/stdio/wprintf.c index ef212d851..176b16a20 100644 --- a/newlib/libc/stdio/wprintf.c +++ b/newlib/libc/stdio/wprintf.c @@ -24,8 +24,7 @@ #include "local.h" int -_DEFUN(_wprintf_r, (ptr, fmt), - struct _reent *ptr, +_wprintf_r (struct _reent *ptr, const wchar_t *fmt, ...) { int ret; @@ -41,8 +40,7 @@ _DEFUN(_wprintf_r, (ptr, fmt), #ifndef _REENT_ONLY int -_DEFUN(wprintf, (fmt), - const wchar_t *__restrict fmt, ...) +wprintf (const wchar_t *__restrict fmt, ...) { int ret; va_list ap; diff --git a/newlib/libc/stdio/wsetup.c b/newlib/libc/stdio/wsetup.c index 72280d2df..5a4fc0ace 100644 --- a/newlib/libc/stdio/wsetup.c +++ b/newlib/libc/stdio/wsetup.c @@ -30,8 +30,7 @@ */ int -_DEFUN(__swsetup_r, (ptr, fp), - struct _reent *ptr, +__swsetup_r (struct _reent *ptr, register FILE * fp) { /* Make sure stdio is set up. */ diff --git a/newlib/libc/stdio64/fdopen64.c b/newlib/libc/stdio64/fdopen64.c index 3c8d4fa05..9d9645b36 100644 --- a/newlib/libc/stdio64/fdopen64.c +++ b/newlib/libc/stdio64/fdopen64.c @@ -35,8 +35,7 @@ File pointer or <>, as for <>. extern int __sflags (); FILE * -_DEFUN (_fdopen64_r, (ptr, fd, mode), - struct _reent *ptr, +_fdopen64_r (struct _reent *ptr, int fd, const char *mode) { @@ -108,8 +107,7 @@ _DEFUN (_fdopen64_r, (ptr, fd, mode), #ifndef _REENT_ONLY FILE * -_DEFUN (fdopen64, (fd, mode), - int fd, +fdopen64 (int fd, const char *mode) { return _fdopen64_r (_REENT, fd, mode); diff --git a/newlib/libc/stdio64/fgetpos64.c b/newlib/libc/stdio64/fgetpos64.c index e2dd28914..52ead9d0d 100644 --- a/newlib/libc/stdio64/fgetpos64.c +++ b/newlib/libc/stdio64/fgetpos64.c @@ -45,8 +45,7 @@ No supporting OS subroutines are required. #ifdef __LARGE64_FILES int -_DEFUN (_fgetpos64_r, (ptr, fp, pos), - struct _reent * ptr, +_fgetpos64_r (struct _reent * ptr, FILE * fp, _fpos64_t * pos) { @@ -62,8 +61,7 @@ _DEFUN (_fgetpos64_r, (ptr, fp, pos), #ifndef _REENT_ONLY int -_DEFUN (fgetpos64, (fp, pos), - FILE * fp, +fgetpos64 (FILE * fp, _fpos64_t * pos) { return _fgetpos64_r (_REENT, fp, pos); diff --git a/newlib/libc/stdio64/fopen64.c b/newlib/libc/stdio64/fopen64.c index 406afa190..8c8df9141 100644 --- a/newlib/libc/stdio64/fopen64.c +++ b/newlib/libc/stdio64/fopen64.c @@ -64,8 +64,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifdef __LARGE64_FILES FILE * -_DEFUN (_fopen64_r, (ptr, file, mode), - struct _reent *ptr, +_fopen64_r (struct _reent *ptr, const char *file, const char *mode) { @@ -117,8 +116,7 @@ _DEFUN (_fopen64_r, (ptr, file, mode), #ifndef _REENT_ONLY FILE * -_DEFUN (fopen64, (file, mode), - const char *file, +fopen64 (const char *file, const char *mode) { return _fopen64_r (_REENT, file, mode); diff --git a/newlib/libc/stdio64/freopen64.c b/newlib/libc/stdio64/freopen64.c index d267899c6..17942b74a 100644 --- a/newlib/libc/stdio64/freopen64.c +++ b/newlib/libc/stdio64/freopen64.c @@ -75,8 +75,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef __LARGE64_FILES FILE * -_DEFUN (_freopen64_r, (ptr, file, mode, fp), - struct _reent *ptr, +_freopen64_r (struct _reent *ptr, const char *file, const char *mode, register FILE *fp) @@ -247,8 +246,7 @@ _DEFUN (_freopen64_r, (ptr, file, mode, fp), #ifndef _REENT_ONLY FILE * -_DEFUN (freopen64, (file, mode, fp), - const char *file, +freopen64 (const char *file, const char *mode, register FILE *fp) { diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c index 8cd11fa67..085855d4b 100644 --- a/newlib/libc/stdio64/fseeko64.c +++ b/newlib/libc/stdio64/fseeko64.c @@ -85,8 +85,7 @@ Supporting OS subroutines required: <>, <>, <>, */ _off64_t -_DEFUN (_fseeko64_r, (ptr, fp, offset, whence), - struct _reent *ptr, +_fseeko64_r (struct _reent *ptr, register FILE *fp, _off64_t offset, int whence) @@ -342,8 +341,7 @@ dumb: #ifndef _REENT_ONLY _off64_t -_DEFUN (fseeko64, (fp, offset, whence), - register FILE *fp, +fseeko64 (register FILE *fp, _off64_t offset, int whence) { diff --git a/newlib/libc/stdio64/fsetpos64.c b/newlib/libc/stdio64/fsetpos64.c index f5f6bdacf..254eb53d7 100644 --- a/newlib/libc/stdio64/fsetpos64.c +++ b/newlib/libc/stdio64/fsetpos64.c @@ -41,8 +41,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef __LARGE64_FILES int -_DEFUN (_fsetpos64_r, (ptr, iop, pos), - struct _reent *ptr, +_fsetpos64_r (struct _reent *ptr, FILE * iop, const _fpos64_t * pos) { @@ -56,8 +55,7 @@ _DEFUN (_fsetpos64_r, (ptr, iop, pos), #ifndef _REENT_ONLY int -_DEFUN (fsetpos64, (iop, pos), - FILE * iop, +fsetpos64 (FILE * iop, const _fpos64_t * pos) { return _fsetpos64_r (_REENT, iop, pos); diff --git a/newlib/libc/stdio64/ftello64.c b/newlib/libc/stdio64/ftello64.c index 9a7e7edfd..7221d5eaf 100644 --- a/newlib/libc/stdio64/ftello64.c +++ b/newlib/libc/stdio64/ftello64.c @@ -76,8 +76,7 @@ static char sccsid[] = "%W% (Berkeley) %G%"; #ifdef __LARGE64_FILES _off64_t -_DEFUN (_ftello64_r, (ptr, fp), - struct _reent *ptr, +_ftello64_r (struct _reent *ptr, register FILE * fp) { _fpos64_t pos; @@ -150,8 +149,7 @@ _DEFUN (_ftello64_r, (ptr, fp), #ifndef _REENT_ONLY _off64_t -_DEFUN (ftello64, (fp), - register FILE * fp) +ftello64 (register FILE * fp) { return _ftello64_r (_REENT, fp); } diff --git a/newlib/libc/stdio64/stdio64.c b/newlib/libc/stdio64/stdio64.c index 813b919bf..8e5efc8b0 100644 --- a/newlib/libc/stdio64/stdio64.c +++ b/newlib/libc/stdio64/stdio64.c @@ -26,8 +26,7 @@ #ifdef __LARGE64_FILES _fpos64_t -_DEFUN(__sseek64, (ptr, cookie, offset, whence), - struct _reent *ptr, +__sseek64 (struct _reent *ptr, void *cookie, _fpos64_t offset, int whence) @@ -47,8 +46,7 @@ _DEFUN(__sseek64, (ptr, cookie, offset, whence), } _READ_WRITE_RETURN_TYPE -_DEFUN(__swrite64, (ptr, cookie, buf, n), - struct _reent *ptr, +__swrite64 (struct _reent *ptr, void *cookie, char const *buf, _READ_WRITE_BUFSIZE_TYPE n) diff --git a/newlib/libc/stdio64/tmpfile64.c b/newlib/libc/stdio64/tmpfile64.c index 2012417fb..18a38d65c 100644 --- a/newlib/libc/stdio64/tmpfile64.c +++ b/newlib/libc/stdio64/tmpfile64.c @@ -53,8 +53,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifdef __LARGE64_FILES FILE * -_DEFUN (_tmpfile64_r, (ptr), - struct _reent *ptr) +_tmpfile64_r (struct _reent *ptr) { FILE *fp; int e; diff --git a/newlib/libc/stdlib/_Exit.c b/newlib/libc/stdlib/_Exit.c index b07559acb..8e205a0c3 100644 --- a/newlib/libc/stdlib/_Exit.c +++ b/newlib/libc/stdlib/_Exit.c @@ -34,8 +34,7 @@ Supporting OS subroutines required: <<_exit>>. #include void -_DEFUN (_Exit, (code), - int code) +_Exit (int code) { _exit (code); } diff --git a/newlib/libc/stdlib/__adjust.c b/newlib/libc/stdlib/__adjust.c index 7627cc7ac..4c478f30b 100644 --- a/newlib/libc/stdlib/__adjust.c +++ b/newlib/libc/stdlib/__adjust.c @@ -9,8 +9,7 @@ #define abs(x) (((x) < 0) ? -(x) : (x)) double -_DEFUN (__adjust, (ptr, acc, dexp, sign), - struct _reent *ptr, +__adjust (struct _reent *ptr, double *acc, int dexp, int sign) diff --git a/newlib/libc/stdlib/__atexit.c b/newlib/libc/stdlib/__atexit.c index cb4a2682e..18e47dc95 100644 --- a/newlib/libc/stdlib/__atexit.c +++ b/newlib/libc/stdlib/__atexit.c @@ -63,9 +63,7 @@ static struct _atexit _global_atexit0 = _ATEXIT_INIT; */ int -_DEFUN (__register_exitproc, - (type, fn, arg, d), - int type, +__register_exitproc (int type, void (*fn) (void), void *arg, void *d) diff --git a/newlib/libc/stdlib/__call_atexit.c b/newlib/libc/stdlib/__call_atexit.c index ad70fcd33..d8e72993e 100644 --- a/newlib/libc/stdlib/__call_atexit.c +++ b/newlib/libc/stdlib/__call_atexit.c @@ -65,8 +65,7 @@ register_fini(void) */ void -_DEFUN (__call_exitprocs, (code, d), - int code, void *d) +__call_exitprocs (int code, void *d) { register struct _atexit *p; struct _atexit **lastp; diff --git a/newlib/libc/stdlib/__exp10.c b/newlib/libc/stdlib/__exp10.c index 1ff81a680..cf223742b 100644 --- a/newlib/libc/stdlib/__exp10.c +++ b/newlib/libc/stdlib/__exp10.c @@ -6,8 +6,7 @@ #include "std.h" double -_DEFUN (__exp10, (x), - unsigned x) +__exp10 (unsigned x) { static const double powtab[] = {1.0, diff --git a/newlib/libc/stdlib/__ten_mu.c b/newlib/libc/stdlib/__ten_mu.c index a7fe70caf..25af8d0c7 100644 --- a/newlib/libc/stdlib/__ten_mu.c +++ b/newlib/libc/stdlib/__ten_mu.c @@ -9,8 +9,7 @@ #include "std.h" int -_DEFUN (__ten_mul, (acc, digit), - double *acc, +__ten_mul (double *acc, int digit) { /* diff --git a/newlib/libc/stdlib/a64l.c b/newlib/libc/stdlib/a64l.c index 8d68ed0e9..dcac2e050 100644 --- a/newlib/libc/stdlib/a64l.c +++ b/newlib/libc/stdlib/a64l.c @@ -56,8 +56,7 @@ Supporting OS subroutines required: None. #include long -_DEFUN (a64l, (input), - const char *input) +a64l (const char *input) { const char *ptr; char ch; diff --git a/newlib/libc/stdlib/abs.c b/newlib/libc/stdlib/abs.c index d347265fa..85a3fecd8 100644 --- a/newlib/libc/stdlib/abs.c +++ b/newlib/libc/stdlib/abs.c @@ -32,7 +32,7 @@ No supporting OS subroutines are required. #include int -_DEFUN (abs, (i), int i) +abs (int i) { return (i < 0) ? -i : i; } diff --git a/newlib/libc/stdlib/assert.c b/newlib/libc/stdlib/assert.c index ba5b46197..46ac92b8c 100644 --- a/newlib/libc/stdlib/assert.c +++ b/newlib/libc/stdlib/assert.c @@ -50,8 +50,7 @@ Supporting OS subroutines required (only if enabled): <>, <>, #ifndef HAVE_ASSERT_FUNC /* func can be NULL, in which case no function information is given. */ void -_DEFUN (__assert_func, (file, line, func, failedexpr), - const char *file, +__assert_func (const char *file, int line, const char *func, const char *failedexpr) @@ -66,8 +65,7 @@ _DEFUN (__assert_func, (file, line, func, failedexpr), #endif /* HAVE_ASSERT_FUNC */ void -_DEFUN (__assert, (file, line, failedexpr), - const char *file, +__assert (const char *file, int line, const char *failedexpr) { diff --git a/newlib/libc/stdlib/atexit.c b/newlib/libc/stdlib/atexit.c index 1710aff14..1d300bd0f 100644 --- a/newlib/libc/stdlib/atexit.c +++ b/newlib/libc/stdlib/atexit.c @@ -53,9 +53,7 @@ Supporting OS subroutines required: <>, <>, <>, */ int -_DEFUN (atexit, - (fn), - void _EXFNPTR(fn, (void))) +atexit (void _EXFNPTR(fn, (void))) { return __register_exitproc (__et_atexit, fn, NULL, NULL); } diff --git a/newlib/libc/stdlib/atof.c b/newlib/libc/stdlib/atof.c index 7dfbd9c55..17ba0fa52 100644 --- a/newlib/libc/stdlib/atof.c +++ b/newlib/libc/stdlib/atof.c @@ -57,8 +57,7 @@ Supporting OS subroutines required: <>, <>, <>, #include <_ansi.h> double -_DEFUN (atof, (s), - const char *s) +atof (const char *s) { return strtod (s, NULL); } diff --git a/newlib/libc/stdlib/atoff.c b/newlib/libc/stdlib/atoff.c index 2966254be..e25ff2917 100644 --- a/newlib/libc/stdlib/atoff.c +++ b/newlib/libc/stdlib/atoff.c @@ -2,8 +2,7 @@ #include <_ansi.h> float -_DEFUN (atoff, (s), - const char *s) +atoff (const char *s) { return strtof (s, NULL); } diff --git a/newlib/libc/stdlib/atoi.c b/newlib/libc/stdlib/atoi.c index 83ad24177..4da53e80a 100644 --- a/newlib/libc/stdlib/atoi.c +++ b/newlib/libc/stdlib/atoi.c @@ -47,16 +47,14 @@ No supporting OS subroutines are required. #ifndef _REENT_ONLY int -_DEFUN (atoi, (s), - const char *s) +atoi (const char *s) { return (int) strtol (s, NULL, 10); } #endif /* !_REENT_ONLY */ int -_DEFUN (_atoi_r, (s), - struct _reent *ptr, +_atoi_r (struct _reent *ptr, const char *s) { return (int) _strtol_r (ptr, s, NULL, 10); diff --git a/newlib/libc/stdlib/atol.c b/newlib/libc/stdlib/atol.c index cad512fbc..a5c8ee9f4 100644 --- a/newlib/libc/stdlib/atol.c +++ b/newlib/libc/stdlib/atol.c @@ -7,14 +7,14 @@ #ifndef _REENT_ONLY long -_DEFUN (atol, (s), const char *s) +atol (const char *s) { return strtol (s, NULL, 10); } #endif /* !_REENT_ONLY */ long -_DEFUN (_atol_r, (ptr, s), struct _reent *ptr, const char *s) +_atol_r (struct _reent *ptr, const char *s) { return _strtol_r (ptr, s, NULL, 10); } diff --git a/newlib/libc/stdlib/atoll.c b/newlib/libc/stdlib/atoll.c index e853f25eb..a8c56fe16 100644 --- a/newlib/libc/stdlib/atoll.c +++ b/newlib/libc/stdlib/atoll.c @@ -69,16 +69,14 @@ No supporting OS subroutines are required. #ifndef _REENT_ONLY long long -_DEFUN(atoll, (str), - const char *str) +atoll (const char *str) { return strtoll(str, (char **)NULL, 10); } #endif /* !_REENT_ONLY */ long long -_DEFUN(_atoll_r, (ptr, str), - struct _reent *ptr, +_atoll_r (struct _reent *ptr, const char *str) { return _strtoll_r(ptr, str, (char **)NULL, 10); diff --git a/newlib/libc/stdlib/calloc.c b/newlib/libc/stdlib/calloc.c index f853f4f3c..208e27eb1 100644 --- a/newlib/libc/stdlib/calloc.c +++ b/newlib/libc/stdlib/calloc.c @@ -46,8 +46,7 @@ Supporting OS subroutines required: <>, <>, <>, #ifndef _REENT_ONLY void * -_DEFUN (calloc, (n, size), - size_t n, +calloc (size_t n, size_t size) { return _calloc_r (_REENT, n, size); diff --git a/newlib/libc/stdlib/cxa_atexit.c b/newlib/libc/stdlib/cxa_atexit.c index 096add4fa..ae2d21a60 100644 --- a/newlib/libc/stdlib/cxa_atexit.c +++ b/newlib/libc/stdlib/cxa_atexit.c @@ -22,9 +22,7 @@ const void * const __cxa_atexit_dummy = &__on_exit_args; */ int -_DEFUN (__cxa_atexit, - (fn, arg, d), - void (*fn) (void *), +__cxa_atexit (void (*fn) (void *), void *arg, void *d) { diff --git a/newlib/libc/stdlib/cxa_finalize.c b/newlib/libc/stdlib/cxa_finalize.c index 17d0526a7..467532881 100644 --- a/newlib/libc/stdlib/cxa_finalize.c +++ b/newlib/libc/stdlib/cxa_finalize.c @@ -13,8 +13,7 @@ */ void -_DEFUN (__cxa_finalize, (d), - void * d) +__cxa_finalize (void * d) { __call_exitprocs (0, d); } diff --git a/newlib/libc/stdlib/div.c b/newlib/libc/stdlib/div.c index 4d2ffee48..20ad7b865 100644 --- a/newlib/libc/stdlib/div.c +++ b/newlib/libc/stdlib/div.c @@ -81,8 +81,7 @@ No supporting OS subroutines are required. #include /* div_t */ div_t -_DEFUN (div, (num, denom), - int num, +div (int num, int denom) { div_t r; diff --git a/newlib/libc/stdlib/drand48.c b/newlib/libc/stdlib/drand48.c index 6c4dca1ed..061689448 100644 --- a/newlib/libc/stdlib/drand48.c +++ b/newlib/libc/stdlib/drand48.c @@ -14,8 +14,7 @@ #include "rand48.h" double -_DEFUN (_drand48_r, (r), - struct _reent *r) +_drand48_r (struct _reent *r) { _REENT_CHECK_RAND48(r); return _erand48_r(r, __rand48_seed); diff --git a/newlib/libc/stdlib/dtoa.c b/newlib/libc/stdlib/dtoa.c index 3b8976435..c38f37afd 100644 --- a/newlib/libc/stdlib/dtoa.c +++ b/newlib/libc/stdlib/dtoa.c @@ -33,9 +33,7 @@ #include "mprec.h" static int -_DEFUN (quorem, - (b, S), - _Bigint * b, _Bigint * S) +quorem (_Bigint * b, _Bigint * S) { int n; __Long borrow, y; @@ -177,9 +175,7 @@ _DEFUN (quorem, char * -_DEFUN (_dtoa_r, - (ptr, _d, mode, ndigits, decpt, sign, rve), - struct _reent *ptr, +_dtoa_r (struct _reent *ptr, double _d, int mode, int ndigits, diff --git a/newlib/libc/stdlib/dtoastub.c b/newlib/libc/stdlib/dtoastub.c index a857c2452..d1c8a6756 100644 --- a/newlib/libc/stdlib/dtoastub.c +++ b/newlib/libc/stdlib/dtoastub.c @@ -8,9 +8,7 @@ #ifndef _REENT_ONLY char * -_DEFUN (__dtoa, - (d, mode, ndigits, decpt, sign, rve), - double d, +__dtoa (double d, int mode, int ndigits, int *decpt, diff --git a/newlib/libc/stdlib/ecvtbuf.c b/newlib/libc/stdlib/ecvtbuf.c index 2326f55ca..e3d7b55d8 100644 --- a/newlib/libc/stdlib/ecvtbuf.c +++ b/newlib/libc/stdlib/ecvtbuf.c @@ -58,8 +58,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" static void -_DEFUN (print_f, (ptr, buf, invalue, ndigit, type, dot, mode), - struct _reent *ptr, +print_f (struct _reent *ptr, char *buf, double invalue, int ndigit, @@ -126,8 +125,7 @@ _DEFUN (print_f, (ptr, buf, invalue, ndigit, type, dot, mode), WIDTH is the number of digits of precision after the decimal point. */ static void -_DEFUN (print_e, (ptr, buf, invalue, width, type, dot), - struct _reent *ptr, +print_e (struct _reent *ptr, char *buf, double invalue, int width, @@ -209,8 +207,7 @@ _DEFUN (print_e, (ptr, buf, invalue, width, type, dot), support ecvt and fcvt, which aren't ANSI anyway. */ char * -_DEFUN (fcvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), - double invalue, +fcvtbuf (double invalue, int ndigit, int *decpt, int *sign, @@ -266,8 +263,7 @@ _DEFUN (fcvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), } char * -_DEFUN (ecvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), - double invalue, +ecvtbuf (double invalue, int ndigit, int *decpt, int *sign, @@ -317,8 +313,7 @@ _DEFUN (ecvtbuf, (invalue, ndigit, decpt, sign, fcvt_buf), #endif char * -_DEFUN (_gcvt, (ptr, invalue, ndigit, buf, type, dot), - struct _reent *ptr, +_gcvt (struct _reent *ptr, double invalue, int ndigit, char *buf, @@ -425,8 +420,7 @@ _DEFUN (_gcvt, (ptr, invalue, ndigit, buf, type, dot), } char * -_DEFUN (_dcvt, (ptr, buffer, invalue, precision, width, type, dot), - struct _reent *ptr, +_dcvt (struct _reent *ptr, char *buffer, double invalue, int precision, diff --git a/newlib/libc/stdlib/efgcvt.c b/newlib/libc/stdlib/efgcvt.c index e354bb170..9314bf361 100644 --- a/newlib/libc/stdlib/efgcvt.c +++ b/newlib/libc/stdlib/efgcvt.c @@ -103,8 +103,7 @@ Supporting OS subroutines required: <>, <>, <>, #include "local.h" char * -_DEFUN (fcvt, (d, ndigit, decpt, sign), - double d, +fcvt (double d, int ndigit, int *decpt, int *sign) @@ -113,8 +112,7 @@ _DEFUN (fcvt, (d, ndigit, decpt, sign), } char * -_DEFUN (fcvtf, (d, ndigit, decpt, sign), - float d, +fcvtf (float d, int ndigit, int *decpt, int *sign) @@ -124,8 +122,7 @@ _DEFUN (fcvtf, (d, ndigit, decpt, sign), char * -_DEFUN (gcvtf, (d, ndigit, buf), - float d, +gcvtf (float d, int ndigit, char *buf) { @@ -135,8 +132,7 @@ _DEFUN (gcvtf, (d, ndigit, buf), char * -_DEFUN (ecvt, (d, ndigit, decpt, sign), - double d, +ecvt (double d, int ndigit, int *decpt, int *sign) @@ -145,8 +141,7 @@ _DEFUN (ecvt, (d, ndigit, decpt, sign), } char * -_DEFUN (ecvtf, (d, ndigit, decpt, sign), - float d, +ecvtf (float d, int ndigit, int *decpt, int *sign) @@ -156,8 +151,7 @@ _DEFUN (ecvtf, (d, ndigit, decpt, sign), char * -_DEFUN (gcvt, (d, ndigit, buf), - double d, +gcvt (double d, int ndigit, char *buf) { diff --git a/newlib/libc/stdlib/erand48.c b/newlib/libc/stdlib/erand48.c index a62ff345a..1be4a953e 100644 --- a/newlib/libc/stdlib/erand48.c +++ b/newlib/libc/stdlib/erand48.c @@ -14,8 +14,7 @@ #include "rand48.h" double -_DEFUN (_erand48_r, (r, xseed), - struct _reent *r, +_erand48_r (struct _reent *r, unsigned short xseed[3]) { __dorand48(r, xseed); @@ -26,8 +25,7 @@ _DEFUN (_erand48_r, (r, xseed), #ifndef _REENT_ONLY double -_DEFUN (erand48, (xseed), - unsigned short xseed[3]) +erand48 (unsigned short xseed[3]) { return _erand48_r (_REENT, xseed); } diff --git a/newlib/libc/stdlib/exit.c b/newlib/libc/stdlib/exit.c index 8fa949081..95108ade6 100644 --- a/newlib/libc/stdlib/exit.c +++ b/newlib/libc/stdlib/exit.c @@ -50,8 +50,7 @@ Supporting OS subroutines required: <<_exit>>. */ void -_DEFUN (exit, (code), - int code) +exit (int code) { #ifdef _LITE_EXIT /* Refer to comments in __atexit.c for more details of lite exit. */ diff --git a/newlib/libc/stdlib/gdtoa-gethex.c b/newlib/libc/stdlib/gdtoa-gethex.c index 18d9cc172..939e0dd8d 100644 --- a/newlib/libc/stdlib/gdtoa-gethex.c +++ b/newlib/libc/stdlib/gdtoa-gethex.c @@ -59,8 +59,7 @@ const unsigned char __hexdig[256]= }; #else /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ unsigned char -_DEFUN (__hexdig_fun, (c), - unsigned char c) +__hexdig_fun (unsigned char c) { if(c>='0' && c<='9') return c-'0'+0x10; else if(c>='a' && c<='f') return c-'a'+0x10+10; @@ -70,8 +69,7 @@ _DEFUN (__hexdig_fun, (c), #endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ static void -_DEFUN(rshift, (b, k), - _Bigint *b, +rshift (_Bigint *b, int k) { __ULong *x, *x1, *xe, y; @@ -101,8 +99,7 @@ _DEFUN(rshift, (b, k), } static _Bigint * -_DEFUN (increment, (ptr, b), - struct _reent *ptr, +increment (struct _reent *ptr, _Bigint *b) { __ULong *x, *xe; diff --git a/newlib/libc/stdlib/gdtoa-hexnan.c b/newlib/libc/stdlib/gdtoa-hexnan.c index fa98646f6..a17e5a699 100644 --- a/newlib/libc/stdlib/gdtoa-hexnan.c +++ b/newlib/libc/stdlib/gdtoa-hexnan.c @@ -45,8 +45,7 @@ THIS SOFTWARE. #ifdef INFNAN_CHECK int -_DEFUN (match, (sp, t), - const char **sp, +match (const char **sp, char *t) { int c, d; @@ -63,8 +62,7 @@ _DEFUN (match, (sp, t), } static void -_DEFUN (L_shift, (x, x1, i), - __ULong *x, +L_shift (__ULong *x, __ULong *x1, int i) { @@ -80,8 +78,7 @@ _DEFUN (L_shift, (x, x1, i), } int -_DEFUN (hexnan, (sp, fpi, x0), - const char **sp, +hexnan (const char **sp, const FPI *fpi, __ULong *x0) { diff --git a/newlib/libc/stdlib/getenv.c b/newlib/libc/stdlib/getenv.c index 973a54732..107376bcd 100644 --- a/newlib/libc/stdlib/getenv.c +++ b/newlib/libc/stdlib/getenv.c @@ -64,8 +64,7 @@ variables vary from one system to another. */ char * -_DEFUN (_findenv, (name, offset), - register const char *name, +_findenv (register const char *name, int *offset) { return _findenv_r (_REENT, name, offset); @@ -77,8 +76,7 @@ _DEFUN (_findenv, (name, offset), */ char * -_DEFUN (getenv, (name), - const char *name) +getenv (const char *name) { int offset; diff --git a/newlib/libc/stdlib/getenv_r.c b/newlib/libc/stdlib/getenv_r.c index 315d283ea..aac11367c 100644 --- a/newlib/libc/stdlib/getenv_r.c +++ b/newlib/libc/stdlib/getenv_r.c @@ -74,8 +74,7 @@ static char ***p_environ = &environ; */ char * -_DEFUN (_findenv_r, (reent_ptr, name, offset), - struct _reent *reent_ptr, +_findenv_r (struct _reent *reent_ptr, register const char *name, int *offset) { @@ -119,8 +118,7 @@ _DEFUN (_findenv_r, (reent_ptr, name, offset), */ char * -_DEFUN (_getenv_r, (reent_ptr, name), - struct _reent *reent_ptr, +_getenv_r (struct _reent *reent_ptr, const char *name) { int offset; diff --git a/newlib/libc/stdlib/itoa.c b/newlib/libc/stdlib/itoa.c index 25e6c3516..7a7daf0ce 100644 --- a/newlib/libc/stdlib/itoa.c +++ b/newlib/libc/stdlib/itoa.c @@ -30,8 +30,7 @@ No supporting OS subroutine calls are required. #include char * -_DEFUN (__itoa, (value, str, base), - int value, +__itoa (int value, char *str, int base) { @@ -60,8 +59,7 @@ _DEFUN (__itoa, (value, str, base), } char * -_DEFUN (itoa, (value, str, base), - int value, +itoa (int value, char *str, int base) { diff --git a/newlib/libc/stdlib/jrand48.c b/newlib/libc/stdlib/jrand48.c index 4f8c12bd1..185e0da90 100644 --- a/newlib/libc/stdlib/jrand48.c +++ b/newlib/libc/stdlib/jrand48.c @@ -14,8 +14,7 @@ #include "rand48.h" long -_DEFUN (_jrand48_r, (r, xseed), - struct _reent *r, +_jrand48_r (struct _reent *r, unsigned short xseed[3]) { __dorand48(r, xseed); @@ -24,8 +23,7 @@ _DEFUN (_jrand48_r, (r, xseed), #ifndef _REENT_ONLY long -_DEFUN (jrand48, (xseed), - unsigned short xseed[3]) +jrand48 (unsigned short xseed[3]) { return _jrand48_r (_REENT, xseed); } diff --git a/newlib/libc/stdlib/l64a.c b/newlib/libc/stdlib/l64a.c index 607842723..45282e32d 100644 --- a/newlib/libc/stdlib/l64a.c +++ b/newlib/libc/stdlib/l64a.c @@ -27,15 +27,13 @@ static const char R64_ARRAY[] = "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; char * -_DEFUN (l64a, (value), - long value) +l64a (long value) { return _l64a_r (_REENT, value); } char * -_DEFUN (_l64a_r, (rptr, value), - struct _reent *rptr, +_l64a_r (struct _reent *rptr, long value) { char *ptr; diff --git a/newlib/libc/stdlib/labs.c b/newlib/libc/stdlib/labs.c index 712f56c37..f6761d0cc 100644 --- a/newlib/libc/stdlib/labs.c +++ b/newlib/libc/stdlib/labs.c @@ -33,8 +33,7 @@ No supporting OS subroutine calls are required. #include long -_DEFUN (labs, (x), - long x) +labs (long x) { if (x < 0) { diff --git a/newlib/libc/stdlib/lcong48.c b/newlib/libc/stdlib/lcong48.c index a16d49ecc..78e9e5746 100644 --- a/newlib/libc/stdlib/lcong48.c +++ b/newlib/libc/stdlib/lcong48.c @@ -14,8 +14,7 @@ #include "rand48.h" void -_DEFUN (_lcong48_r, (r, p), - struct _reent *r, +_lcong48_r (struct _reent *r, unsigned short p[7]) { _REENT_CHECK_RAND48(r); @@ -30,8 +29,7 @@ _DEFUN (_lcong48_r, (r, p), #ifndef _REENT_ONLY void -_DEFUN (lcong48, (p), - unsigned short p[7]) +lcong48 (unsigned short p[7]) { _lcong48_r (_REENT, p); } diff --git a/newlib/libc/stdlib/ldiv.c b/newlib/libc/stdlib/ldiv.c index 00bca6286..294cc8602 100644 --- a/newlib/libc/stdlib/ldiv.c +++ b/newlib/libc/stdlib/ldiv.c @@ -82,8 +82,7 @@ No supporting OS subroutines are required. #include /* ldiv_t */ ldiv_t -_DEFUN (ldiv, (num, denom), - long num, +ldiv (long num, long denom) { ldiv_t r; diff --git a/newlib/libc/stdlib/llabs.c b/newlib/libc/stdlib/llabs.c index c2a561c38..a020deadf 100644 --- a/newlib/libc/stdlib/llabs.c +++ b/newlib/libc/stdlib/llabs.c @@ -54,8 +54,7 @@ No supporting OS subroutines are required. #include long long -_DEFUN(llabs, (j), - long long j) +llabs (long long j) { return (j < 0 ? -j : j); } diff --git a/newlib/libc/stdlib/lldiv.c b/newlib/libc/stdlib/lldiv.c index 8433e76bd..2dadf0e1e 100644 --- a/newlib/libc/stdlib/lldiv.c +++ b/newlib/libc/stdlib/lldiv.c @@ -94,8 +94,7 @@ No supporting OS subroutines are required. * subtract denom from r.rem. */ lldiv_t -_DEFUN (lldiv, (number, denom), - long long numer, long long denom) +lldiv (long long numer, long long denom) { lldiv_t retval; diff --git a/newlib/libc/stdlib/lrand48.c b/newlib/libc/stdlib/lrand48.c index bb3289c83..a28284e61 100644 --- a/newlib/libc/stdlib/lrand48.c +++ b/newlib/libc/stdlib/lrand48.c @@ -14,8 +14,7 @@ #include "rand48.h" long -_DEFUN (_lrand48_r, (r), - struct _reent *r) +_lrand48_r (struct _reent *r) { _REENT_CHECK_RAND48(r); __dorand48(r, __rand48_seed); diff --git a/newlib/libc/stdlib/malign.c b/newlib/libc/stdlib/malign.c index e7d56bb51..480060c43 100644 --- a/newlib/libc/stdlib/malign.c +++ b/newlib/libc/stdlib/malign.c @@ -9,8 +9,7 @@ #ifndef _REENT_ONLY void * -_DEFUN (memalign, (align, nbytes), - size_t align, +memalign (size_t align, size_t nbytes) { return _memalign_r (_REENT, align, nbytes); diff --git a/newlib/libc/stdlib/malloc.c b/newlib/libc/stdlib/malloc.c index 5acaa85d3..f5ac29208 100644 --- a/newlib/libc/stdlib/malloc.c +++ b/newlib/libc/stdlib/malloc.c @@ -159,15 +159,13 @@ Supporting OS subroutines required: <>. */ #ifndef _REENT_ONLY void * -_DEFUN (malloc, (nbytes), - size_t nbytes) /* get a block */ +malloc (size_t nbytes) /* get a block */ { return _malloc_r (_REENT, nbytes); } void -_DEFUN (free, (aptr), - void *aptr) +free (void *aptr) { _free_r (_REENT, aptr); } diff --git a/newlib/libc/stdlib/mblen.c b/newlib/libc/stdlib/mblen.c index 3ea91f4ba..3753d3673 100644 --- a/newlib/libc/stdlib/mblen.c +++ b/newlib/libc/stdlib/mblen.c @@ -43,8 +43,7 @@ effects vary with the locale. #include "local.h" int -_DEFUN (mblen, (s, n), - const char *s, +mblen (const char *s, size_t n) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/mblen_r.c b/newlib/libc/stdlib/mblen_r.c index 1456ceae2..ff1737002 100644 --- a/newlib/libc/stdlib/mblen_r.c +++ b/newlib/libc/stdlib/mblen_r.c @@ -41,8 +41,7 @@ effects vary with the locale. #include "local.h" int -_DEFUN (_mblen_r, (r, s, n, state), - struct _reent *r, +_mblen_r (struct _reent *r, const char *s, size_t n, mbstate_t *state) diff --git a/newlib/libc/stdlib/mbrtowc.c b/newlib/libc/stdlib/mbrtowc.c index 4ca2143cf..65284a0eb 100644 --- a/newlib/libc/stdlib/mbrtowc.c +++ b/newlib/libc/stdlib/mbrtowc.c @@ -8,8 +8,7 @@ #include "local.h" size_t -_DEFUN (_mbrtowc_r, (ptr, pwc, s, n, ps), - struct _reent *ptr, +_mbrtowc_r (struct _reent *ptr, wchar_t *pwc, const char *s, size_t n, @@ -42,8 +41,7 @@ _DEFUN (_mbrtowc_r, (ptr, pwc, s, n, ps), #ifndef _REENT_ONLY size_t -_DEFUN (mbrtowc, (pwc, s, n, ps), - wchar_t *__restrict pwc, +mbrtowc (wchar_t *__restrict pwc, const char *__restrict s, size_t n, mbstate_t *__restrict ps) diff --git a/newlib/libc/stdlib/mbsnrtowcs.c b/newlib/libc/stdlib/mbsnrtowcs.c index 206a0623e..d3ce25084 100644 --- a/newlib/libc/stdlib/mbsnrtowcs.c +++ b/newlib/libc/stdlib/mbsnrtowcs.c @@ -71,8 +71,7 @@ PORTABILITY #include size_t -_DEFUN (_mbsnrtowcs_r, (r, dst, src, nms, len, ps), - struct _reent *r, +_mbsnrtowcs_r (struct _reent *r, wchar_t *dst, const char **src, size_t nms, @@ -137,8 +136,7 @@ _DEFUN (_mbsnrtowcs_r, (r, dst, src, nms, len, ps), #ifndef _REENT_ONLY size_t -_DEFUN (mbsnrtowcs, (dst, src, nms, len, ps), - wchar_t *__restrict dst, +mbsnrtowcs (wchar_t *__restrict dst, const char **__restrict src, size_t nms, size_t len, diff --git a/newlib/libc/stdlib/mbsrtowcs.c b/newlib/libc/stdlib/mbsrtowcs.c index 48d36d028..82589c606 100644 --- a/newlib/libc/stdlib/mbsrtowcs.c +++ b/newlib/libc/stdlib/mbsrtowcs.c @@ -8,8 +8,7 @@ #include size_t -_DEFUN (_mbsrtowcs_r, (r, dst, src, len, ps), - struct _reent *r, +_mbsrtowcs_r (struct _reent *r, wchar_t *dst, const char **src, size_t len, @@ -20,8 +19,7 @@ _DEFUN (_mbsrtowcs_r, (r, dst, src, len, ps), #ifndef _REENT_ONLY size_t -_DEFUN (mbsrtowcs, (dst, src, len, ps), - wchar_t *__restrict dst, +mbsrtowcs (wchar_t *__restrict dst, const char **__restrict src, size_t len, mbstate_t *__restrict ps) diff --git a/newlib/libc/stdlib/mbstowcs.c b/newlib/libc/stdlib/mbstowcs.c index 41ad7b67a..253059cf8 100644 --- a/newlib/libc/stdlib/mbstowcs.c +++ b/newlib/libc/stdlib/mbstowcs.c @@ -47,8 +47,7 @@ effects vary with the locale. #include size_t -_DEFUN (mbstowcs, (pwcs, s, n), - wchar_t *__restrict pwcs, +mbstowcs (wchar_t *__restrict pwcs, const char *__restrict s, size_t n) { diff --git a/newlib/libc/stdlib/mbstowcs_r.c b/newlib/libc/stdlib/mbstowcs_r.c index 7c95e4aba..43aea2cdf 100644 --- a/newlib/libc/stdlib/mbstowcs_r.c +++ b/newlib/libc/stdlib/mbstowcs_r.c @@ -3,8 +3,7 @@ #include "local.h" size_t -_DEFUN (_mbstowcs_r, (reent, pwcs, s, n, state), - struct _reent *r, +_mbstowcs_r (struct _reent *r, wchar_t *__restrict pwcs, const char *__restrict s, size_t n, diff --git a/newlib/libc/stdlib/mbtowc.c b/newlib/libc/stdlib/mbtowc.c index 182884aab..2dc413f2d 100644 --- a/newlib/libc/stdlib/mbtowc.c +++ b/newlib/libc/stdlib/mbtowc.c @@ -50,8 +50,7 @@ effects vary with the locale. #include "local.h" int -_DEFUN (mbtowc, (pwc, s, n), - wchar_t *__restrict pwc, +mbtowc (wchar_t *__restrict pwc, const char *__restrict s, size_t n) { diff --git a/newlib/libc/stdlib/mbtowc_r.c b/newlib/libc/stdlib/mbtowc_r.c index cbc534a7b..920a7ea3c 100644 --- a/newlib/libc/stdlib/mbtowc_r.c +++ b/newlib/libc/stdlib/mbtowc_r.c @@ -8,8 +8,7 @@ #include "local.h" int -_DEFUN (_mbtowc_r, (r, pwc, s, n, state), - struct _reent *r, +_mbtowc_r (struct _reent *r, wchar_t *__restrict pwc, const char *__restrict s, size_t n, @@ -19,8 +18,7 @@ _DEFUN (_mbtowc_r, (r, pwc, s, n, state), } int -_DEFUN (__ascii_mbtowc, (r, pwc, s, n, state), - struct _reent *r, +__ascii_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, @@ -528,8 +526,7 @@ __cp_mbtowc (int val) #endif /* _MB_EXTENDED_CHARSETS_WINDOWS */ int -_DEFUN (__utf8_mbtowc, (r, pwc, s, n, state), - struct _reent *r, +__utf8_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, @@ -730,8 +727,7 @@ _DEFUN (__utf8_mbtowc, (r, pwc, s, n, state), because the underlying OS requires wchar_t == UTF-16. */ #ifndef __CYGWIN__ int -_DEFUN (__sjis_mbtowc, (r, pwc, s, n, state), - struct _reent *r, +__sjis_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, @@ -787,8 +783,7 @@ _DEFUN (__sjis_mbtowc, (r, pwc, s, n, state), } int -_DEFUN (__eucjp_mbtowc, (r, pwc, s, n, state), - struct _reent *r, +__eucjp_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, @@ -870,8 +865,7 @@ _DEFUN (__eucjp_mbtowc, (r, pwc, s, n, state), } int -_DEFUN (__jis_mbtowc, (r, pwc, s, n, state), - struct _reent *r, +__jis_mbtowc (struct _reent *r, wchar_t *pwc, const char *s, size_t n, diff --git a/newlib/libc/stdlib/mprec.c b/newlib/libc/stdlib/mprec.c index bd1c691d9..e433fa8c1 100644 --- a/newlib/libc/stdlib/mprec.c +++ b/newlib/libc/stdlib/mprec.c @@ -94,7 +94,7 @@ */ _Bigint * -_DEFUN (Balloc, (ptr, k), struct _reent *ptr, int k) +Balloc (struct _reent *ptr, int k) { int x; _Bigint *rv ; @@ -133,7 +133,7 @@ _DEFUN (Balloc, (ptr, k), struct _reent *ptr, int k) } void -_DEFUN (Bfree, (ptr, v), struct _reent *ptr, _Bigint * v) +Bfree (struct _reent *ptr, _Bigint * v) { _REENT_CHECK_MP(ptr); if (v) @@ -144,8 +144,7 @@ _DEFUN (Bfree, (ptr, v), struct _reent *ptr, _Bigint * v) } _Bigint * -_DEFUN (multadd, (ptr, b, m, a), - struct _reent *ptr, +multadd (struct _reent *ptr, _Bigint * b, int m, int a) @@ -191,8 +190,7 @@ _DEFUN (multadd, (ptr, b, m, a), } _Bigint * -_DEFUN (s2b, (ptr, s, nd0, nd, y9), - struct _reent * ptr, +s2b (struct _reent * ptr, const char *s, int nd0, int nd, @@ -231,8 +229,7 @@ _DEFUN (s2b, (ptr, s, nd0, nd, y9), } int -_DEFUN (hi0bits, - (x), register __ULong x) +hi0bits (register __ULong x) { register int k = 0; @@ -266,7 +263,7 @@ _DEFUN (hi0bits, } int -_DEFUN (lo0bits, (y), __ULong *y) +lo0bits (__ULong *y) { register int k; register __ULong x = *y; @@ -316,7 +313,7 @@ _DEFUN (lo0bits, (y), __ULong *y) } _Bigint * -_DEFUN (i2b, (ptr, i), struct _reent * ptr, int i) +i2b (struct _reent * ptr, int i) { _Bigint *b; @@ -327,7 +324,7 @@ _DEFUN (i2b, (ptr, i), struct _reent * ptr, int i) } _Bigint * -_DEFUN (mult, (ptr, a, b), struct _reent * ptr, _Bigint * a, _Bigint * b) +mult (struct _reent * ptr, _Bigint * a, _Bigint * b) { _Bigint *c; int k, wa, wb, wc; @@ -419,8 +416,7 @@ _DEFUN (mult, (ptr, a, b), struct _reent * ptr, _Bigint * a, _Bigint * b) } _Bigint * -_DEFUN (pow5mult, - (ptr, b, k), struct _reent * ptr, _Bigint * b, int k) +pow5mult (struct _reent * ptr, _Bigint * b, int k) { _Bigint *b1, *p5, *p51; int i; @@ -459,7 +455,7 @@ _DEFUN (pow5mult, } _Bigint * -_DEFUN (lshift, (ptr, b, k), struct _reent * ptr, _Bigint * b, int k) +lshift (struct _reent * ptr, _Bigint * b, int k) { int i, k1, n, n1; _Bigint *b1; @@ -519,7 +515,7 @@ _DEFUN (lshift, (ptr, b, k), struct _reent * ptr, _Bigint * b, int k) } int -_DEFUN (cmp, (a, b), _Bigint * a, _Bigint * b) +cmp (_Bigint * a, _Bigint * b) { __ULong *xa, *xa0, *xb, *xb0; int i, j; @@ -549,7 +545,7 @@ _DEFUN (cmp, (a, b), _Bigint * a, _Bigint * b) } _Bigint * -_DEFUN (diff, (ptr, a, b), struct _reent * ptr, +diff (struct _reent * ptr, _Bigint * a, _Bigint * b) { _Bigint *c; @@ -633,7 +629,7 @@ _DEFUN (diff, (ptr, a, b), struct _reent * ptr, } double -_DEFUN (ulp, (_x), double _x) +ulp (double _x) { union double_union x, a; register __Long L; @@ -679,8 +675,7 @@ _DEFUN (ulp, (_x), double _x) } double -_DEFUN (b2d, (a, e), - _Bigint * a, int *e) +b2d (_Bigint * a, int *e) { __ULong *xa, *xa0, w, y, z; int k; @@ -756,9 +751,7 @@ ret_d: } _Bigint * -_DEFUN (d2b, - (ptr, _d, e, bits), - struct _reent * ptr, +d2b (struct _reent * ptr, double _d, int *e, int *bits) @@ -911,7 +904,7 @@ _DEFUN (d2b, #undef d1 double -_DEFUN (ratio, (a, b), _Bigint * a, _Bigint * b) +ratio (_Bigint * a, _Bigint * b) { union double_union da, db; @@ -976,8 +969,7 @@ const double tinytens[] = double -_DEFUN (_mprec_log10, (dig), - int dig) +_mprec_log10 (int dig) { double v = 1.0; if (dig < 24) @@ -991,8 +983,7 @@ _DEFUN (_mprec_log10, (dig), } void -_DEFUN (copybits, (c, n, b), - __ULong *c, +copybits (__ULong *c, int n, _Bigint *b) { @@ -1020,8 +1011,7 @@ _DEFUN (copybits, (c, n, b), } __ULong -_DEFUN (any_on, (b, k), - _Bigint *b, +any_on (_Bigint *b, int k) { int n, nwds; diff --git a/newlib/libc/stdlib/mrand48.c b/newlib/libc/stdlib/mrand48.c index 62b44edc9..bb1e454c9 100644 --- a/newlib/libc/stdlib/mrand48.c +++ b/newlib/libc/stdlib/mrand48.c @@ -14,8 +14,7 @@ #include "rand48.h" long -_DEFUN (_mrand48_r, (r), - struct _reent *r) +_mrand48_r (struct _reent *r) { _REENT_CHECK_RAND48(r); __dorand48(r, __rand48_seed); diff --git a/newlib/libc/stdlib/msize.c b/newlib/libc/stdlib/msize.c index 8c2b221e4..108550dcd 100644 --- a/newlib/libc/stdlib/msize.c +++ b/newlib/libc/stdlib/msize.c @@ -9,8 +9,7 @@ #ifndef _REENT_ONLY size_t -_DEFUN (malloc_usable_size, (ptr), - void *ptr) +malloc_usable_size (void *ptr) { return _malloc_usable_size_r (_REENT, ptr); } diff --git a/newlib/libc/stdlib/mstats.c b/newlib/libc/stdlib/mstats.c index 92f9fb792..85c20f1bc 100644 --- a/newlib/libc/stdlib/mstats.c +++ b/newlib/libc/stdlib/mstats.c @@ -97,8 +97,7 @@ malloc_stats (void) } int -_DEFUN (mallopt, (p, v), - int p, +mallopt (int p, int v) { return _mallopt_r (_REENT, p, v); @@ -115,8 +114,7 @@ _DEFUN (mallopt, (p, v), malloc_stats. */ void -_DEFUN (_mstats_r, (ptr, s), - struct _reent *ptr, +_mstats_r (struct _reent *ptr, char *s) { _REENT_SMALL_CHECK_INIT(ptr); @@ -126,8 +124,7 @@ _DEFUN (_mstats_r, (ptr, s), #ifndef _REENT_ONLY void -_DEFUN (mstats, (s), - char *s) +mstats (char *s) { _mstats_r (_REENT, s); } diff --git a/newlib/libc/stdlib/mtrim.c b/newlib/libc/stdlib/mtrim.c index 328eb715e..bf927fa84 100644 --- a/newlib/libc/stdlib/mtrim.c +++ b/newlib/libc/stdlib/mtrim.c @@ -9,8 +9,7 @@ #ifndef _REENT_ONLY int -_DEFUN (malloc_trim, (pad), - size_t pad) +malloc_trim (size_t pad) { return _malloc_trim_r (_REENT, pad); } diff --git a/newlib/libc/stdlib/nrand48.c b/newlib/libc/stdlib/nrand48.c index 43a6d0cfb..cca0e5f7a 100644 --- a/newlib/libc/stdlib/nrand48.c +++ b/newlib/libc/stdlib/nrand48.c @@ -14,8 +14,7 @@ #include "rand48.h" long -_DEFUN (_nrand48_r, (r, xseed), - struct _reent *r, +_nrand48_r (struct _reent *r, unsigned short xseed[3]) { __dorand48 (r, xseed); @@ -25,8 +24,7 @@ _DEFUN (_nrand48_r, (r, xseed), #ifndef _REENT_ONLY long -_DEFUN (nrand48, (xseed), - unsigned short xseed[3]) +nrand48 (unsigned short xseed[3]) { return _nrand48_r (_REENT, xseed); } diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index 97d107e7d..ce6bac68e 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -66,9 +66,7 @@ const void * const __on_exit_dummy = &__on_exit_args; */ int -_DEFUN (on_exit, - (fn, arg), - void _EXFNPTR(fn, (int, void *)), +on_exit (void _EXFNPTR(fn, (int, void *)), void *arg) { return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL); diff --git a/newlib/libc/stdlib/putenv.c b/newlib/libc/stdlib/putenv.c index 978f7c5d6..7a8d7f7d3 100644 --- a/newlib/libc/stdlib/putenv.c +++ b/newlib/libc/stdlib/putenv.c @@ -23,8 +23,7 @@ #include int -_DEFUN (putenv, (str), - char *str) +putenv (char *str) { return _putenv_r (_REENT, str); } diff --git a/newlib/libc/stdlib/putenv_r.c b/newlib/libc/stdlib/putenv_r.c index a780a149e..8c23a823d 100644 --- a/newlib/libc/stdlib/putenv_r.c +++ b/newlib/libc/stdlib/putenv_r.c @@ -31,8 +31,7 @@ or replaces the environment variable "name" with "value" which is specified by str as "name=value". */ int -_DEFUN (_putenv_r, (reent_ptr, str), - struct _reent *reent_ptr, +_putenv_r (struct _reent *reent_ptr, char *str) { register char *p, *equal; diff --git a/newlib/libc/stdlib/rand.c b/newlib/libc/stdlib/rand.c index e6ef7a1f6..209cb32ff 100644 --- a/newlib/libc/stdlib/rand.c +++ b/newlib/libc/stdlib/rand.c @@ -59,7 +59,7 @@ on two different systems. #include void -_DEFUN (srand, (seed), unsigned int seed) +srand (unsigned int seed) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdlib/rand48.c b/newlib/libc/stdlib/rand48.c index 0fc5cc0a9..626b3ef84 100644 --- a/newlib/libc/stdlib/rand48.c +++ b/newlib/libc/stdlib/rand48.c @@ -130,8 +130,7 @@ No supporting OS subroutines are required. #include "rand48.h" void -_DEFUN (__dorand48, (r, xseed), - struct _reent *r, +__dorand48 (struct _reent *r, unsigned short xseed[3]) { unsigned long accu; diff --git a/newlib/libc/stdlib/rand_r.c b/newlib/libc/stdlib/rand_r.c index 437739ef5..0670285a0 100644 --- a/newlib/libc/stdlib/rand_r.c +++ b/newlib/libc/stdlib/rand_r.c @@ -22,7 +22,7 @@ */ int -_DEFUN (rand_r, (seed), unsigned int *seed) +rand_r (unsigned int *seed) { long k; long s = (long)(*seed); diff --git a/newlib/libc/stdlib/random.c b/newlib/libc/stdlib/random.c index b3b0ca305..131dc056c 100644 --- a/newlib/libc/stdlib/random.c +++ b/newlib/libc/stdlib/random.c @@ -57,7 +57,7 @@ algorithm as <>. #include void -_DEFUN (srandom, (seed), unsigned int seed) +srandom (unsigned int seed) { struct _reent *reent = _REENT; diff --git a/newlib/libc/stdlib/realloc.c b/newlib/libc/stdlib/realloc.c index 00a88a5a2..999e8e00b 100644 --- a/newlib/libc/stdlib/realloc.c +++ b/newlib/libc/stdlib/realloc.c @@ -11,8 +11,7 @@ int _dummy_realloc = 1; #ifndef _REENT_ONLY void * -_DEFUN (realloc, (ap, nbytes), - void *ap, +realloc (void *ap, size_t nbytes) { return _realloc_r (_REENT, ap, nbytes); diff --git a/newlib/libc/stdlib/reallocf.c b/newlib/libc/stdlib/reallocf.c index c4aaeaeaa..d62752a80 100644 --- a/newlib/libc/stdlib/reallocf.c +++ b/newlib/libc/stdlib/reallocf.c @@ -31,8 +31,7 @@ #include void * -_DEFUN (_reallocf_r, (reentptr, ptr, size), - struct _reent *reentptr, +_reallocf_r (struct _reent *reentptr, void *ptr, size_t size) { @@ -46,8 +45,7 @@ _DEFUN (_reallocf_r, (reentptr, ptr, size), #ifndef _REENT_ONLY void * -_DEFUN (reallocf, (ptr, size), - void *ptr, +reallocf (void *ptr, size_t size) { return _reallocf_r(_REENT, ptr, size); diff --git a/newlib/libc/stdlib/rpmatch.c b/newlib/libc/stdlib/rpmatch.c index 93d2c3f11..42a351343 100644 --- a/newlib/libc/stdlib/rpmatch.c +++ b/newlib/libc/stdlib/rpmatch.c @@ -59,8 +59,7 @@ No supporting OS subroutines are required. #include int -_DEFUN(rpmatch, (response), - const char *response) +rpmatch (const char *response) { regex_t yes, no; int ret; diff --git a/newlib/libc/stdlib/seed48.c b/newlib/libc/stdlib/seed48.c index 5f3ae2e95..25f0e501e 100644 --- a/newlib/libc/stdlib/seed48.c +++ b/newlib/libc/stdlib/seed48.c @@ -14,8 +14,7 @@ #include "rand48.h" unsigned short * -_DEFUN (_seed48_r, (r, xseed), - struct _reent *r, +_seed48_r (struct _reent *r, unsigned short xseed[3]) { static unsigned short sseed[3]; @@ -36,8 +35,7 @@ _DEFUN (_seed48_r, (r, xseed), #ifndef _REENT_ONLY unsigned short * -_DEFUN (seed48, (xseed), - unsigned short xseed[3]) +seed48 (unsigned short xseed[3]) { return _seed48_r (_REENT, xseed); } diff --git a/newlib/libc/stdlib/setenv.c b/newlib/libc/stdlib/setenv.c index e68e91d14..b0c1585d4 100644 --- a/newlib/libc/stdlib/setenv.c +++ b/newlib/libc/stdlib/setenv.c @@ -32,8 +32,7 @@ extern int _unsetenv_r (struct _reent *, const char *); */ int -_DEFUN (setenv, (name, value, rewrite), - const char *name, +setenv (const char *name, const char *value, int rewrite) { @@ -45,8 +44,7 @@ _DEFUN (setenv, (name, value, rewrite), * Delete environmental variable "name". */ int -_DEFUN (unsetenv, (name), - const char *name) +unsetenv (const char *name) { return _unsetenv_r (_REENT, name); } diff --git a/newlib/libc/stdlib/setenv_r.c b/newlib/libc/stdlib/setenv_r.c index 31d4fc70d..f1f885789 100644 --- a/newlib/libc/stdlib/setenv_r.c +++ b/newlib/libc/stdlib/setenv_r.c @@ -49,8 +49,7 @@ extern char *_findenv_r (struct _reent *, const char *, int *); */ int -_DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), - struct _reent *reent_ptr, +_setenv_r (struct _reent *reent_ptr, const char *name, const char *value, int rewrite) @@ -133,8 +132,7 @@ _DEFUN (_setenv_r, (reent_ptr, name, value, rewrite), * Delete environmental variable "name". */ int -_DEFUN (_unsetenv_r, (reent_ptr, name), - struct _reent *reent_ptr, +_unsetenv_r (struct _reent *reent_ptr, const char *name) { register char **P; diff --git a/newlib/libc/stdlib/srand48.c b/newlib/libc/stdlib/srand48.c index 1eac2a11f..573f62018 100644 --- a/newlib/libc/stdlib/srand48.c +++ b/newlib/libc/stdlib/srand48.c @@ -14,8 +14,7 @@ #include "rand48.h" void -_DEFUN (_srand48_r, (r, seed), - struct _reent *r, +_srand48_r (struct _reent *r, long seed) { _REENT_CHECK_RAND48(r); @@ -30,8 +29,7 @@ _DEFUN (_srand48_r, (r, seed), #ifndef _REENT_ONLY void -_DEFUN (srand48, (seed), - long seed) +srand48 (long seed) { _srand48_r (_REENT, seed); } diff --git a/newlib/libc/stdlib/strtod.c b/newlib/libc/stdlib/strtod.c index 1abff4fe2..402510cdf 100644 --- a/newlib/libc/stdlib/strtod.c +++ b/newlib/libc/stdlib/strtod.c @@ -174,8 +174,7 @@ static const double tinytens[] = { 1e-16, 1e-32, #ifdef Avoid_Underflow /*{*/ static double -_DEFUN (sulp, (x, scale), - U x, +sulp (U x, int scale) { U u; @@ -197,8 +196,7 @@ _DEFUN (sulp, (x, scale), #ifndef NO_HEX_FP static void -_DEFUN (ULtod, (L, bits, exp, k), - __ULong *L, +ULtod (__ULong *L, __ULong *bits, Long exp, int k) @@ -1252,8 +1250,7 @@ _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, } double -_DEFUN (_strtod_r, (ptr, s00, se), - struct _reent *ptr, +_strtod_r (struct _reent *ptr, const char *__restrict s00, char **__restrict se) { @@ -1269,8 +1266,7 @@ strtod_l (const char *__restrict s00, char **__restrict se, locale_t loc) } double -_DEFUN (strtod, (s00, se), - const char *__restrict s00, char **__restrict se) +strtod (const char *__restrict s00, char **__restrict se) { return _strtod_l (_REENT, s00, se, __get_current_locale ()); } @@ -1290,8 +1286,7 @@ strtof_l (const char *__restrict s00, char **__restrict se, locale_t loc) } float -_DEFUN (strtof, (s00, se), - const char *__restrict s00, +strtof (const char *__restrict s00, char **__restrict se) { double val = _strtod_l (_REENT, s00, se, __get_current_locale ()); diff --git a/newlib/libc/stdlib/strtol.c b/newlib/libc/stdlib/strtol.c index a366680e4..f7572b169 100644 --- a/newlib/libc/stdlib/strtol.c +++ b/newlib/libc/stdlib/strtol.c @@ -212,8 +212,7 @@ _strtol_l (struct _reent *rptr, const char *__restrict nptr, } long -_DEFUN (_strtol_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_strtol_r (struct _reent *rptr, const char *__restrict nptr, char **__restrict endptr, int base) @@ -231,8 +230,7 @@ strtol_l (const char *__restrict s, char **__restrict ptr, int base, } long -_DEFUN (strtol, (s, ptr, base), - const char *__restrict s, +strtol (const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/strtoll.c b/newlib/libc/stdlib/strtoll.c index 9fc832393..295886e8f 100644 --- a/newlib/libc/stdlib/strtoll.c +++ b/newlib/libc/stdlib/strtoll.c @@ -214,8 +214,7 @@ _strtoll_l (struct _reent *rptr, const char *__restrict nptr, } long long -_DEFUN (_strtoll_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_strtoll_r (struct _reent *rptr, const char *__restrict nptr, char **__restrict endptr, int base) @@ -233,8 +232,7 @@ strtoll_l (const char *__restrict s, char **__restrict ptr, int base, } long long -_DEFUN (strtoll, (s, ptr, base), - const char *__restrict s, +strtoll (const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/strtoul.c b/newlib/libc/stdlib/strtoul.c index 5a816dab1..f2fba37f2 100644 --- a/newlib/libc/stdlib/strtoul.c +++ b/newlib/libc/stdlib/strtoul.c @@ -191,8 +191,7 @@ _strtoul_l (struct _reent *rptr, const char *__restrict nptr, } unsigned long -_DEFUN (_strtoul_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_strtoul_r (struct _reent *rptr, const char *__restrict nptr, char **__restrict endptr, int base) @@ -210,8 +209,7 @@ strtoul_l (const char *__restrict s, char **__restrict ptr, int base, } unsigned long -_DEFUN (strtoul, (s, ptr, base), - const char *__restrict s, +strtoul (const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/strtoull.c b/newlib/libc/stdlib/strtoull.c index 0f7c9e385..ce4de6e7e 100644 --- a/newlib/libc/stdlib/strtoull.c +++ b/newlib/libc/stdlib/strtoull.c @@ -189,8 +189,7 @@ _strtoull_l (struct _reent *rptr, const char *__restrict nptr, } unsigned long long -_DEFUN (_strtoull_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_strtoull_r (struct _reent *rptr, const char *__restrict nptr, char **__restrict endptr, int base) @@ -208,8 +207,7 @@ strtoull_l (const char *__restrict s, char **__restrict ptr, int base, } unsigned long long -_DEFUN (strtoull, (s, ptr, base), - const char *__restrict s, +strtoull (const char *__restrict s, char **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c index 0df7d60d3..34be6cd8f 100644 --- a/newlib/libc/stdlib/system.c +++ b/newlib/libc/stdlib/system.c @@ -57,8 +57,7 @@ static int _EXFUN(do_system, (struct _reent *ptr, const char *s)); #endif int -_DEFUN(_system_r, (ptr, s), - struct _reent *ptr, +_system_r (struct _reent *ptr, const char *s) { #if defined(HAVE_SYSTEM) @@ -93,8 +92,7 @@ _DEFUN(_system_r, (ptr, s), #ifndef _REENT_ONLY int -_DEFUN(system, (s), - const char *s) +system (const char *s) { return _system_r (_REENT, s); } @@ -110,8 +108,7 @@ extern char **environ; static char ***p_environ = &environ; static int -_DEFUN(do_system, (ptr, s), - struct _reent *ptr, +do_system (struct _reent *ptr, const char *s) { char *argv[4]; @@ -142,8 +139,7 @@ _DEFUN(do_system, (ptr, s), #if defined (__CYGWIN__) static int -_DEFUN(do_system, (ptr, s), - struct _reent *ptr, +do_system (struct _reent *ptr, const char *s) { char *argv[4]; diff --git a/newlib/libc/stdlib/utoa.c b/newlib/libc/stdlib/utoa.c index cc5440783..5ef304ce4 100644 --- a/newlib/libc/stdlib/utoa.c +++ b/newlib/libc/stdlib/utoa.c @@ -28,8 +28,7 @@ No supporting OS subroutine calls are required. #include char * -_DEFUN (__utoa, (value, str, base), - unsigned value, +__utoa (unsigned value, char *str, int base) { @@ -67,8 +66,7 @@ _DEFUN (__utoa, (value, str, base), } char * -_DEFUN (utoa, (value, str, base), - unsigned value, +utoa (unsigned value, char *str, int base) { diff --git a/newlib/libc/stdlib/valloc.c b/newlib/libc/stdlib/valloc.c index 83a839e31..025386663 100644 --- a/newlib/libc/stdlib/valloc.c +++ b/newlib/libc/stdlib/valloc.c @@ -9,15 +9,13 @@ #ifndef _REENT_ONLY void * -_DEFUN (valloc, (nbytes), - size_t nbytes) +valloc (size_t nbytes) { return _valloc_r (_REENT, nbytes); } void * -_DEFUN (pvalloc, (nbytes), - size_t nbytes) +pvalloc (size_t nbytes) { return _pvalloc_r (_REENT, nbytes); } diff --git a/newlib/libc/stdlib/wcrtomb.c b/newlib/libc/stdlib/wcrtomb.c index 3b6cbd62c..97436cb74 100644 --- a/newlib/libc/stdlib/wcrtomb.c +++ b/newlib/libc/stdlib/wcrtomb.c @@ -7,8 +7,7 @@ #include "local.h" size_t -_DEFUN (_wcrtomb_r, (ptr, s, wc, ps), - struct _reent *ptr, +_wcrtomb_r (struct _reent *ptr, char *s, wchar_t wc, mbstate_t *ps) @@ -41,8 +40,7 @@ _DEFUN (_wcrtomb_r, (ptr, s, wc, ps), #ifndef _REENT_ONLY size_t -_DEFUN (wcrtomb, (s, wc, ps), - char *__restrict s, +wcrtomb (char *__restrict s, wchar_t wc, mbstate_t *__restrict ps) { diff --git a/newlib/libc/stdlib/wcsnrtombs.c b/newlib/libc/stdlib/wcsnrtombs.c index 3561257cb..43dd2f3e6 100644 --- a/newlib/libc/stdlib/wcsnrtombs.c +++ b/newlib/libc/stdlib/wcsnrtombs.c @@ -138,8 +138,7 @@ _wcsnrtombs_l (struct _reent *r, char *dst, const wchar_t **src, size_t nwc, } size_t -_DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), - struct _reent *r, +_wcsnrtombs_r (struct _reent *r, char *dst, const wchar_t **src, size_t nwc, @@ -152,8 +151,7 @@ _DEFUN (_wcsnrtombs_r, (r, dst, src, nwc, len, ps), #ifndef _REENT_ONLY size_t -_DEFUN (wcsnrtombs, (dst, src, nwc, len, ps), - char *__restrict dst, +wcsnrtombs (char *__restrict dst, const wchar_t **__restrict src, size_t nwc, size_t len, diff --git a/newlib/libc/stdlib/wcsrtombs.c b/newlib/libc/stdlib/wcsrtombs.c index ac0c9dece..dc4807d2a 100644 --- a/newlib/libc/stdlib/wcsrtombs.c +++ b/newlib/libc/stdlib/wcsrtombs.c @@ -5,8 +5,7 @@ #include size_t -_DEFUN (_wcsrtombs_r, (r, dst, src, len, ps), - struct _reent *r, +_wcsrtombs_r (struct _reent *r, char *dst, const wchar_t **src, size_t len, @@ -17,8 +16,7 @@ _DEFUN (_wcsrtombs_r, (r, dst, src, len, ps), #ifndef _REENT_ONLY size_t -_DEFUN (wcsrtombs, (dst, src, len, ps), - char *__restrict dst, +wcsrtombs (char *__restrict dst, const wchar_t **__restrict src, size_t len, mbstate_t *__restrict ps) diff --git a/newlib/libc/stdlib/wcstod.c b/newlib/libc/stdlib/wcstod.c index 8a72e6fe3..9e0d563ef 100644 --- a/newlib/libc/stdlib/wcstod.c +++ b/newlib/libc/stdlib/wcstod.c @@ -214,8 +214,7 @@ _wcstod_l (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr, } double -_DEFUN (_wcstod_r, (ptr, nptr, endptr), - struct _reent *ptr, +_wcstod_r (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr) { @@ -223,8 +222,7 @@ _DEFUN (_wcstod_r, (ptr, nptr, endptr), } float -_DEFUN (_wcstof_r, (ptr, nptr, endptr), - struct _reent *ptr, +_wcstof_r (struct _reent *ptr, const wchar_t *nptr, wchar_t **endptr) { @@ -244,8 +242,7 @@ wcstod_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, } double -_DEFUN (wcstod, (nptr, endptr), - const wchar_t *__restrict nptr, wchar_t **__restrict endptr) +wcstod (const wchar_t *__restrict nptr, wchar_t **__restrict endptr) { return _wcstod_l (_REENT, nptr, endptr, __get_current_locale ()); } @@ -266,8 +263,7 @@ wcstof_l (const wchar_t *__restrict nptr, wchar_t **__restrict endptr, } float -_DEFUN (wcstof, (nptr, endptr), - const wchar_t *__restrict nptr, +wcstof (const wchar_t *__restrict nptr, wchar_t **__restrict endptr) { double val = _wcstod_l (_REENT, nptr, endptr, __get_current_locale ()); diff --git a/newlib/libc/stdlib/wcstol.c b/newlib/libc/stdlib/wcstol.c index 324d75ee1..023a9c45e 100644 --- a/newlib/libc/stdlib/wcstol.c +++ b/newlib/libc/stdlib/wcstol.c @@ -213,8 +213,7 @@ _wcstol_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, } long -_DEFUN (_wcstol_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_wcstol_r (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, int base) @@ -232,8 +231,7 @@ wcstol_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, } long -_DEFUN (wcstol, (s, ptr, base), - const wchar_t *__restrict s, +wcstol (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wcstoll.c b/newlib/libc/stdlib/wcstoll.c index 00db2adf0..5fe0b2976 100644 --- a/newlib/libc/stdlib/wcstoll.c +++ b/newlib/libc/stdlib/wcstoll.c @@ -213,8 +213,7 @@ _wcstoll_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, } long long -_DEFUN (_wcstoll_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_wcstoll_r (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, int base) @@ -232,8 +231,7 @@ wcstoll_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, } long long -_DEFUN (wcstoll, (s, ptr, base), - const wchar_t *__restrict s, +wcstoll (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wcstombs.c b/newlib/libc/stdlib/wcstombs.c index 6df2dac55..42be54055 100644 --- a/newlib/libc/stdlib/wcstombs.c +++ b/newlib/libc/stdlib/wcstombs.c @@ -48,8 +48,7 @@ effects vary with the locale. #include size_t -_DEFUN (wcstombs, (s, pwcs, n), - char *__restrict s, +wcstombs (char *__restrict s, const wchar_t *__restrict pwcs, size_t n) { diff --git a/newlib/libc/stdlib/wcstombs_r.c b/newlib/libc/stdlib/wcstombs_r.c index d965dc228..c6a06a39a 100644 --- a/newlib/libc/stdlib/wcstombs_r.c +++ b/newlib/libc/stdlib/wcstombs_r.c @@ -3,8 +3,7 @@ #include "local.h" size_t -_DEFUN (_wcstombs_r, (reent, s, pwcs, n, state), - struct _reent *r, +_wcstombs_r (struct _reent *r, char *__restrict s, const wchar_t *__restrict pwcs, size_t n, diff --git a/newlib/libc/stdlib/wcstoul.c b/newlib/libc/stdlib/wcstoul.c index 5c54ec591..8e2796587 100644 --- a/newlib/libc/stdlib/wcstoul.c +++ b/newlib/libc/stdlib/wcstoul.c @@ -192,8 +192,7 @@ _wcstoul_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, } unsigned long -_DEFUN (_wcstoul_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_wcstoul_r (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, int base) @@ -211,8 +210,7 @@ wcstoul_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, } unsigned long -_DEFUN (wcstoul, (s, ptr, base), - const wchar_t *__restrict s, +wcstoul (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wcstoull.c b/newlib/libc/stdlib/wcstoull.c index 4724d6150..5a37473e0 100644 --- a/newlib/libc/stdlib/wcstoull.c +++ b/newlib/libc/stdlib/wcstoull.c @@ -208,8 +208,7 @@ _wcstoull_l (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, } unsigned long long -_DEFUN (_wcstoull_r, (rptr, nptr, endptr, base), - struct _reent *rptr, +_wcstoull_r (struct _reent *rptr, const wchar_t *nptr, wchar_t **endptr, int base) @@ -227,8 +226,7 @@ wcstoull_l (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base, } unsigned long long -_DEFUN (wcstoull, (s, ptr, base), - const wchar_t *__restrict s, +wcstoull (const wchar_t *__restrict s, wchar_t **__restrict ptr, int base) { diff --git a/newlib/libc/stdlib/wctomb.c b/newlib/libc/stdlib/wctomb.c index b68a43ba7..e908d22c2 100644 --- a/newlib/libc/stdlib/wctomb.c +++ b/newlib/libc/stdlib/wctomb.c @@ -46,8 +46,7 @@ effects vary with the locale. #include "local.h" int -_DEFUN (wctomb, (s, wchar), - char *s, +wctomb (char *s, wchar_t wchar) { #ifdef _MB_CAPABLE diff --git a/newlib/libc/stdlib/wctomb_r.c b/newlib/libc/stdlib/wctomb_r.c index 7c4fac1e4..b4799341e 100644 --- a/newlib/libc/stdlib/wctomb_r.c +++ b/newlib/libc/stdlib/wctomb_r.c @@ -7,8 +7,7 @@ #include "local.h" int -_DEFUN (_wctomb_r, (r, s, wchar, state), - struct _reent *r, +_wctomb_r (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state) @@ -17,8 +16,7 @@ _DEFUN (_wctomb_r, (r, s, wchar, state), } int -_DEFUN (__ascii_wctomb, (r, s, wchar, state), - struct _reent *r, +__ascii_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state) @@ -50,8 +48,7 @@ _DEFUN (__ascii_wctomb, (r, s, wchar, state), #define __state __count int -_DEFUN (__utf8_wctomb, (r, s, wchar, state), - struct _reent *r, +__utf8_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state) @@ -144,8 +141,7 @@ _DEFUN (__utf8_wctomb, (r, s, wchar, state), because the underlying OS requires wchar_t == UTF-16. */ #ifndef __CYGWIN__ int -_DEFUN (__sjis_wctomb, (r, s, wchar, state), - struct _reent *r, +__sjis_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state) @@ -178,8 +174,7 @@ _DEFUN (__sjis_wctomb, (r, s, wchar, state), } int -_DEFUN (__eucjp_wctomb, (r, s, wchar, state), - struct _reent *r, +__eucjp_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state) @@ -218,8 +213,7 @@ _DEFUN (__eucjp_wctomb, (r, s, wchar, state), } int -_DEFUN (__jis_wctomb, (r, s, wchar, state), - struct _reent *r, +__jis_wctomb (struct _reent *r, char *s, wchar_t _wchar, mbstate_t *state) diff --git a/newlib/libc/string/bcmp.c b/newlib/libc/string/bcmp.c index 29afe828c..747f8af51 100644 --- a/newlib/libc/string/bcmp.c +++ b/newlib/libc/string/bcmp.c @@ -32,8 +32,7 @@ QUICKREF #include int -_DEFUN (bcmp, (m1, m2, n), - const void *m1, +bcmp (const void *m1, const void *m2, size_t n) diff --git a/newlib/libc/string/bcopy.c b/newlib/libc/string/bcopy.c index d6cb0c97a..d8bdeb57f 100644 --- a/newlib/libc/string/bcopy.c +++ b/newlib/libc/string/bcopy.c @@ -24,8 +24,7 @@ QUICKREF #include void -_DEFUN (bcopy, (b1, b2, length), - const void *b1, +bcopy (const void *b1, void *b2, size_t length) { diff --git a/newlib/libc/string/gnu_basename.c b/newlib/libc/string/gnu_basename.c index 90e22ccdf..c43542599 100644 --- a/newlib/libc/string/gnu_basename.c +++ b/newlib/libc/string/gnu_basename.c @@ -14,8 +14,7 @@ #include char * -_DEFUN (__gnu_basename, (path), - const char *path) +__gnu_basename (const char *path) { char *p; if ((p = strrchr (path, '/'))) diff --git a/newlib/libc/string/index.c b/newlib/libc/string/index.c index 13519b435..4a6788512 100644 --- a/newlib/libc/string/index.c +++ b/newlib/libc/string/index.c @@ -31,8 +31,7 @@ QUICKREF #include char * -_DEFUN (index, (s, c), - const char *s, +index (const char *s, int c) { return strchr (s, c); diff --git a/newlib/libc/string/memccpy.c b/newlib/libc/string/memccpy.c index 9b94061cb..1f5f55c50 100644 --- a/newlib/libc/string/memccpy.c +++ b/newlib/libc/string/memccpy.c @@ -56,8 +56,7 @@ PORTABILITY void * -_DEFUN (memccpy, (dst0, src0, endchar, len0), - void *__restrict dst0, +memccpy (void *__restrict dst0, const void *__restrict src0, int endchar0, size_t len0) diff --git a/newlib/libc/string/memchr.c b/newlib/libc/string/memchr.c index 91f0b3788..21bc4d879 100644 --- a/newlib/libc/string/memchr.c +++ b/newlib/libc/string/memchr.c @@ -62,8 +62,7 @@ QUICKREF #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) void * -_DEFUN (memchr, (src_void, c, length), - const void *src_void, +memchr (const void *src_void, int c, size_t length) { diff --git a/newlib/libc/string/memcmp.c b/newlib/libc/string/memcmp.c index c05cf5745..342fb9fbc 100644 --- a/newlib/libc/string/memcmp.c +++ b/newlib/libc/string/memcmp.c @@ -43,8 +43,7 @@ QUICKREF #define TOO_SMALL(LEN) ((LEN) < LBLOCKSIZE) int -_DEFUN (memcmp, (m1, m2, n), - const void *m1, +memcmp (const void *m1, const void *m2, size_t n) { diff --git a/newlib/libc/string/memcpy.c b/newlib/libc/string/memcpy.c index e1ae0ffe9..a1cff12d9 100644 --- a/newlib/libc/string/memcpy.c +++ b/newlib/libc/string/memcpy.c @@ -44,8 +44,7 @@ QUICKREF #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) void * -_DEFUN (memcpy, (dst0, src0, len0), - void *__restrict dst0, +memcpy (void *__restrict dst0, const void *__restrict src0, size_t len0) { diff --git a/newlib/libc/string/memmem.c b/newlib/libc/string/memmem.c index 5588b9f59..5c57eff9c 100644 --- a/newlib/libc/string/memmem.c +++ b/newlib/libc/string/memmem.c @@ -46,8 +46,7 @@ QUICKREF #endif void * -_DEFUN (memmem, (haystack_start, haystack_len, needle_start, needle_len), - const void *haystack_start, +memmem (const void *haystack_start, size_t haystack_len, const void *needle_start, size_t needle_len) diff --git a/newlib/libc/string/memmove.c b/newlib/libc/string/memmove.c index 70adb836c..da5dfdbdd 100644 --- a/newlib/libc/string/memmove.c +++ b/newlib/libc/string/memmove.c @@ -50,8 +50,7 @@ QUICKREF /*SUPPRESS 20*/ void * __inhibit_loop_to_libcall -_DEFUN (memmove, (dst_void, src_void, length), - void *dst_void, +memmove (void *dst_void, const void *src_void, size_t length) { diff --git a/newlib/libc/string/mempcpy.c b/newlib/libc/string/mempcpy.c index babaea006..129165603 100644 --- a/newlib/libc/string/mempcpy.c +++ b/newlib/libc/string/mempcpy.c @@ -43,8 +43,7 @@ PORTABILITY #define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE) void * -_DEFUN (mempcpy, (dst0, src0, len0), - void *dst0, +mempcpy (void *dst0, const void *src0, size_t len0) { diff --git a/newlib/libc/string/memrchr.c b/newlib/libc/string/memrchr.c index 432f46212..652efb359 100644 --- a/newlib/libc/string/memrchr.c +++ b/newlib/libc/string/memrchr.c @@ -62,8 +62,7 @@ QUICKREF #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) void * -_DEFUN (memrchr, (src_void, c, length), - const void *src_void, +memrchr (const void *src_void, int c, size_t length) { diff --git a/newlib/libc/string/memset.c b/newlib/libc/string/memset.c index 5ce15c5aa..e8e667a24 100644 --- a/newlib/libc/string/memset.c +++ b/newlib/libc/string/memset.c @@ -35,8 +35,7 @@ QUICKREF void * __inhibit_loop_to_libcall -_DEFUN (memset, (m, c, n), - void *m, +memset (void *m, int c, size_t n) { diff --git a/newlib/libc/string/rawmemchr.c b/newlib/libc/string/rawmemchr.c index 881bd231a..56e2b5e2d 100644 --- a/newlib/libc/string/rawmemchr.c +++ b/newlib/libc/string/rawmemchr.c @@ -61,8 +61,7 @@ QUICKREF #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) void * -_DEFUN (rawmemchr, (src_void, c), - const void *src_void, +rawmemchr (const void *src_void, int c) { const unsigned char *src = (const unsigned char *) src_void; diff --git a/newlib/libc/string/rindex.c b/newlib/libc/string/rindex.c index 0c7f153cf..39e5aa2da 100644 --- a/newlib/libc/string/rindex.c +++ b/newlib/libc/string/rindex.c @@ -31,8 +31,7 @@ QUICKREF #include char * -_DEFUN (rindex, (s, c), - const char *s, +rindex (const char *s, int c) { return strrchr (s, c); diff --git a/newlib/libc/string/stpcpy.c b/newlib/libc/string/stpcpy.c index 3933036cc..4e2ae9fe0 100644 --- a/newlib/libc/string/stpcpy.c +++ b/newlib/libc/string/stpcpy.c @@ -53,8 +53,7 @@ QUICKREF #endif char* -_DEFUN (stpcpy, (dst, src), - char *__restrict dst, +stpcpy (char *__restrict dst, const char *__restrict src) { #if !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/stpncpy.c b/newlib/libc/string/stpncpy.c index 69fa8515a..87fe268cf 100644 --- a/newlib/libc/string/stpncpy.c +++ b/newlib/libc/string/stpncpy.c @@ -61,8 +61,7 @@ QUICKREF #define TOO_SMALL(LEN) ((LEN) < sizeof (long)) char * -_DEFUN (stpncpy, (dst, src), - char *__restrict dst, +stpncpy (char *__restrict dst, const char *__restrict src, size_t count) { diff --git a/newlib/libc/string/strcasecmp.c b/newlib/libc/string/strcasecmp.c index 4a48aa69a..c75a3e20d 100644 --- a/newlib/libc/string/strcasecmp.c +++ b/newlib/libc/string/strcasecmp.c @@ -36,8 +36,7 @@ QUICKREF #include int -_DEFUN (strcasecmp, (s1, s2), - const char *s1, +strcasecmp (const char *s1, const char *s2) { int d = 0; diff --git a/newlib/libc/string/strcasestr.c b/newlib/libc/string/strcasestr.c index 1cc5f6ed7..36e183986 100644 --- a/newlib/libc/string/strcasestr.c +++ b/newlib/libc/string/strcasestr.c @@ -90,8 +90,7 @@ QUICKREF * Find the first occurrence of find in s, ignore case. */ char * -_DEFUN (strcasestr, (s, find), - const char *s, +strcasestr (const char *s, const char *find) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcat.c b/newlib/libc/string/strcat.c index ac9bb8e15..92313c492 100644 --- a/newlib/libc/string/strcat.c +++ b/newlib/libc/string/strcat.c @@ -54,8 +54,7 @@ QUICKREF /*SUPPRESS 530*/ char * -_DEFUN (strcat, (s1, s2), - char *__restrict s1, +strcat (char *__restrict s1, const char *__restrict s2) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strchr.c b/newlib/libc/string/strchr.c index 05503d178..96f30be04 100644 --- a/newlib/libc/string/strchr.c +++ b/newlib/libc/string/strchr.c @@ -52,8 +52,7 @@ QUICKREF #define DETECTCHAR(X,MASK) (DETECTNULL(X ^ MASK)) char * -_DEFUN (strchr, (s1, i), - const char *s1, +strchr (const char *s1, int i) { const unsigned char *s = (const unsigned char *)s1; diff --git a/newlib/libc/string/strchrnul.c b/newlib/libc/string/strchrnul.c index 14fd4e2ec..f5c3eb25d 100644 --- a/newlib/libc/string/strchrnul.c +++ b/newlib/libc/string/strchrnul.c @@ -31,8 +31,7 @@ QUICKREF #include char * -_DEFUN (strchrnul, (s1, i), - const char *s1, +strchrnul (const char *s1, int i) { char *s = strchr(s1, i); diff --git a/newlib/libc/string/strcmp.c b/newlib/libc/string/strcmp.c index 6c1a0386d..894424a69 100644 --- a/newlib/libc/string/strcmp.c +++ b/newlib/libc/string/strcmp.c @@ -52,8 +52,7 @@ QUICKREF #endif int -_DEFUN (strcmp, (s1, s2), - const char *s1, +strcmp (const char *s1, const char *s2) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcoll.c b/newlib/libc/string/strcoll.c index fae999a64..7fa8d1373 100644 --- a/newlib/libc/string/strcoll.c +++ b/newlib/libc/string/strcoll.c @@ -36,8 +36,7 @@ QUICKREF #include int -_DEFUN (strcoll, (a, b), - const char *a, +strcoll (const char *a, const char *b) { diff --git a/newlib/libc/string/strcpy.c b/newlib/libc/string/strcpy.c index 3505b800a..94e16b512 100644 --- a/newlib/libc/string/strcpy.c +++ b/newlib/libc/string/strcpy.c @@ -52,8 +52,7 @@ QUICKREF #endif char* -_DEFUN (strcpy, (dst0, src0), - char *dst0, +strcpy (char *dst0, const char *src0) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strcspn.c b/newlib/libc/string/strcspn.c index 589054bae..abaa93ad6 100644 --- a/newlib/libc/string/strcspn.c +++ b/newlib/libc/string/strcspn.c @@ -26,8 +26,7 @@ PORTABILITY #include size_t -_DEFUN (strcspn, (s1, s2), - const char *s1, +strcspn (const char *s1, const char *s2) { const char *s = s1; diff --git a/newlib/libc/string/strdup.c b/newlib/libc/string/strdup.c index 6ea2dd570..3f2a0264c 100644 --- a/newlib/libc/string/strdup.c +++ b/newlib/libc/string/strdup.c @@ -5,7 +5,7 @@ #include char * -_DEFUN (strdup, (str), const char *str) +strdup (const char *str) { return _strdup_r (_REENT, str); } diff --git a/newlib/libc/string/strdup_r.c b/newlib/libc/string/strdup_r.c index 9cdee80f4..14c80f73f 100644 --- a/newlib/libc/string/strdup_r.c +++ b/newlib/libc/string/strdup_r.c @@ -3,8 +3,7 @@ #include char * -_DEFUN (_strdup_r, (reent_ptr, str), - struct _reent *reent_ptr, +_strdup_r (struct _reent *reent_ptr, const char *str) { size_t len = strlen (str) + 1; diff --git a/newlib/libc/string/strerror.c b/newlib/libc/string/strerror.c index 8d5c188f8..c1b934696 100644 --- a/newlib/libc/string/strerror.c +++ b/newlib/libc/string/strerror.c @@ -385,8 +385,7 @@ QUICKREF #include char * -_DEFUN (_strerror_r, (ptr, errnum, internal, errptr), - struct _reent *ptr, +_strerror_r (struct _reent *ptr, int errnum, int internal, int *errptr) @@ -893,8 +892,7 @@ _DEFUN (_strerror_r, (ptr, errnum, internal, errptr), } char * -_DEFUN(strerror, (int), - int errnum) +strerror (int errnum) { return _strerror_r (_REENT, errnum, 0, NULL); } diff --git a/newlib/libc/string/strerror_r.c b/newlib/libc/string/strerror_r.c index c888f9ff3..660fee869 100644 --- a/newlib/libc/string/strerror_r.c +++ b/newlib/libc/string/strerror_r.c @@ -65,8 +65,7 @@ a non-empty alternate string without assigning into its third argument. /* For backwards-compatible linking, this must be the GNU signature; see xpg_strerror_r.c for the POSIX version. */ char * -_DEFUN (strerror_r, (errnum, buffer, n), - int errnum, +strerror_r (int errnum, char *buffer, size_t n) { diff --git a/newlib/libc/string/strlcat.c b/newlib/libc/string/strlcat.c index 2f99294af..a91c297c5 100644 --- a/newlib/libc/string/strlcat.c +++ b/newlib/libc/string/strlcat.c @@ -42,8 +42,7 @@ static char *rcsid = "$OpenBSD: strlcat.c,v 1.8 2001/05/13 15:40:15 deraadt Exp * If retval >= siz, truncation occurred. */ size_t -_DEFUN (strlcat, (dst, src, siz), - char *dst, +strlcat (char *dst, const char *src, size_t siz) { diff --git a/newlib/libc/string/strlcpy.c b/newlib/libc/string/strlcpy.c index 2dffed5e3..63ba31ce9 100644 --- a/newlib/libc/string/strlcpy.c +++ b/newlib/libc/string/strlcpy.c @@ -40,8 +40,7 @@ static char *rcsid = "$OpenBSD: strlcpy.c,v 1.5 2001/05/13 15:40:16 deraadt Exp * Returns strlen(src); if retval >= siz, truncation occurred. */ size_t -_DEFUN (strlcpy, (dst, src, siz), - char *dst, +strlcpy (char *dst, const char *src, size_t siz) { diff --git a/newlib/libc/string/strlen.c b/newlib/libc/string/strlen.c index df76d5fc2..acffa49e1 100644 --- a/newlib/libc/string/strlen.c +++ b/newlib/libc/string/strlen.c @@ -49,8 +49,7 @@ QUICKREF #endif size_t -_DEFUN (strlen, (str), - const char *str) +strlen (const char *str) { const char *start = str; diff --git a/newlib/libc/string/strlwr.c b/newlib/libc/string/strlwr.c index c47ff4859..7211c5917 100644 --- a/newlib/libc/string/strlwr.c +++ b/newlib/libc/string/strlwr.c @@ -29,8 +29,7 @@ QUICKREF #include char * -_DEFUN (strlwr, (s), - char *s) +strlwr (char *s) { unsigned char *ucs = (unsigned char *) s; for ( ; *ucs != '\0'; ucs++) diff --git a/newlib/libc/string/strncasecmp.c b/newlib/libc/string/strncasecmp.c index 2a6f6265d..09dd98bf5 100644 --- a/newlib/libc/string/strncasecmp.c +++ b/newlib/libc/string/strncasecmp.c @@ -37,8 +37,7 @@ QUICKREF #include int -_DEFUN (strncasecmp, (s1, s2, n), - const char *s1, +strncasecmp (const char *s1, const char *s2, size_t n) { diff --git a/newlib/libc/string/strncat.c b/newlib/libc/string/strncat.c index 2411cf124..7351913f9 100644 --- a/newlib/libc/string/strncat.c +++ b/newlib/libc/string/strncat.c @@ -58,8 +58,7 @@ QUICKREF #endif char * -_DEFUN (strncat, (s1, s2, n), - char *__restrict s1, +strncat (char *__restrict s1, const char *__restrict s2, size_t n) { diff --git a/newlib/libc/string/strncmp.c b/newlib/libc/string/strncmp.c index 685d19290..16f8a7729 100644 --- a/newlib/libc/string/strncmp.c +++ b/newlib/libc/string/strncmp.c @@ -52,8 +52,7 @@ QUICKREF #endif int -_DEFUN (strncmp, (s1, s2, n), - const char *s1, +strncmp (const char *s1, const char *s2, size_t n) { diff --git a/newlib/libc/string/strncpy.c b/newlib/libc/string/strncpy.c index abbe43bc7..e7eb34d72 100644 --- a/newlib/libc/string/strncpy.c +++ b/newlib/libc/string/strncpy.c @@ -59,8 +59,7 @@ QUICKREF #define TOO_SMALL(LEN) ((LEN) < sizeof (long)) char * -_DEFUN (strncpy, (dst0, src0), - char *__restrict dst0, +strncpy (char *__restrict dst0, const char *__restrict src0, size_t count) { diff --git a/newlib/libc/string/strndup.c b/newlib/libc/string/strndup.c index c241ca544..3ac890a8c 100644 --- a/newlib/libc/string/strndup.c +++ b/newlib/libc/string/strndup.c @@ -6,8 +6,7 @@ #include char * -_DEFUN (strndup, (str, n), - const char *str, +strndup (const char *str, size_t n) { return _strndup_r (_REENT, str, n); diff --git a/newlib/libc/string/strndup_r.c b/newlib/libc/string/strndup_r.c index 3c7e8ee4f..1b6cf84e5 100644 --- a/newlib/libc/string/strndup_r.c +++ b/newlib/libc/string/strndup_r.c @@ -3,8 +3,7 @@ #include char * -_DEFUN (_strndup_r, (reent_ptr, str, n), - struct _reent *reent_ptr, +_strndup_r (struct _reent *reent_ptr, const char *str, size_t n) { diff --git a/newlib/libc/string/strnlen.c b/newlib/libc/string/strnlen.c index 42f460fea..3ee18d1c0 100644 --- a/newlib/libc/string/strnlen.c +++ b/newlib/libc/string/strnlen.c @@ -30,8 +30,7 @@ PORTABILITY #include size_t -_DEFUN (strnlen, (str, n), - const char *str, +strnlen (const char *str, size_t n) { const char *start = str; diff --git a/newlib/libc/string/strpbrk.c b/newlib/libc/string/strpbrk.c index f70efc1ea..774db1e6d 100644 --- a/newlib/libc/string/strpbrk.c +++ b/newlib/libc/string/strpbrk.c @@ -25,8 +25,7 @@ PORTABILITY #include char * -_DEFUN (strpbrk, (s1, s2), - const char *s1, +strpbrk (const char *s1, const char *s2) { const char *c = s2; diff --git a/newlib/libc/string/strrchr.c b/newlib/libc/string/strrchr.c index 4aafd509a..04897e162 100644 --- a/newlib/libc/string/strrchr.c +++ b/newlib/libc/string/strrchr.c @@ -30,8 +30,7 @@ QUICKREF #include char * -_DEFUN (strrchr, (s, i), - const char *s, +strrchr (const char *s, int i) { const char *last = NULL; diff --git a/newlib/libc/string/strsep.c b/newlib/libc/string/strsep.c index e59782795..e1262ac37 100644 --- a/newlib/libc/string/strsep.c +++ b/newlib/libc/string/strsep.c @@ -11,8 +11,7 @@ extern char *__strtok_r (char *, const char *, char **, int); char * -_DEFUN (strsep, (source_ptr, delim), - register char **source_ptr, +strsep (register char **source_ptr, register const char *delim) { return __strtok_r (*source_ptr, delim, source_ptr, 0); diff --git a/newlib/libc/string/strsignal.c b/newlib/libc/string/strsignal.c index 86a0e5dd9..544857b14 100644 --- a/newlib/libc/string/strsignal.c +++ b/newlib/libc/string/strsignal.c @@ -53,8 +53,7 @@ QUICKREF #include char * -_DEFUN (strsignal, (signal), - int signal) +strsignal (int signal) { char *buffer; struct _reent *ptr; diff --git a/newlib/libc/string/strspn.c b/newlib/libc/string/strspn.c index 22ccd0bf8..baf239947 100644 --- a/newlib/libc/string/strspn.c +++ b/newlib/libc/string/strspn.c @@ -30,8 +30,7 @@ QUICKREF #include size_t -_DEFUN (strspn, (s1, s2), - const char *s1, +strspn (const char *s1, const char *s2) { const char *s = s1; diff --git a/newlib/libc/string/strstr.c b/newlib/libc/string/strstr.c index 749edbce6..580ad6272 100644 --- a/newlib/libc/string/strstr.c +++ b/newlib/libc/string/strstr.c @@ -39,8 +39,7 @@ QUICKREF #endif char * -_DEFUN (strstr, (searchee, lookfor), - const char *searchee, +strstr (const char *searchee, const char *lookfor) { #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) diff --git a/newlib/libc/string/strtok.c b/newlib/libc/string/strtok.c index 92c801731..801f51aca 100644 --- a/newlib/libc/string/strtok.c +++ b/newlib/libc/string/strtok.c @@ -79,8 +79,7 @@ QUICKREF extern char *__strtok_r (char *, const char *, char **, int); char * -_DEFUN (strtok, (s, delim), - register char *__restrict s, +strtok (register char *__restrict s, register const char *__restrict delim) { struct _reent *reent = _REENT; diff --git a/newlib/libc/string/strtok_r.c b/newlib/libc/string/strtok_r.c index 0d01dcaad..d17fd693d 100644 --- a/newlib/libc/string/strtok_r.c +++ b/newlib/libc/string/strtok_r.c @@ -30,8 +30,7 @@ #include char * -_DEFUN (__strtok_r, (s, delim, lasts, skip_leading_delim), - register char *s, +__strtok_r (register char *s, register const char *delim, char **lasts, int skip_leading_delim) @@ -90,8 +89,7 @@ cont: } char * -_DEFUN (strtok_r, (s, delim, lasts), - register char *__restrict s, +strtok_r (register char *__restrict s, register const char *__restrict delim, char **__restrict lasts) { diff --git a/newlib/libc/string/strupr.c b/newlib/libc/string/strupr.c index dbec79e46..a175d5c57 100644 --- a/newlib/libc/string/strupr.c +++ b/newlib/libc/string/strupr.c @@ -29,8 +29,7 @@ QUICKREF #include char * -_DEFUN (strupr, (s), - char *s) +strupr (char *s) { unsigned char *ucs = (unsigned char *) s; for ( ; *ucs != '\0'; ucs++) diff --git a/newlib/libc/string/strxfrm.c b/newlib/libc/string/strxfrm.c index 13c51becf..c5df0bcd5 100644 --- a/newlib/libc/string/strxfrm.c +++ b/newlib/libc/string/strxfrm.c @@ -46,8 +46,7 @@ QUICKREF #include size_t -_DEFUN (strxfrm, (s1, s2, n), - char *__restrict s1, +strxfrm (char *__restrict s1, const char *__restrict s2, size_t n) { diff --git a/newlib/libc/string/swab.c b/newlib/libc/string/swab.c index 1c14a4c48..28ab978bd 100644 --- a/newlib/libc/string/swab.c +++ b/newlib/libc/string/swab.c @@ -18,8 +18,7 @@ PORTABILITY #include void -_DEFUN (swab, (b1, b2, length), - const void *b1, +swab (const void *b1, void *b2, ssize_t length) { diff --git a/newlib/libc/string/u_strerr.c b/newlib/libc/string/u_strerr.c index 174d9170f..cde05adb2 100644 --- a/newlib/libc/string/u_strerr.c +++ b/newlib/libc/string/u_strerr.c @@ -1,8 +1,7 @@ #include <_ansi.h> char * -_DEFUN(_user_strerror, (errnum, internal, errptr), - int errnum, +_user_strerror (int errnum, int internal, int *errptr) { diff --git a/newlib/libc/string/wcpcpy.c b/newlib/libc/string/wcpcpy.c index 942fad19c..76c5311f1 100644 --- a/newlib/libc/string/wcpcpy.c +++ b/newlib/libc/string/wcpcpy.c @@ -26,8 +26,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcpcpy, (s1, s2), - wchar_t *__restrict s1, +wcpcpy (wchar_t *__restrict s1, const wchar_t *__restrict s2) { while ((*s1++ = *s2++)) diff --git a/newlib/libc/string/wcpncpy.c b/newlib/libc/string/wcpncpy.c index 11f4d7c1f..d4e8bcfcd 100644 --- a/newlib/libc/string/wcpncpy.c +++ b/newlib/libc/string/wcpncpy.c @@ -33,8 +33,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcpncpy, (dst, src, count), - wchar_t *__restrict dst, +wcpncpy (wchar_t *__restrict dst, const wchar_t *__restrict src, size_t count) { diff --git a/newlib/libc/string/wcscasecmp.c b/newlib/libc/string/wcscasecmp.c index 483754997..b8623ba06 100644 --- a/newlib/libc/string/wcscasecmp.c +++ b/newlib/libc/string/wcscasecmp.c @@ -36,8 +36,7 @@ QUICKREF #include int -_DEFUN (wcscasecmp, (s1, s2), - const wchar_t *s1, +wcscasecmp (const wchar_t *s1, const wchar_t *s2) { int d = 0; diff --git a/newlib/libc/string/wcscat.c b/newlib/libc/string/wcscat.c index 40b7774e5..c6bde4a6e 100644 --- a/newlib/libc/string/wcscat.c +++ b/newlib/libc/string/wcscat.c @@ -61,8 +61,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcscat, (s1, s2), - wchar_t *__restrict s1, +wcscat (wchar_t *__restrict s1, const wchar_t *__restrict s2) { wchar_t *p; diff --git a/newlib/libc/string/wcschr.c b/newlib/libc/string/wcschr.c index f883f5443..62b96c344 100644 --- a/newlib/libc/string/wcschr.c +++ b/newlib/libc/string/wcschr.c @@ -58,8 +58,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcschr, (s, c), - const wchar_t * s, +wcschr (const wchar_t * s, wchar_t c) { const wchar_t *p; diff --git a/newlib/libc/string/wcscmp.c b/newlib/libc/string/wcscmp.c index 1fb35755c..2784fac16 100644 --- a/newlib/libc/string/wcscmp.c +++ b/newlib/libc/string/wcscmp.c @@ -67,8 +67,7 @@ No supporting OS subroutines are required. * Compare strings. */ int -_DEFUN (wcscmp, (s1, s2), - const wchar_t * s1, +wcscmp (const wchar_t * s1, const wchar_t * s2) { diff --git a/newlib/libc/string/wcscoll.c b/newlib/libc/string/wcscoll.c index 7d6b927f8..4bbf39c9a 100644 --- a/newlib/libc/string/wcscoll.c +++ b/newlib/libc/string/wcscoll.c @@ -33,8 +33,7 @@ PORTABILITY #include int -_DEFUN (wcscoll, (a, b), - const wchar_t *a, +wcscoll (const wchar_t *a, const wchar_t *b) { diff --git a/newlib/libc/string/wcscpy.c b/newlib/libc/string/wcscpy.c index 679e9c543..802d2af1f 100644 --- a/newlib/libc/string/wcscpy.c +++ b/newlib/libc/string/wcscpy.c @@ -57,8 +57,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcscpy, (s1, s2), - wchar_t *__restrict s1, +wcscpy (wchar_t *__restrict s1, const wchar_t *__restrict s2) { wchar_t *p; diff --git a/newlib/libc/string/wcscspn.c b/newlib/libc/string/wcscspn.c index 54bca2fa7..4feb6e7c9 100644 --- a/newlib/libc/string/wcscspn.c +++ b/newlib/libc/string/wcscspn.c @@ -56,8 +56,7 @@ No supporting OS subroutines are required. #include size_t -_DEFUN (wcscspn, (s, set), - const wchar_t * s, +wcscspn (const wchar_t * s, const wchar_t * set) { const wchar_t *p; diff --git a/newlib/libc/string/wcslcat.c b/newlib/libc/string/wcslcat.c index dd96d3049..189a710bd 100644 --- a/newlib/libc/string/wcslcat.c +++ b/newlib/libc/string/wcslcat.c @@ -68,8 +68,7 @@ No supporting OS subroutines are required. * truncation occurred. */ size_t -_DEFUN (wcslcat, (dst, src, siz), - wchar_t * dst, +wcslcat (wchar_t * dst, const wchar_t * src, size_t siz) { diff --git a/newlib/libc/string/wcslcpy.c b/newlib/libc/string/wcslcpy.c index a21f8c8fc..3d688a943 100644 --- a/newlib/libc/string/wcslcpy.c +++ b/newlib/libc/string/wcslcpy.c @@ -62,8 +62,7 @@ No supporting OS subroutines are required. * Returns wcslen(src); if retval >= siz, truncation occurred. */ size_t -_DEFUN (wcslcpy, (dst, src, siz), - wchar_t * dst, +wcslcpy (wchar_t * dst, const wchar_t * src, size_t siz) { diff --git a/newlib/libc/string/wcslen.c b/newlib/libc/string/wcslen.c index c92757708..8fa9f723c 100644 --- a/newlib/libc/string/wcslen.c +++ b/newlib/libc/string/wcslen.c @@ -55,8 +55,7 @@ No supporting OS subroutines are required. #include size_t -_DEFUN (wcslen, (s), - const wchar_t * s) +wcslen (const wchar_t * s) { const wchar_t *p; diff --git a/newlib/libc/string/wcsncasecmp.c b/newlib/libc/string/wcsncasecmp.c index 7abb154ee..b77952ac3 100644 --- a/newlib/libc/string/wcsncasecmp.c +++ b/newlib/libc/string/wcsncasecmp.c @@ -37,8 +37,7 @@ QUICKREF #include int -_DEFUN (wcsncasecmp, (s1, s2, n), - const wchar_t *s1, +wcsncasecmp (const wchar_t *s1, const wchar_t *s2, size_t n) { diff --git a/newlib/libc/string/wcsncat.c b/newlib/libc/string/wcsncat.c index 3c344b46e..4c14e19f3 100644 --- a/newlib/libc/string/wcsncat.c +++ b/newlib/libc/string/wcsncat.c @@ -62,8 +62,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcsncat, (s1, s2, n), - wchar_t *__restrict s1, +wcsncat (wchar_t *__restrict s1, const wchar_t *__restrict s2, size_t n) { diff --git a/newlib/libc/string/wcsncmp.c b/newlib/libc/string/wcsncmp.c index 2dc7660f4..aba4f54aa 100644 --- a/newlib/libc/string/wcsncmp.c +++ b/newlib/libc/string/wcsncmp.c @@ -63,8 +63,7 @@ No supporting OS subroutines are required. #include int -_DEFUN (wcsncmp, (s1, s2, n), - const wchar_t * s1, +wcsncmp (const wchar_t * s1, const wchar_t * s2, size_t n) { diff --git a/newlib/libc/string/wcsncpy.c b/newlib/libc/string/wcsncpy.c index 324dad3a2..9b103b1bd 100644 --- a/newlib/libc/string/wcsncpy.c +++ b/newlib/libc/string/wcsncpy.c @@ -35,8 +35,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcsncpy, (s1, s2, n), - wchar_t *__restrict s1, +wcsncpy (wchar_t *__restrict s1, const wchar_t *__restrict s2, size_t n) { diff --git a/newlib/libc/string/wcsnlen.c b/newlib/libc/string/wcsnlen.c index cc7d66e10..fff1a7ec2 100644 --- a/newlib/libc/string/wcsnlen.c +++ b/newlib/libc/string/wcsnlen.c @@ -52,8 +52,7 @@ PORTABILITY #include size_t -_DEFUN(wcsnlen, (s, maxlen), - const wchar_t *s, +wcsnlen (const wchar_t *s, size_t maxlen) { const wchar_t *p; diff --git a/newlib/libc/string/wcspbrk.c b/newlib/libc/string/wcspbrk.c index ecda7affe..5a3d01ece 100644 --- a/newlib/libc/string/wcspbrk.c +++ b/newlib/libc/string/wcspbrk.c @@ -57,8 +57,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcspbrk, (s, set), - const wchar_t * s, +wcspbrk (const wchar_t * s, const wchar_t * set) { const wchar_t *p; diff --git a/newlib/libc/string/wcsrchr.c b/newlib/libc/string/wcsrchr.c index f12ccc202..0e22dc024 100644 --- a/newlib/libc/string/wcsrchr.c +++ b/newlib/libc/string/wcsrchr.c @@ -60,8 +60,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wcsrchr, (s, c), - const wchar_t * s, +wcsrchr (const wchar_t * s, wchar_t c) { const wchar_t *p; diff --git a/newlib/libc/string/wcsspn.c b/newlib/libc/string/wcsspn.c index 196816821..db64f1f18 100644 --- a/newlib/libc/string/wcsspn.c +++ b/newlib/libc/string/wcsspn.c @@ -56,8 +56,7 @@ No supporting OS subroutines are required. #include size_t -_DEFUN (wcsspn, (s, set), - const wchar_t * s, +wcsspn (const wchar_t * s, const wchar_t * set) { const wchar_t *p; diff --git a/newlib/libc/string/wcsstr.c b/newlib/libc/string/wcsstr.c index d5a031452..e77e50584 100644 --- a/newlib/libc/string/wcsstr.c +++ b/newlib/libc/string/wcsstr.c @@ -61,8 +61,7 @@ PORTABILITY #include wchar_t * -_DEFUN (wcsstr, (big, little), - const wchar_t *__restrict big, +wcsstr (const wchar_t *__restrict big, const wchar_t *__restrict little) { const wchar_t *p; diff --git a/newlib/libc/string/wcstok.c b/newlib/libc/string/wcstok.c index 2467704fd..f7d1c5ee9 100644 --- a/newlib/libc/string/wcstok.c +++ b/newlib/libc/string/wcstok.c @@ -90,8 +90,7 @@ QUICKREF #include wchar_t * -_DEFUN (wcstok, (s, delim, lasts), - register wchar_t *__restrict s, +wcstok (register wchar_t *__restrict s, register const wchar_t *__restrict delim, wchar_t **__restrict lasts) { diff --git a/newlib/libc/string/wcswidth.c b/newlib/libc/string/wcswidth.c index 19abfd92d..4be7b8ae8 100644 --- a/newlib/libc/string/wcswidth.c +++ b/newlib/libc/string/wcswidth.c @@ -34,8 +34,7 @@ PORTABILITY #include "local.h" int -_DEFUN (wcswidth, (pwcs, n), - const wchar_t *pwcs, +wcswidth (const wchar_t *pwcs, size_t n) { diff --git a/newlib/libc/string/wcsxfrm.c b/newlib/libc/string/wcsxfrm.c index 78d7da566..72b3c5bd0 100644 --- a/newlib/libc/string/wcsxfrm.c +++ b/newlib/libc/string/wcsxfrm.c @@ -36,8 +36,7 @@ PORTABILITY #include size_t -_DEFUN (wcsxfrm, (a, b, n), - wchar_t *__restrict a, +wcsxfrm (wchar_t *__restrict a, const wchar_t *__restrict b, size_t n) diff --git a/newlib/libc/string/wcwidth.c b/newlib/libc/string/wcwidth.c index a8c73a542..fc40afd21 100644 --- a/newlib/libc/string/wcwidth.c +++ b/newlib/libc/string/wcwidth.c @@ -163,8 +163,7 @@ bisearch(wint_t ucs, const struct interval *table, int max) */ int -_DEFUN (__wcwidth, (ucs), - const wint_t ucs) +__wcwidth (const wint_t ucs) { #ifdef _MB_CAPABLE /* sorted list of non-overlapping intervals of East Asian Ambiguous @@ -329,8 +328,7 @@ _DEFUN (__wcwidth, (ucs), } int -_DEFUN (wcwidth, (wc), - const wchar_t wc) +wcwidth (const wchar_t wc) { wint_t wi = wc; diff --git a/newlib/libc/string/wmemchr.c b/newlib/libc/string/wmemchr.c index 8db2f64cc..0353e5449 100644 --- a/newlib/libc/string/wmemchr.c +++ b/newlib/libc/string/wmemchr.c @@ -63,8 +63,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wmemchr, (s, c, n), - const wchar_t * s, +wmemchr (const wchar_t * s, wchar_t c, size_t n) { diff --git a/newlib/libc/string/wmemcmp.c b/newlib/libc/string/wmemcmp.c index abb9ed6ff..20223a33d 100644 --- a/newlib/libc/string/wmemcmp.c +++ b/newlib/libc/string/wmemcmp.c @@ -62,8 +62,7 @@ No supporting OS subroutines are required. #include int -_DEFUN (wmemcmp, (s1, s2, n), - const wchar_t * s1, +wmemcmp (const wchar_t * s1, const wchar_t * s2, size_t n) { diff --git a/newlib/libc/string/wmemcpy.c b/newlib/libc/string/wmemcpy.c index ad1aa24bc..d763e2237 100644 --- a/newlib/libc/string/wmemcpy.c +++ b/newlib/libc/string/wmemcpy.c @@ -61,8 +61,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wmemcpy, (d, s, n), - wchar_t *__restrict d, +wmemcpy (wchar_t *__restrict d, const wchar_t *__restrict s, size_t n) { diff --git a/newlib/libc/string/wmemmove.c b/newlib/libc/string/wmemmove.c index 22b5a987d..399fae4e9 100644 --- a/newlib/libc/string/wmemmove.c +++ b/newlib/libc/string/wmemmove.c @@ -66,8 +66,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wmemmove, (d, s, n), - wchar_t * d, +wmemmove (wchar_t * d, const wchar_t * s, size_t n) { diff --git a/newlib/libc/string/wmempcpy.c b/newlib/libc/string/wmempcpy.c index 7354e81da..98983f968 100644 --- a/newlib/libc/string/wmempcpy.c +++ b/newlib/libc/string/wmempcpy.c @@ -34,8 +34,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN (wmempcpy, (d, s, n), - wchar_t *__restrict d, +wmempcpy (wchar_t *__restrict d, const wchar_t *__restrict s, size_t n) { diff --git a/newlib/libc/string/wmemset.c b/newlib/libc/string/wmemset.c index f9ec361cd..2120b564b 100644 --- a/newlib/libc/string/wmemset.c +++ b/newlib/libc/string/wmemset.c @@ -59,8 +59,7 @@ No supporting OS subroutines are required. #include wchar_t * -_DEFUN(wmemset, (s, c, n), - wchar_t *s, +wmemset (wchar_t *s, wchar_t c, size_t n) { diff --git a/newlib/libc/string/xpg_strerror_r.c b/newlib/libc/string/xpg_strerror_r.c index bc1858738..66e693611 100644 --- a/newlib/libc/string/xpg_strerror_r.c +++ b/newlib/libc/string/xpg_strerror_r.c @@ -4,8 +4,7 @@ #include int -_DEFUN (__xpg_strerror_r, (errnum, buffer, n), - int errnum, +__xpg_strerror_r (int errnum, char *buffer, size_t n) { diff --git a/newlib/libc/sys/a29khif/kill.c b/newlib/libc/sys/a29khif/kill.c index 0254367e4..ecb489e38 100644 --- a/newlib/libc/sys/a29khif/kill.c +++ b/newlib/libc/sys/a29khif/kill.c @@ -6,8 +6,7 @@ /* The pid argument should be of type pid_t. */ int -_DEFUN (_kill, (pid, sig), - int pid, +_kill (int pid, int sig) { if (pid == 1 || pid < 0) diff --git a/newlib/libc/sys/h8300hms/misc.c b/newlib/libc/sys/h8300hms/misc.c index 4869af2d3..159939391 100644 --- a/newlib/libc/sys/h8300hms/misc.c +++ b/newlib/libc/sys/h8300hms/misc.c @@ -7,19 +7,17 @@ /* _raise(), getpid(), and kill() are required by abort(). getpid/kill are prefixed with '_' because of MISSING_SYSCALL_NAMES. */ -int _DEFUN(_raise,(sig), - int sig) +int _raise (int sig) { return 0; } -int _DEFUN(_getpid,(),) +int _getpid (void) { return 0; } -int _DEFUN(_kill,(pid, sig), - int pid, +int _kill (int pid, int sig) { if (pid == 0) diff --git a/newlib/libc/sys/h8500hms/misc.c b/newlib/libc/sys/h8500hms/misc.c index d16c797d9..7f98ffceb 100644 --- a/newlib/libc/sys/h8500hms/misc.c +++ b/newlib/libc/sys/h8500hms/misc.c @@ -8,19 +8,17 @@ /* _raise(), getpid(), and kill() are required by abort(). getpid/kill are prefixed with '_' because of MISSING_SYSCALL_NAMES. */ -int _DEFUN(_raise,(sig), - int sig) +int _raise (int sig) { return 0; } -int _DEFUN(_getpid,(),) +int _getpid (void) { return 0; } -int _DEFUN(_kill,(pid, sig), - int pid, +int _kill (int pid, int sig) { if (sig == SIGABRT) diff --git a/newlib/libc/sys/linux/ctermid.c b/newlib/libc/sys/linux/ctermid.c index 05914ffad..bcf36f605 100644 --- a/newlib/libc/sys/linux/ctermid.c +++ b/newlib/libc/sys/linux/ctermid.c @@ -6,8 +6,7 @@ static char devname[] = "/dev/tty"; char * -_DEFUN (ctermid, (buf), - char *buf) +ctermid (char *buf) { if (buf == NULL) return devname; diff --git a/newlib/libc/sys/linux/getpwent.c b/newlib/libc/sys/linux/getpwent.c index adf607e02..5a60cbc53 100644 --- a/newlib/libc/sys/linux/getpwent.c +++ b/newlib/libc/sys/linux/getpwent.c @@ -3,8 +3,7 @@ #include struct passwd * -_DEFUN (getpwnam, (name), - const char *name) +getpwnam (const char *name) { errno = ENOSYS; return NULL; @@ -12,8 +11,7 @@ _DEFUN (getpwnam, (name), /* FIXME: dummy stub for now. */ struct passwd * -_DEFUN (getpwuid, (uid), - uid_t uid) +getpwuid (uid_t uid) { errno = ENOSYS; return NULL; @@ -21,8 +19,7 @@ _DEFUN (getpwuid, (uid), /* FIXME: dummy stub for now. */ struct passwd * -_DEFUN (getpwent, (uid), - uid_t uid) +getpwent (uid_t uid) { errno = ENOSYS; return NULL; diff --git a/newlib/libc/sys/linux/pread.c b/newlib/libc/sys/linux/pread.c index 8d905598f..2ff30bd08 100644 --- a/newlib/libc/sys/linux/pread.c +++ b/newlib/libc/sys/linux/pread.c @@ -6,8 +6,7 @@ #include ssize_t -_DEFUN (_pread_r, (rptr, fd, buf, n, off), - struct _reent *rptr, +_pread_r (struct _reent *rptr, int fd, void *buf, size_t n, @@ -33,8 +32,7 @@ _DEFUN (_pread_r, (rptr, fd, buf, n, off), #ifndef _REENT_ONLY ssize_t -_DEFUN (__libc_pread, (fd, buf, n, off), - int fd, +__libc_pread (int fd, void *buf, size_t n, off_t off) diff --git a/newlib/libc/sys/linux/pread64.c b/newlib/libc/sys/linux/pread64.c index 20d1f9c35..bbf743eb5 100644 --- a/newlib/libc/sys/linux/pread64.c +++ b/newlib/libc/sys/linux/pread64.c @@ -30,8 +30,7 @@ Supporting OS subroutine required: <>, <>. #include ssize_t -_DEFUN (__libc_pread64, (fd, buf, n, off), - int fd, +__libc_pread64 (int fd, void *buf, size_t n, loff_t off) diff --git a/newlib/libc/sys/linux/pwrite.c b/newlib/libc/sys/linux/pwrite.c index b0ec9c233..341ca6f07 100644 --- a/newlib/libc/sys/linux/pwrite.c +++ b/newlib/libc/sys/linux/pwrite.c @@ -6,8 +6,7 @@ #include ssize_t -_DEFUN (_pwrite_r, (rptr, fd, buf, n, off), - struct _reent *rptr, +_pwrite_r (struct _reent *rptr, int fd, const void *buf, size_t n, @@ -33,8 +32,7 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), #ifndef _REENT_ONLY ssize_t -_DEFUN (__libc_pwrite, (fd, buf, n, off), - int fd, +__libc_pwrite (int fd, const void *buf, size_t n, off_t off) diff --git a/newlib/libc/sys/linux/pwrite64.c b/newlib/libc/sys/linux/pwrite64.c index c80a3a2d3..864aa75fe 100644 --- a/newlib/libc/sys/linux/pwrite64.c +++ b/newlib/libc/sys/linux/pwrite64.c @@ -30,8 +30,7 @@ Supporting OS subroutine required: <>, <>. #include ssize_t -_DEFUN (__libc_pwrite64, (fd, buf, n, off), - int fd, +__libc_pwrite64 (int fd, void *buf, size_t n, loff_t off) diff --git a/newlib/libc/sys/sparc64/ieee.c b/newlib/libc/sys/sparc64/ieee.c index f3298e63d..42c530ba4 100644 --- a/newlib/libc/sys/sparc64/ieee.c +++ b/newlib/libc/sys/sparc64/ieee.c @@ -16,8 +16,7 @@ fpgetround (void) } fp_rnd -_DEFUN(fpsetround,(new), - fp_rnd new) +fpsetround (fp_rnd new) { fp_rnd old = fpgetround(); char *dummy; @@ -60,8 +59,7 @@ fpgetmask (void) } fp_except -_DEFUN(fpsetmask,(mask), - fp_except mask) +fpsetmask (fp_except mask) { fp_except old = fpgetmask(); @@ -85,8 +83,7 @@ _DEFUN(fpsetmask,(mask), } fp_except -_DEFUN(fpsetsticky,(mask), - fp_except mask) +fpsetsticky (fp_except mask) { return fpsetmask(mask); } @@ -98,8 +95,7 @@ fpgetsticky (void) } int -_DEFUN(fpsetroundtoi,(rdi_mode), - fp_rdi rdi_mode) +fpsetroundtoi (fp_rdi rdi_mode) { return 0; diff --git a/newlib/libc/sys/sun4/ieee.c b/newlib/libc/sys/sun4/ieee.c index f3298e63d..42c530ba4 100644 --- a/newlib/libc/sys/sun4/ieee.c +++ b/newlib/libc/sys/sun4/ieee.c @@ -16,8 +16,7 @@ fpgetround (void) } fp_rnd -_DEFUN(fpsetround,(new), - fp_rnd new) +fpsetround (fp_rnd new) { fp_rnd old = fpgetround(); char *dummy; @@ -60,8 +59,7 @@ fpgetmask (void) } fp_except -_DEFUN(fpsetmask,(mask), - fp_except mask) +fpsetmask (fp_except mask) { fp_except old = fpgetmask(); @@ -85,8 +83,7 @@ _DEFUN(fpsetmask,(mask), } fp_except -_DEFUN(fpsetsticky,(mask), - fp_except mask) +fpsetsticky (fp_except mask) { return fpsetmask(mask); } @@ -98,8 +95,7 @@ fpgetsticky (void) } int -_DEFUN(fpsetroundtoi,(rdi_mode), - fp_rdi rdi_mode) +fpsetroundtoi (fp_rdi rdi_mode) { return 0; diff --git a/newlib/libc/sys/sysnec810/misc.c b/newlib/libc/sys/sysnec810/misc.c index 354ecd81c..348e7195b 100644 --- a/newlib/libc/sys/sysnec810/misc.c +++ b/newlib/libc/sys/sysnec810/misc.c @@ -30,8 +30,7 @@ isatty() { } int -_DEFUN(_fstat,(file, st), - int file, +_fstat (int file, struct stat *st) { st->st_mode = S_IFCHR; diff --git a/newlib/libc/sys/sysvi386/fpx.c b/newlib/libc/sys/sysvi386/fpx.c index c9ff7c314..957a9b8d8 100644 --- a/newlib/libc/sys/sysvi386/fpx.c +++ b/newlib/libc/sys/sysvi386/fpx.c @@ -2,8 +2,7 @@ #include -fp_except _DEFUN(fpsetmask,(newmask), - fp_except newmask) +fp_except fpsetmask (fp_except newmask) { fp_except oldmask; @@ -32,8 +31,7 @@ fp_rnd fpgetround (void) return tkcw.fp_rounding; } -fp_rnd _DEFUN(fpsetround,(rnd), - fp_rnd rnd) +fp_rnd fpsetround (fp_rnd rnd) { fp_rnd oldrnd; v60_tkcw_type tkcw; @@ -56,8 +54,7 @@ fp_rdi fpgetroundtoi (void) return tkcw.integer_rounding; } -fp_rdi _DEFUN(fpsetroundtoi,(rnd), - fp_rdi rnd) +fp_rdi fpsetroundtoi (fp_rdi rnd) { fp_rdi oldrnd; v60_tkcw_type tkcw; diff --git a/newlib/libc/sys/sysvnecv70/fpx.c b/newlib/libc/sys/sysvnecv70/fpx.c index c9ff7c314..957a9b8d8 100644 --- a/newlib/libc/sys/sysvnecv70/fpx.c +++ b/newlib/libc/sys/sysvnecv70/fpx.c @@ -2,8 +2,7 @@ #include -fp_except _DEFUN(fpsetmask,(newmask), - fp_except newmask) +fp_except fpsetmask (fp_except newmask) { fp_except oldmask; @@ -32,8 +31,7 @@ fp_rnd fpgetround (void) return tkcw.fp_rounding; } -fp_rnd _DEFUN(fpsetround,(rnd), - fp_rnd rnd) +fp_rnd fpsetround (fp_rnd rnd) { fp_rnd oldrnd; v60_tkcw_type tkcw; @@ -56,8 +54,7 @@ fp_rdi fpgetroundtoi (void) return tkcw.integer_rounding; } -fp_rdi _DEFUN(fpsetroundtoi,(rnd), - fp_rdi rnd) +fp_rdi fpsetroundtoi (fp_rdi rnd) { fp_rdi oldrnd; v60_tkcw_type tkcw; diff --git a/newlib/libc/syscalls/sysclose.c b/newlib/libc/syscalls/sysclose.c index 946544bed..44ec36eb3 100644 --- a/newlib/libc/syscalls/sysclose.c +++ b/newlib/libc/syscalls/sysclose.c @@ -4,8 +4,7 @@ #include int -_DEFUN (close, (fd), - int fd) +close (int fd) { return _close_r (_REENT, fd); } diff --git a/newlib/libc/syscalls/sysexecve.c b/newlib/libc/syscalls/sysexecve.c index 1a593117d..52dbaddc3 100644 --- a/newlib/libc/syscalls/sysexecve.c +++ b/newlib/libc/syscalls/sysexecve.c @@ -4,8 +4,7 @@ #include int -_DEFUN (execve, (name, argv, env), - const char *name, +execve (const char *name, char *const argv[], char *const env[]) { diff --git a/newlib/libc/syscalls/sysfcntl.c b/newlib/libc/syscalls/sysfcntl.c index b063d766f..feccbf072 100644 --- a/newlib/libc/syscalls/sysfcntl.c +++ b/newlib/libc/syscalls/sysfcntl.c @@ -5,8 +5,7 @@ #include int -_DEFUN (fcntl, (fd, flag, arg), - int fd, +fcntl (int fd, int flag, int arg) { diff --git a/newlib/libc/syscalls/sysfstat.c b/newlib/libc/syscalls/sysfstat.c index 1ab7d62fa..c95e9aab1 100644 --- a/newlib/libc/syscalls/sysfstat.c +++ b/newlib/libc/syscalls/sysfstat.c @@ -5,8 +5,7 @@ #include int -_DEFUN (fstat, (fd, pstat), - int fd, +fstat (int fd, struct stat *pstat) { return _fstat_r (_REENT, fd, pstat); diff --git a/newlib/libc/syscalls/sysgettod.c b/newlib/libc/syscalls/sysgettod.c index f52f0045f..e050d35e2 100644 --- a/newlib/libc/syscalls/sysgettod.c +++ b/newlib/libc/syscalls/sysgettod.c @@ -5,8 +5,7 @@ #include int -_DEFUN (gettimeofday, (ptimeval, ptimezone), - struct timeval *ptimeval, +gettimeofday (struct timeval *ptimeval, void *ptimezone) { return _gettimeofday_r (_REENT, ptimeval, ptimezone); diff --git a/newlib/libc/syscalls/sysisatty.c b/newlib/libc/syscalls/sysisatty.c index 5a6b8d455..697c54bc4 100644 --- a/newlib/libc/syscalls/sysisatty.c +++ b/newlib/libc/syscalls/sysisatty.c @@ -4,8 +4,7 @@ #include int -_DEFUN (isatty, (fd), - int fd) +isatty (int fd) { #ifdef REENTRANT_SYSCALLS_PROVIDED return _isatty_r (_REENT, fd); diff --git a/newlib/libc/syscalls/syskill.c b/newlib/libc/syscalls/syskill.c index 03e06c07a..34b9f17de 100644 --- a/newlib/libc/syscalls/syskill.c +++ b/newlib/libc/syscalls/syskill.c @@ -4,8 +4,7 @@ #include int -_DEFUN (kill, (pid, sig), - int pid, +kill (int pid, int sig) { return _kill_r (_REENT, pid, sig); diff --git a/newlib/libc/syscalls/syslink.c b/newlib/libc/syscalls/syslink.c index 188040e4e..2f7dec6f9 100644 --- a/newlib/libc/syscalls/syslink.c +++ b/newlib/libc/syscalls/syslink.c @@ -4,8 +4,7 @@ #include int -_DEFUN (link, (old, new), - const char *old, +link (const char *old, const char *new) { return _link_r (_REENT, old, new); diff --git a/newlib/libc/syscalls/syslseek.c b/newlib/libc/syscalls/syslseek.c index 41cfbf745..4d5edd0f3 100644 --- a/newlib/libc/syscalls/syslseek.c +++ b/newlib/libc/syscalls/syslseek.c @@ -4,8 +4,7 @@ #include off_t -_DEFUN (lseek, (fd, pos, whence), - int fd, +lseek (int fd, off_t pos, int whence) { diff --git a/newlib/libc/syscalls/sysopen.c b/newlib/libc/syscalls/sysopen.c index 36523fc67..4d1a29953 100644 --- a/newlib/libc/syscalls/sysopen.c +++ b/newlib/libc/syscalls/sysopen.c @@ -10,8 +10,7 @@ #include int -_DEFUN (open, (file, flags, ...), - const char *file, +open (const char *file, int flags, ...) { va_list ap; diff --git a/newlib/libc/syscalls/sysread.c b/newlib/libc/syscalls/sysread.c index e45b76336..25d4e3bcf 100644 --- a/newlib/libc/syscalls/sysread.c +++ b/newlib/libc/syscalls/sysread.c @@ -4,8 +4,7 @@ #include _READ_WRITE_RETURN_TYPE -_DEFUN (read, (fd, buf, cnt), - int fd, +read (int fd, void *buf, size_t cnt) { diff --git a/newlib/libc/syscalls/syssbrk.c b/newlib/libc/syscalls/syssbrk.c index a3e550579..79b876321 100644 --- a/newlib/libc/syscalls/syssbrk.c +++ b/newlib/libc/syscalls/syssbrk.c @@ -7,8 +7,7 @@ extern void *_sbrk_r (struct _reent *, ptrdiff_t); extern void *_sbrk (ptrdiff_t); void * -_DEFUN (sbrk, (incr), - ptrdiff_t incr) +sbrk (ptrdiff_t incr) { return _sbrk_r (_REENT, incr); } diff --git a/newlib/libc/syscalls/sysstat.c b/newlib/libc/syscalls/sysstat.c index 3e0287ec8..0490df164 100644 --- a/newlib/libc/syscalls/sysstat.c +++ b/newlib/libc/syscalls/sysstat.c @@ -5,8 +5,7 @@ #include int -_DEFUN (stat, (file, pstat), - const char *file, +stat (const char *file, struct stat *pstat) { return _stat_r (_REENT, file, pstat); diff --git a/newlib/libc/syscalls/systimes.c b/newlib/libc/syscalls/systimes.c index cc30a3e38..ecd958348 100644 --- a/newlib/libc/syscalls/systimes.c +++ b/newlib/libc/syscalls/systimes.c @@ -4,8 +4,7 @@ #include clock_t -_DEFUN (times, (buf), - struct tms *buf) +times (struct tms *buf) { return _times_r (_REENT, buf); } diff --git a/newlib/libc/syscalls/sysunlink.c b/newlib/libc/syscalls/sysunlink.c index 06b4fc086..ecd052e7d 100644 --- a/newlib/libc/syscalls/sysunlink.c +++ b/newlib/libc/syscalls/sysunlink.c @@ -4,8 +4,7 @@ #include int -_DEFUN (unlink, (file), - const char *file) +unlink (const char *file) { return _unlink_r (_REENT, file); } diff --git a/newlib/libc/syscalls/syswait.c b/newlib/libc/syscalls/syswait.c index 070160342..25b5c4788 100644 --- a/newlib/libc/syscalls/syswait.c +++ b/newlib/libc/syscalls/syswait.c @@ -4,8 +4,7 @@ #include pid_t -_DEFUN (wait, (status), - int *status) +wait (int *status) { return _wait_r (_REENT, status); } diff --git a/newlib/libc/syscalls/syswrite.c b/newlib/libc/syscalls/syswrite.c index 35a1e8430..3b9b878f5 100644 --- a/newlib/libc/syscalls/syswrite.c +++ b/newlib/libc/syscalls/syswrite.c @@ -4,8 +4,7 @@ #include _READ_WRITE_RETURN_TYPE -_DEFUN (write, (fd, buf, cnt), - int fd, +write (int fd, const void *buf, size_t cnt) { diff --git a/newlib/libc/time/asctime.c b/newlib/libc/time/asctime.c index cbecd94f1..9aa26c3dc 100644 --- a/newlib/libc/time/asctime.c +++ b/newlib/libc/time/asctime.c @@ -48,8 +48,7 @@ ANSI C requires <>. #ifndef _REENT_ONLY char * -_DEFUN (asctime, (tim_p), - const struct tm *tim_p) +asctime (const struct tm *tim_p) { struct _reent *reent = _REENT; diff --git a/newlib/libc/time/asctime_r.c b/newlib/libc/time/asctime_r.c index 93e3fc27f..3e0864fc8 100644 --- a/newlib/libc/time/asctime_r.c +++ b/newlib/libc/time/asctime_r.c @@ -6,8 +6,7 @@ #include char * -_DEFUN (asctime_r, (tim_p, result), - const struct tm *__restrict tim_p, +asctime_r (const struct tm *__restrict tim_p, char *__restrict result) { static const char day_name[7][3] = { diff --git a/newlib/libc/time/ctime.c b/newlib/libc/time/ctime.c index f0592f469..58826a6d8 100644 --- a/newlib/libc/time/ctime.c +++ b/newlib/libc/time/ctime.c @@ -37,8 +37,7 @@ ANSI C requires <>. #ifndef _REENT_ONLY char * -_DEFUN (ctime, (tim_p), - const time_t * tim_p) +ctime (const time_t * tim_p) { return asctime (localtime (tim_p)); } diff --git a/newlib/libc/time/ctime_r.c b/newlib/libc/time/ctime_r.c index 4ab0ba77d..63aee3890 100644 --- a/newlib/libc/time/ctime_r.c +++ b/newlib/libc/time/ctime_r.c @@ -5,8 +5,7 @@ #include char * -_DEFUN (ctime_r, (tim_p, result), - const time_t * tim_p, +ctime_r (const time_t * tim_p, char * result) { diff --git a/newlib/libc/time/difftime.c b/newlib/libc/time/difftime.c index 363eb6482..52ab9d84f 100644 --- a/newlib/libc/time/difftime.c +++ b/newlib/libc/time/difftime.c @@ -30,8 +30,7 @@ in all implementations. #include double -_DEFUN (difftime, (tim1, tim2), - time_t tim1, +difftime (time_t tim1, time_t tim2) { return (double)(tim1 - tim2); diff --git a/newlib/libc/time/gmtime.c b/newlib/libc/time/gmtime.c index e74a16157..08e011129 100644 --- a/newlib/libc/time/gmtime.c +++ b/newlib/libc/time/gmtime.c @@ -50,8 +50,7 @@ ANSI C requires <>. #ifndef _REENT_ONLY struct tm * -_DEFUN (gmtime, (tim_p), - const time_t * tim_p) +gmtime (const time_t * tim_p) { struct _reent *reent = _REENT; diff --git a/newlib/libc/time/gmtime_r.c b/newlib/libc/time/gmtime_r.c index dcc5dd166..8bf9ee52d 100644 --- a/newlib/libc/time/gmtime_r.c +++ b/newlib/libc/time/gmtime_r.c @@ -46,8 +46,7 @@ #define YEARS_PER_ERA 400 struct tm * -_DEFUN (gmtime_r, (tim_p, res), - const time_t *__restrict tim_p, +gmtime_r (const time_t *__restrict tim_p, struct tm *__restrict res) { long days, rem; diff --git a/newlib/libc/time/lcltime.c b/newlib/libc/time/lcltime.c index 493df80d1..ded98c57a 100644 --- a/newlib/libc/time/lcltime.c +++ b/newlib/libc/time/lcltime.c @@ -43,8 +43,7 @@ ANSI C requires <>. #ifndef _REENT_ONLY struct tm * -_DEFUN (localtime, (tim_p), - const time_t * tim_p) +localtime (const time_t * tim_p) { struct _reent *reent = _REENT; diff --git a/newlib/libc/time/lcltime_r.c b/newlib/libc/time/lcltime_r.c index 3eba498c3..9b9126bcc 100644 --- a/newlib/libc/time/lcltime_r.c +++ b/newlib/libc/time/lcltime_r.c @@ -16,8 +16,7 @@ #include "local.h" struct tm * -_DEFUN (localtime_r, (tim_p, res), - const time_t *__restrict tim_p, +localtime_r (const time_t *__restrict tim_p, struct tm *__restrict res) { long offset; diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c index 1f0d9ba27..9bcef3268 100644 --- a/newlib/libc/time/mktime.c +++ b/newlib/libc/time/mktime.c @@ -62,8 +62,7 @@ static const int _DAYS_BEFORE_MONTH[12] = #define _DAYS_IN_YEAR(year) (_ISLEAP(year) ? 366 : 365) static void -_DEFUN(validate_structure, (tim_p), - struct tm *tim_p) +validate_structure (struct tm *tim_p) { div_t res; int days_in_feb = 28; @@ -149,8 +148,7 @@ _DEFUN(validate_structure, (tim_p), } time_t -_DEFUN(mktime, (tim_p), - struct tm *tim_p) +mktime (struct tm *tim_p) { time_t tim = 0; long days = 0; diff --git a/newlib/libc/time/strftime.c b/newlib/libc/time/strftime.c index 4ed84fb23..3e5e268bc 100644 --- a/newlib/libc/time/strftime.c +++ b/newlib/libc/time/strftime.c @@ -348,8 +348,7 @@ static const int dname_len[7] = -1, 0, or 1 as the adjustment to add to the year for the ISO week numbering used in "%g%G%V", avoiding overflow. */ static int -_DEFUN (iso_year_adjust, (tim_p), - const struct tm *tim_p) +iso_year_adjust (const struct tm *tim_p) { /* Account for fact that tm_year==0 is year 1900. */ int leap = isleap (tim_p->tm_year + (YEAR_BASE @@ -1431,8 +1430,7 @@ recurse: } size_t -_DEFUN (strftime, (s, maxsize, format, tim_p), - CHAR *__restrict s, +strftime (CHAR *__restrict s, size_t maxsize, const CHAR *__restrict format, const struct tm *__restrict tim_p) diff --git a/newlib/libc/time/time.c b/newlib/libc/time/time.c index e0c3a8e74..93e061b83 100644 --- a/newlib/libc/time/time.c +++ b/newlib/libc/time/time.c @@ -33,8 +33,7 @@ Supporting OS subroutine required: Some implementations require #include time_t -_DEFUN (time, (t), - time_t * t) +time (time_t * t) { struct timeval now; diff --git a/newlib/libc/time/tzcalc_limits.c b/newlib/libc/time/tzcalc_limits.c index fe785058d..e0ea6549c 100644 --- a/newlib/libc/time/tzcalc_limits.c +++ b/newlib/libc/time/tzcalc_limits.c @@ -11,8 +11,7 @@ #include "local.h" int -_DEFUN (__tzcalc_limits, (year), - int year) +__tzcalc_limits (int year) { int days, year_days, years; int i, j; diff --git a/newlib/libc/time/tzset_r.c b/newlib/libc/time/tzset_r.c index 211ddc8af..9e0cf834b 100644 --- a/newlib/libc/time/tzset_r.c +++ b/newlib/libc/time/tzset_r.c @@ -14,8 +14,7 @@ static char __tzname_dst[11]; static char *prev_tzenv = NULL; void -_DEFUN (_tzset_unlocked_r, (reent_ptr), - struct _reent *reent_ptr) +_tzset_unlocked_r (struct _reent *reent_ptr) { char *tzenv; unsigned short hh, mm, ss, m, w, d; @@ -184,8 +183,7 @@ _DEFUN (_tzset_unlocked_r, (reent_ptr), } void -_DEFUN (_tzset_r, (reent_ptr), - struct _reent *reent_ptr) +_tzset_r (struct _reent *reent_ptr) { TZ_LOCK; _tzset_unlocked_r (reent_ptr); diff --git a/newlib/libc/unix/basename.c b/newlib/libc/unix/basename.c index 3a9cc0c19..7a28ac51b 100644 --- a/newlib/libc/unix/basename.c +++ b/newlib/libc/unix/basename.c @@ -8,8 +8,7 @@ #include char* -_DEFUN (basename, (path), - char *path) +basename (char *path) { char *p; if( path == NULL || *path == '\0' ) diff --git a/newlib/libc/unix/dirname.c b/newlib/libc/unix/dirname.c index 164da7f78..7d8d6f024 100644 --- a/newlib/libc/unix/dirname.c +++ b/newlib/libc/unix/dirname.c @@ -9,8 +9,7 @@ #include char * -_DEFUN (dirname, (path), - char *path) +dirname (char *path) { char *p; if( path == NULL || *path == '\0' ) diff --git a/newlib/libc/unix/pread.c b/newlib/libc/unix/pread.c index 54efe29fe..61daac3b4 100644 --- a/newlib/libc/unix/pread.c +++ b/newlib/libc/unix/pread.c @@ -38,8 +38,7 @@ Supporting OS subroutine required: <>, <>. #include ssize_t -_DEFUN (_pread_r, (rptr, fd, buf, n, off), - struct _reent *rptr, +_pread_r (struct _reent *rptr, int fd, void *buf, size_t n, @@ -65,8 +64,7 @@ _DEFUN (_pread_r, (rptr, fd, buf, n, off), #ifndef _REENT_ONLY ssize_t -_DEFUN (pread, (fd, buf, n, off), - int fd, +pread (int fd, void *buf, size_t n, off_t off) diff --git a/newlib/libc/unix/pwrite.c b/newlib/libc/unix/pwrite.c index 939d186d4..60166c9f9 100644 --- a/newlib/libc/unix/pwrite.c +++ b/newlib/libc/unix/pwrite.c @@ -39,8 +39,7 @@ Supporting OS subroutine required: <>, <>. #include ssize_t -_DEFUN (_pwrite_r, (rptr, fd, buf, n, off), - struct _reent *rptr, +_pwrite_r (struct _reent *rptr, int fd, const void *buf, size_t n, @@ -66,8 +65,7 @@ _DEFUN (_pwrite_r, (rptr, fd, buf, n, off), #ifndef _REENT_ONLY ssize_t -_DEFUN (pwrite, (fd, buf, n, off), - int fd, +pwrite (int fd, const void *buf, size_t n, off_t off) diff --git a/newlib/libc/unix/ttyname.c b/newlib/libc/unix/ttyname.c index b36bb7408..a9a4a5bb4 100644 --- a/newlib/libc/unix/ttyname.c +++ b/newlib/libc/unix/ttyname.c @@ -41,8 +41,7 @@ static char ttyname_buf[TTYNAME_BUFSIZE] = _PATH_DEV; * ttyname() - POSIX 1003.1b 4.7.2 - Determine Terminal Device Name */ char * -_DEFUN( ttyname,(fd), - int fd) + ttyname (int fd) { register int fail; register char *ret=NULL; diff --git a/newlib/libc/unix/ttyname_r.c b/newlib/libc/unix/ttyname_r.c index 673e7f543..fd3b504a7 100644 --- a/newlib/libc/unix/ttyname_r.c +++ b/newlib/libc/unix/ttyname_r.c @@ -44,8 +44,7 @@ * ttyname_r() - POSIX 1003.1b 4.7.2 - Determine Terminal Device Name */ int -_DEFUN( ttyname_r,(fd, name, namesize), - int fd, + ttyname_r (int fd, char *name, size_t namesize) { diff --git a/newlib/libc/xdr/xdr.c b/newlib/libc/xdr/xdr.c index b60a89782..075093014 100644 --- a/newlib/libc/xdr/xdr.c +++ b/newlib/libc/xdr/xdr.c @@ -62,8 +62,7 @@ static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 }; * Not a filter, but a convenient utility nonetheless */ void -_DEFUN (xdr_free, (proc, objp), - xdrproc_t proc, +xdr_free (xdrproc_t proc, void * objp) { XDR x; @@ -86,8 +85,7 @@ xdr_void (void) * XDR integers */ bool_t -_DEFUN (xdr_int, (xdrs, ip), - XDR * xdrs, +xdr_int (XDR * xdrs, int * ip) { #if INT_MAX < LONG_MAX @@ -121,8 +119,7 @@ _DEFUN (xdr_int, (xdrs, ip), * XDR unsigned integers */ bool_t -_DEFUN (xdr_u_int, (xdrs, up), - XDR * xdrs, +xdr_u_int (XDR * xdrs, u_int * up) { #if UINT_MAX < ULONG_MAX @@ -156,8 +153,7 @@ _DEFUN (xdr_u_int, (xdrs, up), * XDR long integers */ bool_t -_DEFUN (xdr_long, (xdrs, lp), - XDR * xdrs, +xdr_long (XDR * xdrs, long * lp) { if ((xdrs->x_op == XDR_ENCODE) @@ -177,8 +173,7 @@ _DEFUN (xdr_long, (xdrs, lp), * XDR unsigned long integers */ bool_t -_DEFUN (xdr_u_long, (xdrs, ulp), - XDR * xdrs, +xdr_u_long (XDR * xdrs, u_long * ulp) { switch (xdrs->x_op) @@ -208,8 +203,7 @@ _DEFUN (xdr_u_long, (xdrs, ulp), * XDR 32-bit integers */ bool_t -_DEFUN (xdr_int32_t, (xdrs, int32_p), - XDR * xdrs, +xdr_int32_t (XDR * xdrs, int32_t * int32_p) { switch (xdrs->x_op) @@ -230,8 +224,7 @@ _DEFUN (xdr_int32_t, (xdrs, int32_p), * XDR unsigned 32-bit integers */ bool_t -_DEFUN (xdr_u_int32_t, (xdrs, u_int32_p), - XDR * xdrs, +xdr_u_int32_t (XDR * xdrs, u_int32_t * u_int32_p) { switch (xdrs->x_op) @@ -252,8 +245,7 @@ _DEFUN (xdr_u_int32_t, (xdrs, u_int32_p), * XDR unsigned 32-bit integers */ bool_t -_DEFUN (xdr_uint32_t, (xdrs, uint32_p), - XDR * xdrs, +xdr_uint32_t (XDR * xdrs, uint32_t * uint32_p) { switch (xdrs->x_op) @@ -274,8 +266,7 @@ _DEFUN (xdr_uint32_t, (xdrs, uint32_p), * XDR short integers */ bool_t -_DEFUN (xdr_short, (xdrs, sp), - XDR * xdrs, +xdr_short (XDR * xdrs, short * sp) { long l; @@ -302,8 +293,7 @@ _DEFUN (xdr_short, (xdrs, sp), * XDR unsigned short integers */ bool_t -_DEFUN (xdr_u_short, (xdrs, usp), - XDR * xdrs, +xdr_u_short (XDR * xdrs, u_short * usp) { long l; @@ -331,8 +321,7 @@ _DEFUN (xdr_u_short, (xdrs, usp), * XDR 16-bit integers */ bool_t -_DEFUN (xdr_int16_t, (xdrs, int16_p), - XDR * xdrs, +xdr_int16_t (XDR * xdrs, int16_t * int16_p) { int32_t t; @@ -359,8 +348,7 @@ _DEFUN (xdr_int16_t, (xdrs, int16_p), * XDR unsigned 16-bit integers */ bool_t -_DEFUN (xdr_u_int16_t, (xdrs, u_int16_p), - XDR * xdrs, +xdr_u_int16_t (XDR * xdrs, u_int16_t * u_int16_p) { uint32_t ut; @@ -387,8 +375,7 @@ _DEFUN (xdr_u_int16_t, (xdrs, u_int16_p), * XDR unsigned 16-bit integers */ bool_t -_DEFUN (xdr_uint16_t, (xdrs, uint16_p), - XDR * xdrs, +xdr_uint16_t (XDR * xdrs, uint16_t * uint16_p) { uint32_t ut; @@ -415,8 +402,7 @@ _DEFUN (xdr_uint16_t, (xdrs, uint16_p), * XDR 8-bit integers */ bool_t -_DEFUN (xdr_int8_t, (xdrs, int8_p), - XDR * xdrs, +xdr_int8_t (XDR * xdrs, int8_t * int8_p) { int32_t t; @@ -443,8 +429,7 @@ _DEFUN (xdr_int8_t, (xdrs, int8_p), * XDR unsigned 8-bit integers */ bool_t -_DEFUN (xdr_u_int8_t, (xdrs, u_int8_p), - XDR * xdrs, +xdr_u_int8_t (XDR * xdrs, u_int8_t * u_int8_p) { uint32_t ut; @@ -471,8 +456,7 @@ _DEFUN (xdr_u_int8_t, (xdrs, u_int8_p), * XDR unsigned 8-bit integers */ bool_t -_DEFUN (xdr_uint8_t, (xdrs, uint8_p), - XDR * xdrs, +xdr_uint8_t (XDR * xdrs, uint8_t * uint8_p) { uint32_t ut; @@ -501,8 +485,7 @@ _DEFUN (xdr_uint8_t, (xdrs, uint8_p), * XDR a char */ bool_t -_DEFUN (xdr_char, (xdrs, cp), - XDR * xdrs, +xdr_char (XDR * xdrs, char * cp) { int i; @@ -518,8 +501,7 @@ _DEFUN (xdr_char, (xdrs, cp), * XDR an unsigned char */ bool_t -_DEFUN (xdr_u_char, (xdrs, ucp), - XDR * xdrs, +xdr_u_char (XDR * xdrs, u_char * ucp) { u_int u; @@ -535,8 +517,7 @@ _DEFUN (xdr_u_char, (xdrs, ucp), * XDR booleans */ bool_t -_DEFUN (xdr_bool, (xdrs, bp), - XDR * xdrs, +xdr_bool (XDR * xdrs, bool_t * bp) { long lb; @@ -563,8 +544,7 @@ _DEFUN (xdr_bool, (xdrs, bp), * XDR enumerations */ bool_t -_DEFUN (xdr_enum, (xdrs, ep), - XDR * xdrs, +xdr_enum (XDR * xdrs, enum_t * ep) { enum sizecheck @@ -607,8 +587,7 @@ _DEFUN (xdr_enum, (xdrs, ep), * cp points to the opaque object and cnt gives the byte length. */ bool_t -_DEFUN (xdr_opaque, (xdrs, cp, cnt), - XDR * xdrs, +xdr_opaque (XDR * xdrs, caddr_t cp, u_int cnt) { @@ -656,8 +635,7 @@ _DEFUN (xdr_opaque, (xdrs, cp, cnt), * If *cpp is NULL maxsize bytes are allocated */ bool_t -_DEFUN (xdr_bytes, (xdrs, cpp, sizep, maxsize), - XDR * xdrs, +xdr_bytes (XDR * xdrs, char ** cpp, u_int * sizep, u_int maxsize) @@ -711,8 +689,7 @@ _DEFUN (xdr_bytes, (xdrs, cpp, sizep, maxsize), * Implemented here due to commonality of the object. */ bool_t -_DEFUN (xdr_netobj, (xdrs, np), - XDR * xdrs, +xdr_netobj (XDR * xdrs, struct netobj * np) { return (xdr_bytes (xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ)); @@ -734,8 +711,7 @@ _DEFUN (xdr_netobj, (xdrs, np), * dfault: default xdr routine */ bool_t -_DEFUN (xdr_union, (xdrs, dscmp, unp, choices, dfault), - XDR * xdrs, +xdr_union (XDR * xdrs, enum_t * dscmp, char * unp, const struct xdr_discrim * choices, @@ -783,8 +759,7 @@ _DEFUN (xdr_union, (xdrs, dscmp, unp, choices, dfault), * of the string as specified by a protocol. */ bool_t -_DEFUN (xdr_string, (xdrs, cpp, maxsize), - XDR * xdrs, +xdr_string (XDR * xdrs, char ** cpp, u_int maxsize) { @@ -861,8 +836,7 @@ _DEFUN (xdr_string, (xdrs, cpp, maxsize), * routines like clnt_call */ bool_t -_DEFUN (xdr_wrapstring, (xdrs, cpp), - XDR * xdrs, +xdr_wrapstring (XDR * xdrs, char ** cpp) { return xdr_string (xdrs, cpp, LASTUNSIGNED); @@ -882,8 +856,7 @@ _DEFUN (xdr_wrapstring, (xdrs, cpp), * XDR 64-bit integers */ bool_t -_DEFUN (xdr_int64_t, (xdrs, llp), - XDR * xdrs, +xdr_int64_t (XDR * xdrs, int64_t * llp) { int32_t t1, t2; @@ -913,8 +886,7 @@ _DEFUN (xdr_int64_t, (xdrs, llp), * XDR unsigned 64-bit integers */ bool_t -_DEFUN (xdr_u_int64_t, (xdrs, ullp), - XDR * xdrs, +xdr_u_int64_t (XDR * xdrs, u_int64_t * ullp) { uint32_t t1, t2; @@ -945,8 +917,7 @@ _DEFUN (xdr_u_int64_t, (xdrs, ullp), * XDR unsigned 64-bit integers */ bool_t -_DEFUN (xdr_uint64_t, (xdrs, ullp), - XDR * xdrs, +xdr_uint64_t (XDR * xdrs, uint64_t * ullp) { uint32_t t1, t2; @@ -978,8 +949,7 @@ _DEFUN (xdr_uint64_t, (xdrs, ullp), * XDR hypers */ bool_t -_DEFUN (xdr_hyper, (xdrs, llp), - XDR * xdrs, +xdr_hyper (XDR * xdrs, quad_t * llp) { /* @@ -994,8 +964,7 @@ _DEFUN (xdr_hyper, (xdrs, llp), * XDR unsigned hypers */ bool_t -_DEFUN (xdr_u_hyper, (xdrs, ullp), - XDR * xdrs, +xdr_u_hyper (XDR * xdrs, u_quad_t * ullp) { /* @@ -1010,8 +979,7 @@ _DEFUN (xdr_u_hyper, (xdrs, ullp), * XDR longlong_t's */ bool_t -_DEFUN (xdr_longlong_t, (xdrs, llp), - XDR * xdrs, +xdr_longlong_t (XDR * xdrs, quad_t * llp) { /* @@ -1026,8 +994,7 @@ _DEFUN (xdr_longlong_t, (xdrs, llp), * XDR u_longlong_t's */ bool_t -_DEFUN (xdr_u_longlong_t, (xdrs, ullp), - XDR * xdrs, +xdr_u_longlong_t (XDR * xdrs, u_quad_t *ullp) { /* diff --git a/newlib/libc/xdr/xdr_array.c b/newlib/libc/xdr/xdr_array.c index 9c9748725..77e7164d2 100644 --- a/newlib/libc/xdr/xdr_array.c +++ b/newlib/libc/xdr/xdr_array.c @@ -54,8 +54,7 @@ * xdr procedure to call to handle each element of the array. */ bool_t -_DEFUN (xdr_array, (xdrs, addrp, sizep, maxsize, elsize, elproc), - XDR * xdrs, +xdr_array (XDR * xdrs, caddr_t * addrp, u_int * sizep, u_int maxsize, @@ -138,8 +137,7 @@ _DEFUN (xdr_array, (xdrs, addrp, sizep, maxsize, elsize, elproc), * > xdr_elem: routine to XDR each element */ bool_t -_DEFUN (xdr_vector, (xdrs, basep, nelem, elemsize, xdr_elem), - XDR * xdrs, +xdr_vector (XDR * xdrs, char *basep, u_int nelem, u_int elemsize, diff --git a/newlib/libc/xdr/xdr_float.c b/newlib/libc/xdr/xdr_float.c index 691e92965..e19b1ef9e 100644 --- a/newlib/libc/xdr/xdr_float.c +++ b/newlib/libc/xdr/xdr_float.c @@ -59,8 +59,7 @@ #if defined(__IEEE_LITTLE_ENDIAN) || defined(__IEEE_BIG_ENDIAN) bool_t -_DEFUN (xdr_float, (xdrs, fp), - XDR * xdrs, +xdr_float (XDR * xdrs, float *fp) { switch (xdrs->x_op) @@ -80,8 +79,7 @@ _DEFUN (xdr_float, (xdrs, fp), #if !defined(_DOUBLE_IS_32BITS) bool_t -_DEFUN (xdr_double, (xdrs, dp), - XDR * xdrs, +xdr_double (XDR * xdrs, double *dp) { int32_t *i32p; diff --git a/newlib/libc/xdr/xdr_float_vax.c b/newlib/libc/xdr/xdr_float_vax.c index ed943480f..09c24b03e 100644 --- a/newlib/libc/xdr/xdr_float_vax.c +++ b/newlib/libc/xdr/xdr_float_vax.c @@ -81,8 +81,7 @@ static struct sgl_limits */ bool_t -_DEFUN (xdr_float, (xdrs, fp), - XDR * xdrs, +xdr_float (XDR * xdrs, float *fp) { struct ieee_single is; @@ -184,8 +183,7 @@ static struct dbl_limits */ bool_t -_DEFUN (xdr_double, (xdrs, dp), - XDR * xdrs, +xdr_double (XDR * xdrs, double *dp) { int32_t *lp; diff --git a/newlib/libc/xdr/xdr_mem.c b/newlib/libc/xdr/xdr_mem.c index 16d128774..3187ade74 100644 --- a/newlib/libc/xdr/xdr_mem.c +++ b/newlib/libc/xdr/xdr_mem.c @@ -101,8 +101,7 @@ static const struct xdr_ops xdrmem_ops_unaligned = { * memory buffer. */ void -_DEFUN (xdrmem_create, (xdrs, addr, size, op), - XDR * xdrs, +xdrmem_create (XDR * xdrs, caddr_t addr, u_int size, enum xdr_op op) @@ -116,14 +115,12 @@ _DEFUN (xdrmem_create, (xdrs, addr, size, op), } static void -_DEFUN (xdrmem_destroy, (xdrs), - XDR * xdrs) +xdrmem_destroy (XDR * xdrs) { } static bool_t -_DEFUN (xdrmem_getlong_aligned, (xdrs, lp), - XDR * xdrs, +xdrmem_getlong_aligned (XDR * xdrs, long *lp) { if (xdrs->x_handy < sizeof (int32_t)) @@ -135,8 +132,7 @@ _DEFUN (xdrmem_getlong_aligned, (xdrs, lp), } static bool_t -_DEFUN (xdrmem_putlong_aligned, (xdrs, lp), - XDR * xdrs, +xdrmem_putlong_aligned (XDR * xdrs, const long *lp) { if (xdrs->x_handy < sizeof (int32_t)) @@ -148,8 +144,7 @@ _DEFUN (xdrmem_putlong_aligned, (xdrs, lp), } static bool_t -_DEFUN (xdrmem_getlong_unaligned, (xdrs, lp), - XDR * xdrs, +xdrmem_getlong_unaligned (XDR * xdrs, long *lp) { u_int32_t l; @@ -164,8 +159,7 @@ _DEFUN (xdrmem_getlong_unaligned, (xdrs, lp), } static bool_t -_DEFUN (xdrmem_putlong_unaligned, (xdrs, lp), - XDR * xdrs, +xdrmem_putlong_unaligned (XDR * xdrs, const long *lp) { u_int32_t l; @@ -180,8 +174,7 @@ _DEFUN (xdrmem_putlong_unaligned, (xdrs, lp), } static bool_t -_DEFUN (xdrmem_getbytes, (xdrs, addr, len), - XDR * xdrs, +xdrmem_getbytes (XDR * xdrs, char *addr, u_int len) { @@ -194,8 +187,7 @@ _DEFUN (xdrmem_getbytes, (xdrs, addr, len), } static bool_t -_DEFUN (xdrmem_putbytes, (xdrs, addr, len), - XDR * xdrs, +xdrmem_putbytes (XDR * xdrs, const char *addr, u_int len) { @@ -208,16 +200,14 @@ _DEFUN (xdrmem_putbytes, (xdrs, addr, len), } static u_int -_DEFUN (xdrmem_getpos, (xdrs), - XDR * xdrs) +xdrmem_getpos (XDR * xdrs) { /* XXX w/64-bit pointers, u_int not enough! */ return (u_int) ((u_long) xdrs->x_private - (u_long) xdrs->x_base); } static bool_t -_DEFUN (xdrmem_setpos, (xdrs, pos), - XDR * xdrs, +xdrmem_setpos (XDR * xdrs, u_int pos) { caddr_t newaddr = xdrs->x_base + pos; @@ -236,8 +226,7 @@ _DEFUN (xdrmem_setpos, (xdrs, pos), } static int32_t * -_DEFUN (xdrmem_inline_aligned, (xdrs, len), - XDR * xdrs, +xdrmem_inline_aligned (XDR * xdrs, u_int len) { int32_t *buf = 0; @@ -252,16 +241,14 @@ _DEFUN (xdrmem_inline_aligned, (xdrs, len), } static int32_t * -_DEFUN (xdrmem_inline_unaligned, (xdrs, len), - XDR * xdrs, +xdrmem_inline_unaligned (XDR * xdrs, u_int len) { return (0); } static bool_t -_DEFUN (xdrmem_getint32_aligned, (xdrs, ip), - XDR *xdrs, +xdrmem_getint32_aligned (XDR *xdrs, int32_t *ip) { if (xdrs->x_handy < sizeof(int32_t)) @@ -273,8 +260,7 @@ _DEFUN (xdrmem_getint32_aligned, (xdrs, ip), } static bool_t -_DEFUN (xdrmem_putint32_aligned, (xdrs, ip), - XDR *xdrs, +xdrmem_putint32_aligned (XDR *xdrs, const int32_t *ip) { if (xdrs->x_handy < sizeof(int32_t)) @@ -286,8 +272,7 @@ _DEFUN (xdrmem_putint32_aligned, (xdrs, ip), } static bool_t -_DEFUN (xdrmem_getint32_unaligned, (xdrs, ip), - XDR *xdrs, +xdrmem_getint32_unaligned (XDR *xdrs, int32_t *ip) { u_int32_t l; @@ -302,8 +287,7 @@ _DEFUN (xdrmem_getint32_unaligned, (xdrs, ip), } static bool_t -_DEFUN (xdrmem_putint32_unaligned, (xdrs, ip), - XDR *xdrs, +xdrmem_putint32_unaligned (XDR *xdrs, const int32_t *ip) { u_int32_t l; diff --git a/newlib/libc/xdr/xdr_private.c b/newlib/libc/xdr/xdr_private.c index 64eac9d23..cad6b7e82 100644 --- a/newlib/libc/xdr/xdr_private.c +++ b/newlib/libc/xdr/xdr_private.c @@ -26,8 +26,7 @@ static xdr_vprintf_t xdr_vprintf = NULL; xdr_vprintf_t -_DEFUN (xdr_set_vprintf, (fnptr), - xdr_vprintf_t fnptr) +xdr_set_vprintf (xdr_vprintf_t fnptr) { xdr_vprintf_t tmp = xdr_vprintf; xdr_vprintf = fnptr; @@ -35,8 +34,7 @@ _DEFUN (xdr_set_vprintf, (fnptr), } void -_DEFUN (xdr_vwarnx, (format, ap), - const char *format, +xdr_vwarnx (const char *format, va_list ap) { if (xdr_vprintf) @@ -48,8 +46,7 @@ _DEFUN (xdr_vwarnx, (format, ap), } void -_DEFUN (xdr_warnx, (fmt), - const char *fmt, ...) +xdr_warnx (const char *fmt, ...) { va_list ap; va_start (ap, fmt); diff --git a/newlib/libc/xdr/xdr_rec.c b/newlib/libc/xdr/xdr_rec.c index 367c3cb64..f46a9a3fa 100644 --- a/newlib/libc/xdr/xdr_rec.c +++ b/newlib/libc/xdr/xdr_rec.c @@ -169,8 +169,7 @@ bool_t _EXFUN (__xdrrec_setnonblock, (XDR *, int)); * calls except that they take an opaque handle rather than an fd. */ void -_DEFUN (xdrrec_create, (xdrs, sendsize, recvsize, tcp_handle, readit, writeit), - XDR * xdrs, +xdrrec_create (XDR * xdrs, u_int sendsize, u_int recvsize, void *tcp_handle, @@ -261,8 +260,7 @@ _DEFUN (xdrrec_create, (xdrs, sendsize, recvsize, tcp_handle, readit, writeit), */ static bool_t -_DEFUN (xdrrec_getlong, (xdrs, lp), - XDR * xdrs, +xdrrec_getlong (XDR * xdrs, long *lp) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -288,8 +286,7 @@ _DEFUN (xdrrec_getlong, (xdrs, lp), } static bool_t -_DEFUN (xdrrec_putlong, (xdrs, lp), - XDR * xdrs, +xdrrec_putlong (XDR * xdrs, const long *lp) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -313,8 +310,7 @@ _DEFUN (xdrrec_putlong, (xdrs, lp), } static bool_t /* must manage buffers, fragments, and records */ -_DEFUN (xdrrec_getbytes, (xdrs, addr, len), - XDR * xdrs, +xdrrec_getbytes (XDR * xdrs, char *addr, u_int len) { @@ -343,8 +339,7 @@ _DEFUN (xdrrec_getbytes, (xdrs, addr, len), } static bool_t -_DEFUN (xdrrec_putbytes, (xdrs, addr, len), - XDR * xdrs, +xdrrec_putbytes (XDR * xdrs, const char *addr, u_int len) { @@ -371,8 +366,7 @@ _DEFUN (xdrrec_putbytes, (xdrs, addr, len), } static u_int -_DEFUN (xdrrec_getpos, (xdrs), - XDR * xdrs) +xdrrec_getpos (XDR * xdrs) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; off_t pos; @@ -398,8 +392,7 @@ _DEFUN (xdrrec_getpos, (xdrs), } static bool_t -_DEFUN (xdrrec_setpos, (xdrs, pos), - XDR * xdrs, +xdrrec_setpos (XDR * xdrs, u_int pos) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -439,8 +432,7 @@ _DEFUN (xdrrec_setpos, (xdrs, pos), } static int32_t * -_DEFUN (xdrrec_inline, (xdrs, len), - XDR * xdrs, +xdrrec_inline (XDR * xdrs, u_int len) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -482,8 +474,7 @@ _DEFUN (xdrrec_inline, (xdrs, len), } static void -_DEFUN (xdrrec_destroy, (xdrs), - XDR * xdrs) +xdrrec_destroy (XDR * xdrs) { RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private; @@ -493,8 +484,7 @@ _DEFUN (xdrrec_destroy, (xdrs), } static bool_t -_DEFUN (xdrrec_getint32, (xdrs, ip), - XDR *xdrs, +xdrrec_getint32 (XDR *xdrs, int32_t *ip) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -520,8 +510,7 @@ _DEFUN (xdrrec_getint32, (xdrs, ip), } static bool_t -_DEFUN (xdrrec_putint32, (xdrs, ip), - XDR *xdrs, +xdrrec_putint32 (XDR *xdrs, const int32_t *ip) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -553,8 +542,7 @@ _DEFUN (xdrrec_putint32, (xdrs, ip), * this procedure to guarantee proper record alignment. */ bool_t -_DEFUN (xdrrec_skiprecord, (xdrs), - XDR * xdrs) +xdrrec_skiprecord (XDR * xdrs) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); enum xprt_stat xstat; @@ -592,8 +580,7 @@ _DEFUN (xdrrec_skiprecord, (xdrs), * after consuming the rest of the current record. */ bool_t -_DEFUN (xdrrec_eof, (xdrs), - XDR * xdrs) +xdrrec_eof (XDR * xdrs) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -617,8 +604,7 @@ _DEFUN (xdrrec_eof, (xdrs), * pipelined procedure calls.) TRUE => immmediate flush to tcp connection. */ bool_t -_DEFUN (xdrrec_endofrecord, (xdrs, sendnow), - XDR * xdrs, +xdrrec_endofrecord (XDR * xdrs, bool_t sendnow) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -644,8 +630,7 @@ _DEFUN (xdrrec_endofrecord, (xdrs, sendnow), * Return true if a record is available in the buffer, false if not. */ bool_t -_DEFUN (__xdrrec_getrec, (xdrs, statp, expectdata), - XDR * xdrs, +__xdrrec_getrec (XDR * xdrs, enum xprt_stat * statp, bool_t expectdata) { @@ -737,8 +722,7 @@ _DEFUN (__xdrrec_getrec, (xdrs, statp, expectdata), } bool_t -_DEFUN (__xdrrec_setnonblock, (xdrs, maxrec), - XDR * xdrs, +__xdrrec_setnonblock (XDR * xdrs, int maxrec) { RECSTREAM *rstrm = (RECSTREAM *) (xdrs->x_private); @@ -754,8 +738,7 @@ _DEFUN (__xdrrec_setnonblock, (xdrs, maxrec), * Internal useful routines */ static bool_t -_DEFUN (flush_out, (rstrm, eor), - RECSTREAM * rstrm, +flush_out (RECSTREAM * rstrm, bool_t eor) { u_int32_t eormask = (eor == TRUE) ? LAST_FRAG : 0; @@ -775,8 +758,7 @@ _DEFUN (flush_out, (rstrm, eor), } static bool_t /* knows nothing about records! Only about input buffers */ -_DEFUN (fill_input_buf, (rstrm), - RECSTREAM * rstrm) +fill_input_buf (RECSTREAM * rstrm) { char *where; u_int32_t i; @@ -798,8 +780,7 @@ _DEFUN (fill_input_buf, (rstrm), } static bool_t /* knows nothing about records! Only about input buffers */ -_DEFUN (get_input_bytes, (rstrm, addr, len), - RECSTREAM * rstrm, +get_input_bytes (RECSTREAM * rstrm, char *addr, size_t len) { @@ -834,8 +815,7 @@ _DEFUN (get_input_bytes, (rstrm, addr, len), } static bool_t /* next two bytes of the input stream are treated as a header */ -_DEFUN (set_input_fragment, (rstrm), - RECSTREAM * rstrm) +set_input_fragment (RECSTREAM * rstrm) { u_int32_t header; @@ -860,8 +840,7 @@ _DEFUN (set_input_fragment, (rstrm), } static bool_t /* consumes input bytes; knows nothing about records! */ -_DEFUN (skip_input_bytes, (rstrm, cnt), - RECSTREAM * rstrm, +skip_input_bytes (RECSTREAM * rstrm, long cnt) { size_t current; @@ -884,8 +863,7 @@ _DEFUN (skip_input_bytes, (rstrm, cnt), } static u_int -_DEFUN (fix_buf_size, (s), - u_int s) +fix_buf_size (u_int s) { if (s < 100) @@ -897,8 +875,7 @@ _DEFUN (fix_buf_size, (s), * Reallocate the input buffer for a non-block stream. */ static bool_t -_DEFUN (realloc_stream, (rstrm, size), - RECSTREAM * rstrm, +realloc_stream (RECSTREAM * rstrm, int size) { ptrdiff_t diff; diff --git a/newlib/libc/xdr/xdr_reference.c b/newlib/libc/xdr/xdr_reference.c index 7a5f1d851..eba4b8355 100644 --- a/newlib/libc/xdr/xdr_reference.c +++ b/newlib/libc/xdr/xdr_reference.c @@ -56,8 +56,7 @@ * proc is the routine to handle the referenced structure. */ bool_t -_DEFUN (xdr_reference, (xdrs, pp, size, proc), - XDR * xdrs, +xdr_reference (XDR * xdrs, caddr_t * pp, u_int size, xdrproc_t proc) @@ -117,8 +116,7 @@ _DEFUN (xdr_reference, (xdrs, pp, size, proc), * */ bool_t -_DEFUN (xdr_pointer, (xdrs, objpp, obj_size, xdr_obj), - XDR * xdrs, +xdr_pointer (XDR * xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj) diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c index 427917640..bf02cf5e7 100644 --- a/newlib/libc/xdr/xdr_sizeof.c +++ b/newlib/libc/xdr/xdr_sizeof.c @@ -43,8 +43,7 @@ /* ARGSUSED */ static bool_t -_DEFUN (x_putlong, (xdrs, longp), - XDR * xdrs, +x_putlong (XDR * xdrs, const long *longp) { xdrs->x_handy += BYTES_PER_XDR_UNIT; @@ -53,8 +52,7 @@ _DEFUN (x_putlong, (xdrs, longp), /* ARGSUSED */ static bool_t -_DEFUN (x_putbytes, (xdrs, bp, len), - XDR * xdrs, +x_putbytes (XDR * xdrs, const char *bp, u_int len) { @@ -63,16 +61,14 @@ _DEFUN (x_putbytes, (xdrs, bp, len), } static u_int -_DEFUN (x_getpostn, (xdrs), - XDR * xdrs) +x_getpostn (XDR * xdrs) { return xdrs->x_handy; } /* ARGSUSED */ static bool_t -_DEFUN (x_setpostn, (xdrs, pos), - XDR * xdrs, +x_setpostn (XDR * xdrs, u_int pos) { /* This is not allowed */ @@ -80,8 +76,7 @@ _DEFUN (x_setpostn, (xdrs, pos), } static int32_t * -_DEFUN (x_inline, (xdrs, len), - XDR * xdrs, +x_inline (XDR * xdrs, u_int len) { if (len == 0) @@ -118,8 +113,7 @@ harmless (void) } static void -_DEFUN (x_destroy, (xdrs), - XDR * xdrs) +x_destroy (XDR * xdrs) { xdrs->x_handy = 0; xdrs->x_base = 0; @@ -132,8 +126,7 @@ _DEFUN (x_destroy, (xdrs), } static bool_t -_DEFUN (x_putint32, (xdrs, int32p), - XDR *xdrs, +x_putint32 (XDR *xdrs, const int32_t *int32p) { xdrs->x_handy += BYTES_PER_XDR_UNIT; @@ -142,8 +135,7 @@ _DEFUN (x_putint32, (xdrs, int32p), unsigned long -_DEFUN (xdr_sizeof, (func, data), - xdrproc_t func, +xdr_sizeof (xdrproc_t func, void *data) { XDR x; diff --git a/newlib/libc/xdr/xdr_stdio.c b/newlib/libc/xdr/xdr_stdio.c index e6513e5d0..784ac6c8b 100644 --- a/newlib/libc/xdr/xdr_stdio.c +++ b/newlib/libc/xdr/xdr_stdio.c @@ -83,8 +83,7 @@ static const struct xdr_ops xdrstdio_ops = { * Operation flag is set to op. */ void -_DEFUN (xdrstdio_create, (xdrs, file, op), - XDR * xdrs, +xdrstdio_create (XDR * xdrs, FILE * file, enum xdr_op op) { @@ -100,16 +99,14 @@ _DEFUN (xdrstdio_create, (xdrs, file, op), * Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create. */ static void -_DEFUN (xdrstdio_destroy, (xdrs), - XDR * xdrs) +xdrstdio_destroy (XDR * xdrs) { (void) fflush ((FILE *) xdrs->x_private); /* XXX: should we close the file ?? */ } static bool_t -_DEFUN (xdrstdio_getlong, (xdrs, lp), - XDR * xdrs, +xdrstdio_getlong (XDR * xdrs, long *lp) { u_int32_t temp; @@ -121,8 +118,7 @@ _DEFUN (xdrstdio_getlong, (xdrs, lp), } static bool_t -_DEFUN (xdrstdio_putlong, (xdrs, lp), - XDR * xdrs, +xdrstdio_putlong (XDR * xdrs, const long *lp) { u_int32_t temp = htonl ((u_int32_t) * lp); @@ -133,8 +129,7 @@ _DEFUN (xdrstdio_putlong, (xdrs, lp), } static bool_t -_DEFUN (xdrstdio_getbytes, (xdrs, addr, len), - XDR * xdrs, +xdrstdio_getbytes (XDR * xdrs, char *addr, u_int len) { @@ -145,8 +140,7 @@ _DEFUN (xdrstdio_getbytes, (xdrs, addr, len), } static bool_t -_DEFUN (xdrstdio_putbytes, (xdrs, addr, len), - XDR * xdrs, +xdrstdio_putbytes (XDR * xdrs, const char *addr, u_int len) { @@ -157,15 +151,13 @@ _DEFUN (xdrstdio_putbytes, (xdrs, addr, len), } static u_int -_DEFUN (xdrstdio_getpos, (xdrs), - XDR * xdrs) +xdrstdio_getpos (XDR * xdrs) { return ((u_int) ftell ((FILE *) xdrs->x_private)); } static bool_t -_DEFUN (xdrstdio_setpos, (xdrs, pos), - XDR * xdrs, +xdrstdio_setpos (XDR * xdrs, u_int pos) { return ((fseek ((FILE *) xdrs->x_private, (long) pos, 0) < 0) ? @@ -174,8 +166,7 @@ _DEFUN (xdrstdio_setpos, (xdrs, pos), /* ARGSUSED */ static int32_t * -_DEFUN (xdrstdio_inline, (xdrs, len), - XDR * xdrs, +xdrstdio_inline (XDR * xdrs, u_int len) { /* @@ -191,8 +182,7 @@ _DEFUN (xdrstdio_inline, (xdrs, len), } static bool_t -_DEFUN (xdrstdio_getint32, (xdrs, ip), - XDR *xdrs, +xdrstdio_getint32 (XDR *xdrs, int32_t *ip) { int32_t temp; @@ -204,8 +194,7 @@ _DEFUN (xdrstdio_getint32, (xdrs, ip), } static bool_t -_DEFUN (xdrstdio_putint32, (xdrs, ip), - XDR *xdrs, +xdrstdio_putint32 (XDR *xdrs, const int32_t *ip) { int32_t temp = htonl (*ip); diff --git a/newlib/libm/common/s_isinf.c b/newlib/libm/common/s_isinf.c index fe18e2aba..55fd5c214 100644 --- a/newlib/libm/common/s_isinf.c +++ b/newlib/libm/common/s_isinf.c @@ -16,8 +16,7 @@ #undef isinf int -_DEFUN (isinf, (x), - double x) +isinf (double x) { __int32_t hx,lx; EXTRACT_WORDS(hx,lx,x); diff --git a/newlib/libm/common/s_isinfd.c b/newlib/libm/common/s_isinfd.c index 5a2b04d4e..771ce44e4 100644 --- a/newlib/libm/common/s_isinfd.c +++ b/newlib/libm/common/s_isinfd.c @@ -9,8 +9,7 @@ #ifndef _DOUBLE_IS_32BITS int -_DEFUN (__isinfd, (x), - double x) +__isinfd (double x) { __int32_t hx,lx; EXTRACT_WORDS(hx,lx,x); diff --git a/newlib/libm/common/s_isnand.c b/newlib/libm/common/s_isnand.c index 5f2c06467..31a3272c5 100644 --- a/newlib/libm/common/s_isnand.c +++ b/newlib/libm/common/s_isnand.c @@ -93,8 +93,7 @@ QUICKREF #ifndef _DOUBLE_IS_32BITS int -_DEFUN (__isnand, (x), - double x) +__isnand (double x) { __int32_t hx,lx; EXTRACT_WORDS(hx,lx,x); diff --git a/newlib/libm/common/sf_isinf.c b/newlib/libm/common/sf_isinf.c index 5b57a346f..75e90c9fd 100644 --- a/newlib/libm/common/sf_isinf.c +++ b/newlib/libm/common/sf_isinf.c @@ -13,8 +13,7 @@ #undef isinff int -_DEFUN (isinff, (x), - float x) +isinff (float x) { __int32_t ix; GET_FLOAT_WORD(ix,x); @@ -27,8 +26,7 @@ _DEFUN (isinff, (x), #undef isinf int -_DEFUN (isinf, (x), - double x) +isinf (double x) { return isinff((float) x); } diff --git a/newlib/libm/common/sf_isinff.c b/newlib/libm/common/sf_isinff.c index 9d0e742e5..cd7b2cfd3 100644 --- a/newlib/libm/common/sf_isinff.c +++ b/newlib/libm/common/sf_isinff.c @@ -6,8 +6,7 @@ #include "fdlibm.h" int -_DEFUN (__isinff, (x), - float x) +__isinff (float x) { __int32_t ix; GET_FLOAT_WORD(ix,x); @@ -18,8 +17,7 @@ _DEFUN (__isinff, (x), #ifdef _DOUBLE_IS_32BITS int -_DEFUN (__isinfd, (x), - double x) +__isinfd (double x) { return __isinff((float) x); } diff --git a/newlib/libm/common/sf_isnan.c b/newlib/libm/common/sf_isnan.c index 9c813fc24..5c611d67e 100644 --- a/newlib/libm/common/sf_isnan.c +++ b/newlib/libm/common/sf_isnan.c @@ -24,8 +24,7 @@ #undef isnanf int -_DEFUN (isnanf, (x), - float x) +isnanf (float x) { __int32_t ix; GET_FLOAT_WORD(ix,x); @@ -38,8 +37,7 @@ _DEFUN (isnanf, (x), #undef isnan int -_DEFUN (isnan, (x), - double x) +isnan (double x) { return isnanf((float) x); } diff --git a/newlib/libm/common/sf_isnanf.c b/newlib/libm/common/sf_isnanf.c index 0b0d9bbaf..0831da664 100644 --- a/newlib/libm/common/sf_isnanf.c +++ b/newlib/libm/common/sf_isnanf.c @@ -16,8 +16,7 @@ #include "fdlibm.h" int -_DEFUN (__isnanf, (x), - float x) +__isnanf (float x) { __int32_t ix; GET_FLOAT_WORD(ix,x); @@ -28,8 +27,7 @@ _DEFUN (__isnanf, (x), #ifdef _DOUBLE_IS_32BITS int -_DEFUN (__isnand, (x), - double x) +__isnand (double x) { return __isnanf((float) x); } diff --git a/newlib/libm/machine/i386/f_math.h b/newlib/libm/machine/i386/f_math.h index bd44b1e92..833e5cff9 100644 --- a/newlib/libm/machine/i386/f_math.h +++ b/newlib/libm/machine/i386/f_math.h @@ -7,8 +7,7 @@ __inline__ static int -_DEFUN (check_finite, (x), - double x) +check_finite (double x) { __int32_t hx; GET_HIGH_WORD(hx,x); @@ -18,8 +17,7 @@ _DEFUN (check_finite, (x), __inline__ static int -_DEFUN (check_finitef, (x), - float x) +check_finitef (float x) { __int32_t ix; GET_FLOAT_WORD(ix,x); diff --git a/newlib/libm/mathfp/s_acos.c b/newlib/libm/mathfp/s_acos.c index d66a5cd26..d0318e1c7 100644 --- a/newlib/libm/mathfp/s_acos.c +++ b/newlib/libm/mathfp/s_acos.c @@ -75,8 +75,7 @@ MATHREF #ifndef _DOUBLE_IS_32BITS double -_DEFUN (acos, (double), - double x) +acos (double x) { return (asine (x, 1)); } diff --git a/newlib/libm/mathfp/s_asin.c b/newlib/libm/mathfp/s_asin.c index 477bbf5cb..b20f0a3f2 100644 --- a/newlib/libm/mathfp/s_asin.c +++ b/newlib/libm/mathfp/s_asin.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (asin, (double), - double x) +asin (double x) { return (asine (x, 0)); } diff --git a/newlib/libm/mathfp/s_asine.c b/newlib/libm/mathfp/s_asine.c index 28cfaf7a6..9e9073d1f 100644 --- a/newlib/libm/mathfp/s_asine.c +++ b/newlib/libm/mathfp/s_asine.c @@ -89,8 +89,7 @@ static const double a[] = { 0.0, 0.78539816339744830962 }; static const double b[] = { 1.57079632679489661923, 0.78539816339744830962 }; double -_DEFUN (asine, (double, int), - double x, +asine (double x, int acosine) { int flag, i; diff --git a/newlib/libm/mathfp/s_atan.c b/newlib/libm/mathfp/s_atan.c index 0dd339474..53551e56e 100644 --- a/newlib/libm/mathfp/s_atan.c +++ b/newlib/libm/mathfp/s_atan.c @@ -54,8 +54,7 @@ PORTABILITY #ifndef _DOUBLE_IS_32BITS double -_DEFUN (atan, (double), - double x) +atan (double x) { switch (numtest (x)) { diff --git a/newlib/libm/mathfp/s_atan2.c b/newlib/libm/mathfp/s_atan2.c index 9f71ed9c8..395253905 100644 --- a/newlib/libm/mathfp/s_atan2.c +++ b/newlib/libm/mathfp/s_atan2.c @@ -69,8 +69,7 @@ PORTABILITY #ifndef _DOUBLE_IS_32BITS double -_DEFUN (atan2, (double, double), - double v, +atan2 (double v, double u) { return (atangent (0.0, v, u, 1)); diff --git a/newlib/libm/mathfp/s_atangent.c b/newlib/libm/mathfp/s_atangent.c index 1df39ac50..02675b522 100644 --- a/newlib/libm/mathfp/s_atangent.c +++ b/newlib/libm/mathfp/s_atangent.c @@ -85,8 +85,7 @@ static const double p[] = { -0.13688768894191926929e+2, -0.83758299368150059274 }; double -_DEFUN (atangent, (double, double, double, int), - double x, +atangent (double x, double v, double u, int arctan2) diff --git a/newlib/libm/mathfp/s_ceil.c b/newlib/libm/mathfp/s_ceil.c index c6ecbe323..29e4a059d 100644 --- a/newlib/libm/mathfp/s_ceil.c +++ b/newlib/libm/mathfp/s_ceil.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (ceil, (double), - double x) +ceil (double x) { double f, y; diff --git a/newlib/libm/mathfp/s_cos.c b/newlib/libm/mathfp/s_cos.c index 6f63a404e..7c4029f9d 100644 --- a/newlib/libm/mathfp/s_cos.c +++ b/newlib/libm/mathfp/s_cos.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (cos, (double), - double x) +cos (double x) { return (sine (x, 1)); } diff --git a/newlib/libm/mathfp/s_cosh.c b/newlib/libm/mathfp/s_cosh.c index 552e5ee5c..bfe665069 100644 --- a/newlib/libm/mathfp/s_cosh.c +++ b/newlib/libm/mathfp/s_cosh.c @@ -63,8 +63,7 @@ QUICKREF #ifndef _DOUBLE_IS_32BITS double -_DEFUN (cosh, (double), - double x) +cosh (double x) { return (sineh (x, 1)); } diff --git a/newlib/libm/mathfp/s_exp.c b/newlib/libm/mathfp/s_exp.c index 362b8b079..bb1beffd7 100644 --- a/newlib/libm/mathfp/s_exp.c +++ b/newlib/libm/mathfp/s_exp.c @@ -70,8 +70,7 @@ static const double q[] = { 0.5, 0.56817302698551221787e-1, 0.75104028399870046114e-6 }; double -_DEFUN (exp, (double), - double x) +exp (double x) { int N; double g, z, R, P, Q; diff --git a/newlib/libm/mathfp/s_exp2.c b/newlib/libm/mathfp/s_exp2.c index 3bcf7ca2c..c913b3a22 100644 --- a/newlib/libm/mathfp/s_exp2.c +++ b/newlib/libm/mathfp/s_exp2.c @@ -9,8 +9,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (exp2, (double), - double x) +exp2 (double x) { return pow(2.0, x); } diff --git a/newlib/libm/mathfp/s_fabs.c b/newlib/libm/mathfp/s_fabs.c index 3d6d83889..10e89ef06 100644 --- a/newlib/libm/mathfp/s_fabs.c +++ b/newlib/libm/mathfp/s_fabs.c @@ -51,8 +51,7 @@ PORTABILITY #ifndef _DOUBLE_IS_32BITS double -_DEFUN (fabs, (double), - double x) +fabs (double x) { switch (numtest (x)) { diff --git a/newlib/libm/mathfp/s_floor.c b/newlib/libm/mathfp/s_floor.c index ebdb9a7b3..e407ea237 100644 --- a/newlib/libm/mathfp/s_floor.c +++ b/newlib/libm/mathfp/s_floor.c @@ -62,8 +62,7 @@ PORTABILITY #ifndef _DOUBLE_IS_32BITS double -_DEFUN (floor, (double), - double x) +floor (double x) { double f, y; diff --git a/newlib/libm/mathfp/s_ldexp.c b/newlib/libm/mathfp/s_ldexp.c index 472093071..6a844e0fe 100644 --- a/newlib/libm/mathfp/s_ldexp.c +++ b/newlib/libm/mathfp/s_ldexp.c @@ -63,8 +63,7 @@ PORTABILITY #define DOUBLE_EXP_OFFS 1023 double -_DEFUN (ldexp, (double, int), - double d, +ldexp (double d, int e) { int exp; diff --git a/newlib/libm/mathfp/s_log.c b/newlib/libm/mathfp/s_log.c index 27b959831..e1d33e10b 100644 --- a/newlib/libm/mathfp/s_log.c +++ b/newlib/libm/mathfp/s_log.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (log, (double), - double x) +log (double x) { return (logarithm (x, 0)); } diff --git a/newlib/libm/mathfp/s_log10.c b/newlib/libm/mathfp/s_log10.c index 9491cff76..d7fed2cfa 100644 --- a/newlib/libm/mathfp/s_log10.c +++ b/newlib/libm/mathfp/s_log10.c @@ -51,8 +51,7 @@ PORTABILITY #ifndef _DOUBLE_IS_32BITS double -_DEFUN (log10, (double), - double x) +log10 (double x) { return (logarithm (x, 1)); } diff --git a/newlib/libm/mathfp/s_logarithm.c b/newlib/libm/mathfp/s_logarithm.c index d14bf2eb4..e8c24200a 100644 --- a/newlib/libm/mathfp/s_logarithm.c +++ b/newlib/libm/mathfp/s_logarithm.c @@ -79,8 +79,7 @@ static const double C2 = 1.428606820309417232e-06; static const double C3 = 0.43429448190325182765; double -_DEFUN (logarithm, (double, int), - double x, +logarithm (double x, int ten) { int N; diff --git a/newlib/libm/mathfp/s_numtest.c b/newlib/libm/mathfp/s_numtest.c index b41bb87f4..a01045fa3 100644 --- a/newlib/libm/mathfp/s_numtest.c +++ b/newlib/libm/mathfp/s_numtest.c @@ -25,8 +25,7 @@ #ifndef _DOUBLE_IS_32BITS int -_DEFUN (numtest, (double), - double x) +numtest (double x) { __uint32_t hx, lx; int exp; diff --git a/newlib/libm/mathfp/s_sin.c b/newlib/libm/mathfp/s_sin.c index 2051304e0..c394f8548 100644 --- a/newlib/libm/mathfp/s_sin.c +++ b/newlib/libm/mathfp/s_sin.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (sin, (double), - double x) +sin (double x) { return (sine (x, 0)); } diff --git a/newlib/libm/mathfp/s_sincos.c b/newlib/libm/mathfp/s_sincos.c index 8fc65ac20..8694dc64d 100644 --- a/newlib/libm/mathfp/s_sincos.c +++ b/newlib/libm/mathfp/s_sincos.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS void -_DEFUN (sincos, (x, sinx, cosx), - double x, +sincos (double x, double *sinx, double *cosx) { diff --git a/newlib/libm/mathfp/s_sine.c b/newlib/libm/mathfp/s_sine.c index d5e4469a0..7a5f4ddd3 100644 --- a/newlib/libm/mathfp/s_sine.c +++ b/newlib/libm/mathfp/s_sine.c @@ -72,8 +72,7 @@ static const double r[] = { -0.16666666666666665052, 0.27204790957888846175e-14 }; double -_DEFUN (sine, (double, int), - double x, +sine (double x, int cosine) { int sgn, N; diff --git a/newlib/libm/mathfp/s_sineh.c b/newlib/libm/mathfp/s_sineh.c index 457003ff8..1ca08b84c 100644 --- a/newlib/libm/mathfp/s_sineh.c +++ b/newlib/libm/mathfp/s_sineh.c @@ -94,8 +94,7 @@ static const double INV_V2 = 0.24999308500451499336; static const double V_OVER2_MINUS1 = 0.13830277879601902638e-4; double -_DEFUN (sineh, (double, int), - double x, +sineh (double x, int cosineh) { double y, f, P, Q, R, res, z, w; diff --git a/newlib/libm/mathfp/s_sinf.c b/newlib/libm/mathfp/s_sinf.c index b738a49b9..3e29fedf3 100644 --- a/newlib/libm/mathfp/s_sinf.c +++ b/newlib/libm/mathfp/s_sinf.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (sinf, (float), - float x) +sinf (float x) { return (sinef (x, 0)); } diff --git a/newlib/libm/mathfp/s_sinh.c b/newlib/libm/mathfp/s_sinh.c index c600ee0da..55b339bfb 100644 --- a/newlib/libm/mathfp/s_sinh.c +++ b/newlib/libm/mathfp/s_sinh.c @@ -20,8 +20,7 @@ #ifndef _DOUBLE_IS_32BITS double -_DEFUN (sinh, (double), - double x) +sinh (double x) { return (sineh (x, 0)); } diff --git a/newlib/libm/mathfp/s_sqrt.c b/newlib/libm/mathfp/s_sqrt.c index af3b1d85e..d5df47eec 100644 --- a/newlib/libm/mathfp/s_sqrt.c +++ b/newlib/libm/mathfp/s_sqrt.c @@ -62,8 +62,7 @@ PORTABILITY #ifndef _DOUBLE_IS_32BITS double -_DEFUN (sqrt, (double), - double x) +sqrt (double x) { double f, y; int exp, i, odd; diff --git a/newlib/libm/mathfp/s_tan.c b/newlib/libm/mathfp/s_tan.c index 3910a4c49..f3bfb6988 100644 --- a/newlib/libm/mathfp/s_tan.c +++ b/newlib/libm/mathfp/s_tan.c @@ -63,8 +63,7 @@ static const double q[] = { -0.46671683339755294240, 0.49819433993786512270e-6 }; double -_DEFUN (tan, (double), - double x) +tan (double x) { double y, f, g, XN, xnum, xden, res; int N; diff --git a/newlib/libm/mathfp/s_tanh.c b/newlib/libm/mathfp/s_tanh.c index 7c92c1750..ed036645b 100644 --- a/newlib/libm/mathfp/s_tanh.c +++ b/newlib/libm/mathfp/s_tanh.c @@ -69,8 +69,7 @@ static const double q[] = { 0.48402357071988688686e+4, 0.11274474380534949335e+3 }; double -_DEFUN (tanh, (double), - double x) +tanh (double x) { double f, res, g, P, Q, R; diff --git a/newlib/libm/mathfp/sf_acos.c b/newlib/libm/mathfp/sf_acos.c index 6bef98041..8631f3b97 100644 --- a/newlib/libm/mathfp/sf_acos.c +++ b/newlib/libm/mathfp/sf_acos.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (acosf, (float), - float x) +acosf (float x) { return (asinef (x, 1)); } diff --git a/newlib/libm/mathfp/sf_asin.c b/newlib/libm/mathfp/sf_asin.c index 92c33fda3..391ac304e 100644 --- a/newlib/libm/mathfp/sf_asin.c +++ b/newlib/libm/mathfp/sf_asin.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (asinf, (float), - float x) +asinf (float x) { return (asinef (x, 0)); } diff --git a/newlib/libm/mathfp/sf_asine.c b/newlib/libm/mathfp/sf_asine.c index a74778034..118479678 100644 --- a/newlib/libm/mathfp/sf_asine.c +++ b/newlib/libm/mathfp/sf_asine.c @@ -30,8 +30,7 @@ static const float a[] = { 0.0, 0.785398163 }; static const float b[] = { 1.570796326, 0.785398163 }; float -_DEFUN (asinef, (float, int), - float x, +asinef (float x, int acosine) { int flag, i; diff --git a/newlib/libm/mathfp/sf_atan.c b/newlib/libm/mathfp/sf_atan.c index f0f522076..03da2a6b0 100644 --- a/newlib/libm/mathfp/sf_atan.c +++ b/newlib/libm/mathfp/sf_atan.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (atanf, (float), - float x) +atanf (float x) { switch (numtestf (x)) { diff --git a/newlib/libm/mathfp/sf_atan2.c b/newlib/libm/mathfp/sf_atan2.c index e866ecbb8..dfe1d3375 100644 --- a/newlib/libm/mathfp/sf_atan2.c +++ b/newlib/libm/mathfp/sf_atan2.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (atan2f, (float, float), - float v, +atan2f (float v, float u) { return (atangentf (0.0, v, u, 1)); diff --git a/newlib/libm/mathfp/sf_atangent.c b/newlib/libm/mathfp/sf_atangent.c index 1865cde74..2c96e1544 100644 --- a/newlib/libm/mathfp/sf_atangent.c +++ b/newlib/libm/mathfp/sf_atangent.c @@ -31,8 +31,7 @@ static const float q[] = { 0.1412500740e+1 }; static const float p[] = { -0.4708325141, -0.5090958253e-1 }; float -_DEFUN (atangentf, (float, float, float, int), - float x, +atangentf (float x, float v, float u, int arctan2) diff --git a/newlib/libm/mathfp/sf_ceil.c b/newlib/libm/mathfp/sf_ceil.c index bc8e1403b..51ddada1f 100644 --- a/newlib/libm/mathfp/sf_ceil.c +++ b/newlib/libm/mathfp/sf_ceil.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (ceilf, (float), - float x) +ceilf (float x) { float f, y; diff --git a/newlib/libm/mathfp/sf_cos.c b/newlib/libm/mathfp/sf_cos.c index 057663e69..34b7dfdab 100644 --- a/newlib/libm/mathfp/sf_cos.c +++ b/newlib/libm/mathfp/sf_cos.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (cosf, (float), - float x) +cosf (float x) { return (sinef (x, 1)); } diff --git a/newlib/libm/mathfp/sf_cosh.c b/newlib/libm/mathfp/sf_cosh.c index 4635b7144..c747e907b 100644 --- a/newlib/libm/mathfp/sf_cosh.c +++ b/newlib/libm/mathfp/sf_cosh.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (coshf, (float), - float x) +coshf (float x) { return (sinehf (x, 1)); } diff --git a/newlib/libm/mathfp/sf_exp.c b/newlib/libm/mathfp/sf_exp.c index e37fac58b..33b3529c8 100644 --- a/newlib/libm/mathfp/sf_exp.c +++ b/newlib/libm/mathfp/sf_exp.c @@ -30,8 +30,7 @@ static const float p[] = { 0.249999999950, 0.00416028863 }; static const float q[] = { 0.5, 0.04998717878 }; float -_DEFUN (expf, (float), - float x) +expf (float x) { int N; float g, z, R, P, Q; diff --git a/newlib/libm/mathfp/sf_exp2.c b/newlib/libm/mathfp/sf_exp2.c index 7e147c5ed..43a9ae2df 100644 --- a/newlib/libm/mathfp/sf_exp2.c +++ b/newlib/libm/mathfp/sf_exp2.c @@ -7,8 +7,7 @@ #include "fdlibm.h" float -_DEFUN (exp2f, (float), - float x) +exp2f (float x) { return powf(2.0, x); } diff --git a/newlib/libm/mathfp/sf_fabs.c b/newlib/libm/mathfp/sf_fabs.c index 2661eabc0..8ee93b162 100644 --- a/newlib/libm/mathfp/sf_fabs.c +++ b/newlib/libm/mathfp/sf_fabs.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (fabsf, (float), - float x) +fabsf (float x) { switch (numtestf (x)) { diff --git a/newlib/libm/mathfp/sf_floor.c b/newlib/libm/mathfp/sf_floor.c index 1e0fb9e44..4ba295139 100644 --- a/newlib/libm/mathfp/sf_floor.c +++ b/newlib/libm/mathfp/sf_floor.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (floorf, (float), - float x) +floorf (float x) { float f, y; diff --git a/newlib/libm/mathfp/sf_fmod.c b/newlib/libm/mathfp/sf_fmod.c index 611725409..5dec8a1c9 100644 --- a/newlib/libm/mathfp/sf_fmod.c +++ b/newlib/libm/mathfp/sf_fmod.c @@ -25,8 +25,7 @@ static const float one = 1.0, Zero[] = {0.0, -0.0,}; float -_DEFUN (fmodf, (float, float), - float x, +fmodf (float x, float y) { __int32_t n,hx,hy,hz,ix,iy,sx,i; diff --git a/newlib/libm/mathfp/sf_ldexp.c b/newlib/libm/mathfp/sf_ldexp.c index 3a0d7a41a..9f05c43a0 100644 --- a/newlib/libm/mathfp/sf_ldexp.c +++ b/newlib/libm/mathfp/sf_ldexp.c @@ -23,8 +23,7 @@ #define FLOAT_EXP_OFFS 127 float -_DEFUN (ldexpf, (float, int), - float d, +ldexpf (float d, int e) { int exp; diff --git a/newlib/libm/mathfp/sf_log.c b/newlib/libm/mathfp/sf_log.c index b746d444f..c988f764f 100644 --- a/newlib/libm/mathfp/sf_log.c +++ b/newlib/libm/mathfp/sf_log.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (logf, (float), - float x) +logf (float x) { return (logarithmf (x, 0)); } diff --git a/newlib/libm/mathfp/sf_log10.c b/newlib/libm/mathfp/sf_log10.c index 444e535e0..deb35a378 100644 --- a/newlib/libm/mathfp/sf_log10.c +++ b/newlib/libm/mathfp/sf_log10.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (log10f, (float), - float x) +log10f (float x) { return (logarithmf (x, 1)); } diff --git a/newlib/libm/mathfp/sf_logarithm.c b/newlib/libm/mathfp/sf_logarithm.c index 855ee0744..37e57251c 100644 --- a/newlib/libm/mathfp/sf_logarithm.c +++ b/newlib/libm/mathfp/sf_logarithm.c @@ -31,8 +31,7 @@ static const float C2 = 1.428606820e-06; static const float C3 = 0.4342944819; float -_DEFUN (logarithmf, (float, int), - float x, +logarithmf (float x, int ten) { int N; diff --git a/newlib/libm/mathfp/sf_numtest.c b/newlib/libm/mathfp/sf_numtest.c index 00bab3a9d..1ad5862b1 100644 --- a/newlib/libm/mathfp/sf_numtest.c +++ b/newlib/libm/mathfp/sf_numtest.c @@ -23,8 +23,7 @@ #include "zmath.h" int -_DEFUN (numtestf, (float), - float x) +numtestf (float x) { __int32_t wx; int exp; diff --git a/newlib/libm/mathfp/sf_sin.c b/newlib/libm/mathfp/sf_sin.c index c68e18e50..61ae76b6b 100644 --- a/newlib/libm/mathfp/sf_sin.c +++ b/newlib/libm/mathfp/sf_sin.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (sinf, (float), - float x) +sinf (float x) { return (sinef (x, 0)); } diff --git a/newlib/libm/mathfp/sf_sincos.c b/newlib/libm/mathfp/sf_sincos.c index 85b393dce..472aa712b 100644 --- a/newlib/libm/mathfp/sf_sincos.c +++ b/newlib/libm/mathfp/sf_sincos.c @@ -18,8 +18,7 @@ #include "zmath.h" void -_DEFUN (sincosf, (x, sinx, cosx), - float x, +sincosf (float x, float *sinx, float *cosx) { diff --git a/newlib/libm/mathfp/sf_sine.c b/newlib/libm/mathfp/sf_sine.c index 24725bde1..8dd34d9a1 100644 --- a/newlib/libm/mathfp/sf_sine.c +++ b/newlib/libm/mathfp/sf_sine.c @@ -32,8 +32,7 @@ static const float r[] = { -0.1666665668, 0.2601903036e-5 }; float -_DEFUN (sinef, (float, int), - float x, +sinef (float x, int cosine) { int sgn, N; diff --git a/newlib/libm/mathfp/sf_sineh.c b/newlib/libm/mathfp/sf_sineh.c index 966e91362..83665bdc3 100644 --- a/newlib/libm/mathfp/sf_sineh.c +++ b/newlib/libm/mathfp/sf_sineh.c @@ -32,8 +32,7 @@ static const float INV_V2 = 0.2499930850; static const float V_OVER2_MINUS1 = 0.1383027787e-4; float -_DEFUN (sinehf, (float, int), - float x, +sinehf (float x, int cosineh) { float y, f, P, Q, R, res, z, w; diff --git a/newlib/libm/mathfp/sf_sinh.c b/newlib/libm/mathfp/sf_sinh.c index a50e56606..78cbef90d 100644 --- a/newlib/libm/mathfp/sf_sinh.c +++ b/newlib/libm/mathfp/sf_sinh.c @@ -18,8 +18,7 @@ #include "zmath.h" float -_DEFUN (sinhf, (float), - float x) +sinhf (float x) { return (sinehf (x, 0)); } diff --git a/newlib/libm/mathfp/sf_sqrt.c b/newlib/libm/mathfp/sf_sqrt.c index 5d5410dce..ede24b987 100644 --- a/newlib/libm/mathfp/sf_sqrt.c +++ b/newlib/libm/mathfp/sf_sqrt.c @@ -32,8 +32,7 @@ #include "zmath.h" float -_DEFUN (sqrtf, (float), - float x) +sqrtf (float x) { float f, y; int exp, i, odd; diff --git a/newlib/libm/mathfp/sf_tan.c b/newlib/libm/mathfp/sf_tan.c index fcde19ab3..7924bd217 100644 --- a/newlib/libm/mathfp/sf_tan.c +++ b/newlib/libm/mathfp/sf_tan.c @@ -29,8 +29,7 @@ static const float q[] = { -0.429135777, 0.971685835e-2 }; float -_DEFUN (tanf, (float), - float x) +tanf (float x) { float y, f, g, XN, xnum, xden, res; int N; diff --git a/newlib/libm/mathfp/sf_tanh.c b/newlib/libm/mathfp/sf_tanh.c index 51806af45..7da600a9c 100644 --- a/newlib/libm/mathfp/sf_tanh.c +++ b/newlib/libm/mathfp/sf_tanh.c @@ -31,8 +31,7 @@ static const float q[] = { 0.6178299136, 0.25 }; float -_DEFUN (tanhf, (float), - float x) +tanhf (float x) { float f, res, g, P, Q, R; diff --git a/newlib/libm/test/convert.c b/newlib/libm/test/convert.c index 24188fa8b..fe5bc0aa4 100644 --- a/newlib/libm/test/convert.c +++ b/newlib/libm/test/convert.c @@ -49,8 +49,7 @@ test_atoff (void) static void -_DEFUN(iterate,(func, name), - void _EXFUN((*func),(void)), +iterate (void _EXFUN((*func),(void)), char *name) { @@ -70,8 +69,7 @@ int_type *p = ints; static void -_DEFUN(int_iterate,(func, name), - void (*func)(), +int_iterate (void (*func)(), char *name) { newfunc(name); @@ -86,8 +84,7 @@ _DEFUN(int_iterate,(func, name), } void -_DEFUN(test_strtol_base,(base, pi, string), - int base, +test_strtol_base (int base, int_scan_type *pi, char *string) { @@ -206,8 +203,7 @@ test_fcvt (void) static void -_DEFUN(diterate,(func, name), - void (*func)(), +diterate (void (*func)(), char *name) { newfunc(name); diff --git a/newlib/libm/test/dcvt.c b/newlib/libm/test/dcvt.c index 922652e9f..56d5c2b6b 100644 --- a/newlib/libm/test/dcvt.c +++ b/newlib/libm/test/dcvt.c @@ -28,8 +28,7 @@ static struct p { #define _MAX_PREC 16 static char -_DEFUN(nextdigit,(value), -double *value) +nextdigit (double *value) { double tmp; @@ -39,8 +38,7 @@ double *value) static char * -_DEFUN(print_nan,(buffer, value, precision), - char *buffer, +print_nan (char *buffer, double value, int precision) { @@ -100,8 +98,7 @@ typedef struct void -_DEFUN(renormalize,(in), - cvt_info_type *in) +renormalize (cvt_info_type *in) { /* Make sure all numbers are less than 1 */ @@ -133,8 +130,7 @@ _DEFUN(renormalize,(in), */ static void -_DEFUN(normalize,(value, in), - double value, +normalize (double value, cvt_info_type *in) { int j; @@ -195,8 +191,7 @@ _DEFUN(normalize,(value, in), } int -_DEFUN(round,(in, start, now, ch), - cvt_info_type *in, +round (cvt_info_type *in, char *start, char *now, char ch) @@ -272,8 +267,7 @@ _DEFUN(round,(in, start, now, ch), void -_DEFUN(_cvte,(in), - register cvt_info_type *in) +_cvte (register cvt_info_type *in) { int buffer_idx =0; int digit = 0; @@ -341,8 +335,7 @@ _DEFUN(_cvte,(in), /* Produce NNNN.FFFF */ void -_DEFUN(_cvtf,(in), - cvt_info_type *in) +_cvtf (cvt_info_type *in) { int buffer_idx = 0; /* Current char being output */ @@ -434,8 +427,7 @@ _DEFUN(_cvtf,(in), char * -_DEFUN(_dcvt,(buffer, invalue, precision, width, type, dot), - char *buffer, +_dcvt (char *buffer, double invalue, int precision, int width, @@ -533,8 +525,7 @@ _DEFUN(_dcvt,(buffer, invalue, precision, width, type, dot), char * -_DEFUN(fcvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), - double invalue, +fcvtbuf (double invalue, int ndigit, int *decpt, int *sign, @@ -563,8 +554,7 @@ _DEFUN(fcvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), char * -_DEFUN(ecvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), - double invalue, +ecvtbuf (double invalue, int ndigit, int *decpt, int *sign, @@ -596,8 +586,7 @@ _DEFUN(ecvtbuf,(invalue,ndigit,decpt,sign, fcvt_buf), char * -_DEFUN(gcvt,(d,ndigit,buf), - double d, +gcvt (double d, int ndigit, char *buf) { diff --git a/newlib/libm/test/math.c b/newlib/libm/test/math.c index f58f64f79..dda587a33 100644 --- a/newlib/libm/test/math.c +++ b/newlib/libm/test/math.c @@ -35,8 +35,7 @@ int verbose; /* To test exceptions - we trap them all and return a known value */ int -_DEFUN(matherr,(e), - struct exception *e) +matherr (struct exception *e) { if (traperror) { @@ -50,8 +49,7 @@ _DEFUN(matherr,(e), } -void _DEFUN(translate_to,(file,r), - FILE *file, +void translate_to (FILE *file, double r) { __ieee_double_shape_type bits; @@ -60,8 +58,7 @@ void _DEFUN(translate_to,(file,r), } int -_DEFUN(ffcheck,( is, p, name, serrno, merror), - double is, +ffcheck (double is, one_line_type *p, char *name, int serrno, @@ -108,8 +105,7 @@ _DEFUN(ffcheck,( is, p, name, serrno, merror), } double -_DEFUN(thedouble, (msw, lsw), - long msw, +thedouble (long msw, long lsw) { __ieee_double_shape_type x; @@ -123,8 +119,7 @@ int calc; int reduce; -_DEFUN(frontline,(f, mag, p, result, merror, errno, args, name), - FILE *f, +frontline (FILE *f, int mag, one_line_type *p, double result, @@ -176,8 +171,7 @@ _DEFUN(frontline,(f, mag, p, result, merror, errno, args, name), fprintf(f, ")*/\n"); } -_DEFUN(finish,(f, vector, result , p, args, name), - FILE *f, +finish (FILE *f, int vector, double result, one_line_type *p, @@ -194,8 +188,7 @@ _DEFUN(finish,(f, vector, result , p, args, name), } int redo; -_DEFUN(run_vector_1,(vector, p, func, name, args), - int vector, +run_vector_1 (int vector, one_line_type *p, char *func, char *name, @@ -429,12 +422,12 @@ test_math (void) */ #if 0 -float _DEFUN(cosf,(a), float a) { return cos((double)a); } -float _DEFUN(sinf,(a), float a) { return sin((double)a); } -float _DEFUN(log1pf,(a), float a) { return log1p((double)a); } -float _DEFUN(tanf,(a), float a) { return tan((double)a); } -float _DEFUN(ceilf,(a), float a) { return ceil(a); } -float _DEFUN(floorf,(a), float a) { return floor(a); } +float cosf (float a) { return cos((double)a); } +float sinf (float a) { return sin((double)a); } +float log1pf (float a) { return log1p((double)a); } +float tanf (float a) { return tan((double)a); } +float ceilf (float a) { return ceil(a); } +float floorf (float a) { return floor(a); } #endif /*ndef HAVE_FLOAT*/ diff --git a/newlib/libm/test/string.c b/newlib/libm/test/string.c index e66117fb6..a8cc1a16f 100644 --- a/newlib/libm/test/string.c +++ b/newlib/libm/test/string.c @@ -10,8 +10,7 @@ int errors = 0; #define check(thing) checkit(thing, __LINE__) void -_DEFUN(checkit,(ok,l), - int ok, +checkit (int ok, int l ) { @@ -31,8 +30,7 @@ _DEFUN(checkit,(ok,l), #define equal(a, b) funcqual(a,b,__LINE__); void -_DEFUN(funcqual,(a,b,l), - char *a, +funcqual (char *a, char *b, int l) { diff --git a/newlib/libm/test/test.c b/newlib/libm/test/test.c index 365c4c843..7769e2b36 100644 --- a/newlib/libm/test/test.c +++ b/newlib/libm/test/test.c @@ -9,8 +9,7 @@ int inacc; int -_DEFUN(main,(ac, av), - int ac, +main (int ac, char **av) { int i; @@ -57,8 +56,7 @@ bt(); static const char *iname = "foo"; void -_DEFUN(newfunc,(string), - const char *string) +newfunc (const char *string) { if (strcmp(iname, string)) { @@ -92,8 +90,7 @@ int reduce = 0; int strtod_vector = 0; int -_DEFUN(bigger,(a,b), - __ieee_double_shape_type *a, +bigger (__ieee_double_shape_type *a, __ieee_double_shape_type *b) { @@ -116,8 +113,7 @@ _DEFUN(bigger,(a,b), /* Return the first bit different between two double numbers */ int -_DEFUN(mag_of_error,(is, shouldbe), - double is, +mag_of_error (double is, double shouldbe) { __ieee_double_shape_type a,b; @@ -183,8 +179,7 @@ _DEFUN(mag_of_error,(is, shouldbe), void -_DEFUN(test_sok,(is, shouldbe), - char *is, +test_sok (char *is, char *shouldbe) { if (strcmp(is,shouldbe)) @@ -197,8 +192,7 @@ _DEFUN(test_sok,(is, shouldbe), } } void -_DEFUN(test_iok,(is, shouldbe), - int is, +test_iok (int is, int shouldbe) { if (is != shouldbe){ @@ -215,8 +209,7 @@ _DEFUN(test_iok,(is, shouldbe), prec float conversions against double results */ void -_DEFUN(test_scok,(is, shouldbe, count), - char *is, +test_scok (char *is, char *shouldbe, int count) { @@ -231,8 +224,7 @@ _DEFUN(test_scok,(is, shouldbe, count), } void -_DEFUN(test_eok,(is, shouldbe), - int is, +test_eok (int is, int shouldbe) { if (is != shouldbe){ @@ -245,8 +237,7 @@ _DEFUN(test_eok,(is, shouldbe), } void -_DEFUN(test_mok,(value, shouldbe, okmag), - double value, +test_mok (double value, double shouldbe, int okmag) { diff --git a/newlib/libm/test/test_ieee.c b/newlib/libm/test/test_ieee.c index 167a40c87..f23ceba6d 100644 --- a/newlib/libm/test/test_ieee.c +++ b/newlib/libm/test/test_ieee.c @@ -82,8 +82,7 @@ test_getroundtoi (void) } double - _DEFUN(dnumber,(msw, lsw), - int msw, + dnumber (int msw, int lsw) { diff --git a/newlib/libm/test/test_is.c b/newlib/libm/test/test_is.c index c4c8e2fdb..ac8f79c49 100644 --- a/newlib/libm/test/test_is.c +++ b/newlib/libm/test/test_is.c @@ -18,8 +18,7 @@ int mygraph; int mypunct; void -_DEFUN(test_is_single,(i), - int i) +test_is_single (int i) { setascii = 0; setlower = 0; @@ -1913,28 +1912,27 @@ _DEFUN(test_is_single,(i), } -int _DEFUN(def_isascii,(i), int i) { return isascii(i); } -int _DEFUN(def_iscntrl,(i), int i) { return iscntrl(i); } -int _DEFUN(def_isspace,(i), int i) { return isspace(i); } -int _DEFUN(def_isprint,(i), int i) { return isprint(i); } -int _DEFUN(def_isalnum,(i), int i) { return isalnum(i); } -int _DEFUN(def_isdigit,(i), int i) { return isdigit(i); } -int _DEFUN(def_isxdigit,(i), int i) { return isxdigit(i); } -int _DEFUN(def_isalpha,(i), int i) { return isalpha(i); } -int _DEFUN(def_isupper,(i), int i) { return isupper(i); } -int _DEFUN(def_islower,(i), int i) { return islower(i); } -int _DEFUN(def_isgraph,(i), int i) { return isgraph(i); } -int _DEFUN(def_ispunct,(i), int i) { return ispunct(i); } -int _DEFUN(def_tolower,(i), int i) { return tolower(i); } -int _DEFUN(def_toupper,(i), int i) { return toupper(i); } -int _DEFUN(def_toascii,(i), int i) { return toascii(i); } -int _DEFUN(def__tolower,(i), int i) { return _tolower(i); } -int _DEFUN(def__toupper,(i), int i) { return _toupper(i); } +int def_isascii (int i) { return isascii(i); } +int def_iscntrl (int i) { return iscntrl(i); } +int def_isspace (int i) { return isspace(i); } +int def_isprint (int i) { return isprint(i); } +int def_isalnum (int i) { return isalnum(i); } +int def_isdigit (int i) { return isdigit(i); } +int def_isxdigit (int i) { return isxdigit(i); } +int def_isalpha (int i) { return isalpha(i); } +int def_isupper (int i) { return isupper(i); } +int def_islower (int i) { return islower(i); } +int def_isgraph (int i) { return isgraph(i); } +int def_ispunct (int i) { return ispunct(i); } +int def_tolower (int i) { return tolower(i); } +int def_toupper (int i) { return toupper(i); } +int def_toascii (int i) { return toascii(i); } +int def__tolower (int i) { return _tolower(i); } +int def__toupper (int i) { return _toupper(i); } extern int inacc; void -_DEFUN(test_is_set,(func, name, p), - int (*func)(), +test_is_set (int (*func)(), char *name, int *p) { @@ -1952,8 +1950,7 @@ _DEFUN(test_is_set,(func, name, p), } } void -_DEFUN(test_to_set,(func, name, p, low, high), - int (*func)(), +test_to_set (int (*func)(), char *name, int *p, int low, From 77f16db546d9c214f639d1ea84c58d99f9e4d282 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 22:52:13 -0600 Subject: [PATCH 217/649] ansification: remove _EXFNPTR, _EXPARM Signed-off-by: Yaakov Selkowitz --- newlib/libc/iconv/lib/conv.h | 28 +++++++++---------- newlib/libc/iconv/lib/ucsconv.h | 48 ++++++++++++++++----------------- newlib/libc/include/_ansi.h | 4 --- newlib/libc/include/rpc/xdr.h | 26 +++++++++--------- newlib/libc/include/sys/reent.h | 30 ++++++++++----------- newlib/libc/search/bsearch.c | 2 +- newlib/libc/stdio/fseeko.c | 2 +- newlib/libc/stdio64/fseeko64.c | 2 +- newlib/libc/stdlib/atexit.c | 2 +- newlib/libc/stdlib/on_exit.c | 2 +- newlib/libc/xdr/xdr_private.h | 2 +- newlib/libc/xdr/xdr_rec.c | 4 +-- newlib/libc/xdr/xdr_sizeof.c | 6 ++--- 13 files changed, 77 insertions(+), 81 deletions(-) diff --git a/newlib/libc/iconv/lib/conv.h b/newlib/libc/iconv/lib/conv.h index 89da4b224..658ab9152 100644 --- a/newlib/libc/iconv/lib/conv.h +++ b/newlib/libc/iconv/lib/conv.h @@ -63,9 +63,9 @@ typedef struct * Pointer to conversion-specific data if success. In case of error * returns NULL and sets current thread's/process's errno. */ - void *_EXFNPTR(open, (struct _reent *rptr, + void *(*open) (struct _reent *rptr, const char *to, - const char *from)); + const char *from); /* * close - close conversion. @@ -81,8 +81,8 @@ typedef struct * When successful, returns (size_t)0. In case of error, sets current * thread's/process's errno and returns (size_t)-1 (same as iconv_open()). */ - size_t _EXFNPTR(close, (struct _reent *rptr, - void *data)); + size_t (*close) (struct _reent *rptr, + void *data); /* convert - perform encoding conversion. * @@ -114,13 +114,13 @@ typedef struct * Reversible conversions are not counted. In case of error, sets current * thread's/process's errno and returns (size_t)-1 (same as iconv()). */ - size_t _EXFNPTR(convert, (struct _reent *rptr, + size_t (*convert) (struct _reent *rptr, void *data, const unsigned char **inbuf, size_t *inbytesleft, unsigned char **outbuf, size_t *outbytesleft, - int flags)); + int flags); /* * get_state - get current shift state. @@ -135,9 +135,9 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - void _EXFNPTR(get_state, (void *data, + void (*get_state) (void *data, mbstate_t *state, - int direction)); + int direction); /* * set_state - set shift state. @@ -154,9 +154,9 @@ typedef struct * "to" encoding is set. * Returns 0 if '*state' object has right format, -1 else. */ - int _EXFNPTR(set_state, (void *data, + int (*set_state) (void *data, mbstate_t *state, - int direction)); + int direction); /* * get_mb_cur_max - get maximum character length in bytes. @@ -170,8 +170,8 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - int _EXFNPTR(get_mb_cur_max, (void *data, - int direction)); + int (*get_mb_cur_max) (void *data, + int direction); /* * is_stateful - is encoding stateful or stateless. @@ -185,8 +185,8 @@ typedef struct * If 'direction' is 0, "from" encoding is tested, else * "to" encoding is tested. */ - int _EXFNPTR(is_stateful, (void *data, - int direction)); + int (*is_stateful) (void *data, + int direction); } iconv_conversion_handlers_t; diff --git a/newlib/libc/iconv/lib/ucsconv.h b/newlib/libc/iconv/lib/ucsconv.h index 391daed35..2c3d8c647 100644 --- a/newlib/libc/iconv/lib/ucsconv.h +++ b/newlib/libc/iconv/lib/ucsconv.h @@ -68,8 +68,8 @@ typedef struct * Returns CES-specific data pointer if success. In case of error returns * NULL and sets current thread's/process's errno. */ - void *_EXFNPTR(init, (struct _reent *rptr, - const char *encoding)); + void *(*init) (struct _reent *rptr, + const char *encoding); /* * close - close CES converter. @@ -84,8 +84,8 @@ typedef struct * Returns (size_t)0 if success. In case of error returns (size_t)-1 and * sets current thread's/process's errno. */ - size_t _EXFNPTR(close, (struct _reent *rptr, - void *data)); + size_t (*close) (struct _reent *rptr, + void *data); /* * get_mb_cur_max - get maximum character length in bytes. @@ -96,7 +96,7 @@ typedef struct * DESCRIPTION: * Returns encoding's maximum character length. */ - int _EXFNPTR(get_mb_cur_max, (void *data)); + int (*get_mb_cur_max) (void *data); /* * get_state - get current shift state. @@ -108,8 +108,8 @@ typedef struct * DESCRIPTION: * Returns encoding's current shift sequence. */ - void _EXFNPTR(get_state, (void *data, - mbstate_t *state)); + void (*get_state) (void *data, + mbstate_t *state); /* * set_state - set shift state. @@ -123,8 +123,8 @@ typedef struct * object is zero-object - reset current shift state. * Returns 0 if '*state' object has right format, -1 else. */ - int _EXFNPTR(set_state, (void *data, - mbstate_t *state)); + int (*set_state) (void *data, + mbstate_t *state); /* * is_stateful - is encoding stateful state. @@ -135,7 +135,7 @@ typedef struct * DESCRIPTION: * Returns 0 if encoding is stateless, else returns 1. */ - int _EXFNPTR(is_stateful, (void *data)); + int (*is_stateful) (void *data); /* * convert_to_ucs - convert character to UCS. @@ -155,9 +155,9 @@ typedef struct * returns ICONV_CES_INVALID_CHARACTER. If invalid or incomplete bytes * sequence was met, returns ICONV_CES_BAD_SEQUENCE. */ - ucs4_t _EXFNPTR(convert_to_ucs, (void *data, + ucs4_t (*convert_to_ucs) (void *data, const unsigned char **inbuf, - size_t *inbytesleft)); + size_t *inbytesleft); } iconv_to_ucs_ces_handlers_t; @@ -172,26 +172,26 @@ typedef struct typedef struct { /* Same as in iconv_to_ucs_ces_handlers_t */ - void *_EXFNPTR(init, (struct _reent *rptr, - const char *encoding)); + void *(*init) (struct _reent *rptr, + const char *encoding); /* Same as in iconv_to_ucs_ces_handlers_t */ - size_t _EXFNPTR(close, (struct _reent *rptr, - void *data)); + size_t (*close) (struct _reent *rptr, + void *data); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXFNPTR(get_mb_cur_max, (void *data)); + int (*get_mb_cur_max) (void *data); /* Same as in iconv_to_ucs_ces_handlers_t */ - void _EXFNPTR(get_state, (void *data, - mbstate_t *state)); + void (*get_state) (void *data, + mbstate_t *state); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXFNPTR(set_state, (void *data, - mbstate_t *state)); + int (*set_state) (void *data, + mbstate_t *state); /* Same as in iconv_to_ucs_ces_handlers_t */ - int _EXFNPTR(is_stateful, (void *data)); + int (*is_stateful) (void *data); /* * convert_from_ucs - convert UCS character to destination encoding. @@ -215,10 +215,10 @@ typedef struct * If there is no corresponding character in destination encoding, returns * ICONV_CES_INVALID_CHARACTER. */ - size_t _EXFNPTR(convert_from_ucs, (void *data, + size_t (*convert_from_ucs) (void *data, ucs4_t in, unsigned char **outbuf, - size_t *outbytesleft)); + size_t *outbytesleft); } iconv_from_ucs_ces_handlers_t; diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 951617520..3e2490088 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -50,13 +50,9 @@ #ifdef __CYGWIN__ #define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW #define _EXFUN(name, proto) __cdecl name proto -#define _EXPARM(name, proto) (* __cdecl name) proto -#define _EXFNPTR(name, proto) (__cdecl * name) proto #else #define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW #define _EXFUN(name, proto) name proto -#define _EXPARM(name, proto) (* name) proto -#define _EXFNPTR(name, proto) (* name) proto #endif #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double diff --git a/newlib/libc/include/rpc/xdr.h b/newlib/libc/include/rpc/xdr.h index 40ddc1cdd..bda8e9926 100644 --- a/newlib/libc/include/rpc/xdr.h +++ b/newlib/libc/include/rpc/xdr.h @@ -111,34 +111,34 @@ typedef struct __rpc_xdr const struct xdr_ops { /* get a long from underlying stream */ - bool_t _EXFNPTR (x_getlong, (struct __rpc_xdr *, long *)); + bool_t (*x_getlong) (struct __rpc_xdr *, long *); /* put a long to " */ - bool_t _EXFNPTR (x_putlong, (struct __rpc_xdr *, const long *)); + bool_t (*x_putlong) (struct __rpc_xdr *, const long *); /* get some bytes from " */ - bool_t _EXFNPTR (x_getbytes, (struct __rpc_xdr *, char *, u_int)); + bool_t (*x_getbytes) (struct __rpc_xdr *, char *, u_int); /* put some bytes to " */ - bool_t _EXFNPTR (x_putbytes, (struct __rpc_xdr *, const char *, u_int)); + bool_t (*x_putbytes) (struct __rpc_xdr *, const char *, u_int); /* returns bytes off from beginning */ - u_int _EXFNPTR (x_getpostn, (struct __rpc_xdr *)); + u_int (*x_getpostn) (struct __rpc_xdr *); /* lets you reposition the stream */ - bool_t _EXFNPTR (x_setpostn, (struct __rpc_xdr *, u_int)); + bool_t (*x_setpostn) (struct __rpc_xdr *, u_int); /* buf quick ptr to buffered data */ - int32_t * _EXFNPTR (x_inline, (struct __rpc_xdr *, u_int)); + int32_t * (*x_inline) (struct __rpc_xdr *, u_int); /* free privates of this xdr_stream */ - void _EXFNPTR (x_destroy, (struct __rpc_xdr *)); + void (*x_destroy) (struct __rpc_xdr *); /* get an int32 from this xdr_stream */ - bool_t _EXFNPTR (x_getint32, (struct __rpc_xdr *, int32_t *)); + bool_t (*x_getint32) (struct __rpc_xdr *, int32_t *); /* put an int32 to the underlying stream */ - bool_t _EXFNPTR (x_putint32, (struct __rpc_xdr *, const int32_t *)); + bool_t (*x_putint32) (struct __rpc_xdr *, const int32_t *); } *x_ops; char *x_public; /* users' data */ @@ -156,7 +156,7 @@ typedef struct __rpc_xdr * allocate dynamic storage of the appropriate size and return it. * bool_t (*xdrproc_t)(XDR *, some_type *) */ -typedef bool_t _EXFNPTR(xdrproc_t, (XDR *, ...)); +typedef bool_t (*xdrproc_t) (XDR *, ...); /* * Operations defined on a XDR handle @@ -366,8 +366,8 @@ extern void _EXFUN (xdrstdio_create, (XDR *, FILE *, enum xdr_op)); /* XDR pseudo records for tcp */ extern void _EXFUN (xdrrec_create, (XDR *, u_int, u_int, void *, - int _EXPARM (, (void *, void *, int)), - int _EXPARM (, (void *, void *, int)))); + int (*) (void *, void *, int), + int (*) (void *, void *, int))); /* make end of xdr record */ extern bool_t _EXFUN (xdrrec_endofrecord, (XDR *, bool_t)); diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index cfb79edd3..54fdf96f1 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -194,13 +194,13 @@ struct __sFILE { /* operations */ void * _cookie; /* cookie passed to io functions */ - _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, void *, - char *, _READ_WRITE_BUFSIZE_TYPE)); - _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, void *, + _READ_WRITE_RETURN_TYPE (*_read) (struct _reent *, void *, + char *, _READ_WRITE_BUFSIZE_TYPE); + _READ_WRITE_RETURN_TYPE (*_write) (struct _reent *, void *, const char *, - _READ_WRITE_BUFSIZE_TYPE)); - _fpos_t _EXFNPTR(_seek, (struct _reent *, void *, _fpos_t, int)); - int _EXFNPTR(_close, (struct _reent *, void *)); + _READ_WRITE_BUFSIZE_TYPE); + _fpos_t (*_seek) (struct _reent *, void *, _fpos_t, int); + int (*_close) (struct _reent *, void *); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -250,13 +250,13 @@ struct __sFILE64 { /* operations */ void * _cookie; /* cookie passed to io functions */ - _READ_WRITE_RETURN_TYPE _EXFNPTR(_read, (struct _reent *, void *, - char *, _READ_WRITE_BUFSIZE_TYPE)); - _READ_WRITE_RETURN_TYPE _EXFNPTR(_write, (struct _reent *, void *, + _READ_WRITE_RETURN_TYPE (*_read) (struct _reent *, void *, + char *, _READ_WRITE_BUFSIZE_TYPE); + _READ_WRITE_RETURN_TYPE (*_write) (struct _reent *, void *, const char *, - _READ_WRITE_BUFSIZE_TYPE)); - _fpos_t _EXFNPTR(_seek, (struct _reent *, void *, _fpos_t, int)); - int _EXFNPTR(_close, (struct _reent *, void *)); + _READ_WRITE_BUFSIZE_TYPE); + _fpos_t (*_seek) (struct _reent *, void *, _fpos_t, int); + int (*_close) (struct _reent *, void *); /* separate buffer for long sequences of ungetc() */ struct __sbuf _ub; /* ungetc buffer */ @@ -275,7 +275,7 @@ struct __sFILE64 { int _flags2; /* for future use */ _off64_t _offset; /* current lseek offset */ - _fpos64_t _EXFNPTR(_seek64, (struct _reent *, void *, _fpos64_t, int)); + _fpos64_t (*_seek64) (struct _reent *, void *, _fpos64_t, int); #ifndef __SINGLE_THREAD__ _flock_t _lock; /* for thread-safety locking */ @@ -391,7 +391,7 @@ struct _reent struct _mprec *_mp; - void _EXFNPTR(__cleanup, (struct _reent *)); + void (*__cleanup) (struct _reent *); int _gamma_signgam; @@ -584,7 +584,7 @@ struct _reent int __sdidinit; /* 1 means stdio has been init'd */ - void _EXFNPTR(__cleanup, (struct _reent *)); + void (*__cleanup) (struct _reent *); /* used by mprec routines */ struct _Bigint *_result; diff --git a/newlib/libc/search/bsearch.c b/newlib/libc/search/bsearch.c index 2f1dc9d77..29b787425 100644 --- a/newlib/libc/search/bsearch.c +++ b/newlib/libc/search/bsearch.c @@ -60,7 +60,7 @@ bsearch (const void *key, const void *base, size_t nmemb, size_t size, - int _EXFNPTR(compar, (const void *, const void *))) + int (*compar) (const void *, const void *)) { void *current; size_t lower = 0; diff --git a/newlib/libc/stdio/fseeko.c b/newlib/libc/stdio/fseeko.c index 7ca86161c..3e0f9e90b 100644 --- a/newlib/libc/stdio/fseeko.c +++ b/newlib/libc/stdio/fseeko.c @@ -98,7 +98,7 @@ _fseeko_r (struct _reent *ptr, _off_t offset, int whence) { - _fpos_t _EXFNPTR(seekfn, (struct _reent *, void *, _fpos_t, int)); + _fpos_t (*seekfn) (struct _reent *, void *, _fpos_t, int); _fpos_t target; _fpos_t curoff = 0; size_t n; diff --git a/newlib/libc/stdio64/fseeko64.c b/newlib/libc/stdio64/fseeko64.c index 085855d4b..0672086a3 100644 --- a/newlib/libc/stdio64/fseeko64.c +++ b/newlib/libc/stdio64/fseeko64.c @@ -90,7 +90,7 @@ _fseeko64_r (struct _reent *ptr, _off64_t offset, int whence) { - _fpos64_t _EXFNPTR(seekfn, (struct _reent *, void *, _fpos64_t, int)); + _fpos64_t (*seekfn) (struct _reent *, void *, _fpos64_t, int); _fpos64_t target, curoff; size_t n; diff --git a/newlib/libc/stdlib/atexit.c b/newlib/libc/stdlib/atexit.c index 1d300bd0f..63617f821 100644 --- a/newlib/libc/stdlib/atexit.c +++ b/newlib/libc/stdlib/atexit.c @@ -53,7 +53,7 @@ Supporting OS subroutines required: <>, <>, <>, */ int -atexit (void _EXFNPTR(fn, (void))) +atexit (void (*fn) (void)) { return __register_exitproc (__et_atexit, fn, NULL, NULL); } diff --git a/newlib/libc/stdlib/on_exit.c b/newlib/libc/stdlib/on_exit.c index ce6bac68e..2eaf03564 100644 --- a/newlib/libc/stdlib/on_exit.c +++ b/newlib/libc/stdlib/on_exit.c @@ -66,7 +66,7 @@ const void * const __on_exit_dummy = &__on_exit_args; */ int -on_exit (void _EXFNPTR(fn, (int, void *)), +on_exit (void (*fn) (int, void *), void *arg) { return __register_exitproc (__et_onexit, (void (*)(void)) fn, arg, NULL); diff --git a/newlib/libc/xdr/xdr_private.h b/newlib/libc/xdr/xdr_private.h index 2b4581866..3b071d668 100644 --- a/newlib/libc/xdr/xdr_private.h +++ b/newlib/libc/xdr/xdr_private.h @@ -41,7 +41,7 @@ extern "C" { #endif -typedef void _EXFNPTR (xdr_vprintf_t, (const char *, va_list)); +typedef void (*xdr_vprintf_t) (const char *, va_list); xdr_vprintf_t _EXFUN (xdr_set_vprintf, (xdr_vprintf_t)); diff --git a/newlib/libc/xdr/xdr_rec.c b/newlib/libc/xdr/xdr_rec.c index f46a9a3fa..9051d522f 100644 --- a/newlib/libc/xdr/xdr_rec.c +++ b/newlib/libc/xdr/xdr_rec.c @@ -173,8 +173,8 @@ xdrrec_create (XDR * xdrs, u_int sendsize, u_int recvsize, void *tcp_handle, - int _EXPARM (readit, (void *, void *, int)), - int _EXPARM (writeit, (void *, void *, int))) + int (*readit) (void *, void *, int), + int (*writeit) (void *, void *, int)) { RECSTREAM *rstrm; /* Although sendsize and recvsize are u_int, we require diff --git a/newlib/libc/xdr/xdr_sizeof.c b/newlib/libc/xdr/xdr_sizeof.c index bf02cf5e7..e086d30e7 100644 --- a/newlib/libc/xdr/xdr_sizeof.c +++ b/newlib/libc/xdr/xdr_sizeof.c @@ -142,9 +142,9 @@ xdr_sizeof (xdrproc_t func, struct xdr_ops ops; bool_t stat; /* to stop ANSI-C compiler from complaining */ - typedef bool_t _EXFNPTR (dummyfunc1, (XDR *, long *)); - typedef bool_t _EXFNPTR (dummyfunc2, (XDR *, caddr_t, u_int)); - typedef bool_t _EXFNPTR (dummyfunc3, (XDR *, int32_t *)); + typedef bool_t (*dummyfunc1) (XDR *, long *); + typedef bool_t (*dummyfunc2) (XDR *, caddr_t, u_int); + typedef bool_t (*dummyfunc3) (XDR *, int32_t *); ops.x_putlong = x_putlong; ops.x_putbytes = x_putbytes; From 70ee6b17df9b055a05cdcc4d3fe1813d7b57e2d8 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 23:54:48 -0600 Subject: [PATCH 218/649] ansification: remove _EXFUN, _EXFUN_NOTHROW Signed-off-by: Yaakov Selkowitz --- libgloss/aarch64/syscalls.c | 2 +- libgloss/arm/syscalls.c | 2 +- libgloss/mcore/write.c | 2 +- libgloss/sparc_leon/asm-leon/clock.h | 4 +- libgloss/write.c | 2 +- newlib/libc/ctype/local.h | 2 +- newlib/libc/iconv/ces/table.c | 8 +- newlib/libc/iconv/lib/ucsconv.c | 4 +- newlib/libc/include/_ansi.h | 9 - newlib/libc/include/alloca.h | 2 +- newlib/libc/include/assert.h | 8 +- newlib/libc/include/ctype.h | 32 +- newlib/libc/include/envlock.h | 4 +- newlib/libc/include/getopt.h | 28 +- newlib/libc/include/iconv.h | 16 +- newlib/libc/include/ieeefp.h | 16 +- newlib/libc/include/libgen.h | 4 +- newlib/libc/include/locale.h | 8 +- newlib/libc/include/pthread.h | 342 +++++----- newlib/libc/include/rpc/xdr.h | 102 +-- newlib/libc/include/setjmp.h | 6 +- newlib/libc/include/signal.h | 10 +- newlib/libc/include/spawn.h | 81 +-- newlib/libc/include/stdio.h | 628 +++++++++---------- newlib/libc/include/stdio_ext.h | 18 +- newlib/libc/include/stdlib.h | 266 ++++---- newlib/libc/include/string.h | 104 +-- newlib/libc/include/sys/iconvnls.h | 22 +- newlib/libc/include/sys/reent.h | 4 +- newlib/libc/include/sys/resource.h | 2 +- newlib/libc/include/sys/signal.h | 47 +- newlib/libc/include/sys/stat.h | 42 +- newlib/libc/include/sys/time.h | 24 +- newlib/libc/include/sys/times.h | 4 +- newlib/libc/include/sys/unistd.h | 264 ++++---- newlib/libc/include/time.h | 85 ++- newlib/libc/include/wchar.h | 306 ++++----- newlib/libc/include/wctype.h | 36 +- newlib/libc/machine/powerpc/machine/malloc.h | 12 +- newlib/libc/machine/powerpc/machine/stdlib.h | 72 +-- newlib/libc/machine/spu/c99ppe.h | 4 +- newlib/libc/misc/__dprintf.c | 8 +- newlib/libc/stdio/asnprintf.c | 8 +- newlib/libc/stdio/asprintf.c | 8 +- newlib/libc/stdio/dprintf.c | 8 +- newlib/libc/stdio/fprintf.c | 8 +- newlib/libc/stdio/fscanf.c | 8 +- newlib/libc/stdio/fvwrite.h | 4 +- newlib/libc/stdio/getline.c | 2 +- newlib/libc/stdio/local.h | 106 ++-- newlib/libc/stdio/nano-vfprintf.c | 14 +- newlib/libc/stdio/nano-vfscanf.c | 22 +- newlib/libc/stdio/printf.c | 8 +- newlib/libc/stdio/scanf.c | 8 +- newlib/libc/stdio/snprintf.c | 8 +- newlib/libc/stdio/sprintf.c | 8 +- newlib/libc/stdio/sscanf.c | 8 +- newlib/libc/stdio/vasnprintf.c | 8 +- newlib/libc/stdio/vasprintf.c | 8 +- newlib/libc/stdio/vdprintf.c | 8 +- newlib/libc/stdio/vfprintf.c | 8 +- newlib/libc/stdio/vfscanf.c | 6 +- newlib/libc/stdio/vfwprintf.c | 12 +- newlib/libc/stdio/vprintf.c | 6 +- newlib/libc/stdio/vscanf.c | 6 +- newlib/libc/stdio/vsnprintf.c | 8 +- newlib/libc/stdio/vsprintf.c | 8 +- newlib/libc/stdio/vsscanf.c | 8 +- newlib/libc/stdlib/local.h | 2 +- newlib/libc/stdlib/mbctype.h | 8 +- newlib/libc/stdlib/mprec.h | 46 +- newlib/libc/stdlib/rand48.h | 2 +- newlib/libc/stdlib/system.c | 2 +- newlib/libc/string/local.h | 2 +- newlib/libc/sys/arm/syscalls.c | 2 +- newlib/libc/sys/linux/include/setjmp.h | 8 +- newlib/libc/sys/linux/include/time.h | 68 +- newlib/libc/sys/linux/sys/signal.h | 20 +- newlib/libc/sys/linux/sys/stat.h | 18 +- newlib/libc/sys/linux/sys/stdio.h | 2 +- newlib/libc/sys/linux/sys/string.h | 2 +- newlib/libc/sys/linux/sys/time.h | 12 +- newlib/libc/sys/linux/sys/unistd.h | 176 +++--- newlib/libc/sys/linux/sys/utime.h | 2 +- newlib/libc/sys/sparc64/sys/stat.h | 12 +- newlib/libc/time/local.h | 10 +- newlib/libc/xdr/xdr_mem.c | 30 +- newlib/libc/xdr/xdr_private.h | 10 +- newlib/libc/xdr/xdr_rec.c | 24 +- newlib/libc/xdr/xdr_stdio.c | 20 +- newlib/libm/mathfp/zmath.h | 24 +- newlib/libm/test/convert.c | 2 +- newlib/libm/test/math.c | 12 +- newlib/libm/test/test.h | 28 +- winsup/cygwin/include/attr/xattr.h | 24 +- winsup/cygwin/include/pty.h | 8 +- winsup/cygwin/include/sys/stdio.h | 4 +- winsup/cygwin/include/sys/utime.h | 2 +- 98 files changed, 1740 insertions(+), 1798 deletions(-) diff --git a/libgloss/aarch64/syscalls.c b/libgloss/aarch64/syscalls.c index 5aeb3d0b5..8198d3ed0 100644 --- a/libgloss/aarch64/syscalls.c +++ b/libgloss/aarch64/syscalls.c @@ -120,7 +120,7 @@ register char * stack_ptr asm ("sp"); /* following is copied from libc/stdio/local.h to check std streams */ -extern void _EXFUN (__sinit, (struct _reent *)); +extern void __sinit (struct _reent *); #define CHECK_INIT(ptr) \ do \ { \ diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index b76858fc9..f80615db9 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -85,7 +85,7 @@ register char * stack_ptr asm ("sp"); /* following is copied from libc/stdio/local.h to check std streams */ -extern void _EXFUN(__sinit,(struct _reent *)); +extern void __sinit (struct _reent *); #define CHECK_INIT(ptr) \ do \ { \ diff --git a/libgloss/mcore/write.c b/libgloss/mcore/write.c index 87dca10a1..8b50fe274 100644 --- a/libgloss/mcore/write.c +++ b/libgloss/mcore/write.c @@ -14,7 +14,7 @@ */ #include "glue.h" -extern int _EXFUN (outbyte, (char x)); +extern int outbyte (char x); /* * write -- write bytes to the serial port. Ignore fd, since diff --git a/libgloss/sparc_leon/asm-leon/clock.h b/libgloss/sparc_leon/asm-leon/clock.h index 189e942e1..7e33ae4d0 100644 --- a/libgloss/sparc_leon/asm-leon/clock.h +++ b/libgloss/sparc_leon/asm-leon/clock.h @@ -30,8 +30,8 @@ #include #ifndef __ASSEMBLER__ -int _EXFUN (gettimeofday, (struct timeval * __p, void *__tz)); -int _EXFUN (settimeofday, (const struct timeval *, const struct timezone *)); +int gettimeofday (struct timeval * __p, void *__tz); +int settimeofday (const struct timeval *, const struct timezone *); void do_gettimeofday (struct timeval *tv); #endif diff --git a/libgloss/write.c b/libgloss/write.c index 4b25cfce7..28b7ea37a 100644 --- a/libgloss/write.c +++ b/libgloss/write.c @@ -14,7 +14,7 @@ */ #include "glue.h" -extern int _EXFUN (outbyte, (char x)); +extern int outbyte (char x); /* * write -- write bytes to the serial port. Ignore fd, since diff --git a/newlib/libc/ctype/local.h b/newlib/libc/ctype/local.h index b3788e218..62d2b1553 100644 --- a/newlib/libc/ctype/local.h +++ b/newlib/libc/ctype/local.h @@ -27,5 +27,5 @@ to the requirements of the underlying OS. */ #define _jp2uc(c) (c) #else -wint_t _EXFUN (_jp2uc, (wint_t)); +wint_t _jp2uc (wint_t); #endif diff --git a/newlib/libc/iconv/ces/table.c b/newlib/libc/iconv/ces/table.c index 2b844d558..c8ef218a1 100644 --- a/newlib/libc/iconv/ces/table.c +++ b/newlib/libc/iconv/ces/table.c @@ -57,17 +57,17 @@ */ static ucs2_t -_EXFUN(find_code_size, (ucs2_t code, const __uint16_t *tblp)); +find_code_size (ucs2_t code, const __uint16_t *tblp); static __inline ucs2_t -_EXFUN(find_code_speed, (ucs2_t code, const __uint16_t *tblp)); +find_code_speed (ucs2_t code, const __uint16_t *tblp); static __inline ucs2_t -_EXFUN(find_code_speed_8bit, (ucs2_t code, const unsigned char *tblp)); +find_code_speed_8bit (ucs2_t code, const unsigned char *tblp); #ifdef _ICONV_ENABLE_EXTERNAL_CCS static const iconv_ccs_desc_t * -_EXFUN(load_file, (struct _reent *rptr, const char *name, int direction)); +load_file (struct _reent *rptr, const char *name, int direction); #endif /* diff --git a/newlib/libc/iconv/lib/ucsconv.c b/newlib/libc/iconv/lib/ucsconv.c index 8c3d19073..59f4f993d 100644 --- a/newlib/libc/iconv/lib/ucsconv.c +++ b/newlib/libc/iconv/lib/ucsconv.c @@ -36,8 +36,8 @@ static int fake_data; static int -_EXFUN(find_encoding_name, (const char *searchee, - const char **names)); +find_encoding_name (const char *searchee, + const char **names); /* diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index 3e2490088..e2737ed48 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -47,19 +47,10 @@ #endif #ifdef _HAVE_STDC -#ifdef __CYGWIN__ -#define _EXFUN_NOTHROW(name, proto) __cdecl name proto _NOTHROW -#define _EXFUN(name, proto) __cdecl name proto -#else -#define _EXFUN_NOTHROW(name, proto) name proto _NOTHROW -#define _EXFUN(name, proto) name proto -#endif #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif #else -#define _EXFUN(name, proto) name() -#define _EXFUN_NOTHROW(name, proto) name() #define _LONG_DOUBLE double #endif diff --git a/newlib/libc/include/alloca.h b/newlib/libc/include/alloca.h index 2ea0fd9b3..5d3631891 100644 --- a/newlib/libc/include/alloca.h +++ b/newlib/libc/include/alloca.h @@ -15,7 +15,7 @@ #ifdef __GNUC__ #define alloca(size) __builtin_alloca(size) #else -void * _EXFUN(alloca,(size_t)); +void * alloca (size_t); #endif #endif diff --git a/newlib/libc/include/assert.h b/newlib/libc/include/assert.h index 91bb040ca..b9e5e9b4a 100644 --- a/newlib/libc/include/assert.h +++ b/newlib/libc/include/assert.h @@ -36,10 +36,10 @@ extern "C" { # endif /* !__ASSERT_FUNC */ #endif /* !NDEBUG */ -void _EXFUN(__assert, (const char *, int, const char *) - _ATTRIBUTE ((__noreturn__))); -void _EXFUN(__assert_func, (const char *, int, const char *, const char *) - _ATTRIBUTE ((__noreturn__))); +void __assert (const char *, int, const char *) + _ATTRIBUTE ((__noreturn__)); +void __assert_func (const char *, int, const char *, const char *) + _ATTRIBUTE ((__noreturn__)); #if __STDC_VERSION__ >= 201112L && !defined __cplusplus # define static_assert _Static_assert diff --git a/newlib/libc/include/ctype.h b/newlib/libc/include/ctype.h index 0d705e131..f74b3499b 100644 --- a/newlib/libc/include/ctype.h +++ b/newlib/libc/include/ctype.h @@ -10,27 +10,27 @@ _BEGIN_STD_C -int _EXFUN(isalnum, (int __c)); -int _EXFUN(isalpha, (int __c)); -int _EXFUN(iscntrl, (int __c)); -int _EXFUN(isdigit, (int __c)); -int _EXFUN(isgraph, (int __c)); -int _EXFUN(islower, (int __c)); -int _EXFUN(isprint, (int __c)); -int _EXFUN(ispunct, (int __c)); -int _EXFUN(isspace, (int __c)); -int _EXFUN(isupper, (int __c)); -int _EXFUN(isxdigit,(int __c)); -int _EXFUN(tolower, (int __c)); -int _EXFUN(toupper, (int __c)); +int isalnum (int __c); +int isalpha (int __c); +int iscntrl (int __c); +int isdigit (int __c); +int isgraph (int __c); +int islower (int __c); +int isprint (int __c); +int ispunct (int __c); +int isspace (int __c); +int isupper (int __c); +int isxdigit (int __c); +int tolower (int __c); +int toupper (int __c); #if __ISO_C_VISIBLE >= 1999 -int _EXFUN(isblank, (int __c)); +int isblank (int __c); #endif #if __MISC_VISIBLE || __XSI_VISIBLE -int _EXFUN(isascii, (int __c)); -int _EXFUN(toascii, (int __c)); +int isascii (int __c); +int toascii (int __c); #define _tolower(__c) ((unsigned char)(__c) - 'A' + 'a') #define _toupper(__c) ((unsigned char)(__c) - 'a' + 'A') #endif diff --git a/newlib/libc/include/envlock.h b/newlib/libc/include/envlock.h index 9bb6a813e..799cf7f9e 100644 --- a/newlib/libc/include/envlock.h +++ b/newlib/libc/include/envlock.h @@ -9,7 +9,7 @@ #define ENV_LOCK __env_lock(reent_ptr) #define ENV_UNLOCK __env_unlock(reent_ptr) -void _EXFUN(__env_lock,(struct _reent *reent)); -void _EXFUN(__env_unlock,(struct _reent *reent)); +void __env_lock (struct _reent *reent); +void __env_unlock (struct _reent *reent); #endif /* _INCLUDE_ENVLOCK_H_ */ diff --git a/newlib/libc/include/getopt.h b/newlib/libc/include/getopt.h index e12d253d4..9bced42e4 100644 --- a/newlib/libc/include/getopt.h +++ b/newlib/libc/include/getopt.h @@ -153,31 +153,25 @@ extern "C" extern int optopt; /* function prototypes */ - int _EXFUN (getopt, - (int __argc, char *const __argv[], const char *__optstring)); + int getopt (int __argc, char *const __argv[], const char *__optstring); - int _EXFUN (getopt_long, - (int __argc, char *const __argv[], const char *__shortopts, - const struct option * __longopts, int *__longind)); + int getopt_long (int __argc, char *const __argv[], const char *__shortopts, + const struct option * __longopts, int *__longind); - int _EXFUN (getopt_long_only, - (int __argc, char *const __argv[], const char *__shortopts, - const struct option * __longopts, int *__longind)); + int getopt_long_only (int __argc, char *const __argv[], const char *__shortopts, + const struct option * __longopts, int *__longind); #ifdef __need_getopt_newlib - int _EXFUN (__getopt_r, - (int __argc, char *const __argv[], const char *__optstring, - struct getopt_data * __data)); + int __getopt_r (int __argc, char *const __argv[], const char *__optstring, + struct getopt_data * __data); - int _EXFUN (__getopt_long_r, - (int __argc, char *const __argv[], const char *__shortopts, + int __getopt_long_r (int __argc, char *const __argv[], const char *__shortopts, const struct option * __longopts, int *__longind, - struct getopt_data * __data)); + struct getopt_data * __data); - int _EXFUN (__getopt_long_only_r, - (int __argc, char *const __argv[], const char *__shortopts, + int __getopt_long_only_r (int __argc, char *const __argv[], const char *__shortopts, const struct option * __longopts, int *__longind, - struct getopt_data * __data)); + struct getopt_data * __data); #endif /* __need_getopt_newlib */ #ifdef __cplusplus diff --git a/newlib/libc/include/iconv.h b/newlib/libc/include/iconv.h index e19f73d85..37feb882f 100644 --- a/newlib/libc/include/iconv.h +++ b/newlib/libc/include/iconv.h @@ -38,25 +38,25 @@ _BEGIN_STD_C #ifndef _REENT_ONLY iconv_t -_EXFUN(iconv_open, (const char *, const char *)); +iconv_open (const char *, const char *); size_t -_EXFUN(iconv, (iconv_t, char **__restrict, size_t *__restrict, - char **__restrict, size_t *__restrict)); +iconv (iconv_t, char **__restrict, size_t *__restrict, + char **__restrict, size_t *__restrict); int -_EXFUN(iconv_close, (iconv_t)); +iconv_close (iconv_t); #endif iconv_t -_EXFUN(_iconv_open_r, (struct _reent *, const char *, const char *)); +_iconv_open_r (struct _reent *, const char *, const char *); size_t -_EXFUN(_iconv_r, (struct _reent *, iconv_t, const char **, - size_t *, char **, size_t *)); +_iconv_r (struct _reent *, iconv_t, const char **, + size_t *, char **, size_t *); int -_EXFUN(_iconv_close_r, (struct _reent *, iconv_t)); +_iconv_close_r (struct _reent *, iconv_t); _END_STD_C diff --git a/newlib/libc/include/ieeefp.h b/newlib/libc/include/ieeefp.h index 2c042848b..2d6421a4c 100644 --- a/newlib/libc/include/ieeefp.h +++ b/newlib/libc/include/ieeefp.h @@ -215,8 +215,8 @@ typedef int fp_rnd; #define FP_RP 2 /* Round up */ #define FP_RZ 3 /* Round to zero (trunate) */ -fp_rnd _EXFUN(fpgetround,(void)); -fp_rnd _EXFUN(fpsetround, (fp_rnd)); +fp_rnd fpgetround (void); +fp_rnd fpsetround (fp_rnd); /* EXCEPTIONS */ @@ -227,10 +227,10 @@ typedef int fp_except; #define FP_X_UFL 0x02 /* Underflow exception */ #define FP_X_IMP 0x01 /* imprecise exception */ -fp_except _EXFUN(fpgetmask,(void)); -fp_except _EXFUN(fpsetmask,(fp_except)); -fp_except _EXFUN(fpgetsticky,(void)); -fp_except _EXFUN(fpsetsticky, (fp_except)); +fp_except fpgetmask (void); +fp_except fpsetmask (fp_except); +fp_except fpgetsticky (void); +fp_except fpsetsticky (fp_except); /* INTEGER ROUNDING */ @@ -238,8 +238,8 @@ typedef int fp_rdi; #define FP_RDI_TOZ 0 /* Round to Zero */ #define FP_RDI_RD 1 /* Follow float mode */ -fp_rdi _EXFUN(fpgetroundtoi,(void)); -fp_rdi _EXFUN(fpsetroundtoi,(fp_rdi)); +fp_rdi fpgetroundtoi (void); +fp_rdi fpsetroundtoi (fp_rdi); #define __IEEE_DBL_EXPBIAS 1023 #define __IEEE_FLT_EXPBIAS 127 diff --git a/newlib/libc/include/libgen.h b/newlib/libc/include/libgen.h index 3c717c5b0..414b5aa18 100644 --- a/newlib/libc/include/libgen.h +++ b/newlib/libc/include/libgen.h @@ -26,8 +26,8 @@ extern "C" { sure here. */ #undef basename #define basename __xpg_basename -char *_EXFUN(basename, (char *)) __asm__(__ASMNAME("basename")); -char *_EXFUN(dirname, (char *)); +char *basename (char *) __asm__(__ASMNAME("basename")); +char *dirname (char *); #ifdef __cplusplus } diff --git a/newlib/libc/include/locale.h b/newlib/libc/include/locale.h index 8ba88a90c..d11eb00fb 100644 --- a/newlib/libc/include/locale.h +++ b/newlib/libc/include/locale.h @@ -68,8 +68,8 @@ struct lconv }; struct _reent; -char *_EXFUN(_setlocale_r,(struct _reent *, int, const char *)); -struct lconv *_EXFUN(_localeconv_r,(struct _reent *)); +char *_setlocale_r (struct _reent *, int, const char *); +struct lconv *_localeconv_r (struct _reent *); struct __locale_t *_newlocale_r (struct _reent *, int, const char *, struct __locale_t *); @@ -79,8 +79,8 @@ struct __locale_t *_uselocale_r (struct _reent *, struct __locale_t *); #ifndef _REENT_ONLY -char *_EXFUN(setlocale,(int, const char *)); -struct lconv *_EXFUN(localeconv,(void)); +char *setlocale (int, const char *); +struct lconv *localeconv (void); #if __POSIX_VISIBLE >= 200809 locale_t newlocale (int, const char *, locale_t); diff --git a/newlib/libc/include/pthread.h b/newlib/libc/include/pthread.h index 493eafd7e..3dee1c9ae 100644 --- a/newlib/libc/include/pthread.h +++ b/newlib/libc/include/pthread.h @@ -39,34 +39,32 @@ struct _pthread_cleanup_context { }; /* Register Fork Handlers */ -int _EXFUN(pthread_atfork,(void (*prepare)(void), void (*parent)(void), - void (*child)(void))); +int pthread_atfork (void (*prepare)(void), void (*parent)(void), + void (*child)(void)); /* Mutex Initialization Attributes, P1003.1c/Draft 10, p. 81 */ -int _EXFUN(pthread_mutexattr_init, (pthread_mutexattr_t *__attr)); -int _EXFUN(pthread_mutexattr_destroy, (pthread_mutexattr_t *__attr)); -int _EXFUN(pthread_mutexattr_getpshared, - (const pthread_mutexattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_mutexattr_setpshared, - (pthread_mutexattr_t *__attr, int __pshared)); +int pthread_mutexattr_init (pthread_mutexattr_t *__attr); +int pthread_mutexattr_destroy (pthread_mutexattr_t *__attr); +int pthread_mutexattr_getpshared (const pthread_mutexattr_t *__attr, + int *__pshared); +int pthread_mutexattr_setpshared (pthread_mutexattr_t *__attr, + int __pshared); #if defined(_UNIX98_THREAD_MUTEX_ATTRIBUTES) /* Single UNIX Specification 2 Mutex Attributes types */ -int _EXFUN(pthread_mutexattr_gettype, - (const pthread_mutexattr_t *__attr, int *__kind)); -int _EXFUN(pthread_mutexattr_settype, - (pthread_mutexattr_t *__attr, int __kind)); +int pthread_mutexattr_gettype (const pthread_mutexattr_t *__attr, int *__kind); +int pthread_mutexattr_settype (pthread_mutexattr_t *__attr, int __kind); #endif /* Initializing and Destroying a Mutex, P1003.1c/Draft 10, p. 87 */ -int _EXFUN(pthread_mutex_init, - (pthread_mutex_t *__mutex, const pthread_mutexattr_t *__attr)); -int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex)); +int pthread_mutex_init (pthread_mutex_t *__mutex, + const pthread_mutexattr_t *__attr); +int pthread_mutex_destroy (pthread_mutex_t *__mutex); /* This is used to statically initialize a pthread_mutex_t. Example: @@ -78,38 +76,36 @@ int _EXFUN(pthread_mutex_destroy, (pthread_mutex_t *__mutex)); /* Locking and Unlocking a Mutex, P1003.1c/Draft 10, p. 93 NOTE: P1003.4b/D8 adds pthread_mutex_timedlock(), p. 29 */ -int _EXFUN(pthread_mutex_lock, (pthread_mutex_t *__mutex)); -int _EXFUN(pthread_mutex_trylock, (pthread_mutex_t *__mutex)); -int _EXFUN(pthread_mutex_unlock, (pthread_mutex_t *__mutex)); +int pthread_mutex_lock (pthread_mutex_t *__mutex); +int pthread_mutex_trylock (pthread_mutex_t *__mutex); +int pthread_mutex_unlock (pthread_mutex_t *__mutex); #if defined(_POSIX_TIMEOUTS) -int _EXFUN(pthread_mutex_timedlock, - (pthread_mutex_t *__mutex, const struct timespec *__timeout)); +int pthread_mutex_timedlock (pthread_mutex_t *__mutex, + const struct timespec *__timeout); #endif /* _POSIX_TIMEOUTS */ /* Condition Variable Initialization Attributes, P1003.1c/Draft 10, p. 96 */ -int _EXFUN(pthread_condattr_init, (pthread_condattr_t *__attr)); -int _EXFUN(pthread_condattr_destroy, (pthread_condattr_t *__attr)); +int pthread_condattr_init (pthread_condattr_t *__attr); +int pthread_condattr_destroy (pthread_condattr_t *__attr); -int _EXFUN(pthread_condattr_getclock, - (const pthread_condattr_t *__restrict __attr, - clockid_t *__restrict __clock_id)); -int _EXFUN(pthread_condattr_setclock, - (pthread_condattr_t *__attr, clockid_t __clock_id)); +int pthread_condattr_getclock (const pthread_condattr_t *__restrict __attr, + clockid_t *__restrict __clock_id); +int pthread_condattr_setclock (pthread_condattr_t *__attr, + clockid_t __clock_id); -int _EXFUN(pthread_condattr_getpshared, - (const pthread_condattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_condattr_setpshared, - (pthread_condattr_t *__attr, int __pshared)); +int pthread_condattr_getpshared (const pthread_condattr_t *__attr, + int *__pshared); +int pthread_condattr_setpshared (pthread_condattr_t *__attr, int __pshared); /* Initializing and Destroying a Condition Variable, P1003.1c/Draft 10, p. 87 */ -int _EXFUN(pthread_cond_init, - (pthread_cond_t *__cond, const pthread_condattr_t *__attr)); -int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex)); +int pthread_cond_init (pthread_cond_t *__cond, + const pthread_condattr_t *__attr); +int pthread_cond_destroy (pthread_cond_t *__mutex); /* This is used to statically initialize a pthread_cond_t. Example: @@ -120,53 +116,50 @@ int _EXFUN(pthread_cond_destroy, (pthread_cond_t *__mutex)); /* Broadcasting and Signaling a Condition, P1003.1c/Draft 10, p. 101 */ -int _EXFUN(pthread_cond_signal, (pthread_cond_t *__cond)); -int _EXFUN(pthread_cond_broadcast, (pthread_cond_t *__cond)); +int pthread_cond_signal (pthread_cond_t *__cond); +int pthread_cond_broadcast (pthread_cond_t *__cond); /* Waiting on a Condition, P1003.1c/Draft 10, p. 105 */ -int _EXFUN(pthread_cond_wait, - (pthread_cond_t *__cond, pthread_mutex_t *__mutex)); +int pthread_cond_wait (pthread_cond_t *__cond, pthread_mutex_t *__mutex); -int _EXFUN(pthread_cond_timedwait, - (pthread_cond_t *__cond, pthread_mutex_t *__mutex, - const struct timespec *__abstime)); +int pthread_cond_timedwait (pthread_cond_t *__cond, + pthread_mutex_t *__mutex, + const struct timespec *__abstime); #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) /* Thread Creation Scheduling Attributes, P1003.1c/Draft 10, p. 120 */ -int _EXFUN(pthread_attr_setscope, - (pthread_attr_t *__attr, int __contentionscope)); -int _EXFUN(pthread_attr_getscope, - (const pthread_attr_t *__attr, int *__contentionscope)); -int _EXFUN(pthread_attr_setinheritsched, - (pthread_attr_t *__attr, int __inheritsched)); -int _EXFUN(pthread_attr_getinheritsched, - (const pthread_attr_t *__attr, int *__inheritsched)); -int _EXFUN(pthread_attr_setschedpolicy, - (pthread_attr_t *__attr, int __policy)); -int _EXFUN(pthread_attr_getschedpolicy, - (const pthread_attr_t *__attr, int *__policy)); +int pthread_attr_setscope (pthread_attr_t *__attr, int __contentionscope); +int pthread_attr_getscope (const pthread_attr_t *__attr, + int *__contentionscope); +int pthread_attr_setinheritsched (pthread_attr_t *__attr, + int __inheritsched); +int pthread_attr_getinheritsched (const pthread_attr_t *__attr, + int *__inheritsched); +int pthread_attr_setschedpolicy (pthread_attr_t *__attr, int __policy); +int pthread_attr_getschedpolicy (const pthread_attr_t *__attr, + int *__policy); #endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ -int _EXFUN(pthread_attr_setschedparam, - (pthread_attr_t *__attr, const struct sched_param *__param)); -int _EXFUN(pthread_attr_getschedparam, - (const pthread_attr_t *__attr, struct sched_param *__param)); +int pthread_attr_setschedparam (pthread_attr_t *__attr, + const struct sched_param *__param); +int pthread_attr_getschedparam (const pthread_attr_t *__attr, + struct sched_param *__param); #if defined(_POSIX_THREAD_PRIORITY_SCHEDULING) /* Dynamic Thread Scheduling Parameters Access, P1003.1c/Draft 10, p. 124 */ -int _EXFUN(pthread_getschedparam, - (pthread_t __pthread, int *__policy, struct sched_param *__param)); -int _EXFUN(pthread_setschedparam, - (pthread_t __pthread, int __policy, struct sched_param *__param)); +int pthread_getschedparam (pthread_t __pthread, int *__policy, + struct sched_param *__param); +int pthread_setschedparam (pthread_t __pthread, int __policy, + struct sched_param *__param); /* Set Scheduling Priority of a Thread */ -int _EXFUN(pthread_setschedprio, (pthread_t thread, int prio)); +int pthread_setschedprio (pthread_t thread, int prio); #endif /* defined(_POSIX_THREAD_PRIORITY_SCHEDULING) */ @@ -180,14 +173,14 @@ int pthread_setname_np(pthread_t, const char *) __nonnull((2)); /* Mutex Initialization Scheduling Attributes, P1003.1c/Draft 10, p. 128 */ -int _EXFUN(pthread_mutexattr_setprotocol, - (pthread_mutexattr_t *__attr, int __protocol)); -int _EXFUN(pthread_mutexattr_getprotocol, - (const pthread_mutexattr_t *__attr, int *__protocol)); -int _EXFUN(pthread_mutexattr_setprioceiling, - (pthread_mutexattr_t *__attr, int __prioceiling)); -int _EXFUN(pthread_mutexattr_getprioceiling, - (const pthread_mutexattr_t *__attr, int *__prioceiling)); +int pthread_mutexattr_setprotocol (pthread_mutexattr_t *__attr, + int __protocol); +int pthread_mutexattr_getprotocol (const pthread_mutexattr_t *__attr, + int *__protocol); +int pthread_mutexattr_setprioceiling (pthread_mutexattr_t *__attr, + int __prioceiling); +int pthread_mutexattr_getprioceiling (const pthread_mutexattr_t *__attr, + int *__prioceiling); #endif /* _POSIX_THREAD_PRIO_INHERIT || _POSIX_THREAD_PRIO_PROTECT */ @@ -195,37 +188,33 @@ int _EXFUN(pthread_mutexattr_getprioceiling, /* Change the Priority Ceiling of a Mutex, P1003.1c/Draft 10, p. 131 */ -int _EXFUN(pthread_mutex_setprioceiling, - (pthread_mutex_t *__mutex, int __prioceiling, int *__old_ceiling)); -int _EXFUN(pthread_mutex_getprioceiling, - (pthread_mutex_t *__mutex, int *__prioceiling)); +int pthread_mutex_setprioceiling (pthread_mutex_t *__mutex, + int __prioceiling, int *__old_ceiling); +int pthread_mutex_getprioceiling (pthread_mutex_t *__mutex, + int *__prioceiling); #endif /* _POSIX_THREAD_PRIO_PROTECT */ /* Thread Creation Attributes, P1003.1c/Draft 10, p, 140 */ -int _EXFUN(pthread_attr_init, (pthread_attr_t *__attr)); -int _EXFUN(pthread_attr_destroy, (pthread_attr_t *__attr)); -int _EXFUN(pthread_attr_setstack, (pthread_attr_t *attr, - void *__stackaddr, size_t __stacksize)); -int _EXFUN(pthread_attr_getstack, (const pthread_attr_t *attr, - void **__stackaddr, size_t *__stacksize)); -int _EXFUN(pthread_attr_getstacksize, - (const pthread_attr_t *__attr, size_t *__stacksize)); -int _EXFUN(pthread_attr_setstacksize, - (pthread_attr_t *__attr, size_t __stacksize)); -int _EXFUN(pthread_attr_getstackaddr, - (const pthread_attr_t *__attr, void **__stackaddr)); -int _EXFUN(pthread_attr_setstackaddr, - (pthread_attr_t *__attr, void *__stackaddr)); -int _EXFUN(pthread_attr_getdetachstate, - (const pthread_attr_t *__attr, int *__detachstate)); -int _EXFUN(pthread_attr_setdetachstate, - (pthread_attr_t *__attr, int __detachstate)); -int _EXFUN(pthread_attr_getguardsize, - (const pthread_attr_t *__attr, size_t *__guardsize)); -int _EXFUN(pthread_attr_setguardsize, - (pthread_attr_t *__attr, size_t __guardsize)); +int pthread_attr_init (pthread_attr_t *__attr); +int pthread_attr_destroy (pthread_attr_t *__attr); +int pthread_attr_setstack (pthread_attr_t *attr, + void *__stackaddr, size_t __stacksize); +int pthread_attr_getstack (const pthread_attr_t *attr, + void **__stackaddr, size_t *__stacksize); +int pthread_attr_getstacksize (const pthread_attr_t *__attr, + size_t *__stacksize); +int pthread_attr_setstacksize (pthread_attr_t *__attr, size_t __stacksize); +int pthread_attr_getstackaddr (const pthread_attr_t *__attr, + void **__stackaddr); +int pthread_attr_setstackaddr (pthread_attr_t *__attr, void *__stackaddr); +int pthread_attr_getdetachstate (const pthread_attr_t *__attr, + int *__detachstate); +int pthread_attr_setdetachstate (pthread_attr_t *__attr, int __detachstate); +int pthread_attr_getguardsize (const pthread_attr_t *__attr, + size_t *__guardsize); +int pthread_attr_setguardsize (pthread_attr_t *__attr, size_t __guardsize); /* POSIX thread APIs beyond the POSIX standard but provided * in GNU/Linux. They may be provided by other OSes for @@ -233,59 +222,55 @@ int _EXFUN(pthread_attr_setguardsize, */ #if __GNU_VISIBLE #if defined(__rtems__) -int _EXFUN(pthread_attr_setaffinity_np, - (pthread_attr_t *__attr, size_t __cpusetsize, - const cpu_set_t *__cpuset)); -int _EXFUN(pthread_attr_getaffinity_np, - (const pthread_attr_t *__attr, size_t __cpusetsize, - cpu_set_t *__cpuset)); +int pthread_attr_setaffinity_np (pthread_attr_t *__attr, + size_t __cpusetsize, + const cpu_set_t *__cpuset); +int pthread_attr_getaffinity_np (const pthread_attr_t *__attr, + size_t __cpusetsize, cpu_set_t *__cpuset); -int _EXFUN(pthread_setaffinity_np, - (pthread_t __id, size_t __cpusetsize, const cpu_set_t *__cpuset)); -int _EXFUN(pthread_getaffinity_np, - (const pthread_t __id, size_t __cpusetsize, cpu_set_t *__cpuset)); +int pthread_setaffinity_np (pthread_t __id, size_t __cpusetsize, + const cpu_set_t *__cpuset); +int pthread_getaffinity_np (const pthread_t __id, size_t __cpusetsize, + cpu_set_t *__cpuset); -int _EXFUN(pthread_getattr_np, - (pthread_t __id, pthread_attr_t *__attr)); +int pthread_getattr_np (pthread_t __id, pthread_attr_t *__attr); #endif /* defined(__rtems__) */ #endif /* __GNU_VISIBLE */ /* Thread Creation, P1003.1c/Draft 10, p. 144 */ -int _EXFUN(pthread_create, - (pthread_t *__pthread, const pthread_attr_t *__attr, - void *(*__start_routine)( void * ), void *__arg)); +int pthread_create (pthread_t *__pthread, const pthread_attr_t *__attr, + void *(*__start_routine)(void *), void *__arg); /* Wait for Thread Termination, P1003.1c/Draft 10, p. 147 */ -int _EXFUN(pthread_join, (pthread_t __pthread, void **__value_ptr)); +int pthread_join (pthread_t __pthread, void **__value_ptr); /* Detaching a Thread, P1003.1c/Draft 10, p. 149 */ -int _EXFUN(pthread_detach, (pthread_t __pthread)); +int pthread_detach (pthread_t __pthread); /* Thread Termination, p1003.1c/Draft 10, p. 150 */ -void _EXFUN(pthread_exit, (void *__value_ptr)) __dead2; +void pthread_exit (void *__value_ptr) __dead2; /* Get Calling Thread's ID, p1003.1c/Draft 10, p. XXX */ -pthread_t _EXFUN(pthread_self, (void)); +pthread_t pthread_self (void); /* Compare Thread IDs, p1003.1c/Draft 10, p. 153 */ -int _EXFUN(pthread_equal, (pthread_t __t1, pthread_t __t2)); +int pthread_equal (pthread_t __t1, pthread_t __t2); /* Retrieve ID of a Thread's CPU Time Clock */ -int _EXFUN(pthread_getcpuclockid, - (pthread_t thread, clockid_t *clock_id)); +int pthread_getcpuclockid (pthread_t thread, clockid_t *clock_id); /* Get/Set Current Thread's Concurrency Level */ -int _EXFUN(pthread_setconcurrency, (int new_level)); -int _EXFUN(pthread_getconcurrency, (void)); +int pthread_setconcurrency (int new_level); +int pthread_getconcurrency (void); #if __BSD_VISIBLE || __GNU_VISIBLE -void _EXFUN(pthread_yield, (void)); +void pthread_yield (void); #endif /* Dynamic Package Initialization */ @@ -298,23 +283,22 @@ void _EXFUN(pthread_yield, (void)); #define PTHREAD_ONCE_INIT _PTHREAD_ONCE_INIT -int _EXFUN(pthread_once, - (pthread_once_t *__once_control, void (*__init_routine)(void))); +int pthread_once (pthread_once_t *__once_control, + void (*__init_routine)(void)); /* Thread-Specific Data Key Create, P1003.1c/Draft 10, p. 163 */ -int _EXFUN(pthread_key_create, - (pthread_key_t *__key, void (*__destructor)( void * ))); +int pthread_key_create (pthread_key_t *__key, + void (*__destructor)(void *)); /* Thread-Specific Data Management, P1003.1c/Draft 10, p. 165 */ -int _EXFUN(pthread_setspecific, - (pthread_key_t __key, const void *__value)); -void * _EXFUN(pthread_getspecific, (pthread_key_t __key)); +int pthread_setspecific (pthread_key_t __key, const void *__value); +void * pthread_getspecific (pthread_key_t __key); /* Thread-Specific Data Key Deletion, P1003.1c/Draft 10, p. 167 */ -int _EXFUN(pthread_key_delete, (pthread_key_t __key)); +int pthread_key_delete (pthread_key_t __key); /* Execution of a Thread, P1003.1c/Draft 10, p. 181 */ @@ -326,23 +310,21 @@ int _EXFUN(pthread_key_delete, (pthread_key_t __key)); #define PTHREAD_CANCELED ((void *) -1) -int _EXFUN(pthread_cancel, (pthread_t __pthread)); +int pthread_cancel (pthread_t __pthread); /* Setting Cancelability State, P1003.1c/Draft 10, p. 183 */ -int _EXFUN(pthread_setcancelstate, (int __state, int *__oldstate)); -int _EXFUN(pthread_setcanceltype, (int __type, int *__oldtype)); -void _EXFUN(pthread_testcancel, (void)); +int pthread_setcancelstate (int __state, int *__oldstate); +int pthread_setcanceltype (int __type, int *__oldtype); +void pthread_testcancel (void); /* Establishing Cancellation Handlers, P1003.1c/Draft 10, p. 184 */ -void _EXFUN(_pthread_cleanup_push, - (struct _pthread_cleanup_context *_context, - void (*_routine)(void *), void *_arg)); +void _pthread_cleanup_push (struct _pthread_cleanup_context *_context, + void (*_routine)(void *), void *_arg); -void _EXFUN(_pthread_cleanup_pop, - (struct _pthread_cleanup_context *_context, - int _execute)); +void _pthread_cleanup_pop (struct _pthread_cleanup_context *_context, + int _execute); /* It is intentional to open and close the scope in two different macros */ #define pthread_cleanup_push(_routine, _arg) \ @@ -355,13 +337,11 @@ void _EXFUN(_pthread_cleanup_pop, } while (0) #if __GNU_VISIBLE -void _EXFUN(_pthread_cleanup_push_defer, - (struct _pthread_cleanup_context *_context, - void (*_routine)(void *), void *_arg)); +void _pthread_cleanup_push_defer (struct _pthread_cleanup_context *_context, + void (*_routine)(void *), void *_arg); -void _EXFUN(_pthread_cleanup_pop_restore, - (struct _pthread_cleanup_context *_context, - int _execute)); +void _pthread_cleanup_pop_restore (struct _pthread_cleanup_context *_context, + int _execute); /* It is intentional to open and close the scope in two different macros */ #define pthread_cleanup_push_defer_np(_routine, _arg) \ @@ -378,8 +358,7 @@ void _EXFUN(_pthread_cleanup_pop_restore, /* Accessing a Thread CPU-time Clock, P1003.4b/D8, p. 58 */ -int _EXFUN(pthread_getcpuclockid, - (pthread_t __pthread_id, clockid_t *__clock_id)); +int pthread_getcpuclockid (pthread_t __pthread_id, clockid_t *__clock_id); #endif /* defined(_POSIX_THREAD_CPUTIME) */ @@ -388,31 +367,30 @@ int _EXFUN(pthread_getcpuclockid, #if defined(_POSIX_BARRIERS) -int _EXFUN(pthread_barrierattr_init, (pthread_barrierattr_t *__attr)); -int _EXFUN(pthread_barrierattr_destroy, (pthread_barrierattr_t *__attr)); -int _EXFUN(pthread_barrierattr_getpshared, - (const pthread_barrierattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_barrierattr_setpshared, - (pthread_barrierattr_t *__attr, int __pshared)); +int pthread_barrierattr_init (pthread_barrierattr_t *__attr); +int pthread_barrierattr_destroy (pthread_barrierattr_t *__attr); +int pthread_barrierattr_getpshared (const pthread_barrierattr_t *__attr, + int *__pshared); +int pthread_barrierattr_setpshared (pthread_barrierattr_t *__attr, + int __pshared); #define PTHREAD_BARRIER_SERIAL_THREAD -1 -int _EXFUN(pthread_barrier_init, - (pthread_barrier_t *__barrier, - const pthread_barrierattr_t *__attr, unsigned __count)); -int _EXFUN(pthread_barrier_destroy, (pthread_barrier_t *__barrier)); -int _EXFUN(pthread_barrier_wait,(pthread_barrier_t *__barrier)); +int pthread_barrier_init (pthread_barrier_t *__barrier, + const pthread_barrierattr_t *__attr, + unsigned __count); +int pthread_barrier_destroy (pthread_barrier_t *__barrier); +int pthread_barrier_wait (pthread_barrier_t *__barrier); #endif /* defined(_POSIX_BARRIERS) */ #if defined(_POSIX_SPIN_LOCKS) -int _EXFUN(pthread_spin_init, - (pthread_spinlock_t *__spinlock, int __pshared)); -int _EXFUN(pthread_spin_destroy, (pthread_spinlock_t *__spinlock)); -int _EXFUN(pthread_spin_lock, (pthread_spinlock_t *__spinlock)); -int _EXFUN(pthread_spin_trylock, (pthread_spinlock_t *__spinlock)); -int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock)); +int pthread_spin_init (pthread_spinlock_t *__spinlock, int __pshared); +int pthread_spin_destroy (pthread_spinlock_t *__spinlock); +int pthread_spin_lock (pthread_spinlock_t *__spinlock); +int pthread_spin_trylock (pthread_spinlock_t *__spinlock); +int pthread_spin_unlock (pthread_spinlock_t *__spinlock); #endif /* defined(_POSIX_SPIN_LOCKS) */ @@ -425,25 +403,25 @@ int _EXFUN(pthread_spin_unlock, (pthread_spinlock_t *__spinlock)); #define PTHREAD_RWLOCK_INITIALIZER _PTHREAD_RWLOCK_INITIALIZER -int _EXFUN(pthread_rwlockattr_init, (pthread_rwlockattr_t *__attr)); -int _EXFUN(pthread_rwlockattr_destroy, (pthread_rwlockattr_t *__attr)); -int _EXFUN(pthread_rwlockattr_getpshared, - (const pthread_rwlockattr_t *__attr, int *__pshared)); -int _EXFUN(pthread_rwlockattr_setpshared, - (pthread_rwlockattr_t *__attr, int __pshared)); +int pthread_rwlockattr_init (pthread_rwlockattr_t *__attr); +int pthread_rwlockattr_destroy (pthread_rwlockattr_t *__attr); +int pthread_rwlockattr_getpshared (const pthread_rwlockattr_t *__attr, + int *__pshared); +int pthread_rwlockattr_setpshared (pthread_rwlockattr_t *__attr, + int __pshared); -int _EXFUN(pthread_rwlock_init, - (pthread_rwlock_t *__rwlock, const pthread_rwlockattr_t *__attr)); -int _EXFUN(pthread_rwlock_destroy, (pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_rdlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_tryrdlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_timedrdlock, - (pthread_rwlock_t *__rwlock, const struct timespec *__abstime)); -int _EXFUN(pthread_rwlock_unlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_wrlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_trywrlock,(pthread_rwlock_t *__rwlock)); -int _EXFUN(pthread_rwlock_timedwrlock, - (pthread_rwlock_t *__rwlock, const struct timespec *__abstime)); +int pthread_rwlock_init (pthread_rwlock_t *__rwlock, + const pthread_rwlockattr_t *__attr); +int pthread_rwlock_destroy (pthread_rwlock_t *__rwlock); +int pthread_rwlock_rdlock (pthread_rwlock_t *__rwlock); +int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock); +int pthread_rwlock_timedrdlock (pthread_rwlock_t *__rwlock, + const struct timespec *__abstime); +int pthread_rwlock_unlock (pthread_rwlock_t *__rwlock); +int pthread_rwlock_wrlock (pthread_rwlock_t *__rwlock); +int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock); +int pthread_rwlock_timedwrlock (pthread_rwlock_t *__rwlock, + const struct timespec *__abstime); #endif /* defined(_POSIX_READER_WRITER_LOCKS) */ diff --git a/newlib/libc/include/rpc/xdr.h b/newlib/libc/include/rpc/xdr.h index bda8e9926..139e0c7ce 100644 --- a/newlib/libc/include/rpc/xdr.h +++ b/newlib/libc/include/rpc/xdr.h @@ -292,51 +292,51 @@ struct xdr_discrim /* * These are the "generic" xdr routines. */ -extern bool_t _EXFUN (xdr_void, (void)); -extern bool_t _EXFUN (xdr_short, (XDR *, short *)); -extern bool_t _EXFUN (xdr_u_short, (XDR *, u_short *)); -extern bool_t _EXFUN (xdr_int, (XDR *, int *)); -extern bool_t _EXFUN (xdr_u_int, (XDR *, u_int *)); -extern bool_t _EXFUN (xdr_long, (XDR *, long *)); -extern bool_t _EXFUN (xdr_u_long, (XDR *, u_long *)); -extern bool_t _EXFUN (xdr_int8_t, (XDR *, int8_t *)); -extern bool_t _EXFUN (xdr_uint8_t, (XDR *, uint8_t *)); -extern bool_t _EXFUN (xdr_u_int8_t, (XDR *, u_int8_t *)); -extern bool_t _EXFUN (xdr_int16_t, (XDR *, int16_t *)); -extern bool_t _EXFUN (xdr_uint16_t, (XDR *, uint16_t *)); -extern bool_t _EXFUN (xdr_u_int16_t, (XDR *, u_int16_t *)); -extern bool_t _EXFUN (xdr_int32_t, (XDR *, int32_t *)); -extern bool_t _EXFUN (xdr_uint32_t, (XDR *, uint32_t *)); -extern bool_t _EXFUN (xdr_u_int32_t, (XDR *, u_int32_t *)); +extern bool_t xdr_void (void); +extern bool_t xdr_short (XDR *, short *); +extern bool_t xdr_u_short (XDR *, u_short *); +extern bool_t xdr_int (XDR *, int *); +extern bool_t xdr_u_int (XDR *, u_int *); +extern bool_t xdr_long (XDR *, long *); +extern bool_t xdr_u_long (XDR *, u_long *); +extern bool_t xdr_int8_t (XDR *, int8_t *); +extern bool_t xdr_uint8_t (XDR *, uint8_t *); +extern bool_t xdr_u_int8_t (XDR *, u_int8_t *); +extern bool_t xdr_int16_t (XDR *, int16_t *); +extern bool_t xdr_uint16_t (XDR *, uint16_t *); +extern bool_t xdr_u_int16_t (XDR *, u_int16_t *); +extern bool_t xdr_int32_t (XDR *, int32_t *); +extern bool_t xdr_uint32_t (XDR *, uint32_t *); +extern bool_t xdr_u_int32_t (XDR *, u_int32_t *); #if defined(___int64_t_defined) -extern bool_t _EXFUN (xdr_int64_t, (XDR *, int64_t *)); -extern bool_t _EXFUN (xdr_uint64_t, (XDR *, uint64_t *)); -extern bool_t _EXFUN (xdr_u_int64_t, (XDR *, u_int64_t *)); +extern bool_t xdr_int64_t (XDR *, int64_t *); +extern bool_t xdr_uint64_t (XDR *, uint64_t *); +extern bool_t xdr_u_int64_t (XDR *, u_int64_t *); #endif /* ___int64_t_defined */ -extern bool_t _EXFUN (xdr_bool, (XDR *, bool_t *)); -extern bool_t _EXFUN (xdr_enum, (XDR *, enum_t *)); -extern bool_t _EXFUN (xdr_array, (XDR *, char **, u_int *, u_int, u_int, xdrproc_t)); -extern bool_t _EXFUN (xdr_bytes, (XDR *, char **, u_int *, u_int)); -extern bool_t _EXFUN (xdr_opaque, (XDR *, char *, u_int)); -extern bool_t _EXFUN (xdr_string, (XDR *, char **, u_int)); -extern bool_t _EXFUN (xdr_union, (XDR *, enum_t *, char *, - const struct xdr_discrim *, xdrproc_t)); -extern bool_t _EXFUN (xdr_char, (XDR *, char *)); -extern bool_t _EXFUN (xdr_u_char, (XDR *, u_char *)); -extern bool_t _EXFUN (xdr_vector, (XDR *, char *, u_int, u_int, xdrproc_t)); -extern bool_t _EXFUN (xdr_float, (XDR *, float *)); -extern bool_t _EXFUN (xdr_double, (XDR *, double *)); -/* extern bool_t _EXFUN (xdr_quadruple, (XDR *, long double *)); */ -extern bool_t _EXFUN (xdr_reference, (XDR *, char **, u_int, xdrproc_t)); -extern bool_t _EXFUN (xdr_pointer, (XDR *, char **, u_int, xdrproc_t)); -extern bool_t _EXFUN (xdr_wrapstring, (XDR *, char **)); +extern bool_t xdr_bool (XDR *, bool_t *); +extern bool_t xdr_enum (XDR *, enum_t *); +extern bool_t xdr_array (XDR *, char **, u_int *, u_int, u_int, xdrproc_t); +extern bool_t xdr_bytes (XDR *, char **, u_int *, u_int); +extern bool_t xdr_opaque (XDR *, char *, u_int); +extern bool_t xdr_string (XDR *, char **, u_int); +extern bool_t xdr_union (XDR *, enum_t *, char *, + const struct xdr_discrim *, xdrproc_t); +extern bool_t xdr_char (XDR *, char *); +extern bool_t xdr_u_char (XDR *, u_char *); +extern bool_t xdr_vector (XDR *, char *, u_int, u_int, xdrproc_t); +extern bool_t xdr_float (XDR *, float *); +extern bool_t xdr_double (XDR *, double *); +/* extern bool_t xdr_quadruple (XDR *, long double *); */ +extern bool_t xdr_reference (XDR *, char **, u_int, xdrproc_t); +extern bool_t xdr_pointer (XDR *, char **, u_int, xdrproc_t); +extern bool_t xdr_wrapstring (XDR *, char **); #if defined(___int64_t_defined) -extern bool_t _EXFUN (xdr_hyper, (XDR *, quad_t *)); -extern bool_t _EXFUN (xdr_u_hyper, (XDR *, u_quad_t *)); -extern bool_t _EXFUN (xdr_longlong_t, (XDR *, quad_t *)); -extern bool_t _EXFUN (xdr_u_longlong_t, (XDR *, u_quad_t *)); +extern bool_t xdr_hyper (XDR *, quad_t *); +extern bool_t xdr_u_hyper (XDR *, u_quad_t *); +extern bool_t xdr_longlong_t (XDR *, quad_t *); +extern bool_t xdr_u_longlong_t (XDR *, u_quad_t *); #endif /* ___int64_t_defined */ -extern u_long _EXFUN (xdr_sizeof, (xdrproc_t, void *)); +extern u_long xdr_sizeof (xdrproc_t, void *); /* * Common opaque bytes objects used by many rpc protocols; @@ -349,7 +349,7 @@ struct netobj char *n_bytes; }; typedef struct netobj netobj; -extern bool_t _EXFUN (xdr_netobj, (XDR *, struct netobj *)); +extern bool_t xdr_netobj (XDR *, struct netobj *); /* * These are the public routines for the various implementations of @@ -357,30 +357,30 @@ extern bool_t _EXFUN (xdr_netobj, (XDR *, struct netobj *)); */ /* XDR using memory buffers */ -extern void _EXFUN (xdrmem_create, (XDR *, char *, u_int, enum xdr_op)); +extern void xdrmem_create (XDR *, char *, u_int, enum xdr_op); /* XDR using stdio library */ #if defined(_STDIO_H_) -extern void _EXFUN (xdrstdio_create, (XDR *, FILE *, enum xdr_op)); +extern void xdrstdio_create (XDR *, FILE *, enum xdr_op); #endif /* XDR pseudo records for tcp */ -extern void _EXFUN (xdrrec_create, (XDR *, u_int, u_int, void *, +extern void xdrrec_create (XDR *, u_int, u_int, void *, int (*) (void *, void *, int), - int (*) (void *, void *, int))); + int (*) (void *, void *, int)); /* make end of xdr record */ -extern bool_t _EXFUN (xdrrec_endofrecord, (XDR *, bool_t)); +extern bool_t xdrrec_endofrecord (XDR *, bool_t); /* move to beginning of next record */ -extern bool_t _EXFUN (xdrrec_skiprecord, (XDR *)); +extern bool_t xdrrec_skiprecord (XDR *); /* true if no more input */ -extern bool_t _EXFUN (xdrrec_eof, (XDR *)); -extern u_int _EXFUN (xdrrec_readbytes, (XDR *, caddr_t, u_int)); +extern bool_t xdrrec_eof (XDR *); +extern u_int xdrrec_readbytes (XDR *, caddr_t, u_int); /* free memory buffers for xdr */ -extern void _EXFUN (xdr_free, (xdrproc_t, void *)); +extern void xdr_free (xdrproc_t, void *); #ifdef __cplusplus } diff --git a/newlib/libc/include/setjmp.h b/newlib/libc/include/setjmp.h index 521eac5a1..a2830b275 100644 --- a/newlib/libc/include/setjmp.h +++ b/newlib/libc/include/setjmp.h @@ -12,12 +12,12 @@ _BEGIN_STD_C #ifdef __GNUC__ -void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)) +void longjmp (jmp_buf __jmpb, int __retval) __attribute__ ((__noreturn__)); #else -void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); +void longjmp (jmp_buf __jmpb, int __retval); #endif -int _EXFUN(setjmp,(jmp_buf __jmpb)); +int setjmp (jmp_buf __jmpb); _END_STD_C diff --git a/newlib/libc/include/signal.h b/newlib/libc/include/signal.h index 0324ae71a..23a9863e6 100644 --- a/newlib/libc/include/signal.h +++ b/newlib/libc/include/signal.h @@ -21,13 +21,13 @@ typedef _sig_func_ptr sighandler_t; /* glibc naming */ struct _reent; -_sig_func_ptr _EXFUN(_signal_r, (struct _reent *, int, _sig_func_ptr)); -int _EXFUN(_raise_r, (struct _reent *, int)); +_sig_func_ptr _signal_r (struct _reent *, int, _sig_func_ptr); +int _raise_r (struct _reent *, int); #ifndef _REENT_ONLY -_sig_func_ptr _EXFUN(signal, (int, _sig_func_ptr)); -int _EXFUN(raise, (int)); -void _EXFUN(psignal, (int, const char *)); +_sig_func_ptr signal (int, _sig_func_ptr); +int raise (int); +void psignal (int, const char *); #endif _END_STD_C diff --git a/newlib/libc/include/spawn.h b/newlib/libc/include/spawn.h index 5a6692f11..d172177b1 100644 --- a/newlib/libc/include/spawn.h +++ b/newlib/libc/include/spawn.h @@ -53,67 +53,52 @@ _BEGIN_STD_C * XXX both arrays should be __restrict, but this does not work when GCC * is invoked with -std=c99. */ -int _EXFUN(posix_spawn, (pid_t * __restrict, const char * __restrict, +int posix_spawn (pid_t * __restrict, const char * __restrict, const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict, - char * const [], char * const []) -); -int _EXFUN(posix_spawnp, (pid_t * __restrict, const char * __restrict, + char * const [], char * const []); +int posix_spawnp (pid_t * __restrict, const char * __restrict, const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict, - char * const [], char * const []) -); + char * const [], char * const []); /* * File descriptor actions */ -int _EXFUN(posix_spawn_file_actions_init, (posix_spawn_file_actions_t *)); -int _EXFUN(posix_spawn_file_actions_destroy, (posix_spawn_file_actions_t *)); +int posix_spawn_file_actions_init (posix_spawn_file_actions_t *); +int posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *); -int _EXFUN(posix_spawn_file_actions_addopen, - (posix_spawn_file_actions_t * __restrict, int, const char * __restrict, int, mode_t) -); -int _EXFUN(posix_spawn_file_actions_adddup2, - (posix_spawn_file_actions_t *, int, int) -); -int _EXFUN(posix_spawn_file_actions_addclose, - (posix_spawn_file_actions_t *, int) -); +int posix_spawn_file_actions_addopen (posix_spawn_file_actions_t * __restrict, + int, const char * __restrict, int, mode_t); +int posix_spawn_file_actions_adddup2 (posix_spawn_file_actions_t *, int, int); +int posix_spawn_file_actions_addclose (posix_spawn_file_actions_t *, int); /* * Spawn attributes */ -int _EXFUN(posix_spawnattr_init, (posix_spawnattr_t *)); -int _EXFUN(posix_spawnattr_destroy, (posix_spawnattr_t *)); +int posix_spawnattr_init (posix_spawnattr_t *); +int posix_spawnattr_destroy (posix_spawnattr_t *); -int _EXFUN(posix_spawnattr_getflags, - (const posix_spawnattr_t * __restrict, short * __restrict) -); -int _EXFUN(posix_spawnattr_getpgroup, - (const posix_spawnattr_t * __restrict, pid_t * __restrict)); -int _EXFUN(posix_spawnattr_getschedparam, - (const posix_spawnattr_t * __restrict, struct sched_param * __restrict) -); -int _EXFUN(posix_spawnattr_getschedpolicy, - (const posix_spawnattr_t * __restrict, int * __restrict) -); -int _EXFUN(posix_spawnattr_getsigdefault, - (const posix_spawnattr_t * __restrict, sigset_t * __restrict) -); -int _EXFUN(posix_spawnattr_getsigmask, - (const posix_spawnattr_t * __restrict, sigset_t * __restrict) -); +int posix_spawnattr_getflags (const posix_spawnattr_t * __restrict, + short * __restrict); +int posix_spawnattr_getpgroup (const posix_spawnattr_t * __restrict, + pid_t * __restrict); +int posix_spawnattr_getschedparam (const posix_spawnattr_t * __restrict, + struct sched_param * __restrict); +int posix_spawnattr_getschedpolicy (const posix_spawnattr_t * __restrict, + int * __restrict); +int posix_spawnattr_getsigdefault (const posix_spawnattr_t * __restrict, + sigset_t * __restrict); +int posix_spawnattr_getsigmask (const posix_spawnattr_t * __restrict, + sigset_t * __restrict); -int _EXFUN(posix_spawnattr_setflags, (posix_spawnattr_t *, short)); -int _EXFUN(posix_spawnattr_setpgroup, (posix_spawnattr_t *, pid_t)); -int _EXFUN(posix_spawnattr_setschedparam, - (posix_spawnattr_t * __restrict, const struct sched_param * __restrict) -); -int _EXFUN(posix_spawnattr_setschedpolicy, (posix_spawnattr_t *, int)); -int _EXFUN(posix_spawnattr_setsigdefault, - (posix_spawnattr_t * __restrict, const sigset_t * __restrict) -); -int _EXFUN(posix_spawnattr_setsigmask, - (posix_spawnattr_t * __restrict, const sigset_t * __restrict) -); +int posix_spawnattr_setflags (posix_spawnattr_t *, short); +int posix_spawnattr_setpgroup (posix_spawnattr_t *, pid_t); +int posix_spawnattr_setschedparam (posix_spawnattr_t * __restrict, + const struct sched_param * __restrict); +int posix_spawnattr_setschedpolicy (posix_spawnattr_t *, int); +int posix_spawnattr_setsigdefault (posix_spawnattr_t * __restrict, + const sigset_t * __restrict); +int posix_spawnattr_setsigmask (posix_spawnattr_t * __restrict, + const sigset_t * __restrict); _END_STD_C #endif /* !_SPAWN_H_ */ diff --git a/newlib/libc/include/stdio.h b/newlib/libc/include/stdio.h index 127145083..cbc0fa989 100644 --- a/newlib/libc/include/stdio.h +++ b/newlib/libc/include/stdio.h @@ -178,155 +178,155 @@ typedef _fpos64_t fpos64_t; #endif #if __POSIX_VISIBLE -char * _EXFUN(ctermid, (char *)); +char * ctermid (char *); #endif #if __XSI_VISIBLE && __XSI_VISIBLE < 600 -char * _EXFUN(cuserid, (char *)); +char * cuserid (char *); #endif -FILE * _EXFUN(tmpfile, (void)); -char * _EXFUN(tmpnam, (char *)); +FILE * tmpfile (void); +char * tmpnam (char *); #if __BSD_VISIBLE || __XSI_VISIBLE || __POSIX_VISIBLE >= 200112 -char * _EXFUN(tempnam, (const char *, const char *)); +char * tempnam (const char *, const char *); #endif -int _EXFUN(fclose, (FILE *)); -int _EXFUN(fflush, (FILE *)); -FILE * _EXFUN(freopen, (const char *__restrict, const char *__restrict, FILE *__restrict)); -void _EXFUN(setbuf, (FILE *__restrict, char *__restrict)); -int _EXFUN(setvbuf, (FILE *__restrict, char *__restrict, int, size_t)); -int _EXFUN(fprintf, (FILE *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(fscanf, (FILE *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__scanf__, 2, 3)))); -int _EXFUN(printf, (const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 1, 2)))); -int _EXFUN(scanf, (const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__scanf__, 1, 2)))); -int _EXFUN(sscanf, (const char *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__scanf__, 2, 3)))); -int _EXFUN(vfprintf, (FILE *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(vprintf, (const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 1, 0)))); -int _EXFUN(vsprintf, (char *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(fgetc, (FILE *)); -char * _EXFUN(fgets, (char *__restrict, int, FILE *__restrict)); -int _EXFUN(fputc, (int, FILE *)); -int _EXFUN(fputs, (const char *__restrict, FILE *__restrict)); -int _EXFUN(getc, (FILE *)); -int _EXFUN(getchar, (void)); -char * _EXFUN(gets, (char *)); -int _EXFUN(putc, (int, FILE *)); -int _EXFUN(putchar, (int)); -int _EXFUN(puts, (const char *)); -int _EXFUN(ungetc, (int, FILE *)); -size_t _EXFUN(fread, (void *__restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(fwrite, (const void *__restrict , size_t _size, size_t _n, FILE *)); +int fclose (FILE *); +int fflush (FILE *); +FILE * freopen (const char *__restrict, const char *__restrict, FILE *__restrict); +void setbuf (FILE *__restrict, char *__restrict); +int setvbuf (FILE *__restrict, char *__restrict, int, size_t); +int fprintf (FILE *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int fscanf (FILE *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__scanf__, 2, 3))); +int printf (const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 1, 2))); +int scanf (const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__scanf__, 1, 2))); +int sscanf (const char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__scanf__, 2, 3))); +int vfprintf (FILE *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int vprintf (const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 1, 0))); +int vsprintf (char *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int fgetc (FILE *); +char * fgets (char *__restrict, int, FILE *__restrict); +int fputc (int, FILE *); +int fputs (const char *__restrict, FILE *__restrict); +int getc (FILE *); +int getchar (void); +char * gets (char *); +int putc (int, FILE *); +int putchar (int); +int puts (const char *); +int ungetc (int, FILE *); +size_t fread (void *__restrict, size_t _size, size_t _n, FILE *__restrict); +size_t fwrite (const void *__restrict , size_t _size, size_t _n, FILE *); #ifdef _COMPILING_NEWLIB -int _EXFUN(fgetpos, (FILE *, _fpos_t *)); +int fgetpos (FILE *, _fpos_t *); #else -int _EXFUN(fgetpos, (FILE *__restrict, fpos_t *__restrict)); +int fgetpos (FILE *__restrict, fpos_t *__restrict); #endif -int _EXFUN(fseek, (FILE *, long, int)); +int fseek (FILE *, long, int); #ifdef _COMPILING_NEWLIB -int _EXFUN(fsetpos, (FILE *, const _fpos_t *)); +int fsetpos (FILE *, const _fpos_t *); #else -int _EXFUN(fsetpos, (FILE *, const fpos_t *)); +int fsetpos (FILE *, const fpos_t *); #endif -long _EXFUN(ftell, ( FILE *)); -void _EXFUN(rewind, (FILE *)); -void _EXFUN(clearerr, (FILE *)); -int _EXFUN(feof, (FILE *)); -int _EXFUN(ferror, (FILE *)); -void _EXFUN(perror, (const char *)); +long ftell ( FILE *); +void rewind (FILE *); +void clearerr (FILE *); +int feof (FILE *); +int ferror (FILE *); +void perror (const char *); #ifndef _REENT_ONLY -FILE * _EXFUN(fopen, (const char *__restrict _name, const char *__restrict _type)); -int _EXFUN(sprintf, (char *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(remove, (const char *)); -int _EXFUN(rename, (const char *, const char *)); +FILE * fopen (const char *__restrict _name, const char *__restrict _type); +int sprintf (char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int remove (const char *); +int rename (const char *, const char *); #ifdef _COMPILING_NEWLIB -int _EXFUN(_rename, (const char *, const char *)); +int _rename (const char *, const char *); #endif #endif #if __LARGEFILE_VISIBLE || __POSIX_VISIBLE >= 200112 #ifdef _COMPILING_NEWLIB -int _EXFUN(fseeko, (FILE *, _off_t, int)); -_off_t _EXFUN(ftello, ( FILE *)); +int fseeko (FILE *, _off_t, int); +_off_t ftello (FILE *); #else -int _EXFUN(fseeko, (FILE *, off_t, int)); -off_t _EXFUN(ftello, ( FILE *)); +int fseeko (FILE *, off_t, int); +off_t ftello (FILE *); #endif #endif #if __GNU_VISIBLE -int _EXFUN(fcloseall, (void)); +int fcloseall (void); #endif #ifndef _REENT_ONLY #if __ISO_C_VISIBLE >= 1999 -int _EXFUN(snprintf, (char *__restrict, size_t, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(vsnprintf, (char *__restrict, size_t, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(vfscanf, (FILE *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); -int _EXFUN(vscanf, (const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 1, 0)))); -int _EXFUN(vsscanf, (const char *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); +int snprintf (char *__restrict, size_t, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int vsnprintf (char *__restrict, size_t, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int vfscanf (FILE *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 2, 0))); +int vscanf (const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 1, 0))); +int vsscanf (const char *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 2, 0))); #endif #if __GNU_VISIBLE -int _EXFUN(asprintf, (char **__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(vasprintf, (char **, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); +int asprintf (char **__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int vasprintf (char **, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); #endif #if __MISC_VISIBLE /* Newlib-specific */ -int _EXFUN(asiprintf, (char **, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -char * _EXFUN(asniprintf, (char *, size_t *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -char * _EXFUN(asnprintf, (char *__restrict, size_t *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); +int asiprintf (char **, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +char * asniprintf (char *, size_t *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +char * asnprintf (char *__restrict, size_t *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); #ifndef diprintf -int _EXFUN(diprintf, (int, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); +int diprintf (int, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); #endif -int _EXFUN(fiprintf, (FILE *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(fiscanf, (FILE *, const char *, ...) - _ATTRIBUTE ((__format__ (__scanf__, 2, 3)))); -int _EXFUN(iprintf, (const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 1, 2)))); -int _EXFUN(iscanf, (const char *, ...) - _ATTRIBUTE ((__format__ (__scanf__, 1, 2)))); -int _EXFUN(siprintf, (char *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(siscanf, (const char *, const char *, ...) - _ATTRIBUTE ((__format__ (__scanf__, 2, 3)))); -int _EXFUN(sniprintf, (char *, size_t, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(vasiprintf, (char **, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -char * _EXFUN(vasniprintf, (char *, size_t *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -char * _EXFUN(vasnprintf, (char *, size_t *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(vdiprintf, (int, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(vfiprintf, (FILE *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(vfiscanf, (FILE *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); -int _EXFUN(viprintf, (const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 1, 0)))); -int _EXFUN(viscanf, (const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 1, 0)))); -int _EXFUN(vsiprintf, (char *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(vsiscanf, (const char *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); -int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); +int fiprintf (FILE *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int fiscanf (FILE *, const char *, ...) + _ATTRIBUTE ((__format__ (__scanf__, 2, 3))); +int iprintf (const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 1, 2))); +int iscanf (const char *, ...) + _ATTRIBUTE ((__format__ (__scanf__, 1, 2))); +int siprintf (char *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int siscanf (const char *, const char *, ...) + _ATTRIBUTE ((__format__ (__scanf__, 2, 3))); +int sniprintf (char *, size_t, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int vasiprintf (char **, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +char * vasniprintf (char *, size_t *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +char * vasnprintf (char *, size_t *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int vdiprintf (int, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int vfiprintf (FILE *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int vfiscanf (FILE *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 2, 0))); +int viprintf (const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 1, 0))); +int viscanf (const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 1, 0))); +int vsiprintf (char *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int vsiscanf (const char *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 2, 0))); +int vsniprintf (char *, size_t, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); #endif /* __MISC_VISIBLE */ #endif /* !_REENT_ONLY */ @@ -336,32 +336,32 @@ int _EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST) #if __POSIX_VISIBLE #ifndef _REENT_ONLY -FILE * _EXFUN(fdopen, (int, const char *)); +FILE * fdopen (int, const char *); #endif -int _EXFUN(fileno, (FILE *)); +int fileno (FILE *); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE >= 199209 -int _EXFUN(pclose, (FILE *)); -FILE * _EXFUN(popen, (const char *, const char *)); +int pclose (FILE *); +FILE * popen (const char *, const char *); #endif #if __BSD_VISIBLE -void _EXFUN(setbuffer, (FILE *, char *, int)); -int _EXFUN(setlinebuf, (FILE *)); +void setbuffer (FILE *, char *, int); +int setlinebuf (FILE *); #endif #if __MISC_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112) -int _EXFUN(getw, (FILE *)); -int _EXFUN(putw, (int, FILE *)); +int getw (FILE *); +int putw (int, FILE *); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE -int _EXFUN(getc_unlocked, (FILE *)); -int _EXFUN(getchar_unlocked, (void)); -void _EXFUN(flockfile, (FILE *)); -int _EXFUN(ftrylockfile, (FILE *)); -void _EXFUN(funlockfile, (FILE *)); -int _EXFUN(putc_unlocked, (int, FILE *)); -int _EXFUN(putchar_unlocked, (int)); +int getc_unlocked (FILE *); +int getchar_unlocked (void); +void flockfile (FILE *); +int ftrylockfile (FILE *); +void funlockfile (FILE *); +int putc_unlocked (int, FILE *); +int putchar_unlocked (int); #endif /* @@ -371,21 +371,21 @@ int _EXFUN(putchar_unlocked, (int)); #if __POSIX_VISIBLE >= 200809 # ifndef _REENT_ONLY # ifndef dprintf -int _EXFUN(dprintf, (int, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); +int dprintf (int, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); # endif -FILE * _EXFUN(fmemopen, (void *__restrict, size_t, const char *__restrict)); +FILE * fmemopen (void *__restrict, size_t, const char *__restrict); /* getdelim - see __getdelim for now */ /* getline - see __getline for now */ -FILE * _EXFUN(open_memstream, (char **, size_t *)); -int _EXFUN(vdprintf, (int, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); +FILE * open_memstream (char **, size_t *); +int vdprintf (int, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); # endif #endif #if __ATFILE_VISIBLE -int _EXFUN(renameat, (int, const char *, int, const char *)); +int renameat (int, const char *, int, const char *); # ifdef __CYGWIN__ -int _EXFUN(renameat2, (int, const char *, int, const char *, unsigned int)); +int renameat2 (int, const char *, int, const char *, unsigned int); # endif #endif @@ -393,180 +393,180 @@ int _EXFUN(renameat2, (int, const char *, int, const char *, unsigned int)); * Recursive versions of the above. */ -int _EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -char * _EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 4, 5)))); -char * _EXFUN(_asnprintf_r, (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 4, 5)))); -int _EXFUN(_asprintf_r, (struct _reent *, char **__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_dprintf_r, (struct _reent *, int, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_fclose_r, (struct _reent *, FILE *)); -int _EXFUN(_fcloseall_r, (struct _reent *)); -FILE * _EXFUN(_fdopen_r, (struct _reent *, int, const char *)); -int _EXFUN(_fflush_r, (struct _reent *, FILE *)); -int _EXFUN(_fgetc_r, (struct _reent *, FILE *)); -int _EXFUN(_fgetc_unlocked_r, (struct _reent *, FILE *)); -char * _EXFUN(_fgets_r, (struct _reent *, char *__restrict, int, FILE *__restrict)); -char * _EXFUN(_fgets_unlocked_r, (struct _reent *, char *__restrict, int, FILE *__restrict)); +int _asiprintf_r (struct _reent *, char **, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +char * _asniprintf_r (struct _reent *, char *, size_t *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 4, 5))); +char * _asnprintf_r (struct _reent *, char *__restrict, size_t *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 4, 5))); +int _asprintf_r (struct _reent *, char **__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _diprintf_r (struct _reent *, int, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _dprintf_r (struct _reent *, int, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _fclose_r (struct _reent *, FILE *); +int _fcloseall_r (struct _reent *); +FILE * _fdopen_r (struct _reent *, int, const char *); +int _fflush_r (struct _reent *, FILE *); +int _fgetc_r (struct _reent *, FILE *); +int _fgetc_unlocked_r (struct _reent *, FILE *); +char * _fgets_r (struct _reent *, char *__restrict, int, FILE *__restrict); +char * _fgets_unlocked_r (struct _reent *, char *__restrict, int, FILE *__restrict); #ifdef _COMPILING_NEWLIB -int _EXFUN(_fgetpos_r, (struct _reent *, FILE *__restrict, _fpos_t *__restrict)); -int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const _fpos_t *)); +int _fgetpos_r (struct _reent *, FILE *__restrict, _fpos_t *__restrict); +int _fsetpos_r (struct _reent *, FILE *, const _fpos_t *); #else -int _EXFUN(_fgetpos_r, (struct _reent *, FILE *, fpos_t *)); -int _EXFUN(_fsetpos_r, (struct _reent *, FILE *, const fpos_t *)); +int _fgetpos_r (struct _reent *, FILE *, fpos_t *); +int _fsetpos_r (struct _reent *, FILE *, const fpos_t *); #endif -int _EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...) - _ATTRIBUTE ((__format__ (__scanf__, 3, 4)))); -FILE * _EXFUN(_fmemopen_r, (struct _reent *, void *__restrict, size_t, const char *__restrict)); -FILE * _EXFUN(_fopen_r, (struct _reent *, const char *__restrict, const char *__restrict)); -FILE * _EXFUN(_freopen_r, (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict)); -int _EXFUN(_fprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_fpurge_r, (struct _reent *, FILE *)); -int _EXFUN(_fputc_r, (struct _reent *, int, FILE *)); -int _EXFUN(_fputc_unlocked_r, (struct _reent *, int, FILE *)); -int _EXFUN(_fputs_r, (struct _reent *, const char *__restrict, FILE *__restrict)); -int _EXFUN(_fputs_unlocked_r, (struct _reent *, const char *__restrict, FILE *__restrict)); -size_t _EXFUN(_fread_r, (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(_fread_unlocked_r, (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict)); -int _EXFUN(_fscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__scanf__, 3, 4)))); -int _EXFUN(_fseek_r, (struct _reent *, FILE *, long, int)); -int _EXFUN(_fseeko_r,(struct _reent *, FILE *, _off_t, int)); -long _EXFUN(_ftell_r, (struct _reent *, FILE *)); -_off_t _EXFUN(_ftello_r,(struct _reent *, FILE *)); -void _EXFUN(_rewind_r, (struct _reent *, FILE *)); -size_t _EXFUN(_fwrite_r, (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(_fwrite_unlocked_r, (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict)); -int _EXFUN(_getc_r, (struct _reent *, FILE *)); -int _EXFUN(_getc_unlocked_r, (struct _reent *, FILE *)); -int _EXFUN(_getchar_r, (struct _reent *)); -int _EXFUN(_getchar_unlocked_r, (struct _reent *)); -char * _EXFUN(_gets_r, (struct _reent *, char *)); -int _EXFUN(_iprintf_r, (struct _reent *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(_iscanf_r, (struct _reent *, const char *, ...) - _ATTRIBUTE ((__format__ (__scanf__, 2, 3)))); -FILE * _EXFUN(_open_memstream_r, (struct _reent *, char **, size_t *)); -void _EXFUN(_perror_r, (struct _reent *, const char *)); -int _EXFUN(_printf_r, (struct _reent *, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 2, 3)))); -int _EXFUN(_putc_r, (struct _reent *, int, FILE *)); -int _EXFUN(_putc_unlocked_r, (struct _reent *, int, FILE *)); -int _EXFUN(_putchar_unlocked_r, (struct _reent *, int)); -int _EXFUN(_putchar_r, (struct _reent *, int)); -int _EXFUN(_puts_r, (struct _reent *, const char *)); -int _EXFUN(_remove_r, (struct _reent *, const char *)); -int _EXFUN(_rename_r, (struct _reent *, - const char *_old, const char *_new)); -int _EXFUN(_scanf_r, (struct _reent *, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__scanf__, 2, 3)))); -int _EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...) - _ATTRIBUTE ((__format__ (__scanf__, 3, 4)))); -int _EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 4, 5)))); -int _EXFUN(_snprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 4, 5)))); -int _EXFUN(_sprintf_r, (struct _reent *, char *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__printf__, 3, 4)))); -int _EXFUN(_sscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, ...) - _ATTRIBUTE ((__format__ (__scanf__, 3, 4)))); -char * _EXFUN(_tempnam_r, (struct _reent *, const char *, const char *)); -FILE * _EXFUN(_tmpfile_r, (struct _reent *)); -char * _EXFUN(_tmpnam_r, (struct _reent *, char *)); -int _EXFUN(_ungetc_r, (struct _reent *, int, FILE *)); -int _EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -char * _EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 4, 0)))); -char * _EXFUN(_vasnprintf_r, (struct _reent*, char *, size_t *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 4, 0)))); -int _EXFUN(_vasprintf_r, (struct _reent *, char **, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vdprintf_r, (struct _reent *, int, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 3, 0)))); -int _EXFUN(_vfprintf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vfscanf_r, (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 3, 0)))); -int _EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); -int _EXFUN(_vprintf_r, (struct _reent *, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 2, 0)))); -int _EXFUN(_vscanf_r, (struct _reent *, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 2, 0)))); -int _EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 3, 0)))); -int _EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 4, 0)))); -int _EXFUN(_vsnprintf_r, (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 4, 0)))); -int _EXFUN(_vsprintf_r, (struct _reent *, char *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_vsscanf_r, (struct _reent *, const char *__restrict, const char *__restrict, __VALIST) - _ATTRIBUTE ((__format__ (__scanf__, 3, 0)))); +int _fiprintf_r (struct _reent *, FILE *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _fiscanf_r (struct _reent *, FILE *, const char *, ...) + _ATTRIBUTE ((__format__ (__scanf__, 3, 4))); +FILE * _fmemopen_r (struct _reent *, void *__restrict, size_t, const char *__restrict); +FILE * _fopen_r (struct _reent *, const char *__restrict, const char *__restrict); +FILE * _freopen_r (struct _reent *, const char *__restrict, const char *__restrict, FILE *__restrict); +int _fprintf_r (struct _reent *, FILE *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _fpurge_r (struct _reent *, FILE *); +int _fputc_r (struct _reent *, int, FILE *); +int _fputc_unlocked_r (struct _reent *, int, FILE *); +int _fputs_r (struct _reent *, const char *__restrict, FILE *__restrict); +int _fputs_unlocked_r (struct _reent *, const char *__restrict, FILE *__restrict); +size_t _fread_r (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict); +size_t _fread_unlocked_r (struct _reent *, void *__restrict, size_t _size, size_t _n, FILE *__restrict); +int _fscanf_r (struct _reent *, FILE *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__scanf__, 3, 4))); +int _fseek_r (struct _reent *, FILE *, long, int); +int _fseeko_r (struct _reent *, FILE *, _off_t, int); +long _ftell_r (struct _reent *, FILE *); +_off_t _ftello_r (struct _reent *, FILE *); +void _rewind_r (struct _reent *, FILE *); +size_t _fwrite_r (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict); +size_t _fwrite_unlocked_r (struct _reent *, const void *__restrict, size_t _size, size_t _n, FILE *__restrict); +int _getc_r (struct _reent *, FILE *); +int _getc_unlocked_r (struct _reent *, FILE *); +int _getchar_r (struct _reent *); +int _getchar_unlocked_r (struct _reent *); +char * _gets_r (struct _reent *, char *); +int _iprintf_r (struct _reent *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int _iscanf_r (struct _reent *, const char *, ...) + _ATTRIBUTE ((__format__ (__scanf__, 2, 3))); +FILE * _open_memstream_r (struct _reent *, char **, size_t *); +void _perror_r (struct _reent *, const char *); +int _printf_r (struct _reent *, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 2, 3))); +int _putc_r (struct _reent *, int, FILE *); +int _putc_unlocked_r (struct _reent *, int, FILE *); +int _putchar_unlocked_r (struct _reent *, int); +int _putchar_r (struct _reent *, int); +int _puts_r (struct _reent *, const char *); +int _remove_r (struct _reent *, const char *); +int _rename_r (struct _reent *, + const char *_old, const char *_new); +int _scanf_r (struct _reent *, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__scanf__, 2, 3))); +int _siprintf_r (struct _reent *, char *, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _siscanf_r (struct _reent *, const char *, const char *, ...) + _ATTRIBUTE ((__format__ (__scanf__, 3, 4))); +int _sniprintf_r (struct _reent *, char *, size_t, const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 4, 5))); +int _snprintf_r (struct _reent *, char *__restrict, size_t, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 4, 5))); +int _sprintf_r (struct _reent *, char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__printf__, 3, 4))); +int _sscanf_r (struct _reent *, const char *__restrict, const char *__restrict, ...) + _ATTRIBUTE ((__format__ (__scanf__, 3, 4))); +char * _tempnam_r (struct _reent *, const char *, const char *); +FILE * _tmpfile_r (struct _reent *); +char * _tmpnam_r (struct _reent *, char *); +int _ungetc_r (struct _reent *, int, FILE *); +int _vasiprintf_r (struct _reent *, char **, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +char * _vasniprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 4, 0))); +char * _vasnprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 4, 0))); +int _vasprintf_r (struct _reent *, char **, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vdiprintf_r (struct _reent *, int, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vdprintf_r (struct _reent *, int, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vfiprintf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vfiscanf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 3, 0))); +int _vfprintf_r (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vfscanf_r (struct _reent *, FILE *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 3, 0))); +int _viprintf_r (struct _reent *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int _viscanf_r (struct _reent *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 2, 0))); +int _vprintf_r (struct _reent *, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 2, 0))); +int _vscanf_r (struct _reent *, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 2, 0))); +int _vsiprintf_r (struct _reent *, char *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vsiscanf_r (struct _reent *, const char *, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 3, 0))); +int _vsniprintf_r (struct _reent *, char *, size_t, const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 4, 0))); +int _vsnprintf_r (struct _reent *, char *__restrict, size_t, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 4, 0))); +int _vsprintf_r (struct _reent *, char *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _vsscanf_r (struct _reent *, const char *__restrict, const char *__restrict, __VALIST) + _ATTRIBUTE ((__format__ (__scanf__, 3, 0))); /* Other extensions. */ -int _EXFUN(fpurge, (FILE *)); -ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *)); -ssize_t _EXFUN(__getline, (char **, size_t *, FILE *)); +int fpurge (FILE *); +ssize_t __getdelim (char **, size_t *, int, FILE *); +ssize_t __getline (char **, size_t *, FILE *); #if __MISC_VISIBLE -void _EXFUN(clearerr_unlocked, (FILE *)); -int _EXFUN(feof_unlocked, (FILE *)); -int _EXFUN(ferror_unlocked, (FILE *)); -int _EXFUN(fileno_unlocked, (FILE *)); -int _EXFUN(fflush_unlocked, (FILE *)); -int _EXFUN(fgetc_unlocked, (FILE *)); -int _EXFUN(fputc_unlocked, (int, FILE *)); -size_t _EXFUN(fread_unlocked, (void *__restrict, size_t _size, size_t _n, FILE *__restrict)); -size_t _EXFUN(fwrite_unlocked, (const void *__restrict , size_t _size, size_t _n, FILE *)); +void clearerr_unlocked (FILE *); +int feof_unlocked (FILE *); +int ferror_unlocked (FILE *); +int fileno_unlocked (FILE *); +int fflush_unlocked (FILE *); +int fgetc_unlocked (FILE *); +int fputc_unlocked (int, FILE *); +size_t fread_unlocked (void *__restrict, size_t _size, size_t _n, FILE *__restrict); +size_t fwrite_unlocked (const void *__restrict , size_t _size, size_t _n, FILE *); #endif #if __GNU_VISIBLE -char * _EXFUN(fgets_unlocked, (char *__restrict, int, FILE *__restrict)); -int _EXFUN(fputs_unlocked, (const char *__restrict, FILE *__restrict)); +char * fgets_unlocked (char *__restrict, int, FILE *__restrict); +int fputs_unlocked (const char *__restrict, FILE *__restrict); #endif #ifdef __LARGE64_FILES #if !defined(__CYGWIN__) || defined(_COMPILING_NEWLIB) -FILE * _EXFUN(fdopen64, (int, const char *)); -FILE * _EXFUN(fopen64, (const char *, const char *)); -FILE * _EXFUN(freopen64, (const char *, const char *, FILE *)); -_off64_t _EXFUN(ftello64, (FILE *)); -_off64_t _EXFUN(fseeko64, (FILE *, _off64_t, int)); -int _EXFUN(fgetpos64, (FILE *, _fpos64_t *)); -int _EXFUN(fsetpos64, (FILE *, const _fpos64_t *)); -FILE * _EXFUN(tmpfile64, (void)); +FILE * fdopen64 (int, const char *); +FILE * fopen64 (const char *, const char *); +FILE * freopen64 (const char *, const char *, FILE *); +_off64_t ftello64 (FILE *); +_off64_t fseeko64 (FILE *, _off64_t, int); +int fgetpos64 (FILE *, _fpos64_t *); +int fsetpos64 (FILE *, const _fpos64_t *); +FILE * tmpfile64 (void); -FILE * _EXFUN(_fdopen64_r, (struct _reent *, int, const char *)); -FILE * _EXFUN(_fopen64_r, (struct _reent *,const char *, const char *)); -FILE * _EXFUN(_freopen64_r, (struct _reent *, const char *, const char *, FILE *)); -_off64_t _EXFUN(_ftello64_r, (struct _reent *, FILE *)); -_off64_t _EXFUN(_fseeko64_r, (struct _reent *, FILE *, _off64_t, int)); -int _EXFUN(_fgetpos64_r, (struct _reent *, FILE *, _fpos64_t *)); -int _EXFUN(_fsetpos64_r, (struct _reent *, FILE *, const _fpos64_t *)); -FILE * _EXFUN(_tmpfile64_r, (struct _reent *)); +FILE * _fdopen64_r (struct _reent *, int, const char *); +FILE * _fopen64_r (struct _reent *,const char *, const char *); +FILE * _freopen64_r (struct _reent *, const char *, const char *, FILE *); +_off64_t _ftello64_r (struct _reent *, FILE *); +_off64_t _fseeko64_r (struct _reent *, FILE *, _off64_t, int); +int _fgetpos64_r (struct _reent *, FILE *, _fpos64_t *); +int _fsetpos64_r (struct _reent *, FILE *, const _fpos64_t *); +FILE * _tmpfile64_r (struct _reent *); #endif /* !__CYGWIN__ */ #endif /* __LARGE64_FILES */ @@ -574,8 +574,8 @@ FILE * _EXFUN(_tmpfile64_r, (struct _reent *)); * Routines internal to the implementation. */ -int _EXFUN(__srget_r, (struct _reent *, FILE *)); -int _EXFUN(__swbuf_r, (struct _reent *, int, FILE *)); +int __srget_r (struct _reent *, FILE *); +int __swbuf_r (struct _reent *, int, FILE *); /* * Stdio function-access interface. @@ -583,35 +583,35 @@ int _EXFUN(__swbuf_r, (struct _reent *, int, FILE *)); #if __BSD_VISIBLE # ifdef __LARGE64_FILES -FILE *_EXFUN(funopen,(const void *__cookie, +FILE *funopen (const void *__cookie, int (*__readfn)(void *__c, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), int (*__writefn)(void *__c, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), _fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence), - int (*__closefn)(void *__c))); -FILE *_EXFUN(_funopen_r,(struct _reent *, const void *__cookie, + int (*__closefn)(void *__c)); +FILE *_funopen_r (struct _reent *, const void *__cookie, int (*__readfn)(void *__c, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), int (*__writefn)(void *__c, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), _fpos64_t (*__seekfn)(void *__c, _fpos64_t __off, int __whence), - int (*__closefn)(void *__c))); + int (*__closefn)(void *__c)); # else -FILE *_EXFUN(funopen,(const void *__cookie, +FILE *funopen (const void *__cookie, int (*__readfn)(void *__cookie, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), int (*__writefn)(void *__cookie, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence), - int (*__closefn)(void *__cookie))); -FILE *_EXFUN(_funopen_r,(struct _reent *, const void *__cookie, + int (*__closefn)(void *__cookie)); +FILE *_funopen_r (struct _reent *, const void *__cookie, int (*__readfn)(void *__cookie, char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), int (*__writefn)(void *__cookie, const char *__buf, _READ_WRITE_BUFSIZE_TYPE __n), fpos_t (*__seekfn)(void *__cookie, fpos_t __off, int __whence), - int (*__closefn)(void *__cookie))); + int (*__closefn)(void *__cookie)); # endif /* !__LARGE64_FILES */ # define fropen(__cookie, __fn) funopen(__cookie, __fn, (int (*)())0, \ @@ -640,10 +640,10 @@ typedef struct cookie_seek_function_t *seek; cookie_close_function_t *close; } cookie_io_functions_t; -FILE *_EXFUN(fopencookie,(void *__cookie, - const char *__mode, cookie_io_functions_t __functions)); -FILE *_EXFUN(_fopencookie_r,(struct _reent *, void *__cookie, - const char *__mode, cookie_io_functions_t __functions)); +FILE *fopencookie (void *__cookie, + const char *__mode, cookie_io_functions_t __functions); +FILE *_fopencookie_r (struct _reent *, void *__cookie, + const char *__mode, cookie_io_functions_t __functions); #endif /* __GNU_VISIBLE */ #ifndef __CUSTOM_FILE_IO__ diff --git a/newlib/libc/include/stdio_ext.h b/newlib/libc/include/stdio_ext.h index 029ab0253..231262d47 100644 --- a/newlib/libc/include/stdio_ext.h +++ b/newlib/libc/include/stdio_ext.h @@ -19,8 +19,8 @@ _BEGIN_STD_C -void _EXFUN(__fpurge,(FILE *)); -int _EXFUN(__fsetlocking,(FILE *, int)); +void __fpurge (FILE *); +int __fsetlocking (FILE *, int); /* TODO: @@ -52,13 +52,13 @@ __fpending (FILE *__fp) { return __fp->_p - __fp->_bf._base; } #else -size_t _EXFUN(__fbufsize,(FILE *)); -int _EXFUN(__freading,(FILE *)); -int _EXFUN(__fwriting,(FILE *)); -int _EXFUN(__freadable,(FILE *)); -int _EXFUN(__fwritable,(FILE *)); -int _EXFUN(__flbf,(FILE *)); -size_t _EXFUN(__fpending,(FILE *)); +size_t __fbufsize (FILE *); +int __freading (FILE *); +int __fwriting (FILE *); +int __freadable (FILE *); +int __fwritable (FILE *); +int __flbf (FILE *); +size_t __fpending (FILE *); #ifndef __cplusplus diff --git a/newlib/libc/include/stdlib.h b/newlib/libc/include/stdlib.h index 80f15f4e9..ef0e4bdda 100644 --- a/newlib/libc/include/stdlib.h +++ b/newlib/libc/include/stdlib.h @@ -62,102 +62,102 @@ typedef int (*__compar_fn_t) (const void *, const void *); #define RAND_MAX __RAND_MAX -int _EXFUN(__locale_mb_cur_max,(void)); +int __locale_mb_cur_max (void); #define MB_CUR_MAX __locale_mb_cur_max() -void _EXFUN(abort,(void) _ATTRIBUTE ((__noreturn__))); -int _EXFUN(abs,(int)); +void abort (void) _ATTRIBUTE ((__noreturn__)); +int abs (int); #if __BSD_VISIBLE -__uint32_t _EXFUN(arc4random, (void)); -__uint32_t _EXFUN(arc4random_uniform, (__uint32_t)); -void _EXFUN(arc4random_buf, (void *, size_t)); +__uint32_t arc4random (void); +__uint32_t arc4random_uniform (__uint32_t); +void arc4random_buf (void *, size_t); #endif -int _EXFUN(atexit,(void (*__func)(void))); -double _EXFUN(atof,(const char *__nptr)); +int atexit (void (*__func)(void)); +double atof (const char *__nptr); #if __MISC_VISIBLE -float _EXFUN(atoff,(const char *__nptr)); +float atoff (const char *__nptr); #endif -int _EXFUN(atoi,(const char *__nptr)); -int _EXFUN(_atoi_r,(struct _reent *, const char *__nptr)); -long _EXFUN(atol,(const char *__nptr)); -long _EXFUN(_atol_r,(struct _reent *, const char *__nptr)); -void * _EXFUN(bsearch,(const void *__key, +int atoi (const char *__nptr); +int _atoi_r (struct _reent *, const char *__nptr); +long atol (const char *__nptr); +long _atol_r (struct _reent *, const char *__nptr); +void * bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size, - __compar_fn_t _compar)); -void * _EXFUN_NOTHROW(calloc,(size_t __nmemb, size_t __size)); -div_t _EXFUN(div,(int __numer, int __denom)); -void _EXFUN(exit,(int __status) _ATTRIBUTE ((__noreturn__))); -void _EXFUN_NOTHROW(free,(void *)); -char * _EXFUN(getenv,(const char *__string)); -char * _EXFUN(_getenv_r,(struct _reent *, const char *__string)); -char * _EXFUN(_findenv,(const char *, int *)); -char * _EXFUN(_findenv_r,(struct _reent *, const char *, int *)); + __compar_fn_t _compar); +void * calloc (size_t __nmemb, size_t __size) _NOTHROW; +div_t div (int __numer, int __denom); +void exit (int __status) _ATTRIBUTE ((__noreturn__)); +void free (void *) _NOTHROW; +char * getenv (const char *__string); +char * _getenv_r (struct _reent *, const char *__string); +char * _findenv (const char *, int *); +char * _findenv_r (struct _reent *, const char *, int *); #if __POSIX_VISIBLE >= 200809 extern char *suboptarg; /* getsubopt(3) external variable */ -int _EXFUN(getsubopt,(char **, char * const *, char **)); +int getsubopt (char **, char * const *, char **); #endif -long _EXFUN(labs,(long)); -ldiv_t _EXFUN(ldiv,(long __numer, long __denom)); -void * _EXFUN_NOTHROW(malloc,(size_t __size)); -int _EXFUN(mblen,(const char *, size_t)); -int _EXFUN(_mblen_r,(struct _reent *, const char *, size_t, _mbstate_t *)); -int _EXFUN(mbtowc,(wchar_t *__restrict, const char *__restrict, size_t)); -int _EXFUN(_mbtowc_r,(struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *)); -int _EXFUN(wctomb,(char *, wchar_t)); -int _EXFUN(_wctomb_r,(struct _reent *, char *, wchar_t, _mbstate_t *)); -size_t _EXFUN(mbstowcs,(wchar_t *__restrict, const char *__restrict, size_t)); -size_t _EXFUN(_mbstowcs_r,(struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *)); -size_t _EXFUN(wcstombs,(char *__restrict, const wchar_t *__restrict, size_t)); -size_t _EXFUN(_wcstombs_r,(struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *)); +long labs (long); +ldiv_t ldiv (long __numer, long __denom); +void * malloc (size_t __size) _NOTHROW; +int mblen (const char *, size_t); +int _mblen_r (struct _reent *, const char *, size_t, _mbstate_t *); +int mbtowc (wchar_t *__restrict, const char *__restrict, size_t); +int _mbtowc_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *); +int wctomb (char *, wchar_t); +int _wctomb_r (struct _reent *, char *, wchar_t, _mbstate_t *); +size_t mbstowcs (wchar_t *__restrict, const char *__restrict, size_t); +size_t _mbstowcs_r (struct _reent *, wchar_t *__restrict, const char *__restrict, size_t, _mbstate_t *); +size_t wcstombs (char *__restrict, const wchar_t *__restrict, size_t); +size_t _wcstombs_r (struct _reent *, char *__restrict, const wchar_t *__restrict, size_t, _mbstate_t *); #ifndef _REENT_ONLY #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 -char * _EXFUN(mkdtemp,(char *)); +char * mkdtemp (char *); #endif #if __GNU_VISIBLE -int _EXFUN(mkostemp,(char *, int)); -int _EXFUN(mkostemps,(char *, int, int)); +int mkostemp (char *, int); +int mkostemps (char *, int, int); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4 -int _EXFUN(mkstemp,(char *)); +int mkstemp (char *); #endif #if __MISC_VISIBLE -int _EXFUN(mkstemps,(char *, int)); +int mkstemps (char *, int); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112) -char * _EXFUN(mktemp,(char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")))); +char * mktemp (char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead"))); #endif #endif /* !_REENT_ONLY */ -char * _EXFUN(_mkdtemp_r, (struct _reent *, char *)); -int _EXFUN(_mkostemp_r, (struct _reent *, char *, int)); -int _EXFUN(_mkostemps_r, (struct _reent *, char *, int, int)); -int _EXFUN(_mkstemp_r, (struct _reent *, char *)); -int _EXFUN(_mkstemps_r, (struct _reent *, char *, int)); -char * _EXFUN(_mktemp_r, (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead")))); -void _EXFUN(qsort,(void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar)); -int _EXFUN(rand,(void)); -void * _EXFUN_NOTHROW(realloc,(void *__r, size_t __size)); +char * _mkdtemp_r (struct _reent *, char *); +int _mkostemp_r (struct _reent *, char *, int); +int _mkostemps_r (struct _reent *, char *, int, int); +int _mkstemp_r (struct _reent *, char *); +int _mkstemps_r (struct _reent *, char *, int); +char * _mktemp_r (struct _reent *, char *) _ATTRIBUTE ((__deprecated__("the use of `mktemp' is dangerous; use `mkstemp' instead"))); +void qsort (void *__base, size_t __nmemb, size_t __size, __compar_fn_t _compar); +int rand (void); +void * realloc (void *__r, size_t __size) _NOTHROW; #if __BSD_VISIBLE void *reallocarray(void *, size_t, size_t) __result_use_check __alloc_size(2) __alloc_size(3); -void * _EXFUN(reallocf,(void *__r, size_t __size)); +void * reallocf (void *__r, size_t __size); #endif #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 -char * _EXFUN(realpath, (const char *__restrict path, char *__restrict resolved_path)); +char * realpath (const char *__restrict path, char *__restrict resolved_path); #endif #if __BSD_VISIBLE -int _EXFUN(rpmatch, (const char *response)); +int rpmatch (const char *response); #endif #if __XSI_VISIBLE -void _EXFUN(setkey, (const char *__key)); +void setkey (const char *__key); #endif -void _EXFUN(srand,(unsigned __seed)); -double _EXFUN(strtod,(const char *__restrict __n, char **__restrict __end_PTR)); -double _EXFUN(_strtod_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR)); +void srand (unsigned __seed); +double strtod (const char *__restrict __n, char **__restrict __end_PTR); +double _strtod_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR); #if __ISO_C_VISIBLE >= 1999 -float _EXFUN(strtof,(const char *__restrict __n, char **__restrict __end_PTR)); +float strtof (const char *__restrict __n, char **__restrict __end_PTR); #endif #if __MISC_VISIBLE /* the following strtodf interface is deprecated...use strtof instead */ @@ -165,10 +165,10 @@ float _EXFUN(strtof,(const char *__restrict __n, char **__restrict __end_PTR)); # define strtodf strtof # endif #endif -long _EXFUN(strtol,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); -long _EXFUN(_strtol_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base)); -unsigned long _EXFUN(strtoul,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); -unsigned long _EXFUN(_strtoul_r,(struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base)); +long strtol (const char *__restrict __n, char **__restrict __end_PTR, int __base); +long _strtol_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base); +unsigned long strtoul (const char *__restrict __n, char **__restrict __end_PTR, int __base); +unsigned long _strtoul_r (struct _reent *,const char *__restrict __n, char **__restrict __end_PTR, int __base); #if __GNU_VISIBLE double strtod_l (const char *__restrict, char **__restrict, locale_t); @@ -185,130 +185,130 @@ unsigned long long strtoull_l (const char *__restrict, char **__restrict, int, locale_t __loc); #endif -int _EXFUN(system,(const char *__string)); +int system (const char *__string); #if __SVID_VISIBLE || __XSI_VISIBLE >= 4 -long _EXFUN(a64l,(const char *__input)); -char * _EXFUN(l64a,(long __input)); -char * _EXFUN(_l64a_r,(struct _reent *,long __input)); +long a64l (const char *__input); +char * l64a (long __input); +char * _l64a_r (struct _reent *,long __input); #endif #if __MISC_VISIBLE -int _EXFUN(on_exit,(void (*__func)(int, void *),void *__arg)); +int on_exit (void (*__func)(int, void *),void *__arg); #endif #if __ISO_C_VISIBLE >= 1999 -void _EXFUN(_Exit,(int __status) _ATTRIBUTE ((__noreturn__))); +void _Exit (int __status) _ATTRIBUTE ((__noreturn__)); #endif #if __SVID_VISIBLE || __XSI_VISIBLE -int _EXFUN(putenv,(char *__string)); +int putenv (char *__string); #endif -int _EXFUN(_putenv_r,(struct _reent *, char *__string)); -void * _EXFUN(_reallocf_r,(struct _reent *, void *, size_t)); +int _putenv_r (struct _reent *, char *__string); +void * _reallocf_r (struct _reent *, void *, size_t); #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 -int _EXFUN(setenv,(const char *__string, const char *__value, int __overwrite)); +int setenv (const char *__string, const char *__value, int __overwrite); #endif -int _EXFUN(_setenv_r,(struct _reent *, const char *__string, const char *__value, int __overwrite)); +int _setenv_r (struct _reent *, const char *__string, const char *__value, int __overwrite); #if __XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112 -char * _EXFUN(gcvt,(double,int,char *)); -char * _EXFUN(gcvtf,(float,int,char *)); -char * _EXFUN(fcvt,(double,int,int *,int *)); -char * _EXFUN(fcvtf,(float,int,int *,int *)); -char * _EXFUN(ecvt,(double,int,int *,int *)); -char * _EXFUN(ecvtbuf,(double, int, int*, int*, char *)); -char * _EXFUN(fcvtbuf,(double, int, int*, int*, char *)); -char * _EXFUN(ecvtf,(float,int,int *,int *)); +char * gcvt (double,int,char *); +char * gcvtf (float,int,char *); +char * fcvt (double,int,int *,int *); +char * fcvtf (float,int,int *,int *); +char * ecvt (double,int,int *,int *); +char * ecvtbuf (double, int, int*, int*, char *); +char * fcvtbuf (double, int, int*, int*, char *); +char * ecvtf (float,int,int *,int *); #endif -char * _EXFUN(__itoa,(int, char *, int)); -char * _EXFUN(__utoa,(unsigned, char *, int)); +char * __itoa (int, char *, int); +char * __utoa (unsigned, char *, int); #if __MISC_VISIBLE -char * _EXFUN(itoa,(int, char *, int)); -char * _EXFUN(utoa,(unsigned, char *, int)); +char * itoa (int, char *, int); +char * utoa (unsigned, char *, int); #endif #if __POSIX_VISIBLE -int _EXFUN(rand_r,(unsigned *__seed)); +int rand_r (unsigned *__seed); #endif #if __SVID_VISIBLE || __XSI_VISIBLE -double _EXFUN(drand48,(void)); -double _EXFUN(_drand48_r,(struct _reent *)); -double _EXFUN(erand48,(unsigned short [3])); -double _EXFUN(_erand48_r,(struct _reent *, unsigned short [3])); -long _EXFUN(jrand48,(unsigned short [3])); -long _EXFUN(_jrand48_r,(struct _reent *, unsigned short [3])); -void _EXFUN(lcong48,(unsigned short [7])); -void _EXFUN(_lcong48_r,(struct _reent *, unsigned short [7])); -long _EXFUN(lrand48,(void)); -long _EXFUN(_lrand48_r,(struct _reent *)); -long _EXFUN(mrand48,(void)); -long _EXFUN(_mrand48_r,(struct _reent *)); -long _EXFUN(nrand48,(unsigned short [3])); -long _EXFUN(_nrand48_r,(struct _reent *, unsigned short [3])); +double drand48 (void); +double _drand48_r (struct _reent *); +double erand48 (unsigned short [3]); +double _erand48_r (struct _reent *, unsigned short [3]); +long jrand48 (unsigned short [3]); +long _jrand48_r (struct _reent *, unsigned short [3]); +void lcong48 (unsigned short [7]); +void _lcong48_r (struct _reent *, unsigned short [7]); +long lrand48 (void); +long _lrand48_r (struct _reent *); +long mrand48 (void); +long _mrand48_r (struct _reent *); +long nrand48 (unsigned short [3]); +long _nrand48_r (struct _reent *, unsigned short [3]); unsigned short * - _EXFUN(seed48,(unsigned short [3])); + seed48 (unsigned short [3]); unsigned short * - _EXFUN(_seed48_r,(struct _reent *, unsigned short [3])); -void _EXFUN(srand48,(long)); -void _EXFUN(_srand48_r,(struct _reent *, long)); + _seed48_r (struct _reent *, unsigned short [3]); +void srand48 (long); +void _srand48_r (struct _reent *, long); #endif /* __SVID_VISIBLE || __XSI_VISIBLE */ #if __SVID_VISIBLE || __XSI_VISIBLE >= 4 || __BSD_VISIBLE -char * _EXFUN(initstate,(unsigned, char *, size_t)); -long _EXFUN(random,(void)); -char * _EXFUN(setstate,(char *)); -void _EXFUN(srandom,(unsigned)); +char * initstate (unsigned, char *, size_t); +long random (void); +char * setstate (char *); +void srandom (unsigned); #endif #if __ISO_C_VISIBLE >= 1999 -long long _EXFUN(atoll,(const char *__nptr)); +long long atoll (const char *__nptr); #endif -long long _EXFUN(_atoll_r,(struct _reent *, const char *__nptr)); +long long _atoll_r (struct _reent *, const char *__nptr); #if __ISO_C_VISIBLE >= 1999 -long long _EXFUN(llabs,(long long)); -lldiv_t _EXFUN(lldiv,(long long __numer, long long __denom)); -long long _EXFUN(strtoll,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); +long long llabs (long long); +lldiv_t lldiv (long long __numer, long long __denom); +long long strtoll (const char *__restrict __n, char **__restrict __end_PTR, int __base); #endif -long long _EXFUN(_strtoll_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base)); +long long _strtoll_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base); #if __ISO_C_VISIBLE >= 1999 -unsigned long long _EXFUN(strtoull,(const char *__restrict __n, char **__restrict __end_PTR, int __base)); +unsigned long long strtoull (const char *__restrict __n, char **__restrict __end_PTR, int __base); #endif -unsigned long long _EXFUN(_strtoull_r,(struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base)); +unsigned long long _strtoull_r (struct _reent *, const char *__restrict __n, char **__restrict __end_PTR, int __base); #ifndef __CYGWIN__ #if __MISC_VISIBLE -void _EXFUN(cfree,(void *)); +void cfree (void *); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 -int _EXFUN(unsetenv,(const char *__string)); +int unsetenv (const char *__string); #endif -int _EXFUN(_unsetenv_r,(struct _reent *, const char *__string)); +int _unsetenv_r (struct _reent *, const char *__string); #endif /* !__CYGWIN__ */ #if __POSIX_VISIBLE >= 200112 -int _EXFUN(__nonnull ((1)) posix_memalign,(void **, size_t, size_t)); +int __nonnull ((1)) posix_memalign (void **, size_t, size_t); #endif -char * _EXFUN(_dtoa_r,(struct _reent *, double, int, int, int *, int*, char**)); +char * _dtoa_r (struct _reent *, double, int, int, int *, int*, char**); #ifndef __CYGWIN__ -void * _EXFUN_NOTHROW(_malloc_r,(struct _reent *, size_t)); -void * _EXFUN_NOTHROW(_calloc_r,(struct _reent *, size_t, size_t)); -void _EXFUN_NOTHROW(_free_r,(struct _reent *, void *)); -void * _EXFUN_NOTHROW(_realloc_r,(struct _reent *, void *, size_t)); -void _EXFUN(_mstats_r,(struct _reent *, char *)); +void * _malloc_r (struct _reent *, size_t) _NOTHROW; +void * _calloc_r (struct _reent *, size_t, size_t) _NOTHROW; +void _free_r (struct _reent *, void *) _NOTHROW; +void * _realloc_r (struct _reent *, void *, size_t) _NOTHROW; +void _mstats_r (struct _reent *, char *); #endif -int _EXFUN(_system_r,(struct _reent *, const char *)); +int _system_r (struct _reent *, const char *); -void _EXFUN(__eprintf,(const char *, const char *, unsigned int, const char *)); +void __eprintf (const char *, const char *, unsigned int, const char *); /* There are two common qsort_r variants. If you request _BSD_SOURCE, you get the BSD version; otherwise you get the GNU version. We want that #undef qsort_r will still let you invoke the underlying function, but that requires gcc support. */ #if __GNU_VISIBLE -void _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk)); +void qsort_r (void *__base, size_t __nmemb, size_t __size, int (*_compar)(const void *, const void *, void *), void *__thunk); #elif __BSD_VISIBLE # ifdef __GNUC__ -void _EXFUN(qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))) +void qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *)) __asm__ (__ASMNAME ("__bsd_qsort_r")); # else -void _EXFUN(__bsd_qsort_r,(void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *))); +void __bsd_qsort_r (void *__base, size_t __nmemb, size_t __size, void *__thunk, int (*_compar)(void *, const void *, const void *)); # define qsort_r __bsd_qsort_r # endif #endif diff --git a/newlib/libc/include/string.h b/newlib/libc/include/string.h index e44ac3079..37febadc0 100644 --- a/newlib/libc/include/string.h +++ b/newlib/libc/include/string.h @@ -26,30 +26,30 @@ _BEGIN_STD_C -void * _EXFUN(memchr,(const void *, int, size_t)); -int _EXFUN(memcmp,(const void *, const void *, size_t)); -void * _EXFUN(memcpy,(void *__restrict, const void *__restrict, size_t)); -void * _EXFUN(memmove,(void *, const void *, size_t)); -void * _EXFUN(memset,(void *, int, size_t)); -char *_EXFUN(strcat,(char *__restrict, const char *__restrict)); -char *_EXFUN(strchr,(const char *, int)); -int _EXFUN(strcmp,(const char *, const char *)); -int _EXFUN(strcoll,(const char *, const char *)); -char *_EXFUN(strcpy,(char *__restrict, const char *__restrict)); -size_t _EXFUN(strcspn,(const char *, const char *)); -char *_EXFUN(strerror,(int)); -size_t _EXFUN(strlen,(const char *)); -char *_EXFUN(strncat,(char *__restrict, const char *__restrict, size_t)); -int _EXFUN(strncmp,(const char *, const char *, size_t)); -char *_EXFUN(strncpy,(char *__restrict, const char *__restrict, size_t)); -char *_EXFUN(strpbrk,(const char *, const char *)); -char *_EXFUN(strrchr,(const char *, int)); -size_t _EXFUN(strspn,(const char *, const char *)); -char *_EXFUN(strstr,(const char *, const char *)); +void * memchr (const void *, int, size_t); +int memcmp (const void *, const void *, size_t); +void * memcpy (void *__restrict, const void *__restrict, size_t); +void * memmove (void *, const void *, size_t); +void * memset (void *, int, size_t); +char *strcat (char *__restrict, const char *__restrict); +char *strchr (const char *, int); +int strcmp (const char *, const char *); +int strcoll (const char *, const char *); +char *strcpy (char *__restrict, const char *__restrict); +size_t strcspn (const char *, const char *); +char *strerror (int); +size_t strlen (const char *); +char *strncat (char *__restrict, const char *__restrict, size_t); +int strncmp (const char *, const char *, size_t); +char *strncpy (char *__restrict, const char *__restrict, size_t); +char *strpbrk (const char *, const char *); +char *strrchr (const char *, int); +size_t strspn (const char *, const char *); +char *strstr (const char *, const char *); #ifndef _REENT_ONLY -char *_EXFUN(strtok,(char *__restrict, const char *__restrict)); +char *strtok (char *__restrict, const char *__restrict); #endif -size_t _EXFUN(strxfrm,(char *__restrict, const char *__restrict, size_t)); +size_t strxfrm (char *__restrict, const char *__restrict, size_t); #if __POSIX_VISIBLE >= 200809 int strcoll_l (const char *, const char *, locale_t); @@ -57,89 +57,89 @@ char *strerror_l (int, locale_t); size_t strxfrm_l (char *__restrict, const char *__restrict, size_t, locale_t); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE -char *_EXFUN(strtok_r,(char *__restrict, const char *__restrict, char **__restrict)); +char *strtok_r (char *__restrict, const char *__restrict, char **__restrict); #endif #if __BSD_VISIBLE -int _EXFUN(timingsafe_bcmp,(const void *, const void *, size_t)); -int _EXFUN(timingsafe_memcmp,(const void *, const void *, size_t)); +int timingsafe_bcmp (const void *, const void *, size_t); +int timingsafe_memcmp (const void *, const void *, size_t); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE -void * _EXFUN(memccpy,(void *__restrict, const void *__restrict, int, size_t)); +void * memccpy (void *__restrict, const void *__restrict, int, size_t); #endif #if __GNU_VISIBLE -void * _EXFUN(mempcpy,(void *, const void *, size_t)); -void * _EXFUN(memmem, (const void *, size_t, const void *, size_t)); -void * _EXFUN(memrchr,(const void *, int, size_t)); -void * _EXFUN(rawmemchr,(const void *, int)); +void * mempcpy (void *, const void *, size_t); +void * memmem (const void *, size_t, const void *, size_t); +void * memrchr (const void *, int, size_t); +void * rawmemchr (const void *, int); #endif #if __POSIX_VISIBLE >= 200809 -char *_EXFUN(stpcpy,(char *__restrict, const char *__restrict)); -char *_EXFUN(stpncpy,(char *__restrict, const char *__restrict, size_t)); +char *stpcpy (char *__restrict, const char *__restrict); +char *stpncpy (char *__restrict, const char *__restrict, size_t); #endif #if __GNU_VISIBLE -char *_EXFUN(strcasestr,(const char *, const char *)); -char *_EXFUN(strchrnul,(const char *, int)); +char *strcasestr (const char *, const char *); +char *strchrnul (const char *, int); #endif #if __MISC_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4 -char *_EXFUN(strdup,(const char *)); +char *strdup (const char *); #endif -char *_EXFUN(_strdup_r,(struct _reent *, const char *)); +char *_strdup_r (struct _reent *, const char *); #if __POSIX_VISIBLE >= 200809 -char *_EXFUN(strndup,(const char *, size_t)); +char *strndup (const char *, size_t); #endif -char *_EXFUN(_strndup_r,(struct _reent *, const char *, size_t)); +char *_strndup_r (struct _reent *, const char *, size_t); /* There are two common strerror_r variants. If you request _GNU_SOURCE, you get the GNU version; otherwise you get the POSIX version. POSIX requires that #undef strerror_r will still let you invoke the underlying function, but that requires gcc support. */ #if __GNU_VISIBLE -char *_EXFUN(strerror_r,(int, char *, size_t)); +char *strerror_r (int, char *, size_t); #elif __POSIX_VISIBLE >= 200112 # ifdef __GNUC__ -int _EXFUN(strerror_r,(int, char *, size_t)) +int strerror_r (int, char *, size_t) #ifdef __ASMNAME __asm__ (__ASMNAME ("__xpg_strerror_r")) #endif ; # else -int _EXFUN(__xpg_strerror_r,(int, char *, size_t)); +int __xpg_strerror_r (int, char *, size_t); # define strerror_r __xpg_strerror_r # endif #endif /* Reentrant version of strerror. */ -char * _EXFUN(_strerror_r, (struct _reent *, int, int, int *)); +char * _strerror_r (struct _reent *, int, int, int *); #if __BSD_VISIBLE -size_t _EXFUN(strlcat,(char *, const char *, size_t)); -size_t _EXFUN(strlcpy,(char *, const char *, size_t)); +size_t strlcat (char *, const char *, size_t); +size_t strlcpy (char *, const char *, size_t); #endif #if __POSIX_VISIBLE >= 200809 -size_t _EXFUN(strnlen,(const char *, size_t)); +size_t strnlen (const char *, size_t); #endif #if __BSD_VISIBLE -char *_EXFUN(strsep,(char **, const char *)); +char *strsep (char **, const char *); #endif #if __BSD_VISIBLE char *strnstr(const char *, const char *, size_t) __pure; #endif #if __MISC_VISIBLE -char *_EXFUN(strlwr,(char *)); -char *_EXFUN(strupr,(char *)); +char *strlwr (char *); +char *strupr (char *); #endif #ifndef DEFS_H /* Kludge to work around problem compiling in gdb */ -char *_EXFUN(strsignal, (int __signo)); +char *strsignal (int __signo); #endif #ifdef __CYGWIN__ -int _EXFUN(strtosigno, (const char *__name)); +int strtosigno (const char *__name); #endif #if __GNU_VISIBLE -int _EXFUN(strverscmp,(const char *, const char *)); +int strverscmp (const char *, const char *); #endif #if __GNU_VISIBLE && defined(__GNUC__) @@ -169,7 +169,7 @@ int _EXFUN(strverscmp,(const char *, const char *)); sure here. */ #if __GNU_VISIBLE && !defined(basename) # define basename basename -char *_EXFUN(__nonnull ((1)) basename,(const char *)) __asm__(__ASMNAME("__gnu_basename")); +char *__nonnull ((1)) basename (const char *) __asm__(__ASMNAME("__gnu_basename")); #endif #include diff --git a/newlib/libc/include/sys/iconvnls.h b/newlib/libc/include/sys/iconvnls.h index aa0b78441..d4ee0b7c9 100644 --- a/newlib/libc/include/sys/iconvnls.h +++ b/newlib/libc/include/sys/iconvnls.h @@ -45,33 +45,33 @@ #define ICONV_NLS_TO 1 void -_EXFUN(_iconv_nls_get_state, (iconv_t cd, mbstate_t *ps, int direction)); +_iconv_nls_get_state (iconv_t cd, mbstate_t *ps, int direction); int -_EXFUN(_iconv_nls_set_state, (iconv_t cd, mbstate_t *ps, int direction)); +_iconv_nls_set_state (iconv_t cd, mbstate_t *ps, int direction); int -_EXFUN(_iconv_nls_is_stateful, (iconv_t cd, int direction)); +_iconv_nls_is_stateful (iconv_t cd, int direction); int -_EXFUN(_iconv_nls_get_mb_cur_max, (iconv_t cd, int direction)); +_iconv_nls_get_mb_cur_max (iconv_t cd, int direction); size_t -_EXFUN(_iconv_nls_conv, (struct _reent *rptr, iconv_t cd, +_iconv_nls_conv (struct _reent *rptr, iconv_t cd, const char **inbuf, size_t *inbytesleft, - char **outbuf, size_t *outbytesleft)); + char **outbuf, size_t *outbytesleft); const char * -_EXFUN(_iconv_nls_construct_filename, (struct _reent *rptr, const char *file, - const char *dir, const char *ext)); +_iconv_nls_construct_filename (struct _reent *rptr, const char *file, + const char *dir, const char *ext); int -_EXFUN(_iconv_nls_open, (struct _reent *rptr, const char *encoding, - iconv_t *towc, iconv_t *fromwc, int flag)); +_iconv_nls_open (struct _reent *rptr, const char *encoding, + iconv_t *towc, iconv_t *fromwc, int flag); char * -_EXFUN(_iconv_resolve_encoding_name, (struct _reent *rptr, const char *ca)); +_iconv_resolve_encoding_name (struct _reent *rptr, const char *ca); #endif /* __SYS_ICONVNLS_H__ */ diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 54fdf96f1..1ef226194 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -165,7 +165,7 @@ struct __sFILE_fake { /* Following is needed both in libc/stdio and libc/stdlib so we put it * here instead of libc/stdio/local.h where it was previously. */ -extern void _EXFUN(__sinit,(struct _reent *)); +extern void __sinit (struct _reent *); # define _REENT_SMALL_CHECK_INIT(ptr) \ do \ @@ -781,7 +781,7 @@ void _reclaim_reent (struct _reent *); #if defined(__DYNAMIC_REENT__) && !defined(__SINGLE_THREAD__) #ifndef __getreent - struct _reent * _EXFUN(__getreent, (void)); + struct _reent * __getreent (void); #endif # define _REENT (__getreent()) #else /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */ diff --git a/newlib/libc/include/sys/resource.h b/newlib/libc/include/sys/resource.h index c35ac2a46..b99506bd8 100644 --- a/newlib/libc/include/sys/resource.h +++ b/newlib/libc/include/sys/resource.h @@ -11,7 +11,7 @@ struct rusage { struct timeval ru_stime; /* system time used */ }; -int _EXFUN(getrusage, (int, struct rusage*)); +int getrusage (int, struct rusage*); #endif diff --git a/newlib/libc/include/sys/signal.h b/newlib/libc/include/sys/signal.h index 70ff15d01..7d0c59437 100644 --- a/newlib/libc/include/sys/signal.h +++ b/newlib/libc/include/sys/signal.h @@ -161,34 +161,34 @@ typedef struct sigaltstack { #define SIG_BLOCK 1 /* set of signals to block */ #define SIG_UNBLOCK 2 /* set of signals to, well, unblock */ -int _EXFUN(sigprocmask, (int how, const sigset_t *set, sigset_t *oset)); +int sigprocmask (int how, const sigset_t *set, sigset_t *oset); #endif #if __POSIX_VISIBLE >= 199506 -int _EXFUN(pthread_sigmask, (int how, const sigset_t *set, sigset_t *oset)); +int pthread_sigmask (int how, const sigset_t *set, sigset_t *oset); #endif #ifdef _COMPILING_NEWLIB -int _EXFUN(_kill, (pid_t, int)); +int _kill (pid_t, int); #endif /* _COMPILING_NEWLIB */ #if __POSIX_VISIBLE -int _EXFUN(kill, (pid_t, int)); +int kill (pid_t, int); #endif #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 -int _EXFUN(killpg, (pid_t, int)); +int killpg (pid_t, int); #endif #if __POSIX_VISIBLE -int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *)); -int _EXFUN(sigaddset, (sigset_t *, const int)); -int _EXFUN(sigdelset, (sigset_t *, const int)); -int _EXFUN(sigismember, (const sigset_t *, int)); -int _EXFUN(sigfillset, (sigset_t *)); -int _EXFUN(sigemptyset, (sigset_t *)); -int _EXFUN(sigpending, (sigset_t *)); -int _EXFUN(sigsuspend, (const sigset_t *)); -int _EXFUN(sigwait, (const sigset_t *set, int *sig)); +int sigaction (int, const struct sigaction *, struct sigaction *); +int sigaddset (sigset_t *, const int); +int sigdelset (sigset_t *, const int); +int sigismember (const sigset_t *, int); +int sigfillset (sigset_t *); +int sigemptyset (sigset_t *); +int sigpending (sigset_t *); +int sigsuspend (const sigset_t *); +int sigwait (const sigset_t *set, int *sig); #if !defined(__CYGWIN__) && !defined(__rtems__) /* These depend upon the type of sigset_t, which right now @@ -209,21 +209,21 @@ int _EXFUN(sigwait, (const sigset_t *set, int *sig)); value. */ #if __XSI_VISIBLE && !defined(__INSIDE_CYGWIN__) # ifdef __GNUC__ -int _EXFUN(sigpause, (int)) __asm__ (__ASMNAME ("__xpg_sigpause")); +int sigpause (int) __asm__ (__ASMNAME ("__xpg_sigpause")); # else -int _EXFUN(__xpg_sigpause, (int)); +int __xpg_sigpause (int); # define sigpause __xpg_sigpause # endif #elif __BSD_VISIBLE -int _EXFUN(sigpause, (int)); +int sigpause (int); #endif #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 -int _EXFUN(sigaltstack, (const stack_t *__restrict, stack_t *__restrict)); +int sigaltstack (const stack_t *__restrict, stack_t *__restrict); #endif #if __POSIX_VISIBLE >= 199506 -int _EXFUN(pthread_kill, (pthread_t thread, int sig)); +int pthread_kill (pthread_t thread, int sig); #endif #if __POSIX_VISIBLE >= 199309 @@ -231,12 +231,11 @@ int _EXFUN(pthread_kill, (pthread_t thread, int sig)); /* 3.3.8 Synchronously Accept a Signal, P1003.1b-1993, p. 76 NOTE: P1003.1c/D10, p. 39 adds sigwait(). */ -int _EXFUN(sigwaitinfo, (const sigset_t *set, siginfo_t *info)); -int _EXFUN(sigtimedwait, - (const sigset_t *set, siginfo_t *info, const struct timespec *timeout) -); +int sigwaitinfo (const sigset_t *set, siginfo_t *info); +int sigtimedwait (const sigset_t *set, siginfo_t *info, + const struct timespec *timeout); /* 3.3.9 Queue a Signal to a Process, P1003.1b-1993, p. 78 */ -int _EXFUN(sigqueue, (pid_t pid, int signo, const union sigval value)); +int sigqueue (pid_t pid, int signo, const union sigval value); #endif /* __POSIX_VISIBLE >= 199309 */ diff --git a/newlib/libc/include/sys/stat.h b/newlib/libc/include/sys/stat.h index 94a90c0dd..eee98db64 100644 --- a/newlib/libc/include/sys/stat.h +++ b/newlib/libc/include/sys/stat.h @@ -144,41 +144,41 @@ struct stat #define UTIME_OMIT -1L #endif -int _EXFUN(chmod,( const char *__path, mode_t __mode )); -int _EXFUN(fchmod,(int __fd, mode_t __mode)); -int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); -int _EXFUN(mkdir,( const char *_path, mode_t __mode )); -int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); -int _EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf )); -mode_t _EXFUN(umask,( mode_t __mask )); +int chmod (const char *__path, mode_t __mode ); +int fchmod (int __fd, mode_t __mode); +int fstat (int __fd, struct stat *__sbuf ); +int mkdir (const char *_path, mode_t __mode ); +int mkfifo (const char *__path, mode_t __mode ); +int stat (const char *__restrict __path, struct stat *__restrict __sbuf ); +mode_t umask (mode_t __mask ); #if defined (__SPU__) || defined(__rtems__) || defined(__CYGWIN__) && !defined(__INSIDE_CYGWIN__) -int _EXFUN(lstat,( const char *__restrict __path, struct stat *__restrict __buf )); -int _EXFUN(mknod,( const char *__path, mode_t __mode, dev_t __dev )); +int lstat (const char *__restrict __path, struct stat *__restrict __buf ); +int mknod (const char *__path, mode_t __mode, dev_t __dev ); #endif #if __ATFILE_VISIBLE && !defined(__INSIDE_CYGWIN__) -int _EXFUN(fchmodat, (int, const char *, mode_t, int)); -int _EXFUN(fstatat, (int, const char *__restrict , struct stat *__restrict, int)); -int _EXFUN(mkdirat, (int, const char *, mode_t)); -int _EXFUN(mkfifoat, (int, const char *, mode_t)); -int _EXFUN(mknodat, (int, const char *, mode_t, dev_t)); -int _EXFUN(utimensat, (int, const char *, const struct timespec *, int)); +int fchmodat (int, const char *, mode_t, int); +int fstatat (int, const char *__restrict , struct stat *__restrict, int); +int mkdirat (int, const char *, mode_t); +int mkfifoat (int, const char *, mode_t); +int mknodat (int, const char *, mode_t, dev_t); +int utimensat (int, const char *, const struct timespec *, int); #endif #if __POSIX_VISIBLE >= 200809 && !defined(__INSIDE_CYGWIN__) -int _EXFUN(futimens, (int, const struct timespec *)); +int futimens (int, const struct timespec *); #endif /* Provide prototypes for most of the _ names that are provided in newlib for some compilers. */ #ifdef _COMPILING_NEWLIB -int _EXFUN(_fstat,( int __fd, struct stat *__sbuf )); -int _EXFUN(_stat,( const char *__restrict __path, struct stat *__restrict __sbuf )); -int _EXFUN(_mkdir,( const char *_path, mode_t __mode )); +int _fstat (int __fd, struct stat *__sbuf ); +int _stat (const char *__restrict __path, struct stat *__restrict __sbuf ); +int _mkdir (const char *_path, mode_t __mode ); #ifdef __LARGE64_FILES struct stat64; -int _EXFUN(_stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf )); -int _EXFUN(_fstat64,( int __fd, struct stat64 *__sbuf )); +int _stat64 (const char *__restrict __path, struct stat64 *__restrict __sbuf ); +int _fstat64 (int __fd, struct stat64 *__sbuf ); #endif #endif diff --git a/newlib/libc/include/sys/time.h b/newlib/libc/include/sys/time.h index 5fdb6673b..ce2e667f7 100644 --- a/newlib/libc/include/sys/time.h +++ b/newlib/libc/include/sys/time.h @@ -268,30 +268,30 @@ struct itimerval { #include __BEGIN_DECLS -int _EXFUN(utimes, (const char *__path, const struct timeval *__tvp)); +int utimes (const char *__path, const struct timeval *__tvp); #if __BSD_VISIBLE -int _EXFUN(adjtime, (const struct timeval *, struct timeval *)); -int _EXFUN(futimes, (int, const struct timeval *)); -int _EXFUN(lutimes, (const char *, const struct timeval *)); -int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); +int adjtime (const struct timeval *, struct timeval *); +int futimes (int, const struct timeval *); +int lutimes (const char *, const struct timeval *); +int settimeofday (const struct timeval *, const struct timezone *); #endif #if __MISC_VISIBLE || __XSI_VISIBLE -int _EXFUN(getitimer, (int __which, struct itimerval *__value)); -int _EXFUN(setitimer, (int __which, const struct itimerval *__restrict __value, - struct itimerval *__restrict __ovalue)); +int getitimer (int __which, struct itimerval *__value); +int setitimer (int __which, const struct itimerval *__restrict __value, + struct itimerval *__restrict __ovalue); #endif -int _EXFUN(gettimeofday, (struct timeval *__restrict __p, - void *__restrict __tz)); +int gettimeofday (struct timeval *__restrict __p, + void *__restrict __tz); #if __GNU_VISIBLE -int _EXFUN(futimesat, (int, const char *, const struct timeval [2])); +int futimesat (int, const char *, const struct timeval [2]); #endif #ifdef _COMPILING_NEWLIB -int _EXFUN(_gettimeofday, (struct timeval *__p, void *__tz)); +int _gettimeofday (struct timeval *__p, void *__tz); #endif __END_DECLS diff --git a/newlib/libc/include/sys/times.h b/newlib/libc/include/sys/times.h index b1f1dc699..05b254714 100644 --- a/newlib/libc/include/sys/times.h +++ b/newlib/libc/include/sys/times.h @@ -21,9 +21,9 @@ struct tms { clock_t tms_cstime; /* system time, children */ }; -clock_t _EXFUN(times,(struct tms *)); +clock_t times (struct tms *); #ifdef _COMPILING_NEWLIB -clock_t _EXFUN(_times,(struct tms *)); +clock_t _times (struct tms *); #endif #ifdef __cplusplus diff --git a/newlib/libc/include/sys/unistd.h b/newlib/libc/include/sys/unistd.h index c811eb649..5386bd49d 100644 --- a/newlib/libc/include/sys/unistd.h +++ b/newlib/libc/include/sys/unistd.h @@ -15,234 +15,234 @@ extern "C" { extern char **environ; -void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((__noreturn__))); +void _exit (int __status) _ATTRIBUTE ((__noreturn__)); -int _EXFUN(access,(const char *__path, int __amode )); -unsigned _EXFUN(alarm, (unsigned __secs )); -int _EXFUN(chdir, (const char *__path )); -int _EXFUN(chmod, (const char *__path, mode_t __mode )); +int access (const char *__path, int __amode); +unsigned alarm (unsigned __secs); +int chdir (const char *__path); +int chmod (const char *__path, mode_t __mode); #if !defined(__INSIDE_CYGWIN__) -int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group )); +int chown (const char *__path, uid_t __owner, gid_t __group); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112) -int _EXFUN(chroot, (const char *__path )); +int chroot (const char *__path); #endif -int _EXFUN(close, (int __fildes )); +int close (int __fildes); #if __POSIX_VISIBLE >= 199209 -size_t _EXFUN(confstr, (int __name, char *__buf, size_t __len)); +size_t confstr (int __name, char *__buf, size_t __len); #endif #if __XSI_VISIBLE -char * _EXFUN(crypt, (const char *__key, const char *__salt)); +char * crypt (const char *__key, const char *__salt); #endif #if __XSI_VISIBLE && __XSI_VISIBLE < 700 -char * _EXFUN(ctermid, (char *__s )); +char * ctermid (char *__s); #endif #if __XSI_VISIBLE && __XSI_VISIBLE < 600 -char * _EXFUN(cuserid, (char *__s )); +char * cuserid (char *__s); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) -int _EXFUN(daemon, (int nochdir, int noclose)); +int daemon (int nochdir, int noclose); #endif -int _EXFUN(dup, (int __fildes )); -int _EXFUN(dup2, (int __fildes, int __fildes2 )); +int dup (int __fildes); +int dup2 (int __fildes, int __fildes2); #if __GNU_VISIBLE -int _EXFUN(dup3, (int __fildes, int __fildes2, int flags)); -int _EXFUN(eaccess, (const char *__path, int __mode)); +int dup3 (int __fildes, int __fildes2, int flags); +int eaccess (const char *__path, int __mode); #endif #if __XSI_VISIBLE -void _EXFUN(encrypt, (char *__block, int __edflag)); +void encrypt (char *__block, int __edflag); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) -void _EXFUN(endusershell, (void)); +void endusershell (void); #endif #if __GNU_VISIBLE -int _EXFUN(euidaccess, (const char *__path, int __mode)); +int euidaccess (const char *__path, int __mode); #endif -int _EXFUN(execl, (const char *__path, const char *, ... )); -int _EXFUN(execle, (const char *__path, const char *, ... )); -int _EXFUN(execlp, (const char *__file, const char *, ... )); +int execl (const char *__path, const char *, ...); +int execle (const char *__path, const char *, ...); +int execlp (const char *__file, const char *, ...); #if __MISC_VISIBLE -int _EXFUN(execlpe, (const char *__file, const char *, ... )); +int execlpe (const char *__file, const char *, ...); #endif -int _EXFUN(execv, (const char *__path, char * const __argv[] )); -int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] )); -int _EXFUN(execvp, (const char *__file, char * const __argv[] )); +int execv (const char *__path, char * const __argv[]); +int execve (const char *__path, char * const __argv[], char * const __envp[]); +int execvp (const char *__file, char * const __argv[]); #if __GNU_VISIBLE -int _EXFUN(execvpe, (const char *__file, char * const __argv[], char * const __envp[] )); +int execvpe (const char *__file, char * const __argv[], char * const __envp[]); #endif #if __ATFILE_VISIBLE -int _EXFUN(faccessat, (int __dirfd, const char *__path, int __mode, int __flags)); +int faccessat (int __dirfd, const char *__path, int __mode, int __flags); #endif #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 -int _EXFUN(fchdir, (int __fildes)); +int fchdir (int __fildes); #endif #if __POSIX_VISIBLE >= 199309 -int _EXFUN(fchmod, (int __fildes, mode_t __mode )); +int fchmod (int __fildes, mode_t __mode); #endif #if !defined(__INSIDE_CYGWIN__) #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 -int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group )); +int fchown (int __fildes, uid_t __owner, gid_t __group); #endif #endif #if __ATFILE_VISIBLE -int _EXFUN(fchownat, (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags)); +int fchownat (int __dirfd, const char *__path, uid_t __owner, gid_t __group, int __flags); #endif #if __POSIX_VISIBLE >= 200809 -int _EXFUN(fexecve, (int __fd, char * const __argv[], char * const __envp[] )); +int fexecve (int __fd, char * const __argv[], char * const __envp[]); #endif -pid_t _EXFUN(fork, (void )); -long _EXFUN(fpathconf, (int __fd, int __name )); -int _EXFUN(fsync, (int __fd)); +pid_t fork (void); +long fpathconf (int __fd, int __name); +int fsync (int __fd); #if __POSIX_VISIBLE >= 199309 -int _EXFUN(fdatasync, (int __fd)); +int fdatasync (int __fd); #endif #if __GNU_VISIBLE -char * _EXFUN(get_current_dir_name, (void)); +char * get_current_dir_name (void); #endif -char * _EXFUN(getcwd, (char *__buf, size_t __size )); +char * getcwd (char *__buf, size_t __size); #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) -int _EXFUN(getdomainname ,(char *__name, size_t __len)); +int getdomainname (char *__name, size_t __len); #endif #if __BSD_VISIBLE -int _EXFUN(getentropy, (void *, size_t)); +int getentropy (void *, size_t); #endif #if !defined(__INSIDE_CYGWIN__) -gid_t _EXFUN(getegid, (void )); -uid_t _EXFUN(geteuid, (void )); -gid_t _EXFUN(getgid, (void )); +gid_t getegid (void); +uid_t geteuid (void); +gid_t getgid (void); #endif -int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); +int getgroups (int __gidsetsize, gid_t __grouplist[]); #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 -long _EXFUN(gethostid, (void)); +long gethostid (void); #endif -char * _EXFUN(getlogin, (void )); +char * getlogin (void); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) -int _EXFUN(getlogin_r, (char *name, size_t namesize) ); +int getlogin_r (char *name, size_t namesize) ; #endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __POSIX_VISIBLE < 200112) -char * _EXFUN(getpass, (const char *__prompt)); -int _EXFUN(getpagesize, (void)); +char * getpass (const char *__prompt); +int getpagesize (void); #endif #if __BSD_VISIBLE -int _EXFUN(getpeereid, (int, uid_t *, gid_t *)); +int getpeereid (int, uid_t *, gid_t *); #endif #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4 -pid_t _EXFUN(getpgid, (pid_t)); +pid_t getpgid (pid_t); #endif -pid_t _EXFUN(getpgrp, (void )); -pid_t _EXFUN(getpid, (void )); -pid_t _EXFUN(getppid, (void )); +pid_t getpgrp (void); +pid_t getpid (void); +pid_t getppid (void); #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 4 -pid_t _EXFUN(getsid, (pid_t)); +pid_t getsid (pid_t); #endif #if !defined(__INSIDE_CYGWIN__) -uid_t _EXFUN(getuid, (void )); +uid_t getuid (void); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) -char * _EXFUN(getusershell, (void)); +char * getusershell (void); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200809) -char * _EXFUN(getwd, (char *__buf )); +char * getwd (char *__buf); #endif #if __BSD_VISIBLE -int _EXFUN(iruserok, (unsigned long raddr, int superuser, const char *ruser, const char *luser)); +int iruserok (unsigned long raddr, int superuser, const char *ruser, const char *luser); #endif -int _EXFUN(isatty, (int __fildes )); +int isatty (int __fildes); #if __BSD_VISIBLE -int _EXFUN(issetugid, (void)); +int issetugid (void); #endif #if !defined(__INSIDE_CYGWIN__) #if __BSD_VISIBLE || __XSI_VISIBLE >= 4 || __POSIX_VISIBLE >= 200809 -int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group )); +int lchown (const char *__path, uid_t __owner, gid_t __group); #endif #endif -int _EXFUN(link, (const char *__path1, const char *__path2 )); +int link (const char *__path1, const char *__path2); #if __ATFILE_VISIBLE -int _EXFUN(linkat, (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags )); +int linkat (int __dirfd1, const char *__path1, int __dirfd2, const char *__path2, int __flags); #endif #if __MISC_VISIBLE || __XSI_VISIBLE -int _EXFUN(nice, (int __nice_value )); +int nice (int __nice_value); #endif #if !defined(__INSIDE_CYGWIN__) -off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); +off_t lseek (int __fildes, off_t __offset, int __whence); #endif #if __MISC_VISIBLE || __XSI_VISIBLE >= 4 #define F_ULOCK 0 #define F_LOCK 1 #define F_TLOCK 2 #define F_TEST 3 -int _EXFUN(lockf, (int __fd, int __cmd, off_t __len)); +int lockf (int __fd, int __cmd, off_t __len); #endif -long _EXFUN(pathconf, (const char *__path, int __name )); -int _EXFUN(pause, (void )); +long pathconf (const char *__path, int __name); +int pause (void); #if __POSIX_VISIBLE >= 199506 -int _EXFUN(pthread_atfork, (void (*)(void), void (*)(void), void (*)(void))); +int pthread_atfork (void (*)(void), void (*)(void), void (*)(void)); #endif -int _EXFUN(pipe, (int __fildes[2] )); +int pipe (int __fildes[2]); #if __GNU_VISIBLE -int _EXFUN(pipe2, (int __fildes[2], int flags)); +int pipe2 (int __fildes[2], int flags); #endif #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500 -ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset)); -ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset)); +ssize_t pread (int __fd, void *__buf, size_t __nbytes, off_t __offset); +ssize_t pwrite (int __fd, const void *__buf, size_t __nbytes, off_t __offset); #endif -_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte )); +_READ_WRITE_RETURN_TYPE read (int __fd, void *__buf, size_t __nbyte); #if __BSD_VISIBLE -int _EXFUN(rresvport, (int *__alport)); -int _EXFUN(revoke, (char *__path)); +int rresvport (int *__alport); +int revoke (char *__path); #endif -int _EXFUN(rmdir, (const char *__path )); +int rmdir (const char *__path); #if __BSD_VISIBLE -int _EXFUN(ruserok, (const char *rhost, int superuser, const char *ruser, const char *luser)); +int ruserok (const char *rhost, int superuser, const char *ruser, const char *luser); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200112) -void * _EXFUN(sbrk, (ptrdiff_t __incr)); +void * sbrk (ptrdiff_t __incr); #endif #if !defined(__INSIDE_CYGWIN__) #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 -int _EXFUN(setegid, (gid_t __gid )); -int _EXFUN(seteuid, (uid_t __uid )); +int setegid (gid_t __gid); +int seteuid (uid_t __uid); #endif -int _EXFUN(setgid, (gid_t __gid )); +int setgid (gid_t __gid); #endif #if __BSD_VISIBLE -int _EXFUN(setgroups, (int ngroups, const gid_t *grouplist )); +int setgroups (int ngroups, const gid_t *grouplist); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) -int _EXFUN(sethostname, (const char *, size_t)); +int sethostname (const char *, size_t); #endif -int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid )); +int setpgid (pid_t __pid, pid_t __pgid); #if __SVID_VISIBLE || __XSI_VISIBLE >= 500 -int _EXFUN(setpgrp, (void )); +int setpgrp (void); #endif #if (__BSD_VISIBLE || __XSI_VISIBLE >= 4) && !defined(__INSIDE_CYGWIN__) -int _EXFUN(setregid, (gid_t __rgid, gid_t __egid)); -int _EXFUN(setreuid, (uid_t __ruid, uid_t __euid)); +int setregid (gid_t __rgid, gid_t __egid); +int setreuid (uid_t __ruid, uid_t __euid); #endif -pid_t _EXFUN(setsid, (void )); +pid_t setsid (void); #if !defined(__INSIDE_CYGWIN__) -int _EXFUN(setuid, (uid_t __uid )); +int setuid (uid_t __uid); #endif #if __BSD_VISIBLE || (__XSI_VISIBLE && __XSI_VISIBLE < 500) -void _EXFUN(setusershell, (void)); +void setusershell (void); #endif -unsigned _EXFUN(sleep, (unsigned int __seconds )); +unsigned sleep (unsigned int __seconds); #if __XSI_VISIBLE -void _EXFUN(swab, (const void *__restrict, void *__restrict, ssize_t)); +void swab (const void *__restrict, void *__restrict, ssize_t); #endif -long _EXFUN(sysconf, (int __name )); -pid_t _EXFUN(tcgetpgrp, (int __fildes )); -int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); -char * _EXFUN(ttyname, (int __fildes )); -int _EXFUN(ttyname_r, (int, char *, size_t)); -int _EXFUN(unlink, (const char *__path )); +long sysconf (int __name); +pid_t tcgetpgrp (int __fildes); +int tcsetpgrp (int __fildes, pid_t __pgrp_id); +char * ttyname (int __fildes); +int ttyname_r (int, char *, size_t); +int unlink (const char *__path); #if __XSI_VISIBLE >= 500 && __POSIX_VISIBLE < 200809 || __BSD_VISIBLE -int _EXFUN(usleep, (useconds_t __useconds)); +int usleep (useconds_t __useconds); #endif #if __BSD_VISIBLE -int _EXFUN(vhangup, (void )); +int vhangup (void); #endif -_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte )); +_READ_WRITE_RETURN_TYPE write (int __fd, const void *__buf, size_t __nbyte); #ifdef __CYGWIN__ # define __UNISTD_GETOPT__ @@ -256,69 +256,69 @@ extern int optreset; /* getopt(3) external variable */ #endif #if __BSD_VISIBLE || (__XSI_VISIBLE >= 4 && __POSIX_VISIBLE < 200809) -pid_t _EXFUN(vfork, (void )); +pid_t vfork (void); #endif #ifdef _COMPILING_NEWLIB /* Provide prototypes for most of the _ names that are provided in newlib for some compilers. */ -int _EXFUN(_close, (int __fildes )); -pid_t _EXFUN(_fork, (void )); -pid_t _EXFUN(_getpid, (void )); -int _EXFUN(_isatty, (int __fildes )); -int _EXFUN(_link, (const char *__path1, const char *__path2 )); -_off_t _EXFUN(_lseek, (int __fildes, _off_t __offset, int __whence )); +int _close (int __fildes); +pid_t _fork (void); +pid_t _getpid (void); +int _isatty (int __fildes); +int _link (const char *__path1, const char *__path2); +_off_t _lseek (int __fildes, _off_t __offset, int __whence); #ifdef __LARGE64_FILES -_off64_t _EXFUN(_lseek64, (int __filedes, _off64_t __offset, int __whence )); +_off64_t _lseek64 (int __filedes, _off64_t __offset, int __whence); #endif -_READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte )); -void * _EXFUN(_sbrk, (ptrdiff_t __incr)); -int _EXFUN(_unlink, (const char *__path )); -_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte )); -int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] )); +_READ_WRITE_RETURN_TYPE _read (int __fd, void *__buf, size_t __nbyte); +void * _sbrk (ptrdiff_t __incr); +int _unlink (const char *__path); +_READ_WRITE_RETURN_TYPE _write (int __fd, const void *__buf, size_t __nbyte); +int _execve (const char *__path, char * const __argv[], char * const __envp[]); #endif #if !defined(__INSIDE_CYGWIN__) #if __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 -int _EXFUN(ftruncate, (int __fd, off_t __length)); +int ftruncate (int __fd, off_t __length); #endif #if __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500 -int _EXFUN(truncate, (const char *, off_t __length)); +int truncate (const char *, off_t __length); #endif #endif #if __BSD_VISIBLE || __POSIX_VISIBLE < 200112 -int _EXFUN(getdtablesize, (void)); +int getdtablesize (void); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200809 || __XSI_VISIBLE >= 500 -useconds_t _EXFUN(ualarm, (useconds_t __useconds, useconds_t __interval)); +useconds_t ualarm (useconds_t __useconds, useconds_t __interval); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 500 #if !(defined (_WINSOCK_H) || defined (_WINSOCKAPI_) || defined (__USE_W32_SOCKETS)) /* winsock[2].h defines as __stdcall, and with int as 2nd arg */ - int _EXFUN(gethostname, (char *__name, size_t __len)); + int gethostname (char *__name, size_t __len); #endif #endif #if __MISC_VISIBLE -int _EXFUN(setdtablesize, (int)); +int setdtablesize (int); #endif #if __BSD_VISIBLE || __XSI_VISIBLE >= 500 -void _EXFUN(sync, (void)); +void sync (void); #endif #if __BSD_VISIBLE || __POSIX_VISIBLE >= 200112 || __XSI_VISIBLE >= 4 -ssize_t _EXFUN(readlink, (const char *__restrict __path, - char *__restrict __buf, size_t __buflen)); -int _EXFUN(symlink, (const char *__name1, const char *__name2)); +ssize_t readlink (const char *__restrict __path, + char *__restrict __buf, size_t __buflen); +int symlink (const char *__name1, const char *__name2); #endif #if __ATFILE_VISIBLE -ssize_t _EXFUN(readlinkat, (int __dirfd1, const char *__restrict __path, - char *__restrict __buf, size_t __buflen)); -int _EXFUN(symlinkat, (const char *, int, const char *)); -int _EXFUN(unlinkat, (int, const char *, int)); +ssize_t readlinkat (int __dirfd1, const char *__restrict __path, + char *__restrict __buf, size_t __buflen); +int symlinkat (const char *, int, const char *); +int unlinkat (int, const char *, int); #endif #define F_OK 0 diff --git a/newlib/libc/include/time.h b/newlib/libc/include/time.h index 6f6ff86c8..a2efcc15e 100644 --- a/newlib/libc/include/time.h +++ b/newlib/libc/include/time.h @@ -53,19 +53,19 @@ struct tm #endif }; -clock_t _EXFUN(clock, (void)); -double _EXFUN(difftime, (time_t _time2, time_t _time1)); -time_t _EXFUN(mktime, (struct tm *_timeptr)); -time_t _EXFUN(time, (time_t *_timer)); +clock_t clock (void); +double difftime (time_t _time2, time_t _time1); +time_t mktime (struct tm *_timeptr); +time_t time (time_t *_timer); #ifndef _REENT_ONLY -char *_EXFUN(asctime, (const struct tm *_tblock)); -char *_EXFUN(ctime, (const time_t *_time)); -struct tm *_EXFUN(gmtime, (const time_t *_timer)); -struct tm *_EXFUN(localtime,(const time_t *_timer)); +char *asctime (const struct tm *_tblock); +char *ctime (const time_t *_time); +struct tm *gmtime (const time_t *_timer); +struct tm *localtime (const time_t *_timer); #endif -size_t _EXFUN(strftime, (char *__restrict _s, +size_t strftime (char *__restrict _s, size_t _maxsize, const char *__restrict _fmt, - const struct tm *__restrict _t)); + const struct tm *__restrict _t); #if __POSIX_VISIBLE >= 200809 extern size_t strftime_l (char *__restrict _s, size_t _maxsize, @@ -73,13 +73,13 @@ extern size_t strftime_l (char *__restrict _s, size_t _maxsize, const struct tm *__restrict _t, locale_t _l); #endif -char *_EXFUN(asctime_r, (const struct tm *__restrict, - char *__restrict)); -char *_EXFUN(ctime_r, (const time_t *, char *)); -struct tm *_EXFUN(gmtime_r, (const time_t *__restrict, - struct tm *__restrict)); -struct tm *_EXFUN(localtime_r, (const time_t *__restrict, - struct tm *__restrict)); +char *asctime_r (const struct tm *__restrict, + char *__restrict); +char *ctime_r (const time_t *, char *); +struct tm *gmtime_r (const time_t *__restrict, + struct tm *__restrict); +struct tm *localtime_r (const time_t *__restrict, + struct tm *__restrict); _END_STD_C @@ -88,9 +88,9 @@ extern "C" { #endif #if __XSI_VISIBLE -char *_EXFUN(strptime, (const char *__restrict, +char *strptime (const char *__restrict, const char *__restrict, - struct tm *__restrict)); + struct tm *__restrict); #endif #if __GNU_VISIBLE char *strptime_l (const char *__restrict, const char *__restrict, @@ -98,9 +98,9 @@ char *strptime_l (const char *__restrict, const char *__restrict, #endif #if __POSIX_VISIBLE -void _EXFUN(tzset, (void)); +void tzset (void); #endif -void _EXFUN(_tzset_r, (struct _reent *)); +void _tzset_r (struct _reent *); typedef struct __tzrule_struct { @@ -120,7 +120,7 @@ typedef struct __tzinfo_struct __tzrule_type __tzrule[2]; } __tzinfo_type; -__tzinfo_type *_EXFUN (__gettzinfo, (void)); +__tzinfo_type *__gettzinfo (void); /* getdate functions */ @@ -128,9 +128,9 @@ __tzinfo_type *_EXFUN (__gettzinfo, (void)); #if __XSI_VISIBLE >= 4 #ifndef _REENT_ONLY #define getdate_err (*__getdate_err()) -int *_EXFUN(__getdate_err,(void)); +int *__getdate_err (void); -struct tm * _EXFUN(getdate, (const char *)); +struct tm * getdate (const char *); /* getdate_err is set to one of the following values to indicate the error. 1 the DATEMSK environment variable is null or undefined, 2 the template file cannot be opened for reading, @@ -145,7 +145,7 @@ struct tm * _EXFUN(getdate, (const char *)); #if __GNU_VISIBLE /* getdate_r returns the error code as above */ -int _EXFUN(getdate_r, (const char *, struct tm *)); +int getdate_r (const char *, struct tm *); #endif /* __GNU_VISIBLE */ #endif /* HAVE_GETDATE */ @@ -183,33 +183,31 @@ extern "C" { /* Clocks, P1003.1b-1993, p. 263 */ -int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp)); -int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp)); -int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res)); +int clock_settime (clockid_t clock_id, const struct timespec *tp); +int clock_gettime (clockid_t clock_id, struct timespec *tp); +int clock_getres (clockid_t clock_id, struct timespec *res); /* Create a Per-Process Timer, P1003.1b-1993, p. 264 */ -int _EXFUN(timer_create, - (clockid_t clock_id, +int timer_create (clockid_t clock_id, struct sigevent *__restrict evp, - timer_t *__restrict timerid)); + timer_t *__restrict timerid); /* Delete a Per_process Timer, P1003.1b-1993, p. 266 */ -int _EXFUN(timer_delete, (timer_t timerid)); +int timer_delete (timer_t timerid); /* Per-Process Timers, P1003.1b-1993, p. 267 */ -int _EXFUN(timer_settime, - (timer_t timerid, int flags, +int timer_settime (timer_t timerid, int flags, const struct itimerspec *__restrict value, - struct itimerspec *__restrict ovalue)); -int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value)); -int _EXFUN(timer_getoverrun, (timer_t timerid)); + struct itimerspec *__restrict ovalue); +int timer_gettime (timer_t timerid, struct itimerspec *value); +int timer_getoverrun (timer_t timerid); /* High Resolution Sleep, P1003.1b-1993, p. 269 */ -int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); +int nanosleep (const struct timespec *rqtp, struct timespec *rmtp); #ifdef __cplusplus } @@ -222,9 +220,8 @@ int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); extern "C" { #endif -int _EXFUN(clock_nanosleep, - (clockid_t clock_id, int flags, const struct timespec *rqtp, - struct timespec *rmtp)); +int clock_nanosleep (clockid_t clock_id, int flags, + const struct timespec *rqtp, struct timespec *rmtp); #ifdef __cplusplus } @@ -297,7 +294,7 @@ extern "C" { /* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */ -int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id)); +int clock_getcpuclockid (pid_t pid, clockid_t *clock_id); #endif /* _POSIX_CPUTIME */ @@ -305,8 +302,8 @@ int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id)); /* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */ -int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr)); -int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr)); +int clock_setenable_attr (clockid_t clock_id, int attr); +int clock_getenable_attr (clockid_t clock_id, int *attr); #endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */ diff --git a/newlib/libc/include/wchar.h b/newlib/libc/include/wchar.h index dccc10627..c84834277 100644 --- a/newlib/libc/include/wchar.h +++ b/newlib/libc/include/wchar.h @@ -86,90 +86,90 @@ struct tm; typedef _mbstate_t mbstate_t; #endif /* _MBSTATE_T */ -wint_t _EXFUN(btowc, (int)); -int _EXFUN(wctob, (wint_t)); -size_t _EXFUN(mbrlen, (const char *__restrict, size_t, mbstate_t *__restrict)); -size_t _EXFUN(mbrtowc, (wchar_t *__restrict, const char *__restrict, size_t, - mbstate_t *__restrict)); -size_t _EXFUN(_mbrtowc_r, (struct _reent *, wchar_t * , const char * , - size_t, mbstate_t *)); -int _EXFUN(mbsinit, (const mbstate_t *)); +wint_t btowc (int); +int wctob (wint_t); +size_t mbrlen (const char *__restrict, size_t, mbstate_t *__restrict); +size_t mbrtowc (wchar_t *__restrict, const char *__restrict, size_t, + mbstate_t *__restrict); +size_t _mbrtowc_r (struct _reent *, wchar_t * , const char * , + size_t, mbstate_t *); +int mbsinit (const mbstate_t *); #if __POSIX_VISIBLE >= 200809 -size_t _EXFUN(mbsnrtowcs, (wchar_t *__restrict, const char **__restrict, - size_t, size_t, mbstate_t *__restrict)); +size_t mbsnrtowcs (wchar_t *__restrict, const char **__restrict, + size_t, size_t, mbstate_t *__restrict); #endif -size_t _EXFUN(_mbsnrtowcs_r, (struct _reent *, wchar_t * , const char ** , - size_t, size_t, mbstate_t *)); -size_t _EXFUN(mbsrtowcs, (wchar_t *__restrict, const char **__restrict, size_t, - mbstate_t *__restrict)); -size_t _EXFUN(_mbsrtowcs_r, (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *)); -size_t _EXFUN(wcrtomb, (char *__restrict, wchar_t, mbstate_t *__restrict)); -size_t _EXFUN(_wcrtomb_r, (struct _reent *, char * , wchar_t, mbstate_t *)); +size_t _mbsnrtowcs_r (struct _reent *, wchar_t * , const char ** , + size_t, size_t, mbstate_t *); +size_t mbsrtowcs (wchar_t *__restrict, const char **__restrict, size_t, + mbstate_t *__restrict); +size_t _mbsrtowcs_r (struct _reent *, wchar_t * , const char ** , size_t, mbstate_t *); +size_t wcrtomb (char *__restrict, wchar_t, mbstate_t *__restrict); +size_t _wcrtomb_r (struct _reent *, char * , wchar_t, mbstate_t *); #if __POSIX_VISIBLE >= 200809 -size_t _EXFUN(wcsnrtombs, (char *__restrict, const wchar_t **__restrict, - size_t, size_t, mbstate_t *__restrict)); +size_t wcsnrtombs (char *__restrict, const wchar_t **__restrict, + size_t, size_t, mbstate_t *__restrict); #endif -size_t _EXFUN(_wcsnrtombs_r, (struct _reent *, char * , const wchar_t ** , - size_t, size_t, mbstate_t *)); -size_t _EXFUN(wcsrtombs, (char *__restrict, const wchar_t **__restrict, - size_t, mbstate_t *__restrict)); -size_t _EXFUN(_wcsrtombs_r, (struct _reent *, char * , const wchar_t ** , - size_t, mbstate_t *)); +size_t _wcsnrtombs_r (struct _reent *, char * , const wchar_t ** , + size_t, size_t, mbstate_t *); +size_t wcsrtombs (char *__restrict, const wchar_t **__restrict, + size_t, mbstate_t *__restrict); +size_t _wcsrtombs_r (struct _reent *, char * , const wchar_t ** , + size_t, mbstate_t *); #if __POSIX_VISIBLE >= 200809 -int _EXFUN(wcscasecmp, (const wchar_t *, const wchar_t *)); +int wcscasecmp (const wchar_t *, const wchar_t *); #endif -wchar_t *_EXFUN(wcscat, (wchar_t *__restrict, const wchar_t *__restrict)); -wchar_t *_EXFUN(wcschr, (const wchar_t *, wchar_t)); -int _EXFUN(wcscmp, (const wchar_t *, const wchar_t *)); -int _EXFUN(wcscoll, (const wchar_t *, const wchar_t *)); -wchar_t *_EXFUN(wcscpy, (wchar_t *__restrict, const wchar_t *__restrict)); +wchar_t *wcscat (wchar_t *__restrict, const wchar_t *__restrict); +wchar_t *wcschr (const wchar_t *, wchar_t); +int wcscmp (const wchar_t *, const wchar_t *); +int wcscoll (const wchar_t *, const wchar_t *); +wchar_t *wcscpy (wchar_t *__restrict, const wchar_t *__restrict); #if __POSIX_VISIBLE >= 200809 -wchar_t *_EXFUN(wcpcpy, (wchar_t *__restrict, - const wchar_t *__restrict)); -wchar_t *_EXFUN(wcsdup, (const wchar_t *)); +wchar_t *wcpcpy (wchar_t *__restrict, + const wchar_t *__restrict); +wchar_t *wcsdup (const wchar_t *); #endif -wchar_t *_EXFUN(_wcsdup_r, (struct _reent *, const wchar_t * )); -size_t _EXFUN(wcscspn, (const wchar_t *, const wchar_t *)); -size_t _EXFUN(wcsftime, (wchar_t *__restrict, size_t, - const wchar_t *__restrict, const struct tm *__restrict)); +wchar_t *_wcsdup_r (struct _reent *, const wchar_t * ); +size_t wcscspn (const wchar_t *, const wchar_t *); +size_t wcsftime (wchar_t *__restrict, size_t, + const wchar_t *__restrict, const struct tm *__restrict); #if __GNU_VISIBLE size_t wcsftime_l (wchar_t *__restrict, size_t, const wchar_t *__restrict, const struct tm *__restrict, locale_t); #endif -size_t _EXFUN(wcslcat, (wchar_t *, const wchar_t *, size_t)); -size_t _EXFUN(wcslcpy, (wchar_t *, const wchar_t *, size_t)); -size_t _EXFUN(wcslen, (const wchar_t *)); +size_t wcslcat (wchar_t *, const wchar_t *, size_t); +size_t wcslcpy (wchar_t *, const wchar_t *, size_t); +size_t wcslen (const wchar_t *); #if __POSIX_VISIBLE >= 200809 -int _EXFUN(wcsncasecmp, (const wchar_t *, const wchar_t *, size_t)); +int wcsncasecmp (const wchar_t *, const wchar_t *, size_t); #endif -wchar_t *_EXFUN(wcsncat, (wchar_t *__restrict, - const wchar_t *__restrict, size_t)); -int _EXFUN(wcsncmp, (const wchar_t *, const wchar_t *, size_t)); -wchar_t *_EXFUN(wcsncpy, (wchar_t *__restrict, - const wchar_t *__restrict, size_t)); +wchar_t *wcsncat (wchar_t *__restrict, + const wchar_t *__restrict, size_t); +int wcsncmp (const wchar_t *, const wchar_t *, size_t); +wchar_t *wcsncpy (wchar_t *__restrict, + const wchar_t *__restrict, size_t); #if __POSIX_VISIBLE >= 200809 -wchar_t *_EXFUN(wcpncpy, (wchar_t *__restrict, - const wchar_t *__restrict, size_t)); -size_t _EXFUN(wcsnlen, (const wchar_t *, size_t)); +wchar_t *wcpncpy (wchar_t *__restrict, + const wchar_t *__restrict, size_t); +size_t wcsnlen (const wchar_t *, size_t); #endif -wchar_t *_EXFUN(wcspbrk, (const wchar_t *, const wchar_t *)); -wchar_t *_EXFUN(wcsrchr, (const wchar_t *, wchar_t)); -size_t _EXFUN(wcsspn, (const wchar_t *, const wchar_t *)); -wchar_t *_EXFUN(wcsstr, (const wchar_t *__restrict, - const wchar_t *__restrict)); -wchar_t *_EXFUN(wcstok, (wchar_t *__restrict, const wchar_t *__restrict, - wchar_t **__restrict)); -double _EXFUN(wcstod, (const wchar_t *__restrict, wchar_t **__restrict)); -double _EXFUN(_wcstod_r, (struct _reent *, const wchar_t *, wchar_t **)); +wchar_t *wcspbrk (const wchar_t *, const wchar_t *); +wchar_t *wcsrchr (const wchar_t *, wchar_t); +size_t wcsspn (const wchar_t *, const wchar_t *); +wchar_t *wcsstr (const wchar_t *__restrict, + const wchar_t *__restrict); +wchar_t *wcstok (wchar_t *__restrict, const wchar_t *__restrict, + wchar_t **__restrict); +double wcstod (const wchar_t *__restrict, wchar_t **__restrict); +double _wcstod_r (struct _reent *, const wchar_t *, wchar_t **); #if __ISO_C_VISIBLE >= 1999 -float _EXFUN(wcstof, (const wchar_t *__restrict, wchar_t **__restrict)); +float wcstof (const wchar_t *__restrict, wchar_t **__restrict); #endif -float _EXFUN(_wcstof_r, (struct _reent *, const wchar_t *, wchar_t **)); +float _wcstof_r (struct _reent *, const wchar_t *, wchar_t **); #if __XSI_VISIBLE -int _EXFUN(wcswidth, (const wchar_t *, size_t)); +int wcswidth (const wchar_t *, size_t); #endif -size_t _EXFUN(wcsxfrm, (wchar_t *__restrict, const wchar_t *__restrict, - size_t)); +size_t wcsxfrm (wchar_t *__restrict, const wchar_t *__restrict, + size_t); #if __POSIX_VISIBLE >= 200809 extern int wcscasecmp_l (const wchar_t *, const wchar_t *, locale_t); extern int wcsncasecmp_l (const wchar_t *, const wchar_t *, size_t, locale_t); @@ -179,36 +179,36 @@ extern size_t wcsxfrm_l (wchar_t *__restrict, const wchar_t *__restrict, size_t, #endif #if __XSI_VISIBLE -int _EXFUN(wcwidth, (const wchar_t)); +int wcwidth (const wchar_t); #endif -wchar_t *_EXFUN(wmemchr, (const wchar_t *, wchar_t, size_t)); -int _EXFUN(wmemcmp, (const wchar_t *, const wchar_t *, size_t)); -wchar_t *_EXFUN(wmemcpy, (wchar_t *__restrict, const wchar_t *__restrict, - size_t)); -wchar_t *_EXFUN(wmemmove, (wchar_t *, const wchar_t *, size_t)); +wchar_t *wmemchr (const wchar_t *, wchar_t, size_t); +int wmemcmp (const wchar_t *, const wchar_t *, size_t); +wchar_t *wmemcpy (wchar_t *__restrict, const wchar_t *__restrict, + size_t); +wchar_t *wmemmove (wchar_t *, const wchar_t *, size_t); #if __GNU_VISIBLE -wchar_t *_EXFUN(wmempcpy, (wchar_t *__restrict, const wchar_t *__restrict, - size_t)); +wchar_t *wmempcpy (wchar_t *__restrict, const wchar_t *__restrict, + size_t); #endif -wchar_t *_EXFUN(wmemset, (wchar_t *, wchar_t, size_t)); +wchar_t *wmemset (wchar_t *, wchar_t, size_t); -long _EXFUN(wcstol, (const wchar_t *__restrict, wchar_t **__restrict, int)); +long wcstol (const wchar_t *__restrict, wchar_t **__restrict, int); #if __ISO_C_VISIBLE >= 1999 -long long _EXFUN(wcstoll, (const wchar_t *__restrict, wchar_t **__restrict, - int)); +long long wcstoll (const wchar_t *__restrict, wchar_t **__restrict, + int); #endif -unsigned long _EXFUN(wcstoul, (const wchar_t *__restrict, wchar_t **__restrict, - int)); +unsigned long wcstoul (const wchar_t *__restrict, wchar_t **__restrict, + int); #if __ISO_C_VISIBLE >= 1999 -unsigned long long _EXFUN(wcstoull, (const wchar_t *__restrict, - wchar_t **__restrict, int)); +unsigned long long wcstoull (const wchar_t *__restrict, + wchar_t **__restrict, int); #endif -long _EXFUN(_wcstol_r, (struct _reent *, const wchar_t *, wchar_t **, int)); -long long _EXFUN(_wcstoll_r, (struct _reent *, const wchar_t *, wchar_t **, int)); -unsigned long _EXFUN(_wcstoul_r, (struct _reent *, const wchar_t *, wchar_t **, int)); -unsigned long long _EXFUN(_wcstoull_r, (struct _reent *, const wchar_t *, wchar_t **, int)); +long _wcstol_r (struct _reent *, const wchar_t *, wchar_t **, int); +long long _wcstoll_r (struct _reent *, const wchar_t *, wchar_t **, int); +unsigned long _wcstoul_r (struct _reent *, const wchar_t *, wchar_t **, int); +unsigned long long _wcstoull_r (struct _reent *, const wchar_t *, wchar_t **, int); #if __ISO_C_VISIBLE >= 1999 -long double _EXFUN(wcstold, (const wchar_t *, wchar_t **)); +long double wcstold (const wchar_t *, wchar_t **); #endif #if __GNU_VISIBLE @@ -224,53 +224,53 @@ float wcstof_l (const wchar_t *, wchar_t **, locale_t); long double wcstold_l (const wchar_t *, wchar_t **, locale_t); #endif -wint_t _EXFUN(fgetwc, (__FILE *)); -wchar_t *_EXFUN(fgetws, (wchar_t *__restrict, int, __FILE *__restrict)); -wint_t _EXFUN(fputwc, (wchar_t, __FILE *)); -int _EXFUN(fputws, (const wchar_t *__restrict, __FILE *__restrict)); +wint_t fgetwc (__FILE *); +wchar_t *fgetws (wchar_t *__restrict, int, __FILE *__restrict); +wint_t fputwc (wchar_t, __FILE *); +int fputws (const wchar_t *__restrict, __FILE *__restrict); #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 -int _EXFUN (fwide, (__FILE *, int)); +int fwide (__FILE *, int); #endif -wint_t _EXFUN (getwc, (__FILE *)); -wint_t _EXFUN (getwchar, (void)); -wint_t _EXFUN(putwc, (wchar_t, __FILE *)); -wint_t _EXFUN(putwchar, (wchar_t)); -wint_t _EXFUN (ungetwc, (wint_t wc, __FILE *)); +wint_t getwc (__FILE *); +wint_t getwchar (void); +wint_t putwc (wchar_t, __FILE *); +wint_t putwchar (wchar_t); +wint_t ungetwc (wint_t wc, __FILE *); -wint_t _EXFUN(_fgetwc_r, (struct _reent *, __FILE *)); -wint_t _EXFUN(_fgetwc_unlocked_r, (struct _reent *, __FILE *)); -wchar_t *_EXFUN(_fgetws_r, (struct _reent *, wchar_t *, int, __FILE *)); -wchar_t *_EXFUN(_fgetws_unlocked_r, (struct _reent *, wchar_t *, int, __FILE *)); -wint_t _EXFUN(_fputwc_r, (struct _reent *, wchar_t, __FILE *)); -wint_t _EXFUN(_fputwc_unlocked_r, (struct _reent *, wchar_t, __FILE *)); -int _EXFUN(_fputws_r, (struct _reent *, const wchar_t *, __FILE *)); -int _EXFUN(_fputws_unlocked_r, (struct _reent *, const wchar_t *, __FILE *)); -int _EXFUN (_fwide_r, (struct _reent *, __FILE *, int)); -wint_t _EXFUN (_getwc_r, (struct _reent *, __FILE *)); -wint_t _EXFUN (_getwc_unlocked_r, (struct _reent *, __FILE *)); -wint_t _EXFUN (_getwchar_r, (struct _reent *ptr)); -wint_t _EXFUN (_getwchar_unlocked_r, (struct _reent *ptr)); -wint_t _EXFUN(_putwc_r, (struct _reent *, wchar_t, __FILE *)); -wint_t _EXFUN(_putwc_unlocked_r, (struct _reent *, wchar_t, __FILE *)); -wint_t _EXFUN(_putwchar_r, (struct _reent *, wchar_t)); -wint_t _EXFUN(_putwchar_unlocked_r, (struct _reent *, wchar_t)); -wint_t _EXFUN (_ungetwc_r, (struct _reent *, wint_t wc, __FILE *)); +wint_t _fgetwc_r (struct _reent *, __FILE *); +wint_t _fgetwc_unlocked_r (struct _reent *, __FILE *); +wchar_t *_fgetws_r (struct _reent *, wchar_t *, int, __FILE *); +wchar_t *_fgetws_unlocked_r (struct _reent *, wchar_t *, int, __FILE *); +wint_t _fputwc_r (struct _reent *, wchar_t, __FILE *); +wint_t _fputwc_unlocked_r (struct _reent *, wchar_t, __FILE *); +int _fputws_r (struct _reent *, const wchar_t *, __FILE *); +int _fputws_unlocked_r (struct _reent *, const wchar_t *, __FILE *); +int _fwide_r (struct _reent *, __FILE *, int); +wint_t _getwc_r (struct _reent *, __FILE *); +wint_t _getwc_unlocked_r (struct _reent *, __FILE *); +wint_t _getwchar_r (struct _reent *ptr); +wint_t _getwchar_unlocked_r (struct _reent *ptr); +wint_t _putwc_r (struct _reent *, wchar_t, __FILE *); +wint_t _putwc_unlocked_r (struct _reent *, wchar_t, __FILE *); +wint_t _putwchar_r (struct _reent *, wchar_t); +wint_t _putwchar_unlocked_r (struct _reent *, wchar_t); +wint_t _ungetwc_r (struct _reent *, wint_t wc, __FILE *); #if __GNU_VISIBLE -wint_t _EXFUN(fgetwc_unlocked, (__FILE *)); -wchar_t *_EXFUN(fgetws_unlocked, (wchar_t *__restrict, int, __FILE *__restrict)); -wint_t _EXFUN(fputwc_unlocked, (wchar_t, __FILE *)); -int _EXFUN(fputws_unlocked, (const wchar_t *__restrict, __FILE *__restrict)); -wint_t _EXFUN(getwc_unlocked, (__FILE *)); -wint_t _EXFUN(getwchar_unlocked, (void)); -wint_t _EXFUN(putwc_unlocked, (wchar_t, __FILE *)); -wint_t _EXFUN(putwchar_unlocked, (wchar_t)); +wint_t fgetwc_unlocked (__FILE *); +wchar_t *fgetws_unlocked (wchar_t *__restrict, int, __FILE *__restrict); +wint_t fputwc_unlocked (wchar_t, __FILE *); +int fputws_unlocked (const wchar_t *__restrict, __FILE *__restrict); +wint_t getwc_unlocked (__FILE *); +wint_t getwchar_unlocked (void); +wint_t putwc_unlocked (wchar_t, __FILE *); +wint_t putwchar_unlocked (wchar_t); #endif #if __POSIX_VISIBLE >= 200809 -__FILE *_EXFUN (open_wmemstream, (wchar_t **, size_t *)); +__FILE *open_wmemstream (wchar_t **, size_t *); #endif -__FILE *_EXFUN (_open_wmemstream_r, (struct _reent *, wchar_t **, size_t *)); +__FILE *_open_wmemstream_r (struct _reent *, wchar_t **, size_t *); #ifndef __VALIST #ifdef __GNUC__ @@ -281,42 +281,42 @@ __FILE *_EXFUN (_open_wmemstream_r, (struct _reent *, wchar_t **, size_t *)); #endif #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 -int _EXFUN(fwprintf, (__FILE *__restrict, const wchar_t *__restrict, ...)); -int _EXFUN(swprintf, (wchar_t *__restrict, size_t, - const wchar_t *__restrict, ...)); -int _EXFUN(vfwprintf, (__FILE *__restrict, const wchar_t *__restrict, - __VALIST)); -int _EXFUN(vswprintf, (wchar_t *__restrict, size_t, - const wchar_t *__restrict, __VALIST)); -int _EXFUN(vwprintf, (const wchar_t *__restrict, __VALIST)); -int _EXFUN(wprintf, (const wchar_t *__restrict, ...)); +int fwprintf (__FILE *__restrict, const wchar_t *__restrict, ...); +int swprintf (wchar_t *__restrict, size_t, + const wchar_t *__restrict, ...); +int vfwprintf (__FILE *__restrict, const wchar_t *__restrict, + __VALIST); +int vswprintf (wchar_t *__restrict, size_t, + const wchar_t *__restrict, __VALIST); +int vwprintf (const wchar_t *__restrict, __VALIST); +int wprintf (const wchar_t *__restrict, ...); #endif -int _EXFUN(_fwprintf_r, (struct _reent *, __FILE *, const wchar_t *, ...)); -int _EXFUN(_swprintf_r, (struct _reent *, wchar_t *, size_t, const wchar_t *, ...)); -int _EXFUN(_vfwprintf_r, (struct _reent *, __FILE *, const wchar_t *, __VALIST)); -int _EXFUN(_vswprintf_r, (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST)); -int _EXFUN(_vwprintf_r, (struct _reent *, const wchar_t *, __VALIST)); -int _EXFUN(_wprintf_r, (struct _reent *, const wchar_t *, ...)); +int _fwprintf_r (struct _reent *, __FILE *, const wchar_t *, ...); +int _swprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, ...); +int _vfwprintf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST); +int _vswprintf_r (struct _reent *, wchar_t *, size_t, const wchar_t *, __VALIST); +int _vwprintf_r (struct _reent *, const wchar_t *, __VALIST); +int _wprintf_r (struct _reent *, const wchar_t *, ...); #if __ISO_C_VISIBLE >= 1999 || __XSI_VISIBLE >= 500 -int _EXFUN(fwscanf, (__FILE *__restrict, const wchar_t *__restrict, ...)); -int _EXFUN(swscanf, (const wchar_t *__restrict, - const wchar_t *__restrict, ...)); -int _EXFUN(vfwscanf, (__FILE *__restrict, const wchar_t *__restrict, - __VALIST)); -int _EXFUN(vswscanf, (const wchar_t *__restrict, const wchar_t *__restrict, - __VALIST)); -int _EXFUN(vwscanf, (const wchar_t *__restrict, __VALIST)); -int _EXFUN(wscanf, (const wchar_t *__restrict, ...)); +int fwscanf (__FILE *__restrict, const wchar_t *__restrict, ...); +int swscanf (const wchar_t *__restrict, + const wchar_t *__restrict, ...); +int vfwscanf (__FILE *__restrict, const wchar_t *__restrict, + __VALIST); +int vswscanf (const wchar_t *__restrict, const wchar_t *__restrict, + __VALIST); +int vwscanf (const wchar_t *__restrict, __VALIST); +int wscanf (const wchar_t *__restrict, ...); #endif -int _EXFUN(_fwscanf_r, (struct _reent *, __FILE *, const wchar_t *, ...)); -int _EXFUN(_swscanf_r, (struct _reent *, const wchar_t *, const wchar_t *, ...)); -int _EXFUN(_vfwscanf_r, (struct _reent *, __FILE *, const wchar_t *, __VALIST)); -int _EXFUN(_vswscanf_r, (struct _reent *, const wchar_t *, const wchar_t *, __VALIST)); -int _EXFUN(_vwscanf_r, (struct _reent *, const wchar_t *, __VALIST)); -int _EXFUN(_wscanf_r, (struct _reent *, const wchar_t *, ...)); +int _fwscanf_r (struct _reent *, __FILE *, const wchar_t *, ...); +int _swscanf_r (struct _reent *, const wchar_t *, const wchar_t *, ...); +int _vfwscanf_r (struct _reent *, __FILE *, const wchar_t *, __VALIST); +int _vswscanf_r (struct _reent *, const wchar_t *, const wchar_t *, __VALIST); +int _vwscanf_r (struct _reent *, const wchar_t *, __VALIST); +int _wscanf_r (struct _reent *, const wchar_t *, ...); #define getwc(fp) fgetwc(fp) #define putwc(wc,fp) fputwc((wc), (fp)) diff --git a/newlib/libc/include/wctype.h b/newlib/libc/include/wctype.h index 3d36d5a92..9b710900d 100644 --- a/newlib/libc/include/wctype.h +++ b/newlib/libc/include/wctype.h @@ -27,26 +27,26 @@ typedef int wctype_t; typedef int wctrans_t; #endif -int _EXFUN(iswalpha, (wint_t)); -int _EXFUN(iswalnum, (wint_t)); +int iswalpha (wint_t); +int iswalnum (wint_t); #if __ISO_C_VISIBLE >= 1999 -int _EXFUN(iswblank, (wint_t)); +int iswblank (wint_t); #endif -int _EXFUN(iswcntrl, (wint_t)); -int _EXFUN(iswctype, (wint_t, wctype_t)); -int _EXFUN(iswdigit, (wint_t)); -int _EXFUN(iswgraph, (wint_t)); -int _EXFUN(iswlower, (wint_t)); -int _EXFUN(iswprint, (wint_t)); -int _EXFUN(iswpunct, (wint_t)); -int _EXFUN(iswspace, (wint_t)); -int _EXFUN(iswupper, (wint_t)); -int _EXFUN(iswxdigit, (wint_t)); -wint_t _EXFUN(towctrans, (wint_t, wctrans_t)); -wint_t _EXFUN(towupper, (wint_t)); -wint_t _EXFUN(towlower, (wint_t)); -wctrans_t _EXFUN(wctrans, (const char *)); -wctype_t _EXFUN(wctype, (const char *)); +int iswcntrl (wint_t); +int iswctype (wint_t, wctype_t); +int iswdigit (wint_t); +int iswgraph (wint_t); +int iswlower (wint_t); +int iswprint (wint_t); +int iswpunct (wint_t); +int iswspace (wint_t); +int iswupper (wint_t); +int iswxdigit (wint_t); +wint_t towctrans (wint_t, wctrans_t); +wint_t towupper (wint_t); +wint_t towlower (wint_t); +wctrans_t wctrans (const char *); +wctype_t wctype (const char *); #if __POSIX_VISIBLE >= 200809 extern int iswalpha_l (wint_t, locale_t); diff --git a/newlib/libc/machine/powerpc/machine/malloc.h b/newlib/libc/machine/powerpc/machine/malloc.h index 394ad4e4e..32fbb268b 100644 --- a/newlib/libc/machine/powerpc/machine/malloc.h +++ b/newlib/libc/machine/powerpc/machine/malloc.h @@ -3,14 +3,14 @@ # if defined(__ALTIVEC__) -void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); -void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); -void _EXFUN(vec_free,(void *)); +void *vec_calloc (size_t __nmemb, size_t __size); +void *_vec_calloc_r (struct _reent *, size_t __nmemb, size_t __size); +void vec_free (void *); #define _vec_freer _freer -void *_EXFUN(vec_malloc,(size_t __size)); +void *vec_malloc (size_t __size); #define _vec_mallocr _memalign_r -void *_EXFUN(vec_realloc,(void *__r, size_t __size)); -void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size)); +void *vec_realloc (void *__r, size_t __size); +void *_vec_realloc_r (struct _reent *, void *__r, size_t __size); # endif /* __ALTIVEC__ */ diff --git a/newlib/libc/machine/powerpc/machine/stdlib.h b/newlib/libc/machine/powerpc/machine/stdlib.h index ea597102b..2db801092 100644 --- a/newlib/libc/machine/powerpc/machine/stdlib.h +++ b/newlib/libc/machine/powerpc/machine/stdlib.h @@ -5,14 +5,14 @@ # if defined(__ALTIVEC__) -void *_EXFUN(vec_calloc,(size_t __nmemb, size_t __size)); -void *_EXFUN(_vec_calloc_r,(struct _reent *, size_t __nmemb, size_t __size)); -void _EXFUN(vec_free,(void *)); +void *vec_calloc (size_t __nmemb, size_t __size); +void *_vec_calloc_r (struct _reent *, size_t __nmemb, size_t __size); +void vec_free (void *); #define _vec_freer _freer -void *_EXFUN(vec_malloc,(size_t __size)); +void *vec_malloc (size_t __size); #define _vec_mallocr _memalign_r -void *_EXFUN(vec_realloc,(void *__r, size_t __size)); -void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size)); +void *vec_realloc (void *__r, size_t __size); +void *_vec_realloc_r (struct _reent *, void *__r, size_t __size); # endif /* __ALTIVEC__ */ @@ -24,39 +24,39 @@ void *_EXFUN(_vec_realloc_r,(struct _reent *, void *__r, size_t __size)); #ifdef __cplusplus extern "C" { #endif -__int16_t _EXFUN(atosfix16,(const char *__str)); -__int16_t _EXFUN(_atosfix16_r,(struct _reent *, const char *__str)); -__int32_t _EXFUN(atosfix32,(const char *__str)); -__int32_t _EXFUN(_atosfix32_r,(struct _reent *, const char *__str)); -__int64_t _EXFUN(atosfix64,(const char *__str)); -__int64_t _EXFUN(_atosfix64_r,(struct _reent *, const char *__str)); +__int16_t atosfix16 (const char *__str); +__int16_t _atosfix16_r (struct _reent *, const char *__str); +__int32_t atosfix32 (const char *__str); +__int32_t _atosfix32_r (struct _reent *, const char *__str); +__int64_t atosfix64 (const char *__str); +__int64_t _atosfix64_r (struct _reent *, const char *__str); -__uint16_t _EXFUN(atoufix16,(const char *__str)); -__uint16_t _EXFUN(_atoufix16_r,(struct _reent *, const char *__str)); -__uint32_t _EXFUN(atoufix32,(const char *__str)); -__uint32_t _EXFUN(_atoufix32_r,(struct _reent *, const char *__str)); -__uint64_t _EXFUN(atoufix64,(const char *__str)); -__uint64_t _EXFUN(_atoufix64_r,(struct _reent *, const char *__str)); +__uint16_t atoufix16 (const char *__str); +__uint16_t _atoufix16_r (struct _reent *, const char *__str); +__uint32_t atoufix32 (const char *__str); +__uint32_t _atoufix32_r (struct _reent *, const char *__str); +__uint64_t atoufix64 (const char *__str); +__uint64_t _atoufix64_r (struct _reent *, const char *__str); -__int16_t _EXFUN(strtosfix16,(const char *__str, char **__endptr)); -__int16_t _EXFUN(_strtosfix16_r,(struct _reent *, const char *__str, - char **__endptr)); -__int32_t _EXFUN(strtosfix32,(const char *__str, char **__endptr)); -__int32_t _EXFUN(_strtosfix32_r,(struct _reent *, const char *__str, - char **__endptr)); -__int64_t _EXFUN(strtosfix64,(const char *__str, char **__endptr)); -__int64_t _EXFUN(_strtosfix64_r,(struct _reent *, const char *__str, - char **__endptr)); +__int16_t strtosfix16 (const char *__str, char **__endptr); +__int16_t _strtosfix16_r (struct _reent *, const char *__str, + char **__endptr); +__int32_t strtosfix32 (const char *__str, char **__endptr); +__int32_t _strtosfix32_r (struct _reent *, const char *__str, + char **__endptr); +__int64_t strtosfix64 (const char *__str, char **__endptr); +__int64_t _strtosfix64_r (struct _reent *, const char *__str, + char **__endptr); -__uint16_t _EXFUN(strtoufix16,(const char *__str, char **__endptr)); -__uint16_t _EXFUN(_strtoufix16_r,(struct _reent *, const char *__str, - char **__endptr)); -__uint32_t _EXFUN(strtoufix32,(const char *__str, char **__endptr)); -__uint32_t _EXFUN(_strtoufix32_r,(struct _reent *, const char *__str, - char **__endptr)); -__uint64_t _EXFUN(strtoufix64,(const char *__str, char **__endptr)); -__uint64_t _EXFUN(_strtoufix64_r,(struct _reent *, const char *__str, - char **__endptr)); +__uint16_t strtoufix16 (const char *__str, char **__endptr); +__uint16_t _strtoufix16_r (struct _reent *, const char *__str, + char **__endptr); +__uint32_t strtoufix32 (const char *__str, char **__endptr); +__uint32_t _strtoufix32_r (struct _reent *, const char *__str, + char **__endptr); +__uint64_t strtoufix64 (const char *__str, char **__endptr); +__uint64_t _strtoufix64_r (struct _reent *, const char *__str, + char **__endptr); #ifdef __cplusplus } #endif diff --git a/newlib/libc/machine/spu/c99ppe.h b/newlib/libc/machine/spu/c99ppe.h index b0ccf2dc0..ccd2d257c 100644 --- a/newlib/libc/machine/spu/c99ppe.h +++ b/newlib/libc/machine/spu/c99ppe.h @@ -99,8 +99,8 @@ struct spe_reg128{ unsigned int slot[4]; }; -void _EXFUN(__sinit,(struct _reent *)); -FILE *_EXFUN(__sfp,(struct _reent *)); +void __sinit (struct _reent *); +FILE *__sfp (struct _reent *); #define __sfp_free(fp) ( (fp)->_fp = 0 ) #define CHECK_INIT(ptr) \ diff --git a/newlib/libc/misc/__dprintf.c b/newlib/libc/misc/__dprintf.c index 592d714c2..31454f4c2 100644 --- a/newlib/libc/misc/__dprintf.c +++ b/newlib/libc/misc/__dprintf.c @@ -20,10 +20,10 @@ static char *parse_number (); #endif -static long _EXFUN(get_number, (char *, long, int)); -static void _EXFUN(print_number, (int, int, long)); -static void _EXFUN(write_char, (char c)); -static void _EXFUN(write_string, (const char *s)); +static long get_number (char *, long, int); +static void print_number (int, int, long); +static void write_char (char c); +static void write_string (const char *s); /* Non-zero for big-endian systems. */ static int big_endian_p; diff --git a/newlib/libc/stdio/asnprintf.c b/newlib/libc/stdio/asnprintf.c index 34639dc09..f657f9ec9 100644 --- a/newlib/libc/stdio/asnprintf.c +++ b/newlib/libc/stdio/asnprintf.c @@ -59,8 +59,8 @@ _asnprintf_r (struct _reent *__restrict ptr, #ifdef _NANO_FORMATTED_IO char * -_EXFUN(_asniprintf_r, (struct _reent *, char *, size_t *, const char *, ...) - _ATTRIBUTE ((__alias__("_asnprintf_r")))); +_asniprintf_r (struct _reent *, char *, size_t *, const char *, ...) + _ATTRIBUTE ((__alias__("_asnprintf_r"))); #endif #ifndef _REENT_ONLY @@ -111,7 +111,7 @@ asnprintf (char *__restrict buf, #ifdef _NANO_FORMATTED_IO char * -_EXFUN(asniprintf, (char *, size_t *, const char *, ...) - _ATTRIBUTE ((__alias__("asnprintf")))); +asniprintf (char *, size_t *, const char *, ...) + _ATTRIBUTE ((__alias__("asnprintf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/asprintf.c b/newlib/libc/stdio/asprintf.c index 330491ebe..25696c575 100644 --- a/newlib/libc/stdio/asprintf.c +++ b/newlib/libc/stdio/asprintf.c @@ -51,8 +51,8 @@ _asprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_asiprintf_r, (struct _reent *, char **, const char *, ...) - _ATTRIBUTE ((__alias__("_asprintf_r")))); +_asiprintf_r (struct _reent *, char **, const char *, ...) + _ATTRIBUTE ((__alias__("_asprintf_r"))); #endif #ifndef _REENT_ONLY @@ -83,7 +83,7 @@ asprintf (char **__restrict strp, #ifdef _NANO_FORMATTED_IO int -_EXFUN(asiprintf, (char **, const char *, ...) - _ATTRIBUTE ((__alias__("asprintf")))); +asiprintf (char **, const char *, ...) + _ATTRIBUTE ((__alias__("asprintf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/dprintf.c b/newlib/libc/stdio/dprintf.c index 1493e1f18..ae9f86d18 100644 --- a/newlib/libc/stdio/dprintf.c +++ b/newlib/libc/stdio/dprintf.c @@ -68,8 +68,8 @@ _dprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_diprintf_r, (struct _reent *, int, const char *, ...) - _ATTRIBUTE ((__alias__("_dprintf_r")))); +_diprintf_r (struct _reent *, int, const char *, ...) + _ATTRIBUTE ((__alias__("_dprintf_r"))); #endif #ifndef _REENT_ONLY @@ -91,7 +91,7 @@ dprintf (int fd, #ifdef _NANO_FORMATTED_IO int -_EXFUN(diprintf, (int, const char *, ...) - _ATTRIBUTE ((__alias__("dprintf")))); +diprintf (int, const char *, ...) + _ATTRIBUTE ((__alias__("dprintf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/fprintf.c b/newlib/libc/stdio/fprintf.c index 4c03b1a02..efb97ad20 100644 --- a/newlib/libc/stdio/fprintf.c +++ b/newlib/libc/stdio/fprintf.c @@ -37,8 +37,8 @@ _fprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_fiprintf_r, (struct _reent *, FILE *, const char *, ...) - _ATTRIBUTE ((__alias__("_fprintf_r")))); +_fiprintf_r (struct _reent *, FILE *, const char *, ...) + _ATTRIBUTE ((__alias__("_fprintf_r"))); #endif #ifndef _REENT_ONLY @@ -58,7 +58,7 @@ fprintf (FILE *__restrict fp, #ifdef _NANO_FORMATTED_IO int -_EXFUN(fiprintf, (FILE *, const char *, ...) - _ATTRIBUTE ((__alias__("fprintf")))); +fiprintf (FILE *, const char *, ...) + _ATTRIBUTE ((__alias__("fprintf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/fscanf.c b/newlib/libc/stdio/fscanf.c index 40705a5e7..94096a22b 100644 --- a/newlib/libc/stdio/fscanf.c +++ b/newlib/libc/stdio/fscanf.c @@ -52,8 +52,8 @@ fscanf(FILE *fp, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(fiscanf, (FILE *, const char *, ...) - _ATTRIBUTE ((__alias__("fscanf")))); +fiscanf (FILE *, const char *, ...) + _ATTRIBUTE ((__alias__("fscanf"))); #endif #endif /* !_REENT_ONLY */ @@ -84,6 +84,6 @@ _fscanf_r(ptr, FILE *fp, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(_fiscanf_r, (struct _reent *, FILE *, const char *, ...) - _ATTRIBUTE ((__alias__("_fscanf_r")))); +_fiscanf_r (struct _reent *, FILE *, const char *, ...) + _ATTRIBUTE ((__alias__("_fscanf_r"))); #endif diff --git a/newlib/libc/stdio/fvwrite.h b/newlib/libc/stdio/fvwrite.h index 91cabc890..139d83737 100644 --- a/newlib/libc/stdio/fvwrite.h +++ b/newlib/libc/stdio/fvwrite.h @@ -32,5 +32,5 @@ struct __suio { }; -extern int _EXFUN(__sfvwrite_r,(struct _reent *, FILE *, struct __suio *)); -extern int _EXFUN(__swsetup_r,(struct _reent *, FILE *)); +extern int __sfvwrite_r (struct _reent *, FILE *, struct __suio *); +extern int __swsetup_r (struct _reent *, FILE *); diff --git a/newlib/libc/stdio/getline.c b/newlib/libc/stdio/getline.c index 857e980ad..1c59afd2a 100644 --- a/newlib/libc/stdio/getline.c +++ b/newlib/libc/stdio/getline.c @@ -34,7 +34,7 @@ No supporting OS subroutines are directly required. #include <_ansi.h> #include -extern ssize_t _EXFUN(__getdelim, (char **, size_t *, int, FILE *)); +extern ssize_t __getdelim (char **, size_t *, int, FILE *); ssize_t __getline (char **lptr, diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 68a36e054..5f56792de 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -140,59 +140,59 @@ #endif /* __SINGLE_THREAD__ || __IMPL_UNLOCKED__ */ -extern wint_t _EXFUN(__fgetwc, (struct _reent *, FILE *)); -extern wint_t _EXFUN(__fputwc, (struct _reent *, wchar_t, FILE *)); -extern u_char *_EXFUN(__sccl, (char *, u_char *fmt)); -extern int _EXFUN(__svfscanf_r,(struct _reent *,FILE *, const char *,va_list)); -extern int _EXFUN(__ssvfscanf_r,(struct _reent *,FILE *, const char *,va_list)); -extern int _EXFUN(__svfiscanf_r,(struct _reent *,FILE *, const char *,va_list)); -extern int _EXFUN(__ssvfiscanf_r,(struct _reent *,FILE *, const char *,va_list)); -extern int _EXFUN(__svfwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); -extern int _EXFUN(__ssvfwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); -extern int _EXFUN(__svfiwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); -extern int _EXFUN(__ssvfiwscanf_r,(struct _reent *,FILE *, const wchar_t *,va_list)); -int _EXFUN(_svfprintf_r,(struct _reent *, FILE *, const char *, +extern wint_t __fgetwc (struct _reent *, FILE *); +extern wint_t __fputwc (struct _reent *, wchar_t, FILE *); +extern u_char *__sccl (char *, u_char *fmt); +extern int __svfscanf_r (struct _reent *,FILE *, const char *,va_list); +extern int __ssvfscanf_r (struct _reent *,FILE *, const char *,va_list); +extern int __svfiscanf_r (struct _reent *,FILE *, const char *,va_list); +extern int __ssvfiscanf_r (struct _reent *,FILE *, const char *,va_list); +extern int __svfwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list); +extern int __ssvfwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list); +extern int __svfiwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list); +extern int __ssvfiwscanf_r (struct _reent *,FILE *, const wchar_t *,va_list); +int _svfprintf_r (struct _reent *, FILE *, const char *, va_list) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_svfiprintf_r,(struct _reent *, FILE *, const char *, + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _svfiprintf_r (struct _reent *, FILE *, const char *, va_list) - _ATTRIBUTE ((__format__ (__printf__, 3, 0)))); -int _EXFUN(_svfwprintf_r,(struct _reent *, FILE *, const wchar_t *, - va_list)); -int _EXFUN(_svfiwprintf_r,(struct _reent *, FILE *, const wchar_t *, - va_list)); -extern FILE *_EXFUN(__sfp,(struct _reent *)); -extern int _EXFUN(__sflags,(struct _reent *,const char*, int*)); -extern int _EXFUN(__sflush_r,(struct _reent *,FILE *)); + _ATTRIBUTE ((__format__ (__printf__, 3, 0))); +int _svfwprintf_r (struct _reent *, FILE *, const wchar_t *, + va_list); +int _svfiwprintf_r (struct _reent *, FILE *, const wchar_t *, + va_list); +extern FILE *__sfp (struct _reent *); +extern int __sflags (struct _reent *,const char*, int*); +extern int __sflush_r (struct _reent *,FILE *); #ifdef _STDIO_BSD_SEMANTICS -extern int _EXFUN(__sflushw_r,(struct _reent *,FILE *)); +extern int __sflushw_r (struct _reent *,FILE *); #endif -extern int _EXFUN(__srefill_r,(struct _reent *,FILE *)); -extern _READ_WRITE_RETURN_TYPE _EXFUN(__sread,(struct _reent *, void *, char *, - _READ_WRITE_BUFSIZE_TYPE)); -extern _READ_WRITE_RETURN_TYPE _EXFUN(__seofread,(struct _reent *, void *, +extern int __srefill_r (struct _reent *,FILE *); +extern _READ_WRITE_RETURN_TYPE __sread (struct _reent *, void *, char *, + _READ_WRITE_BUFSIZE_TYPE); +extern _READ_WRITE_RETURN_TYPE __seofread (struct _reent *, void *, char *, - _READ_WRITE_BUFSIZE_TYPE)); -extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite,(struct _reent *, void *, + _READ_WRITE_BUFSIZE_TYPE); +extern _READ_WRITE_RETURN_TYPE __swrite (struct _reent *, void *, const char *, - _READ_WRITE_BUFSIZE_TYPE)); -extern _fpos_t _EXFUN(__sseek,(struct _reent *, void *, _fpos_t, int)); -extern int _EXFUN(__sclose,(struct _reent *, void *)); -extern int _EXFUN(__stextmode,(int)); -extern void _EXFUN(__sinit,(struct _reent *)); -extern void _EXFUN(_cleanup_r,(struct _reent *)); -extern void _EXFUN(__smakebuf_r,(struct _reent *, FILE *)); -extern int _EXFUN(__swhatbuf_r,(struct _reent *, FILE *, size_t *, int *)); -extern int _EXFUN(_fwalk,(struct _reent *, int (*)(FILE *))); -extern int _EXFUN(_fwalk_reent,(struct _reent *, int (*)(struct _reent *, FILE *))); -struct _glue * _EXFUN(__sfmoreglue,(struct _reent *,int n)); -extern int _EXFUN(__submore, (struct _reent *, FILE *)); + _READ_WRITE_BUFSIZE_TYPE); +extern _fpos_t __sseek (struct _reent *, void *, _fpos_t, int); +extern int __sclose (struct _reent *, void *); +extern int __stextmode (int); +extern void __sinit (struct _reent *); +extern void _cleanup_r (struct _reent *); +extern void __smakebuf_r (struct _reent *, FILE *); +extern int __swhatbuf_r (struct _reent *, FILE *, size_t *, int *); +extern int _fwalk (struct _reent *, int (*)(FILE *)); +extern int _fwalk_reent (struct _reent *, int (*)(struct _reent *, FILE *)); +struct _glue * __sfmoreglue (struct _reent *,int n); +extern int __submore (struct _reent *, FILE *); #ifdef __LARGE64_FILES -extern _fpos64_t _EXFUN(__sseek64,(struct _reent *, void *, _fpos64_t, int)); -extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64,(struct _reent *, void *, +extern _fpos64_t __sseek64 (struct _reent *, void *, _fpos64_t, int); +extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *, const char *, - _READ_WRITE_BUFSIZE_TYPE)); + _READ_WRITE_BUFSIZE_TYPE); #endif /* Called by the main entry point fns to ensure stdio has been initialized. */ @@ -279,12 +279,12 @@ extern _READ_WRITE_RETURN_TYPE _EXFUN(__swrite64,(struct _reent *, void *, /* WARNING: _dcvt is defined in the stdlib directory, not here! */ -char *_EXFUN(_dcvt,(struct _reent *, char *, double, int, int, char, int)); -char *_EXFUN(_sicvt,(char *, short, char)); -char *_EXFUN(_icvt,(char *, int, char)); -char *_EXFUN(_licvt,(char *, long, char)); +char *_dcvt (struct _reent *, char *, double, int, int, char, int); +char *_sicvt (char *, short, char); +char *_icvt (char *, int, char); +char *_licvt (char *, long, char); #ifdef __GNUC__ -char *_EXFUN(_llicvt,(char *, long long, char)); +char *_llicvt (char *, long long, char); #endif #define CVT_BUF_SIZE 128 @@ -297,10 +297,10 @@ char *_EXFUN(_llicvt,(char *, long long, char)); #define __sinit_lock_acquire() #define __sinit_lock_release() #else -void _EXFUN(__sfp_lock_acquire,(void)); -void _EXFUN(__sfp_lock_release,(void)); -void _EXFUN(__sinit_lock_acquire,(void)); -void _EXFUN(__sinit_lock_release,(void)); +void __sfp_lock_acquire (void); +void __sfp_lock_release (void); +void __sinit_lock_acquire (void); +void __sinit_lock_release (void); #endif /* Types used in positional argument support in vfprinf/vfwprintf. diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index 1c5a07516..ed7316a77 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -443,7 +443,7 @@ __sfputs_r (struct _reent *ptr, } #endif /* STRING_ONLY. */ -int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, const char *, va_list)); +int _VFPRINTF_R (struct _reent *, FILE *, const char *, va_list); #ifndef STRING_ONLY int @@ -457,8 +457,8 @@ VFPRINTF (FILE * fp, } int -_EXFUN(vfiprintf, (FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vfprintf")))); +vfiprintf (FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vfprintf"))); #endif #ifdef STRING_ONLY @@ -659,10 +659,10 @@ error: #ifdef STRING_ONLY int -_EXFUN(_svfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_svfprintf_r")))); +_svfiprintf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_svfprintf_r"))); #else int -_EXFUN(_vfiprintf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vfprintf_r")))); +_vfiprintf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vfprintf_r"))); #endif diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index e8a9325ec..5579cb0f1 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -153,8 +153,8 @@ VFSCANF (register FILE *fp, } int -_EXFUN(vfiscanf, (FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vfscanf")))); +vfiscanf (FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vfscanf"))); int __SVFSCANF (register FILE *fp, @@ -177,8 +177,8 @@ _VFSCANF_R (struct _reent *data, } int -_EXFUN(_vfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vfscanf_r")))); +_vfiscanf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vfscanf_r"))); #endif /* !STRING_ONLY. */ #if defined (STRING_ONLY) @@ -257,9 +257,9 @@ __ssrefill_r (struct _reent * ptr, } #else -int _EXFUN (_sungetc_r, (struct _reent *, int, register FILE *)); -int _EXFUN (__ssrefill_r, (struct _reent *, register FILE *)); -size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *)); +int _sungetc_r (struct _reent *, int, register FILE *); +int __ssrefill_r (struct _reent *, register FILE *); +size_t _sfread_r (struct _reent *, void *buf, size_t, size_t, FILE *); #endif /* !STRING_ONLY. */ int @@ -457,11 +457,11 @@ all_done: #ifdef STRING_ONLY int -_EXFUN(__ssvfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("__ssvfscanf_r")))); +__ssvfiscanf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("__ssvfscanf_r"))); #else int -_EXFUN(__svfiscanf_r, (struct _reent *, FILE *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("__svfscanf_r")))); +__svfiscanf_r (struct _reent *, FILE *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("__svfscanf_r"))); #endif diff --git a/newlib/libc/stdio/printf.c b/newlib/libc/stdio/printf.c index a323f5ad0..a9ba6118e 100644 --- a/newlib/libc/stdio/printf.c +++ b/newlib/libc/stdio/printf.c @@ -38,8 +38,8 @@ _printf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_iprintf_r, (struct _reent *, const char *, ...) - _ATTRIBUTE ((__alias__("_printf_r")))); +_iprintf_r (struct _reent *, const char *, ...) + _ATTRIBUTE ((__alias__("_printf_r"))); #endif #ifndef _REENT_ONLY @@ -60,7 +60,7 @@ printf (const char *__restrict fmt, ...) #ifdef _NANO_FORMATTED_IO int -_EXFUN(iprintf, (const char *, ...) - _ATTRIBUTE ((__alias__("printf")))); +iprintf (const char *, ...) + _ATTRIBUTE ((__alias__("printf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/scanf.c b/newlib/libc/stdio/scanf.c index 87cbeb7b8..a5a9391c0 100644 --- a/newlib/libc/stdio/scanf.c +++ b/newlib/libc/stdio/scanf.c @@ -53,8 +53,8 @@ scanf(fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(iscanf, (const char *, ...) - _ATTRIBUTE ((__alias__("scanf")))); +iscanf (const char *, ...) + _ATTRIBUTE ((__alias__("scanf"))); #endif #endif /* !_REENT_ONLY */ @@ -85,6 +85,6 @@ _scanf_r(ptr, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(_iscanf_r, (struct _reent *, const char *, ...) - _ATTRIBUTE ((__alias__("_scanf_r")))); +_iscanf_r (struct _reent *, const char *, ...) + _ATTRIBUTE ((__alias__("_scanf_r"))); #endif diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c index d5ba7085c..d73cdbf3a 100644 --- a/newlib/libc/stdio/snprintf.c +++ b/newlib/libc/stdio/snprintf.c @@ -73,8 +73,8 @@ _snprintf_r(ptr, str, size, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(_sniprintf_r, (struct _reent *, char *, size_t, const char *, ...) - _ATTRIBUTE ((__alias__("_snprintf_r")))); +_sniprintf_r (struct _reent *, char *, size_t, const char *, ...) + _ATTRIBUTE ((__alias__("_snprintf_r"))); #endif #ifndef _REENT_ONLY @@ -122,7 +122,7 @@ snprintf(str, size, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(sniprintf, (char *, size_t, const char *, ...) - _ATTRIBUTE ((__alias__("snprintf")))); +sniprintf (char *, size_t, const char *, ...) + _ATTRIBUTE ((__alias__("snprintf"))); #endif #endif diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index bbb9753b9..37d92f93e 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -612,8 +612,8 @@ _sprintf_r(ptr, str, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(_siprintf_r, (struct _reent *, char *, const char *, ...) - _ATTRIBUTE ((__alias__("_sprintf_r")))); +_siprintf_r (struct _reent *, char *, const char *, ...) + _ATTRIBUTE ((__alias__("_sprintf_r"))); #endif #ifndef _REENT_ONLY @@ -650,7 +650,7 @@ sprintf(str, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(siprintf, (char *, const char *, ...) - _ATTRIBUTE ((__alias__("sprintf")))); +siprintf (char *, const char *, ...) + _ATTRIBUTE ((__alias__("sprintf"))); #endif #endif diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index a04f9b65c..971db439d 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -459,8 +459,8 @@ sscanf(str, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(siscanf, (const char *, const char *, ...) - _ATTRIBUTE ((__alias__("sscanf")))); +siscanf (const char *, const char *, ...) + _ATTRIBUTE ((__alias__("sscanf"))); #endif #endif /* !_REENT_ONLY */ @@ -502,6 +502,6 @@ _sscanf_r(ptr, str, fmt, va_alist) #ifdef _NANO_FORMATTED_IO int -_EXFUN(_siscanf_r, (struct _reent *, const char *, const char *, ...) - _ATTRIBUTE ((__alias__("_sscanf_r")))); +_siscanf_r (struct _reent *, const char *, const char *, ...) + _ATTRIBUTE ((__alias__("_sscanf_r"))); #endif diff --git a/newlib/libc/stdio/vasnprintf.c b/newlib/libc/stdio/vasnprintf.c index 5bc0ec634..1fbf5a171 100644 --- a/newlib/libc/stdio/vasnprintf.c +++ b/newlib/libc/stdio/vasnprintf.c @@ -57,9 +57,9 @@ _vasnprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO char * -_EXFUN(_vasniprintf_r, (struct _reent*, char *, size_t *, +_vasniprintf_r (struct _reent*, char *, size_t *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vasnprintf_r")))); + _ATTRIBUTE ((__alias__("_vasnprintf_r"))); #endif #ifndef _REENT_ONLY @@ -75,7 +75,7 @@ vasnprintf (char *buf, #ifdef _NANO_FORMATTED_IO char * -_EXFUN(vasniprintf, (char *, size_t *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vasnprintf")))); +vasniprintf (char *, size_t *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vasnprintf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/vasprintf.c b/newlib/libc/stdio/vasprintf.c index 4acbc0479..8fe635462 100644 --- a/newlib/libc/stdio/vasprintf.c +++ b/newlib/libc/stdio/vasprintf.c @@ -40,8 +40,8 @@ vasprintf (char **strp, #ifdef _NANO_FORMATTED_IO int -_EXFUN(vasiprintf, (char **, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vasprintf")))); +vasiprintf (char **, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vasprintf"))); #endif #endif /* !_REENT_ONLY */ @@ -70,6 +70,6 @@ _vasprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_vasiprintf_r, (struct _reent *, char **, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vasprintf_r")))); +_vasiprintf_r (struct _reent *, char **, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vasprintf_r"))); #endif diff --git a/newlib/libc/stdio/vdprintf.c b/newlib/libc/stdio/vdprintf.c index 6261f6217..d22463e49 100644 --- a/newlib/libc/stdio/vdprintf.c +++ b/newlib/libc/stdio/vdprintf.c @@ -34,8 +34,8 @@ _vdprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_vdiprintf_r, (struct _reent *, int, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vdprintf_r")))); +_vdiprintf_r (struct _reent *, int, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vdprintf_r"))); #endif #ifndef _REENT_ONLY @@ -50,7 +50,7 @@ vdprintf (int fd, #ifdef _NANO_FORMATTED_IO int -_EXFUN(vdiprintf, (int, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vdprintf")))); +vdiprintf (int, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vdprintf"))); #endif #endif /* ! _REENT_ONLY */ diff --git a/newlib/libc/stdio/vfprintf.c b/newlib/libc/stdio/vfprintf.c index 6649e2b61..c4bf2dbe3 100644 --- a/newlib/libc/stdio/vfprintf.c +++ b/newlib/libc/stdio/vfprintf.c @@ -517,7 +517,7 @@ extern char *_dtoa_r (struct _reent *, double, int, extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int, int, int *, int *, char **); -extern int _EXFUN(_ldcheck,(_LONG_DOUBLE *)); +extern int _ldcheck (_LONG_DOUBLE *); # define _PRINTF_FLOAT_TYPE _LONG_DOUBLE # define _DTOA_R _ldtoa_r @@ -600,9 +600,9 @@ union arg_val }; static union arg_val * -_EXFUN(get_arg, (struct _reent *data, int n, char *fmt, +get_arg (struct _reent *data, int n, char *fmt, va_list *ap, int *numargs, union arg_val *args, - int *arg_type, char **last_fmt)); + int *arg_type, char **last_fmt); #endif /* !_NO_POS_ARGS */ /* @@ -639,7 +639,7 @@ _EXFUN(get_arg, (struct _reent *data, int n, char *fmt, # define GROUPING 0x400 /* use grouping ("'" flag) */ #endif -int _EXFUN(_VFPRINTF_R, (struct _reent *, FILE *, const char *, va_list)); +int _VFPRINTF_R (struct _reent *, FILE *, const char *, va_list); #ifndef STRING_ONLY int diff --git a/newlib/libc/stdio/vfscanf.c b/newlib/libc/stdio/vfscanf.c index 097fd801c..b97235559 100644 --- a/newlib/libc/stdio/vfscanf.c +++ b/newlib/libc/stdio/vfscanf.c @@ -378,9 +378,9 @@ _sfread_r (struct _reent * ptr, return count; } #else /* !STRING_ONLY || !INTEGER_ONLY */ -int _EXFUN (_sungetc_r, (struct _reent *, int, register FILE *)); -int _EXFUN (__ssrefill_r, (struct _reent *, register FILE *)); -size_t _EXFUN (_sfread_r, (struct _reent *, void *buf, size_t, size_t, FILE *)); +int _sungetc_r (struct _reent *, int, register FILE *); +int __ssrefill_r (struct _reent *, register FILE *); +size_t _sfread_r (struct _reent *, void *buf, size_t, size_t, FILE *); #endif /* !STRING_ONLY || !INTEGER_ONLY */ static inline int diff --git a/newlib/libc/stdio/vfwprintf.c b/newlib/libc/stdio/vfwprintf.c index dd78eb015..980b31e3b 100644 --- a/newlib/libc/stdio/vfwprintf.c +++ b/newlib/libc/stdio/vfwprintf.c @@ -149,7 +149,7 @@ SEEALSO # undef _NO_LONGLONG #endif -int _EXFUN(_VFWPRINTF_R, (struct _reent *, FILE *, const wchar_t *, va_list)); +int _VFWPRINTF_R (struct _reent *, FILE *, const wchar_t *, va_list); /* Defined in vfprintf.c. */ #ifdef _FVWRITE_IN_STREAMIO # ifdef STRING_ONLY @@ -157,14 +157,14 @@ int _EXFUN(_VFWPRINTF_R, (struct _reent *, FILE *, const wchar_t *, va_list)); # else # define __SPRINT __sprint_r # endif -int _EXFUN(__SPRINT, (struct _reent *, FILE *, register struct __suio *)); +int __SPRINT (struct _reent *, FILE *, register struct __suio *); #else # ifdef STRING_ONLY # define __SPRINT __ssputs_r # else # define __SPRINT __sfputs_r # endif -int _EXFUN(__SPRINT, (struct _reent *, FILE *, const char *, size_t)); +int __SPRINT (struct _reent *, FILE *, const char *, size_t); #endif #ifndef STRING_ONLY #ifdef _UNBUF_STREAM_OPT @@ -239,7 +239,7 @@ extern char *_dtoa_r (struct _reent *, double, int, extern char *_ldtoa_r (struct _reent *, _LONG_DOUBLE, int, int, int *, int *, char **); -extern int _EXFUN(_ldcheck,(_LONG_DOUBLE *)); +extern int _ldcheck (_LONG_DOUBLE *); # define _PRINTF_FLOAT_TYPE _LONG_DOUBLE # define _DTOA_R _ldtoa_r @@ -324,9 +324,9 @@ union arg_val }; static union arg_val * -_EXFUN(get_arg, (struct _reent *data, int n, wchar_t *fmt, +get_arg (struct _reent *data, int n, wchar_t *fmt, va_list *ap, int *numargs, union arg_val *args, - int *arg_type, wchar_t **last_fmt)); + int *arg_type, wchar_t **last_fmt); #endif /* !_NO_POS_ARGS */ /* diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c index 79c324d55..fb46c1c1a 100644 --- a/newlib/libc/stdio/vprintf.c +++ b/newlib/libc/stdio/vprintf.c @@ -40,7 +40,7 @@ vprintf (const char *fmt, #ifdef _NANO_FORMATTED_IO int -_EXFUN(viprintf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vprintf")))); +viprintf (const char *, __VALIST) _ATTRIBUTE ((__alias__("vprintf"))); #endif #endif /* !_REENT_ONLY */ @@ -56,6 +56,6 @@ _vprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_viprintf_r, (struct _reent *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vprintf_r")))); +_viprintf_r (struct _reent *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vprintf_r"))); #endif diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c index be329ded4..bbbbd0a83 100644 --- a/newlib/libc/stdio/vscanf.c +++ b/newlib/libc/stdio/vscanf.c @@ -41,7 +41,7 @@ vscanf (const char *fmt, #ifdef _NANO_FORMATTED_IO int -_EXFUN(viscanf, (const char *, __VALIST) _ATTRIBUTE ((__alias__("vscanf")))); +viscanf (const char *, __VALIST) _ATTRIBUTE ((__alias__("vscanf"))); #endif #endif /* !_REENT_ONLY */ @@ -57,6 +57,6 @@ _vscanf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_viscanf_r, (struct _reent *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vscanf_r")))); +_viscanf_r (struct _reent *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vscanf_r"))); #endif diff --git a/newlib/libc/stdio/vsnprintf.c b/newlib/libc/stdio/vsnprintf.c index 02b5443bf..bcaffa30f 100644 --- a/newlib/libc/stdio/vsnprintf.c +++ b/newlib/libc/stdio/vsnprintf.c @@ -42,8 +42,8 @@ vsnprintf (char *__restrict str, #ifdef _NANO_FORMATTED_IO int -_EXFUN(vsniprintf, (char *, size_t, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vsnprintf")))); +vsniprintf (char *, size_t, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vsnprintf"))); #endif #endif /* !_REENT_ONLY */ @@ -77,6 +77,6 @@ _vsnprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_vsniprintf_r, (struct _reent *, char *, size_t, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vsnprintf_r")))); +_vsniprintf_r (struct _reent *, char *, size_t, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vsnprintf_r"))); #endif diff --git a/newlib/libc/stdio/vsprintf.c b/newlib/libc/stdio/vsprintf.c index 7344a3854..823cacb56 100644 --- a/newlib/libc/stdio/vsprintf.c +++ b/newlib/libc/stdio/vsprintf.c @@ -40,8 +40,8 @@ vsprintf (char *__restrict str, #ifdef _NANO_FORMATTED_IO int -_EXFUN(vsiprintf, (char *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vsprintf")))); +vsiprintf (char *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vsprintf"))); #endif #endif /* !_REENT_ONLY */ @@ -66,6 +66,6 @@ _vsprintf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_vsiprintf_r, (struct _reent *, char *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vsprintf_r")))); +_vsiprintf_r (struct _reent *, char *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vsprintf_r"))); #endif diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c index 61c65cd5e..97c7bae80 100644 --- a/newlib/libc/stdio/vsscanf.c +++ b/newlib/libc/stdio/vsscanf.c @@ -44,8 +44,8 @@ vsscanf (const char *__restrict str, #ifdef _NANO_FORMATTED_IO int -_EXFUN(vsiscanf, (const char *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("vsscanf")))); +vsiscanf (const char *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("vsscanf"))); #endif #endif /* !_REENT_ONLY */ @@ -70,6 +70,6 @@ _vsscanf_r (struct _reent *ptr, #ifdef _NANO_FORMATTED_IO int -_EXFUN(_vsiscanf_r, (struct _reent *, const char *, const char *, __VALIST) - _ATTRIBUTE ((__alias__("_vsscanf_r")))); +_vsiscanf_r (struct _reent *, const char *, const char *, __VALIST) + _ATTRIBUTE ((__alias__("_vsscanf_r"))); #endif diff --git a/newlib/libc/stdlib/local.h b/newlib/libc/stdlib/local.h index 0b950d2f4..a96ed2cc4 100644 --- a/newlib/libc/stdlib/local.h +++ b/newlib/libc/stdlib/local.h @@ -3,7 +3,7 @@ #ifndef _LOCAL_H_ #define _LOCAL_H_ -char * _EXFUN(_gcvt,(struct _reent *, double , int , char *, char, int)); +char * _gcvt (struct _reent *, double , int , char *, char, int); #include "../locale/setlocale.h" diff --git a/newlib/libc/stdlib/mbctype.h b/newlib/libc/stdlib/mbctype.h index 65cf24c34..359c83c77 100644 --- a/newlib/libc/stdlib/mbctype.h +++ b/newlib/libc/stdlib/mbctype.h @@ -7,10 +7,10 @@ /* functions used to support SHIFT_JIS, EUC-JP, and JIS multibyte encodings */ -int _EXFUN(_issjis1, (int c)); -int _EXFUN(_issjis2, (int c)); -int _EXFUN(_iseucjp, (int c)); -int _EXFUN(_isjis, (int c)); +int _issjis1 (int c); +int _issjis2 (int c); +int _iseucjp (int c); +int _isjis (int c); #define _issjis1(c) (((c) >= 0x81 && (c) <= 0x9f) || ((c) >= 0xe0 && (c) <= 0xef)) #define _issjis2(c) (((c) >= 0x40 && (c) <= 0x7e) || ((c) >= 0x80 && (c) <= 0xfc)) diff --git a/newlib/libc/stdlib/mprec.h b/newlib/libc/stdlib/mprec.h index a98120aa4..7baec835c 100644 --- a/newlib/libc/stdlib/mprec.h +++ b/newlib/libc/stdlib/mprec.h @@ -385,26 +385,26 @@ typedef struct _Bigint _Bigint; struct _reent ; struct FPI; -double _EXFUN(ulp,(double x)); -double _EXFUN(b2d,(_Bigint *a , int *e)); -_Bigint * _EXFUN(Balloc,(struct _reent *p, int k)); -void _EXFUN(Bfree,(struct _reent *p, _Bigint *v)); -_Bigint * _EXFUN(multadd,(struct _reent *p, _Bigint *, int, int)); -_Bigint * _EXFUN(s2b,(struct _reent *, const char*, int, int, __ULong)); -_Bigint * _EXFUN(i2b,(struct _reent *,int)); -_Bigint * _EXFUN(mult, (struct _reent *, _Bigint *, _Bigint *)); -_Bigint * _EXFUN(pow5mult, (struct _reent *, _Bigint *, int k)); -int _EXFUN(hi0bits,(__ULong)); -int _EXFUN(lo0bits,(__ULong *)); -_Bigint * _EXFUN(d2b,(struct _reent *p, double d, int *e, int *bits)); -_Bigint * _EXFUN(lshift,(struct _reent *p, _Bigint *b, int k)); -int _EXFUN(match,(const char**, char*)); -_Bigint * _EXFUN(diff,(struct _reent *p, _Bigint *a, _Bigint *b)); -int _EXFUN(cmp,(_Bigint *a, _Bigint *b)); -int _EXFUN(gethex,(struct _reent *p, const char **sp, const struct FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc)); -double _EXFUN(ratio,(_Bigint *a, _Bigint *b)); -__ULong _EXFUN(any_on,(_Bigint *b, int k)); -void _EXFUN(copybits,(__ULong *c, int n, _Bigint *b)); +double ulp (double x); +double b2d (_Bigint *a , int *e); +_Bigint * Balloc (struct _reent *p, int k); +void Bfree (struct _reent *p, _Bigint *v); +_Bigint * multadd (struct _reent *p, _Bigint *, int, int); +_Bigint * s2b (struct _reent *, const char*, int, int, __ULong); +_Bigint * i2b (struct _reent *,int); +_Bigint * mult (struct _reent *, _Bigint *, _Bigint *); +_Bigint * pow5mult (struct _reent *, _Bigint *, int k); +int hi0bits (__ULong); +int lo0bits (__ULong *); +_Bigint * d2b (struct _reent *p, double d, int *e, int *bits); +_Bigint * lshift (struct _reent *p, _Bigint *b, int k); +int match (const char**, char*); +_Bigint * diff (struct _reent *p, _Bigint *a, _Bigint *b); +int cmp (_Bigint *a, _Bigint *b); +int gethex (struct _reent *p, const char **sp, const struct FPI *fpi, Long *exp, _Bigint **bp, int sign, locale_t loc); +double ratio (_Bigint *a, _Bigint *b); +__ULong any_on (_Bigint *b, int k); +void copybits (__ULong *c, int n, _Bigint *b); double _strtod_l (struct _reent *ptr, const char *__restrict s00, char **__restrict se, locale_t loc); #if defined (_HAVE_LONG_DOUBLE) && !defined (_LDBL_EQ_DBL) @@ -416,10 +416,10 @@ int _strtodg_l (struct _reent *p, const char *s00, char **se, #endif /* _HAVE_LONG_DOUBLE && !_LDBL_EQ_DBL */ #if defined(PREFER_SIZE_OVER_SPEED) || defined(__OPTIMIZE_SIZE__) || defined(_SMALL_HEXDIG) -unsigned char _EXFUN(__hexdig_fun,(unsigned char)); +unsigned char __hexdig_fun (unsigned char); #endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ #ifdef INFNAN_CHECK -int _EXFUN(hexnan,(const char **sp, const struct FPI *fpi, __ULong *x0)); +int hexnan (const char **sp, const struct FPI *fpi, __ULong *x0); #endif #define Bcopy(x,y) memcpy((char *)&x->_sign, (char *)&y->_sign, y->_wds*sizeof(__Long) + 2*sizeof(int)) @@ -432,4 +432,4 @@ extern const unsigned char __hexdig[]; #endif /* !defined(PREFER_SIZE_OVER_SPEED) && !defined(__OPTIMIZE_SIZE__) && !defined(_SMALL_HEXDIG) */ -double _EXFUN(_mprec_log10,(int)); +double _mprec_log10 (int); diff --git a/newlib/libc/stdlib/rand48.h b/newlib/libc/stdlib/rand48.h index a6cb479ef..26455e35a 100644 --- a/newlib/libc/stdlib/rand48.h +++ b/newlib/libc/stdlib/rand48.h @@ -17,7 +17,7 @@ #include #include -extern void _EXFUN(__dorand48,(struct _reent *r, unsigned short[3])); +extern void __dorand48 (struct _reent *r, unsigned short[3]); #define __rand48_seed _REENT_RAND48_SEED(r) #define __rand48_mult _REENT_RAND48_MULT(r) #define __rand48_add _REENT_RAND48_ADD(r) diff --git a/newlib/libc/stdlib/system.c b/newlib/libc/stdlib/system.c index 34be6cd8f..f30b7df80 100644 --- a/newlib/libc/stdlib/system.c +++ b/newlib/libc/stdlib/system.c @@ -53,7 +53,7 @@ Supporting OS subroutines required: <<_exit>>, <<_execve>>, <<_fork_r>>, #include #if defined (unix) || defined (__CYGWIN__) -static int _EXFUN(do_system, (struct _reent *ptr, const char *s)); +static int do_system (struct _reent *ptr, const char *s); #endif int diff --git a/newlib/libc/string/local.h b/newlib/libc/string/local.h index afef7e34a..8d364fdaa 100644 --- a/newlib/libc/string/local.h +++ b/newlib/libc/string/local.h @@ -2,7 +2,7 @@ #include <../ctype/local.h> /* internal function to compute width of wide char. */ -int _EXFUN (__wcwidth, (wint_t)); +int __wcwidth (wint_t); /* Taken from glibc: diff --git a/newlib/libc/sys/arm/syscalls.c b/newlib/libc/sys/arm/syscalls.c index 474618dd7..68f1185dd 100644 --- a/newlib/libc/sys/arm/syscalls.c +++ b/newlib/libc/sys/arm/syscalls.c @@ -55,7 +55,7 @@ register char * stack_ptr asm ("sp"); /* following is copied from libc/stdio/local.h to check std streams */ -extern void _EXFUN(__sinit,(struct _reent *)); +extern void __sinit (struct _reent *); #define CHECK_INIT(ptr) \ do \ { \ diff --git a/newlib/libc/sys/linux/include/setjmp.h b/newlib/libc/sys/linux/include/setjmp.h index f07dbab6d..f77a45708 100644 --- a/newlib/libc/sys/linux/include/setjmp.h +++ b/newlib/libc/sys/linux/include/setjmp.h @@ -22,10 +22,10 @@ typedef struct __sigjmpbuf typedef __jmp_buf jmp_buf; -void _EXFUN(longjmp,(jmp_buf __jmpb, int __retval)); -int _EXFUN(setjmp,(jmp_buf __jmpb)); -void _EXFUN(siglongjmp,(sigjmp_buf __jmpb, int __retval)); -int _EXFUN(sigsetjmp,(sigjmp_buf __jmpb, int __savemask)); +void longjmp (jmp_buf __jmpb, int __retval); +int setjmp (jmp_buf __jmpb); +void siglongjmp (sigjmp_buf __jmpb, int __retval); +int sigsetjmp (sigjmp_buf __jmpb, int __savemask); /* sigsetjmp is implemented as macro using setjmp */ diff --git a/newlib/libc/sys/linux/include/time.h b/newlib/libc/sys/linux/include/time.h index e5456766e..5e61d2b65 100644 --- a/newlib/libc/sys/linux/include/time.h +++ b/newlib/libc/sys/linux/include/time.h @@ -62,27 +62,27 @@ struct tm typedef __timer_t timer_t; #endif -clock_t _EXFUN(clock, (void)); -double _EXFUN(difftime, (time_t _time2, time_t _time1)); -time_t _EXFUN(mktime, (struct tm *_timeptr)); -time_t _EXFUN(time, (time_t *_timer)); +clock_t clock (void); +double difftime (time_t _time2, time_t _time1); +time_t mktime (struct tm *_timeptr); +time_t time (time_t *_timer); #ifndef _REENT_ONLY -char *_EXFUN(asctime, (const struct tm *_tblock)); -char *_EXFUN(ctime, (const time_t *_time)); -struct tm *_EXFUN(gmtime, (const time_t *_timer)); -struct tm *_EXFUN(localtime,(const time_t *_timer)); +char *asctime (const struct tm *_tblock); +char *ctime (const time_t *_time); +struct tm *gmtime (const time_t *_timer); +struct tm *localtime (const time_t *_timer); #endif -size_t _EXFUN(strftime, (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t)); +size_t strftime (char *_s, size_t _maxsize, const char *_fmt, const struct tm *_t); -char *_EXFUN(asctime_r, (const struct tm *, char *)); -char *_EXFUN(ctime_r, (const time_t *, char *)); -struct tm *_EXFUN(gmtime_r, (const time_t *, struct tm *)); -struct tm *_EXFUN(localtime_r, (const time_t *, struct tm *)); +char *asctime_r (const struct tm *, char *); +char *ctime_r (const time_t *, char *); +struct tm *gmtime_r (const time_t *, struct tm *); +struct tm *localtime_r (const time_t *, struct tm *); #ifndef __STRICT_ANSI__ -char *_EXFUN(strptime, (const char *, const char *, struct tm *)); -void _EXFUN(tzset, (void)); -void _EXFUN(_tzset_r, (struct _reent *)); +char *strptime (const char *, const char *, struct tm *); +void tzset (void); +void _tzset_r (struct _reent *); typedef struct __tzrule_struct { @@ -102,15 +102,15 @@ typedef struct __tzinfo_struct __tzrule_type __tzrule[2]; } __tzinfo_type; -__tzinfo_type *_EXFUN (__gettzinfo, (void)); +__tzinfo_type *__gettzinfo (void); /* getdate functions */ #ifndef _REENT_ONLY #define getdate_err (*__getdate_err()) -int *_EXFUN(__getdate_err,(void)); +int *__getdate_err (void); -struct tm * _EXFUN(getdate, (const char *)); +struct tm * getdate (const char *); /* getdate_err is set to one of the following values to indicate the error. 1 the DATEMSK environment variable is null or undefined, 2 the template file cannot be opened for reading, @@ -123,7 +123,7 @@ struct tm * _EXFUN(getdate, (const char *)); #endif /* !_REENT_ONLY */ /* getdate_r returns the error code as above */ -int _EXFUN(getdate_r, (const char *, struct tm *)); +int getdate_r (const char *, struct tm *); /* defines for the opengroup specifications Derived from Issue 1 of the SVID. */ extern __IMPORT long _timezone; @@ -145,30 +145,28 @@ extern __IMPORT char *_tzname[2]; /* Clocks, P1003.1b-1993, p. 263 */ -int _EXFUN(clock_settime, (clockid_t clock_id, const struct timespec *tp)); -int _EXFUN(clock_gettime, (clockid_t clock_id, struct timespec *tp)); -int _EXFUN(clock_getres, (clockid_t clock_id, struct timespec *res)); +int clock_settime (clockid_t clock_id, const struct timespec *tp); +int clock_gettime (clockid_t clock_id, struct timespec *tp); +int clock_getres (clockid_t clock_id, struct timespec *res); /* Create a Per-Process Timer, P1003.1b-1993, p. 264 */ -int _EXFUN(timer_create, - (clockid_t clock_id, struct sigevent *evp, timer_t *timerid)); +int timer_create (clockid_t clock_id, struct sigevent *evp, timer_t *timerid); /* Delete a Per_process Timer, P1003.1b-1993, p. 266 */ -int _EXFUN(timer_delete, (timer_t timerid)); +int timer_delete (timer_t timerid); /* Per-Process Timers, P1003.1b-1993, p. 267 */ -int _EXFUN(timer_settime, - (timer_t timerid, int flags, const struct itimerspec *value, - struct itimerspec *ovalue)); -int _EXFUN(timer_gettime, (timer_t timerid, struct itimerspec *value)); -int _EXFUN(timer_getoverrun, (timer_t timerid)); +int timer_settime (timer_t timerid, int flags, const struct itimerspec *value, + struct itimerspec *ovalue); +int timer_gettime (timer_t timerid, struct itimerspec *value); +int timer_getoverrun (timer_t timerid); /* High Resolution Sleep, P1003.1b-1993, p. 269 */ -int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); +int nanosleep (const struct timespec *rqtp, struct timespec *rmtp); #endif /* _POSIX_TIMERS */ @@ -223,7 +221,7 @@ int _EXFUN(nanosleep, (const struct timespec *rqtp, struct timespec *rmtp)); /* Accessing a Process CPU-time CLock, P1003.4b/D8, p. 55 */ -int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id)); +int clock_getcpuclockid (pid_t pid, clockid_t *clock_id); #endif /* _POSIX_CPUTIME */ @@ -231,8 +229,8 @@ int _EXFUN(clock_getcpuclockid, (pid_t pid, clockid_t *clock_id)); /* CPU-time Clock Attribute Access, P1003.4b/D8, p. 56 */ -int _EXFUN(clock_setenable_attr, (clockid_t clock_id, int attr)); -int _EXFUN(clock_getenable_attr, (clockid_t clock_id, int *attr)); +int clock_setenable_attr (clockid_t clock_id, int attr); +int clock_getenable_attr (clockid_t clock_id, int *attr); #endif /* _POSIX_CPUTIME or _POSIX_THREAD_CPUTIME */ diff --git a/newlib/libc/sys/linux/sys/signal.h b/newlib/libc/sys/linux/sys/signal.h index 092798bb4..2797426d1 100644 --- a/newlib/libc/sys/linux/sys/signal.h +++ b/newlib/libc/sys/linux/sys/signal.h @@ -36,16 +36,16 @@ typedef _sig_func_ptr __sighandler_t; #include <_ansi.h> -int _EXFUN(kill, (int, int)); -int _EXFUN(sigaction, (int, const struct sigaction *, struct sigaction *)); -int _EXFUN(sigaddset, (sigset_t *, const int)); -int _EXFUN(sigdelset, (sigset_t *, const int)); -int _EXFUN(sigismember, (const sigset_t *, int)); -int _EXFUN(sigfillset, (sigset_t *)); -int _EXFUN(sigemptyset, (sigset_t *)); -int _EXFUN(sigpending, (sigset_t *)); -int _EXFUN(sigsuspend, (const sigset_t *)); -int _EXFUN(sigpause, (int)); +int kill (int, int); +int sigaction (int, const struct sigaction *, struct sigaction *); +int sigaddset (sigset_t *, const int); +int sigdelset (sigset_t *, const int); +int sigismember (const sigset_t *, int); +int sigfillset (sigset_t *); +int sigemptyset (sigset_t *); +int sigpending (sigset_t *); +int sigsuspend (const sigset_t *); +int sigpause (int); #ifndef _POSIX_SOURCE extern const char *const sys_siglist[]; diff --git a/newlib/libc/sys/linux/sys/stat.h b/newlib/libc/sys/linux/sys/stat.h index c04142c45..c94bb8b94 100644 --- a/newlib/libc/sys/linux/sys/stat.h +++ b/newlib/libc/sys/linux/sys/stat.h @@ -17,17 +17,17 @@ /* --- redundant stuff below --- */ -int _EXFUN(fstat,( int __fd, struct stat *__sbuf )); -int _EXFUN(mkdir,( const char *_path, mode_t __mode )); -int _EXFUN(mkfifo,( const char *__path, mode_t __mode )); -int _EXFUN(stat,( const char *__restrict __path, struct stat *__restrict __sbuf )); -mode_t _EXFUN(umask,( mode_t __mask )); +int fstat (int __fd, struct stat *__sbuf); +int mkdir (const char *_path, mode_t __mode); +int mkfifo (const char *__path, mode_t __mode); +int stat (const char *__restrict __path, struct stat *__restrict __sbuf); +mode_t umask (mode_t __mask); #ifndef _POSIX_SOURCE -int _EXFUN(fstat64,( int __fd, struct stat64 *__sbuf )); -int _EXFUN(lstat,( const char *__restrict file_name, struct stat64 *__restrict buf)); -int _EXFUN(lstat64,( const char *__restrict file_name, struct stat64 *__restrict buf)); -int _EXFUN(stat64,( const char *__restrict __path, struct stat64 *__restrict __sbuf )); +int fstat64 (int __fd, struct stat64 *__sbuf); +int lstat (const char *__restrict file_name, struct stat64 *__restrict buf); +int lstat64 (const char *__restrict file_name, struct stat64 *__restrict buf); +int stat64 (const char *__restrict __path, struct stat64 *__restrict __sbuf); #endif /* _POSIX_SOURCE */ #endif /* _SYS_STAT_H */ diff --git a/newlib/libc/sys/linux/sys/stdio.h b/newlib/libc/sys/linux/sys/stdio.h index a99308161..e1cd22e55 100644 --- a/newlib/libc/sys/linux/sys/stdio.h +++ b/newlib/libc/sys/linux/sys/stdio.h @@ -16,6 +16,6 @@ #define getline __getline #define getdelim __getdelim -char * _EXFUN(ctermid, (char *)); +char * ctermid (char *); #endif /* _NEWLIB_STDIO_H */ diff --git a/newlib/libc/sys/linux/sys/string.h b/newlib/libc/sys/linux/sys/string.h index 25489caea..dd88a8d00 100644 --- a/newlib/libc/sys/linux/sys/string.h +++ b/newlib/libc/sys/linux/sys/string.h @@ -2,7 +2,7 @@ #define _SYS_STRING_H #ifndef __STRICT_ANSI__ -char *_EXFUN(strsignal, (int __signo)); +char *strsignal (int __signo); #endif #endif /* _SYS_STRING_H */ diff --git a/newlib/libc/sys/linux/sys/time.h b/newlib/libc/sys/linux/sys/time.h index f2c656e5a..ca462fa8d 100644 --- a/newlib/libc/sys/linux/sys/time.h +++ b/newlib/libc/sys/linux/sys/time.h @@ -85,10 +85,10 @@ #include <_ansi.h> -int _EXFUN(gettimeofday, (struct timeval *__p, struct timezone *__z)); -int _EXFUN(settimeofday, (const struct timeval *, const struct timezone *)); -int _EXFUN(utimes, (const char *__path, const struct timeval __tvp[2])); -int _EXFUN(getitimer, (int __which, struct itimerval *__value)); -int _EXFUN(setitimer, (int __which, const struct itimerval *__value, - struct itimerval *__ovalue)); +int gettimeofday (struct timeval *__p, struct timezone *__z); +int settimeofday (const struct timeval *, const struct timezone *); +int utimes (const char *__path, const struct timeval __tvp[2]); +int getitimer (int __which, struct itimerval *__value); +int setitimer (int __which, const struct itimerval *__value, + struct itimerval *__ovalue); #endif diff --git a/newlib/libc/sys/linux/sys/unistd.h b/newlib/libc/sys/linux/sys/unistd.h index 6b5a93e0c..2b3e6131f 100644 --- a/newlib/libc/sys/linux/sys/unistd.h +++ b/newlib/libc/sys/linux/sys/unistd.h @@ -16,86 +16,86 @@ extern "C" { extern char **environ; -void _EXFUN(_exit, (int __status ) _ATTRIBUTE ((__noreturn__))); +void _exit (int __status) _ATTRIBUTE ((__noreturn__)); -int _EXFUN(access,(const char *__path, int __amode )); -unsigned _EXFUN(alarm, (unsigned __secs )); -int _EXFUN(chdir, (const char *__path )); -int _EXFUN(chmod, (const char *__path, mode_t __mode )); -int _EXFUN(chown, (const char *__path, uid_t __owner, gid_t __group )); -int _EXFUN(chroot, (const char *__path )); -int _EXFUN(close, (int __fildes )); -char _EXFUN(*ctermid, (char *__s )); -char _EXFUN(*cuserid, (char *__s )); -int _EXFUN(dup, (int __fildes )); -int _EXFUN(dup2, (int __fildes, int __fildes2 )); -int _EXFUN(execl, (const char *__path, const char *, ... )); -int _EXFUN(execle, (const char *__path, const char *, ... )); -int _EXFUN(execlp, (const char *__file, const char *, ... )); -int _EXFUN(execv, (const char *__path, char * const __argv[] )); -int _EXFUN(execve, (const char *__path, char * const __argv[], char * const __envp[] )); -int _EXFUN(execvp, (const char *__file, char * const __argv[] )); -int _EXFUN(fchdir, (int __fildes)); -int _EXFUN(fchmod, (int __fildes, mode_t __mode )); -int _EXFUN(fchown, (int __fildes, uid_t __owner, gid_t __group )); -pid_t _EXFUN(fork, (void )); -long _EXFUN(fpathconf, (int __fd, int __name )); -int _EXFUN(fsync, (int __fd)); -int _EXFUN(ftruncate, (int __fd, off_t __length)); -char _EXFUN(*getcwd, (char *__buf, size_t __size )); -int _EXFUN(getdomainname ,(char *__name, size_t __len)); -gid_t _EXFUN(getegid, (void )); -uid_t _EXFUN(geteuid, (void )); -gid_t _EXFUN(getgid, (void )); -int _EXFUN(getgroups, (int __gidsetsize, gid_t __grouplist[] )); -int _EXFUN(__gethostname, (char *__name, size_t __len)); -char _EXFUN(*getlogin, (void )); +int access (const char *__path, int __amode); +unsigned alarm (unsigned __secs); +int chdir (const char *__path); +int chmod (const char *__path, mode_t __mode); +int chown (const char *__path, uid_t __owner, gid_t __group); +int chroot (const char *__path); +int close (int __fildes); +char *ctermid (char *__s); +char *cuserid (char *__s); +int dup (int __fildes); +int dup2 (int __fildes, int __fildes2); +int execl (const char *__path, const char *, ...); +int execle (const char *__path, const char *, ...); +int execlp (const char *__file, const char *, ...); +int execv (const char *__path, char * const __argv[]); +int execve (const char *__path, char * const __argv[], char * const __envp[]); +int execvp (const char *__file, char * const __argv[]); +int fchdir (int __fildes); +int fchmod (int __fildes, mode_t __mode); +int fchown (int __fildes, uid_t __owner, gid_t __group); +pid_t fork (void); +long fpathconf (int __fd, int __name); +int fsync (int __fd); +int ftruncate (int __fd, off_t __length); +char *getcwd (char *__buf, size_t __size); +int getdomainname (char *__name, size_t __len); +gid_t getegid (void); +uid_t geteuid (void); +gid_t getgid (void); +int getgroups (int __gidsetsize, gid_t __grouplist[]); +int __gethostname (char *__name, size_t __len); +char *getlogin (void); #if defined(_POSIX_THREAD_SAFE_FUNCTIONS) -int _EXFUN(getlogin_r, (char *name, size_t namesize) ); +int getlogin_r (char *name, size_t namesize) ; #endif -char _EXFUN(*getpass, (__const char *__prompt)); -int _EXFUN(getpagesize, (void)); -pid_t _EXFUN(getpgid, (pid_t)); -pid_t _EXFUN(getpgrp, (void )); -pid_t _EXFUN(getpid, (void )); -pid_t _EXFUN(getppid, (void )); -uid_t _EXFUN(getuid, (void )); -char * _EXFUN(getusershell, (void)); -char _EXFUN(*getwd, (char *__buf )); -int _EXFUN(isatty, (int __fildes )); -int _EXFUN(lchown, (const char *__path, uid_t __owner, gid_t __group )); -int _EXFUN(link, (const char *__path1, const char *__path2 )); -int _EXFUN(nice, (int __nice_value )); -off_t _EXFUN(lseek, (int __fildes, off_t __offset, int __whence )); -long _EXFUN(pathconf, (const char *__path, int __name )); -int _EXFUN(pause, (void )); -int _EXFUN(pipe, (int __fildes[2] )); -ssize_t _EXFUN(pread, (int __fd, void *__buf, size_t __nbytes, off_t __offset)); -ssize_t _EXFUN(pwrite, (int __fd, const void *__buf, size_t __nbytes, off_t __offset)); -_READ_WRITE_RETURN_TYPE _EXFUN(read, (int __fd, void *__buf, size_t __nbyte )); -int _EXFUN(readlink, (const char *path, char *buf, size_t bufsiz)); -int _EXFUN(rmdir, (const char *__path )); -void * _EXFUN(sbrk, (ptrdiff_t __incr)); -int _EXFUN(setegid, (gid_t __gid )); -int _EXFUN(seteuid, (uid_t __uid )); -int _EXFUN(setgid, (gid_t __gid )); -int _EXFUN(setpgid, (pid_t __pid, pid_t __pgid )); -int _EXFUN(setpgrp, (void )); -pid_t _EXFUN(setsid, (void )); -int _EXFUN(setuid, (uid_t __uid )); -unsigned _EXFUN(sleep, (unsigned int __seconds )); -void _EXFUN(swab, (const void *, void *, ssize_t)); -int _EXFUN(symlink, (const char *oldpath, const char *newpath)); -long _EXFUN(sysconf, (int __name )); -pid_t _EXFUN(tcgetpgrp, (int __fildes )); -int _EXFUN(tcsetpgrp, (int __fildes, pid_t __pgrp_id )); -int _EXFUN(truncate, (const char *, off_t __length)); -char * _EXFUN(ttyname, (int __fildes )); -int _EXFUN(ttyname_r, (int __fildes, char *__buf, size_t __len)); -int _EXFUN(unlink, (const char *__path )); -int _EXFUN(usleep, (__useconds_t __useconds)); -int _EXFUN(vhangup, (void )); -_READ_WRITE_RETURN_TYPE _EXFUN(write, (int __fd, const void *__buf, size_t __nbyte )); +char *getpass (__const char *__prompt); +int getpagesize (void); +pid_t getpgid (pid_t); +pid_t getpgrp (void); +pid_t getpid (void); +pid_t getppid (void); +uid_t getuid (void); +char * getusershell (void); +char *getwd (char *__buf); +int isatty (int __fildes); +int lchown (const char *__path, uid_t __owner, gid_t __group); +int link (const char *__path1, const char *__path2); +int nice (int __nice_value); +off_t lseek (int __fildes, off_t __offset, int __whence); +long pathconf (const char *__path, int __name); +int pause (void); +int pipe (int __fildes[2]); +ssize_t pread (int __fd, void *__buf, size_t __nbytes, off_t __offset); +ssize_t pwrite (int __fd, const void *__buf, size_t __nbytes, off_t __offset); +_READ_WRITE_RETURN_TYPE read (int __fd, void *__buf, size_t __nbyte); +int readlink (const char *path, char *buf, size_t bufsiz); +int rmdir (const char *__path); +void * sbrk (ptrdiff_t __incr); +int setegid (gid_t __gid); +int seteuid (uid_t __uid); +int setgid (gid_t __gid); +int setpgid (pid_t __pid, pid_t __pgid); +int setpgrp (void); +pid_t setsid (void); +int setuid (uid_t __uid); +unsigned sleep (unsigned int __seconds); +void swab (const void *, void *, ssize_t); +int symlink (const char *oldpath, const char *newpath); +long sysconf (int __name); +pid_t tcgetpgrp (int __fildes); +int tcsetpgrp (int __fildes, pid_t __pgrp_id); +int truncate (const char *, off_t __length); +char * ttyname (int __fildes); +int ttyname_r (int __fildes, char *__buf, size_t __len); +int unlink (const char *__path); +int usleep (__useconds_t __useconds); +int vhangup (void); +_READ_WRITE_RETURN_TYPE write (int __fd, const void *__buf, size_t __nbyte); extern char *optarg; /* getopt(3) external variables */ extern int optind, opterr, optopt; @@ -103,7 +103,7 @@ int getopt(int, char * const [], const char *); extern int optreset; /* getopt(3) external variable */ #ifndef _POSIX_SOURCE -pid_t _EXFUN(vfork, (void )); +pid_t vfork (void); extern char *suboptarg; /* getsubopt(3) external variable */ int getsubopt(char **, char * const *, char **); @@ -111,16 +111,16 @@ int getsubopt(char **, char * const *, char **); /* Provide prototypes for most of the _ names that are provided in newlib for some compilers. */ -int _EXFUN(_close, (int __fildes )); -pid_t _EXFUN(_fork, (void )); -pid_t _EXFUN(_getpid, (void )); -int _EXFUN(_link, (const char *__path1, const char *__path2 )); -off_t _EXFUN(_lseek, (int __fildes, off_t __offset, int __whence )); -_READ_WRITE_RETURN_TYPE _EXFUN(_read, (int __fd, void *__buf, size_t __nbyte )); -void * _EXFUN(_sbrk, (size_t __incr)); -int _EXFUN(_unlink, (const char *__path )); -_READ_WRITE_RETURN_TYPE _EXFUN(_write, (int __fd, const void *__buf, size_t __nbyte )); -int _EXFUN(_execve, (const char *__path, char * const __argv[], char * const __envp[] )); +int _close (int __fildes); +pid_t _fork (void); +pid_t _getpid (void); +int _link (const char *__path1, const char *__path2); +off_t _lseek (int __fildes, off_t __offset, int __whence); +_READ_WRITE_RETURN_TYPE _read (int __fd, void *__buf, size_t __nbyte); +void * _sbrk (size_t __incr); +int _unlink (const char *__path); +_READ_WRITE_RETURN_TYPE _write (int __fd, const void *__buf, size_t __nbyte); +int _execve (const char *__path, char * const __argv[], char * const __envp[]); #define F_OK 0 #define R_OK 4 diff --git a/newlib/libc/sys/linux/sys/utime.h b/newlib/libc/sys/linux/sys/utime.h index 7499cfe7e..0df444ae6 100644 --- a/newlib/libc/sys/linux/sys/utime.h +++ b/newlib/libc/sys/linux/sys/utime.h @@ -9,6 +9,6 @@ struct utimbuf time_t modtime; /* Modification time. */ }; -int _EXFUN(utime, (const char *__file, const struct utimbuf *__times)); +int utime (const char *__file, const struct utimbuf *__times); #endif /* _SYS_UTIME_H */ diff --git a/newlib/libc/sys/sparc64/sys/stat.h b/newlib/libc/sys/sparc64/sys/stat.h index 746406737..c1f2a61d4 100644 --- a/newlib/libc/sys/sparc64/sys/stat.h +++ b/newlib/libc/sys/sparc64/sys/stat.h @@ -119,12 +119,12 @@ struct stat #define S_ISLNK(m) (((m)&_IFMT) == _IFLNK) #define S_ISSOCK(m) (((m)&_IFMT) == _IFSOCK) -int _EXFUN(chmod,( const char *_path, mode_t _mode )); -int _EXFUN(fstat,( int _fd, struct stat *_sbuf )); -int _EXFUN(mkdir,( char *_path, mode_t _mode )); -int _EXFUN(mkfifo,( char *_path, mode_t _mode )); -int _EXFUN(stat,( const char *__restrict _path, struct stat *__restrict _sbuf )); -mode_t _EXFUN(umask,( mode_t _mask )); +int chmod (const char *_path, mode_t _mode); +int fstat (int _fd, struct stat *_sbuf); +int mkdir (char *_path, mode_t _mode); +int mkfifo (char *_path, mode_t _mode); +int stat (const char *__restrict _path, struct stat *__restrict _sbuf); +mode_t umask (mode_t _mask); #ifdef __cplusplus } diff --git a/newlib/libc/time/local.h b/newlib/libc/time/local.h index 10c5b445d..dce51cda2 100644 --- a/newlib/libc/time/local.h +++ b/newlib/libc/time/local.h @@ -19,12 +19,12 @@ #define isleap(y) ((((y) % 4) == 0 && ((y) % 100) != 0) || ((y) % 400) == 0) -int _EXFUN (__tzcalc_limits, (int __year)); +int __tzcalc_limits (int __year); extern const int __month_lengths[2][MONSPERYEAR]; -void _EXFUN(_tzset_unlocked_r, (struct _reent *)); -void _EXFUN(_tzset_unlocked, (void)); +void _tzset_unlocked_r (struct _reent *); +void _tzset_unlocked (void); /* locks for multi-threading */ #ifdef __SINGLE_THREAD__ @@ -35,6 +35,6 @@ void _EXFUN(_tzset_unlocked, (void)); #define TZ_UNLOCK __tz_unlock() #endif -void _EXFUN(__tz_lock,(void)); -void _EXFUN(__tz_unlock,(void)); +void __tz_lock (void); +void __tz_unlock (void); diff --git a/newlib/libc/xdr/xdr_mem.c b/newlib/libc/xdr/xdr_mem.c index 3187ade74..a3d97b633 100644 --- a/newlib/libc/xdr/xdr_mem.c +++ b/newlib/libc/xdr/xdr_mem.c @@ -53,22 +53,22 @@ # define htonl(x) xdr_htonl(x) #endif -static void _EXFUN (xdrmem_destroy, (XDR *)); -static bool_t _EXFUN (xdrmem_getlong_aligned, (XDR *, long *)); -static bool_t _EXFUN (xdrmem_putlong_aligned, (XDR *, const long *)); -static bool_t _EXFUN (xdrmem_getlong_unaligned, (XDR *, long *)); -static bool_t _EXFUN (xdrmem_putlong_unaligned, (XDR *, const long *)); -static bool_t _EXFUN (xdrmem_getbytes, (XDR *, char *, u_int)); -static bool_t _EXFUN (xdrmem_putbytes, (XDR *, const char *, u_int)); +static void xdrmem_destroy (XDR *); +static bool_t xdrmem_getlong_aligned (XDR *, long *); +static bool_t xdrmem_putlong_aligned (XDR *, const long *); +static bool_t xdrmem_getlong_unaligned (XDR *, long *); +static bool_t xdrmem_putlong_unaligned (XDR *, const long *); +static bool_t xdrmem_getbytes (XDR *, char *, u_int); +static bool_t xdrmem_putbytes (XDR *, const char *, u_int); /* XXX: w/64-bit pointers, u_int not enough! */ -static u_int _EXFUN (xdrmem_getpos, (XDR *)); -static bool_t _EXFUN (xdrmem_setpos, (XDR *, u_int)); -static int32_t * _EXFUN (xdrmem_inline_aligned, (XDR *, u_int)); -static int32_t * _EXFUN (xdrmem_inline_unaligned, (XDR *, u_int)); -static bool_t _EXFUN (xdrmem_getint32_aligned, (XDR *, int32_t *)); -static bool_t _EXFUN (xdrmem_putint32_aligned, (XDR *, const int32_t *)); -static bool_t _EXFUN (xdrmem_getint32_unaligned, (XDR *, int32_t *)); -static bool_t _EXFUN (xdrmem_putint32_unaligned, (XDR *, const int32_t *)); +static u_int xdrmem_getpos (XDR *); +static bool_t xdrmem_setpos (XDR *, u_int); +static int32_t * xdrmem_inline_aligned (XDR *, u_int); +static int32_t * xdrmem_inline_unaligned (XDR *, u_int); +static bool_t xdrmem_getint32_aligned (XDR *, int32_t *); +static bool_t xdrmem_putint32_aligned (XDR *, const int32_t *); +static bool_t xdrmem_getint32_unaligned (XDR *, int32_t *); +static bool_t xdrmem_putint32_unaligned (XDR *, const int32_t *); static const struct xdr_ops xdrmem_ops_aligned = { xdrmem_getlong_aligned, diff --git a/newlib/libc/xdr/xdr_private.h b/newlib/libc/xdr/xdr_private.h index 3b071d668..98c9daada 100644 --- a/newlib/libc/xdr/xdr_private.h +++ b/newlib/libc/xdr/xdr_private.h @@ -43,13 +43,13 @@ extern "C" { typedef void (*xdr_vprintf_t) (const char *, va_list); -xdr_vprintf_t _EXFUN (xdr_set_vprintf, (xdr_vprintf_t)); +xdr_vprintf_t xdr_set_vprintf (xdr_vprintf_t); -void _EXFUN (xdr_vwarnx, (const char *, __VALIST) - _ATTRIBUTE ((__format__ (__printf__, 1, 0)))); +void xdr_vwarnx (const char *, __VALIST) + _ATTRIBUTE ((__format__ (__printf__, 1, 0))); -void _EXFUN (xdr_warnx, (const char *, ...) - _ATTRIBUTE ((__format__ (__printf__, 1, 2)))); +void xdr_warnx (const char *, ...) + _ATTRIBUTE ((__format__ (__printf__, 1, 2))); /* endian issues */ #include diff --git a/newlib/libc/xdr/xdr_rec.c b/newlib/libc/xdr/xdr_rec.c index 9051d522f..24cb5eb53 100644 --- a/newlib/libc/xdr/xdr_rec.c +++ b/newlib/libc/xdr/xdr_rec.c @@ -72,16 +72,16 @@ enum xprt_stat XPRT_IDLE }; -static bool_t _EXFUN (xdrrec_getlong, (XDR *, long *)); -static bool_t _EXFUN (xdrrec_putlong, (XDR *, const long *)); -static bool_t _EXFUN (xdrrec_getbytes, (XDR *, char *, u_int)); -static bool_t _EXFUN (xdrrec_putbytes, (XDR *, const char *, u_int)); -static u_int _EXFUN (xdrrec_getpos, (XDR *)); -static bool_t _EXFUN (xdrrec_setpos, (XDR *, u_int)); -static int32_t * _EXFUN (xdrrec_inline, (XDR *, u_int)); -static void _EXFUN (xdrrec_destroy, (XDR *)); -static bool_t _EXFUN (xdrrec_getint32, (XDR *, int32_t *)); -static bool_t _EXFUN (xdrrec_putint32, (XDR *, const int32_t *)); +static bool_t xdrrec_getlong (XDR *, long *); +static bool_t xdrrec_putlong (XDR *, const long *); +static bool_t xdrrec_getbytes (XDR *, char *, u_int); +static bool_t xdrrec_putbytes (XDR *, const char *, u_int); +static u_int xdrrec_getpos (XDR *); +static bool_t xdrrec_setpos (XDR *, u_int); +static int32_t * xdrrec_inline (XDR *, u_int); +static void xdrrec_destroy (XDR *); +static bool_t xdrrec_getint32 (XDR *, int32_t *); +static bool_t xdrrec_putint32 (XDR *, const int32_t *); static const struct xdr_ops xdrrec_ops = { xdrrec_getlong, @@ -156,8 +156,8 @@ static bool_t set_input_fragment (RECSTREAM *); static bool_t skip_input_bytes (RECSTREAM *, long); static bool_t realloc_stream (RECSTREAM *, int); -bool_t _EXFUN (__xdrrec_getrec, (XDR *, enum xprt_stat *, bool_t)); -bool_t _EXFUN (__xdrrec_setnonblock, (XDR *, int)); +bool_t __xdrrec_getrec (XDR *, enum xprt_stat *, bool_t); +bool_t __xdrrec_setnonblock (XDR *, int); /* * Create an xdr handle for xdrrec diff --git a/newlib/libc/xdr/xdr_stdio.c b/newlib/libc/xdr/xdr_stdio.c index 784ac6c8b..05fbe1f30 100644 --- a/newlib/libc/xdr/xdr_stdio.c +++ b/newlib/libc/xdr/xdr_stdio.c @@ -50,16 +50,16 @@ # define htonl(x) xdr_htonl(x) #endif -static void _EXFUN (xdrstdio_destroy, (XDR *)); -static bool_t _EXFUN (xdrstdio_getlong, (XDR *, long *)); -static bool_t _EXFUN (xdrstdio_putlong, (XDR *, const long *)); -static bool_t _EXFUN (xdrstdio_getbytes, (XDR *, char *, u_int)); -static bool_t _EXFUN (xdrstdio_putbytes, (XDR *, const char *, u_int)); -static u_int _EXFUN (xdrstdio_getpos, (XDR *)); -static bool_t _EXFUN (xdrstdio_setpos, (XDR *, u_int)); -static int32_t * _EXFUN (xdrstdio_inline, (XDR *, u_int)); -static bool_t _EXFUN (xdrstdio_getint32, (XDR*, int32_t *)); -static bool_t _EXFUN (xdrstdio_putint32, (XDR*, const int32_t *)); +static void xdrstdio_destroy (XDR *); +static bool_t xdrstdio_getlong (XDR *, long *); +static bool_t xdrstdio_putlong (XDR *, const long *); +static bool_t xdrstdio_getbytes (XDR *, char *, u_int); +static bool_t xdrstdio_putbytes (XDR *, const char *, u_int); +static u_int xdrstdio_getpos (XDR *); +static bool_t xdrstdio_setpos (XDR *, u_int); +static int32_t * xdrstdio_inline (XDR *, u_int); +static bool_t xdrstdio_getint32 (XDR*, int32_t *); +static bool_t xdrstdio_putint32 (XDR*, const int32_t *); /* * Ops vector for stdio type XDR diff --git a/newlib/libm/mathfp/zmath.h b/newlib/libm/mathfp/zmath.h index 369bfec49..67bdb24a7 100644 --- a/newlib/libm/mathfp/zmath.h +++ b/newlib/libm/mathfp/zmath.h @@ -39,17 +39,17 @@ extern float z_rooteps_f; /* Core math routines. */ -int _EXFUN (numtest, (double)); -int _EXFUN (numtestf, (float)); -double _EXFUN (logarithm, (double, int)); -float _EXFUN (logarithmf, (float, int)); -double _EXFUN (sine, (double, int)); -float _EXFUN (sinef, (float, int)); -double _EXFUN (asine, (double, int)); -float _EXFUN (asinef, (float, int)); -double _EXFUN (atangent, (double, double, double, int)); -float _EXFUN (atangentf, (float, float, float, int)); -double _EXFUN (sineh, (double, int)); -float _EXFUN (sinehf, (float, int)); +int numtest (double); +int numtestf (float); +double logarithm (double, int); +float logarithmf (float, int); +double sine (double, int); +float sinef (float, int); +double asine (double, int); +float asinef (float, int); +double atangent (double, double, double, int); +float atangentf (float, float, float, int); +double sineh (double, int); +float sinehf (float, int); #endif /* no __ZMATH_H */ diff --git a/newlib/libm/test/convert.c b/newlib/libm/test/convert.c index fe5bc0aa4..026bd277b 100644 --- a/newlib/libm/test/convert.c +++ b/newlib/libm/test/convert.c @@ -49,7 +49,7 @@ test_atoff (void) static void -iterate (void _EXFUN((*func),(void)), +iterate (void (*func) (void), char *name) { diff --git a/newlib/libm/test/math.c b/newlib/libm/test/math.c index dda587a33..0a6389a01 100644 --- a/newlib/libm/test/math.c +++ b/newlib/libm/test/math.c @@ -263,7 +263,7 @@ run_vector_1 (int vector, if (strcmp(args,"dd")==0) { - typedef double _EXFUN((*pdblfunc),(double)); + typedef double (*pdblfunc) (double); /* Double function returning a double */ @@ -276,7 +276,7 @@ run_vector_1 (int vector, float arga; double a; - typedef float _EXFUN((*pdblfunc),(float)); + typedef float (*pdblfunc) (float); /* Double function returning a double */ @@ -289,7 +289,7 @@ run_vector_1 (int vector, } else if (strcmp(args,"ddd")==0) { - typedef double _EXFUN((*pdblfunc),(double,double)); + typedef double (*pdblfunc) (double,double); result = ((pdblfunc)(func))(arg1,arg2); finish(f, vector, result, p,args, name); @@ -301,7 +301,7 @@ run_vector_1 (int vector, float arga; float argb; - typedef float _EXFUN((*pdblfunc),(float,float)); + typedef float (*pdblfunc) (float,float); if (arg1 < FLT_MAX && arg2 < FLT_MAX) @@ -314,7 +314,7 @@ run_vector_1 (int vector, } else if (strcmp(args,"did")==0) { - typedef double _EXFUN((*pdblfunc),(int,double)); + typedef double (*pdblfunc) (int,double); result = ((pdblfunc)(func))((int)arg1,arg2); finish(f, vector, result, p,args, name); @@ -326,7 +326,7 @@ run_vector_1 (int vector, float arga; float argb; - typedef float _EXFUN((*pdblfunc),(int,float)); + typedef float (*pdblfunc) (int,float); if (arg1 < FLT_MAX && arg2 < FLT_MAX) diff --git a/newlib/libm/test/test.h b/newlib/libm/test/test.h index 440c3850e..e95c6b4c4 100644 --- a/newlib/libm/test/test.h +++ b/newlib/libm/test/test.h @@ -34,7 +34,7 @@ typedef struct #define MVEC_END 0,}; -int _EXFUN(mag_of_error,(double, double)); +int mag_of_error (double, double); #define ERROR_PERFECT 20 @@ -128,18 +128,18 @@ typedef struct } sprint_int_type; -void _EXFUN(test_ieee,(void)); -void _EXFUN(test_math2,(void)); -void _EXFUN(test_math,(void)); -void _EXFUN(test_string,(void)); -void _EXFUN(test_is,(void)); -void _EXFUN(test_cvt,(void)); +void test_ieee (void); +void test_math2 (void); +void test_math (void); +void test_string (void); +void test_is (void); +void test_cvt (void); -void _EXFUN(line,(int)); +void line (int); -void _EXFUN(test_mok, (double, double, int)); -void _EXFUN(test_iok, (int, int)); -void _EXFUN(test_eok, (int, int)); -void _EXFUN(test_sok, (char *, char*)); -void _EXFUN(test_scok, (char *, char*, int)); -void _EXFUN(newfunc,(const char *)); +void test_mok (double, double, int); +void test_iok (int, int); +void test_eok (int, int); +void test_sok (char *, char*); +void test_scok (char *, char*, int); +void newfunc (const char *); diff --git a/winsup/cygwin/include/attr/xattr.h b/winsup/cygwin/include/attr/xattr.h index 7e410414d..07d33837e 100644 --- a/winsup/cygwin/include/attr/xattr.h +++ b/winsup/cygwin/include/attr/xattr.h @@ -26,18 +26,18 @@ details. */ _BEGIN_STD_C -ssize_t _EXFUN(getxattr,(const char *, const char *, void *, size_t )); -ssize_t _EXFUN(lgetxattr,(const char *, const char *, void *, size_t )); -ssize_t _EXFUN(fgetxattr,(int , const char *, void *, size_t )); -ssize_t _EXFUN(listxattr,(const char *, char *, size_t )); -ssize_t _EXFUN(llistxattr,(const char *, char *, size_t )); -ssize_t _EXFUN(flistxattr,(int , char *, size_t )); -int _EXFUN(setxattr,(const char *, const char *, const void *, size_t , int )); -int _EXFUN(lsetxattr,(const char *, const char *, const void *, size_t , int )); -int _EXFUN(fsetxattr,(int , const char *, const void *, size_t , int )); -int _EXFUN(removexattr,(const char *, const char *)); -int _EXFUN(lremovexattr,(const char *, const char *)); -int _EXFUN(fremovexattr,(int , const char *)); +ssize_t getxattr (const char *, const char *, void *, size_t); +ssize_t lgetxattr (const char *, const char *, void *, size_t); +ssize_t fgetxattr (int , const char *, void *, size_t); +ssize_t listxattr (const char *, char *, size_t); +ssize_t llistxattr (const char *, char *, size_t); +ssize_t flistxattr (int , char *, size_t); +int setxattr (const char *, const char *, const void *, size_t , int); +int lsetxattr (const char *, const char *, const void *, size_t , int); +int fsetxattr (int , const char *, const void *, size_t , int); +int removexattr (const char *, const char *); +int lremovexattr (const char *, const char *); +int fremovexattr (int , const char *); _END_STD_C diff --git a/winsup/cygwin/include/pty.h b/winsup/cygwin/include/pty.h index 7b92a2b4d..8754dedc9 100644 --- a/winsup/cygwin/include/pty.h +++ b/winsup/cygwin/include/pty.h @@ -8,10 +8,10 @@ extern "C" { #endif -int _EXFUN(openpty ,(int *, int *, char *, const struct termios *, - const struct winsize *)); -int _EXFUN(forkpty ,(int *, char *, const struct termios *, - const struct winsize *)); +int openpty (int *, int *, char *, const struct termios *, + const struct winsize *); +int forkpty (int *, char *, const struct termios *, + const struct winsize *); #ifdef __cplusplus } diff --git a/winsup/cygwin/include/sys/stdio.h b/winsup/cygwin/include/sys/stdio.h index ac22a3940..1e6830fb0 100644 --- a/winsup/cygwin/include/sys/stdio.h +++ b/winsup/cygwin/include/sys/stdio.h @@ -32,8 +32,8 @@ details. */ __BEGIN_DECLS -ssize_t _EXFUN(getline, (char **, size_t *, FILE *)); -ssize_t _EXFUN(getdelim, (char **, size_t *, int, FILE *)); +ssize_t getline (char **, size_t *, FILE *); +ssize_t getdelim (char **, size_t *, int, FILE *); __END_DECLS diff --git a/winsup/cygwin/include/sys/utime.h b/winsup/cygwin/include/sys/utime.h index 8408fa1df..ab6faebb9 100644 --- a/winsup/cygwin/include/sys/utime.h +++ b/winsup/cygwin/include/sys/utime.h @@ -19,7 +19,7 @@ struct utimbuf time_t modtime; }; -int _EXFUN(utime, (const char *__path, const struct utimbuf *__buf)); +int utime (const char *__path, const struct utimbuf *__buf); #ifdef __cplusplus }; From 7192f840966684d4460542a516278ca08dd14842 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 3 Dec 2017 23:58:31 -0600 Subject: [PATCH 219/649] ansification: remove _HAVE_STDC Signed-off-by: Yaakov Selkowitz --- libgloss/sparc_leon/console_dbg.c | 4 ---- newlib/doc/ansidecl.h | 21 ------------------- newlib/libc/include/_ansi.h | 19 +---------------- newlib/libc/include/machine/fastmath.h | 2 -- newlib/libc/machine/powerpc/vfprintf.c | 4 ---- newlib/libc/machine/powerpc/vfscanf.c | 4 ---- newlib/libc/machine/spu/vfprintf.c | 4 ---- newlib/libc/machine/spu/vfscanf.c | 4 ---- newlib/libc/machine/spu/vprintf.c | 4 ---- newlib/libc/machine/spu/vscanf.c | 4 ---- newlib/libc/machine/spu/vsnprintf.c | 4 ---- newlib/libc/machine/spu/vsprintf.c | 4 ---- newlib/libc/machine/spu/vsscanf.c | 4 ---- newlib/libc/posix/execl.c | 11 ---------- newlib/libc/posix/execle.c | 11 ---------- newlib/libc/posix/execlp.c | 11 ---------- newlib/libc/stdio/fiscanf.c | 27 ------------------------ newlib/libc/stdio/fscanf.c | 27 ------------------------ newlib/libc/stdio/iscanf.c | 25 ---------------------- newlib/libc/stdio/scanf.c | 25 ---------------------- newlib/libc/stdio/siprintf.c | 27 ------------------------ newlib/libc/stdio/siscanf.c | 29 -------------------------- newlib/libc/stdio/sniprintf.c | 29 -------------------------- newlib/libc/stdio/snprintf.c | 29 -------------------------- newlib/libc/stdio/sprintf.c | 27 ------------------------ newlib/libc/stdio/sscanf.c | 29 -------------------------- newlib/libc/stdio/viprintf.c | 4 ---- newlib/libc/stdio/viscanf.c | 4 ---- newlib/libc/stdio/vprintf.c | 4 ---- newlib/libc/stdio/vscanf.c | 4 ---- newlib/libc/stdio/vsiscanf.c | 4 ---- newlib/libc/stdio/vsscanf.c | 4 ---- newlib/libc/stdio/vswscanf.c | 4 ---- newlib/libc/stdio/vwscanf.c | 4 ---- newlib/libc/stdlib/std.h | 6 ------ newlib/libc/syscalls/sysopen.c | 13 ------------ newlib/libm/math/wf_acos.c | 5 ----- 37 files changed, 1 insertion(+), 444 deletions(-) diff --git a/libgloss/sparc_leon/console_dbg.c b/libgloss/sparc_leon/console_dbg.c index 57c258fb4..f4bfc5c27 100644 --- a/libgloss/sparc_leon/console_dbg.c +++ b/libgloss/sparc_leon/console_dbg.c @@ -25,11 +25,7 @@ #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include #include diff --git a/newlib/doc/ansidecl.h b/newlib/doc/ansidecl.h index 1c7708fd5..f67f93bea 100644 --- a/newlib/doc/ansidecl.h +++ b/newlib/doc/ansidecl.h @@ -74,7 +74,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ /* LINTLIBRARY */ -#ifdef _HAVE_STDC #define PTR void * #define PTRCONST void *CONST @@ -91,26 +90,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #define DEFUN(name, arglist, args) name(args) #define DEFUN_VOID(name) name(NOARGS) -#else /* Not ANSI C. */ - -#define PTR char * -#define PTRCONST PTR -#define LONG_DOUBLE double - -#define AND ; -#define NOARGS -#define CONST -#define VOLATILE -#define SIGNED -#define DOTS - -#define const - -#define EXFUN(name, proto) name() -#define DEFUN(name, arglist, args) name arglist args; -#define DEFUN_VOID(name) name() - -#endif /* ANSI C. */ #endif /* ansidecl.h */ diff --git a/newlib/libc/include/_ansi.h b/newlib/libc/include/_ansi.h index e2737ed48..6c7497efd 100644 --- a/newlib/libc/include/_ansi.h +++ b/newlib/libc/include/_ansi.h @@ -1,11 +1,6 @@ /* Provide support for both ANSI and non-ANSI environments. */ -/* Some ANSI environments are "broken" in the sense that __STDC__ cannot be - relied upon to have it's intended meaning. Therefore we must use our own - concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib - sources! - - To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will +/* To get a strict ANSI C environment, define macro __STRICT_ANSI__. This will "comment out" the non-ANSI parts of the ANSI header files (non-ANSI header files aren't affected). */ @@ -15,14 +10,6 @@ #include #include -/* First try to figure out whether we really are in an ANSI C environment. */ -/* FIXME: This probably needs some work. Perhaps sys/config.h can be - prevailed upon to give us a clue. */ - -#ifdef __STDC__ -#define _HAVE_STDC -#endif - /* ISO C++. */ #ifdef __cplusplus @@ -46,13 +33,9 @@ #define _NOTHROW #endif -#ifdef _HAVE_STDC #ifndef _LONG_DOUBLE #define _LONG_DOUBLE long double #endif -#else -#define _LONG_DOUBLE double -#endif /* Support gcc's __attribute__ facility. */ diff --git a/newlib/libc/include/machine/fastmath.h b/newlib/libc/include/machine/fastmath.h index b13befa22..d13ab3b73 100644 --- a/newlib/libc/include/machine/fastmath.h +++ b/newlib/libc/include/machine/fastmath.h @@ -46,7 +46,6 @@ double EXFUN(fast_loge,(double)); #define log2(x) fast_log2(x) #define loge(x) fast_loge(x) -#ifdef _HAVE_STDC /* These functions are in assembler, they really do take floats. This can only be used with a real ANSI compiler */ @@ -94,7 +93,6 @@ float EXFUN(fast_logef,(float)); #define log10f(x) fast_log10f(x) #define log2f(x) fast_log2f(x) #define logef(x) fast_logef(x) -#endif /* Override the functions defined in math.h */ #endif /* __sysvnecv70_target */ diff --git a/newlib/libc/machine/powerpc/vfprintf.c b/newlib/libc/machine/powerpc/vfprintf.c index 2cae2aaa1..1244f39f1 100644 --- a/newlib/libc/machine/powerpc/vfprintf.c +++ b/newlib/libc/machine/powerpc/vfprintf.c @@ -120,11 +120,7 @@ static char *rcsid = "$Id$"; #include #endif -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #include "fvwrite.h" diff --git a/newlib/libc/machine/powerpc/vfscanf.c b/newlib/libc/machine/powerpc/vfscanf.c index f0443bf4a..111fe5f9e 100644 --- a/newlib/libc/machine/powerpc/vfscanf.c +++ b/newlib/libc/machine/powerpc/vfscanf.c @@ -77,11 +77,7 @@ Supporting OS subroutines required: #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef NO_FLOATING_POINT diff --git a/newlib/libc/machine/spu/vfprintf.c b/newlib/libc/machine/spu/vfprintf.c index 6e436421b..deda41571 100644 --- a/newlib/libc/machine/spu/vfprintf.c +++ b/newlib/libc/machine/spu/vfprintf.c @@ -35,11 +35,7 @@ Author: Joel Schopp #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vfprintf vfiprintf diff --git a/newlib/libc/machine/spu/vfscanf.c b/newlib/libc/machine/spu/vfscanf.c index 9af12e91a..9e093ba28 100644 --- a/newlib/libc/machine/spu/vfscanf.c +++ b/newlib/libc/machine/spu/vfscanf.c @@ -35,11 +35,7 @@ Author: Joel Schopp #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vfscanf vfiscanf diff --git a/newlib/libc/machine/spu/vprintf.c b/newlib/libc/machine/spu/vprintf.c index 29cac0c8d..de98c0a33 100644 --- a/newlib/libc/machine/spu/vprintf.c +++ b/newlib/libc/machine/spu/vprintf.c @@ -3,11 +3,7 @@ #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vprintf viprintf diff --git a/newlib/libc/machine/spu/vscanf.c b/newlib/libc/machine/spu/vscanf.c index 39348905d..e2d324ed7 100644 --- a/newlib/libc/machine/spu/vscanf.c +++ b/newlib/libc/machine/spu/vscanf.c @@ -35,11 +35,7 @@ Author: Joel Schopp #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vscanf viscanf diff --git a/newlib/libc/machine/spu/vsnprintf.c b/newlib/libc/machine/spu/vsnprintf.c index 81ba7bef2..298165f5a 100644 --- a/newlib/libc/machine/spu/vsnprintf.c +++ b/newlib/libc/machine/spu/vsnprintf.c @@ -3,11 +3,7 @@ #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vsnprintf vsniprintf diff --git a/newlib/libc/machine/spu/vsprintf.c b/newlib/libc/machine/spu/vsprintf.c index 8b0e414de..8317a6636 100644 --- a/newlib/libc/machine/spu/vsprintf.c +++ b/newlib/libc/machine/spu/vsprintf.c @@ -4,11 +4,7 @@ #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vsprintf vsiprintf diff --git a/newlib/libc/machine/spu/vsscanf.c b/newlib/libc/machine/spu/vsscanf.c index a94b152d2..ed6421422 100644 --- a/newlib/libc/machine/spu/vsscanf.c +++ b/newlib/libc/machine/spu/vsscanf.c @@ -35,11 +35,7 @@ Author: Joel Schopp #include "c99ppe.h" -#ifdef _HAVE_STDC #include -#else -#include -#endif #ifdef INTEGER_ONLY # define vsscanf vsiscanf diff --git a/newlib/libc/posix/execl.c b/newlib/libc/posix/execl.c index 6ba95e2dc..c3b4e55bd 100644 --- a/newlib/libc/posix/execl.c +++ b/newlib/libc/posix/execl.c @@ -13,7 +13,6 @@ 'environ'. */ static char ***p_environ = &environ; -#ifdef _HAVE_STDC #include @@ -21,16 +20,6 @@ int execl (const char *path, const char *arg0, ...) -#else - -#include - -int -execl (const char *path, - const char *arg0, - va_dcl) - -#endif { int i; diff --git a/newlib/libc/posix/execle.c b/newlib/libc/posix/execle.c index 641bdac72..34f0ea373 100644 --- a/newlib/libc/posix/execle.c +++ b/newlib/libc/posix/execle.c @@ -8,7 +8,6 @@ #include <_ansi.h> #include -#ifdef _HAVE_STDC #include @@ -16,16 +15,6 @@ int execle (const char *path, const char *arg0, ...) -#else - -#include - -int -execle (const char *path, - const char *arg0, - va_dcl) - -#endif { int i; diff --git a/newlib/libc/posix/execlp.c b/newlib/libc/posix/execlp.c index 41b300d8f..b845c88c5 100644 --- a/newlib/libc/posix/execlp.c +++ b/newlib/libc/posix/execlp.c @@ -8,7 +8,6 @@ #include <_ansi.h> #include -#ifdef _HAVE_STDC #include @@ -16,16 +15,6 @@ int execlp (const char *path, const char *arg0, ...) -#else - -#include - -int -execlp (const char *path, - const char *arg0, - va_dcl) - -#endif { int i; diff --git a/newlib/libc/stdio/fiscanf.c b/newlib/libc/stdio/fiscanf.c index 7b497bddb..ea93f7542 100644 --- a/newlib/libc/stdio/fiscanf.c +++ b/newlib/libc/stdio/fiscanf.c @@ -18,33 +18,18 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC fiscanf(FILE *fp, const char *fmt, ...) -#else -fiscanf(FILE *fp, fmt, va_alist) - FILE *fp; - char *fmt; - va_dcl -#endif { int ret; va_list ap; -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __svfiscanf_r (_REENT, fp, fmt, ap); va_end (ap); return ret; @@ -53,24 +38,12 @@ fiscanf(FILE *fp, fmt, va_alist) #endif /* !_REENT_ONLY */ int -#ifdef _HAVE_STDC _fiscanf_r(struct _reent *ptr, FILE *fp, const char *fmt, ...) -#else -_fiscanf_r(ptr, FILE *fp, fmt, va_alist) - struct _reent *ptr; - FILE *fp; - char *fmt; - va_dcl -#endif { int ret; va_list ap; -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __svfiscanf_r (ptr, fp, fmt, ap); va_end (ap); return (ret); diff --git a/newlib/libc/stdio/fscanf.c b/newlib/libc/stdio/fscanf.c index 94096a22b..af01eedbe 100644 --- a/newlib/libc/stdio/fscanf.c +++ b/newlib/libc/stdio/fscanf.c @@ -18,33 +18,18 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC fscanf(FILE *__restrict fp, const char *__restrict fmt, ...) -#else -fscanf(FILE *fp, fmt, va_alist) - FILE *fp; - char *fmt; - va_dcl -#endif { int ret; va_list ap; -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _vfscanf_r (_REENT, fp, fmt, ap); va_end (ap); return ret; @@ -59,24 +44,12 @@ fiscanf (FILE *, const char *, ...) #endif /* !_REENT_ONLY */ int -#ifdef _HAVE_STDC _fscanf_r(struct _reent *ptr, FILE *__restrict fp, const char *__restrict fmt, ...) -#else -_fscanf_r(ptr, FILE *fp, fmt, va_alist) - struct _reent *ptr; - FILE *fp; - char *fmt; - va_dcl -#endif { int ret; va_list ap; -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _vfscanf_r (ptr, fp, fmt, ap); va_end (ap); return (ret); diff --git a/newlib/libc/stdio/iscanf.c b/newlib/libc/stdio/iscanf.c index aefd1a4ac..980dabd29 100644 --- a/newlib/libc/stdio/iscanf.c +++ b/newlib/libc/stdio/iscanf.c @@ -18,33 +18,19 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC iscanf(const char *fmt, ...) -#else -iscanf(fmt, va_alist) - char *fmt; - va_dcl -#endif { int ret; va_list ap; _REENT_SMALL_CHECK_INIT (_REENT); -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __svfiscanf_r (_REENT, _stdin_r (_REENT), fmt, ap); va_end (ap); return ret; @@ -53,24 +39,13 @@ iscanf(fmt, va_alist) #endif /* !_REENT_ONLY */ int -#ifdef _HAVE_STDC _iscanf_r(struct _reent *ptr, const char *fmt, ...) -#else -_iscanf_r(ptr, fmt, va_alist) - struct _reent *ptr; - char *fmt; - va_dcl -#endif { int ret; va_list ap; _REENT_SMALL_CHECK_INIT (ptr); -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __svfiscanf_r (ptr, _stdin_r (ptr), fmt, ap); va_end (ap); return (ret); diff --git a/newlib/libc/stdio/scanf.c b/newlib/libc/stdio/scanf.c index a5a9391c0..898c6e7af 100644 --- a/newlib/libc/stdio/scanf.c +++ b/newlib/libc/stdio/scanf.c @@ -18,34 +18,20 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC scanf(const char *__restrict fmt, ...) -#else -scanf(fmt, va_alist) - char *fmt; - va_dcl -#endif { int ret; va_list ap; struct _reent *reent = _REENT; _REENT_SMALL_CHECK_INIT (reent); -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _vfscanf_r (reent, _stdin_r (reent), fmt, ap); va_end (ap); return ret; @@ -60,24 +46,13 @@ iscanf (const char *, ...) #endif /* !_REENT_ONLY */ int -#ifdef _HAVE_STDC _scanf_r(struct _reent *ptr, const char *__restrict fmt, ...) -#else -_scanf_r(ptr, fmt, va_alist) - struct _reent *ptr; - char *fmt; - va_dcl -#endif { int ret; va_list ap; _REENT_SMALL_CHECK_INIT (ptr); -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _vfscanf_r (ptr, _stdin_r (ptr), fmt, ap); va_end (ap); return (ret); diff --git a/newlib/libc/stdio/siprintf.c b/newlib/libc/stdio/siprintf.c index 6ec24777e..be000f629 100644 --- a/newlib/libc/stdio/siprintf.c +++ b/newlib/libc/stdio/siprintf.c @@ -94,26 +94,14 @@ Supporting OS subroutines required: <>, <>, <>, #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include #include "local.h" int -#ifdef _HAVE_STDC _siprintf_r (struct _reent *ptr, char *str, const char *fmt, ...) -#else -_siprintf_r(ptr, str, fmt, va_alist) - struct _reent *ptr; - char *str; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -123,11 +111,7 @@ _siprintf_r(ptr, str, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = INT_MAX; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfiprintf_r (ptr, &f, fmt, ap); va_end (ap); *f._p = 0; @@ -137,15 +121,8 @@ _siprintf_r(ptr, str, fmt, va_alist) #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC siprintf (char *str, const char *fmt, ...) -#else -siprintf(str, fmt, va_alist) - char *str; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -155,11 +132,7 @@ siprintf(str, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = INT_MAX; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfiprintf_r (_REENT, &f, fmt, ap); va_end (ap); *f._p = 0; diff --git a/newlib/libc/stdio/siscanf.c b/newlib/libc/stdio/siscanf.c index 9b45ecdbb..355d2662a 100644 --- a/newlib/libc/stdio/siscanf.c +++ b/newlib/libc/stdio/siscanf.c @@ -76,26 +76,14 @@ Supporting OS subroutines required: <>, <>, <>, #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY -#ifdef _HAVE_STDC int siscanf (const char *str, const char *fmt, ...) -#else -int -siscanf(str, fmt, va_alist) - const char *str; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -108,11 +96,7 @@ siscanf(str, fmt, va_alist) f._ub._base = NULL; f._lb._base = NULL; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __ssvfiscanf_r (_REENT, &f, fmt, ap); va_end (ap); return ret; @@ -120,19 +104,10 @@ siscanf(str, fmt, va_alist) #endif /* !_REENT_ONLY */ -#ifdef _HAVE_STDC int _siscanf_r (struct _reent *ptr, const char *str, const char *fmt, ...) -#else -int -_siscanf_r(ptr, str, fmt, va_alist) - struct _reent *ptr; - const char *str; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -145,11 +120,7 @@ _siscanf_r(ptr, str, fmt, va_alist) f._ub._base = NULL; f._lb._base = NULL; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __ssvfiscanf_r (ptr, &f, fmt, ap); va_end (ap); return ret; diff --git a/newlib/libc/stdio/sniprintf.c b/newlib/libc/stdio/sniprintf.c index d13278437..840c564dc 100644 --- a/newlib/libc/stdio/sniprintf.c +++ b/newlib/libc/stdio/sniprintf.c @@ -21,29 +21,16 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include #include #include "local.h" int -#ifdef _HAVE_STDC _sniprintf_r (struct _reent *ptr, char *str, size_t size, const char *fmt, ...) -#else -_sniprintf_r (ptr, str, size, fmt, va_alist) - struct _reent *ptr; - char *str; - size_t size; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -58,11 +45,7 @@ _sniprintf_r (ptr, str, size, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = (size > 0 ? size - 1 : 0); f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfiprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) @@ -75,17 +58,9 @@ _sniprintf_r (ptr, str, size, fmt, va_alist) #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC sniprintf (char *str, size_t size, const char *fmt, ...) -#else -sniprintf (str, size, fmt, va_alist) - char *str; - size_t size; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -101,11 +76,7 @@ sniprintf (str, size, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = (size > 0 ? size - 1 : 0); f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfiprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) diff --git a/newlib/libc/stdio/snprintf.c b/newlib/libc/stdio/snprintf.c index d73cdbf3a..809b52b51 100644 --- a/newlib/libc/stdio/snprintf.c +++ b/newlib/libc/stdio/snprintf.c @@ -20,29 +20,16 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include #include #include "local.h" int -#ifdef _HAVE_STDC _snprintf_r (struct _reent *ptr, char *__restrict str, size_t size, const char *__restrict fmt, ...) -#else -_snprintf_r(ptr, str, size, fmt, va_alist) - struct _reent *ptr; - char *str; - size_t size; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -57,11 +44,7 @@ _snprintf_r(ptr, str, size, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = (size > 0 ? size - 1 : 0); f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) @@ -80,17 +63,9 @@ _sniprintf_r (struct _reent *, char *, size_t, const char *, ...) #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC snprintf (char *__restrict str, size_t size, const char *__restrict fmt, ...) -#else -snprintf(str, size, fmt, va_alist) - char *str; - size_t size; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -106,11 +81,7 @@ snprintf(str, size, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = (size > 0 ? size - 1 : 0); f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfprintf_r (ptr, &f, fmt, ap); va_end (ap); if (ret < EOF) diff --git a/newlib/libc/stdio/sprintf.c b/newlib/libc/stdio/sprintf.c index 37d92f93e..096ca216a 100644 --- a/newlib/libc/stdio/sprintf.c +++ b/newlib/libc/stdio/sprintf.c @@ -570,26 +570,14 @@ Supporting OS subroutines required: <>, <>, <>, #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include #include "local.h" int -#ifdef _HAVE_STDC _sprintf_r (struct _reent *ptr, char *__restrict str, const char *__restrict fmt, ...) -#else -_sprintf_r(ptr, str, fmt, va_alist) - struct _reent *ptr; - char *__restrict str; - const char *__restrict fmt; - va_dcl -#endif { int ret; va_list ap; @@ -599,11 +587,7 @@ _sprintf_r(ptr, str, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = INT_MAX; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfprintf_r (ptr, &f, fmt, ap); va_end (ap); *f._p = '\0'; /* terminate the string */ @@ -619,15 +603,8 @@ _siprintf_r (struct _reent *, char *, const char *, ...) #ifndef _REENT_ONLY int -#ifdef _HAVE_STDC sprintf (char *__restrict str, const char *__restrict fmt, ...) -#else -sprintf(str, fmt, va_alist) - char *str; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -637,11 +614,7 @@ sprintf(str, fmt, va_alist) f._bf._base = f._p = (unsigned char *) str; f._bf._size = f._w = INT_MAX; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = _svfprintf_r (_REENT, &f, fmt, ap); va_end (ap); *f._p = '\0'; /* terminate the string */ diff --git a/newlib/libc/stdio/sscanf.c b/newlib/libc/stdio/sscanf.c index 971db439d..99054e245 100644 --- a/newlib/libc/stdio/sscanf.c +++ b/newlib/libc/stdio/sscanf.c @@ -415,26 +415,14 @@ Supporting OS subroutines required: <>, <>, <>, #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY -#ifdef _HAVE_STDC int sscanf (const char *__restrict str, const char * fmt, ...) -#else -int -sscanf(str, fmt, va_alist) - const char *str; - const char *fmt; - va_dcl -#endif { int ret; va_list ap; @@ -447,11 +435,7 @@ sscanf(str, fmt, va_alist) f._ub._base = NULL; f._lb._base = NULL; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __ssvfscanf_r (_REENT, &f, fmt, ap); va_end (ap); return ret; @@ -465,19 +449,10 @@ siscanf (const char *, const char *, ...) #endif /* !_REENT_ONLY */ -#ifdef _HAVE_STDC int _sscanf_r (struct _reent *ptr, const char *__restrict str, const char *__restrict fmt, ...) -#else -int -_sscanf_r(ptr, str, fmt, va_alist) - struct _reent *ptr; - const char *__restrict str; - const char *__restrict fmt; - va_dcl -#endif { int ret; va_list ap; @@ -490,11 +465,7 @@ _sscanf_r(ptr, str, fmt, va_alist) f._ub._base = NULL; f._lb._base = NULL; f._file = -1; /* No file. */ -#ifdef _HAVE_STDC va_start (ap, fmt); -#else - va_start (ap); -#endif ret = __ssvfscanf_r (ptr, &f, fmt, ap); va_end (ap); return ret; diff --git a/newlib/libc/stdio/viprintf.c b/newlib/libc/stdio/viprintf.c index 9678815f1..a59bc9c19 100644 --- a/newlib/libc/stdio/viprintf.c +++ b/newlib/libc/stdio/viprintf.c @@ -95,11 +95,7 @@ Supporting OS subroutines required: <>, <>, <>, #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY diff --git a/newlib/libc/stdio/viscanf.c b/newlib/libc/stdio/viscanf.c index e5ad1dbbd..c19d1b16a 100644 --- a/newlib/libc/stdio/viscanf.c +++ b/newlib/libc/stdio/viscanf.c @@ -79,11 +79,7 @@ Supporting OS subroutines required: #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY diff --git a/newlib/libc/stdio/vprintf.c b/newlib/libc/stdio/vprintf.c index fb46c1c1a..b195a1ecf 100644 --- a/newlib/libc/stdio/vprintf.c +++ b/newlib/libc/stdio/vprintf.c @@ -19,11 +19,7 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY diff --git a/newlib/libc/stdio/vscanf.c b/newlib/libc/stdio/vscanf.c index bbbbd0a83..567f5cb3e 100644 --- a/newlib/libc/stdio/vscanf.c +++ b/newlib/libc/stdio/vscanf.c @@ -20,11 +20,7 @@ #include <_ansi.h> #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY diff --git a/newlib/libc/stdio/vsiscanf.c b/newlib/libc/stdio/vsiscanf.c index 5679df056..b21dcb1a2 100644 --- a/newlib/libc/stdio/vsiscanf.c +++ b/newlib/libc/stdio/vsiscanf.c @@ -21,11 +21,7 @@ #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" /* diff --git a/newlib/libc/stdio/vsscanf.c b/newlib/libc/stdio/vsscanf.c index 97c7bae80..f4e096b50 100644 --- a/newlib/libc/stdio/vsscanf.c +++ b/newlib/libc/stdio/vsscanf.c @@ -21,11 +21,7 @@ #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" /* diff --git a/newlib/libc/stdio/vswscanf.c b/newlib/libc/stdio/vswscanf.c index 90393f528..7687001ab 100644 --- a/newlib/libc/stdio/vswscanf.c +++ b/newlib/libc/stdio/vswscanf.c @@ -23,11 +23,7 @@ #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" /* diff --git a/newlib/libc/stdio/vwscanf.c b/newlib/libc/stdio/vwscanf.c index 3945e79c8..1f33db6af 100644 --- a/newlib/libc/stdio/vwscanf.c +++ b/newlib/libc/stdio/vwscanf.c @@ -22,11 +22,7 @@ #include #include #include -#ifdef _HAVE_STDC #include -#else -#include -#endif #include "local.h" #ifndef _REENT_ONLY diff --git a/newlib/libc/stdlib/std.h b/newlib/libc/stdlib/std.h index b20820be4..c000a67c6 100644 --- a/newlib/libc/stdlib/std.h +++ b/newlib/libc/stdlib/std.h @@ -22,12 +22,6 @@ #define ESIGN 0x02 #define DECP 0x04 -#ifdef _HAVE_STDC int __ten_mul(double *acc, int digit); double __adjust(struct _reent *ptr, double *acc, int dexp, int sign); double __exp10(unsigned x); -#else -int __ten_mul(); -double __adjust(); -double __exp10(); -#endif diff --git a/newlib/libc/syscalls/sysopen.c b/newlib/libc/syscalls/sysopen.c index 4d1a29953..bc8d9d59f 100644 --- a/newlib/libc/syscalls/sysopen.c +++ b/newlib/libc/syscalls/sysopen.c @@ -3,7 +3,6 @@ #include #include -#ifdef _HAVE_STDC /* The prototype in uses ..., so we must correspond. */ @@ -22,15 +21,3 @@ open (const char *file, return ret; } -#else /* ! _HAVE_STDC */ - -int -open (file, flags, mode) - const char *file; - int flags; - int mode; -{ - return _open_r (_REENT, file, flags, mode); -} - -#endif /* ! _HAVE_STDC */ diff --git a/newlib/libm/math/wf_acos.c b/newlib/libm/math/wf_acos.c index ff9f80b26..8154c795e 100644 --- a/newlib/libm/math/wf_acos.c +++ b/newlib/libm/math/wf_acos.c @@ -20,12 +20,7 @@ #include "fdlibm.h" #include -#ifdef _HAVE_STDC float acosf(float x) /* wrapper acosf */ -#else - float acosf(x) /* wrapper acosf */ - float x; -#endif { #ifdef _IEEE_LIBM return __ieee754_acosf(x); From 7bfa24c49563717426d1ee237f29d1ccfc4b51db Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 4 Dec 2017 03:25:26 -0600 Subject: [PATCH 220/649] ansification: fix makedoc for ANSI C Signed-off-by: Yaakov Selkowitz --- newlib/doc/makedoc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c index 3f4ff4c06..3faad96a2 100644 --- a/newlib/doc/makedoc.c +++ b/newlib/doc/makedoc.c @@ -1287,13 +1287,13 @@ DEFUN(compile, (string), /* Got a number, embedd the magic push number function */ add_to_definition(ptr, push_number); - add_to_definition(ptr, atol(word)); + add_to_definition(ptr, (stinst_type)atol(word)); break; default: add_to_definition(ptr, call); lookup = lookup_word(word); if (!lookup) ret++; - add_to_definition(ptr, lookup); + add_to_definition(ptr, (stinst_type)lookup); } string = nextword(string, &word); From 4cd1905add4404d995f1a7c77bc298957b01f91d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 4 Dec 2017 03:59:06 -0600 Subject: [PATCH 221/649] ansification: remove ansidecl.h from makedoc Signed-off-by: Yaakov Selkowitz --- newlib/doc/ansidecl.h | 95 ------------------------------ newlib/doc/makedoc.c | 132 ++++++++++++++++-------------------------- 2 files changed, 51 insertions(+), 176 deletions(-) delete mode 100644 newlib/doc/ansidecl.h diff --git a/newlib/doc/ansidecl.h b/newlib/doc/ansidecl.h deleted file mode 100644 index f67f93bea..000000000 --- a/newlib/doc/ansidecl.h +++ /dev/null @@ -1,95 +0,0 @@ -/* ANSI and traditional C compatability macros - Copyright 1991 Free Software Foundation, Inc. - This file is part of the GNU C Library. - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ - -/* ANSI and traditional C compatibility macros - - Some ANSI environments are "broken" in the sense that __STDC__ cannot be - relied upon to have it's intended meaning. Therefore we must use our own - concoction: _HAVE_STDC. Always use _HAVE_STDC instead of __STDC__ in newlib - sources! - - ANSI C is assumed if _HAVE_STDC is #defined. - - Macro ANSI C definition Traditional C definition - ----- ---- - ---------- ----------- - ---------- - PTR `void *' `char *' - LONG_DOUBLE `long double' `double' - CONST `const' `' - VOLATILE `volatile' `' - SIGNED `signed' `' - PTRCONST `void *const' `char *' - - DEFUN(name, arglist, args) - - Defines function NAME. - - ARGLIST lists the arguments, separated by commas and enclosed in - parentheses. ARGLIST becomes the argument list in traditional C. - - ARGS list the arguments with their types. It becomes a prototype in - ANSI C, and the type declarations in traditional C. Arguments should - be separated with `AND'. For functions with a variable number of - arguments, the last thing listed should be `DOTS'. - - DEFUN_VOID(name) - - Defines a function NAME, which takes no arguments. - - EXFUN(name, prototype) - - Is used in an external function declaration. - In ANSI C it is `NAMEPROTOTYPE' (so PROTOTYPE should be enclosed in - parentheses). In traditional C it is `NAME()'. - For a function that takes no arguments, PROTOTYPE should be `(NOARGS)'. - - For example: - extern int EXFUN(printf, (CONST char *format DOTS)); - int DEFUN(fprintf, (stream, format), - FILE *stream AND CONST char *format DOTS) { ... } - void DEFUN_VOID(abort) { ... } -*/ - -#ifndef _ANSIDECL_H - -#define _ANSIDECL_H 1 - - -/* Every source file includes this file, - so they will all get the switch for lint. */ -/* LINTLIBRARY */ - - - -#define PTR void * -#define PTRCONST void *CONST -#define LONG_DOUBLE long double - -#define AND , -#define NOARGS void -#define CONST const -#define VOLATILE volatile -#define SIGNED signed -#define DOTS , ... - -#define EXFUN(name, proto) name proto -#define DEFUN(name, arglist, args) name(args) -#define DEFUN_VOID(name) name(NOARGS) - - - -#endif /* ansidecl.h */ diff --git a/newlib/doc/makedoc.c b/newlib/doc/makedoc.c index 3faad96a2..36a14e535 100644 --- a/newlib/doc/makedoc.c +++ b/newlib/doc/makedoc.c @@ -35,7 +35,6 @@ There is no -#include "ansidecl.h" #include #include #include @@ -67,25 +66,23 @@ typedef struct buffer -static void DEFUN(init_string_with_size,(buffer, size), - string_type *buffer AND - unsigned int size ) +static void +init_string_with_size (string_type *buffer, unsigned int size) { buffer->write_idx = 0; buffer->size = size; buffer->ptr = malloc(size); } -static void DEFUN(init_string,(buffer), - string_type *buffer) +static void +init_string (string_type *buffer) { init_string_with_size(buffer, DEF_SIZE); } -static int DEFUN(find, (str, what), - string_type *str AND - char *what) +static int +find (string_type *str, char *what) { unsigned int i; char *p; @@ -101,30 +98,28 @@ static int DEFUN(find, (str, what), } -static void DEFUN(write_buffer,(buffer), - string_type *buffer) +static void +write_buffer (string_type *buffer) { fwrite(buffer->ptr, buffer->write_idx, 1, stdout); } -static void DEFUN(delete_string,(buffer), - string_type *buffer) +static void +delete_string (string_type *buffer) { free(buffer->ptr); } -static char *DEFUN(addr, (buffer, idx), - string_type *buffer AND - unsigned int idx) +static char * +addr (string_type *buffer, unsigned int idx) { return buffer->ptr + idx; } -static char DEFUN(at,(buffer, pos), - string_type *buffer AND - unsigned int pos) +static char +at (string_type *buffer, unsigned int pos) { if ( pos >= buffer->write_idx) { @@ -133,9 +128,8 @@ static char DEFUN(at,(buffer, pos), return buffer->ptr[pos]; } -static void DEFUN(catchar,(buffer, ch), - string_type *buffer AND - char ch) +static void +catchar (string_type *buffer, char ch) { if (buffer->write_idx == buffer->size) { @@ -147,9 +141,8 @@ static void DEFUN(catchar,(buffer, ch), } -static void DEFUN(overwrite_string,(dst, src), - string_type *dst AND - string_type *src) +static void +overwrite_string (string_type *dst, string_type *src) { free(dst->ptr); dst->size = src->size; @@ -157,9 +150,8 @@ static void DEFUN(overwrite_string,(dst, src), dst->ptr = src->ptr; } -static void DEFUN(catstr,(dst, src), - string_type *dst AND - string_type *src) +static void +catstr (string_type *dst, string_type *src) { unsigned int i; for (i = 0; i < src->write_idx; i++) @@ -169,9 +161,8 @@ static void DEFUN(catstr,(dst, src), } -static void DEFUN(cattext,(buffer, string), - string_type *buffer AND - char *string) +static void +cattext (string_type *buffer, char *string) { while (*string) @@ -181,10 +172,8 @@ static void DEFUN(cattext,(buffer, string), } } -static void DEFUN(catbuf,(buffer, buf, len), - string_type *buffer AND - char *buf AND - unsigned int len) +static void +catbuf (string_type *buffer, char *buf, unsigned int len) { while (len--) @@ -197,9 +186,7 @@ static void DEFUN(catbuf,(buffer, buf, len), static unsigned int -DEFUN(skip_white_and_stars,(src, idx), - string_type *src AND - unsigned int idx) +skip_white_and_stars (string_type *src, unsigned int idx) { while (isspace(at(src,idx)) || (at(src,idx) == '*' && at(src,idx +1) !='/')) @@ -216,7 +203,7 @@ string_type *tos; unsigned int idx = 0; /* Pos in input buffer */ string_type *ptr; /* and the buffer */ -typedef void (*stinst_type)(NOARGS); +typedef void (*stinst_type)(void); stinst_type *pc; stinst_type sstack[STACK]; stinst_type *ssp = &sstack[0]; @@ -238,10 +225,10 @@ struct dict_struct }; typedef struct dict_struct dict_type; -#define WORD(x) static void x(NOARGS) +#define WORD(x) static void x(void) -static void DEFUN(exec,(word), - dict_type *word) +static void +exec (dict_type *word) { pc = word->code; while (*pc) @@ -299,9 +286,7 @@ WORD(push_text) */ static void -DEFUN(remove_noncomments,(src,dst), - string_type *src AND - string_type *dst) +remove_noncomments (string_type *src, string_type *dst) { unsigned int idx = 0; @@ -354,7 +339,7 @@ DEFUN(remove_noncomments,(src,dst), */ static void -DEFUN_VOID(exfunstuff) +exfunstuff (void) { unsigned int openp; unsigned int fname; @@ -482,7 +467,7 @@ WORD(manglecomments) /* Mod tos so that only lines with leading dots remain */ static void -DEFUN_VOID(outputdots) +outputdots (void) { unsigned int idx = 0; string_type out; @@ -726,9 +711,7 @@ WORD(do_fancy_stuff) } /* A command is all upper case,and alone on a line */ static int -DEFUN( iscommand,(ptr, idx), - string_type *ptr AND - unsigned int idx) +iscommand (string_type *ptr, unsigned int idx) { unsigned int len = 0; @@ -757,10 +740,7 @@ DEFUN( iscommand,(ptr, idx), unsigned int -DEFUN(copy_past_newline,(ptr, idx, dst), - string_type *ptr AND - unsigned int idx AND - string_type *dst) +copy_past_newline (string_type *ptr, unsigned int idx, string_type *dst) { while (at(ptr, idx) && at(ptr, idx) != '\n') { @@ -1031,9 +1011,7 @@ WORD(warn) } char * -DEFUN(nextword,(string, word), - char *string AND - char **word) +nextword (char *string, char **word) { char *word_start; int idx; @@ -1109,8 +1087,7 @@ DEFUN(nextword,(string, word), } dict_type *root; dict_type * -DEFUN(lookup_word,(word), - char *word) +lookup_word (char *word) { dict_type *ptr = root; while (ptr) { @@ -1124,7 +1101,8 @@ DEFUN(lookup_word,(word), } -static int DEFUN_VOID(perform) +static int +perform (void) { tos = stack; int errors = 0; @@ -1164,8 +1142,7 @@ static int DEFUN_VOID(perform) } dict_type * -DEFUN(newentry,(word), - char *word) +newentry (char *word) { dict_type *new = (dict_type *)malloc(sizeof(dict_type)); new->word = word; @@ -1180,9 +1157,7 @@ DEFUN(newentry,(word), unsigned int -DEFUN(add_to_definition,(entry, word), - dict_type *entry AND - stinst_type word) +add_to_definition (dict_type *entry, stinst_type word) { if (entry->code_end == entry->code_length) { @@ -1203,9 +1178,7 @@ return entry->code_end++; void -DEFUN(add_intrinsic,(name, func), - char *name AND - void (*func)(NOARGS)) +add_intrinsic (char *name, void (*func)(void)) { dict_type *new = newentry(name); add_to_definition(new, func); @@ -1213,8 +1186,7 @@ DEFUN(add_intrinsic,(name, func), } void -DEFUN(add_var,(name), - char *name) +add_var (char *name) { dict_type *new = newentry(name); add_to_definition(new, push_number); @@ -1227,9 +1199,7 @@ DEFUN(add_var,(name), int -DEFUN(compile, (string), - char *string) - +compile (char *string) { int ret=0; /* add words to the dictionary */ @@ -1312,7 +1282,8 @@ return(ret); } -static void DEFUN_VOID(bang) +static void +bang (void) { *(uintptr_t *)((isp[0])) = isp[-1]; isp-=2; @@ -1335,9 +1306,8 @@ WORD(hello) -static void DEFUN(read_in, (str, file), - string_type *str AND - FILE *file) +static void +read_in (string_type *str, FILE *file) { char buff[10000]; unsigned int r; @@ -1355,16 +1325,16 @@ static void DEFUN(read_in, (str, file), #if 0 -static void DEFUN_VOID(usage) +static void +usage (void) { fprintf(stderr,"usage: -[i|v] -f macrofile file\n"); exit(33); } #endif -int DEFUN(main,(ac,av), -int ac AND -char *av[]) +int +main (int ac, char *av[]) { unsigned int i; int status = 0; From cba678ba02428b02e08a9a169d57e70f271d789f Mon Sep 17 00:00:00 2001 From: Kito Cheng Date: Fri, 17 Nov 2017 14:50:52 +0800 Subject: [PATCH 222/649] RISC-V: Fix alignment issue in sigjmp_buf --- newlib/libc/include/machine/setjmp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/machine/setjmp.h b/newlib/libc/include/machine/setjmp.h index b33f437d7..9212f840b 100644 --- a/newlib/libc/include/machine/setjmp.h +++ b/newlib/libc/include/machine/setjmp.h @@ -359,7 +359,9 @@ _BEGIN_STD_C #endif #ifdef __riscv -#define _JBTYPE long +/* _JBTYPE using long long to make sure the alignment is align to 8 byte, + otherwise in rv32imafd, store/restore FPR may mis-align. */ +#define _JBTYPE long long #ifdef __riscv_32e #define _JBLEN ((4*sizeof(long))/sizeof(long)) #else From f2c9e55faf6fa560c25d448afa7e2d1ad61468f2 Mon Sep 17 00:00:00 2001 From: Chih-Mao Chen Date: Thu, 16 Nov 2017 16:08:16 +0800 Subject: [PATCH 223/649] RISC-V: isatty: return 0 on error --- libgloss/riscv/sys_isatty.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libgloss/riscv/sys_isatty.c b/libgloss/riscv/sys_isatty.c index 0dc3db169..8857f4828 100644 --- a/libgloss/riscv/sys_isatty.c +++ b/libgloss/riscv/sys_isatty.c @@ -13,5 +13,5 @@ _isatty(int file) { struct stat s; int ret = _fstat (file, &s); - return ret == -1 ? -1 : !!(s.st_mode & S_IFCHR); + return ret == -1 ? 0 : !!(s.st_mode & S_IFCHR); } From fffd2770db9aa7aa0404d124d8ce4bf00f7f4c71 Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 18 Jan 2018 13:07:45 -0500 Subject: [PATCH 224/649] Bump release to 3.0.0 for yearly snapshot - major release required due to removal of K&R support --- newlib/MAINTAINERS | 2 +- newlib/NEWS | 13 + newlib/README | 21 +- newlib/acinclude.m4 | 4 +- newlib/configure | 26 +- newlib/doc/configure | 20 +- newlib/iconvdata/configure | 20 +- newlib/libc/configure | 20 +- newlib/libc/machine/a29k/configure | 20 +- newlib/libc/machine/aarch64/configure | 20 +- newlib/libc/machine/arc/configure | 20 +- newlib/libc/machine/arm/configure | 20 +- newlib/libc/machine/bfin/configure | 20 +- newlib/libc/machine/configure | 24 +- newlib/libc/machine/cr16/configure | 20 +- newlib/libc/machine/cris/configure | 20 +- newlib/libc/machine/crx/configure | 20 +- newlib/libc/machine/d10v/configure | 20 +- newlib/libc/machine/d30v/configure | 20 +- newlib/libc/machine/epiphany/configure | 20 +- newlib/libc/machine/fr30/configure | 20 +- newlib/libc/machine/frv/configure | 20 +- newlib/libc/machine/ft32/configure | 20 +- newlib/libc/machine/h8300/configure | 20 +- newlib/libc/machine/h8500/configure | 20 +- newlib/libc/machine/hppa/configure | 20 +- newlib/libc/machine/i386/configure | 20 +- newlib/libc/machine/i960/configure | 20 +- newlib/libc/machine/iq2000/configure | 20 +- newlib/libc/machine/lm32/configure | 20 +- newlib/libc/machine/m32c/configure | 20 +- newlib/libc/machine/m32r/configure | 20 +- newlib/libc/machine/m68hc11/configure | 20 +- newlib/libc/machine/m68k/configure | 20 +- newlib/libc/machine/m88k/configure | 20 +- newlib/libc/machine/mep/configure | 20 +- newlib/libc/machine/microblaze/configure | 20 +- newlib/libc/machine/mips/configure | 20 +- newlib/libc/machine/mn10200/configure | 20 +- newlib/libc/machine/mn10300/configure | 20 +- newlib/libc/machine/moxie/configure | 20 +- newlib/libc/machine/msp430/configure | 20 +- newlib/libc/machine/mt/configure | 20 +- newlib/libc/machine/nds32/configure | 20 +- newlib/libc/machine/necv70/configure | 20 +- newlib/libc/machine/nios2/configure | 20 +- newlib/libc/machine/or1k/configure | 20 +- newlib/libc/machine/powerpc/configure | 20 +- newlib/libc/machine/riscv/configure | 20 +- newlib/libc/machine/rl78/configure | 20 +- newlib/libc/machine/rx/configure | 20 +- newlib/libc/machine/sh/configure | 20 +- newlib/libc/machine/sparc/configure | 20 +- newlib/libc/machine/spu/configure | 20 +- newlib/libc/machine/tic4x/configure | 20 +- newlib/libc/machine/tic6x/configure | 20 +- newlib/libc/machine/tic80/configure | 20 +- newlib/libc/machine/v850/configure | 20 +- newlib/libc/machine/visium/configure | 20 +- newlib/libc/machine/w65/configure | 20 +- newlib/libc/machine/x86_64/configure | 20 +- newlib/libc/machine/xc16x/configure | 20 +- newlib/libc/machine/xscale/configure | 20 +- newlib/libc/machine/xstormy16/configure | 20 +- newlib/libc/machine/z8k/configure | 20 +- newlib/libc/sys/a29khif/configure | 20 +- newlib/libc/sys/arm/configure | 20 +- newlib/libc/sys/configure | 20 +- newlib/libc/sys/d10v/configure | 20 +- newlib/libc/sys/decstation/configure | 20 +- newlib/libc/sys/epiphany/configure | 20 +- newlib/libc/sys/h8300hms/configure | 20 +- newlib/libc/sys/h8500hms/configure | 20 +- newlib/libc/sys/linux/configure | 20 +- newlib/libc/sys/linux/linuxthreads/configure | 20 +- .../sys/linux/linuxthreads/machine/configure | 20 +- .../linux/linuxthreads/machine/i386/configure | 20 +- newlib/libc/sys/linux/machine/configure | 20 +- newlib/libc/sys/linux/machine/i386/configure | 20 +- newlib/libc/sys/m88kbug/configure | 20 +- newlib/libc/sys/mmixware/configure | 20 +- newlib/libc/sys/netware/configure | 20 +- newlib/libc/sys/or1k/configure | 20 +- newlib/libc/sys/phoenix/configure | 20 +- newlib/libc/sys/rdos/configure | 20 +- newlib/libc/sys/rtems/configure | 20 +- newlib/libc/sys/sh/configure | 20 +- newlib/libc/sys/sparc64/configure | 20 +- newlib/libc/sys/sun4/configure | 20 +- newlib/libc/sys/sysmec/configure | 20 +- newlib/libc/sys/sysnec810/configure | 20 +- newlib/libc/sys/sysnecv850/configure | 20 +- newlib/libc/sys/sysvi386/configure | 20 +- newlib/libc/sys/sysvnecv70/configure | 20 +- newlib/libc/sys/tic80/configure | 20 +- newlib/libc/sys/tirtos/configure | 20 +- newlib/libc/sys/w65/configure | 20 +- newlib/libc/sys/z8ksim/configure | 20 +- newlib/libm/configure | 20 +- newlib/libm/machine/aarch64/configure | 20 +- newlib/libm/machine/arm/configure | 20 +- newlib/libm/machine/configure | 24 +- newlib/libm/machine/i386/configure | 20 +- newlib/libm/machine/nds32/configure | 20 +- newlib/libm/machine/riscv/Makefile.in | 1 - newlib/libm/machine/riscv/aclocal.m4 | 4 +- newlib/libm/machine/riscv/configure | 230 ++++++++---------- newlib/libm/machine/spu/configure | 20 +- 108 files changed, 1153 insertions(+), 1156 deletions(-) diff --git a/newlib/MAINTAINERS b/newlib/MAINTAINERS index 1fbff5174..fe431ccc5 100644 --- a/newlib/MAINTAINERS +++ b/newlib/MAINTAINERS @@ -5,8 +5,8 @@ The official maintainers of newlib: -Jeff Johnston jjohnstn@redhat.com Corinna Vinschen corinna@vinschen.de +Jeff Johnston jjohnstn@redhat.com Various Domain Maintainers diff --git a/newlib/NEWS b/newlib/NEWS index e10042dd3..57b36ea89 100644 --- a/newlib/NEWS +++ b/newlib/NEWS @@ -1,3 +1,16 @@ +*** Major changes in newlib version 3.0.0: + +- K&R support removed in code and docs +- 64-bit time_t support +- riscv platform support added +- new expf, exp2f, logf, and powf implementations +- unification of lock object names +- locking routine retargetting at link time +- new long double complex math routines +- various ARM optimizations +- various POSIX/BSD additions +- further feature test macros overhaul + *** Major changes in newlib version 2.5.0: - memory.h added diff --git a/newlib/README b/newlib/README index 8c97e24aa..e793d57ce 100644 --- a/newlib/README +++ b/newlib/README @@ -1,9 +1,12 @@ - README for newlib-2.5.0 release + README for newlib-3.0.0 release (mostly cribbed from the README in the gdb-4.13 release) This is `newlib', a simple ANSI C library, math library, and collection of board support packages. +Prior to the 3.0.0 release, newlib supported both ANSI and K&R-style +compilers. As of 3.0.0, K&R is no longer supported. + The newlib and libgloss subdirectories are a collection of software from several sources, each with their own copyright and license. See the file COPYING.NEWLIB for details. The rest of the release tree is under either @@ -17,8 +20,8 @@ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. Unpacking and Installation -- quick overview ========================== -When you unpack the newlib-2.5.0.tar.gz file, you'll find a directory -called `newlib-2.5.0', which contains: +When you unpack the newlib-3.0.0.tar.gz file, you'll find a directory +called `newlib-3.0.0', which contains: COPYING config/ install-sh* mpw-configure COPYING.LIB config-ml.in libgloss/ mpw-install @@ -94,13 +97,13 @@ directory. If the path to `configure' would be the same as the argument to `--srcdir', you can leave out the `--srcdir' option; it will be assumed.) - For example, with version 2.5.0, you can build NEWLIB in a separate + For example, with version 3.0.0, you can build NEWLIB in a separate directory for a Sun 4 cross m68k-aout environment like this: - cd newlib-2.5.0 + cd newlib-3.0.0 mkdir ../newlib-m68k-aout cd ../newlib-m68k-aout - ../newlib-2.5.0/configure --host=sun4 --target=m68k-aout + ../newlib-3.0.0/configure --host=sun4 --target=m68k-aout make When `configure' builds a configuration using a remote source @@ -116,8 +119,8 @@ called `configure' (or one of its subdirectories). The `Makefile' that `configure' generates in each source directory also runs recursively. If you type `make' in a source directory such -as `newlib-2.5.0' (or in a separate configured directory configured with -`--srcdir=PATH/newlib-2.5.0'), you will build all the required libraries. +as `newlib-3.0.0' (or in a separate configured directory configured with +`--srcdir=PATH/newlib-3.0.0'), you will build all the required libraries. When you have multiple hosts or targets configured in separate directories, you can run `make' on them in parallel (for example, if @@ -601,7 +604,7 @@ Reporting Bugs The correct address for reporting bugs found in NEWLIB is "newlib@sourceware.org". Please email all bug reports to that -address. Please include the NEWLIB version number (e.g., newlib-2.5.0), +address. Please include the NEWLIB version number (e.g., newlib-3.0.0), and how you configured it (e.g., "sun4 host and m68k-aout target"). Since NEWLIB supports many different configurations, it is important that you be precise about this. diff --git a/newlib/acinclude.m4 b/newlib/acinclude.m4 index 2b0dd5822..8b18097f4 100644 --- a/newlib/acinclude.m4 +++ b/newlib/acinclude.m4 @@ -1,8 +1,8 @@ dnl This provides configure definitions used by all the newlib dnl configure.in files. -AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[2])) -AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[5])) +AC_DEFUN([DEF_NEWLIB_MAJOR_VERSION],m4_define([NEWLIB_MAJOR_VERSION],[3])) +AC_DEFUN([DEF_NEWLIB_MINOR_VERSION],m4_define([NEWLIB_MINOR_VERSION],[0])) AC_DEFUN([DEF_NEWLIB_PATCHLEVEL_VERSION],m4_define([NEWLIB_PATCHLEVEL_VERSION],[0])) AC_DEFUN([DEF_NEWLIB_VERSION],m4_define([NEWLIB_VERSION],[NEWLIB_MAJOR_VERSION.NEWLIB_MINOR_VERSION.NEWLIB_PATCHLEVEL_VERSION])) diff --git a/newlib/configure b/newlib/configure index 9613214eb..1d4a8a316 100755 --- a/newlib/configure +++ b/newlib/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1378,7 +1378,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1448,7 +1448,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1582,7 +1582,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1860,7 +1860,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -3208,7 +3208,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12406,13 +12406,13 @@ _ACEOF fi -$as_echo "#define _NEWLIB_VERSION \"2.5.0\"" >>confdefs.h +$as_echo "#define _NEWLIB_VERSION \"3.0.0\"" >>confdefs.h -$as_echo "#define __NEWLIB__ 2" >>confdefs.h +$as_echo "#define __NEWLIB__ 3" >>confdefs.h -$as_echo "#define __NEWLIB_MINOR__ 5" >>confdefs.h +$as_echo "#define __NEWLIB_MINOR__ 0" >>confdefs.h $as_echo "#define __NEWLIB_PATCHLEVEL__ 0" >>confdefs.h @@ -13345,7 +13345,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -13411,7 +13411,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/doc/configure b/newlib/doc/configure index d51547b04..d41bb996f 100755 --- a/newlib/doc/configure +++ b/newlib/doc/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1241,7 +1241,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1311,7 +1311,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1402,7 +1402,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1457,7 +1457,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2529,7 +2529,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4045,7 +4045,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4102,7 +4102,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/iconvdata/configure b/newlib/iconvdata/configure index e520005ad..cce729aca 100755 --- a/newlib/iconvdata/configure +++ b/newlib/iconvdata/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1322,7 +1322,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1392,7 +1392,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1503,7 +1503,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1781,7 +1781,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2853,7 +2853,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12378,7 +12378,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12435,7 +12435,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/configure b/newlib/libc/configure index 240c384d3..3f3baa970 100755 --- a/newlib/libc/configure +++ b/newlib/libc/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1370,7 +1370,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1440,7 +1440,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1555,7 +1555,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1833,7 +1833,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2968,7 +2968,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12777,7 +12777,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12834,7 +12834,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/a29k/configure b/newlib/libc/machine/a29k/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/a29k/configure +++ b/newlib/libc/machine/a29k/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/aarch64/configure b/newlib/libc/machine/aarch64/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/aarch64/configure +++ b/newlib/libc/machine/aarch64/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/arc/configure b/newlib/libc/machine/arc/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/arc/configure +++ b/newlib/libc/machine/arc/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/arm/configure b/newlib/libc/machine/arm/configure index b3691a884..004919685 100755 --- a/newlib/libc/machine/arm/configure +++ b/newlib/libc/machine/arm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1240,7 +1240,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1310,7 +1310,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1401,7 +1401,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1456,7 +1456,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2528,7 +2528,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4010,7 +4010,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4067,7 +4067,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/bfin/configure b/newlib/libc/machine/bfin/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/bfin/configure +++ b/newlib/libc/machine/bfin/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/configure b/newlib/libc/machine/configure index c72010b6d..17a78a8b8 100755 --- a/newlib/libc/machine/configure +++ b/newlib/libc/machine/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1380,7 +1380,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1450,7 +1450,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1561,7 +1561,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1839,7 +1839,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2911,7 +2911,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -11483,7 +11483,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11485 "configure" +#line 11486 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11589,7 +11589,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11591 "configure" +#line 11592 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12566,7 +12566,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12623,7 +12623,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/cr16/configure b/newlib/libc/machine/cr16/configure index d3b535d2d..f788ab144 100644 --- a/newlib/libc/machine/cr16/configure +++ b/newlib/libc/machine/cr16/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/cris/configure b/newlib/libc/machine/cris/configure index 74996222e..786e50b6a 100755 --- a/newlib/libc/machine/cris/configure +++ b/newlib/libc/machine/cris/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/crx/configure b/newlib/libc/machine/crx/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/crx/configure +++ b/newlib/libc/machine/crx/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/d10v/configure b/newlib/libc/machine/d10v/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/d10v/configure +++ b/newlib/libc/machine/d10v/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/d30v/configure b/newlib/libc/machine/d30v/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/d30v/configure +++ b/newlib/libc/machine/d30v/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/epiphany/configure b/newlib/libc/machine/epiphany/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/epiphany/configure +++ b/newlib/libc/machine/epiphany/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/fr30/configure b/newlib/libc/machine/fr30/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/fr30/configure +++ b/newlib/libc/machine/fr30/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/frv/configure b/newlib/libc/machine/frv/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/frv/configure +++ b/newlib/libc/machine/frv/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/ft32/configure b/newlib/libc/machine/ft32/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/ft32/configure +++ b/newlib/libc/machine/ft32/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/h8300/configure b/newlib/libc/machine/h8300/configure index 248592edb..d5199281f 100755 --- a/newlib/libc/machine/h8300/configure +++ b/newlib/libc/machine/h8300/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/h8500/configure b/newlib/libc/machine/h8500/configure index 6c55d0d5a..b1c558499 100755 --- a/newlib/libc/machine/h8500/configure +++ b/newlib/libc/machine/h8500/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/hppa/configure b/newlib/libc/machine/hppa/configure index 6f0bd2500..cbb42af80 100755 --- a/newlib/libc/machine/hppa/configure +++ b/newlib/libc/machine/hppa/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/i386/configure b/newlib/libc/machine/i386/configure index 4ee4707f6..7c21328a9 100755 --- a/newlib/libc/machine/i386/configure +++ b/newlib/libc/machine/i386/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1324,7 +1324,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1394,7 +1394,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1505,7 +1505,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1783,7 +1783,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2855,7 +2855,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12393,7 +12393,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12450,7 +12450,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/i960/configure b/newlib/libc/machine/i960/configure index bb878bacf..3db5af7e7 100755 --- a/newlib/libc/machine/i960/configure +++ b/newlib/libc/machine/i960/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/iq2000/configure b/newlib/libc/machine/iq2000/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/iq2000/configure +++ b/newlib/libc/machine/iq2000/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/lm32/configure b/newlib/libc/machine/lm32/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/lm32/configure +++ b/newlib/libc/machine/lm32/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/m32c/configure b/newlib/libc/machine/m32c/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/m32c/configure +++ b/newlib/libc/machine/m32c/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/m32r/configure b/newlib/libc/machine/m32r/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/m32r/configure +++ b/newlib/libc/machine/m32r/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/m68hc11/configure b/newlib/libc/machine/m68hc11/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/m68hc11/configure +++ b/newlib/libc/machine/m68hc11/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/m68k/configure b/newlib/libc/machine/m68k/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/m68k/configure +++ b/newlib/libc/machine/m68k/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/m88k/configure b/newlib/libc/machine/m88k/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/m88k/configure +++ b/newlib/libc/machine/m88k/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/mep/configure b/newlib/libc/machine/mep/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/mep/configure +++ b/newlib/libc/machine/mep/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/microblaze/configure b/newlib/libc/machine/microblaze/configure index f80e155f3..6e2a1181e 100644 --- a/newlib/libc/machine/microblaze/configure +++ b/newlib/libc/machine/microblaze/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/mips/configure b/newlib/libc/machine/mips/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/mips/configure +++ b/newlib/libc/machine/mips/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/mn10200/configure b/newlib/libc/machine/mn10200/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/mn10200/configure +++ b/newlib/libc/machine/mn10200/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/mn10300/configure b/newlib/libc/machine/mn10300/configure index 6f0bd2500..cbb42af80 100755 --- a/newlib/libc/machine/mn10300/configure +++ b/newlib/libc/machine/mn10300/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/moxie/configure b/newlib/libc/machine/moxie/configure index d3b535d2d..f788ab144 100644 --- a/newlib/libc/machine/moxie/configure +++ b/newlib/libc/machine/moxie/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/msp430/configure b/newlib/libc/machine/msp430/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/msp430/configure +++ b/newlib/libc/machine/msp430/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/mt/configure b/newlib/libc/machine/mt/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/mt/configure +++ b/newlib/libc/machine/mt/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/nds32/configure b/newlib/libc/machine/nds32/configure index b990b39db..ad6741b09 100755 --- a/newlib/libc/machine/nds32/configure +++ b/newlib/libc/machine/nds32/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1253,7 +1253,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1323,7 +1323,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1421,7 +1421,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1476,7 +1476,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2548,7 +2548,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -5069,7 +5069,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5126,7 +5126,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/necv70/configure b/newlib/libc/machine/necv70/configure index 4c1042031..1978c3547 100755 --- a/newlib/libc/machine/necv70/configure +++ b/newlib/libc/machine/necv70/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/nios2/configure b/newlib/libc/machine/nios2/configure index 9fdf98864..2e33830dc 100755 --- a/newlib/libc/machine/nios2/configure +++ b/newlib/libc/machine/nios2/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/or1k/configure b/newlib/libc/machine/or1k/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/or1k/configure +++ b/newlib/libc/machine/or1k/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/powerpc/configure b/newlib/libc/machine/powerpc/configure index feafc8bec..2b38b225a 100755 --- a/newlib/libc/machine/powerpc/configure +++ b/newlib/libc/machine/powerpc/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1240,7 +1240,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1310,7 +1310,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1401,7 +1401,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1456,7 +1456,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2528,7 +2528,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4019,7 +4019,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4076,7 +4076,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/riscv/configure b/newlib/libc/machine/riscv/configure index 2cf2d3a18..cfbc9e33d 100755 --- a/newlib/libc/machine/riscv/configure +++ b/newlib/libc/machine/riscv/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/rl78/configure b/newlib/libc/machine/rl78/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/rl78/configure +++ b/newlib/libc/machine/rl78/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/rx/configure b/newlib/libc/machine/rx/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/rx/configure +++ b/newlib/libc/machine/rx/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/sh/configure b/newlib/libc/machine/sh/configure index 32a819735..ad94a1282 100755 --- a/newlib/libc/machine/sh/configure +++ b/newlib/libc/machine/sh/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -557,8 +557,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1258,7 +1258,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1328,7 +1328,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1427,7 +1427,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1519,7 +1519,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2593,7 +2593,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -5376,7 +5376,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5433,7 +5433,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/sparc/configure b/newlib/libc/machine/sparc/configure index 20417c236..754a39bf5 100755 --- a/newlib/libc/machine/sparc/configure +++ b/newlib/libc/machine/sparc/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/spu/configure b/newlib/libc/machine/spu/configure index 0c094c57b..01638b6ea 100644 --- a/newlib/libc/machine/spu/configure +++ b/newlib/libc/machine/spu/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1241,7 +1241,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1311,7 +1311,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1402,7 +1402,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1457,7 +1457,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2529,7 +2529,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4041,7 +4041,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4098,7 +4098,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/tic4x/configure b/newlib/libc/machine/tic4x/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/tic4x/configure +++ b/newlib/libc/machine/tic4x/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/tic6x/configure b/newlib/libc/machine/tic6x/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/tic6x/configure +++ b/newlib/libc/machine/tic6x/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/tic80/configure b/newlib/libc/machine/tic80/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/tic80/configure +++ b/newlib/libc/machine/tic80/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/v850/configure b/newlib/libc/machine/v850/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/v850/configure +++ b/newlib/libc/machine/v850/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/visium/configure b/newlib/libc/machine/visium/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/visium/configure +++ b/newlib/libc/machine/visium/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/w65/configure b/newlib/libc/machine/w65/configure index 6c55d0d5a..b1c558499 100755 --- a/newlib/libc/machine/w65/configure +++ b/newlib/libc/machine/w65/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/x86_64/configure b/newlib/libc/machine/x86_64/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/x86_64/configure +++ b/newlib/libc/machine/x86_64/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/xc16x/configure b/newlib/libc/machine/xc16x/configure index 4cd1db78a..ea445657f 100644 --- a/newlib/libc/machine/xc16x/configure +++ b/newlib/libc/machine/xc16x/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/xscale/configure b/newlib/libc/machine/xscale/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libc/machine/xscale/configure +++ b/newlib/libc/machine/xscale/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/xstormy16/configure b/newlib/libc/machine/xstormy16/configure index 4cd1db78a..ea445657f 100755 --- a/newlib/libc/machine/xstormy16/configure +++ b/newlib/libc/machine/xstormy16/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/machine/z8k/configure b/newlib/libc/machine/z8k/configure index 70a9593dd..fa69bd712 100755 --- a/newlib/libc/machine/z8k/configure +++ b/newlib/libc/machine/z8k/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/a29khif/configure b/newlib/libc/sys/a29khif/configure index eebae20f4..16e6e22d5 100755 --- a/newlib/libc/sys/a29khif/configure +++ b/newlib/libc/sys/a29khif/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/arm/configure b/newlib/libc/sys/arm/configure index 023065454..e53ccc550 100755 --- a/newlib/libc/sys/arm/configure +++ b/newlib/libc/sys/arm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/configure b/newlib/libc/sys/configure index de5cf01ee..0362c1e29 100755 --- a/newlib/libc/sys/configure +++ b/newlib/libc/sys/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1353,7 +1353,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1423,7 +1423,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1534,7 +1534,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1812,7 +1812,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2884,7 +2884,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12489,7 +12489,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12546,7 +12546,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/d10v/configure b/newlib/libc/sys/d10v/configure index f5079be5f..8090d5299 100755 --- a/newlib/libc/sys/d10v/configure +++ b/newlib/libc/sys/d10v/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/decstation/configure b/newlib/libc/sys/decstation/configure index bdfa6d3d7..a4021d8fb 100755 --- a/newlib/libc/sys/decstation/configure +++ b/newlib/libc/sys/decstation/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/epiphany/configure b/newlib/libc/sys/epiphany/configure index 376094df7..1be275a9f 100755 --- a/newlib/libc/sys/epiphany/configure +++ b/newlib/libc/sys/epiphany/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/h8300hms/configure b/newlib/libc/sys/h8300hms/configure index ae9bbae2b..b6db5cbb3 100755 --- a/newlib/libc/sys/h8300hms/configure +++ b/newlib/libc/sys/h8300hms/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/h8500hms/configure b/newlib/libc/sys/h8500hms/configure index a9889bf5b..96a2ca544 100755 --- a/newlib/libc/sys/h8500hms/configure +++ b/newlib/libc/sys/h8500hms/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/linux/configure b/newlib/libc/sys/linux/configure index 6552079a8..0a3f824cb 100755 --- a/newlib/libc/sys/linux/configure +++ b/newlib/libc/sys/linux/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1328,7 +1328,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1398,7 +1398,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1509,7 +1509,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1787,7 +1787,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2859,7 +2859,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12459,7 +12459,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12516,7 +12516,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/linux/linuxthreads/configure b/newlib/libc/sys/linux/linuxthreads/configure index ba9e9ce7b..9b4b77339 100755 --- a/newlib/libc/sys/linux/linuxthreads/configure +++ b/newlib/libc/sys/linux/linuxthreads/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1326,7 +1326,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1396,7 +1396,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1785,7 +1785,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2857,7 +2857,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12436,7 +12436,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12493,7 +12493,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/linux/linuxthreads/machine/configure b/newlib/libc/sys/linux/linuxthreads/machine/configure index 123d855e8..3eb7c7109 100755 --- a/newlib/libc/sys/linux/linuxthreads/machine/configure +++ b/newlib/libc/sys/linux/linuxthreads/machine/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1326,7 +1326,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1396,7 +1396,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1507,7 +1507,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1785,7 +1785,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2857,7 +2857,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12404,7 +12404,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12461,7 +12461,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/linux/linuxthreads/machine/i386/configure b/newlib/libc/sys/linux/linuxthreads/machine/i386/configure index 02705eb9f..ffb6f5d16 100755 --- a/newlib/libc/sys/linux/linuxthreads/machine/i386/configure +++ b/newlib/libc/sys/linux/linuxthreads/machine/i386/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1322,7 +1322,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1392,7 +1392,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1503,7 +1503,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1781,7 +1781,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2853,7 +2853,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12420,7 +12420,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12477,7 +12477,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/linux/machine/configure b/newlib/libc/sys/linux/machine/configure index 020801a9e..cfd978007 100755 --- a/newlib/libc/sys/linux/machine/configure +++ b/newlib/libc/sys/linux/machine/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1327,7 +1327,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1397,7 +1397,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1508,7 +1508,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1786,7 +1786,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2858,7 +2858,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12411,7 +12411,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12468,7 +12468,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/linux/machine/i386/configure b/newlib/libc/sys/linux/machine/i386/configure index 64370ac60..3216a54f3 100755 --- a/newlib/libc/sys/linux/machine/i386/configure +++ b/newlib/libc/sys/linux/machine/i386/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1322,7 +1322,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1392,7 +1392,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1503,7 +1503,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1781,7 +1781,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2853,7 +2853,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12420,7 +12420,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12477,7 +12477,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/m88kbug/configure b/newlib/libc/sys/m88kbug/configure index a64814f4d..506eecc5e 100755 --- a/newlib/libc/sys/m88kbug/configure +++ b/newlib/libc/sys/m88kbug/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/mmixware/configure b/newlib/libc/sys/mmixware/configure index d5cfb0a10..d58e2714c 100755 --- a/newlib/libc/sys/mmixware/configure +++ b/newlib/libc/sys/mmixware/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/netware/configure b/newlib/libc/sys/netware/configure index 24be0fc9e..aca3c4bb9 100755 --- a/newlib/libc/sys/netware/configure +++ b/newlib/libc/sys/netware/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/or1k/configure b/newlib/libc/sys/or1k/configure index 1a7054d47..9239db769 100755 --- a/newlib/libc/sys/or1k/configure +++ b/newlib/libc/sys/or1k/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/phoenix/configure b/newlib/libc/sys/phoenix/configure index 555d7580c..e1adcdabc 100644 --- a/newlib/libc/sys/phoenix/configure +++ b/newlib/libc/sys/phoenix/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1242,7 +1242,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1312,7 +1312,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1403,7 +1403,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1458,7 +1458,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2530,7 +2530,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4018,7 +4018,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4075,7 +4075,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/rdos/configure b/newlib/libc/sys/rdos/configure index 72c73e446..b2db6e9c2 100755 --- a/newlib/libc/sys/rdos/configure +++ b/newlib/libc/sys/rdos/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/rtems/configure b/newlib/libc/sys/rtems/configure index 7f4a7b951..d12d513eb 100755 --- a/newlib/libc/sys/rtems/configure +++ b/newlib/libc/sys/rtems/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sh/configure b/newlib/libc/sys/sh/configure index f5079be5f..8090d5299 100755 --- a/newlib/libc/sys/sh/configure +++ b/newlib/libc/sys/sh/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sparc64/configure b/newlib/libc/sys/sparc64/configure index e89ca982a..1207e2199 100755 --- a/newlib/libc/sys/sparc64/configure +++ b/newlib/libc/sys/sparc64/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sun4/configure b/newlib/libc/sys/sun4/configure index 9cccd1bfa..8e2d66b77 100755 --- a/newlib/libc/sys/sun4/configure +++ b/newlib/libc/sys/sun4/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sysmec/configure b/newlib/libc/sys/sysmec/configure index ae9bbae2b..b6db5cbb3 100755 --- a/newlib/libc/sys/sysmec/configure +++ b/newlib/libc/sys/sysmec/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sysnec810/configure b/newlib/libc/sys/sysnec810/configure index 5c808c8e3..ad258a946 100755 --- a/newlib/libc/sys/sysnec810/configure +++ b/newlib/libc/sys/sysnec810/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sysnecv850/configure b/newlib/libc/sys/sysnecv850/configure index ae9bbae2b..b6db5cbb3 100755 --- a/newlib/libc/sys/sysnecv850/configure +++ b/newlib/libc/sys/sysnecv850/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sysvi386/configure b/newlib/libc/sys/sysvi386/configure index 37559f825..7f19a9d1c 100755 --- a/newlib/libc/sys/sysvi386/configure +++ b/newlib/libc/sys/sysvi386/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/sysvnecv70/configure b/newlib/libc/sys/sysvnecv70/configure index cecd1c5ae..17a1f544c 100755 --- a/newlib/libc/sys/sysvnecv70/configure +++ b/newlib/libc/sys/sysvnecv70/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/tic80/configure b/newlib/libc/sys/tic80/configure index d5cfb0a10..d58e2714c 100755 --- a/newlib/libc/sys/tic80/configure +++ b/newlib/libc/sys/tic80/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/tirtos/configure b/newlib/libc/sys/tirtos/configure index 0004eb2c7..158cb6a08 100755 --- a/newlib/libc/sys/tirtos/configure +++ b/newlib/libc/sys/tirtos/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/w65/configure b/newlib/libc/sys/w65/configure index 2b25bc2fe..d0148494b 100755 --- a/newlib/libc/sys/w65/configure +++ b/newlib/libc/sys/w65/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libc/sys/z8ksim/configure b/newlib/libc/sys/z8ksim/configure index b32798ce6..2e1991cc5 100755 --- a/newlib/libc/sys/z8ksim/configure +++ b/newlib/libc/sys/z8ksim/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/configure b/newlib/libm/configure index 083708a70..961f0cb6d 100755 --- a/newlib/libm/configure +++ b/newlib/libm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1330,7 +1330,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1400,7 +1400,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1512,7 +1512,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1790,7 +1790,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2917,7 +2917,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12466,7 +12466,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12523,7 +12523,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/machine/aarch64/configure b/newlib/libm/machine/aarch64/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libm/machine/aarch64/configure +++ b/newlib/libm/machine/aarch64/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/machine/arm/configure b/newlib/libm/machine/arm/configure index d3b535d2d..f788ab144 100755 --- a/newlib/libm/machine/arm/configure +++ b/newlib/libm/machine/arm/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/machine/configure b/newlib/libm/machine/configure index 86ceca95a..c15ef32ee 100755 --- a/newlib/libm/machine/configure +++ b/newlib/libm/machine/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1332,7 +1332,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1402,7 +1402,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1513,7 +1513,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1791,7 +1791,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2863,7 +2863,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -11435,7 +11435,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11437 "configure" +#line 11438 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -11541,7 +11541,7 @@ else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF -#line 11543 "configure" +#line 11544 "configure" #include "confdefs.h" #if HAVE_DLFCN_H @@ -12429,7 +12429,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12486,7 +12486,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/machine/i386/configure b/newlib/libm/machine/i386/configure index a47184ef4..f6bf9892a 100755 --- a/newlib/libm/machine/i386/configure +++ b/newlib/libm/machine/i386/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -567,8 +567,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1322,7 +1322,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1392,7 +1392,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1503,7 +1503,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1781,7 +1781,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2853,7 +2853,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -12378,7 +12378,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -12435,7 +12435,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/machine/nds32/configure b/newlib/libm/machine/nds32/configure index 11dc416d2..65d850b42 100644 --- a/newlib/libm/machine/nds32/configure +++ b/newlib/libm/machine/nds32/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1255,7 +1255,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1325,7 +1325,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1423,7 +1423,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1478,7 +1478,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2550,7 +2550,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -5104,7 +5104,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -5161,7 +5161,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" diff --git a/newlib/libm/machine/riscv/Makefile.in b/newlib/libm/machine/riscv/Makefile.in index 68cb6780a..a5023a51e 100644 --- a/newlib/libm/machine/riscv/Makefile.in +++ b/newlib/libm/machine/riscv/Makefile.in @@ -189,7 +189,6 @@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ -runstatedir = @runstatedir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ diff --git a/newlib/libm/machine/riscv/aclocal.m4 b/newlib/libm/machine/riscv/aclocal.m4 index 62fe272e2..18dab02aa 100644 --- a/newlib/libm/machine/riscv/aclocal.m4 +++ b/newlib/libm/machine/riscv/aclocal.m4 @@ -14,8 +14,8 @@ m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl -m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, -[m4_warning([this file was generated for autoconf 2.69. +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically `autoreconf'.])]) diff --git a/newlib/libm/machine/riscv/configure b/newlib/libm/machine/riscv/configure index b43a01580..f788ab144 100755 --- a/newlib/libm/machine/riscv/configure +++ b/newlib/libm/machine/riscv/configure @@ -1,9 +1,11 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # -# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. # # # This configure script is free software; the Free Software Foundation @@ -132,31 +134,6 @@ export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH -# Use a proper internal environment variable to ensure we don't fall - # into an infinite loop, continuously re-executing ourselves. - if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then - _as_can_reexec=no; export _as_can_reexec; - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -as_fn_exit 255 - fi - # We don't want this to propagate to other subprocesses. - { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh @@ -190,8 +167,7 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi -test x\$exitcode = x0 || exit 1 -test -x / || exit 1" +test x\$exitcode = x0 || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && @@ -235,25 +211,21 @@ IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : - export CONFIG_SHELL - # We cannot yet assume a decent shell, so we have to provide a -# neutralization value for shells without unset; and this also -# works around shells that cannot unset nonexistent variables. -# Preserve -v and -x to the replacement shell. -BASH_ENV=/dev/null -ENV=/dev/null -(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV -case $- in # (((( - *v*x* | *x*v* ) as_opts=-vx ;; - *v* ) as_opts=-v ;; - *x* ) as_opts=-x ;; - * ) as_opts= ;; -esac -exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} -# Admittedly, this is quite paranoid, since all the known shells bail -# out after a failed `exec'. -$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 -exit 255 + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} fi if test x$as_have_required = xno; then : @@ -355,14 +327,6 @@ $as_echo X"$as_dir" | } # as_fn_mkdir_p - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take @@ -484,10 +448,6 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } - # If we had to re-execute with $CONFIG_SHELL, we're ensured to have - # already done that, so ensure we don't try to do so again and fall - # in an infinite loop. This has already happened in practice. - _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). @@ -522,16 +482,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -543,8 +503,28 @@ else as_mkdir_p=false fi -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -576,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -679,7 +659,6 @@ infodir docdir oldincludedir includedir -runstatedir localstatedir sharedstatedir sysconfdir @@ -756,7 +735,6 @@ datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' -runstatedir='${localstatedir}/run' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' @@ -1009,15 +987,6 @@ do | -silent | --silent | --silen | --sile | --sil) silent=yes ;; - -runstatedir | --runstatedir | --runstatedi | --runstated \ - | --runstate | --runstat | --runsta | --runst | --runs \ - | --run | --ru | --r) - ac_prev=runstatedir ;; - -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ - | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ - | --run=* | --ru=* | --r=*) - runstatedir=$ac_optarg ;; - -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ @@ -1155,7 +1124,7 @@ fi for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ - libdir localedir mandir runstatedir + libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. @@ -1183,6 +1152,8 @@ target=$target_alias if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi @@ -1268,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1308,7 +1279,6 @@ Fine tuning of the installation directories: --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] - --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] @@ -1339,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1430,10 +1400,10 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 -generated by GNU Autoconf 2.69 +newlib configure 3.0.0 +generated by GNU Autoconf 2.68 -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF @@ -1485,8 +1455,8 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was -generated by GNU Autoconf 2.69. Invocation command line was +It was created by newlib $as_me 3.0.0, which was +generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -1976,7 +1946,7 @@ case $as_dir/ in #(( # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. @@ -2145,7 +2115,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2185,7 +2155,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2236,7 +2206,7 @@ do test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do - as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ @@ -2289,7 +2259,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2557,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -2617,7 +2587,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -2785,7 +2755,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue @@ -2963,7 +2933,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AS="${ac_tool_prefix}as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3003,7 +2973,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AS="as" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3055,7 +3025,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AR="${ac_tool_prefix}ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3095,7 +3065,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_AR="ar" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3147,7 +3117,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3187,7 +3157,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3239,7 +3209,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_READELF="${ac_tool_prefix}readelf" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3279,7 +3249,7 @@ do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do - if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_READELF="readelf" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 @@ -3926,16 +3896,16 @@ if (echo >conf$$.file) 2>/dev/null; then # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. - # In both cases, we have to default to `cp -pR'. + # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || - as_ln_s='cp -pR' + as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi else - as_ln_s='cp -pR' + as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null @@ -3995,16 +3965,28 @@ else as_mkdir_p=false fi - -# as_fn_executable_p FILE -# ----------------------- -# Test if FILE is an executable regular file. -as_fn_executable_p () -{ - test -f "$1" && test -x "$1" -} # as_fn_executable_p -as_test_x='test -x' -as_executable_p=as_fn_executable_p +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" @@ -4025,8 +4007,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was -generated by GNU Autoconf 2.69. Invocation command line was +This file was extended by newlib $as_me 3.0.0, which was +generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS @@ -4082,11 +4064,11 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 -configured by $0, generated by GNU Autoconf 2.69, +newlib config.status 3.0.0 +configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" -Copyright (C) 2012 Free Software Foundation, Inc. +Copyright (C) 2010 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." @@ -4166,7 +4148,7 @@ fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then - set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' diff --git a/newlib/libm/machine/spu/configure b/newlib/libm/machine/spu/configure index d3b535d2d..f788ab144 100644 --- a/newlib/libm/machine/spu/configure +++ b/newlib/libm/machine/spu/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.68 for newlib 2.5.0. +# Generated by GNU Autoconf 2.68 for newlib 3.0.0. # # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -556,8 +556,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='newlib' PACKAGE_TARNAME='newlib' -PACKAGE_VERSION='2.5.0' -PACKAGE_STRING='newlib 2.5.0' +PACKAGE_VERSION='3.0.0' +PACKAGE_STRING='newlib 3.0.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1239,7 +1239,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures newlib 2.5.0 to adapt to many kinds of systems. +\`configure' configures newlib 3.0.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1309,7 +1309,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of newlib 2.5.0:";; + short | recursive ) echo "Configuration of newlib 3.0.0:";; esac cat <<\_ACEOF @@ -1400,7 +1400,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -newlib configure 2.5.0 +newlib configure 3.0.0 generated by GNU Autoconf 2.68 Copyright (C) 2010 Free Software Foundation, Inc. @@ -1455,7 +1455,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by newlib $as_me 2.5.0, which was +It was created by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was $ $0 $@ @@ -2527,7 +2527,7 @@ fi # Define the identity of the package. PACKAGE='newlib' - VERSION='2.5.0' + VERSION='3.0.0' # Some tools Automake needs. @@ -4007,7 +4007,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by newlib $as_me 2.5.0, which was +This file was extended by newlib $as_me 3.0.0, which was generated by GNU Autoconf 2.68. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -4064,7 +4064,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -newlib config.status 2.5.0 +newlib config.status 3.0.0 configured by $0, generated by GNU Autoconf 2.68, with options \\"\$ac_cs_config\\" From fa47495755489a0807104a2a7c7347f57dc5d1f1 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 19 Jan 2018 12:06:00 -0600 Subject: [PATCH 225/649] cygwin: remove inclusion of from POSIX does not mention the inclusion of in or , nor is there anything in the latter two that would require the former. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/sys/socket.h | 1 - 1 file changed, 1 deletion(-) diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h index 9e897a9ff..e6b92eef8 100644 --- a/winsup/cygwin/include/sys/socket.h +++ b/winsup/cygwin/include/sys/socket.h @@ -11,7 +11,6 @@ details. */ #include #include -#include #ifdef __cplusplus extern "C" From 061710370c6e02b87f5e366310d41f99ae73e5df Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Mon, 15 Jan 2018 21:19:59 -0600 Subject: [PATCH 226/649] cygwin: make completely visible from While POSIX mandates that certain socket types shall be defined by the inclusing of , it also says that this header may also make visible all symbols. Glibc does this, and without out it, some packages end up requiring an additional #include . Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/cygwin/in.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/include/cygwin/in.h b/winsup/cygwin/include/cygwin/in.h index 9d7331d30..42b776653 100644 --- a/winsup/cygwin/include/cygwin/in.h +++ b/winsup/cygwin/include/cygwin/in.h @@ -18,7 +18,7 @@ #ifndef _CYGWIN_IN_H #define _CYGWIN_IN_H -#include +#include #ifndef _IN_ADDR_T_DECLARED typedef __uint32_t in_addr_t; From b7e0f286a2ecab3b687ec9b3f95f5a88b9f85310 Mon Sep 17 00:00:00 2001 From: Orlando Arias Date: Fri, 19 Jan 2018 11:45:01 -0500 Subject: [PATCH 227/649] Fix syntax error in exit.c This patch fixes a syntax error in exit.c that was introduced during the ANSI-fication of newlib. The patch fixes a compile-time issue that arises when newlib is configured with the --enable-lite-exit feature. --- newlib/libc/stdlib/exit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/newlib/libc/stdlib/exit.c b/newlib/libc/stdlib/exit.c index 95108ade6..3e618914e 100644 --- a/newlib/libc/stdlib/exit.c +++ b/newlib/libc/stdlib/exit.c @@ -54,7 +54,7 @@ exit (int code) { #ifdef _LITE_EXIT /* Refer to comments in __atexit.c for more details of lite exit. */ - void __call_exitprocs (int, void *)) __attribute__((weak); + void __call_exitprocs (int, void *) __attribute__((weak)); if (__call_exitprocs) #endif __call_exitprocs (code, NULL); From bd62f539defbbd16f73e99ff20d2daa6d6c18d9e Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 18 Jan 2018 23:53:18 -0600 Subject: [PATCH 228/649] Guard langinfo.h nl_item from multiple typedefs This is a prerequisite of adding nl_types.h support to Cygwin. Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/langinfo.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newlib/libc/include/langinfo.h b/newlib/libc/include/langinfo.h index 59381d6b6..458b92565 100644 --- a/newlib/libc/include/langinfo.h +++ b/newlib/libc/include/langinfo.h @@ -36,7 +36,10 @@ #include #endif +#ifndef _NL_ITEM_DECLARED typedef int nl_item; +#define _NL_ITEM_DECLARED +#endif enum __nl_item { From cadc12f69584626fbc7fd5b2f92345dba34f58d9 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 18 Jan 2018 23:26:41 -0600 Subject: [PATCH 229/649] cygwin: add catopen, catgets, catclose The implementation is taken from FreeBSD with #ifdef __CYGWIN__ modifications. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/Makefile.in | 1 + winsup/cygwin/common.din | 3 + winsup/cygwin/include/cygwin/version.h | 3 +- winsup/cygwin/include/nl_types.h | 100 ++++++ winsup/cygwin/libc/msgcat.c | 478 +++++++++++++++++++++++++ 5 files changed, 584 insertions(+), 1 deletion(-) create mode 100644 winsup/cygwin/include/nl_types.h create mode 100644 winsup/cygwin/libc/msgcat.c diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index c1de26c1b..b75774ace 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -333,6 +333,7 @@ DLL_OFILES:= \ mktemp.o \ mmap.o \ msg.o \ + msgcat.o \ mount.o \ net.o \ netdb.o \ diff --git a/winsup/cygwin/common.din b/winsup/cygwin/common.din index 91f2915bf..6e8bf9185 100644 --- a/winsup/cygwin/common.din +++ b/winsup/cygwin/common.din @@ -274,6 +274,9 @@ catanh NOSIGFE catanhf NOSIGFE catanhl NOSIGFE catanl NOSIGFE +catclose SIGFE +catgets SIGFE +catopen SIGFE cbrt NOSIGFE cbrtf NOSIGFE cbrtl NOSIGFE diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index aa7c14ec3..fa9137d05 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -493,12 +493,13 @@ details. */ 322: [w]scanf %m modifier. 323: scanf %l[ conversion. 324: Export sigtimedwait. + 325: Export catclose, catgets, catopen. Note that we forgot to bump the api for ualarm, strtoll, strtoull, sigaltstack, sethostname. */ #define CYGWIN_VERSION_API_MAJOR 0 -#define CYGWIN_VERSION_API_MINOR 324 +#define CYGWIN_VERSION_API_MINOR 325 /* There is also a compatibity version number associated with the shared memory regions. It is incremented when incompatible changes are made to the shared diff --git a/winsup/cygwin/include/nl_types.h b/winsup/cygwin/include/nl_types.h new file mode 100644 index 000000000..b9c06f6c3 --- /dev/null +++ b/winsup/cygwin/include/nl_types.h @@ -0,0 +1,100 @@ +/* $NetBSD: nl_types.h,v 1.9 2000/10/03 19:53:32 sommerfeld Exp $ */ + +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD + * + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by J.T. Conklin. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _NL_TYPES_H_ +#define _NL_TYPES_H_ + +#include +#include + +#ifdef _NLS_PRIVATE +/* + * MESSAGE CATALOG FILE FORMAT. + * + * The NetBSD/FreeBSD message catalog format is similar to the format used by + * Svr4 systems. The differences are: + * * fixed byte order (big endian) + * * fixed data field sizes + * + * A message catalog contains four data types: a catalog header, one + * or more set headers, one or more message headers, and one or more + * text strings. + */ + +#define _NLS_MAGIC 0xff88ff89 + +struct _nls_cat_hdr { + int32_t __magic; + int32_t __nsets; + int32_t __mem; + int32_t __msg_hdr_offset; + int32_t __msg_txt_offset; +} ; + +struct _nls_set_hdr { + int32_t __setno; /* set number: 0 < x <= NL_SETMAX */ + int32_t __nmsgs; /* number of messages in the set */ + int32_t __index; /* index of first msg_hdr in msg_hdr table */ +} ; + +struct _nls_msg_hdr { + int32_t __msgno; /* msg number: 0 < x <= NL_MSGMAX */ + int32_t __msglen; + int32_t __offset; +} ; + +#endif /* _NLS_PRIVATE */ + +#define NL_SETD 0 +#define NL_CAT_LOCALE 1 + +typedef struct __nl_cat_d { + void *__data; + int __size; +} *nl_catd; + + +#ifndef _NL_ITEM_DECLARED +typedef int nl_item; +#define _NL_ITEM_DECLARED +#endif + +__BEGIN_DECLS +nl_catd catopen(const char *, int); +char *catgets(nl_catd, int, int, const char *) __format_arg(4); +int catclose(nl_catd); +__END_DECLS + +#endif /* _NL_TYPES_H_ */ diff --git a/winsup/cygwin/libc/msgcat.c b/winsup/cygwin/libc/msgcat.c new file mode 100644 index 000000000..3df43afa4 --- /dev/null +++ b/winsup/cygwin/libc/msgcat.c @@ -0,0 +1,478 @@ +/*********************************************************** +Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. +Copyright 2010, Gabor Kovesdan + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that Alfalfa's name not be used in +advertising or publicity pertaining to distribution of the software +without specific, written prior permission. + +ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +If you make any modifications, bugfixes or other changes to this software +we'd appreciate it if you could send a copy to us so we can keep things +up-to-date. Many thanks. + Kee Hinckley + Alfalfa Software, Inc. + 267 Allston St., #3 + Cambridge, MA 02139 USA + nazgul@alfalfa.com + +******************************************************************/ + +#include +__FBSDID("$FreeBSD$"); + +#define _NLS_PRIVATE + +#ifndef __CYGWIN__ +#include "namespace.h" +#endif +#include +#include +#include +#include + +#include /* for ntohl() */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#ifndef __CYGWIN__ +#include "un-namespace.h" + +#include "../locale/xlocale_private.h" + +#define _DEFAULT_NLS_PATH "/usr/share/nls/%L/%N.cat:/usr/share/nls/%N/%L:/usr/local/share/nls/%L/%N.cat:/usr/local/share/nls/%N/%L" + +#define RLOCK(fail) { int ret; \ + if (__isthreaded && \ + ((ret = _pthread_rwlock_rdlock(&rwlock)) != 0)) { \ + errno = ret; \ + return (fail); \ + }} +#define WLOCK(fail) { int ret; \ + if (__isthreaded && \ + ((ret = _pthread_rwlock_wrlock(&rwlock)) != 0)) { \ + errno = ret; \ + return (fail); \ + }} +#define UNLOCK { if (__isthreaded) \ + _pthread_rwlock_unlock(&rwlock); } + +static pthread_rwlock_t rwlock = PTHREAD_RWLOCK_INITIALIZER; +#else + +#include "../locale/setlocale.h" +#define SIZE_T_MAX __SIZE_MAX__ +#define _close close +#define _open open +#define _fstat fstat +#define RLOCK(a) +#define WLOCK(a) +#define UNLOCK + +#define _DEFAULT_NLS_PATH "/usr/share/locale/%L/%N.cat:/usr/share/locale/%L/LC_MESSAGES/%N.cat:/usr/share/locale/%L/%N:/usr/share/locale/%L/LC_MESSAGES/%N:/usr/share/locale/%l/%N.cat:/usr/share/locale/%l/LC_MESSAGES/%N.cat:/usr/share/locale/%l/%N:/usr/share/locale/%l/LC_MESSAGES/%N" + +#endif + +#define NLERR ((nl_catd) -1) +#define NLRETERR(errc) { errno = errc; return (NLERR); } +#define SAVEFAIL(n, l, e) { WLOCK(NLERR); \ + np = malloc(sizeof(struct catentry)); \ + if (np != NULL) { \ + np->name = strdup(n); \ + np->path = NULL; \ + np->catd = NLERR; \ + np->refcount = 0; \ + np->lang = (l == NULL) ? NULL : \ + strdup(l); \ + np->caterrno = e; \ + SLIST_INSERT_HEAD(&cache, np, list); \ + } \ + UNLOCK; \ + errno = e; \ + } + +static nl_catd load_msgcat(const char *, const char *, const char *); + +struct catentry { + SLIST_ENTRY(catentry) list; + char *name; + char *path; + int caterrno; + nl_catd catd; + char *lang; + int refcount; +}; + +static SLIST_HEAD(listhead, catentry) cache = + SLIST_HEAD_INITIALIZER(cache); + +nl_catd +catopen(const char *name, int type) +{ + struct stat sbuf; + struct catentry *np; + char *base, *cptr, *cptr1, *nlspath, *pathP, *pcode; + char *plang, *pter; + int saverr, spcleft; + const char *lang, *tmpptr; + char path[PATH_MAX]; + + /* sanity checking */ + if (name == NULL || *name == '\0') + NLRETERR(EINVAL); + + if (strchr(name, '/') != NULL) + /* have a pathname */ + lang = NULL; + else { + if (type == NL_CAT_LOCALE) +#ifdef __CYGWIN__ + lang = __get_current_locale()->categories[LC_MESSAGES]; +#else + lang = querylocale(LC_MESSAGES_MASK, __get_locale()); +#endif + else + lang = getenv("LANG"); + + if (lang == NULL || *lang == '\0' || strlen(lang) > ENCODING_LEN || + (lang[0] == '.' && + (lang[1] == '\0' || (lang[1] == '.' && lang[2] == '\0'))) || + strchr(lang, '/') != NULL) + lang = "C"; + } + + /* Try to get it from the cache first */ + RLOCK(NLERR); + SLIST_FOREACH(np, &cache, list) { + if ((strcmp(np->name, name) == 0) && + ((lang != NULL && np->lang != NULL && + strcmp(np->lang, lang) == 0) || (np->lang == lang))) { + if (np->caterrno != 0) { + /* Found cached failing entry */ + UNLOCK; + NLRETERR(np->caterrno); + } else { + /* Found cached successful entry */ + np->refcount++; + UNLOCK; + return (np->catd); + } + } + } + UNLOCK; + + /* is it absolute path ? if yes, load immediately */ + if (strchr(name, '/') != NULL) + return (load_msgcat(name, name, lang)); + + /* sanity checking */ + if ((plang = cptr1 = strdup(lang)) == NULL) + return (NLERR); + if ((cptr = strchr(cptr1, '@')) != NULL) + *cptr = '\0'; + pter = pcode = (char *)""; + if ((cptr = strchr(cptr1, '_')) != NULL) { + *cptr++ = '\0'; + pter = cptr1 = cptr; + } + if ((cptr = strchr(cptr1, '.')) != NULL) { + *cptr++ = '\0'; + pcode = cptr; + } + + if ((nlspath = getenv("NLSPATH")) == NULL || issetugid()) + nlspath = (char *)_DEFAULT_NLS_PATH; + + if ((base = cptr = strdup(nlspath)) == NULL) { + saverr = errno; + free(plang); + errno = saverr; + return (NLERR); + } + + while ((nlspath = strsep(&cptr, ":")) != NULL) { + pathP = path; + if (*nlspath) { + for (; *nlspath; ++nlspath) { + if (*nlspath == '%') { + switch (*(nlspath + 1)) { + case 'l': + tmpptr = plang; + break; + case 't': + tmpptr = pter; + break; + case 'c': + tmpptr = pcode; + break; + case 'L': + tmpptr = lang; + break; + case 'N': + tmpptr = (char *)name; + break; + case '%': + ++nlspath; + /* FALLTHROUGH */ + default: + if (pathP - path >= + sizeof(path) - 1) + goto too_long; + *(pathP++) = *nlspath; + continue; + } + ++nlspath; + put_tmpptr: + spcleft = sizeof(path) - + (pathP - path) - 1; + if (strlcpy(pathP, tmpptr, spcleft) >= + spcleft) { + too_long: + free(plang); + free(base); + SAVEFAIL(name, lang, ENAMETOOLONG); + NLRETERR(ENAMETOOLONG); + } + pathP += strlen(tmpptr); + } else { + if (pathP - path >= sizeof(path) - 1) + goto too_long; + *(pathP++) = *nlspath; + } + } + *pathP = '\0'; + if (stat(path, &sbuf) == 0) { + free(plang); + free(base); + return (load_msgcat(path, name, lang)); + } + } else { + tmpptr = (char *)name; + --nlspath; + goto put_tmpptr; + } + } + free(plang); + free(base); + SAVEFAIL(name, lang, ENOENT); + NLRETERR(ENOENT); +} + +char * +catgets(nl_catd catd, int set_id, int msg_id, const char *s) +{ + struct _nls_cat_hdr *cat_hdr; + struct _nls_msg_hdr *msg_hdr; + struct _nls_set_hdr *set_hdr; + int i, l, r, u; + + if (catd == NULL || catd == NLERR) { + errno = EBADF; + /* LINTED interface problem */ + return ((char *)s); + } + + cat_hdr = (struct _nls_cat_hdr *)catd->__data; + set_hdr = (struct _nls_set_hdr *)(void *)((char *)catd->__data + + sizeof(struct _nls_cat_hdr)); + + /* binary search, see knuth algorithm b */ + l = 0; + u = ntohl((u_int32_t)cat_hdr->__nsets) - 1; + while (l <= u) { + i = (l + u) / 2; + r = set_id - ntohl((u_int32_t)set_hdr[i].__setno); + + if (r == 0) { + msg_hdr = (struct _nls_msg_hdr *) + (void *)((char *)catd->__data + + sizeof(struct _nls_cat_hdr) + + ntohl((u_int32_t)cat_hdr->__msg_hdr_offset)); + + l = ntohl((u_int32_t)set_hdr[i].__index); + u = l + ntohl((u_int32_t)set_hdr[i].__nmsgs) - 1; + while (l <= u) { + i = (l + u) / 2; + r = msg_id - + ntohl((u_int32_t)msg_hdr[i].__msgno); + if (r == 0) { + return ((char *) catd->__data + + sizeof(struct _nls_cat_hdr) + + ntohl((u_int32_t) + cat_hdr->__msg_txt_offset) + + ntohl((u_int32_t) + msg_hdr[i].__offset)); + } else if (r < 0) { + u = i - 1; + } else { + l = i + 1; + } + } + + /* not found */ + goto notfound; + + } else if (r < 0) { + u = i - 1; + } else { + l = i + 1; + } + } + +notfound: + /* not found */ + errno = ENOMSG; + /* LINTED interface problem */ + return ((char *)s); +} + +static void +catfree(struct catentry *np) +{ + + if (np->catd != NULL && np->catd != NLERR) { + munmap(np->catd->__data, (size_t)np->catd->__size); + free(np->catd); + } + SLIST_REMOVE(&cache, np, catentry, list); + free(np->name); + free(np->path); + free(np->lang); + free(np); +} + +int +catclose(nl_catd catd) +{ + struct catentry *np; + + /* sanity checking */ + if (catd == NULL || catd == NLERR) { + errno = EBADF; + return (-1); + } + + /* Remove from cache if not referenced any more */ + WLOCK(-1); + SLIST_FOREACH(np, &cache, list) { + if (catd == np->catd) { + np->refcount--; + if (np->refcount == 0) + catfree(np); + break; + } + } + UNLOCK; + return (0); +} + +/* + * Internal support functions + */ + +static nl_catd +load_msgcat(const char *path, const char *name, const char *lang) +{ + struct stat st; + nl_catd catd; + struct catentry *np; + void *data; + int fd; + + /* path/name will never be NULL here */ + + /* + * One more try in cache; if it was not found by name, + * it might still be found by absolute path. + */ + RLOCK(NLERR); + SLIST_FOREACH(np, &cache, list) { + if ((np->path != NULL) && (strcmp(np->path, path) == 0)) { + np->refcount++; + UNLOCK; + return (np->catd); + } + } + UNLOCK; + + if ((fd = _open(path, O_RDONLY | O_CLOEXEC)) == -1) { + SAVEFAIL(name, lang, errno); + NLRETERR(errno); + } + + if (_fstat(fd, &st) != 0) { + _close(fd); + SAVEFAIL(name, lang, EFTYPE); + NLRETERR(EFTYPE); + } + + /* + * If the file size cannot be held in size_t we cannot mmap() + * it to the memory. Probably, this will not be a problem given + * that catalog files are usually small. + */ + if (st.st_size > SIZE_T_MAX) { + _close(fd); + SAVEFAIL(name, lang, EFBIG); + NLRETERR(EFBIG); + } + + if ((data = mmap(0, (size_t)st.st_size, PROT_READ, + MAP_FILE|MAP_SHARED, fd, (off_t)0)) == MAP_FAILED) { + int saved_errno = errno; + _close(fd); + SAVEFAIL(name, lang, saved_errno); + NLRETERR(saved_errno); + } + _close(fd); + + if (ntohl((u_int32_t)((struct _nls_cat_hdr *)data)->__magic) != + _NLS_MAGIC) { + munmap(data, (size_t)st.st_size); + SAVEFAIL(name, lang, EFTYPE); + NLRETERR(EFTYPE); + } + + if ((catd = malloc(sizeof (*catd))) == NULL) { + munmap(data, (size_t)st.st_size); + SAVEFAIL(name, lang, ENOMEM); + NLRETERR(ENOMEM); + } + + catd->__data = data; + catd->__size = (int)st.st_size; + + /* Caching opened catalog */ + WLOCK(NLERR); + if ((np = malloc(sizeof(struct catentry))) != NULL) { + np->name = strdup(name); + np->path = strdup(path); + np->catd = catd; + np->lang = (lang == NULL) ? NULL : strdup(lang); + np->refcount = 1; + np->caterrno = 0; + SLIST_INSERT_HEAD(&cache, np, list); + } + UNLOCK; + return (catd); +} From e5d52a2db9996dcd7c17a1eb6b7bb93d29413ab4 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Thu, 18 Jan 2018 23:28:27 -0600 Subject: [PATCH 230/649] cygwin: add gencat tool This is needed for compiling catalog files used in catgets(3) calls. Signed-off-by: Yaakov Selkowitz --- winsup/utils/Makefile.in | 2 +- winsup/utils/gencat.c | 696 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 697 insertions(+), 1 deletion(-) create mode 100644 winsup/utils/gencat.c diff --git a/winsup/utils/Makefile.in b/winsup/utils/Makefile.in index 0ad73fb76..be525d07f 100644 --- a/winsup/utils/Makefile.in +++ b/winsup/utils/Makefile.in @@ -54,7 +54,7 @@ MINGW_CXX := @MINGW_CXX@ # List all binaries to be linked in Cygwin mode. Each binary on this list # must have a corresponding .o of the same name. -CYGWIN_BINS := ${addsuffix .exe,cygpath getconf getfacl ldd locale kill minidumper mkgroup \ +CYGWIN_BINS := ${addsuffix .exe,cygpath gencat getconf getfacl ldd locale kill minidumper mkgroup \ mkpasswd mount passwd pldd ps regtool setfacl setmetamode ssp tzset umount} # List all binaries to be linked in MinGW mode. Each binary on this list diff --git a/winsup/utils/gencat.c b/winsup/utils/gencat.c new file mode 100644 index 000000000..a583a8843 --- /dev/null +++ b/winsup/utils/gencat.c @@ -0,0 +1,696 @@ +/* ex:ts=4 + */ + +/* $NetBSD: gencat.c,v 1.18 2003/10/27 00:12:43 lukem Exp $ */ + +/*- + * SPDX-License-Identifier: BSD-2-Clause-NetBSD AND MIT + * + * Copyright (c) 1996 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by J.T. Conklin. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +/*********************************************************** +Copyright 1990, by Alfalfa Software Incorporated, Cambridge, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +provided that the above copyright notice appear in all copies and that +both that copyright notice and this permission notice appear in +supporting documentation, and that Alfalfa's name not be used in +advertising or publicity pertaining to distribution of the software +without specific, written prior permission. + +ALPHALPHA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +ALPHALPHA BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR +ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, +WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, +ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS +SOFTWARE. + +If you make any modifications, bugfixes or other changes to this software +we'd appreciate it if you could send a copy to us so we can keep things +up-to-date. Many thanks. + Kee Hinckley + Alfalfa Software, Inc. + 267 Allston St., #3 + Cambridge, MA 02139 USA + nazgul@alfalfa.com + +******************************************************************/ + +#include +__FBSDID("$FreeBSD$"); + +#define _NLS_PRIVATE + +#include +#include + +#include /* for htonl() */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +struct _msgT { + long msgId; + char *str; + LIST_ENTRY(_msgT) entries; +}; + +struct _setT { + long setId; + LIST_HEAD(msghead, _msgT) msghead; + LIST_ENTRY(_setT) entries; +}; + +static LIST_HEAD(sethead, _setT) sethead; +static struct _setT *curSet; + +static char *curline = NULL; +static long lineno = 0; + +static char *cskip(char *); +static void error(const char *); +static char *get_line(int); +static char *getmsg(int, char *, char); +static void warning(const char *, const char *); +static char *wskip(char *); +static char *xstrdup(const char *); +static void *xmalloc(size_t); +static void *xrealloc(void *, size_t); + +void MCParse(int); +void MCReadCat(int); +void MCWriteCat(int); +void MCDelMsg(int); +void MCAddMsg(int, const char *); +void MCAddSet(int); +void MCDelSet(int); +void usage(void); +int main(int, char **); + +void +usage(void) +{ + fprintf(stderr, "usage: %s catfile msgfile ...\n", getprogname()); + exit(1); +} + +int +main(int argc, char **argv) +{ + int ofd, ifd; + char *catfile = NULL; + int c; + +#define DEPRECATEDMSG 1 + +#ifdef DEPRECATEDMSG + while ((c = getopt(argc, argv, "new")) != -1) { +#else + while ((c = getopt(argc, argv, "")) != -1) { +#endif + switch (c) { +#ifdef DEPRECATEDMSG + case 'n': + fprintf(stderr, "WARNING: Usage of \"-new\" argument is deprecated.\n"); + case 'e': + case 'w': + break; +#endif + case '?': + default: + usage(); + /* NOTREACHED */ + } + } + argc -= optind; + argv += optind; + + if (argc < 2) { + usage(); + /* NOTREACHED */ + } + catfile = *argv++; + + for (; *argv; argv++) { + if ((ifd = open(*argv, O_RDONLY)) < 0) + err(1, "Unable to read %s", *argv); + MCParse(ifd); + close(ifd); + } + + if ((ofd = open(catfile, O_WRONLY | O_TRUNC | O_CREAT, 0666)) < 0) + err(1, "Unable to create a new %s", catfile); + MCWriteCat(ofd); + exit(0); +} + +static void +warning(const char *cptr, const char *msg) +{ + fprintf(stderr, "%s: %s on line %ld\n", getprogname(), msg, lineno); + fprintf(stderr, "%s\n", curline); + if (cptr) { + char *tptr; + for (tptr = curline; tptr < cptr; ++tptr) + putc(' ', stderr); + fprintf(stderr, "^\n"); + } +} + +#define CORRUPT() { error("corrupt message catalog"); } +#define NOMEM() { error("out of memory"); } + +static void +error(const char *msg) +{ + warning(NULL, msg); + exit(1); +} + +static void * +xmalloc(size_t len) +{ + void *p; + + if ((p = malloc(len)) == NULL) + NOMEM(); + return (p); +} + +static void * +xrealloc(void *ptr, size_t size) +{ + if ((ptr = realloc(ptr, size)) == NULL) + NOMEM(); + return (ptr); +} + +static char * +xstrdup(const char *str) +{ + char *nstr; + + if ((nstr = strdup(str)) == NULL) + NOMEM(); + return (nstr); +} + +static char * +get_line(int fd) +{ + static long curlen = BUFSIZ; + static char buf[BUFSIZ], *bptr = buf, *bend = buf; + char *cptr, *cend; + long buflen; + + if (!curline) { + curline = xmalloc(curlen); + } + ++lineno; + + cptr = curline; + cend = curline + curlen; + for (;;) { + for (; bptr < bend && cptr < cend; ++cptr, ++bptr) { + if (*bptr == '\n') { + *cptr = '\0'; + ++bptr; + return (curline); + } else + *cptr = *bptr; + } + if (cptr == cend) { + cptr = curline = xrealloc(curline, curlen *= 2); + cend = curline + curlen; + } + if (bptr == bend) { + buflen = read(fd, buf, BUFSIZ); + if (buflen <= 0) { + if (cptr > curline) { + *cptr = '\0'; + return (curline); + } + return (NULL); + } + bend = buf + buflen; + bptr = buf; + } + } +} + +static char * +wskip(char *cptr) +{ + if (!*cptr || !isspace((unsigned char) *cptr)) { + warning(cptr, "expected a space"); + return (cptr); + } + while (*cptr && isspace((unsigned char) *cptr)) + ++cptr; + return (cptr); +} + +static char * +cskip(char *cptr) +{ + if (!*cptr || isspace((unsigned char) *cptr)) { + warning(cptr, "wasn't expecting a space"); + return (cptr); + } + while (*cptr && !isspace((unsigned char) *cptr)) + ++cptr; + return (cptr); +} + +static char * +getmsg(int fd, char *cptr, char quote) +{ + static char *msg = NULL; + static long msglen = 0; + long clen, i; + char *tptr; + + if (quote && *cptr == quote) { + ++cptr; + } + + clen = strlen(cptr) + 1; + if (clen > msglen) { + if (msglen) + msg = xrealloc(msg, clen); + else + msg = xmalloc(clen); + msglen = clen; + } + tptr = msg; + + while (*cptr) { + if (quote && *cptr == quote) { + char *tmp; + tmp = cptr + 1; + if (*tmp && (!isspace((unsigned char) *tmp) || *wskip(tmp))) { + warning(cptr, "unexpected quote character, ignoring"); + *tptr++ = *cptr++; + } else { + *cptr = '\0'; + } + } else + if (*cptr == '\\') { + ++cptr; + switch (*cptr) { + case '\0': + cptr = get_line(fd); + if (!cptr) + error("premature end of file"); + msglen += strlen(cptr); + i = tptr - msg; + msg = xrealloc(msg, msglen); + tptr = msg + i; + break; + + #define CASEOF(CS, CH) \ + case CS: \ + *tptr++ = CH; \ + ++cptr; \ + break; \ + + CASEOF('n', '\n'); + CASEOF('t', '\t'); + CASEOF('v', '\v'); + CASEOF('b', '\b'); + CASEOF('r', '\r'); + CASEOF('f', '\f'); + CASEOF('"', '"'); + CASEOF('\\', '\\'); + + default: + if (quote && *cptr == quote) { + *tptr++ = *cptr++; + } else if (isdigit((unsigned char) *cptr)) { + *tptr = 0; + for (i = 0; i < 3; ++i) { + if (!isdigit((unsigned char) *cptr)) + break; + if (*cptr > '7') + warning(cptr, "octal number greater than 7?!"); + *tptr *= 8; + *tptr += (*cptr - '0'); + ++cptr; + } + } else { + warning(cptr, "unrecognized escape sequence"); + } + break; + } + } else { + *tptr++ = *cptr++; + } + } + *tptr = '\0'; + return (msg); +} + +void +MCParse(int fd) +{ + char *cptr, *str; + int setid, msgid = 0; + char quote = 0; + + /* XXX: init sethead? */ + + while ((cptr = get_line(fd))) { + if (*cptr == '$') { + ++cptr; + if (strncmp(cptr, "set", 3) == 0) { + cptr += 3; + cptr = wskip(cptr); + setid = atoi(cptr); + MCAddSet(setid); + msgid = 0; + } else if (strncmp(cptr, "delset", 6) == 0) { + cptr += 6; + cptr = wskip(cptr); + setid = atoi(cptr); + MCDelSet(setid); + } else if (strncmp(cptr, "quote", 5) == 0) { + cptr += 5; + if (!*cptr) + quote = 0; + else { + cptr = wskip(cptr); + if (!*cptr) + quote = 0; + else + quote = *cptr; + } + } else if (isspace((unsigned char) *cptr)) { + ; + } else { + if (*cptr) { + cptr = wskip(cptr); + if (*cptr) + warning(cptr, "unrecognized line"); + } + } + } else { + /* + * First check for (and eat) empty lines.... + */ + if (!*cptr) + continue; + /* + * We have a digit? Start of a message. Else, + * syntax error. + */ + if (isdigit((unsigned char) *cptr)) { + msgid = atoi(cptr); + cptr = cskip(cptr); + cptr = wskip(cptr); + /* if (*cptr) ++cptr; */ + } else { + warning(cptr, "neither blank line nor start of a message id"); + continue; + } + /* + * If we have a message ID, but no message, + * then this means "delete this message id + * from the catalog". + */ + if (!*cptr) { + MCDelMsg(msgid); + } else { + str = getmsg(fd, cptr, quote); + MCAddMsg(msgid, str); + } + } + } +} + +/* + * Write message catalog. + * + * The message catalog is first converted from its internal to its + * external representation in a chunk of memory allocated for this + * purpose. Then the completed catalog is written. This approach + * avoids additional housekeeping variables and/or a lot of seeks + * that would otherwise be required. + */ +void +MCWriteCat(int fd) +{ + int nsets; /* number of sets */ + int nmsgs; /* number of msgs */ + int string_size; /* total size of string pool */ + int msgcat_size; /* total size of message catalog */ + void *msgcat; /* message catalog data */ + struct _nls_cat_hdr *cat_hdr; + struct _nls_set_hdr *set_hdr; + struct _nls_msg_hdr *msg_hdr; + char *strings; + struct _setT *set; + struct _msgT *msg; + int msg_index; + int msg_offset; + + /* determine number of sets, number of messages, and size of the + * string pool */ + nsets = 0; + nmsgs = 0; + string_size = 0; + + for (set = sethead.lh_first; set != NULL; + set = set->entries.le_next) { + nsets++; + + for (msg = set->msghead.lh_first; msg != NULL; + msg = msg->entries.le_next) { + nmsgs++; + string_size += strlen(msg->str) + 1; + } + } + +#ifdef DEBUG + printf("number of sets: %d\n", nsets); + printf("number of msgs: %d\n", nmsgs); + printf("string pool size: %d\n", string_size); +#endif + + /* determine size and then allocate buffer for constructing external + * message catalog representation */ + msgcat_size = sizeof(struct _nls_cat_hdr) + + (nsets * sizeof(struct _nls_set_hdr)) + + (nmsgs * sizeof(struct _nls_msg_hdr)) + + string_size; + + msgcat = xmalloc(msgcat_size); + memset(msgcat, '\0', msgcat_size); + + /* fill in msg catalog header */ + cat_hdr = (struct _nls_cat_hdr *) msgcat; + cat_hdr->__magic = htonl(_NLS_MAGIC); + cat_hdr->__nsets = htonl(nsets); + cat_hdr->__mem = htonl(msgcat_size - sizeof(struct _nls_cat_hdr)); + cat_hdr->__msg_hdr_offset = + htonl(nsets * sizeof(struct _nls_set_hdr)); + cat_hdr->__msg_txt_offset = + htonl(nsets * sizeof(struct _nls_set_hdr) + + nmsgs * sizeof(struct _nls_msg_hdr)); + + /* compute offsets for set & msg header tables and string pool */ + set_hdr = (struct _nls_set_hdr *)(void *)((char *)msgcat + + sizeof(struct _nls_cat_hdr)); + msg_hdr = (struct _nls_msg_hdr *)(void *)((char *)msgcat + + sizeof(struct _nls_cat_hdr) + + nsets * sizeof(struct _nls_set_hdr)); + strings = (char *) msgcat + + sizeof(struct _nls_cat_hdr) + + nsets * sizeof(struct _nls_set_hdr) + + nmsgs * sizeof(struct _nls_msg_hdr); + + msg_index = 0; + msg_offset = 0; + for (set = sethead.lh_first; set != NULL; + set = set->entries.le_next) { + + nmsgs = 0; + for (msg = set->msghead.lh_first; msg != NULL; + msg = msg->entries.le_next) { + int msg_len = strlen(msg->str) + 1; + + msg_hdr->__msgno = htonl(msg->msgId); + msg_hdr->__msglen = htonl(msg_len); + msg_hdr->__offset = htonl(msg_offset); + + memcpy(strings, msg->str, msg_len); + strings += msg_len; + msg_offset += msg_len; + + nmsgs++; + msg_hdr++; + } + + set_hdr->__setno = htonl(set->setId); + set_hdr->__nmsgs = htonl(nmsgs); + set_hdr->__index = htonl(msg_index); + msg_index += nmsgs; + set_hdr++; + } + + /* write out catalog. XXX: should this be done in small chunks? */ + write(fd, msgcat, msgcat_size); +} + +void +MCAddSet(int setId) +{ + struct _setT *p, *q; + + if (setId <= 0) { + error("setId's must be greater than zero"); + /* NOTREACHED */ + } + if (setId > NL_SETMAX) { + error("setId exceeds limit"); + /* NOTREACHED */ + } + + p = sethead.lh_first; + q = NULL; + for (; p != NULL && p->setId < setId; q = p, p = p->entries.le_next); + + if (p && p->setId == setId) { + ; + } else { + p = xmalloc(sizeof(struct _setT)); + memset(p, '\0', sizeof(struct _setT)); + LIST_INIT(&p->msghead); + + p->setId = setId; + + if (q == NULL) { + LIST_INSERT_HEAD(&sethead, p, entries); + } else { + LIST_INSERT_AFTER(q, p, entries); + } + } + + curSet = p; +} + +void +MCAddMsg(int msgId, const char *str) +{ + struct _msgT *p, *q; + + if (!curSet) + error("can't specify a message when no set exists"); + + if (msgId <= 0) { + error("msgId's must be greater than zero"); + /* NOTREACHED */ + } + if (msgId > NL_MSGMAX) { + error("msgID exceeds limit"); + /* NOTREACHED */ + } + + p = curSet->msghead.lh_first; + q = NULL; + for (; p != NULL && p->msgId < msgId; q = p, p = p->entries.le_next); + + if (p && p->msgId == msgId) { + free(p->str); + } else { + p = xmalloc(sizeof(struct _msgT)); + memset(p, '\0', sizeof(struct _msgT)); + + if (q == NULL) { + LIST_INSERT_HEAD(&curSet->msghead, p, entries); + } else { + LIST_INSERT_AFTER(q, p, entries); + } + } + + p->msgId = msgId; + p->str = xstrdup(str); +} + +void +MCDelSet(int setId) +{ + struct _setT *set; + struct _msgT *msg; + + set = sethead.lh_first; + for (; set != NULL && set->setId < setId; set = set->entries.le_next); + + if (set && set->setId == setId) { + + msg = set->msghead.lh_first; + while (msg) { + free(msg->str); + LIST_REMOVE(msg, entries); + } + + LIST_REMOVE(set, entries); + return; + } + warning(NULL, "specified set doesn't exist"); +} + +void +MCDelMsg(int msgId) +{ + struct _msgT *msg; + + if (!curSet) + error("you can't delete a message before defining the set"); + + msg = curSet->msghead.lh_first; + for (; msg != NULL && msg->msgId < msgId; msg = msg->entries.le_next); + + if (msg && msg->msgId == msgId) { + free(msg->str); + LIST_REMOVE(msg, entries); + return; + } + warning(NULL, "specified msg doesn't exist"); +} From 00bf01789e3f1e794b3424dab683c569cab72f17 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Fri, 19 Jan 2018 00:36:15 -0600 Subject: [PATCH 231/649] cygwin: update docs for 2.10.0 Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/release/2.10.0 | 27 +++++++++++++++++++++++++++ winsup/doc/new-features.xml | 27 ++++++++++++++++++++++++++- winsup/doc/posix.xml | 6 +++--- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0 index 0c6b406a1..ad7122976 100644 --- a/winsup/cygwin/release/2.10.0 +++ b/winsup/cygwin/release/2.10.0 @@ -7,12 +7,39 @@ What's new: - scanf now handles the %l[ conversion. +- Improved hostprogs compatibility for cross-compiling the Linux kernel. +New headers: , . + +- Built-in implementation of Stack Smashing Protection compiler feature. +New APIs: __stack_chk_fail, __stack_chk_guard. + +- Built-in implementation of _FORTIFY_SOURCE guards for functions in +, , , , , , +, and . +New APIs: __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, __mempcpy_chk, +__memset_chk, __snprintf_chk, __sprintf_chk, __stpcpy_chk, __stpncpy_chk, +__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk, +__vsprintf_chk. + +- Built-in implementation of POSIX.1-2001 message catalog support. +New APIs: catclose, catgets, catopen. New tool: gencat. + - New APIs: sigtimedwait, wmempcpy. What changed: ------------- +- Standard headers no longer use macros to support K&R C. + +- confstr(3) and getconf(1) accept LFS_CFLAGS, LFS_LDFLAGS, etc. + +- The __always_inline and __nonnull macros in are now +compatible with glibc. + +- Feature Test Macros improvements in , , , +, and . + Bug Fixes --------- diff --git a/winsup/doc/new-features.xml b/winsup/doc/new-features.xml index b3d258862..59af6efc0 100644 --- a/winsup/doc/new-features.xml +++ b/winsup/doc/new-features.xml @@ -17,7 +17,32 @@ scanf/wscanf now handle the POSIX %m modifier. -- scanf now handles the %l[ conversion. +scanf now handles the %l[ conversion. + + + +Improved hostprogs compatibility for cross-compiling the Linux kernel. +New headers: <asm/bitsperlong.h>, <asm/posix_types.h>. + + + +Built-in implementation of Stack Smashing Protection compiler feature. +New APIs: __stack_chk_fail, __stack_chk_guard. + + + +Built-in implementation of _FORTIFY_SOURCE guards for functions in +<stdio.h>, <stdlib.h>, <string.h>, <strings.h>, +<unistd.h>, <wchar.h>, <sys/poll.h>, and <sys/socket.h>. +New APIs: __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, __mempcpy_chk, +__memset_chk, __snprintf_chk, __sprintf_chk, __stpcpy_chk, __stpncpy_chk, +__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk, +__vsprintf_chk. + + + +Built-in implementation of POSIX.1-2001 message catalog support. +New APIs: catclose, catgets, catopen. New tool: gencat. diff --git a/winsup/doc/posix.xml b/winsup/doc/posix.xml index 2664159e1..8b4bab1b0 100644 --- a/winsup/doc/posix.xml +++ b/winsup/doc/posix.xml @@ -86,9 +86,9 @@ also IEEE Std 1003.1-2008 (POSIX.1-2008). catanhf catanhl catanl - catclose (available in external "catgets" library) - catgets (available in external "catgets" library) - catopen (available in external "catgets" library) + catclose + catgets + catopen cbrt cbrtf cbrtl From 8810f929fc05e1794e06c80b2313728998de4ea5 Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Sun, 21 Jan 2018 23:51:51 -0600 Subject: [PATCH 232/649] cygwin: Declare pthread_rwlock_timedrdlock, pthread_rwlock_timedwrlock These were added in commit 8128f5482f2b1889e2336488e9d45a33c9972d11 but without their public declarations. Signed-off-by: Yaakov Selkowitz --- winsup/cygwin/include/pthread.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/winsup/cygwin/include/pthread.h b/winsup/cygwin/include/pthread.h index 6d3bfd0eb..3dfc2bc80 100644 --- a/winsup/cygwin/include/pthread.h +++ b/winsup/cygwin/include/pthread.h @@ -191,8 +191,12 @@ int pthread_spin_unlock (pthread_spinlock_t *); int pthread_rwlock_destroy (pthread_rwlock_t *rwlock); int pthread_rwlock_init (pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *attr); int pthread_rwlock_rdlock (pthread_rwlock_t *rwlock); +int pthread_rwlock_timedrdlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime); int pthread_rwlock_tryrdlock (pthread_rwlock_t *rwlock); int pthread_rwlock_wrlock (pthread_rwlock_t *rwlock); +int pthread_rwlock_timedwrlock (pthread_rwlock_t *rwlock, + const struct timespec *abstime); int pthread_rwlock_trywrlock (pthread_rwlock_t *rwlock); int pthread_rwlock_unlock (pthread_rwlock_t *rwlock); int pthread_rwlockattr_init (pthread_rwlockattr_t *rwlockattr); From c17b0f00820c6c5187944800b6b4c3b83fe71293 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 22 Jan 2018 15:32:29 +0100 Subject: [PATCH 233/649] cygwin: 2.10.0 release text: fix formatting Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.10.0 | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/winsup/cygwin/release/2.10.0 b/winsup/cygwin/release/2.10.0 index ad7122976..4f4737bf8 100644 --- a/winsup/cygwin/release/2.10.0 +++ b/winsup/cygwin/release/2.10.0 @@ -8,21 +8,21 @@ What's new: - scanf now handles the %l[ conversion. - Improved hostprogs compatibility for cross-compiling the Linux kernel. -New headers: , . + New headers: , . - Built-in implementation of Stack Smashing Protection compiler feature. -New APIs: __stack_chk_fail, __stack_chk_guard. + New APIs: __stack_chk_fail, __stack_chk_guard. - Built-in implementation of _FORTIFY_SOURCE guards for functions in -, , , , , , -, and . -New APIs: __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, __mempcpy_chk, -__memset_chk, __snprintf_chk, __sprintf_chk, __stpcpy_chk, __stpncpy_chk, -__strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk, -__vsprintf_chk. + , , , , , , + , and . + New APIs: __chk_fail, __gets_chk, __memcpy_chk, __memmove_chk, __mempcpy_chk, + __memset_chk, __snprintf_chk, __sprintf_chk, __stpcpy_chk, __stpncpy_chk, + __strcat_chk, __strcpy_chk, __strncat_chk, __strncpy_chk, __vsnprintf_chk, + __vsprintf_chk. - Built-in implementation of POSIX.1-2001 message catalog support. -New APIs: catclose, catgets, catopen. New tool: gencat. + New APIs: catclose, catgets, catopen. New tool: gencat. - New APIs: sigtimedwait, wmempcpy. @@ -35,10 +35,10 @@ What changed: - confstr(3) and getconf(1) accept LFS_CFLAGS, LFS_LDFLAGS, etc. - The __always_inline and __nonnull macros in are now -compatible with glibc. + compatible with glibc. - Feature Test Macros improvements in , , , -, and . + , and . Bug Fixes From 29af5b27cf6a5222670ca910102e0f25406691ad Mon Sep 17 00:00:00 2001 From: Mark Geisert Date: Wed, 24 Jan 2018 00:34:23 -0800 Subject: [PATCH 234/649] Define internal function mythreadname() -- revised This new function returns the name of the calling thread; works for both cygthreads and pthreads. All calls to cygthread::name(/*void*/) replaced by calls to mythreadname(/*void*/). --- winsup/cygwin/exceptions.cc | 4 ++-- winsup/cygwin/fhandler_tty.cc | 2 +- winsup/cygwin/strace.cc | 2 +- winsup/cygwin/thread.cc | 14 ++++++++++++++ winsup/cygwin/thread.h | 3 +++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc index 47782e45b..f659540cb 100644 --- a/winsup/cygwin/exceptions.cc +++ b/winsup/cygwin/exceptions.cc @@ -200,7 +200,7 @@ cygwin_exception::dump_exception () small_printf ("r14=%016X r15=%016X\r\n", ctx->R14, ctx->R15); small_printf ("rbp=%016X rsp=%016X\r\n", ctx->Rbp, ctx->Rsp); small_printf ("program=%W, pid %u, thread %s\r\n", - myself->progname, myself->pid, cygthread::name ()); + myself->progname, myself->pid, mythreadname ()); #else if (exception_name) small_printf ("Exception: %s at eip=%08x\r\n", exception_name, ctx->Eip); @@ -210,7 +210,7 @@ cygwin_exception::dump_exception () ctx->Eax, ctx->Ebx, ctx->Ecx, ctx->Edx, ctx->Esi, ctx->Edi); small_printf ("ebp=%08x esp=%08x program=%W, pid %u, thread %s\r\n", ctx->Ebp, ctx->Esp, myself->progname, myself->pid, - cygthread::name ()); + mythreadname ()); #endif small_printf ("cs=%04x ds=%04x es=%04x fs=%04x gs=%04x ss=%04x\r\n", ctx->SegCs, ctx->SegDs, ctx->SegEs, ctx->SegFs, diff --git a/winsup/cygwin/fhandler_tty.cc b/winsup/cygwin/fhandler_tty.cc index 1505b8c2b..0b8185d90 100644 --- a/winsup/cygwin/fhandler_tty.cc +++ b/winsup/cygwin/fhandler_tty.cc @@ -106,7 +106,7 @@ fhandler_pty_common::__acquire_output_mutex (const char *fn, int ln, #else ostack[osi].fn = fn; ostack[osi].ln = ln; - ostack[osi].tname = cygthread::name (); + ostack[osi].tname = mythreadname (); termios_printf ("acquired for %s:%d, osi %d", fn, ln, osi); osi++; #endif diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 1e7ab047d..b95b436aa 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -138,7 +138,7 @@ strace::vsprntf (char *buf, const char *func, const char *infmt, va_list ap) char fmt[80]; static NO_COPY bool nonewline = false; DWORD err = GetLastError (); - const char *tn = cygthread::name (); + const char *tn = mythreadname (); int microsec = microseconds (); lmicrosec = microsec; diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index f3c709a15..913f7b655 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -2682,6 +2682,20 @@ pthread_setname_np (pthread_t thread, const char *name) return 0; } +/* Returns running thread's name; works for both cygthreads and pthreads */ +char * +mythreadname (void) +{ + char *result = (char *) cygthread::name (); + + if (result == _my_tls.locals.unknown_thread_name) + { + result[0] = '\0'; + pthread_getname_np (pthread_self (), result, (size_t) THRNAMELEN); + } + + return result; +} #undef THRNAMELEN /* provided for source level compatability. diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index 12a9ef26d..9f5e19bda 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -17,6 +17,9 @@ details. */ /* resource.cc */ extern size_t get_rlimit_stack (void); +/* thread.cc */ +char *mythreadname (void); + #include #include #include "security.h" From 7d09d0e26191c1ca66c25dcfe0e62328ce87276f Mon Sep 17 00:00:00 2001 From: Thomas Preudhomme Date: Tue, 23 Jan 2018 10:43:54 +0000 Subject: [PATCH 235/649] Disable powf/log2?f/exp2?f optimization for single-precision Arm FPU New optimized powf, logf, log2f, expf and exp2f yield worse performance on Arm targets with only single precision instructions because the double precision arithmetic is then implemented via softfloat routines. This patch uses the old implementation when double precision instructions are not available on Arm targets. Testing: Built newlib with GCC's rmprofile Arm multilibs and compared before/after -> only the above functions are changed and calls to them (name change from logf to __ieee754_logf and similar). Testing the changed function on a panel of values yields the same result before the original patches to improve them and after this one. Double checking the performance by looping the same panel of values being tested on Arm Cortex-M4 does show the performance regression is fixed. --- newlib/libc/include/machine/ieeefp.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/machine/ieeefp.h b/newlib/libc/include/machine/ieeefp.h index b1b44665e..9fbef8449 100644 --- a/newlib/libc/include/machine/ieeefp.h +++ b/newlib/libc/include/machine/ieeefp.h @@ -78,7 +78,9 @@ # else # define __IEEE_BIG_ENDIAN # endif -# define __OBSOLETE_MATH_DEFAULT 0 +# if __ARM_FP & 0x8 +# define __OBSOLETE_MATH_DEFAULT 0 +# endif #else # define __IEEE_BIG_ENDIAN # ifdef __ARMEL__ From b920561fe3ec2128e783096e0c30fecb7ccb075d Mon Sep 17 00:00:00 2001 From: Yaakov Selkowitz Date: Tue, 23 Jan 2018 21:53:04 -0600 Subject: [PATCH 236/649] ssp: do not use __ssp_protected_ symbol prefixes This is a NetBSD-specific detail which does not apply to Newlib, causing linking issues in certain scenarios: https://cygwin.com/ml/cygwin/2018-01/msg00189.html Signed-off-by: Yaakov Selkowitz --- newlib/libc/include/ssp/ssp.h | 1 - 1 file changed, 1 deletion(-) diff --git a/newlib/libc/include/ssp/ssp.h b/newlib/libc/include/ssp/ssp.h index 5c65cf4b2..922908659 100644 --- a/newlib/libc/include/ssp/ssp.h +++ b/newlib/libc/include/ssp/ssp.h @@ -51,7 +51,6 @@ __chk_fail() #define __ssp_decl(rtype, fun, args) \ rtype __ssp_real_(fun) args __asm__(__ASMNAME(#fun)); \ -__ssp_inline rtype fun args __asm__(__ASMNAME("__ssp_protected_" #fun)); \ __ssp_inline rtype fun args #define __ssp_redirect_raw(rtype, fun, args, call, cond, bos) \ __ssp_decl(rtype, fun, args) \ From 1658a57715de93d50983f34e75216101eb373993 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 31 Jan 2018 08:14:44 +0100 Subject: [PATCH 237/649] epiphany: Additional setjmp() and longjmp() syms At least with Binutils 2.30 and GCC 7.3 we need symbol definitions without the leading underscore. Signed-off-by: Sebastian Huber --- newlib/libc/machine/epiphany/setjmp.S | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/newlib/libc/machine/epiphany/setjmp.S b/newlib/libc/machine/epiphany/setjmp.S index 2986bb47a..b981ee51e 100644 --- a/newlib/libc/machine/epiphany/setjmp.S +++ b/newlib/libc/machine/epiphany/setjmp.S @@ -45,6 +45,8 @@ _setjmp: mov r0,#0 rts .size _setjmp, .-_setjmp + .global setjmp + .set setjmp, _setjmp .global _longjmp _longjmp: @@ -63,3 +65,5 @@ _longjmp: movne r0,r1 jr lr .size _longjmp, .-_longjmp + .global longjmp + .set longjmp, _longjmp From b8272e3b8df8337744423e4dd23e727cf963d528 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 1 Feb 2018 09:06:00 +0000 Subject: [PATCH 238/649] Fix vprintf and vfscanf for GCC PR 14577 --- newlib/libc/stdio/nano-vfprintf.c | 29 +++++++++++------------------ newlib/libc/stdio/nano-vfscanf.c | 28 +++++++++++++--------------- 2 files changed, 24 insertions(+), 33 deletions(-) diff --git a/newlib/libc/stdio/nano-vfprintf.c b/newlib/libc/stdio/nano-vfprintf.c index ed7316a77..bc7ed0743 100644 --- a/newlib/libc/stdio/nano-vfprintf.c +++ b/newlib/libc/stdio/nano-vfprintf.c @@ -168,16 +168,6 @@ static char *rcsid = "$Id$"; #include "vfieeefp.h" #include "nano-vfprintf_local.h" - -/* GCC PR 14577 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557 */ -#if __STDC_VERSION__ >= 201112L -#define va_ptr(ap) _Generic(&(ap), va_list *: &(ap), default: (va_list *)(ap)) -#elif __GNUC__ >= 4 -#define va_ptr(ap) __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(&(ap)), va_list *), &(ap), (va_list *)(ap)) -#else -#define va_ptr(ap) (sizeof(ap) == sizeof(va_list) ? (va_list *)&(ap) : (va_list *)(ap)) -#endif - /* The __ssputs_r function is shared between all versions of vfprintf and vfwprintf. */ #ifdef STRING_ONLY @@ -485,6 +475,7 @@ _VFPRINTF_R (struct _reent *data, register char *cp; /* Handy char pointer (short term usage). */ const char *flag_chars; struct _prt_data_t prt_data; /* All data for decoding format string. */ + va_list ap_copy; /* Output function pointer. */ int (*pfunc)(struct _reent *, FILE *, const char *, size_t len); @@ -522,6 +513,9 @@ _VFPRINTF_R (struct _reent *data, prt_data.blank = ' '; prt_data.zero = '0'; + /* GCC PR 14577 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557 */ + va_copy (ap_copy, ap); + /* Scan the format for conversions (`%' character). */ for (;;) { @@ -577,7 +571,7 @@ _VFPRINTF_R (struct _reent *data, * -- ANSI X3J11 * They don't exclude field widths read from args. */ - prt_data.width = GET_ARG (n, ap, int); + prt_data.width = GET_ARG (n, ap_copy, int); if (prt_data.width < 0) { prt_data.width = -prt_data.width; @@ -598,7 +592,7 @@ _VFPRINTF_R (struct _reent *data, if (*fmt == '*') { fmt++; - prt_data.prec = GET_ARG (n, ap, int); + prt_data.prec = GET_ARG (n, ap_copy, int); if (prt_data.prec < 0) prt_data.prec = -1; } @@ -630,18 +624,16 @@ _VFPRINTF_R (struct _reent *data, if (_printf_float == NULL) { if (prt_data.flags & LONGDBL) - GET_ARG (N, ap, _LONG_DOUBLE); + GET_ARG (N, ap_copy, _LONG_DOUBLE); else - GET_ARG (N, ap, double); + GET_ARG (N, ap_copy, double); } else - { - n = _printf_float (data, &prt_data, fp, pfunc, va_ptr(ap)); - } + n = _printf_float (data, &prt_data, fp, pfunc, &ap_copy); } else #endif - n = _printf_i (data, &prt_data, fp, pfunc, va_ptr(ap)); + n = _printf_i (data, &prt_data, fp, pfunc, &ap_copy); if (n == -1) goto error; @@ -654,6 +646,7 @@ error: #ifndef STRING_ONLY _newlib_flockfile_end (fp); #endif + va_end (ap_copy); return (__sferror (fp) ? EOF : prt_data.ret); } diff --git a/newlib/libc/stdio/nano-vfscanf.c b/newlib/libc/stdio/nano-vfscanf.c index 5579cb0f1..97810b739 100644 --- a/newlib/libc/stdio/nano-vfscanf.c +++ b/newlib/libc/stdio/nano-vfscanf.c @@ -119,15 +119,6 @@ Supporting OS subroutines required: #include "../stdlib/local.h" #include "nano-vfscanf_local.h" -/* GCC PR 14577 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557 */ -#if __STDC_VERSION__ >= 201112L -#define va_ptr(ap) _Generic(&(ap), va_list *: &(ap), default: (va_list *)(ap)) -#elif __GNUC__ >= 4 -#define va_ptr(ap) __builtin_choose_expr(__builtin_types_compatible_p(__typeof__(&(ap)), va_list *), &(ap), (va_list *)(ap)) -#else -#define va_ptr(ap) (sizeof(ap) == sizeof(va_list) ? (va_list *)&(ap) : (va_list *)(ap)) -#endif - #define VFSCANF vfscanf #define _VFSCANF_R _vfscanf_r #define __SVFSCANF __svfscanf @@ -272,6 +263,7 @@ __SVFSCANF_R (struct _reent *rptr, register int c; /* Character from format, or conversion. */ register char *p; /* Points into all kinds of strings. */ char ccltab[256]; /* Character class table for %[...]. */ + va_list ap_copy; int ret; char *cp; @@ -287,6 +279,9 @@ __SVFSCANF_R (struct _reent *rptr, scan_data.pfn_ungetc = _ungetc_r; scan_data.pfn_refill = __srefill_r; + /* GCC PR 14577 at https://gcc.gnu.org/bugzilla/show_bug.cgi?id=14557 */ + va_copy (ap_copy, ap); + for (;;) { if (*fmt == 0) @@ -379,17 +374,18 @@ __SVFSCANF_R (struct _reent *rptr, continue; if (scan_data.flags & SHORT) - *GET_ARG (N, ap, short *) = scan_data.nread; + *GET_ARG (N, ap_copy, short *) = scan_data.nread; else if (scan_data.flags & LONG) - *GET_ARG (N, ap, long *) = scan_data.nread; + *GET_ARG (N, ap_copy, long *) = scan_data.nread; else - *GET_ARG (N, ap, int *) = scan_data.nread; + *GET_ARG (N, ap_copy, int *) = scan_data.nread; continue; /* Disgusting backwards compatibility hacks. XXX. */ case '\0': /* compat. */ _newlib_flockfile_exit (fp); + va_end (ap_copy); return EOF; #ifdef FLOATING_POINT @@ -427,12 +423,12 @@ __SVFSCANF_R (struct _reent *rptr, } ret = 0; if (scan_data.code < CT_INT) - ret = _scanf_chars (rptr, &scan_data, fp, va_ptr(ap)); + ret = _scanf_chars (rptr, &scan_data, fp, &ap_copy); else if (scan_data.code < CT_FLOAT) - ret = _scanf_i (rptr, &scan_data, fp, va_ptr(ap)); + ret = _scanf_i (rptr, &scan_data, fp, &ap_copy); #ifdef FLOATING_POINT else if (_scanf_float) - ret = _scanf_float (rptr, &scan_data, fp, va_ptr(ap)); + ret = _scanf_float (rptr, &scan_data, fp, &ap_copy); #endif if (ret == MATCH_FAILURE) @@ -446,12 +442,14 @@ input_failure: invalid format string), return EOF if no matches yet, else number of matches made prior to failure. */ _newlib_flockfile_exit (fp); + va_end (ap_copy); return scan_data.nassigned && !(fp->_flags & __SERR) ? scan_data.nassigned : EOF; match_failure: all_done: /* Return number of matches, which can be 0 on match failure. */ _newlib_flockfile_end (fp); + va_end (ap_copy); return scan_data.nassigned; } From 4c73ad6b20378e4b74355fcdb2005f2aac489c9f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Feb 2018 11:27:58 +0100 Subject: [PATCH 239/649] newlib: drop Cygwin license from sys/select.h This license was accidentally retained when moving the file from Cygwin to newlib. Signed-off-by: Corinna Vinschen --- newlib/libc/include/sys/select.h | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/newlib/libc/include/sys/select.h b/newlib/libc/include/sys/select.h index f5dc58688..1e5d895bb 100644 --- a/newlib/libc/include/sys/select.h +++ b/newlib/libc/include/sys/select.h @@ -1,14 +1,3 @@ -/* select.h - Copyright 1998, 1999, 2000, 2001, 2005, 2009 Red Hat, Inc. - - Written by Geoffrey Noer - -This file is part of Cygwin. - -This software is a copyrighted work licensed under the terms of the -Cygwin license. Please consult the file "CYGWIN_LICENSE" for -details. */ - #ifndef _SYS_SELECT_H #define _SYS_SELECT_H From 623d3fdf6b27f5e0f2ec450f691999ad3b40404a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Feb 2018 15:32:28 +0100 Subject: [PATCH 240/649] Cygwin: bump version to 2.10.1 Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/cygwin/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/include/cygwin/version.h b/winsup/cygwin/include/cygwin/version.h index fa9137d05..f08707eea 100644 --- a/winsup/cygwin/include/cygwin/version.h +++ b/winsup/cygwin/include/cygwin/version.h @@ -11,7 +11,7 @@ details. */ changes to the DLL and is mainly informative in nature. */ #define CYGWIN_VERSION_DLL_MAJOR 2010 -#define CYGWIN_VERSION_DLL_MINOR 0 +#define CYGWIN_VERSION_DLL_MINOR 1 /* Major numbers before CYGWIN_VERSION_DLL_EPOCH are incompatible. */ From 9dc34cea28d55c91a5b751530daf39a697cd1794 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Feb 2018 19:22:47 +0100 Subject: [PATCH 241/649] Cygwin: Use SO_EXCLUSIVEADDRUSE We're still using ~SO_REUSEADDR because SO_EXCLUSIVEADDRUSE wasn't defined in Mingw. But it is in Mingw-w64, so fix it. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index cc75b9719..6eac689af 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1154,7 +1154,7 @@ fhandler_socket::bind (const struct sockaddr *name, int namelen) for a more detailed description. */ int on = 1; int ret = ::setsockopt (get_socket (), SOL_SOCKET, - ~(SO_REUSEADDR), + SO_EXCLUSIVEADDRUSE, (const char *) &on, sizeof on); debug_printf ("%d = setsockopt(SO_EXCLUSIVEADDRUSE), %E", ret); } From 34f031982fbf9ce6eb23e47f7f0aeede175cd596 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Feb 2018 19:27:55 +0100 Subject: [PATCH 242/649] Cygwin: bindresvport_sa: Ignore incoming port number Ignore port number just like glibc, otherwise suffer EADDRINUSE in subsequent connect calls. Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 8969e7c6f..b6890121a 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2467,7 +2467,6 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) struct sockaddr_storage sst; struct sockaddr_in *sin = NULL; struct sockaddr_in6 *sin6 = NULL; - in_port_t port; socklen_t salen; int ret = -1; @@ -2489,27 +2488,20 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) case AF_INET: salen = sizeof (struct sockaddr_in); sin = (struct sockaddr_in *) sa; - port = sin->sin_port; break; case AF_INET6: salen = sizeof (struct sockaddr_in6); sin6 = (struct sockaddr_in6 *) sa; - port = sin6->sin6_port; break; default: set_errno (EPFNOSUPPORT); __leave; } - /* If a non-zero port number is given, try this first. If that succeeds, - or if the error message is serious, return. */ - if (port) - { - ret = fh->bind (sa, salen); - if (!ret || (get_errno () != EADDRINUSE && get_errno () != EINVAL)) - __leave; - } - + /* Originally we tried to use the incoming port number first here, + but that may lead to EADDRINUSE scenarios when calling bindresvport + on the client side. So we ignore any port value that the caller + supplies, just like glibc. */ LONG myport; for (int i = 0; i < NUM_PORTS; i++) From 2f61f65601b842af126c64cf02a556425afa1709 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Feb 2018 21:00:15 +0100 Subject: [PATCH 243/649] Cygwin: bindresvport: check correctness of address family Assuming the address parameter is non-NULL, the test in cygwin_bindresvport_sa only tests if the address family is supported at all, which is insufficient. Check if the incoming address family matches the socket address family and for being AF_INET in cygwin_bindresvport since the latter doesn't support any other family. Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index b6890121a..cd4334738 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2482,6 +2482,11 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) memset (&sst, 0, sizeof sst); sa->sa_family = fh->get_addr_family (); } + else if (sa->sa_family != fh->get_addr_family ()) + { + set_errno (EPFNOSUPPORT); + __leave; + } switch (sa->sa_family) { @@ -2529,10 +2534,14 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) return ret; } - extern "C" int cygwin_bindresvport (int fd, struct sockaddr_in *sin) { + if (sin && sin->sin_family != AF_INET) + { + set_errno (EAFNOSUPPORT); + return -1; + } return cygwin_bindresvport_sa (fd, (struct sockaddr *) sin); } From e9ff2d697871eb78f7a4bc246868c855c052a859 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Feb 2018 21:05:09 +0100 Subject: [PATCH 244/649] Cygwin: bindresvport: Try hard to find unused port Workaround the problem that bind doesn't fail with EADDRINUSE if a socket with the same local address is still in TIME_WAIT. Use IP Helper functions to check if such a socket exist and don't even try this port, if so. Signed-off-by: Corinna Vinschen --- winsup/cygwin/autoload.cc | 2 + winsup/cygwin/net.cc | 90 +++++++++++++++++++++++++++++++++++---- 2 files changed, 84 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/autoload.cc b/winsup/cygwin/autoload.cc index 349f5e7b3..199821d95 100644 --- a/winsup/cygwin/autoload.cc +++ b/winsup/cygwin/autoload.cc @@ -573,6 +573,8 @@ LoadDLLfunc (GetIfEntry, 4, iphlpapi) LoadDLLfunc (GetIpAddrTable, 12, iphlpapi) LoadDLLfunc (GetIpForwardTable, 12, iphlpapi) LoadDLLfunc (GetNetworkParams, 8, iphlpapi) +LoadDLLfunc (GetTcpTable, 12, iphlpapi) +LoadDLLfunc (GetTcp6Table, 12, iphlpapi) LoadDLLfunc (GetUdpTable, 12, iphlpapi) LoadDLLfunc (if_indextoname, 8, iphlpapi) LoadDLLfunc (if_nametoindex, 4, iphlpapi) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index cd4334738..3fadb2b15 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2461,6 +2461,66 @@ if_freenameindex (struct if_nameindex *ptr) #define PORT_HIGH (IPPORT_RESERVED - 1) #define NUM_PORTS (PORT_HIGH - PORT_LOW + 1) +/* port is in host byte order */ +static in_port_t +next_free_port (sa_family_t family, in_port_t in_port) +{ + DWORD ret; + ULONG size = 0; + char *tab = NULL; + PMIB_TCPTABLE tab4 = NULL; + PMIB_TCP6TABLE tab6 = NULL; + + /* Start testing with incoming port number. */ + in_port_t tst_port = in_port; + in_port_t res_port = 0; + in_port_t tab_port; + + do + { + if (family == AF_INET) + ret = GetTcpTable ((PMIB_TCPTABLE) tab, &size, TRUE); + else + ret = GetTcp6Table ((PMIB_TCP6TABLE) tab, &size, TRUE); + + if (ret == ERROR_INSUFFICIENT_BUFFER) + tab = (char *) realloc (tab, size); + } + while (ret == ERROR_INSUFFICIENT_BUFFER); + + tab4 = (PMIB_TCPTABLE) tab; + tab6 = (PMIB_TCP6TABLE) tab; + + /* dwNumEntries has offset 0 in both structs. */ + for (int idx = tab4->dwNumEntries - 1; idx >= 0; --idx) + { + if (family == AF_INET) + tab_port = ntohs (tab4->table[idx].dwLocalPort); + else + tab_port = ntohs (tab6->table[idx].dwLocalPort); + /* Skip table entries with too high port number. */ + if (tab_port > tst_port) + continue; + /* Is the current port number free? */ + if (tab_port < tst_port) + { + res_port = tst_port; + break; + } + /* Decrement port and handle underflow of the reserved area. */ + if (--tst_port < PORT_LOW) + { + tst_port = PORT_HIGH; + idx = tab4->dwNumEntries; + } + /* Check if we're round to the incoming port. */ + if (tst_port == in_port) + break; + } + free (tab); + return res_port; +} + extern "C" int cygwin_bindresvport_sa (int fd, struct sockaddr *sa) { @@ -2469,6 +2529,7 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) struct sockaddr_in6 *sin6 = NULL; socklen_t salen; int ret = -1; + LONG port, next_port; __try { @@ -2507,21 +2568,34 @@ cygwin_bindresvport_sa (int fd, struct sockaddr *sa) but that may lead to EADDRINUSE scenarios when calling bindresvport on the client side. So we ignore any port value that the caller supplies, just like glibc. */ - LONG myport; + /* Note that repeating this loop NUM_PORTS times is arbitrary. The + job is mainly done by next_free_port() but it doesn't cover bound + sockets. And calling and checking GetTcpTable and subsequently + calling bind is inevitably racy. We have to continue if bind fails + with EADDRINUSE. */ for (int i = 0; i < NUM_PORTS; i++) { - while ((myport = InterlockedExchange ( + while ((port = InterlockedExchange ( &cygwin_shared->last_used_bindresvport, -1)) == -1) yield (); - if (myport == 0 || --myport < PORT_LOW) - myport = PORT_HIGH; - InterlockedExchange (&cygwin_shared->last_used_bindresvport, myport); - + next_port = port; + if (next_port == 0 || --next_port < PORT_LOW) + next_port = PORT_HIGH; + /* Returns 0 if no reserved port is free. */ + next_port = next_free_port (sa->sa_family, next_port); + if (next_port) + port = next_port; + InterlockedExchange (&cygwin_shared->last_used_bindresvport, port); + if (next_port == 0) + { + set_errno (EADDRINUSE); + break; + } if (sa->sa_family == AF_INET6) - sin6->sin6_port = htons (myport); + sin6->sin6_port = htons (port); else - sin->sin_port = htons (myport); + sin->sin_port = htons (port); if (!(ret = fh->bind (sa, salen))) break; if (get_errno () != EADDRINUSE && get_errno () != EINVAL) From b08e6690a676b9b58abbb676c9e9233f6f2f5c54 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Feb 2018 21:06:29 +0100 Subject: [PATCH 245/649] Cygwin: bindresvport: Guard prototypes with __MISC_VISIBLE Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/netinet/in.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/cygwin/include/netinet/in.h b/winsup/cygwin/include/netinet/in.h index da0265bee..862e45623 100644 --- a/winsup/cygwin/include/netinet/in.h +++ b/winsup/cygwin/include/netinet/in.h @@ -16,8 +16,10 @@ extern "C" { #endif +#if __MISC_VISIBLE extern int bindresvport (int, struct sockaddr_in *); extern int bindresvport_sa (int, struct sockaddr *); +#endif #ifdef __cplusplus }; From f8ce6912231d929d225c4ac428b790b1570e5175 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Feb 2018 18:42:00 +0100 Subject: [PATCH 246/649] Cygwin: setsockopt/getsockopt: Clean up code Rearrange setsockopt/getsockopt into per level/per optname preprocessing switch, actual call, per level/per optname postprocessing switch for better readability as well as extensibility. Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 327 +++++++++++++++++++++++++++---------------- 1 file changed, 208 insertions(+), 119 deletions(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 3fadb2b15..9ff64b82e 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -797,6 +797,7 @@ extern "C" int cygwin_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) { + bool ignore = false; int res = -1; __try @@ -805,105 +806,130 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval, if (!fh) __leave; - /* Switch off the AF_LOCAL handshake and thus SO_PEERCRED handling - for AF_LOCAL/SOCK_STREAM sockets. This allows to handle special - situations in which connect is called before a listening socket - accepts connections. - FIXME: In the long run we should find a more generic solution which - doesn't require a blocking handshake in accept/connect to exchange - SO_PEERCRED credentials. */ - if (level == SOL_SOCKET && optname == SO_PEERCRED) + /* Preprocessing setsockopt. Set ignore to true if setsockopt call + should get skipped entirely. */ + switch (level) { - if (optval || optlen) - set_errno (EINVAL); - else - res = fh->af_local_set_no_getpeereid (); - __leave; + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + /* Switch off the AF_LOCAL handshake and thus SO_PEERCRED + handling for AF_LOCAL/SOCK_STREAM sockets. This allows to + handle special situations in which connect is called before + a listening socket accepts connections. + FIXME: In the long run we should find a more generic solution + which doesn't require a blocking handshake in accept/connect + to exchange SO_PEERCRED credentials. */ + if (optval || optlen) + set_errno (EINVAL); + else + res = fh->af_local_set_no_getpeereid (); + __leave; + + case SO_REUSEADDR: + /* Per POSIX we must not be able to reuse a complete duplicate + of a local TCP address (same IP, same port), even if + SO_REUSEADDR has been set. This behaviour is maintained in + WinSock for backward compatibility, while the WinSock + standard behaviour of stream socket binding is equivalent to + the POSIX behaviour as if SO_REUSEADDR has been set. + The SO_EXCLUSIVEADDRUSE option has been added to allow an + application to request POSIX standard behaviour in the + non-SO_REUSEADDR case. + + To emulate POSIX socket binding behaviour, note that + SO_REUSEADDR has been set but don't call setsockopt. + Instead fhandler_socket::bind sets SO_EXCLUSIVEADDRUSE if + the application did not set SO_REUSEADDR. */ + if (fh->get_socket_type () == SOCK_STREAM) + ignore = true; + break; + + default: + break; + } + break; + + case IPPROTO_IP: + /* Old applications still use the old WinSock1 IPPROTO_IP values. */ + if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) + optname = convert_ws1_ip_optname (optname); + switch (optname) + { + case IP_TOS: + /* Winsock doesn't support setting the IP_TOS field with + setsockopt and TOS was never implemented for TCP anyway. + setsockopt returns WinSock error 10022, WSAEINVAL when + trying to set the IP_TOS field. We just return 0 instead. */ + ignore = true; + break; + + default: + break; + } + break; + + case IPPROTO_IPV6: + { + switch (optname) + { + case IPV6_TCLASS: + /* Unsupported */ + ignore = true; + break; + + default: + break; + } + } + default: + break; } - /* Old applications still use the old WinSock1 IPPROTO_IP values. */ - if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) - optname = convert_ws1_ip_optname (optname); - - /* Per POSIX we must not be able to reuse a complete duplicate of a - local TCP address (same IP, same port), even if SO_REUSEADDR has been - set. That's unfortunately possible in WinSock, and this has never - been changed to maintain backward compatibility. Instead, the - SO_EXCLUSIVEADDRUSE option has been added to allow an application to - request POSIX standard behaviour in the non-SO_REUSEADDR case. - - However, the WinSock standard behaviour of stream socket binding - is equivalent to the POSIX behaviour as if SO_REUSEADDR has been set. - So what we do here is to note that SO_REUSEADDR has been set, but not - actually hand over the request to WinSock. This is tested in - fhandler_socket::bind(), so that SO_EXCLUSIVEADDRUSE can be set if - the application did not set SO_REUSEADDR. This should reflect the - POSIX socket binding behaviour as close as possible with WinSock. */ - if (level == SOL_SOCKET && optname == SO_REUSEADDR - && fh->get_socket_type () == SOCK_STREAM) + /* Call setsockopt (or not) */ + if (ignore) res = 0; else - res = setsockopt (fh->get_socket (), level, optname, - (const char *) optval, optlen); + { + res = setsockopt (fh->get_socket (), level, optname, + (const char *) optval, optlen); + if (res == SOCKET_ERROR) + { + set_winsock_errno (); + __leave; + } + } if (optlen == sizeof (int)) - syscall_printf ("setsockopt optval=%x", *(int *) optval); + debug_printf ("setsockopt optval=%x", *(int *) optval); - if (res) + /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ + switch (level) { - /* KB 248611: - - Windows 2000 and above don't support setting the IP_TOS field - with setsockopt. Additionally, TOS was always (also under 9x - and NT) only implemented for UDP and ICMP, never for TCP. - - The difference is that beginning with Windows 2000 the - setsockopt call returns WinSock error 10022, WSAEINVAL when - trying to set the IP_TOS field, instead of just ignoring the - call. This is *not* explained in KB 248611, but only in KB - 258978. - - Either case, the official workaround is to add a new registry - DWORD value HKLM/System/CurrentControlSet/Services/Tcpip/... - ... Parameters/DisableUserTOSSetting, set to 0, and reboot. - - Sidenote: The reasoning for dropping ToS in Win2K is that ToS - per RFC 1349 is incompatible with DiffServ per RFC 2474/2475. - - We just ignore the return value of setting IP_TOS entirely. - - CV 2014-04-16: Same for IPV6_TCLASS - FIXME: Same for IPV6_RECVTCLASS? */ - if (level == IPPROTO_IP && optname == IP_TOS - && WSAGetLastError () == WSAEINVAL) + case SOL_SOCKET: + switch (optname) { - debug_printf ("Faked IP_TOS success"); - res = 0; + case SO_REUSEADDR: + fh->saw_reuseaddr (*(int *) optval); + break; + + case SO_RCVBUF: + fh->rmem (*(int *) optval); + break; + + case SO_SNDBUF: + fh->wmem (*(int *) optval); + break; + + default: + break; } - else if (level == IPPROTO_IPV6 && optname == IPV6_TCLASS - && WSAGetLastError () == WSAENOPROTOOPT) - { - debug_printf ("Faked IPV6_TCLASS success"); - res = 0; - } - else - set_winsock_errno (); + break; + + default: + break; } - else if (level == SOL_SOCKET) - switch (optname) - { - case SO_REUSEADDR: - fh->saw_reuseaddr (*(int *) optval); - break; - case SO_RCVBUF: - fh->rmem (*(int *) optval); - break; - case SO_SNDBUF: - fh->wmem (*(int *) optval); - break; - default: - break; - } } __except (EFAULT) { @@ -920,6 +946,8 @@ extern "C" int cygwin_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen) { + bool ignore = false; + bool onebyte = false; int res = -1; __try @@ -927,49 +955,110 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, fhandler_socket *fh = get (fd); if (!fh) __leave; - if (optname == SO_PEERCRED && level == SOL_SOCKET) + + /* Preprocessing getsockopt. Set ignore to true if getsockopt call + should get skipped entirely. */ + switch (level) { - struct ucred *cred = (struct ucred *) optval; - res = fh->getpeereid (&cred->pid, &cred->uid, &cred->gid); - __leave; + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + { + struct ucred *cred = (struct ucred *) optval; + res = fh->getpeereid (&cred->pid, &cred->uid, &cred->gid); + __leave; + } + break; + + case SO_REUSEADDR: + { + unsigned int *reuseaddr = (unsigned int *) optval; + *reuseaddr = fh->saw_reuseaddr(); + *optlen = sizeof *reuseaddr; + ignore = true; + } + break; + + default: + break; + } + break; + + case IPPROTO_IP: + /* Old applications still use the old WinSock1 IPPROTO_IP values. */ + if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) + optname = convert_ws1_ip_optname (optname); + break; + + default: + break; } - else if (optname == SO_REUSEADDR && level == SOL_SOCKET) + + /* Call getsockopt (or not) */ + if (ignore) + res = 0; + else { - unsigned int *reuseaddr = (unsigned int *) optval; - *reuseaddr = fh->saw_reuseaddr(); - *optlen = sizeof *reuseaddr; - res = 0; - __leave; + res = getsockopt (fh->get_socket (), level, optname, (char *) optval, + (int *) optlen); + if (res == SOCKET_ERROR) + { + set_winsock_errno (); + __leave; + } } - /* Old applications still use the old WinSock1 IPPROTO_IP values. */ - if (level == IPPROTO_IP && CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) - optname = convert_ws1_ip_optname (optname); - res = getsockopt (fh->get_socket (), level, optname, (char *) optval, - (int *) optlen); - if (res == SOCKET_ERROR) - set_winsock_errno (); - else if (level == SOL_SOCKET && optname == SO_ERROR) + + /* Postprocessing getsockopt, setting fhandler_socket members, etc. + Set onebyte to true for options returning a BOOLEAN instead of a + boolean DWORD. */ + switch (level) { - int *e = (int *) optval; - debug_printf ("WinSock SO_ERROR = %d", *e); - *e = find_winsock_errno (*e); + case SOL_SOCKET: + switch (optname) + { + case SO_ERROR: + { + int *e = (int *) optval; + debug_printf ("WinSock SO_ERROR = %d", *e); + *e = find_winsock_errno (*e); + } + break; + + case SO_KEEPALIVE: + case SO_DONTROUTE: + onebyte = true; + break; + + default: + break; + } + break; + case IPPROTO_TCP: + switch (optname) + { + case TCP_NODELAY: + onebyte = true; + break; + + default: + break; + } + default: + break; } - else if (*optlen == 1) + + if (onebyte) { - /* Regression in Vista and later: instead of a 4 byte BOOL value, + /* Regression in Vista and later: instead of a 4 byte BOOL value, a 1 byte BOOLEAN value is returned, in contrast to older systems and the documentation. Since an int type is expected by the calling application, we convert the result here. For some reason only three BSD-compatible socket options seem to be affected. */ - if ((level == SOL_SOCKET - && (optname == SO_KEEPALIVE || optname == SO_DONTROUTE)) - || (level == IPPROTO_TCP && optname == TCP_NODELAY)) - { - BOOLEAN *in = (BOOLEAN *) optval; - int *out = (int *) optval; - *out = *in; - *optlen = 4; - } + BOOLEAN *in = (BOOLEAN *) optval; + int *out = (int *) optval; + *out = *in; + *optlen = 4; } } __except (EFAULT) From 2af67d21b2e4e1d657fe88fc42924cbebab64585 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Feb 2018 13:07:44 +0100 Subject: [PATCH 247/649] Cygwin: Cleanup time handling * Redefine NSPERSEC to NS100PERSEC * Define NSPERSEC as nanosecs per second * Define USPERSEC as microsecs per second * Use above constants throughout where appropriate * Rename to_us to timespec_to_us and inline * Rename it_bad to timespec_bad and inline Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_disk_file.cc | 4 +- winsup/cygwin/fhandler_proc.cc | 12 ++-- winsup/cygwin/fhandler_process.cc | 8 +-- winsup/cygwin/hires.h | 6 +- winsup/cygwin/posix_ipc.cc | 2 +- winsup/cygwin/resource.cc | 4 +- winsup/cygwin/sched.cc | 8 ++- winsup/cygwin/select.cc | 5 +- winsup/cygwin/signal.cc | 26 +++++---- winsup/cygwin/sysconf.cc | 3 +- winsup/cygwin/thread.cc | 10 ++-- winsup/cygwin/timer.cc | 39 +++++++------ winsup/cygwin/times.cc | 85 ++++++++++++++--------------- 13 files changed, 115 insertions(+), 97 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 5dfcae4d9..f0799657c 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1314,8 +1314,8 @@ fhandler_base::utimens_fs (const struct timespec *tvp) tmp[1] = tmp[0] = timeofday; else { - if ((tvp[0].tv_nsec < UTIME_NOW || tvp[0].tv_nsec > 999999999L) - || (tvp[1].tv_nsec < UTIME_NOW || tvp[1].tv_nsec > 999999999L)) + if ((tvp[0].tv_nsec < UTIME_NOW || tvp[0].tv_nsec >= NSPERSEC) + || (tvp[1].tv_nsec < UTIME_NOW || tvp[1].tv_nsec >= NSPERSEC)) { if (closeit) close_fs (); diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index ad367e457..771235f0a 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -535,9 +535,9 @@ format_proc_stat (void *, char *&destbuf) for (unsigned long i = 0; i < wincap.cpu_count (); i++) { kernel_time += (spt[i].KernelTime.QuadPart - spt[i].IdleTime.QuadPart) - * HZ / 10000000ULL; - user_time += spt[i].UserTime.QuadPart * HZ / 10000000ULL; - idle_time += spt[i].IdleTime.QuadPart * HZ / 10000000ULL; + * HZ / NS100PERSEC; + user_time += spt[i].UserTime.QuadPart * HZ / NS100PERSEC; + idle_time += spt[i].IdleTime.QuadPart * HZ / NS100PERSEC; } eobuf += __small_sprintf (eobuf, "cpu %U %U %U %U\n", @@ -546,9 +546,9 @@ format_proc_stat (void *, char *&destbuf) for (unsigned long i = 0; i < wincap.cpu_count (); i++) { interrupt_count += spt[i].InterruptCount; - kernel_time = (spt[i].KernelTime.QuadPart - spt[i].IdleTime.QuadPart) * HZ / 10000000ULL; - user_time = spt[i].UserTime.QuadPart * HZ / 10000000ULL; - idle_time = spt[i].IdleTime.QuadPart * HZ / 10000000ULL; + kernel_time = (spt[i].KernelTime.QuadPart - spt[i].IdleTime.QuadPart) * HZ / NS100PERSEC; + user_time = spt[i].UserTime.QuadPart * HZ / NS100PERSEC; + idle_time = spt[i].IdleTime.QuadPart * HZ / NS100PERSEC; eobuf += __small_sprintf (eobuf, "cpu%d %U %U %U %U\n", i, user_time, 0ULL, kernel_time, idle_time); } diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index eb5a523ff..c74844784 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -1139,19 +1139,19 @@ format_process_stat (void *data, char *&destbuf) return 0; } fault_count = vmc.PageFaultCount; - utime = put.UserTime.QuadPart * HZ / 10000000ULL; - stime = put.KernelTime.QuadPart * HZ / 10000000ULL; + utime = put.UserTime.QuadPart * HZ / NS100PERSEC; + stime = put.KernelTime.QuadPart * HZ / NS100PERSEC; #if 0 if (stodi.CurrentTime.QuadPart > put.CreateTime.QuadPart) start_time = (spt.KernelTime.QuadPart + spt.UserTime.QuadPart - - stodi.CurrentTime.QuadPart + put.CreateTime.QuadPart) * HZ / 10000000ULL; + stodi.CurrentTime.QuadPart + put.CreateTime.QuadPart) * HZ / NS100PERSEC; else /* * sometimes stodi.CurrentTime is a bit behind * Note: some older versions of procps are broken and can't cope * with process start times > time(NULL). */ - start_time = (spt.KernelTme.QuadPart + spt.UserTime.QuadPart) * HZ / 10000000ULL; + start_time = (spt.KernelTme.QuadPart + spt.UserTime.QuadPart) * HZ / NS100PERSEC; #endif /* The BasePriority returned to a 32 bit process under WOW64 is apparently broken, for 32 and 64 bit target processes. 64 bit diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h index c6a286cff..96010a605 100644 --- a/winsup/cygwin/hires.h +++ b/winsup/cygwin/hires.h @@ -29,8 +29,12 @@ details. */ /* 100ns difference between Windows and UNIX timebase. */ #define FACTOR (0x19db1ded53e8000LL) +/* # of nanosecs per second. */ +#define NSPERSEC (1000000000) /* # of 100ns intervals per second. */ -#define NSPERSEC 10000000LL +#define NS100PERSEC (10000000) +/* # of millisecs per second. */ +#define USPERSEC (1000000) class hires_base { diff --git a/winsup/cygwin/posix_ipc.cc b/winsup/cygwin/posix_ipc.cc index f5c4009ff..36e9ed9cf 100644 --- a/winsup/cygwin/posix_ipc.cc +++ b/winsup/cygwin/posix_ipc.cc @@ -183,7 +183,7 @@ ipc_cond_timedwait (HANDLE evt, HANDLE mtx, const struct timespec *abstime) { if (abstime->tv_sec < 0 || abstime->tv_nsec < 0 - || abstime->tv_nsec > 999999999) + || abstime->tv_nsec >= NSPERSEC) return EINVAL; /* If a timeout is set, we create a waitable timer to wait for. diff --git a/winsup/cygwin/resource.cc b/winsup/cygwin/resource.cc index 11a04f13d..9e39d3a04 100644 --- a/winsup/cygwin/resource.cc +++ b/winsup/cygwin/resource.cc @@ -29,9 +29,9 @@ add_timeval (struct timeval *tv1, struct timeval *tv2) { tv1->tv_sec += tv2->tv_sec; tv1->tv_usec += tv2->tv_usec; - if (tv1->tv_usec >= 1000000) + if (tv1->tv_usec >= USPERSEC) { - tv1->tv_usec -= 1000000; + tv1->tv_usec -= USPERSEC; tv1->tv_sec++; } } diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc index 3fd058ff0..b8e0a2b5d 100644 --- a/winsup/cygwin/sched.cc +++ b/winsup/cygwin/sched.cc @@ -12,8 +12,10 @@ #include "miscfuncs.h" #include "cygerrno.h" #include "pinfo.h" +#include "hires.h" /* for getpid */ #include +#include #include "registry.h" /* Win32 priority to UNIX priority Mapping. */ @@ -199,9 +201,9 @@ sched_rr_get_interval (pid_t pid, struct timespec *interval) slindex -= 1; nsec = quantable[vfindex][slindex][qindex] / quantapertick - * clocktickinterval * 1000000; - interval->tv_sec = nsec / 1000000000; - interval->tv_nsec = nsec % 1000000000; + * clocktickinterval * (NSPERSEC / HZ); + interval->tv_sec = nsec / NSPERSEC; + interval->tv_nsec = nsec % NSPERSEC; return 0; } diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 0cd2dc929..ca2cd5ab2 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -107,7 +107,10 @@ pselect (int maxfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, else { /* Convert to microseconds or -1 if to == NULL */ - LONGLONG us = to ? to->tv_sec * 1000000LL + (to->tv_nsec + 999) / 1000 : -1LL; + LONGLONG us = to ? to->tv_sec * USPERSEC + + (to->tv_nsec + (NSPERSEC/USPERSEC) - 1) + / (NSPERSEC/USPERSEC) + : -1LL; if (to) select_printf ("to->tv_sec %ld, to->tv_nsec %ld, us %D", to->tv_sec, to->tv_nsec, us); diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc index f7c56c591..e581d28da 100644 --- a/winsup/cygwin/signal.cc +++ b/winsup/cygwin/signal.cc @@ -65,7 +65,7 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, sig_dispatch_pending (); pthread_testcancel (); - if (rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 || rqtp->tv_nsec > 999999999L) + if (rqtp->tv_sec < 0 || rqtp->tv_nsec < 0 || rqtp->tv_nsec >= NSPERSEC) return EINVAL; /* Explicitly disallowed by POSIX. Needs to be checked first to avoid @@ -89,8 +89,9 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, LARGE_INTEGER timeout; - timeout.QuadPart = (LONGLONG) rqtp->tv_sec * NSPERSEC - + ((LONGLONG) rqtp->tv_nsec + 99LL) / 100LL; + timeout.QuadPart = (LONGLONG) rqtp->tv_sec * NS100PERSEC + + ((LONGLONG) rqtp->tv_nsec + (NSPERSEC/NS100PERSEC) - 1) + / (NSPERSEC/NS100PERSEC); if (abstime) { @@ -107,7 +108,8 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, else { /* other clocks need to be handled with a relative timeout */ - timeout.QuadPart -= tp.tv_sec * NSPERSEC + tp.tv_nsec / 100LL; + timeout.QuadPart -= tp.tv_sec * NS100PERSEC + + tp.tv_nsec / (NSPERSEC/NS100PERSEC); timeout.QuadPart *= -1LL; } } @@ -123,8 +125,9 @@ clock_nanosleep (clockid_t clk_id, int flags, const struct timespec *rqtp, /* according to POSIX, rmtp is used only if !abstime */ if (rmtp && !abstime) { - rmtp->tv_sec = (time_t) (timeout.QuadPart / NSPERSEC); - rmtp->tv_nsec = (long) ((timeout.QuadPart % NSPERSEC) * 100LL); + rmtp->tv_sec = (time_t) (timeout.QuadPart / NS100PERSEC); + rmtp->tv_nsec = (long) ((timeout.QuadPart % NS100PERSEC) + * (NSPERSEC/NS100PERSEC)); } syscall_printf ("%d = clock_nanosleep(%lu, %d, %ld.%09ld, %ld.%09.ld)", @@ -160,8 +163,8 @@ extern "C" unsigned int usleep (useconds_t useconds) { struct timespec req; - req.tv_sec = useconds / 1000000; - req.tv_nsec = (useconds % 1000000) * 1000; + req.tv_sec = useconds / USPERSEC; + req.tv_nsec = (useconds % USPERSEC) * (NSPERSEC/USPERSEC); int res = clock_nanosleep (CLOCK_REALTIME, 0, &req, NULL); if (res != 0) { @@ -628,14 +631,15 @@ sigtimedwait (const sigset_t *set, siginfo_t *info, const timespec *timeout) if (timeout) { if (timeout->tv_sec < 0 - || timeout->tv_nsec < 0 || timeout->tv_nsec > (NSPERSEC * 100LL)) + || timeout->tv_nsec < 0 || timeout->tv_nsec > NSPERSEC) { set_errno (EINVAL); return -1; } /* convert timespec to 100ns units */ - waittime.QuadPart = (LONGLONG) timeout->tv_sec * NSPERSEC - + ((LONGLONG) timeout->tv_nsec + 99LL) / 100LL; + waittime.QuadPart = (LONGLONG) timeout->tv_sec * NS100PERSEC + + ((LONGLONG) timeout->tv_nsec + (NSPERSEC/NS100PERSEC) - 1) + / (NSPERSEC/NS100PERSEC); } return sigwait_common (set, info, timeout ? &waittime : cw_infinite); diff --git a/winsup/cygwin/sysconf.cc b/winsup/cygwin/sysconf.cc index 9563b889a..7680cfc90 100644 --- a/winsup/cygwin/sysconf.cc +++ b/winsup/cygwin/sysconf.cc @@ -19,6 +19,7 @@ details. */ #include "ntdll.h" #include "tls_pbuf.h" #include "cpuid.h" +#include "hires.h" static long get_open_max (int in) @@ -793,7 +794,7 @@ sysinfo (struct sysinfo *info) sizeof_stodi, NULL); if (NT_SUCCESS (status)) uptime = (stodi->CurrentTime.QuadPart - stodi->BootTime.QuadPart) - / 10000000ULL; + / NS100PERSEC; else debug_printf ("NtQuerySystemInformation(SystemTimeOfDayInformation), " "status %y", status); diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index 913f7b655..9f2e18357 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -2546,7 +2546,7 @@ pthread_convert_abstime (clockid_t clock_id, const struct timespec *abstime, /* According to SUSv3, the abstime value must be checked for validity. */ if (abstime->tv_sec < 0 || abstime->tv_nsec < 0 - || abstime->tv_nsec > 999999999) + || abstime->tv_nsec >= NSPERSEC) return EINVAL; /* Check for immediate timeout before converting */ @@ -2556,8 +2556,9 @@ pthread_convert_abstime (clockid_t clock_id, const struct timespec *abstime, && tp.tv_nsec > abstime->tv_nsec)) return ETIMEDOUT; - timeout->QuadPart = abstime->tv_sec * NSPERSEC - + (abstime->tv_nsec + 99LL) / 100LL; + timeout->QuadPart = abstime->tv_sec * NS100PERSEC + + (abstime->tv_nsec + (NSPERSEC/NS100PERSEC) - 1) + / (NSPERSEC/NS100PERSEC); switch (clock_id) { case CLOCK_REALTIME: @@ -2565,7 +2566,8 @@ pthread_convert_abstime (clockid_t clock_id, const struct timespec *abstime, break; default: /* other clocks must be handled as relative timeout */ - timeout->QuadPart -= tp.tv_sec * NSPERSEC + tp.tv_nsec / 100LL; + timeout->QuadPart -= tp.tv_sec * NS100PERSEC + tp.tv_nsec + / (NSPERSEC/NS100PERSEC); timeout->QuadPart *= -1LL; break; } diff --git a/winsup/cygwin/timer.cc b/winsup/cygwin/timer.cc index 044cdda40..94679c323 100644 --- a/winsup/cygwin/timer.cc +++ b/winsup/cygwin/timer.cc @@ -14,6 +14,7 @@ details. */ #include "fhandler.h" #include "dtable.h" #include "cygheap.h" +#include #define TT_MAGIC 0x513e4a1c struct timer_tracker @@ -105,12 +106,12 @@ timer_tracker::timer_tracker (clockid_t c, const sigevent *e) } } -static long long -to_us (const timespec& ts) +static inline long long +timespec_to_us (const timespec& ts) { long long res = ts.tv_sec; - res *= 1000000; - res += ts.tv_nsec / 1000 + ((ts.tv_nsec % 1000) ? 1 : 0); + res *= USPERSEC; + res += (ts.tv_nsec + (NSPERSEC/USPERSEC) - 1) / (NSPERSEC/USPERSEC); return res; } @@ -131,7 +132,7 @@ timer_thread (VOID *x) if (sleep_us > 0) { tt->sleepto_us = sleepto_us; - sleep_ms = (sleep_us + 999) / 1000; + sleep_ms = (sleep_us + (USPERSEC/HZ) - 1) / (USPERSEC/HZ); } else { @@ -203,10 +204,10 @@ out: return 0; } -static bool -it_bad (const timespec& t) +static inline bool +timespec_bad (const timespec& t) { - if (t.tv_nsec < 0 || t.tv_nsec >= 1000000000 || t.tv_sec < 0) + if (t.tv_nsec < 0 || t.tv_nsec >= NSPERSEC || t.tv_sec < 0) { set_errno (EINVAL); return true; @@ -227,7 +228,7 @@ timer_tracker::settime (int in_flags, const itimerspec *value, itimerspec *ovalu __leave; } - if (it_bad (value->it_value) || it_bad (value->it_interval)) + if (timespec_bad (value->it_value) || timespec_bad (value->it_interval)) __leave; long long now = in_flags & TIMER_ABSTIME ? 0 : gtod.usecs (); @@ -242,8 +243,8 @@ timer_tracker::settime (int in_flags, const itimerspec *value, itimerspec *ovalu interval_us = sleepto_us = 0; else { - sleepto_us = now + to_us (value->it_value); - interval_us = to_us (value->it_interval); + sleepto_us = now + timespec_to_us (value->it_value); + interval_us = timespec_to_us (value->it_interval); it_interval = value->it_interval; if (!hcancel) hcancel = CreateEvent (&sec_none_nih, TRUE, FALSE, NULL); @@ -274,8 +275,8 @@ timer_tracker::gettime (itimerspec *ovalue) long long left_us = sleepto_us - now; if (left_us < 0) left_us = 0; - ovalue->it_value.tv_sec = left_us / 1000000; - ovalue->it_value.tv_nsec = (left_us % 1000000) * 1000; + ovalue->it_value.tv_sec = left_us / USPERSEC; + ovalue->it_value.tv_nsec = (left_us % USPERSEC) * (NSPERSEC/USPERSEC); } } @@ -481,16 +482,18 @@ ualarm (useconds_t value, useconds_t interval) Interpret negative arguments as zero */ if (value > 0) { - timer.it_value.tv_sec = value / 1000000; - timer.it_value.tv_nsec = (value % 1000000) * 1000; + timer.it_value.tv_sec = value / USPERSEC; + timer.it_value.tv_nsec = (value % USPERSEC) * (NSPERSEC/USPERSEC); } if (interval > 0) { - timer.it_interval.tv_sec = interval / 1000000; - timer.it_interval.tv_nsec = (interval % 1000000) * 1000; + timer.it_interval.tv_sec = interval / USPERSEC; + timer.it_interval.tv_nsec = (interval % USPERSEC) * (NSPERSEC/USPERSEC); } timer_settime ((timer_t) &ttstart, 0, &timer, &otimer); - useconds_t ret = otimer.it_value.tv_sec * 1000000 + (otimer.it_value.tv_nsec + 999) / 1000; + useconds_t ret = otimer.it_value.tv_sec * USPERSEC + + (otimer.it_value.tv_nsec + (NSPERSEC/USPERSEC) - 1) + / (NSPERSEC/USPERSEC); syscall_printf ("%d = ualarm(%ld , %ld)", ret, value, interval); return ret; } diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 5da0bbc7a..86e32b8bf 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -10,6 +10,7 @@ details. */ #include "winsup.h" #include #include +#include #include #include #include @@ -45,7 +46,7 @@ __to_clock_t (PLARGE_INTEGER src, int flag) if (flag) total -= FACTOR; - total /= NSPERSEC / CLOCKS_PER_SEC; + total /= NS100PERSEC / CLOCKS_PER_SEC; return total; } @@ -72,7 +73,7 @@ times (struct tms *buf) /* uptime */ ticks.QuadPart -= stodi.BootTime.QuadPart; /* ticks is in in 100ns, convert to clock ticks. */ - tc = (clock_t) (ticks.QuadPart * CLOCKS_PER_SEC / NSPERSEC); + tc = (clock_t) (ticks.QuadPart * CLOCKS_PER_SEC / NS100PERSEC); buf->tms_stime = __to_clock_t (&kut.KernelTime, 0); buf->tms_utime = __to_clock_t (&kut.UserTime, 0); @@ -102,7 +103,7 @@ settimeofday (const struct timeval *tv, const struct timezone *tz) __try { - if (tv->tv_usec < 0 || tv->tv_usec >= 1000000) + if (tv->tv_usec < 0 || tv->tv_usec >= USPERSEC) { set_errno (EINVAL); return -1; @@ -116,7 +117,7 @@ settimeofday (const struct timeval *tv, const struct timezone *tz) st.wHour = ptm->tm_hour; st.wMinute = ptm->tm_min; st.wSecond = ptm->tm_sec; - st.wMilliseconds = tv->tv_usec / 1000; + st.wMilliseconds = tv->tv_usec / (USPERSEC/HZ); res = -!SetSystemTime (&st); gtod.reset (); @@ -158,11 +159,11 @@ totimeval (struct timeval *dst, PLARGE_INTEGER src, int sub, int flag) { int64_t x = __to_clock_t (src, flag); - x *= (int64_t) 1000000 / CLOCKS_PER_SEC; /* Turn x into usecs */ - x -= (int64_t) sub * 1000000; + x *= (int64_t) USPERSEC / CLOCKS_PER_SEC; /* Turn x into usecs */ + x -= (int64_t) sub * USPERSEC; - dst->tv_usec = x % 1000000; /* And split */ - dst->tv_sec = x / 1000000; + dst->tv_usec = x % USPERSEC; /* And split */ + dst->tv_sec = x / USPERSEC; } /* FIXME: Make thread safe */ @@ -176,8 +177,8 @@ gettimeofday (struct timeval *__restrict tv, void *__restrict tzvp) if (now == (LONGLONG) -1) return -1; - tv->tv_sec = now / 1000000; - tv->tv_usec = now % 1000000; + tv->tv_sec = now / USPERSEC; + tv->tv_usec = now % USPERSEC; if (tz != NULL) { @@ -202,16 +203,16 @@ timespec_to_filetime (const struct timespec *time_in, PLARGE_INTEGER out) if (time_in->tv_nsec == UTIME_OMIT) out->QuadPart = 0; else - out->QuadPart = time_in->tv_sec * NSPERSEC - + time_in->tv_nsec / (1000000000/NSPERSEC) + FACTOR; + out->QuadPart = time_in->tv_sec * NS100PERSEC + + time_in->tv_nsec / (NSPERSEC/NS100PERSEC) + FACTOR; } /* Cygwin internal */ void __stdcall timeval_to_filetime (const struct timeval *time_in, PLARGE_INTEGER out) { - out->QuadPart = time_in->tv_sec * NSPERSEC - + time_in->tv_usec * (NSPERSEC/1000000) + FACTOR; + out->QuadPart = time_in->tv_sec * NS100PERSEC + + time_in->tv_usec * (NS100PERSEC/USPERSEC) + FACTOR; } /* Cygwin internal */ @@ -232,18 +233,18 @@ timeval_to_timespec (const struct timeval *tvp, struct timespec *tmp) return NULL; tmp[0].tv_sec = tvp[0].tv_sec; - tmp[0].tv_nsec = tvp[0].tv_usec * 1000; + tmp[0].tv_nsec = tvp[0].tv_usec * (NSPERSEC/USPERSEC); if (tmp[0].tv_nsec < 0) tmp[0].tv_nsec = 0; - else if (tmp[0].tv_nsec > 999999999) - tmp[0].tv_nsec = 999999999; + else if (tmp[0].tv_nsec >= NSPERSEC) + tmp[0].tv_nsec = NSPERSEC - 1; tmp[1].tv_sec = tvp[1].tv_sec; - tmp[1].tv_nsec = tvp[1].tv_usec * 1000; + tmp[1].tv_nsec = tvp[1].tv_usec * (NSPERSEC/USPERSEC); if (tmp[1].tv_nsec < 0) tmp[1].tv_nsec = 0; - else if (tmp[1].tv_nsec > 999999999) - tmp[1].tv_nsec = 999999999; + else if (tmp[1].tv_nsec >= NSPERSEC) + tmp[1].tv_nsec = NSPERSEC - 1; return tmp; } @@ -264,7 +265,7 @@ to_time_t (PLARGE_INTEGER ptr) return 0; x -= FACTOR; /* number of 100ns between 1601 and 1970 */ - x /= NSPERSEC; /* number of 100ns in a second */ + x /= NS100PERSEC; /* number of 100ns in a second */ return x; } @@ -277,8 +278,6 @@ to_timestruc_t (PLARGE_INTEGER ptr, timestruc_t *out) stuffed into two long words. A timestruc_t is the number of seconds and microseconds since jan 1 1970 stuffed into a time_t and a long. */ - - int64_t rem; int64_t x = ptr->QuadPart; /* pass "no time" as epoch */ @@ -290,10 +289,8 @@ to_timestruc_t (PLARGE_INTEGER ptr, timestruc_t *out) } x -= FACTOR; /* number of 100ns between 1601 and 1970 */ - rem = x % NSPERSEC; - x /= NSPERSEC; /* number of 100ns in a second */ - out->tv_nsec = rem * 100; /* as tv_nsec is in nanoseconds */ - out->tv_sec = x; + out->tv_sec = x / NS100PERSEC; + out->tv_nsec = (x % NS100PERSEC) * (NSPERSEC/NS100PERSEC); } /* Cygwin internal */ @@ -470,7 +467,7 @@ hires_ns::prime () return; } - freq = (double) ((double) 1000000000. / (double) ifreq.QuadPart); + freq = (double) ((double) NSPERSEC / (double) ifreq.QuadPart); inited = true; SetThreadPriority (GetCurrentThread (), priority); } @@ -534,8 +531,8 @@ clock_gettime (clockid_t clk_id, struct timespec *tp) &kut, sizeof kut, NULL); x = kut.KernelTime.QuadPart + kut.UserTime.QuadPart; - tp->tv_sec = x / NSPERSEC; - tp->tv_nsec = (x % NSPERSEC) * 100LL; + tp->tv_sec = x / NS100PERSEC; + tp->tv_nsec = (x % NS100PERSEC) * (NSPERSEC/NS100PERSEC); CloseHandle (hProcess); return 0; @@ -562,8 +559,8 @@ clock_gettime (clockid_t clk_id, struct timespec *tp) &kut, sizeof kut, NULL); x = kut.KernelTime.QuadPart + kut.UserTime.QuadPart; - tp->tv_sec = x / NSPERSEC; - tp->tv_nsec = (x % NSPERSEC) * 100LL; + tp->tv_sec = x / NS100PERSEC; + tp->tv_nsec = (x % NS100PERSEC) * (NSPERSEC/NS100PERSEC); CloseHandle (hThread); return 0; @@ -576,8 +573,8 @@ clock_gettime (clockid_t clk_id, struct timespec *tp) LONGLONG now = gtod.nsecs (); if (now == (LONGLONG) -1) return -1; - tp->tv_sec = now / NSPERSEC; - tp->tv_nsec = (now % NSPERSEC) * (1000000000 / NSPERSEC); + tp->tv_sec = now / NS100PERSEC; + tp->tv_nsec = (now % NS100PERSEC) * (NSPERSEC / NS100PERSEC); break; } @@ -587,8 +584,8 @@ clock_gettime (clockid_t clk_id, struct timespec *tp) if (now == (LONGLONG) -1) return -1; - tp->tv_sec = now / 1000000000; - tp->tv_nsec = (now % 1000000000); + tp->tv_sec = now / NSPERSEC; + tp->tv_nsec = (now % NSPERSEC); break; } @@ -667,8 +664,8 @@ clock_getres (clockid_t clk_id, struct timespec *tp) ULONG coarsest, finest, actual; NtQueryTimerResolution (&coarsest, &finest, &actual); - tp->tv_sec = coarsest / NSPERSEC; - tp->tv_nsec = (coarsest % NSPERSEC) * 100; + tp->tv_sec = coarsest / NS100PERSEC; + tp->tv_nsec = (coarsest % NS100PERSEC) * (NSPERSEC/NS100PERSEC); return 0; } @@ -677,16 +674,16 @@ clock_getres (clockid_t clk_id, struct timespec *tp) case CLOCK_REALTIME: { DWORD period = gtod.resolution (); - tp->tv_sec = period / NSPERSEC; - tp->tv_nsec = (period % NSPERSEC) * 100; + tp->tv_sec = period / NS100PERSEC; + tp->tv_nsec = (period % NS100PERSEC) * (NSPERSEC/NS100PERSEC); break; } case CLOCK_MONOTONIC: { LONGLONG period = ntod.resolution (); - tp->tv_sec = period / 1000000000; - tp->tv_nsec = period % 1000000000; + tp->tv_sec = period / NSPERSEC; + tp->tv_nsec = period % NSPERSEC; break; } @@ -715,7 +712,9 @@ clock_setres (clockid_t clk_id, struct timespec *tp) is < 430 secs. Actually the coarsest timer resolution is only slightly beyond 15ms, but this might change in future OS versions, so we play nice here. */ - ULONGLONG period = (tp->tv_sec * 10000000ULL) + ((tp->tv_nsec) / 100ULL); + ULONGLONG period = tp->tv_sec * NS100PERSEC + + (tp->tv_nsec + (NSPERSEC/NS100PERSEC) - 1) + / (NSPERSEC/NS100PERSEC); /* clock_setres is non-POSIX/non-Linux. On QNX, the function always rounds the incoming value to the nearest supported value. */ From 51af517cabcf2677f9ad1b8540dcd98f8e141928 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Feb 2018 15:37:48 +0100 Subject: [PATCH 248/649] Cygwin: setsockopt/getsockopt: Add missing optlen checks Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 9ff64b82e..6f96acbd2 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -842,6 +842,11 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval, SO_REUSEADDR has been set but don't call setsockopt. Instead fhandler_socket::bind sets SO_EXCLUSIVEADDRUSE if the application did not set SO_REUSEADDR. */ + if (optlen < (socklen_t) sizeof (int)) + { + set_errno (EINVAL); + __leave; + } if (fh->get_socket_type () == SOCK_STREAM) ignore = true; break; @@ -901,7 +906,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval, } } - if (optlen == sizeof (int)) + if (optlen == (socklen_t) sizeof (int)) debug_printf ("setsockopt optval=%x", *(int *) optval); /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ @@ -966,7 +971,15 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, case SO_PEERCRED: { struct ucred *cred = (struct ucred *) optval; + + if (*optlen < (socklen_t) sizeof *cred) + { + set_errno (EINVAL); + __leave; + } res = fh->getpeereid (&cred->pid, &cred->uid, &cred->gid); + if (!res) + *optlen = (socklen_t) sizeof *cred; __leave; } break; @@ -974,8 +987,14 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, case SO_REUSEADDR: { unsigned int *reuseaddr = (unsigned int *) optval; + + if (*optlen < (socklen_t) sizeof *reuseaddr) + { + set_errno (EINVAL); + __leave; + } *reuseaddr = fh->saw_reuseaddr(); - *optlen = sizeof *reuseaddr; + *optlen = (socklen_t) sizeof *reuseaddr; ignore = true; } break; From c51a0b74dcec39222d5a61189bfe4a6aa73dcf46 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Feb 2018 16:16:51 +0100 Subject: [PATCH 249/649] Cygwin: sockets: Handle SO_RCVTIMEO and SO_SNDTIMEO Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 7 ++++++ winsup/cygwin/fhandler_socket.cc | 21 ++++++++++++++-- winsup/cygwin/net.cc | 42 ++++++++++++++++++++++++++++++++ winsup/cygwin/release/2.10.1 | 13 ++++++++++ winsup/cygwin/times.cc | 16 ++++++++++++ winsup/cygwin/winsup.h | 1 + 6 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 winsup/cygwin/release/2.10.1 diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 153e3847f..a446e754e 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -523,6 +523,13 @@ class fhandler_socket: public fhandler_base void rmem (int nrmem) { _rmem = nrmem; } void wmem (int nwmem) { _wmem = nwmem; } + private: + DWORD _rcvtimeo; /* msecs */ + DWORD _sndtimeo; /* msecs */ + public: + DWORD &rcvtimeo () { return _rcvtimeo; } + DWORD &sndtimeo () { return _sndtimeo; } + private: struct _WSAPROTOCOL_INFOW *prot_info_ptr; public: diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 6eac689af..92b4db9f5 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -227,6 +227,8 @@ fhandler_socket::fhandler_socket () : wsock_events (NULL), wsock_mtx (NULL), wsock_evt (NULL), + _rcvtimeo (INFINITE), + _sndtimeo (INFINITE), prot_info_ptr (NULL), sun_path (NULL), peer_sun_path (NULL), @@ -752,6 +754,8 @@ fhandler_socket::wait_for_events (const long event_mask, const DWORD flags) int ret; long events = 0; + DWORD wfmo_timeout = 50; + DWORD timeout; WSAEVENT ev[3] = { wsock_evt, NULL, NULL }; wait_signal_arrived here (ev[1]); @@ -759,19 +763,32 @@ fhandler_socket::wait_for_events (const long event_mask, const DWORD flags) if ((ev[2] = pthread::get_cancel_event ()) != NULL) ++ev_cnt; + if (is_nonblocking () || (flags & MSG_DONTWAIT)) + timeout = 0; + else if (event_mask & FD_READ) + timeout = rcvtimeo (); + else if (event_mask & FD_WRITE) + timeout = sndtimeo (); + else + timeout = INFINITE; + while (!(ret = evaluate_events (event_mask, events, !(flags & MSG_PEEK))) && !events) { - if (is_nonblocking () || (flags & MSG_DONTWAIT)) + if (timeout == 0) { WSASetLastError (WSAEWOULDBLOCK); return SOCKET_ERROR; } - switch (WSAWaitForMultipleEvents (ev_cnt, ev, FALSE, 50, FALSE)) + if (timeout < wfmo_timeout) + wfmo_timeout = timeout; + switch (WSAWaitForMultipleEvents (ev_cnt, ev, FALSE, wfmo_timeout, FALSE)) { case WSA_WAIT_TIMEOUT: case WSA_WAIT_EVENT_0: + if (timeout != INFINITE) + timeout -= wfmo_timeout; break; case WSA_WAIT_EVENT_0 + 1: diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 6f96acbd2..43da5dcac 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -851,6 +851,21 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval, ignore = true; break; + case SO_RCVTIMEO: + case SO_SNDTIMEO: + if (optlen < (socklen_t) sizeof (struct timeval)) + { + set_errno (EINVAL); + __leave; + } + if (timeval_to_ms ((struct timeval *) optval, + (optname == SO_RCVTIMEO) + ? fh->rcvtimeo () : fh->sndtimeo ())) + res = 0; + else + set_errno (EDOM); + __leave; + default: break; } @@ -999,6 +1014,33 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, } break; + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + struct timeval *time_out = (struct timeval *) optval; + + if (*optlen < (socklen_t) sizeof *time_out) + { + set_errno (EINVAL); + __leave; + } + DWORD ms = (optname == SO_RCVTIMEO) ? fh->rcvtimeo () + : fh->sndtimeo (); + if (ms == 0 || ms == INFINITE) + { + time_out->tv_sec = 0; + time_out->tv_usec = 0; + } + else + { + time_out->tv_sec = ms / HZ; + time_out->tv_usec = ((ms % HZ) * USPERSEC) / HZ; + } + *optlen = (socklen_t) sizeof *time_out; + res = 0; + __leave; + } + default: break; } diff --git a/winsup/cygwin/release/2.10.1 b/winsup/cygwin/release/2.10.1 new file mode 100644 index 000000000..f8fd4cb42 --- /dev/null +++ b/winsup/cygwin/release/2.10.1 @@ -0,0 +1,13 @@ +What's new: +----------- + + +What changed: +------------- + +- SO_RCVTIMEO and SO_SNDTIMEO socket options are now honored. + + +Bug Fixes +--------- + diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 86e32b8bf..198fc32ce 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -215,6 +215,22 @@ timeval_to_filetime (const struct timeval *time_in, PLARGE_INTEGER out) + time_in->tv_usec * (NS100PERSEC/USPERSEC) + FACTOR; } +/* Cygwin internal */ +bool +timeval_to_ms (const struct timeval *time_in, DWORD &ms) +{ + if (time_in->tv_sec < 0 || time_in->tv_usec < 0 + || time_in->tv_usec >= USPERSEC) + return false; + if ((time_in->tv_sec == 0 && time_in->tv_usec == 0) + || time_in->tv_sec >= INFINITE / HZ) + ms = INFINITE; + else + ms = time_in->tv_sec * HZ + (time_in->tv_usec + (USPERSEC/HZ) - 1) + / (USPERSEC/HZ); + return true; +} + /* Cygwin internal */ static timeval __stdcall time_t_to_timeval (time_t in) diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index fcb08e213..1b3fbfeee 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -206,6 +206,7 @@ void __stdcall to_timestruc_t (PLARGE_INTEGER, timestruc_t *); void __stdcall time_as_timestruc_t (timestruc_t *); void __stdcall timeval_to_filetime (const struct timeval *, PLARGE_INTEGER); void __stdcall timespec_to_filetime (const struct timespec *, PLARGE_INTEGER); +bool timeval_to_ms (const struct timeval *, DWORD &); /* Console related */ void __stdcall set_console_title (char *); From 283e0137c784ef2915c148633fa966ba7810fe70 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Feb 2018 17:34:59 +0100 Subject: [PATCH 250/649] Cygwin: Fix x86 compiler warning The previous patch introduced a compiler warning on x86. Given time_t is only 4 bytes on x86 we get a long vs. unsigned long comparison in timeval_to_ms. Fix it by careful casting. Signed-off-by: Corinna Vinschen --- winsup/cygwin/times.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 198fc32ce..677376e2c 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -223,7 +223,7 @@ timeval_to_ms (const struct timeval *time_in, DWORD &ms) || time_in->tv_usec >= USPERSEC) return false; if ((time_in->tv_sec == 0 && time_in->tv_usec == 0) - || time_in->tv_sec >= INFINITE / HZ) + || time_in->tv_sec >= (time_t) (INFINITE / HZ)) ms = INFINITE; else ms = time_in->tv_sec * HZ + (time_in->tv_usec + (USPERSEC/HZ) - 1) From 58f72783eec1c15a1d9835ada22c9b003cf41ad9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 12 Feb 2018 21:21:58 +0100 Subject: [PATCH 251/649] Cygwin: Define MSPERSEC and fix USPERSEC comment Signed-off-by: Corinna Vinschen --- winsup/cygwin/hires.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h index 96010a605..a28efcdd7 100644 --- a/winsup/cygwin/hires.h +++ b/winsup/cygwin/hires.h @@ -33,8 +33,10 @@ details. */ #define NSPERSEC (1000000000) /* # of 100ns intervals per second. */ #define NS100PERSEC (10000000) -/* # of millisecs per second. */ +/* # of microsecs per second. */ #define USPERSEC (1000000) +/* # of millisecs per second. */ +#define MSPERSEC (1000) class hires_base { From 01c643e49fe93b9b70f3b83469e041f6754ebe5b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 12 Feb 2018 22:08:42 +0100 Subject: [PATCH 252/649] Cygwin: Drop HZ usage in favor of MSPERSEC and CLOCKS_PER_SEC Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_proc.cc | 13 +++++++------ winsup/cygwin/fhandler_process.cc | 13 ++++++++----- winsup/cygwin/net.cc | 4 ++-- winsup/cygwin/sched.cc | 2 +- winsup/cygwin/timer.cc | 3 ++- winsup/cygwin/times.cc | 9 +++++---- 6 files changed, 25 insertions(+), 19 deletions(-) diff --git a/winsup/cygwin/fhandler_proc.cc b/winsup/cygwin/fhandler_proc.cc index 771235f0a..942cc9694 100644 --- a/winsup/cygwin/fhandler_proc.cc +++ b/winsup/cygwin/fhandler_proc.cc @@ -535,9 +535,9 @@ format_proc_stat (void *, char *&destbuf) for (unsigned long i = 0; i < wincap.cpu_count (); i++) { kernel_time += (spt[i].KernelTime.QuadPart - spt[i].IdleTime.QuadPart) - * HZ / NS100PERSEC; - user_time += spt[i].UserTime.QuadPart * HZ / NS100PERSEC; - idle_time += spt[i].IdleTime.QuadPart * HZ / NS100PERSEC; + * CLOCKS_PER_SEC / NS100PERSEC; + user_time += spt[i].UserTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; + idle_time += spt[i].IdleTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; } eobuf += __small_sprintf (eobuf, "cpu %U %U %U %U\n", @@ -546,9 +546,10 @@ format_proc_stat (void *, char *&destbuf) for (unsigned long i = 0; i < wincap.cpu_count (); i++) { interrupt_count += spt[i].InterruptCount; - kernel_time = (spt[i].KernelTime.QuadPart - spt[i].IdleTime.QuadPart) * HZ / NS100PERSEC; - user_time = spt[i].UserTime.QuadPart * HZ / NS100PERSEC; - idle_time = spt[i].IdleTime.QuadPart * HZ / NS100PERSEC; + kernel_time = (spt[i].KernelTime.QuadPart - spt[i].IdleTime.QuadPart) + * CLOCKS_PER_SEC / NS100PERSEC; + user_time = spt[i].UserTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; + idle_time = spt[i].IdleTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; eobuf += __small_sprintf (eobuf, "cpu%d %U %U %U %U\n", i, user_time, 0ULL, kernel_time, idle_time); } diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index c74844784..f67c2de8d 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -1092,7 +1092,8 @@ format_process_stat (void *data, char *&destbuf) state = 'T'; else state = get_process_state (p->dwProcessId); - start_time = (GetTickCount () / 1000 - time (NULL) + p->start_time) * HZ; + start_time = (GetTickCount () / MSPERSEC - time (NULL) + p->start_time) + * CLOCKS_PER_SEC; NTSTATUS status; HANDLE hProcess; @@ -1139,19 +1140,21 @@ format_process_stat (void *data, char *&destbuf) return 0; } fault_count = vmc.PageFaultCount; - utime = put.UserTime.QuadPart * HZ / NS100PERSEC; - stime = put.KernelTime.QuadPart * HZ / NS100PERSEC; + utime = put.UserTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; + stime = put.KernelTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; #if 0 if (stodi.CurrentTime.QuadPart > put.CreateTime.QuadPart) start_time = (spt.KernelTime.QuadPart + spt.UserTime.QuadPart - - stodi.CurrentTime.QuadPart + put.CreateTime.QuadPart) * HZ / NS100PERSEC; + stodi.CurrentTime.QuadPart + put.CreateTime.QuadPart) + * CLOCKS_PER_SEC / NS100PERSEC; else /* * sometimes stodi.CurrentTime is a bit behind * Note: some older versions of procps are broken and can't cope * with process start times > time(NULL). */ - start_time = (spt.KernelTme.QuadPart + spt.UserTime.QuadPart) * HZ / NS100PERSEC; + start_time = (spt.KernelTme.QuadPart + spt.UserTime.QuadPart) + * CLOCKS_PER_SEC / NS100PERSEC; #endif /* The BasePriority returned to a 32 bit process under WOW64 is apparently broken, for 32 and 64 bit target processes. 64 bit diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 43da5dcac..c7bd73611 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -1033,8 +1033,8 @@ cygwin_getsockopt (int fd, int level, int optname, void *optval, } else { - time_out->tv_sec = ms / HZ; - time_out->tv_usec = ((ms % HZ) * USPERSEC) / HZ; + time_out->tv_sec = ms / MSPERSEC; + time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; } *optlen = (socklen_t) sizeof *time_out; res = 0; diff --git a/winsup/cygwin/sched.cc b/winsup/cygwin/sched.cc index b8e0a2b5d..a32e9424d 100644 --- a/winsup/cygwin/sched.cc +++ b/winsup/cygwin/sched.cc @@ -201,7 +201,7 @@ sched_rr_get_interval (pid_t pid, struct timespec *interval) slindex -= 1; nsec = quantable[vfindex][slindex][qindex] / quantapertick - * clocktickinterval * (NSPERSEC / HZ); + * clocktickinterval * (NSPERSEC / MSPERSEC); interval->tv_sec = nsec / NSPERSEC; interval->tv_nsec = nsec % NSPERSEC; diff --git a/winsup/cygwin/timer.cc b/winsup/cygwin/timer.cc index 94679c323..9d3d7dc94 100644 --- a/winsup/cygwin/timer.cc +++ b/winsup/cygwin/timer.cc @@ -132,7 +132,8 @@ timer_thread (VOID *x) if (sleep_us > 0) { tt->sleepto_us = sleepto_us; - sleep_ms = (sleep_us + (USPERSEC/HZ) - 1) / (USPERSEC/HZ); + sleep_ms = (sleep_us + (USPERSEC / MSPERSEC) - 1) + / (USPERSEC / MSPERSEC); } else { diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index 677376e2c..11fb8f257 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -117,7 +117,7 @@ settimeofday (const struct timeval *tv, const struct timezone *tz) st.wHour = ptm->tm_hour; st.wMinute = ptm->tm_min; st.wSecond = ptm->tm_sec; - st.wMilliseconds = tv->tv_usec / (USPERSEC/HZ); + st.wMilliseconds = tv->tv_usec / (USPERSEC / MSPERSEC); res = -!SetSystemTime (&st); gtod.reset (); @@ -223,11 +223,12 @@ timeval_to_ms (const struct timeval *time_in, DWORD &ms) || time_in->tv_usec >= USPERSEC) return false; if ((time_in->tv_sec == 0 && time_in->tv_usec == 0) - || time_in->tv_sec >= (time_t) (INFINITE / HZ)) + || time_in->tv_sec >= (time_t) (INFINITE / MSPERSEC)) ms = INFINITE; else - ms = time_in->tv_sec * HZ + (time_in->tv_usec + (USPERSEC/HZ) - 1) - / (USPERSEC/HZ); + ms = time_in->tv_sec * MSPERSEC + + (time_in->tv_usec + (USPERSEC / MSPERSEC) - 1) + / (USPERSEC / MSPERSEC); return true; } From e113d126848f57fb5113cb76dfe9521e1521b79b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 12 Feb 2018 22:10:08 +0100 Subject: [PATCH 253/649] Cygwin: /proc//stat: Fix time handling * Use 64 bit timestamps * Use System boot and process start time to compute starttime value per Linux proc.5 description. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_process.cc | 55 +++++++++++-------------------- 1 file changed, 19 insertions(+), 36 deletions(-) diff --git a/winsup/cygwin/fhandler_process.cc b/winsup/cygwin/fhandler_process.cc index f67c2de8d..8df55ece9 100644 --- a/winsup/cygwin/fhandler_process.cc +++ b/winsup/cygwin/fhandler_process.cc @@ -1065,9 +1065,8 @@ format_process_stat (void *data, char *&destbuf) char cmd[NAME_MAX + 1]; int state = 'R'; unsigned long fault_count = 0UL, - utime = 0UL, stime = 0UL, - start_time = 0UL, vmsize = 0UL, vmrss = 0UL, vmmaxrss = 0UL; + uint64_t utime = 0ULL, stime = 0ULL, start_time = 0ULL; int priority = 0; if (p->process_state & PID_EXITED) strcpy (cmd, ""); @@ -1092,8 +1091,6 @@ format_process_stat (void *data, char *&destbuf) state = 'T'; else state = get_process_state (p->dwProcessId); - start_time = (GetTickCount () / MSPERSEC - time (NULL) + p->start_time) - * CLOCKS_PER_SEC; NTSTATUS status; HANDLE hProcess; @@ -1105,28 +1102,26 @@ format_process_stat (void *data, char *&destbuf) SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION spt; hProcess = OpenProcess (PROCESS_QUERY_LIMITED_INFORMATION | PROCESS_VM_READ, FALSE, p->dwProcessId); - if (hProcess != NULL) - { - status = NtQueryInformationProcess (hProcess, ProcessVmCounters, - (PVOID) &vmc, sizeof vmc, NULL); - if (NT_SUCCESS (status)) - status = NtQueryInformationProcess (hProcess, ProcessTimes, - (PVOID) &put, sizeof put, NULL); - if (NT_SUCCESS (status)) - status = NtQueryInformationProcess (hProcess, ProcessBasicInformation, - (PVOID) &pbi, sizeof pbi, NULL); - if (NT_SUCCESS (status)) - status = NtQueryInformationProcess (hProcess, ProcessQuotaLimits, - (PVOID) &ql, sizeof ql, NULL); - CloseHandle (hProcess); - } - else + if (hProcess == NULL) { DWORD error = GetLastError (); __seterrno_from_win_error (error); debug_printf ("OpenProcess: ret %u", error); return 0; } + + status = NtQueryInformationProcess (hProcess, ProcessVmCounters, + (PVOID) &vmc, sizeof vmc, NULL); + if (NT_SUCCESS (status)) + status = NtQueryInformationProcess (hProcess, ProcessTimes, + (PVOID) &put, sizeof put, NULL); + if (NT_SUCCESS (status)) + status = NtQueryInformationProcess (hProcess, ProcessBasicInformation, + (PVOID) &pbi, sizeof pbi, NULL); + if (NT_SUCCESS (status)) + status = NtQueryInformationProcess (hProcess, ProcessQuotaLimits, + (PVOID) &ql, sizeof ql, NULL); + CloseHandle (hProcess); if (NT_SUCCESS (status)) status = NtQuerySystemInformation (SystemTimeOfDayInformation, (PVOID) &stodi, sizeof stodi, NULL); @@ -1142,20 +1137,8 @@ format_process_stat (void *data, char *&destbuf) fault_count = vmc.PageFaultCount; utime = put.UserTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; stime = put.KernelTime.QuadPart * CLOCKS_PER_SEC / NS100PERSEC; -#if 0 - if (stodi.CurrentTime.QuadPart > put.CreateTime.QuadPart) - start_time = (spt.KernelTime.QuadPart + spt.UserTime.QuadPart - - stodi.CurrentTime.QuadPart + put.CreateTime.QuadPart) - * CLOCKS_PER_SEC / NS100PERSEC; - else - /* - * sometimes stodi.CurrentTime is a bit behind - * Note: some older versions of procps are broken and can't cope - * with process start times > time(NULL). - */ - start_time = (spt.KernelTme.QuadPart + spt.UserTime.QuadPart) - * CLOCKS_PER_SEC / NS100PERSEC; -#endif + start_time = (put.CreateTime.QuadPart - stodi.BootTime.QuadPart) + * CLOCKS_PER_SEC / NS100PERSEC; /* The BasePriority returned to a 32 bit process under WOW64 is apparently broken, for 32 and 64 bit target processes. 64 bit processes get the correct base priority, even for 32 bit processes. */ @@ -1172,8 +1155,8 @@ format_process_stat (void *data, char *&destbuf) return __small_sprintf (destbuf, "%d (%s) %c " "%d %d %d %d %d " "%u %lu %lu %u %u %lu %lu " - "%ld %ld %d %d %d %d " - "%lu %lu " + "%U %U %d %d %d %d " + "%U %lu " "%ld %lu", p->pid, cmd, state, p->ppid, p->pgid, p->sid, p->ctty, -1, From 09d32b7480aaa27b92e69fb74c4baecdb54369d0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 14 Feb 2018 10:31:02 +0100 Subject: [PATCH 254/649] Cygwin: improve a comment in fhandler_socket::getsockname Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 92b4db9f5..fa2bdf341 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -1411,9 +1411,8 @@ fhandler_socket::getsockname (struct sockaddr *name, int *namelen) } else { - /* Always use a local big enough buffer and truncate later as necessary - per POSIX. WinSock unfortunaltey only returns WSAEFAULT if the buffer - is too small. */ + /* WinSock just returns WSAEFAULT if the buffer is too small. Use a + big enough local buffer and truncate later as necessary, per POSIX. */ struct sockaddr_storage sock; int len = sizeof sock; res = ::getsockname (get_socket (), (struct sockaddr *) &sock, &len); From 1188d308bf254a85c2cdfca86453bd684cffb7ef Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 14 Feb 2018 10:20:42 +0100 Subject: [PATCH 255/649] Cygwin: fix file-related functions on unix sockets * Fix an incorrect condition to recognize AF_LOCAL sockets in file-related functions (fchmod, fchown, fstat, fsttavfs, facl, link). * Return successfully when called on unnamed or abstract AF_LOCAL sockets, except link, just as on Linux. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 39 +++++++++++++++++++++++++++----- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index fa2bdf341..2d043bded 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -39,6 +39,7 @@ #include "wininfo.h" #include #include +#include #include #include "cygtls.h" #include @@ -947,8 +948,21 @@ int __reg2 fhandler_socket::fstat (struct stat *buf) { int res; - if (get_device () == FH_UNIX) + if (get_addr_family () == AF_LOCAL) { + if (!get_sun_path () || get_sun_path ()[0] == '\0') + { + memset (buf, 0, sizeof *buf); + buf->st_dev = FH_UNIX; + buf->st_ino = get_plain_ino (); + buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO; + buf->st_nlink = 1; + buf->st_uid = myself->uid; + buf->st_gid = myself->gid; + time_as_timestruc_t (&buf->st_ctim); + buf->st_blksize = 4096; + return 0; + } res = fhandler_base::fstat_fs (buf); if (!res) { @@ -975,8 +989,15 @@ fhandler_socket::fstat (struct stat *buf) int __reg2 fhandler_socket::fstatvfs (struct statvfs *sfs) { - if (get_device () == FH_UNIX) + if (get_addr_family () == AF_LOCAL) { + if (!get_sun_path () || get_sun_path ()[0] == '\0') + { + memset (sfs, 0, sizeof (*sfs)); + sfs->f_bsize = sfs->f_frsize = 4096; + sfs->f_namemax = NAME_MAX; + return 0; + } fhandler_disk_file fh (pc); fh.get_device () = FH_FS; return fh.fstatvfs (sfs); @@ -988,8 +1009,10 @@ fhandler_socket::fstatvfs (struct statvfs *sfs) int fhandler_socket::fchmod (mode_t mode) { - if (get_device () == FH_UNIX) + if (get_addr_family () == AF_LOCAL) { + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return 0; fhandler_disk_file fh (pc); fh.get_device () = FH_FS; int ret = fh.fchmod (S_IFSOCK | adjust_socket_file_mode (mode)); @@ -1002,8 +1025,10 @@ fhandler_socket::fchmod (mode_t mode) int fhandler_socket::fchown (uid_t uid, gid_t gid) { - if (get_device () == FH_UNIX) + if (get_addr_family () == AF_LOCAL) { + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return 0; fhandler_disk_file fh (pc); return fh.fchown (uid, gid); } @@ -1014,8 +1039,10 @@ fhandler_socket::fchown (uid_t uid, gid_t gid) int fhandler_socket::facl (int cmd, int nentries, aclent_t *aclbufp) { - if (get_device () == FH_UNIX) + if (get_addr_family () == AF_LOCAL) { + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_base::facl (cmd, nentries, aclbufp); fhandler_disk_file fh (pc); return fh.facl (cmd, nentries, aclbufp); } @@ -1026,7 +1053,7 @@ fhandler_socket::facl (int cmd, int nentries, aclent_t *aclbufp) int fhandler_socket::link (const char *newpath) { - if (get_device () == FH_UNIX) + if (get_addr_family () == AF_LOCAL) { fhandler_disk_file fh (pc); return fh.link (newpath); From 7ae73be14194ccadc9a7557be33c3940ca4667cb Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 14 Feb 2018 12:55:24 +0100 Subject: [PATCH 256/649] Cygwin: improve O_TMPFILE handling Windows does not remove FILE_ATTRIBUTE_TEMPORARY by itself after a file has been closed. It's just some attribute which can be set or removed at will, despite its purpose. Apparently there are tools out there which use FILE_ATTRIBUTE_TEMPORARY accidentally or wrongly, even Microsoft's own tools are affected. In the end, the filesystem is potentially full of files with this attribute set. Implement O_TMPFILE files with FILE_ATTRIBUTE_TEMPORARY and FILE_ATTRIBUTE_HIDDEN set. This combination is pretty unlikely. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.cc | 7 +++++-- winsup/cygwin/fhandler.h | 2 ++ winsup/cygwin/fhandler_disk_file.cc | 31 +++++++++++++++++++---------- 3 files changed, 28 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 7da1c4e84..086be7311 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -603,11 +603,14 @@ fhandler_base::open (int flags, mode_t mode) as with FILE_ATTRIBUTE_TEMPORARY. The latter speeds up file access, because the OS tries to keep the file in memory as much as possible. In conjunction with FILE_DELETE_ON_CLOSE, ideally the OS never has - to write to the disk at all. */ + to write to the disk at all. + Note that O_TMPFILE_FILE_ATTRS also sets the DOS HIDDEN attribute + to help telling Cygwin O_TMPFILE files apart from other files + accidentally setting FILE_ATTRIBUTE_TEMPORARY. */ if (flags & O_TMPFILE) { access |= DELETE; - file_attributes |= FILE_ATTRIBUTE_TEMPORARY; + file_attributes |= O_TMPFILE_FILE_ATTRS; options |= FILE_DELETE_ON_CLOSE; } diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index a446e754e..9d2b26342 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -37,6 +37,8 @@ details. */ never be used in Cygwin for this function. */ #define PIPE_ADD_PID FILE_FLAG_FIRST_PIPE_INSTANCE +#define O_TMPFILE_FILE_ATTRS (FILE_ATTRIBUTE_TEMPORARY | FILE_ATTRIBUTE_HIDDEN) + extern const char *windows_device_names[]; extern struct __cygwin_perfile *perfile_table; #define __fmode (*(user_data->fmode_ptr)) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index f0799657c..cb6be2590 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1243,16 +1243,28 @@ fhandler_disk_file::link (const char *newpath) __seterrno_from_nt_status (status); return -1; } - else if (pc.file_attributes () & FILE_ATTRIBUTE_TEMPORARY) + else if ((pc.file_attributes () & O_TMPFILE_FILE_ATTRS) + == O_TMPFILE_FILE_ATTRS) { - /* If the original file has been opened with O_TMPFILE the file has - FILE_ATTRIBUTE_TEMPORARY set. After a successful hardlink the - file is not temporary anymore in the usual sense. So we remove - FILE_ATTRIBUTE_TEMPORARY here, even if this makes the original file - visible in directory enumeration. */ + /* An O_TMPFILE file has FILE_ATTRIBUTE_TEMPORARY and + FILE_ATTRIBUTE_HIDDEN set. After a successful hardlink the file is + not temporary anymore in the usual sense. So we remove these + attributes here, even if this makes the original link (temporarily) + visible in directory enumeration. + + Note that we don't create a reopen attribute for the original + link but rather a normal attribute for the just created link. + The reason is a curious behaviour of Windows: If we remove + the O_TMPFILE attributes on the original link, the new link + will not show up in file system listings, long after the original + link has been closed and removed. The file and its metadata will + be kept in memory only as long as Windows sees fit. By opening + the new link, we request the attribute changes on the new link, + so after closing it Windows will have an increased interest to + write back the metadata. */ OBJECT_ATTRIBUTES attr; status = NtOpenFile (&fh, FILE_WRITE_ATTRIBUTES, - pc.init_reopen_attr (attr, fh), &io, + newpc.get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT); if (!NT_SUCCESS (status)) debug_printf ("Opening for removing TEMPORARY attrib failed, " @@ -1263,8 +1275,7 @@ fhandler_disk_file::link (const char *newpath) fbi.CreationTime.QuadPart = fbi.LastAccessTime.QuadPart = fbi.LastWriteTime.QuadPart = fbi.ChangeTime.QuadPart = 0LL; - fbi.FileAttributes = (pc.file_attributes () - & ~FILE_ATTRIBUTE_TEMPORARY) + fbi.FileAttributes = (pc.file_attributes () & ~O_TMPFILE_FILE_ATTRS) ?: FILE_ATTRIBUTE_NORMAL; status = NtSetInformationFile (fh, &io, &fbi, sizeof fbi, FileBasicInformation); @@ -2213,7 +2224,7 @@ go_ahead: } /* We don't show O_TMPFILE files in the filesystem. This is a kludge, so we may end up removing this snippet again. */ - if (FileAttributes & FILE_ATTRIBUTE_TEMPORARY) + if ((FileAttributes & O_TMPFILE_FILE_ATTRS) == O_TMPFILE_FILE_ATTRS) goto restart; RtlInitCountedUnicodeString (&fname, FileName, FileNameLength); d_mounts (dir)->check_mount (&fname); From 913c6ca2c1467893bb0c3b7598cccdb02ca9f598 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 14 Feb 2018 22:21:58 +0100 Subject: [PATCH 257/649] Cygwin: socket: move socket creation inside fhandler_socket class Add fhandler_socket::socket method Add fhandler_socket::set_socket_handle method, basically duplicating what fdsock is doing. This is the first step in getting rid of fdsock. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 5 ++ winsup/cygwin/fhandler_socket.cc | 117 +++++++++++++++++++++++++++++++ winsup/cygwin/net.cc | 92 ++++++++++++------------ 3 files changed, 167 insertions(+), 47 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 9d2b26342..e1659db5a 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -556,6 +556,10 @@ class fhandler_socket: public fhandler_base {} } status; +#ifdef __INSIDE_CYGWIN_NET__ + int set_socket_handle (SOCKET sock); +#endif + public: fhandler_socket (); ~fhandler_socket (); @@ -576,6 +580,7 @@ class fhandler_socket: public fhandler_base IMPLEMENT_STATUS_FLAG (conn_state, connect_state) IMPLEMENT_STATUS_FLAG (bool, no_getpeereid) + int socket (int af, int type, int protocol, int flags); int bind (const struct sockaddr *name, int namelen); int connect (const struct sockaddr *name, int namelen); int listen (int backlog); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 2d043bded..a30b49511 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -262,6 +262,120 @@ fhandler_socket::open (int flags, mode_t mode) return 0; } +int +fhandler_socket::set_socket_handle (SOCKET sock) +{ + DWORD flags; + bool lsp_fixup = false; + + /* Usually sockets are inheritable IFS objects. Unfortunately some virus + scanners or other network-oriented software replace normal sockets + with their own kind, which is running through a filter driver called + "layered service provider" (LSP) which, fortunately, are deprecated. + + LSP sockets are not kernel objects. They are typically not marked as + inheritable, nor are they IFS handles. They are in fact not inheritable + to child processes, and it does not help to mark them inheritable via + SetHandleInformation. Subsequent socket calls in the child process fail + with error 10038, WSAENOTSOCK. + + There's a neat way to workaround these annoying LSP sockets. WSAIoctl + allows to fetch the underlying base socket, which is a normal, inheritable + IFS handle. So we fetch the base socket, duplicate it, and close the + original socket. Now we have a standard IFS socket which (hopefully) + works as expected. + + If that doesn't work for some reason, mark the sockets for duplication + via WSADuplicateSocket/WSASocket. This requires to start the child + process in SUSPENDED state so we only do this if really necessary. */ + if (!GetHandleInformation ((HANDLE) sock, &flags) + || !(flags & HANDLE_FLAG_INHERIT)) + { + int ret; + SOCKET base_sock; + DWORD bret; + + lsp_fixup = true; + debug_printf ("LSP handle: %p", sock); + ret = WSAIoctl (sock, SIO_BASE_HANDLE, NULL, 0, (void *) &base_sock, + sizeof (base_sock), &bret, NULL, NULL); + if (ret) + debug_printf ("WSAIoctl: %u", WSAGetLastError ()); + else if (base_sock != sock) + { + if (GetHandleInformation ((HANDLE) base_sock, &flags) + && (flags & HANDLE_FLAG_INHERIT)) + { + if (!DuplicateHandle (GetCurrentProcess (), (HANDLE) base_sock, + GetCurrentProcess (), (PHANDLE) &base_sock, + 0, TRUE, DUPLICATE_SAME_ACCESS)) + debug_printf ("DuplicateHandle failed, %E"); + else + { + closesocket (sock); + sock = base_sock; + lsp_fixup = false; + } + } + } + } + set_io_handle ((HANDLE) sock); + if (!init_events ()) + { + closesocket (sock); + return -1; + } + if (lsp_fixup) + init_fixup_before (); + set_flags (O_RDWR | O_BINARY); + set_unique_id (); + if (get_socket_type () == SOCK_DGRAM) + { + /* Workaround the problem that a missing listener on a UDP socket + in a call to sendto will result in select/WSAEnumNetworkEvents + reporting that the socket has pending data and a subsequent call + to recvfrom will return -1 with error set to WSAECONNRESET. + + This problem is a regression introduced in Windows 2000. + Instead of fixing the problem, a new socket IOCTL code has + been added, see http://support.microsoft.com/kb/263823 */ + BOOL cr = FALSE; + DWORD blen; + if (WSAIoctl (sock, SIO_UDP_CONNRESET, &cr, sizeof cr, NULL, 0, + &blen, NULL, NULL) == SOCKET_ERROR) + debug_printf ("Reset SIO_UDP_CONNRESET: WinSock error %u", + WSAGetLastError ()); + } +#ifdef __x86_64__ + rmem () = 212992; + wmem () = 212992; +#else + rmem () = 64512; + wmem () = 64512; +#endif + return 0; +} + +int +fhandler_socket::socket (int af, int type, int protocol, int flags) +{ + SOCKET sock; + + sock = ::socket (af == AF_LOCAL ? AF_INET : af, type, protocol); + if (sock == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + set_addr_family (af); + set_socket_type (type); + if (flags & SOCK_NONBLOCK) + set_nonblocking (true); + if (flags & SOCK_CLOEXEC) + set_close_on_exec (true); + return set_socket_handle (sock); +} + void fhandler_socket::af_local_set_sockpair_cred () { @@ -635,6 +749,9 @@ fhandler_socket::init_events () } /* sock type not yet set here. */ + /* FIXME: as soon as we switch to socket method, we're good to use + get_socket_type (). */ + if (pc.dev == FH_UDP || pc.dev == FH_DGRAM) wsock_events->events = FD_WRITE; return true; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index c7bd73611..8497d5944 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -655,68 +655,66 @@ extern "C" int cygwin_socket (int af, int type, int protocol) { int res = -1; - SOCKET soc = 0; + const device *dev; + fhandler_socket *fh; int flags = type & _SOCK_FLAG_MASK; type &= ~_SOCK_FLAG_MASK; debug_printf ("socket (%d, %d (flags %y), %d)", af, type, flags, protocol); + switch (af) + { + case AF_LOCAL: + if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + goto done; + } + if (protocol != 0) + { + set_errno (EPROTONOSUPPORT); + goto done; + } + dev = type == SOCK_STREAM ? stream_dev : dgram_dev; + break; + case AF_INET: + case AF_INET6: + if (type != SOCK_STREAM && type != SOCK_DGRAM && type != SOCK_RAW) + { + set_errno (EINVAL); + goto done; + } + dev = type == SOCK_STREAM ? tcp_dev : udp_dev; + break; + default: + set_errno (EAFNOSUPPORT); + goto done; + } + if ((flags & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)) != 0) { set_errno (EINVAL); goto done; } - soc = socket (af == AF_LOCAL ? AF_INET : af, type, - af == AF_LOCAL ? 0 : protocol); - - if (soc == INVALID_SOCKET) { - set_winsock_errno (); - goto done; + cygheap_fdnew fd; + + if (fd < 0) + goto done; + fh = (fhandler_socket *) build_fh_dev (*dev); + if (fh && fh->socket (af, type, protocol, flags) == 0) + { + fd = fh; + if (fd <= 2) + set_std_handle (fd); + res = fd; + } + else + fd.release (); } - const device *dev; - - if (af == AF_LOCAL) - dev = type == SOCK_STREAM ? stream_dev : dgram_dev; - else - dev = type == SOCK_STREAM ? tcp_dev : udp_dev; - - { - cygheap_fdnew fd; - if (fd < 0 || !fdsock (fd, dev, soc)) - closesocket (soc); - else - { - ((fhandler_socket *) fd)->set_addr_family (af); - ((fhandler_socket *) fd)->set_socket_type (type); - if (flags & SOCK_NONBLOCK) - ((fhandler_socket *) fd)->set_nonblocking (true); - if (flags & SOCK_CLOEXEC) - ((fhandler_socket *) fd)->set_close_on_exec (true); - if (type == SOCK_DGRAM) - { - /* Workaround the problem that a missing listener on a UDP socket - in a call to sendto will result in select/WSAEnumNetworkEvents - reporting that the socket has pending data and a subsequent call - to recvfrom will return -1 with error set to WSAECONNRESET. - - This problem is a regression introduced in Windows 2000. - Instead of fixing the problem, a new socket IOCTL code has - been added, see http://support.microsoft.com/kb/263823 */ - BOOL cr = FALSE; - DWORD blen; - if (WSAIoctl (soc, SIO_UDP_CONNRESET, &cr, sizeof cr, NULL, 0, - &blen, NULL, NULL) == SOCKET_ERROR) - debug_printf ("Reset SIO_UDP_CONNRESET: WinSock error %u", - WSAGetLastError ()); - } - res = fd; - } - } - done: syscall_printf ("%R = socket(%d, %d (flags %y), %d)", res, af, type, flags, protocol); From fdc5f5280880b1a31386a713512f092bee5a9a57 Mon Sep 17 00:00:00 2001 From: Jaap de Wolff Date: Mon, 12 Feb 2018 12:23:41 +0100 Subject: [PATCH 258/649] Add define _COMPILING_NEWLIB for arm to configure.host, as it is obviously needed Signed-off-by: Jaap de Wolff --- newlib/configure.host | 1 + 1 file changed, 1 insertion(+) diff --git a/newlib/configure.host b/newlib/configure.host index eb645868b..5985f1376 100644 --- a/newlib/configure.host +++ b/newlib/configure.host @@ -410,6 +410,7 @@ case "${host}" in signal_dir= ;; arm*-*-*) + newlib_cflags="${newlib_cflags} -D_COMPILING_NEWLIB" sys_dir=arm if [ "x${newlib_may_supply_syscalls}" = "xno" ] ; then have_crt0="no" From 337cee51cac0d0fa0d68a437d5d182fc84de1241 Mon Sep 17 00:00:00 2001 From: Jaap de Wolff Date: Mon, 12 Feb 2018 12:23:42 +0100 Subject: [PATCH 259/649] Add prototype to _malloc_lock() and *unlock() to malloc.h, and inlude this from nano-mallocr.c --- newlib/libc/include/malloc.h | 4 ++++ newlib/libc/stdlib/nano-mallocr.c | 16 +--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/newlib/libc/include/malloc.h b/newlib/libc/include/malloc.h index e12a13244..a9dc5bca6 100644 --- a/newlib/libc/include/malloc.h +++ b/newlib/libc/include/malloc.h @@ -133,6 +133,10 @@ extern int malloc_trim (size_t); extern int _malloc_trim_r (struct _reent *, size_t); #endif +extern void __malloc_lock(struct _reent *); + +extern void __malloc_unlock(struct _reent *); + /* A compatibility routine for an earlier version of the allocator. */ extern void mstats (char *); diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c index a0accdd36..13b72c99f 100644 --- a/newlib/libc/stdlib/nano-mallocr.c +++ b/newlib/libc/stdlib/nano-mallocr.c @@ -35,6 +35,7 @@ #include #include #include +#include #if DEBUG #include @@ -150,20 +151,6 @@ typedef struct malloc_chunk struct malloc_chunk * next; }chunk; -/* Copied from malloc.h */ -struct mallinfo -{ - size_t arena; /* total space allocated from system */ - size_t ordblks; /* number of non-inuse chunks */ - size_t smblks; /* unused -- always zero */ - size_t hblks; /* number of mmapped regions */ - size_t hblkhd; /* total space in mmapped regions */ - size_t usmblks; /* unused -- always zero */ - size_t fsmblks; /* unused -- always zero */ - size_t uordblks; /* total allocated space */ - size_t fordblks; /* total non-inuse space */ - size_t keepcost; /* top-most, releasable (via malloc_trim) space */ -}; #define CHUNK_OFFSET ((malloc_size_t)(&(((struct malloc_chunk *)0)->next))) @@ -181,7 +168,6 @@ extern void * nano_malloc(RARG malloc_size_t); extern void nano_free (RARG void * free_p); extern void nano_cfree(RARG void * ptr); extern void * nano_calloc(RARG malloc_size_t n, malloc_size_t elem); -extern struct mallinfo nano_mallinfo(RONEARG); extern void nano_malloc_stats(RONEARG); extern malloc_size_t nano_malloc_usable_size(RARG void * ptr); extern void * nano_realloc(RARG void * ptr, malloc_size_t size); From 8329f4867b3f843318134f756c9c0fb27a5befd4 Mon Sep 17 00:00:00 2001 From: Jaap de Wolff Date: Mon, 12 Feb 2018 12:23:43 +0100 Subject: [PATCH 260/649] add forward declaration to __cxa_atexit to aeabi_atexit, to prevent warnings --- newlib/libc/sys/arm/aeabi_atexit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newlib/libc/sys/arm/aeabi_atexit.c b/newlib/libc/sys/arm/aeabi_atexit.c index 4b600e250..a5626b732 100644 --- a/newlib/libc/sys/arm/aeabi_atexit.c +++ b/newlib/libc/sys/arm/aeabi_atexit.c @@ -1,5 +1,8 @@ #include +/* forward declaration */ +extern int __cxa_atexit (void (*) (void *), void *, void *); + /* Register a function to be called by exit or when a shared library is unloaded. This routine is like __cxa_atexit, but uses the calling sequence required by the ARM EABI. */ From c9d4bac58c18495d92c3334614ad676ccef1de46 Mon Sep 17 00:00:00 2001 From: Jaap de Wolff Date: Mon, 12 Feb 2018 12:23:44 +0100 Subject: [PATCH 261/649] adapt prototypes arm/syscalls.c to usual prototypes, and do not rely on implicit conversions --- libgloss/arm/syscalls.c | 97 +++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/libgloss/arm/syscalls.c b/libgloss/arm/syscalls.c index f80615db9..dacd1a9d3 100644 --- a/libgloss/arm/syscalls.c +++ b/libgloss/arm/syscalls.c @@ -24,23 +24,23 @@ int _isatty (int); clock_t _times (struct tms *); int _gettimeofday (struct timeval *, void *); int _unlink (const char *); -int _link (void); +int _link (const char *, const char *); int _stat (const char *, struct stat *); int _fstat (int, struct stat *); int _swistat (int fd, struct stat * st); -caddr_t _sbrk (int); -int _getpid (int); +void * _sbrk (ptrdiff_t); +pid_t _getpid (void); int _close (int); clock_t _clock (void); int _swiclose (int); int _open (const char *, int, ...); int _swiopen (const char *, int); -int _write (int, char *, int); -int _swiwrite (int, char *, int); -int _lseek (int, int, int); -int _swilseek (int, int, int); -int _read (int, char *, int); -int _swiread (int, char *, int); +int _write (int, const void *, size_t); +int _swiwrite (int, const void *, size_t); +_off_t _lseek (int, _off_t, int); +_off_t _swilseek (int, _off_t, int); +int _read (int, void *, size_t); +int _swiread (int, void *, size_t); void initialise_monitor_handles (void); static int checkerror (int); @@ -323,7 +323,7 @@ get_errno (void) #ifdef ARM_RDI_MONITOR return do_AngelSWI (AngelSWI_Reason_Errno, NULL); #else - register r0 asm("r0"); + register int r0 asm("r0"); asm ("swi %a1" : "=r"(r0) : "i" (SWI_GetErrno)); return r0; #endif @@ -352,24 +352,24 @@ checkerror (int result) Returns the number of bytes *not* written. */ int _swiread (int fh, - char * ptr, - int len) + void * ptr, + size_t len) { #ifdef ARM_RDI_MONITOR int block[3]; block[0] = fh; block[1] = (int) ptr; - block[2] = len; + block[2] = (int) len; return checkerror (do_AngelSWI (AngelSWI_Reason_Read, block)); #else - register r0 asm("r0"); - register r1 asm("r1"); - register r2 asm("r2"); + register int r0 asm("r0"); + register int r1 asm("r1"); + register int r2 asm("r2"); r0 = fh; - r1 = (int)ptr; - r2 = len; + r1 = (int) ptr; + r2 = (int) len; asm ("swi %a4" : "=r" (r0) : "0"(r0), "r"(r1), "r"(r2), "i"(SWI_Read)); @@ -382,8 +382,8 @@ _swiread (int fh, bytes read. */ int __attribute__((weak)) _read (int fd, - char * ptr, - int len) + void * ptr, + size_t len) { int res; struct fdent *pfd; @@ -408,12 +408,12 @@ _read (int fd, } /* fd, is a user file descriptor. */ -int +off_t _swilseek (int fd, - int ptr, + off_t ptr, int dir) { - int res; + off_t res; struct fdent *pfd; /* Valid file descriptor? */ @@ -461,7 +461,7 @@ _swilseek (int fd, /* This code only does absolute seeks. */ block[0] = pfd->handle; - block[1] = ptr; + block[1] = (int) ptr; res = checkerror (do_AngelSWI (AngelSWI_Reason_Seek, block)); #else if (dir == SEEK_END) @@ -493,8 +493,9 @@ _swilseek (int fd, return -1; } +off_t _lseek (int fd, - int ptr, + off_t ptr, int dir) { return _swilseek (fd, ptr, dir); @@ -505,21 +506,21 @@ _lseek (int fd, int _swiwrite ( int fh, - char * ptr, - int len) + const void * ptr, + size_t len) { #ifdef ARM_RDI_MONITOR int block[3]; block[0] = fh; block[1] = (int) ptr; - block[2] = len; + block[2] = (int) len; return checkerror (do_AngelSWI (AngelSWI_Reason_Write, block)); #else - register r0 asm("r0"); - register r1 asm("r1"); - register r2 asm("r2"); + register int r0 asm("r0"); + register int r1 asm("r1"); + register int r2 asm("r2"); r0 = fh; r1 = (int)ptr; r2 = len; @@ -533,8 +534,8 @@ _swiwrite ( /* fd, is a user file descriptor. */ int __attribute__((weak)) _write (int fd, - char * ptr, - int len) + const void * ptr, + size_t len) { int res; struct fdent *pfd; @@ -653,7 +654,7 @@ _swiclose (int fh) #ifdef ARM_RDI_MONITOR return checkerror (do_AngelSWI (AngelSWI_Reason_Close, &fh)); #else - register r0 asm("r0"); + register int r0 asm("r0"); r0 = fh; asm ("swi %a2" : "=r"(r0) @@ -694,17 +695,17 @@ _close (int fd) return res; } -int __attribute__((weak)) -_getpid (int n __attribute__ ((unused))) +pid_t __attribute__((weak)) +_getpid (void) { - return 1; + return (pid_t)1; } /* Heap limit returned from SYS_HEAPINFO Angel semihost call. */ uint __heap_limit = 0xcafedead; -caddr_t __attribute__((weak)) -_sbrk (int incr) +void * __attribute__((weak)) +_sbrk (ptrdiff_t incr) { extern char end asm ("end"); /* Defined by the linker. */ static char * heap_end; @@ -717,7 +718,7 @@ _sbrk (int incr) if ((heap_end + incr > stack_ptr) /* Honour heap limit if it's valid. */ - || (__heap_limit != 0xcafedead && heap_end + incr > __heap_limit)) + || (__heap_limit != 0xcafedead && heap_end + incr > (char *)__heap_limit)) { /* Some of the libstdc++-v3 tests rely upon detecting out of memory errors, so do not abort here. */ @@ -729,13 +730,13 @@ _sbrk (int incr) abort (); #else errno = ENOMEM; - return (caddr_t) -1; + return (void *) -1; #endif } heap_end += incr; - return (caddr_t) prev_heap_end; + return (void *) prev_heap_end; } int @@ -795,7 +796,7 @@ _stat (const char *fname, struct stat *st) } int __attribute__((weak)) -_link (void) +_link (const char *__path1 __attribute__ ((unused)), const char *__path2 __attribute__ ((unused))) { errno = ENOSYS; return -1; @@ -811,7 +812,7 @@ _unlink (const char *path) block[1] = strlen(path); res = do_AngelSWI (AngelSWI_Reason_Remove, block); #else - register r0 asm("r0"); + register int r0 asm("r0"); r0 = (int)path; asm ("swi %a2" : "=r"(r0) @@ -900,7 +901,7 @@ _isatty (int fd) #ifdef ARM_RDI_MONITOR tty = do_AngelSWI (AngelSWI_Reason_IsTTY, &pfd->handle); #else - register r0 asm("r0"); + register int r0 asm("r0"); r0 = pfd->handle; asm ("swi %a2" : "=r" (r0) @@ -941,7 +942,7 @@ _system (const char *s) } return e; #else - register r0 asm("r0"); + register int r0 asm("r0"); r0 = (int)s; asm ("swi %a2" : "=r" (r0) @@ -961,8 +962,8 @@ _rename (const char * oldpath, const char * newpath) block[3] = strlen(newpath); return checkerror (do_AngelSWI (AngelSWI_Reason_Rename, block)) ? -1 : 0; #else - register r0 asm("r0"); - register r1 asm("r1"); + register int r0 asm("r0"); + register int r1 asm("r1"); r0 = (int)oldpath; r1 = (int)newpath; asm ("swi %a3" From bc9b30ea77c73840265d2dd69650d472b786feac Mon Sep 17 00:00:00 2001 From: Jaap de Wolff Date: Mon, 12 Feb 2018 12:23:45 +0100 Subject: [PATCH 262/649] add forward declaration to main() to prevent warnings --- libgloss/arm/linux-crt0.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libgloss/arm/linux-crt0.c b/libgloss/arm/linux-crt0.c index 878ece765..6b2d62a9b 100644 --- a/libgloss/arm/linux-crt0.c +++ b/libgloss/arm/linux-crt0.c @@ -10,6 +10,8 @@ #include #include "arm.h" +/* forward declaration */ +int main(int argc, char *argv[], char *env[]); static int _main(int argc, char *argv[]) __attribute__((noreturn)); #if __thumb__ && !defined(PREFER_THUMB) From cff85eaddcb85f887e41c73a53232c39d69904f3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Feb 2018 16:23:32 +0100 Subject: [PATCH 263/649] Cygwin: sockets: move common settings into set_socket_handle() Move setting address family, socket type and descriptor flags into fhandler_socket::set_socket_handle method. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 2 +- winsup/cygwin/fhandler_socket.cc | 37 +++++++++++++++++--------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index e1659db5a..99cacd31f 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -557,7 +557,7 @@ class fhandler_socket: public fhandler_base } status; #ifdef __INSIDE_CYGWIN_NET__ - int set_socket_handle (SOCKET sock); + int set_socket_handle (SOCKET sock, int af, int type, int flags); #endif public: diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index a30b49511..d7e9171f3 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -263,9 +263,9 @@ fhandler_socket::open (int flags, mode_t mode) } int -fhandler_socket::set_socket_handle (SOCKET sock) +fhandler_socket::set_socket_handle (SOCKET sock, int af, int type, int flags) { - DWORD flags; + DWORD hdl_flags; bool lsp_fixup = false; /* Usually sockets are inheritable IFS objects. Unfortunately some virus @@ -288,8 +288,8 @@ fhandler_socket::set_socket_handle (SOCKET sock) If that doesn't work for some reason, mark the sockets for duplication via WSADuplicateSocket/WSASocket. This requires to start the child process in SUSPENDED state so we only do this if really necessary. */ - if (!GetHandleInformation ((HANDLE) sock, &flags) - || !(flags & HANDLE_FLAG_INHERIT)) + if (!GetHandleInformation ((HANDLE) sock, &hdl_flags) + || !(hdl_flags & HANDLE_FLAG_INHERIT)) { int ret; SOCKET base_sock; @@ -303,7 +303,7 @@ fhandler_socket::set_socket_handle (SOCKET sock) debug_printf ("WSAIoctl: %u", WSAGetLastError ()); else if (base_sock != sock) { - if (GetHandleInformation ((HANDLE) base_sock, &flags) + if (GetHandleInformation ((HANDLE) base_sock, &hdl_flags) && (flags & HANDLE_FLAG_INHERIT)) { if (!DuplicateHandle (GetCurrentProcess (), (HANDLE) base_sock, @@ -312,19 +312,22 @@ fhandler_socket::set_socket_handle (SOCKET sock) debug_printf ("DuplicateHandle failed, %E"); else { - closesocket (sock); + ::closesocket (sock); sock = base_sock; lsp_fixup = false; } } } } + set_addr_family (af); + set_socket_type (type); + if (flags & SOCK_NONBLOCK) + set_nonblocking (true); + if (flags & SOCK_CLOEXEC) + set_close_on_exec (true); set_io_handle ((HANDLE) sock); if (!init_events ()) - { - closesocket (sock); - return -1; - } + return -1; if (lsp_fixup) init_fixup_before (); set_flags (O_RDWR | O_BINARY); @@ -360,6 +363,7 @@ int fhandler_socket::socket (int af, int type, int protocol, int flags) { SOCKET sock; + int ret; sock = ::socket (af == AF_LOCAL ? AF_INET : af, type, protocol); if (sock == INVALID_SOCKET) @@ -367,13 +371,12 @@ fhandler_socket::socket (int af, int type, int protocol, int flags) set_winsock_errno (); return -1; } - set_addr_family (af); - set_socket_type (type); - if (flags & SOCK_NONBLOCK) - set_nonblocking (true); - if (flags & SOCK_CLOEXEC) - set_close_on_exec (true); - return set_socket_handle (sock); + ret = set_socket_handle (sock, af, type, flags); + if (ret < 0) + ::closesocket (sock); + return ret; +} + } void From 4e04751fc76611c68460395b491990678f54e313 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Feb 2018 16:36:19 +0100 Subject: [PATCH 264/649] Cygwin: socketpair: Move socketpair creation inside fhandler_socket class Add fhandler_socket::socketpair method Deliberately disable AF_INET socketpairs for now Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 2 + winsup/cygwin/fhandler_socket.cc | 124 +++++++++++++++ winsup/cygwin/net.cc | 255 +++++++++---------------------- 3 files changed, 202 insertions(+), 179 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 99cacd31f..c24304b21 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -588,6 +588,8 @@ class fhandler_socket: public fhandler_base int getsockname (struct sockaddr *name, int *namelen); int getpeername (struct sockaddr *name, int *namelen); int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); + socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out); int open (int flags, mode_t mode = 0); void __reg3 read (void *ptr, size_t& len); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index d7e9171f3..3a18ff593 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -377,6 +377,130 @@ fhandler_socket::socket (int af, int type, int protocol, int flags) return ret; } +/* fhandler_socket::socketpair is called on the fhandler handling the + accepting socket, fh_out is the fhandler for the connecting socket. */ +int +fhandler_socket::socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out) +{ + SOCKET insock = INVALID_SOCKET; + SOCKET outsock = INVALID_SOCKET; + SOCKET sock = INVALID_SOCKET; + struct sockaddr_in sock_in, sock_out; + int len; + + /* create listening socket */ + sock = ::socket (AF_INET, type, 0); + if (sock == INVALID_SOCKET) + { + set_winsock_errno (); + goto err; + } + /* bind to unused port */ + sock_in.sin_family = AF_INET; + sock_in.sin_port = 0; + sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (::bind (sock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) + { + set_winsock_errno (); + goto err; + } + /* fetch socket name */ + len = sizeof (sock_in); + if (::getsockname (sock, (struct sockaddr *) &sock_in, &len) < 0) + { + set_winsock_errno (); + goto err; + } + /* on stream sockets, create listener */ + if (type == SOCK_STREAM && ::listen (sock, 2) < 0) + { + set_winsock_errno (); + goto err; + } + /* create connecting socket */ + outsock = ::socket (AF_INET, type, 0); + if (outsock == INVALID_SOCKET) + { + set_winsock_errno (); + goto err; + } + /* on datagram sockets, bind connecting socket */ + if (type == SOCK_DGRAM) + { + sock_out.sin_family = AF_INET; + sock_out.sin_port = 0; + sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (::bind (outsock, (struct sockaddr *) &sock_out, + sizeof (sock_out)) < 0) + { + set_winsock_errno (); + goto err; + } + /* ...and fetch name */ + len = sizeof (sock_out); + if (::getsockname (outsock, (struct sockaddr *) &sock_out, &len) < 0) + { + set_winsock_errno (); + goto err; + } + } + sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (type == SOCK_DGRAM) + sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + /* connect */ + if (::connect (outsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) + { + set_winsock_errno (); + goto err; + } + if (type == SOCK_STREAM) + { + /* on stream sockets, accept connection and close listener */ + len = sizeof (sock_in); + insock = ::accept (sock, (struct sockaddr *) &sock_in, &len); + if (insock == INVALID_SOCKET) + { + set_winsock_errno (); + goto err; + } + ::closesocket (sock); + } + else + { + /* on datagram sockets, connect vice versa */ + if (::connect (sock, (struct sockaddr *) &sock_out, + sizeof (sock_out)) < 0) + { + set_winsock_errno (); + goto err; + } + insock = sock; + } + sock = INVALID_SOCKET; + + /* postprocessing */ + connect_state (connected); + fh_out->connect_state (connected); + if (af == AF_LOCAL && type == SOCK_STREAM) + { + af_local_set_sockpair_cred (); + fh_out->af_local_set_sockpair_cred (); + } + if (set_socket_handle (insock, af, type, flags) < 0 + || fh_out->set_socket_handle (outsock, af, type, flags) < 0) + goto err; + + return 0; + +err: + if (sock != INVALID_SOCKET) + ::closesocket (sock); + if (insock != INVALID_SOCKET) + ::closesocket (insock); + if (outsock != INVALID_SOCKET) + ::closesocket (outsock); + return -1; } void diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 8497d5944..b6209fcc5 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2767,201 +2767,98 @@ cygwin_bindresvport (int fd, struct sockaddr_in *sin) return cygwin_bindresvport_sa (fd, (struct sockaddr *) sin); } -/* socketpair: standards? */ -/* Win32 supports AF_INET only, so ignore domain and protocol arguments */ +/* socketpair: POSIX.1-2001, POSIX.1-2008, 4.4BSD. */ extern "C" int -socketpair (int family, int type, int protocol, int *sb) +socketpair (int af, int type, int protocol, int *sb) { int res = -1; - SOCKET insock = INVALID_SOCKET; - SOCKET outsock = INVALID_SOCKET; - SOCKET newsock = INVALID_SOCKET; - struct sockaddr_in sock_in, sock_out; - int len; + const device *dev; + fhandler_socket *fh_in, *fh_out; - __try + int flags = type & _SOCK_FLAG_MASK; + type &= ~_SOCK_FLAG_MASK; + + debug_printf ("socket (%d, %d (flags %y), %d)", af, type, flags, protocol); + + switch (af) { - int flags = type & _SOCK_FLAG_MASK; - type &= ~_SOCK_FLAG_MASK; - - if (family != AF_LOCAL && family != AF_INET) - { - set_errno (EAFNOSUPPORT); - __leave; - } + case AF_LOCAL: if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + goto done; + } + if (protocol != 0) + { + set_errno (EPROTONOSUPPORT); + goto done; + } + dev = type == SOCK_STREAM ? stream_dev : dgram_dev; + break; +#if 0 /* FIXME: Given neither BSD nor Linux support anything other than AF_LOCAL + sockets, we deliberately disable AF_INIT socketpairs now and hope for + the best. */ + case AF_INET: + if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + goto done; + } + dev = type == SOCK_STREAM ? tcp_dev : udp_dev; + break; +#endif + default: + set_errno (EAFNOSUPPORT); + goto done; + } + + if ((flags & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)) != 0) + { + set_errno (EINVAL); + goto done; + } + + { + cygheap_fdnew fd_in; + if (fd_in < 0) + goto done; + + cygheap_fdnew fd_out (fd_in, false); + if (fd_out < 0) { - set_errno (EPROTOTYPE); - __leave; - } - if ((flags & ~(SOCK_NONBLOCK | SOCK_CLOEXEC)) != 0) - { - set_errno (EINVAL); - __leave; - } - if ((family == AF_LOCAL && protocol != PF_UNSPEC && protocol != PF_LOCAL) - || (family == AF_INET && protocol != PF_UNSPEC && protocol != PF_INET)) - { - set_errno (EPROTONOSUPPORT); - __leave; + fd_in.release (); + goto done; } - /* create the first socket */ - newsock = socket (AF_INET, type, 0); - if (newsock == INVALID_SOCKET) + fh_in = (fhandler_socket *) build_fh_dev (*dev); + fh_out = (fhandler_socket *) build_fh_dev (*dev); + if (fh_in && fh_out + && fh_in->socketpair (af, type, protocol, flags, fh_out) == 0) { - debug_printf ("first socket call failed"); - set_winsock_errno (); - __leave; - } - - /* bind the socket to any unused port */ - sock_in.sin_family = AF_INET; - sock_in.sin_port = 0; - sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (bind (newsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) - { - debug_printf ("bind failed"); - set_winsock_errno (); - __leave; - } - len = sizeof (sock_in); - if (getsockname (newsock, (struct sockaddr *) &sock_in, &len) < 0) - { - debug_printf ("getsockname error"); - set_winsock_errno (); - __leave; - } - - /* For stream sockets, create a listener */ - if (type == SOCK_STREAM) - listen (newsock, 2); - - /* create a connecting socket */ - outsock = socket (AF_INET, type, 0); - if (outsock == INVALID_SOCKET) - { - debug_printf ("second socket call failed"); - set_winsock_errno (); - __leave; - } - - /* For datagram sockets, bind the 2nd socket to an unused address, too */ - if (type == SOCK_DGRAM) - { - sock_out.sin_family = AF_INET; - sock_out.sin_port = 0; - sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (bind (outsock, (struct sockaddr *) &sock_out, sizeof (sock_out)) < 0) + fd_in = fh_in; + fd_out = fh_out; + if (fd_in <= 2) + set_std_handle (fd_in); + if (fd_out <= 2) + set_std_handle (fd_out); + __try { - debug_printf ("bind failed"); - set_winsock_errno (); - __leave; - } - len = sizeof (sock_out); - if (getsockname (outsock, (struct sockaddr *) &sock_out, &len) < 0) - { - debug_printf ("getsockname error"); - set_winsock_errno (); - __leave; - } - } - - /* Force IP address to loopback */ - sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (type == SOCK_DGRAM) - sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - - /* Do a connect */ - if (connect (outsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) - { - debug_printf ("connect error"); - set_winsock_errno (); - __leave; - } - - if (type == SOCK_STREAM) - { - /* For stream sockets, accept the connection and close the listener */ - len = sizeof (sock_in); - insock = accept (newsock, (struct sockaddr *) &sock_in, &len); - if (insock == INVALID_SOCKET) - { - debug_printf ("accept error"); - set_winsock_errno (); - __leave; - } - closesocket (newsock); - newsock = INVALID_SOCKET; - } - else - { - /* For datagram sockets, connect the 2nd socket */ - if (connect (newsock, (struct sockaddr *) &sock_out, - sizeof (sock_out)) < 0) - { - debug_printf ("connect error"); - set_winsock_errno (); - __leave; - } - insock = newsock; - newsock = INVALID_SOCKET; - } - - cygheap_fdnew sb0; - const device *dev; - - if (family == AF_INET) - dev = (type == SOCK_STREAM ? tcp_dev : udp_dev); - else - dev = (type == SOCK_STREAM ? stream_dev : dgram_dev); - - if (sb0 >= 0 && fdsock (sb0, dev, insock)) - { - ((fhandler_socket *) sb0)->set_addr_family (family); - ((fhandler_socket *) sb0)->set_socket_type (type); - ((fhandler_socket *) sb0)->connect_state (connected); - if (flags & SOCK_NONBLOCK) - ((fhandler_socket *) sb0)->set_nonblocking (true); - if (flags & SOCK_CLOEXEC) - ((fhandler_socket *) sb0)->set_close_on_exec (true); - if (family == AF_LOCAL && type == SOCK_STREAM) - ((fhandler_socket *) sb0)->af_local_set_sockpair_cred (); - - cygheap_fdnew sb1 (sb0, false); - - if (sb1 >= 0 && fdsock (sb1, dev, outsock)) - { - ((fhandler_socket *) sb1)->set_addr_family (family); - ((fhandler_socket *) sb1)->set_socket_type (type); - ((fhandler_socket *) sb1)->connect_state (connected); - if (flags & SOCK_NONBLOCK) - ((fhandler_socket *) sb1)->set_nonblocking (true); - if (flags & SOCK_CLOEXEC) - ((fhandler_socket *) sb1)->set_close_on_exec (true); - if (family == AF_LOCAL && type == SOCK_STREAM) - ((fhandler_socket *) sb1)->af_local_set_sockpair_cred (); - - sb[0] = sb0; - sb[1] = sb1; + sb[0] = fd_in; + sb[1] = fd_out; res = 0; } - else - sb0.release (); + __except (EFAULT) {} + __endtry + } + else + { + fd_in.release (); + fd_out.release (); } } - __except (EFAULT) {} - __endtry + +done: syscall_printf ("%R = socketpair(...)", res); - if (res == -1) - { - if (insock != INVALID_SOCKET) - closesocket (insock); - if (outsock != INVALID_SOCKET) - closesocket (outsock); - if (newsock != INVALID_SOCKET) - closesocket (newsock); - } return res; } From 2327f01726d48dd20b410c499924fe9f69b6ef75 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Feb 2018 16:41:42 +0100 Subject: [PATCH 265/649] Cygwin: fhandler_socket: Add :: to potentially colliding WinSock calls Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 3a18ff593..a7c702e7e 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -957,8 +957,8 @@ fhandler_socket::evaluate_events (const long event_mask, long &events, CV 2014-06-16: Call WSASetLastError *after* setsockopt since, apparently, setsockopt sets the last WSA error code to 0 on success. */ - setsockopt (get_socket (), SOL_SOCKET, SO_ERROR, - (const char *) &wsa_err, sizeof wsa_err); + ::setsockopt (get_socket (), SOL_SOCKET, SO_ERROR, + (const char *) &wsa_err, sizeof wsa_err); WSASetLastError (wsa_err); ret = SOCKET_ERROR; } @@ -1654,7 +1654,7 @@ fhandler_socket::accept4 (struct sockaddr *peer, int *len, int flags) } else { - closesocket (res); + ::closesocket (res); res = -1; } } @@ -2331,7 +2331,7 @@ fhandler_socket::close () int res = 0; release_events (); - while ((res = closesocket (get_socket ())) != 0) + while ((res = ::closesocket (get_socket ())) != 0) { if (WSAGetLastError () != WSAEWOULDBLOCK) { @@ -2557,7 +2557,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p) case _IOR('f', 127, u_long): #endif /* Make sure to use the Winsock definition of FIONREAD. */ - res = ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); + res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); if (res == SOCKET_ERROR) set_winsock_errno (); break; @@ -2577,7 +2577,7 @@ fhandler_socket::ioctl (unsigned int cmd, void *p) res = 0; } else - res = ioctlsocket (get_socket (), cmd, (u_long *) p); + res = ::ioctlsocket (get_socket (), cmd, (u_long *) p); break; } syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); From f881942d771ec027aef4b101bd6582fbd1543181 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Feb 2018 16:57:24 +0100 Subject: [PATCH 266/649] Cygwin: net: Improve standars conformance comments Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 65 ++++++++++++++++++++++++-------------------- 1 file changed, 35 insertions(+), 30 deletions(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index b6209fcc5..d0e4d3b57 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -490,7 +490,7 @@ dup_ent (servent *src) return (servent *) dup_ent (_my_tls.locals.servent_buf, (unionent *) src, unionent::t_servent); } -/* exported as getprotobyname: standards? */ +/* exported as getprotobyname: POSIX.1-2001, POSIX.1-2008, 4.3BSD */ extern "C" struct protoent * cygwin_getprotobyname (const char *p) { @@ -503,7 +503,7 @@ cygwin_getprotobyname (const char *p) return NULL; } -/* exported as getprotobynumber: standards? */ +/* exported as getprotobynumber: POSIX.1-2001, POSIX.1-2008, 4.3BSD */ extern "C" struct protoent * cygwin_getprotobynumber (int number) { @@ -650,7 +650,7 @@ fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc) return true; } -/* exported as socket: standards? */ +/* exported as socket: POSIX.1-2001, POSIX.1-2008, 4.4BSD */ extern "C" int cygwin_socket (int af, int type, int protocol) { @@ -721,7 +721,7 @@ done: return res; } -/* exported as sendto: standards? */ +/* exported as sendto: 4.4BSD, SVr4, POSIX.1-2001 */ extern "C" ssize_t cygwin_sendto (int fd, const void *buf, size_t len, int flags, const struct sockaddr *to, socklen_t tolen) @@ -743,7 +743,7 @@ cygwin_sendto (int fd, const void *buf, size_t len, int flags, return res; } -/* exported as recvfrom: standards? */ +/* exported as recvfrom: 4.4BSD, SVr4, POSIX.1-2001 */ extern "C" ssize_t cygwin_recvfrom (int fd, void *buf, size_t len, int flags, struct sockaddr *from, socklen_t *fromlen) @@ -790,7 +790,7 @@ convert_ws1_ip_optname (int optname) : ws2_optname[optname]; } -/* exported as setsockopt: standards? */ +/* exported as setsockopt: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) @@ -959,7 +959,7 @@ cygwin_setsockopt (int fd, int level, int optname, const void *optval, return res; } -/* exported as getsockopt: standards? */ +/* exported as getsockopt: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen) @@ -1152,7 +1152,7 @@ getpeereid (int fd, uid_t *euid, gid_t *egid) return -1; } -/* exported as connect: standards? */ +/* exported as connect: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_connect (int fd, const struct sockaddr *name, socklen_t namelen) { @@ -1172,7 +1172,7 @@ cygwin_connect (int fd, const struct sockaddr *name, socklen_t namelen) return res; } -/* exported as getservbyname: standards? */ +/* exported as getservbyname: POSIX.1-2001, POSIX.1-2008, 4.3BSD */ extern "C" struct servent * cygwin_getservbyname (const char *name, const char *proto) { @@ -1188,7 +1188,7 @@ cygwin_getservbyname (const char *name, const char *proto) return res; } -/* exported as getservbyport: standards? */ +/* exported as getservbyport: POSIX.1-2001, POSIX.1-2008, 4.3BSD */ extern "C" struct servent * cygwin_getservbyport (int port, const char *proto) { @@ -1247,7 +1247,7 @@ sethostname (const char *name, size_t len) return 0; } -/* exported as gethostbyname: standards? */ +/* exported as gethostbyname: POSIX.1-2001 */ extern "C" struct hostent * cygwin_gethostbyname (const char *name) { @@ -1298,7 +1298,7 @@ cygwin_gethostbyname (const char *name) return res; } -/* exported as gethostbyaddr: standards? */ +/* exported as gethostbyaddr: POSIX.1-2001 */ extern "C" struct hostent * cygwin_gethostbyaddr (const void *addr, socklen_t len, int type) { @@ -1637,7 +1637,7 @@ corrupted: return NULL; } -/* gethostbyname2: standards? */ +/* gethostbyname2: GNU extension */ extern "C" struct hostent * gethostbyname2 (const char *name, int af) { @@ -1678,7 +1678,7 @@ gethostbyname2 (const char *name, int af) return res; } -/* exported as accept: standards? */ +/* exported as accept: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_accept (int fd, struct sockaddr *peer, socklen_t *len) { @@ -1699,6 +1699,7 @@ cygwin_accept (int fd, struct sockaddr *peer, socklen_t *len) return res; } +/* accept4: GNU extension */ extern "C" int accept4 (int fd, struct sockaddr *peer, socklen_t *len, int flags) { @@ -1722,7 +1723,7 @@ accept4 (int fd, struct sockaddr *peer, socklen_t *len, int flags) return res; } -/* exported as bind: standards? */ +/* exported as bind: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen) { @@ -1740,7 +1741,7 @@ cygwin_bind (int fd, const struct sockaddr *my_addr, socklen_t addrlen) return res; } -/* exported as getsockname: standards? */ +/* exported as getsockname: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_getsockname (int fd, struct sockaddr *addr, socklen_t *namelen) { @@ -1758,7 +1759,7 @@ cygwin_getsockname (int fd, struct sockaddr *addr, socklen_t *namelen) return res; } -/* exported as listen: standards? */ +/* exported as listen: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_listen (int fd, int backlog) { @@ -1776,7 +1777,7 @@ cygwin_listen (int fd, int backlog) return res; } -/* exported as shutdown: standards? */ +/* exported as shutdown: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_shutdown (int fd, int how) { @@ -1839,7 +1840,7 @@ cygwin_herror (const char *s) __endtry } -/* exported as getpeername: standards? */ +/* exported as getpeername: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len) { @@ -1859,7 +1860,7 @@ cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len) return res; } -/* exported as recv: standards? */ +/* exported as recv: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" ssize_t cygwin_recv (int fd, void *buf, size_t len, int flags) { @@ -1883,7 +1884,7 @@ cygwin_recv (int fd, void *buf, size_t len, int flags) return res; } -/* exported as send: standards? */ +/* exported as send: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" ssize_t cygwin_send (int fd, const void *buf, size_t len, int flags) { @@ -1903,7 +1904,7 @@ cygwin_send (int fd, const void *buf, size_t len, int flags) return res; } -/* getdomainname: standards? */ +/* getdomainname: 4.4BSD */ extern "C" int getdomainname (char *domain, size_t len) { @@ -2862,19 +2863,19 @@ done: return res; } -/* sethostent: standards? */ +/* sethostent: POSIX.1-2001 */ extern "C" void sethostent (int) { } -/* endhostent: standards? */ +/* endhostent: POSIX.1-2001 */ extern "C" void endhostent (void) { } -/* exported as recvmsg: standards? */ +/* exported as recvmsg: POSIX.1-2001, POSIX.1-2008, 4.4BSD */ extern "C" ssize_t cygwin_recvmsg (int fd, struct msghdr *msg, int flags) { @@ -2905,7 +2906,7 @@ cygwin_recvmsg (int fd, struct msghdr *msg, int flags) return res; } -/* exported as sendmsg: standards? */ +/* exported as sendmsg: POSIX.1-2001, POSIX.1-2008, 4.4BSD */ extern "C" ssize_t cygwin_sendmsg (int fd, const struct msghdr *msg, int flags) { @@ -3297,6 +3298,7 @@ cygwin_inet_ntop (int af, const void *src, char *dst, socklen_t size) /* NOTREACHED */ } +/* Exported as freeaddrinfo: POSIX.1-2001, POSIX.1-2008, RFC 2553 */ extern "C" void cygwin_freeaddrinfo (struct addrinfo *addr) { @@ -3455,6 +3457,7 @@ static struct gai_errmap_t {0, "Parameter string not correctly encoded"} }; +/* Exported as gai_strerror: POSIX.1-2001, POSIX.1-2008 */ extern "C" const char * cygwin_gai_strerror (int err) { @@ -3473,6 +3476,7 @@ w32_to_gai_err (int w32_err) return w32_err; } +/* Exported as getaddrinfo: POSIX.1-2001, POSIX.1-2008, RFC 2553 */ extern "C" int cygwin_getaddrinfo (const char *hostname, const char *servname, const struct addrinfo *hints, struct addrinfo **res) @@ -3595,6 +3599,7 @@ cygwin_getaddrinfo (const char *hostname, const char *servname, return ret; } +/* Exported as getnameinfo: POSIX.1-2001, POSIX.1-2008, RFC 2553 */ extern "C" int cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen, char *host, size_t hostlen, char *serv, @@ -3678,28 +3683,28 @@ cygwin_getnameinfo (const struct sockaddr *sa, socklen_t salen, #undef htons #undef ntohs -/* htonl: standards? */ +/* htonl: POSIX.1-2001, POSIX.1-2008 */ extern "C" uint32_t htonl (uint32_t x) { return __htonl (x); } -/* ntohl: standards? */ +/* ntohl: POSIX.1-2001, POSIX.1-2008 */ extern "C" uint32_t ntohl (uint32_t x) { return __ntohl (x); } -/* htons: standards? */ +/* htons: POSIX.1-2001, POSIX.1-2008 */ extern "C" uint16_t htons (uint16_t x) { return __htons (x); } -/* ntohs: standards? */ +/* ntohs: POSIX.1-2001, POSIX.1-2008 */ extern "C" uint16_t ntohs (uint16_t x) { From 26bcedda20c88c7bfbcef106dbb240b8b591cf59 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Feb 2018 17:21:48 +0100 Subject: [PATCH 267/649] Cygwin: fix utils path handling in case cygdrive path is just '/' Signed-off-by: Corinna Vinschen --- winsup/cygwin/release/2.10.1 | 2 ++ winsup/utils/path.cc | 32 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/release/2.10.1 b/winsup/cygwin/release/2.10.1 index f8fd4cb42..c08d10209 100644 --- a/winsup/cygwin/release/2.10.1 +++ b/winsup/cygwin/release/2.10.1 @@ -11,3 +11,5 @@ What changed: Bug Fixes --------- +- Fix utils path handling in case cygdrive path is just '/'. + Addresses: https://cygwin.com/ml/cygwin/2018-02/msg00174.html diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc index a76cf765f..fcc5c0790 100644 --- a/winsup/utils/path.cc +++ b/winsup/utils/path.cc @@ -672,7 +672,7 @@ read_mounts () */ static int -path_prefix_p (const char *path1, const char *path2, int len1) +path_prefix_p (const char *path1, const char *path2, size_t len1) { /* Handle case where PATH1 has trailing '/' and when it doesn't. */ if (len1 > 0 && isslash (path1[len1 - 1])) @@ -778,7 +778,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v) cwd = pathbuf; } - int max_len = -1; + int max_len = 0; mnt_t *m, *match = NULL; for (m = mount_table; m->posix; m++) @@ -786,7 +786,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v) if (m->flags & MOUNT_CYGDRIVE) continue; - int n = strlen (m->native); + size_t n = strlen (m->native); if (n < max_len || !path_prefix_p (m->native, cwd, n)) continue; max_len = n; @@ -821,7 +821,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v) static char * vcygpath (const char *cwd, const char *s, va_list v) { - int max_len = -1; + size_t max_len = 0; mnt_t *m, *match = NULL; if (!max_mount_entry) @@ -843,15 +843,23 @@ vcygpath (const char *cwd, const char *s, va_list v) for (m = mount_table; m->posix; m++) { - int n = strlen (m->posix); + size_t n = strlen (m->posix); if (n < max_len || !path_prefix_p (m->posix, path, n)) continue; - if ((m->flags & MOUNT_CYGDRIVE) - && ((int) strlen (path) < n + 2 - || path[n] != '/' - || !isalpha (path[n + 1]) - || path[n + 2] != '/')) - continue; + if (m->flags & MOUNT_CYGDRIVE) + { + if (strlen (path) < n + 2) + continue; + /* If cygdrive path is just '/', fix n for followup evaluation. */ + if (n == 1) + n = 0; + if (path[n] != '/') + continue; + if (!isalpha (path[n + 1])) + continue; + if (path[n + 2] != '/') + continue; + } max_len = n; match = m; } @@ -859,7 +867,7 @@ vcygpath (const char *cwd, const char *s, va_list v) char *native; if (match == NULL) native = strdup (path); - else if (max_len == (int) strlen (path)) + else if (max_len == strlen (path)) native = strdup (match->native); else if (match->flags & MOUNT_CYGDRIVE) { From ea543d3ffa129dd4976aa19d47cf6c8f7ce09a11 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 16 Feb 2018 17:34:57 +0100 Subject: [PATCH 268/649] Cygwin: fix declaration of fhandler_socket::socketpair Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index c24304b21..ab6fb6e91 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -588,8 +588,8 @@ class fhandler_socket: public fhandler_base int getsockname (struct sockaddr *name, int *namelen); int getpeername (struct sockaddr *name, int *namelen); int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); - socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out); + int socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out); int open (int flags, mode_t mode = 0); void __reg3 read (void *ptr, size_t& len); From 0a3f4e6087e0e44fd36ca2d88f619fae2dfaa02c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 20 Feb 2018 15:05:23 +0100 Subject: [PATCH 269/649] Cygwin: Make sure fraction of seconds constants enforce 64 bit computation Dropping the 'LL' specifier leads to 32 bit truncation during timestamp computation. Revert it. Exempt MSPERSEC which is used for 32 bit values. Signed-off-by: Corinna Vinschen --- winsup/cygwin/hires.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h index a28efcdd7..5c75cf65a 100644 --- a/winsup/cygwin/hires.h +++ b/winsup/cygwin/hires.h @@ -30,13 +30,13 @@ details. */ /* 100ns difference between Windows and UNIX timebase. */ #define FACTOR (0x19db1ded53e8000LL) /* # of nanosecs per second. */ -#define NSPERSEC (1000000000) +#define NSPERSEC (1000000000LL) /* # of 100ns intervals per second. */ -#define NS100PERSEC (10000000) +#define NS100PERSEC (10000000LL) /* # of microsecs per second. */ -#define USPERSEC (1000000) +#define USPERSEC (1000000LL) /* # of millisecs per second. */ -#define MSPERSEC (1000) +#define MSPERSEC (1000L) class hires_base { From 044ab77dcc59ec7eea0e3880d47c22f5f62cc502 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 20 Feb 2018 17:59:45 +0100 Subject: [PATCH 270/649] Cygwin: clean error mapping - Move definition of windows to POSIX error mapping struct into cygerrno.h - Move declaration of winsock errno functions to cygerrno.h - Input to error mapping functions is DWORD Signed-off-by: Corinna Vinschen --- winsup/cygwin/cygerrno.h | 10 ++++++++++ winsup/cygwin/errno.cc | 7 +------ winsup/cygwin/net.cc | 21 +++++++-------------- winsup/cygwin/winsup.h | 3 --- 4 files changed, 18 insertions(+), 23 deletions(-) diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h index ce33d971a..afcae4cb0 100644 --- a/winsup/cygwin/cygerrno.h +++ b/winsup/cygwin/cygerrno.h @@ -11,6 +11,13 @@ details. */ #include #include "regparm.h" +struct errmap_t +{ + DWORD w; /* windows version of error */ + const char *s; /* text of windows version */ + int e; /* errno version of error */ +}; + void __reg3 seterrno_from_win_error (const char *file, int line, DWORD code); void __reg3 seterrno_from_nt_status (const char *file, int line, NTSTATUS status); int __reg2 geterrno_from_win_error (DWORD code = GetLastError (), int deferrno = 13 /*EACCESS*/); @@ -34,6 +41,9 @@ __set_errno (const char *fn, int ln, int val) } #define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val)) +void __reg2 __set_winsock_errno (const char *fn, int ln); +#define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__) + #define get_errno() (errno) extern "C" void __stdcall set_sig_errno (int e); diff --git a/winsup/cygwin/errno.cc b/winsup/cygwin/errno.cc index 9168e9b4d..420326566 100644 --- a/winsup/cygwin/errno.cc +++ b/winsup/cygwin/errno.cc @@ -31,12 +31,7 @@ details. */ #define X(w, e) {ERROR_##w, #w, e} -static const struct -{ - DWORD w; /* windows version of error */ - const char *s; /* text of windows version */ - int e; /* errno version of error */ -} errmap[] = +static const errmap_t errmap[] = { /* FIXME: Some of these choices are arbitrary! */ X (ACCESS_DENIED, EACCES), diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index d0e4d3b57..7d73790a6 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -150,14 +150,7 @@ inet_makeaddr (int net, int lna) return in; } -struct tl -{ - int w; - const char *s; - int e; -}; - -static const struct tl errmap[] = { +static const errmap_t wsock_errmap[] = { {WSA_INVALID_HANDLE, "WSA_INVALID_HANDLE", EBADF}, {WSA_NOT_ENOUGH_MEMORY, "WSA_NOT_ENOUGH_MEMORY", ENOMEM}, {WSA_INVALID_PARAMETER, "WSA_INVALID_PARAMETER", EINVAL}, @@ -206,11 +199,11 @@ static const struct tl errmap[] = { }; static int -find_winsock_errno (int why) +find_winsock_errno (DWORD why) { - for (int i = 0; errmap[i].s != NULL; ++i) - if (why == errmap[i].w) - return errmap[i].e; + for (int i = 0; wsock_errmap[i].s != NULL; ++i) + if (why == wsock_errmap[i].w) + return wsock_errmap[i].e; return EPERM; } @@ -229,7 +222,7 @@ __set_winsock_errno (const char *fn, int ln) * Since the member `s' isn't used for debug output we can use it * for the error text returned by herror and hstrerror. */ -static const struct tl host_errmap[] = { +static const errmap_t host_errmap[] = { {WSAHOST_NOT_FOUND, "Unknown host", HOST_NOT_FOUND}, {WSATRY_AGAIN, "Host name lookup failure", TRY_AGAIN}, {WSANO_RECOVERY, "Unknown server error", NO_RECOVERY}, @@ -242,7 +235,7 @@ set_host_errno () { int i; - int why = WSAGetLastError (); + DWORD why = WSAGetLastError (); for (i = 0; host_errmap[i].w != 0; ++i) if (why == host_errmap[i].w) diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index 1b3fbfeee..d2b37181a 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -212,9 +212,6 @@ bool timeval_to_ms (const struct timeval *, DWORD &); void __stdcall set_console_title (char *); void init_console_handler (bool); -void __reg2 __set_winsock_errno (const char *fn, int ln); -#define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__) - extern bool wsock_started; /* Printf type functions */ From ea1e5318d5479ca841beab601a4c3dd7cce627ad Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 20 Feb 2018 18:01:40 +0100 Subject: [PATCH 271/649] Cygwin: set/getsockopt: Move implementation into fhandler_socket class This requires to export find_winsock_errno from net.cc. Signed-off-by: Corinna Vinschen --- winsup/cygwin/cygerrno.h | 1 + winsup/cygwin/fhandler.h | 4 + winsup/cygwin/fhandler_socket.cc | 330 +++++++++++++++++++++++++++++ winsup/cygwin/net.cc | 347 ++----------------------------- 4 files changed, 348 insertions(+), 334 deletions(-) diff --git a/winsup/cygwin/cygerrno.h b/winsup/cygwin/cygerrno.h index afcae4cb0..009ae635a 100644 --- a/winsup/cygwin/cygerrno.h +++ b/winsup/cygwin/cygerrno.h @@ -41,6 +41,7 @@ __set_errno (const char *fn, int ln, int val) } #define set_errno(val) __set_errno (__PRETTY_FUNCTION__, __LINE__, (val)) +int find_winsock_errno (DWORD why); void __reg2 __set_winsock_errno (const char *fn, int ln); #define set_winsock_errno() __set_winsock_errno (__FUNCTION__, __LINE__) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index ab6fb6e91..ce9d9246e 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -590,6 +590,10 @@ class fhandler_socket: public fhandler_base int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); int socketpair (int af, int type, int protocol, int flags, fhandler_socket *fh_out); + int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen); + int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen); int open (int flags, mode_t mode = 0); void __reg3 read (void *ptr, size_t& len); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index a7c702e7e..26d4716b4 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -2685,3 +2685,333 @@ fhandler_socket::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) __endtry return -1; } + +static int +convert_ws1_ip_optname (int optname) +{ + static int ws2_optname[] = + { + 0, + IP_OPTIONS, + IP_MULTICAST_IF, + IP_MULTICAST_TTL, + IP_MULTICAST_LOOP, + IP_ADD_MEMBERSHIP, + IP_DROP_MEMBERSHIP, + IP_TTL, + IP_TOS, + IP_DONTFRAGMENT + }; + return (optname < 1 || optname > _WS1_IP_DONTFRAGMENT) + ? optname + : ws2_optname[optname]; +} + +int +fhandler_socket::setsockopt (int level, int optname, const void *optval, + socklen_t optlen) +{ + bool ignore = false; + int ret = -1; + + /* Preprocessing setsockopt. Set ignore to true if setsockopt call should + get skipped entirely. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + /* Switch off the AF_LOCAL handshake and thus SO_PEERCRED handling + for AF_LOCAL/SOCK_STREAM sockets. This allows to handle special + situations in which connect is called before a listening socket + accepts connections. + FIXME: In the long run we should find a more generic solution + which doesn't require a blocking handshake in accept/connect + to exchange SO_PEERCRED credentials. */ + if (optval || optlen) + set_errno (EINVAL); + else + ret = af_local_set_no_getpeereid (); + return ret; + + case SO_REUSEADDR: + /* Per POSIX we must not be able to reuse a complete duplicate of a + local TCP address (same IP, same port), even if SO_REUSEADDR has + been set. This behaviour is maintained in WinSock for backward + compatibility, while the WinSock standard behaviour of stream + socket binding is equivalent to the POSIX behaviour as if + SO_REUSEADDR has been set. The SO_EXCLUSIVEADDRUSE option has + been added to allow an application to request POSIX standard + behaviour in the non-SO_REUSEADDR case. + + To emulate POSIX socket binding behaviour, note that SO_REUSEADDR + has been set but don't call setsockopt. Instead + fhandler_socket::bind sets SO_EXCLUSIVEADDRUSE if the application + did not set SO_REUSEADDR. */ + if (optlen < (socklen_t) sizeof (int)) + { + set_errno (EINVAL); + return ret; + } + if (get_socket_type () == SOCK_STREAM) + ignore = true; + break; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + if (optlen < (socklen_t) sizeof (struct timeval)) + { + set_errno (EINVAL); + return ret; + } + if (timeval_to_ms ((struct timeval *) optval, + (optname == SO_RCVTIMEO) ? rcvtimeo () + : sndtimeo ())) + ret = 0; + else + set_errno (EDOM); + return ret; + + default: + break; + } + break; + + case IPPROTO_IP: + /* Old applications still use the old WinSock1 IPPROTO_IP values. */ + if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) + optname = convert_ws1_ip_optname (optname); + switch (optname) + { + case IP_TOS: + /* Winsock doesn't support setting the IP_TOS field with setsockopt + and TOS was never implemented for TCP anyway. setsockopt returns + WinSock error 10022, WSAEINVAL when trying to set the IP_TOS + field. We just return 0 instead. */ + ignore = true; + break; + + default: + break; + } + break; + + case IPPROTO_IPV6: + { + switch (optname) + { + case IPV6_TCLASS: + /* Unsupported */ + ignore = true; + break; + + default: + break; + } + } + default: + break; + } + + /* Call Winsock setsockopt (or not) */ + if (ignore) + ret = 0; + else + { + ret = ::setsockopt (get_socket (), level, optname, (const char *) optval, + optlen); + if (ret == SOCKET_ERROR) + { + set_winsock_errno (); + return ret; + } + } + + if (optlen == (socklen_t) sizeof (int)) + debug_printf ("setsockopt optval=%x", *(int *) optval); + + /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_REUSEADDR: + saw_reuseaddr (*(int *) optval); + break; + + case SO_RCVBUF: + rmem (*(int *) optval); + break; + + case SO_SNDBUF: + wmem (*(int *) optval); + break; + + default: + break; + } + break; + + default: + break; + } + + return ret; +} + +int +fhandler_socket::getsockopt (int level, int optname, const void *optval, + socklen_t *optlen) +{ + bool ignore = false; + bool onebyte = false; + int ret = -1; + + /* Preprocessing getsockopt. Set ignore to true if getsockopt call should + get skipped entirely. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + { + struct ucred *cred = (struct ucred *) optval; + + if (*optlen < (socklen_t) sizeof *cred) + { + set_errno (EINVAL); + return ret; + } + ret = getpeereid (&cred->pid, &cred->uid, &cred->gid); + if (!ret) + *optlen = (socklen_t) sizeof *cred; + return ret; + } + break; + + case SO_REUSEADDR: + { + unsigned int *reuseaddr = (unsigned int *) optval; + + if (*optlen < (socklen_t) sizeof *reuseaddr) + { + set_errno (EINVAL); + return ret; + } + *reuseaddr = saw_reuseaddr(); + *optlen = (socklen_t) sizeof *reuseaddr; + ignore = true; + } + break; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + struct timeval *time_out = (struct timeval *) optval; + + if (*optlen < (socklen_t) sizeof *time_out) + { + set_errno (EINVAL); + return ret; + } + DWORD ms = (optname == SO_RCVTIMEO) ? rcvtimeo () : sndtimeo (); + if (ms == 0 || ms == INFINITE) + { + time_out->tv_sec = 0; + time_out->tv_usec = 0; + } + else + { + time_out->tv_sec = ms / MSPERSEC; + time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; + } + *optlen = (socklen_t) sizeof *time_out; + ret = 0; + return ret; + } + + default: + break; + } + break; + + case IPPROTO_IP: + /* Old applications still use the old WinSock1 IPPROTO_IP values. */ + if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) + optname = convert_ws1_ip_optname (optname); + break; + + default: + break; + } + + /* Call Winsock getsockopt (or not) */ + if (ignore) + ret = 0; + else + { + ret = ::getsockopt (get_socket (), level, optname, (char *) optval, + (int *) optlen); + if (ret == SOCKET_ERROR) + { + set_winsock_errno (); + return ret; + } + } + + /* Postprocessing getsockopt, setting fhandler_socket members, etc. Set + onebyte true for options returning BOOLEAN instead of a boolean DWORD. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_ERROR: + { + int *e = (int *) optval; + debug_printf ("WinSock SO_ERROR = %d", *e); + *e = find_winsock_errno (*e); + } + break; + + case SO_KEEPALIVE: + case SO_DONTROUTE: + onebyte = true; + break; + + default: + break; + } + break; + case IPPROTO_TCP: + switch (optname) + { + case TCP_NODELAY: + onebyte = true; + break; + + default: + break; + } + default: + break; + } + + if (onebyte) + { + /* Regression in Vista and later: instead of a 4 byte BOOL value, a + 1 byte BOOLEAN value is returned, in contrast to older systems and + the documentation. Since an int type is expected by the calling + application, we convert the result here. For some reason only three + BSD-compatible socket options seem to be affected. */ + BOOLEAN *in = (BOOLEAN *) optval; + int *out = (int *) optval; + *out = *in; + *optlen = 4; + } + + return ret; +} diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 7d73790a6..dc81fb7de 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -198,7 +198,7 @@ static const errmap_t wsock_errmap[] = { {0, NULL, 0} }; -static int +int find_winsock_errno (DWORD why) { for (int i = 0; wsock_errmap[i].s != NULL; ++i) @@ -762,194 +762,24 @@ cygwin_recvfrom (int fd, void *buf, size_t len, int flags, return res; } -static int -convert_ws1_ip_optname (int optname) -{ - static int ws2_optname[] = - { - 0, - IP_OPTIONS, - IP_MULTICAST_IF, - IP_MULTICAST_TTL, - IP_MULTICAST_LOOP, - IP_ADD_MEMBERSHIP, - IP_DROP_MEMBERSHIP, - IP_TTL, - IP_TOS, - IP_DONTFRAGMENT - }; - return (optname < 1 || optname > _WS1_IP_DONTFRAGMENT) - ? optname - : ws2_optname[optname]; -} - /* exported as setsockopt: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ extern "C" int cygwin_setsockopt (int fd, int level, int optname, const void *optval, socklen_t optlen) { - bool ignore = false; - int res = -1; + int ret = -1; __try { fhandler_socket *fh = get (fd); - if (!fh) - __leave; - - /* Preprocessing setsockopt. Set ignore to true if setsockopt call - should get skipped entirely. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_PEERCRED: - /* Switch off the AF_LOCAL handshake and thus SO_PEERCRED - handling for AF_LOCAL/SOCK_STREAM sockets. This allows to - handle special situations in which connect is called before - a listening socket accepts connections. - FIXME: In the long run we should find a more generic solution - which doesn't require a blocking handshake in accept/connect - to exchange SO_PEERCRED credentials. */ - if (optval || optlen) - set_errno (EINVAL); - else - res = fh->af_local_set_no_getpeereid (); - __leave; - - case SO_REUSEADDR: - /* Per POSIX we must not be able to reuse a complete duplicate - of a local TCP address (same IP, same port), even if - SO_REUSEADDR has been set. This behaviour is maintained in - WinSock for backward compatibility, while the WinSock - standard behaviour of stream socket binding is equivalent to - the POSIX behaviour as if SO_REUSEADDR has been set. - The SO_EXCLUSIVEADDRUSE option has been added to allow an - application to request POSIX standard behaviour in the - non-SO_REUSEADDR case. - - To emulate POSIX socket binding behaviour, note that - SO_REUSEADDR has been set but don't call setsockopt. - Instead fhandler_socket::bind sets SO_EXCLUSIVEADDRUSE if - the application did not set SO_REUSEADDR. */ - if (optlen < (socklen_t) sizeof (int)) - { - set_errno (EINVAL); - __leave; - } - if (fh->get_socket_type () == SOCK_STREAM) - ignore = true; - break; - - case SO_RCVTIMEO: - case SO_SNDTIMEO: - if (optlen < (socklen_t) sizeof (struct timeval)) - { - set_errno (EINVAL); - __leave; - } - if (timeval_to_ms ((struct timeval *) optval, - (optname == SO_RCVTIMEO) - ? fh->rcvtimeo () : fh->sndtimeo ())) - res = 0; - else - set_errno (EDOM); - __leave; - - default: - break; - } - break; - - case IPPROTO_IP: - /* Old applications still use the old WinSock1 IPPROTO_IP values. */ - if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) - optname = convert_ws1_ip_optname (optname); - switch (optname) - { - case IP_TOS: - /* Winsock doesn't support setting the IP_TOS field with - setsockopt and TOS was never implemented for TCP anyway. - setsockopt returns WinSock error 10022, WSAEINVAL when - trying to set the IP_TOS field. We just return 0 instead. */ - ignore = true; - break; - - default: - break; - } - break; - - case IPPROTO_IPV6: - { - switch (optname) - { - case IPV6_TCLASS: - /* Unsupported */ - ignore = true; - break; - - default: - break; - } - } - default: - break; - } - - /* Call setsockopt (or not) */ - if (ignore) - res = 0; - else - { - res = setsockopt (fh->get_socket (), level, optname, - (const char *) optval, optlen); - if (res == SOCKET_ERROR) - { - set_winsock_errno (); - __leave; - } - } - - if (optlen == (socklen_t) sizeof (int)) - debug_printf ("setsockopt optval=%x", *(int *) optval); - - /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_REUSEADDR: - fh->saw_reuseaddr (*(int *) optval); - break; - - case SO_RCVBUF: - fh->rmem (*(int *) optval); - break; - - case SO_SNDBUF: - fh->wmem (*(int *) optval); - break; - - default: - break; - } - break; - - default: - break; - } - } - __except (EFAULT) - { - res = -1; + if (fh) + ret = fh->setsockopt (level, optname, optval, optlen); } + __except (EFAULT) {} __endtry syscall_printf ("%R = setsockopt(%d, %d, %y, %p, %d)", - res, fd, level, optname, optval, optlen); - return res; + ret, fd, level, optname, optval, optlen); + return ret; } /* exported as getsockopt: POSIX.1-2001, POSIX.1-2008, SVr4, 4.4BSD */ @@ -957,170 +787,19 @@ extern "C" int cygwin_getsockopt (int fd, int level, int optname, void *optval, socklen_t *optlen) { - bool ignore = false; - bool onebyte = false; - int res = -1; + int ret = -1; __try { fhandler_socket *fh = get (fd); - if (!fh) - __leave; - - /* Preprocessing getsockopt. Set ignore to true if getsockopt call - should get skipped entirely. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_PEERCRED: - { - struct ucred *cred = (struct ucred *) optval; - - if (*optlen < (socklen_t) sizeof *cred) - { - set_errno (EINVAL); - __leave; - } - res = fh->getpeereid (&cred->pid, &cred->uid, &cred->gid); - if (!res) - *optlen = (socklen_t) sizeof *cred; - __leave; - } - break; - - case SO_REUSEADDR: - { - unsigned int *reuseaddr = (unsigned int *) optval; - - if (*optlen < (socklen_t) sizeof *reuseaddr) - { - set_errno (EINVAL); - __leave; - } - *reuseaddr = fh->saw_reuseaddr(); - *optlen = (socklen_t) sizeof *reuseaddr; - ignore = true; - } - break; - - case SO_RCVTIMEO: - case SO_SNDTIMEO: - { - struct timeval *time_out = (struct timeval *) optval; - - if (*optlen < (socklen_t) sizeof *time_out) - { - set_errno (EINVAL); - __leave; - } - DWORD ms = (optname == SO_RCVTIMEO) ? fh->rcvtimeo () - : fh->sndtimeo (); - if (ms == 0 || ms == INFINITE) - { - time_out->tv_sec = 0; - time_out->tv_usec = 0; - } - else - { - time_out->tv_sec = ms / MSPERSEC; - time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; - } - *optlen = (socklen_t) sizeof *time_out; - res = 0; - __leave; - } - - default: - break; - } - break; - - case IPPROTO_IP: - /* Old applications still use the old WinSock1 IPPROTO_IP values. */ - if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) - optname = convert_ws1_ip_optname (optname); - break; - - default: - break; - } - - /* Call getsockopt (or not) */ - if (ignore) - res = 0; - else - { - res = getsockopt (fh->get_socket (), level, optname, (char *) optval, - (int *) optlen); - if (res == SOCKET_ERROR) - { - set_winsock_errno (); - __leave; - } - } - - /* Postprocessing getsockopt, setting fhandler_socket members, etc. - Set onebyte to true for options returning a BOOLEAN instead of a - boolean DWORD. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_ERROR: - { - int *e = (int *) optval; - debug_printf ("WinSock SO_ERROR = %d", *e); - *e = find_winsock_errno (*e); - } - break; - - case SO_KEEPALIVE: - case SO_DONTROUTE: - onebyte = true; - break; - - default: - break; - } - break; - case IPPROTO_TCP: - switch (optname) - { - case TCP_NODELAY: - onebyte = true; - break; - - default: - break; - } - default: - break; - } - - if (onebyte) - { - /* Regression in Vista and later: instead of a 4 byte BOOL value, - a 1 byte BOOLEAN value is returned, in contrast to older systems - and the documentation. Since an int type is expected by the - calling application, we convert the result here. For some reason - only three BSD-compatible socket options seem to be affected. */ - BOOLEAN *in = (BOOLEAN *) optval; - int *out = (int *) optval; - *out = *in; - *optlen = 4; - } - } - __except (EFAULT) - { - res = -1; + if (fh) + ret = fh->getsockopt (level, optname, optval, optlen); } + __except (EFAULT) {} __endtry syscall_printf ("%R = getsockopt(%d, %d, %y, %p, %p)", - res, fd, level, optname, optval, optlen); - return res; + ret, fd, level, optname, optval, optlen); + return ret; } /* POSIX.1-2001 */ From dff3bc9a86c5d07f97dd62dd3279124b4b576296 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 20 Feb 2018 18:14:57 +0100 Subject: [PATCH 272/649] Cygwin: net.cc: drop redundant declarations Replace cygwin_inet_aton call with cygwin_inet_pton Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index dc81fb7de..0d853327e 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -59,11 +59,8 @@ extern "C" { int h_errno; - int __stdcall rcmd (char **ahost, unsigned short inport, char *locuser, - char *remuser, char *cmd, SOCKET * fd2p); int sscanf (const char *, const char *, ...); int cygwin_inet_pton(int, const char *, void *); - int cygwin_inet_aton(const char *, struct in_addr *); const char *cygwin_inet_ntop (int, const void *, char *, socklen_t); int dn_length1(const unsigned char *, const unsigned char *, const unsigned char *); @@ -1792,7 +1789,7 @@ get_ipv4fromreg (struct ifall *ifp, const char *name, DWORD idx) { \ char t[64]; \ sys_wcstombs (t, 64, (u)); \ - cygwin_inet_aton (t, (a)); \ + cygwin_inet_pton (AF_INET, t, (a)); \ } /* If DHCP is used, we have only one address. */ if (dhcp) From 859d215b7e006e5fc60f686ec976e997e35d169b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 21 Feb 2018 21:40:01 +0100 Subject: [PATCH 273/649] Cygwin: split out fhandler_socket into inet and local classes First cut, still incomplete * fhandler_socket is now base class for other socket classes * fhandler_socket_inet handles AF_INET and AF_INET6 sockets * fhandler_socket_local handles AF_LOCAL/AF_UNIX sockets * finally get rid of fdsock by using set_socket_handle in accept4 * align file-related calls (fstat, fstatvfs, fchown, fchmod, facl) to Linux. Signed-off-by: Corinna Vinschen --- winsup/cygwin/Makefile.in | 2 + winsup/cygwin/dtable.cc | 8 +- winsup/cygwin/fhandler.h | 237 ++- winsup/cygwin/fhandler_socket.cc | 2072 +----------------------- winsup/cygwin/fhandler_socket_inet.cc | 1163 +++++++++++++ winsup/cygwin/fhandler_socket_local.cc | 1844 +++++++++++++++++++++ winsup/cygwin/net.cc | 140 -- winsup/cygwin/security.h | 1 + winsup/cygwin/syslog.cc | 40 +- winsup/cygwin/uinfo.cc | 4 +- 10 files changed, 3293 insertions(+), 2218 deletions(-) create mode 100644 winsup/cygwin/fhandler_socket_inet.cc create mode 100644 winsup/cygwin/fhandler_socket_local.cc diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index b75774ace..75ec29707 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -296,6 +296,8 @@ DLL_OFILES:= \ fhandler_registry.o \ fhandler_serial.o \ fhandler_socket.o \ + fhandler_socket_inet.o \ + fhandler_socket_local.o \ fhandler_tape.o \ fhandler_termios.o \ fhandler_tty.o \ diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index f46461823..eb3081e49 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -304,8 +304,8 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) dev.parse (name); else if (strcmp (name, ":sock:") == 0 /* NtQueryObject returns an error when called on an LSP socket - handle. fdsock tries to fetch the underlying base socket, - but this might fail. */ + handle. fhandler_socket::set_socket_handle tries to fetch + the underlying base socket, but this might fail. */ || (strcmp (name, unknown_file) == 0 && !::getsockopt ((SOCKET) handle, SOL_SOCKET, SO_RCVBUF, (char *) &rcv, &len))) @@ -517,10 +517,12 @@ fh_alloc (path_conv& pc) case FH_TCP: case FH_UDP: case FH_ICMP: + fh = cnew (fhandler_socket_inet); + break; case FH_UNIX: case FH_STREAM: case FH_DGRAM: - fh = cnew (fhandler_socket); + fh = cnew (fhandler_socket_local); break; case FH_FS: fh = cnew (fhandler_disk_file); diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index ce9d9246e..d912e1cb7 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -479,9 +479,16 @@ struct wsa_event class fhandler_socket: public fhandler_base { private: + /* permission fake following Linux rules */ + uid_t uid; + uid_t gid; + mode_t mode; + + protected: int addr_family; int type; - int connect_secret[4]; + virtual int af_local_connect () = 0; + int get_socket_flags (); wsa_event *wsock_events; HANDLE wsock_mtx; @@ -491,32 +498,11 @@ class fhandler_socket: public fhandler_base int evaluate_events (const long event_mask, long &events, const bool erase); const HANDLE wsock_event () const { return wsock_evt; } const LONG serial_number () const { return wsock_events->serial_number; } - private: + protected: int wait_for_events (const long event_mask, const DWORD flags); void release_events (); - pid_t sec_pid; - uid_t sec_uid; - gid_t sec_gid; - pid_t sec_peer_pid; - uid_t sec_peer_uid; - gid_t sec_peer_gid; - void af_local_set_secret (char *); - void af_local_setblocking (bool &, bool &); - void af_local_unsetblocking (bool, bool); - void af_local_set_cred (); - void af_local_copy (fhandler_socket *); - bool af_local_recv_secret (); - bool af_local_send_secret (); - bool af_local_recv_cred (); - bool af_local_send_cred (); - int af_local_accept (); - public: - int af_local_connect (); - int af_local_set_no_getpeereid (); - void af_local_set_sockpair_cred (); - - private: + protected: int _rmem; int _wmem; public: @@ -525,22 +511,20 @@ class fhandler_socket: public fhandler_base void rmem (int nrmem) { _rmem = nrmem; } void wmem (int nwmem) { _wmem = nwmem; } - private: + protected: DWORD _rcvtimeo; /* msecs */ DWORD _sndtimeo; /* msecs */ public: DWORD &rcvtimeo () { return _rcvtimeo; } DWORD &sndtimeo () { return _sndtimeo; } - private: + protected: struct _WSAPROTOCOL_INFOW *prot_info_ptr; public: void init_fixup_before (); bool need_fixup_before () const {return prot_info_ptr != NULL;} - private: - char *sun_path; - char *peer_sun_path; + protected: struct status_flags { unsigned async_io : 1; /* async I/O */ @@ -580,35 +564,34 @@ class fhandler_socket: public fhandler_base IMPLEMENT_STATUS_FLAG (conn_state, connect_state) IMPLEMENT_STATUS_FLAG (bool, no_getpeereid) - int socket (int af, int type, int protocol, int flags); - int bind (const struct sockaddr *name, int namelen); - int connect (const struct sockaddr *name, int namelen); - int listen (int backlog); - int accept4 (struct sockaddr *peer, int *len, int flags); - int getsockname (struct sockaddr *name, int *namelen); - int getpeername (struct sockaddr *name, int *namelen); - int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); - int socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out); - int setsockopt (int level, int optname, const void *optval, - __socklen_t optlen); - int getsockopt (int level, int optname, const void *optval, - __socklen_t *optlen); + virtual int socket (int af, int type, int protocol, int flags) = 0; + virtual int socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out) = 0; + virtual int bind (const struct sockaddr *name, int namelen) = 0; + virtual int listen (int backlog) = 0; + virtual int accept4 (struct sockaddr *peer, int *len, int flags) = 0; + virtual int connect (const struct sockaddr *name, int namelen) = 0; + virtual int getsockname (struct sockaddr *name, int *namelen) = 0; + virtual int getpeername (struct sockaddr *name, int *namelen) = 0; + virtual int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); + virtual int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen) = 0; + virtual int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen) = 0; int open (int flags, mode_t mode = 0); - void __reg3 read (void *ptr, size_t& len); - ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1); - inline ssize_t __reg3 recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); - ssize_t recvfrom (void *ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen); - ssize_t recvmsg (struct msghdr *msg, int flags); + virtual ssize_t recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen) = 0; + virtual ssize_t recvmsg (struct msghdr *msg, int flags) = 0; + virtual void __reg3 read (void *ptr, size_t& len) = 0; + virtual ssize_t __stdcall readv (const struct iovec *, int iovcnt, + ssize_t tot = -1) = 0; - ssize_t __stdcall write (const void *ptr, size_t len); - ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); - inline ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); - ssize_t sendto (const void *ptr, size_t len, int flags, - const struct sockaddr *to, int tolen); - ssize_t sendmsg (const struct msghdr *msg, int flags); + virtual ssize_t sendto (const void *ptr, size_t len, int flags, + const struct sockaddr *to, int tolen) = 0; + virtual ssize_t sendmsg (const struct msghdr *msg, int flags) = 0; + virtual ssize_t __stdcall write (const void *ptr, size_t len) = 0; + virtual ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1) = 0; int ioctl (unsigned int cmd, void *); int fcntl (int cmd, intptr_t); @@ -635,31 +618,159 @@ class fhandler_socket: public fhandler_base int get_addr_family () {return addr_family;} void set_socket_type (int st) { type = st;} int get_socket_type () {return type;} + + int __reg2 fstat (struct stat *buf); + int __reg2 fstatvfs (struct statvfs *buf); + int __reg1 fchmod (mode_t newmode); + int __reg2 fchown (uid_t newuid, gid_t newgid); + int __reg3 facl (int, int, struct acl *); + int __reg2 link (const char *); +}; + +class fhandler_socket_inet: public fhandler_socket +{ + protected: + int af_local_connect () { return 0; } + + private: + inline ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); + inline ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); + + public: + fhandler_socket_inet (); + ~fhandler_socket_inet (); + + int socket (int af, int type, int protocol, int flags); + int socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out); + int bind (const struct sockaddr *name, int namelen); + int listen (int backlog); + int accept4 (struct sockaddr *peer, int *len, int flags); + int connect (const struct sockaddr *name, int namelen); + int getsockname (struct sockaddr *name, int *namelen); + int getpeername (struct sockaddr *name, int *namelen); + int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen); + int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen); + ssize_t recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen); + ssize_t recvmsg (struct msghdr *msg, int flags); + void __reg3 read (void *ptr, size_t& len); + ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1); + ssize_t sendto (const void *ptr, size_t len, int flags, + const struct sockaddr *to, int tolen); + ssize_t sendmsg (const struct msghdr *msg, int flags); + ssize_t __stdcall write (const void *ptr, size_t len); + ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + + /* from here on: CLONING */ + fhandler_socket_inet (void *) {} + + void copyto (fhandler_base *x) + { + x->pc.free_strings (); + *reinterpret_cast (x) = *this; + x->reset (this); + } + + fhandler_socket_inet *clone (cygheap_types malloc_type = HEAP_FHANDLER) + { + void *ptr = (void *) ccalloc (malloc_type, 1, sizeof (fhandler_socket_inet)); + fhandler_socket_inet *fh = new (ptr) fhandler_socket_inet (ptr); + copyto (fh); + return fh; + } +}; + +class fhandler_socket_local: public fhandler_socket +{ + protected: + char *sun_path; + char *peer_sun_path; void set_sun_path (const char *path); char *get_sun_path () {return sun_path;} void set_peer_sun_path (const char *path); char *get_peer_sun_path () {return peer_sun_path;} + protected: + int connect_secret[4]; + pid_t sec_pid; + uid_t sec_uid; + gid_t sec_gid; + pid_t sec_peer_pid; + uid_t sec_peer_uid; + gid_t sec_peer_gid; + void af_local_set_secret (char *); + void af_local_setblocking (bool &, bool &); + void af_local_unsetblocking (bool, bool); + void af_local_set_cred (); + void af_local_copy (fhandler_socket_local *); + bool af_local_recv_secret (); + bool af_local_send_secret (); + bool af_local_recv_cred (); + bool af_local_send_cred (); + int af_local_accept (); + int af_local_connect (); + int af_local_set_no_getpeereid (); + void af_local_set_sockpair_cred (); + + private: + inline ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); + inline ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); + + public: + fhandler_socket_local (); + ~fhandler_socket_local (); + + int dup (fhandler_base *child, int); + + int socket (int af, int type, int protocol, int flags); + int socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out); + int bind (const struct sockaddr *name, int namelen); + int listen (int backlog); + int accept4 (struct sockaddr *peer, int *len, int flags); + int connect (const struct sockaddr *name, int namelen); + int getsockname (struct sockaddr *name, int *namelen); + int getpeername (struct sockaddr *name, int *namelen); + int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); + int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen); + int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen); + ssize_t recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen); + ssize_t recvmsg (struct msghdr *msg, int flags); + void __reg3 read (void *ptr, size_t& len); + ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1); + ssize_t sendto (const void *ptr, size_t len, int flags, + const struct sockaddr *to, int tolen); + ssize_t sendmsg (const struct msghdr *msg, int flags); + ssize_t __stdcall write (const void *ptr, size_t len); + ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int __reg2 fstat (struct stat *buf); int __reg2 fstatvfs (struct statvfs *buf); - int __reg1 fchmod (mode_t mode); - int __reg2 fchown (uid_t uid, gid_t gid); + int __reg1 fchmod (mode_t newmode); + int __reg2 fchown (uid_t newuid, gid_t newgid); int __reg3 facl (int, int, struct acl *); int __reg2 link (const char *); - fhandler_socket (void *) {} + /* from here on: CLONING */ + fhandler_socket_local (void *) {} void copyto (fhandler_base *x) { x->pc.free_strings (); - *reinterpret_cast (x) = *this; + *reinterpret_cast (x) = *this; x->reset (this); } - fhandler_socket *clone (cygheap_types malloc_type = HEAP_FHANDLER) + fhandler_socket_local *clone (cygheap_types malloc_type = HEAP_FHANDLER) { - void *ptr = (void *) ccalloc (malloc_type, 1, sizeof (fhandler_socket)); - fhandler_socket *fh = new (ptr) fhandler_socket (ptr); + void *ptr = (void *) ccalloc (malloc_type, 1, sizeof (fhandler_socket_local)); + fhandler_socket_local *fh = new (ptr) fhandler_socket_local (ptr); copyto (fh); return fh; } @@ -2223,6 +2334,8 @@ typedef union char __registry[sizeof (fhandler_registry)]; char __serial[sizeof (fhandler_serial)]; char __socket[sizeof (fhandler_socket)]; + char __socket_inet[sizeof (fhandler_socket_inet)]; + char __socket_local[sizeof (fhandler_socket_local)]; char __termios[sizeof (fhandler_termios)]; char __pty_common[sizeof (fhandler_pty_common)]; char __pty_slave[sizeof (fhandler_pty_slave)]; diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 26d4716b4..371cc398c 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -6,8 +6,6 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -/* #define DEBUG_NEST_ON 1 */ - #define __INSIDE_CYGWIN_NET__ #define USE_SYS_TYPES_FD_SET @@ -45,194 +43,29 @@ #include #include "ntdll.h" #include "miscfuncs.h" +#include "tls_pbuf.h" #define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) #define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) -extern bool fdsock (cygheap_fdmanip& fd, const device *, SOCKET soc); extern "C" { -int sscanf (const char *, const char *, ...); + int sscanf (const char *, const char *, ...); } /* End of "C" section */ -static inline mode_t -adjust_socket_file_mode (mode_t mode) -{ - /* Kludge: Don't allow to remove read bit on socket files for - user/group/other, if the accompanying write bit is set. It would - be nice to have exact permissions on a socket file, but it's - necessary that somebody able to access the socket can always read - the contents of the socket file to avoid spurious "permission - denied" messages. */ - return mode | ((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) << 1); -} - -/* cygwin internal: map sockaddr into internet domain address */ -int -get_inet_addr (const struct sockaddr *in, int inlen, - struct sockaddr_storage *out, int *outlen, - int *type = NULL, int *secret = NULL) -{ - int secret_buf [4]; - int* secret_ptr = (secret ? : secret_buf); - - switch (in->sa_family) - { - case AF_LOCAL: - /* Check for abstract socket. These are generated for AF_LOCAL datagram - sockets in recv_internal, to allow a datagram server to use sendto - after recvfrom. */ - if (inlen >= (int) sizeof (in->sa_family) + 7 - && in->sa_data[0] == '\0' && in->sa_data[1] == 'd' - && in->sa_data[6] == '\0') - { - struct sockaddr_in addr; - addr.sin_family = AF_INET; - sscanf (in->sa_data + 2, "%04hx", &addr.sin_port); - addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - *outlen = sizeof addr; - memcpy (out, &addr, *outlen); - return 0; - } - break; - case AF_INET: - memcpy (out, in, inlen); - *outlen = inlen; - /* If the peer address given in connect or sendto is the ANY address, - Winsock fails with WSAEADDRNOTAVAIL, while Linux converts that into - a connection/send attempt to LOOPBACK. We're doing the same here. */ - if (((struct sockaddr_in *) out)->sin_addr.s_addr == htonl (INADDR_ANY)) - ((struct sockaddr_in *) out)->sin_addr.s_addr = htonl (INADDR_LOOPBACK); - return 0; - case AF_INET6: - memcpy (out, in, inlen); - *outlen = inlen; - /* See comment in AF_INET case. */ - if (IN6_IS_ADDR_UNSPECIFIED (&((struct sockaddr_in6 *) out)->sin6_addr)) - ((struct sockaddr_in6 *) out)->sin6_addr = in6addr_loopback; - return 0; - default: - set_errno (EAFNOSUPPORT); - return SOCKET_ERROR; - } - /* AF_LOCAL/AF_UNIX only */ - path_conv pc (in->sa_data, PC_SYM_FOLLOW); - if (pc.error) - { - set_errno (pc.error); - return SOCKET_ERROR; - } - if (!pc.exists ()) - { - set_errno (ENOENT); - return SOCKET_ERROR; - } - /* Do NOT test for the file being a socket file here. The socket file - creation is not an atomic operation, so there is a chance that socket - files which are just in the process of being created are recognized - as non-socket files. To work around this problem we now create the - file with all sharing disabled. If the below NtOpenFile fails - with STATUS_SHARING_VIOLATION we know that the file already exists, - but the creating process isn't finished yet. So we yield and try - again, until we can either open the file successfully, or some error - other than STATUS_SHARING_VIOLATION occurs. - Since we now don't know if the file is actually a socket file, we - perform this check here explicitely. */ - NTSTATUS status; - HANDLE fh; - OBJECT_ATTRIBUTES attr; - IO_STATUS_BLOCK io; - - pc.get_object_attr (attr, sec_none_nih); - do - { - status = NtOpenFile (&fh, GENERIC_READ | SYNCHRONIZE, &attr, &io, - FILE_SHARE_VALID_FLAGS, - FILE_SYNCHRONOUS_IO_NONALERT - | FILE_OPEN_FOR_BACKUP_INTENT - | FILE_NON_DIRECTORY_FILE); - if (status == STATUS_SHARING_VIOLATION) - { - /* While we hope that the sharing violation is only temporary, we - also could easily get stuck here, waiting for a file in use by - some greedy Win32 application. Therefore we should never wait - endlessly without checking for signals and thread cancel event. */ - pthread_testcancel (); - if (cygwait (NULL, cw_nowait, cw_sig_eintr) == WAIT_SIGNALED - && !_my_tls.call_signal_handler ()) - { - set_errno (EINTR); - return SOCKET_ERROR; - } - yield (); - } - else if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - return SOCKET_ERROR; - } - } - while (status == STATUS_SHARING_VIOLATION); - /* Now test for the SYSTEM bit. */ - FILE_BASIC_INFORMATION fbi; - status = NtQueryInformationFile (fh, &io, &fbi, sizeof fbi, - FileBasicInformation); - if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - return SOCKET_ERROR; - } - if (!(fbi.FileAttributes & FILE_ATTRIBUTE_SYSTEM)) - { - NtClose (fh); - set_errno (EBADF); - return SOCKET_ERROR; - } - /* Eventually check the content and fetch the required information. */ - char buf[128]; - memset (buf, 0, sizeof buf); - status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, 128, NULL, NULL); - NtClose (fh); - if (NT_SUCCESS (status)) - { - struct sockaddr_in sin; - char ctype; - sin.sin_family = AF_INET; - if (strncmp (buf, SOCKET_COOKIE, strlen (SOCKET_COOKIE))) - { - set_errno (EBADF); - return SOCKET_ERROR; - } - sscanf (buf + strlen (SOCKET_COOKIE), "%hu %c %08x-%08x-%08x-%08x", - &sin.sin_port, - &ctype, - secret_ptr, secret_ptr + 1, secret_ptr + 2, secret_ptr + 3); - sin.sin_port = htons (sin.sin_port); - sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - memcpy (out, &sin, sizeof sin); - *outlen = sizeof sin; - if (type) - *type = (ctype == 's' ? SOCK_STREAM : - ctype == 'd' ? SOCK_DGRAM - : 0); - return 0; - } - __seterrno_from_nt_status (status); - return SOCKET_ERROR; -} - /**********************************************************************/ /* fhandler_socket */ fhandler_socket::fhandler_socket () : fhandler_base (), + uid (myself->uid), + gid (myself->gid), + mode (S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO), wsock_events (NULL), wsock_mtx (NULL), wsock_evt (NULL), _rcvtimeo (INFINITE), _sndtimeo (INFINITE), prot_info_ptr (NULL), - sun_path (NULL), - peer_sun_path (NULL), status () { need_fork_fixup (true); @@ -242,10 +75,6 @@ fhandler_socket::~fhandler_socket () { if (prot_info_ptr) cfree (prot_info_ptr); - if (sun_path) - cfree (sun_path); - if (peer_sun_path) - cfree (peer_sun_path); } char * @@ -359,384 +188,6 @@ fhandler_socket::set_socket_handle (SOCKET sock, int af, int type, int flags) return 0; } -int -fhandler_socket::socket (int af, int type, int protocol, int flags) -{ - SOCKET sock; - int ret; - - sock = ::socket (af == AF_LOCAL ? AF_INET : af, type, protocol); - if (sock == INVALID_SOCKET) - { - set_winsock_errno (); - return -1; - } - ret = set_socket_handle (sock, af, type, flags); - if (ret < 0) - ::closesocket (sock); - return ret; -} - -/* fhandler_socket::socketpair is called on the fhandler handling the - accepting socket, fh_out is the fhandler for the connecting socket. */ -int -fhandler_socket::socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out) -{ - SOCKET insock = INVALID_SOCKET; - SOCKET outsock = INVALID_SOCKET; - SOCKET sock = INVALID_SOCKET; - struct sockaddr_in sock_in, sock_out; - int len; - - /* create listening socket */ - sock = ::socket (AF_INET, type, 0); - if (sock == INVALID_SOCKET) - { - set_winsock_errno (); - goto err; - } - /* bind to unused port */ - sock_in.sin_family = AF_INET; - sock_in.sin_port = 0; - sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (::bind (sock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) - { - set_winsock_errno (); - goto err; - } - /* fetch socket name */ - len = sizeof (sock_in); - if (::getsockname (sock, (struct sockaddr *) &sock_in, &len) < 0) - { - set_winsock_errno (); - goto err; - } - /* on stream sockets, create listener */ - if (type == SOCK_STREAM && ::listen (sock, 2) < 0) - { - set_winsock_errno (); - goto err; - } - /* create connecting socket */ - outsock = ::socket (AF_INET, type, 0); - if (outsock == INVALID_SOCKET) - { - set_winsock_errno (); - goto err; - } - /* on datagram sockets, bind connecting socket */ - if (type == SOCK_DGRAM) - { - sock_out.sin_family = AF_INET; - sock_out.sin_port = 0; - sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (::bind (outsock, (struct sockaddr *) &sock_out, - sizeof (sock_out)) < 0) - { - set_winsock_errno (); - goto err; - } - /* ...and fetch name */ - len = sizeof (sock_out); - if (::getsockname (outsock, (struct sockaddr *) &sock_out, &len) < 0) - { - set_winsock_errno (); - goto err; - } - } - sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (type == SOCK_DGRAM) - sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - /* connect */ - if (::connect (outsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) - { - set_winsock_errno (); - goto err; - } - if (type == SOCK_STREAM) - { - /* on stream sockets, accept connection and close listener */ - len = sizeof (sock_in); - insock = ::accept (sock, (struct sockaddr *) &sock_in, &len); - if (insock == INVALID_SOCKET) - { - set_winsock_errno (); - goto err; - } - ::closesocket (sock); - } - else - { - /* on datagram sockets, connect vice versa */ - if (::connect (sock, (struct sockaddr *) &sock_out, - sizeof (sock_out)) < 0) - { - set_winsock_errno (); - goto err; - } - insock = sock; - } - sock = INVALID_SOCKET; - - /* postprocessing */ - connect_state (connected); - fh_out->connect_state (connected); - if (af == AF_LOCAL && type == SOCK_STREAM) - { - af_local_set_sockpair_cred (); - fh_out->af_local_set_sockpair_cred (); - } - if (set_socket_handle (insock, af, type, flags) < 0 - || fh_out->set_socket_handle (outsock, af, type, flags) < 0) - goto err; - - return 0; - -err: - if (sock != INVALID_SOCKET) - ::closesocket (sock); - if (insock != INVALID_SOCKET) - ::closesocket (insock); - if (outsock != INVALID_SOCKET) - ::closesocket (outsock); - return -1; -} - -void -fhandler_socket::af_local_set_sockpair_cred () -{ - sec_pid = sec_peer_pid = getpid (); - sec_uid = sec_peer_uid = geteuid32 (); - sec_gid = sec_peer_gid = getegid32 (); -} - -void -fhandler_socket::af_local_setblocking (bool &async, bool &nonblocking) -{ - async = async_io (); - nonblocking = is_nonblocking (); - if (async) - { - WSAAsyncSelect (get_socket (), winmsg, 0, 0); - WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); - } - set_nonblocking (false); - async_io (false); -} - -void -fhandler_socket::af_local_unsetblocking (bool async, bool nonblocking) -{ - if (nonblocking) - set_nonblocking (true); - if (async) - { - WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, ASYNC_MASK); - async_io (true); - } -} - -bool -fhandler_socket::af_local_recv_secret () -{ - int out[4] = { 0, 0, 0, 0 }; - int rest = sizeof out; - char *ptr = (char *) out; - while (rest > 0) - { - int ret = recvfrom (ptr, rest, 0, NULL, NULL); - if (ret <= 0) - break; - rest -= ret; - ptr += ret; - } - if (rest == 0) - { - debug_printf ("Received af_local secret: %08x-%08x-%08x-%08x", - out[0], out[1], out[2], out[3]); - if (out[0] != connect_secret[0] || out[1] != connect_secret[1] - || out[2] != connect_secret[2] || out[3] != connect_secret[3]) - { - debug_printf ("Receiving af_local secret mismatch"); - return false; - } - } - else - debug_printf ("Receiving af_local secret failed"); - return rest == 0; -} - -bool -fhandler_socket::af_local_send_secret () -{ - int rest = sizeof connect_secret; - char *ptr = (char *) connect_secret; - while (rest > 0) - { - int ret = sendto (ptr, rest, 0, NULL, 0); - if (ret <= 0) - break; - rest -= ret; - ptr += ret; - } - debug_printf ("Sending af_local secret %s", rest == 0 ? "succeeded" - : "failed"); - return rest == 0; -} - -bool -fhandler_socket::af_local_recv_cred () -{ - struct ucred out = { (pid_t) 0, (uid_t) -1, (gid_t) -1 }; - int rest = sizeof out; - char *ptr = (char *) &out; - while (rest > 0) - { - int ret = recvfrom (ptr, rest, 0, NULL, NULL); - if (ret <= 0) - break; - rest -= ret; - ptr += ret; - } - if (rest == 0) - { - debug_printf ("Received eid credentials: pid: %d, uid: %d, gid: %d", - out.pid, out.uid, out.gid); - sec_peer_pid = out.pid; - sec_peer_uid = out.uid; - sec_peer_gid = out.gid; - } - else - debug_printf ("Receiving eid credentials failed"); - return rest == 0; -} - -bool -fhandler_socket::af_local_send_cred () -{ - struct ucred in = { sec_pid, sec_uid, sec_gid }; - int rest = sizeof in; - char *ptr = (char *) ∈ - while (rest > 0) - { - int ret = sendto (ptr, rest, 0, NULL, 0); - if (ret <= 0) - break; - rest -= ret; - ptr += ret; - } - if (rest == 0) - debug_printf ("Sending eid credentials succeeded"); - else - debug_printf ("Sending eid credentials failed"); - return rest == 0; -} - -int -fhandler_socket::af_local_connect () -{ - bool orig_async_io, orig_is_nonblocking; - - if (get_addr_family () != AF_LOCAL || get_socket_type () != SOCK_STREAM) - return 0; - - debug_printf ("af_local_connect called, no_getpeereid=%d", no_getpeereid ()); - if (no_getpeereid ()) - return 0; - - af_local_setblocking (orig_async_io, orig_is_nonblocking); - if (!af_local_send_secret () || !af_local_recv_secret () - || !af_local_send_cred () || !af_local_recv_cred ()) - { - debug_printf ("accept from unauthorized server"); - ::shutdown (get_socket (), SD_BOTH); - WSASetLastError (WSAECONNREFUSED); - return -1; - } - af_local_unsetblocking (orig_async_io, orig_is_nonblocking); - return 0; -} - -int -fhandler_socket::af_local_accept () -{ - bool orig_async_io, orig_is_nonblocking; - - debug_printf ("af_local_accept called, no_getpeereid=%d", no_getpeereid ()); - if (no_getpeereid ()) - return 0; - - af_local_setblocking (orig_async_io, orig_is_nonblocking); - if (!af_local_recv_secret () || !af_local_send_secret () - || !af_local_recv_cred () || !af_local_send_cred ()) - { - debug_printf ("connect from unauthorized client"); - ::shutdown (get_socket (), SD_BOTH); - ::closesocket (get_socket ()); - WSASetLastError (WSAECONNABORTED); - return -1; - } - af_local_unsetblocking (orig_async_io, orig_is_nonblocking); - return 0; -} - -int -fhandler_socket::af_local_set_no_getpeereid () -{ - if (get_addr_family () != AF_LOCAL || get_socket_type () != SOCK_STREAM) - { - set_errno (EINVAL); - return -1; - } - if (connect_state () != unconnected) - { - set_errno (EALREADY); - return -1; - } - - debug_printf ("no_getpeereid set"); - no_getpeereid (true); - return 0; -} - -void -fhandler_socket::af_local_set_cred () -{ - sec_pid = getpid (); - sec_uid = geteuid32 (); - sec_gid = getegid32 (); - sec_peer_pid = (pid_t) 0; - sec_peer_uid = (uid_t) -1; - sec_peer_gid = (gid_t) -1; -} - -void -fhandler_socket::af_local_copy (fhandler_socket *sock) -{ - sock->connect_secret[0] = connect_secret[0]; - sock->connect_secret[1] = connect_secret[1]; - sock->connect_secret[2] = connect_secret[2]; - sock->connect_secret[3] = connect_secret[3]; - sock->sec_pid = sec_pid; - sock->sec_uid = sec_uid; - sock->sec_gid = sec_gid; - sock->sec_peer_pid = sec_peer_pid; - sock->sec_peer_uid = sec_peer_uid; - sock->sec_peer_gid = sec_peer_gid; - sock->no_getpeereid (no_getpeereid ()); -} - -void -fhandler_socket::af_local_set_secret (char *buf) -{ - if (!RtlGenRandom (connect_secret, sizeof (connect_secret))) - bzero ((char*) connect_secret, sizeof (connect_secret)); - __small_sprintf (buf, "%08x-%08x-%08x-%08x", - connect_secret [0], connect_secret [1], - connect_secret [2], connect_secret [3]); -} - /* Maximum number of concurrently opened sockets from all Cygwin processes per session. Note that shared sockets (through dup/fork/exec) are counted as one socket. */ @@ -874,12 +325,7 @@ fhandler_socket::init_events () NtClose (wsock_mtx); return false; } - - /* sock type not yet set here. */ - /* FIXME: as soon as we switch to socket method, we're good to use - get_socket_type (). */ - - if (pc.dev == FH_UDP || pc.dev == FH_DGRAM) + if (get_socket_type () == SOCK_DGRAM) wsock_events->events = FD_WRITE; return true; } @@ -1075,9 +521,9 @@ fhandler_socket::release_events () } } -/* Called from net.cc:fdsock() if a freshly created socket is not - inheritable. In that case we use fixup_before_fork_exec. See - the comment in fdsock() for a description of the problem. */ +/* Called if a freshly created socket is not inheritable. In that case we + have to use fixup_before_fork_exec. See comment in set_socket_handle for + a description of the problem. */ void fhandler_socket::init_fixup_before () { @@ -1155,11 +601,6 @@ fhandler_socket::dup (fhandler_base *child, int flags) NtClose (fhs->wsock_mtx); return -1; } - if (get_addr_family () == AF_LOCAL) - { - fhs->set_sun_path (get_sun_path ()); - fhs->set_peer_sun_path (get_peer_sun_path ()); - } if (!need_fixup_before ()) { int ret = fhandler_base::dup (child, flags); @@ -1192,40 +633,18 @@ int __reg2 fhandler_socket::fstat (struct stat *buf) { int res; - if (get_addr_family () == AF_LOCAL) + + res = fhandler_socket::fstat (buf); + if (!res) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') - { - memset (buf, 0, sizeof *buf); - buf->st_dev = FH_UNIX; - buf->st_ino = get_plain_ino (); - buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO; - buf->st_nlink = 1; - buf->st_uid = myself->uid; - buf->st_gid = myself->gid; - time_as_timestruc_t (&buf->st_ctim); - buf->st_blksize = 4096; - return 0; - } - res = fhandler_base::fstat_fs (buf); - if (!res) - { - buf->st_mode = (buf->st_mode & ~S_IFMT) | S_IFSOCK; - buf->st_size = 0; - } - } - else - { - res = fhandler_base::fstat (buf); - if (!res) - { - buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0); - if (!(buf->st_ino = get_plain_ino ())) - sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]", - (long long *) &buf->st_ino); - buf->st_mode = S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO; - buf->st_size = 0; - } + buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0); + if (!(buf->st_ino = get_plain_ino ())) + sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]", + (long long *) &buf->st_ino); + buf->st_uid = uid; + buf->st_gid = gid; + buf->st_mode = mode; + buf->st_size = 0; } return res; } @@ -1233,1059 +652,85 @@ fhandler_socket::fstat (struct stat *buf) int __reg2 fhandler_socket::fstatvfs (struct statvfs *sfs) { - if (get_addr_family () == AF_LOCAL) + memset (sfs, 0, sizeof (*sfs)); + sfs->f_bsize = sfs->f_frsize = 4096; + sfs->f_namemax = NAME_MAX; + return 0; +} + +int +fhandler_socket::fchmod (mode_t newmode) +{ + mode = (newmode & ~S_IFMT) | S_IFSOCK; + return 0; +} + +int +fhandler_socket::fchown (uid_t newuid, gid_t newgid) +{ + bool perms = check_token_membership (&well_known_admins_sid); + + /* Admin rulez */ + if (!perms) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') + /* Otherwise, new uid == old uid or current uid is fine */ + if (newuid == ILLEGAL_UID || newuid == uid || newuid == myself->uid) + perms = true; + /* Otherwise, new gid == old gid or current gid is fine */ + else if (newgid == ILLEGAL_GID || newgid == gid || newgid == myself->gid) + perms = true; + else { - memset (sfs, 0, sizeof (*sfs)); - sfs->f_bsize = sfs->f_frsize = 4096; - sfs->f_namemax = NAME_MAX; - return 0; + /* Last but not least, newgid in supplementary group list is fine */ + tmp_pathbuf tp; + gid_t *gids = (gid_t *) tp.w_get (); + int num = getgroups (65536 / sizeof (*gids), gids); + + for (int idx = 0; idx < num; ++idx) + if (newgid == gids[idx]) + { + perms = true; + break; + } } - fhandler_disk_file fh (pc); - fh.get_device () = FH_FS; - return fh.fstatvfs (sfs); - } - set_errno (EBADF); - return -1; -} + } -int -fhandler_socket::fchmod (mode_t mode) -{ - if (get_addr_family () == AF_LOCAL) + if (perms) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') - return 0; - fhandler_disk_file fh (pc); - fh.get_device () = FH_FS; - int ret = fh.fchmod (S_IFSOCK | adjust_socket_file_mode (mode)); - return ret; + if (newuid != ILLEGAL_UID) + uid = newuid; + if (newgid != ILLEGAL_GID) + gid = newgid; + return 0; } - set_errno (EBADF); - return -1; -} - -int -fhandler_socket::fchown (uid_t uid, gid_t gid) -{ - if (get_addr_family () == AF_LOCAL) - { - if (!get_sun_path () || get_sun_path ()[0] == '\0') - return 0; - fhandler_disk_file fh (pc); - return fh.fchown (uid, gid); - } - set_errno (EBADF); + set_errno (EPERM); return -1; } int fhandler_socket::facl (int cmd, int nentries, aclent_t *aclbufp) { - if (get_addr_family () == AF_LOCAL) - { - if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_base::facl (cmd, nentries, aclbufp); - fhandler_disk_file fh (pc); - return fh.facl (cmd, nentries, aclbufp); - } - set_errno (EBADF); + set_errno (EOPNOTSUPP); return -1; } int fhandler_socket::link (const char *newpath) { - if (get_addr_family () == AF_LOCAL) - { - fhandler_disk_file fh (pc); - return fh.link (newpath); - } return fhandler_base::link (newpath); } int -fhandler_socket::bind (const struct sockaddr *name, int namelen) +fhandler_socket::get_socket_flags () { - int res = -1; - - if (name->sa_family == AF_LOCAL) - { -#define un_addr ((struct sockaddr_un *) name) - struct sockaddr_in sin; - int len = namelen - offsetof (struct sockaddr_un, sun_path); - - /* Check that name is within bounds. Don't check if the string is - NUL-terminated, because there are projects out there which set - namelen to a value which doesn't cover the trailing NUL. */ - if (len <= 1 || (len = strnlen (un_addr->sun_path, len)) > UNIX_PATH_MAX) - { - set_errno (len <= 1 ? (len == 1 ? ENOENT : EINVAL) : ENAMETOOLONG); - goto out; - } - /* Copy over the sun_path string into a buffer big enough to add a - trailing NUL. */ - char sun_path[len + 1]; - strncpy (sun_path, un_addr->sun_path, len); - sun_path[len] = '\0'; - - /* This isn't entirely foolproof, but we check first if the file exists - so we can return with EADDRINUSE before having bound the socket. - This allows an application to call bind again on the same socket using - another filename. If we bind first, the application will not be able - to call bind successfully ever again. */ - path_conv pc (sun_path, PC_SYM_FOLLOW); - if (pc.error) - { - set_errno (pc.error); - goto out; - } - if (pc.exists ()) - { - set_errno (EADDRINUSE); - goto out; - } - - sin.sin_family = AF_INET; - sin.sin_port = 0; - sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - if (::bind (get_socket (), (sockaddr *) &sin, len = sizeof sin)) - { - syscall_printf ("AF_LOCAL: bind failed"); - set_winsock_errno (); - goto out; - } - if (::getsockname (get_socket (), (sockaddr *) &sin, &len)) - { - syscall_printf ("AF_LOCAL: getsockname failed"); - set_winsock_errno (); - goto out; - } - - sin.sin_port = ntohs (sin.sin_port); - debug_printf ("AF_LOCAL: socket bound to port %u", sin.sin_port); - - mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - DWORD fattr = FILE_ATTRIBUTE_SYSTEM; - if (!pc.has_acls () - && !(mode & ~cygheap->umask & (S_IWUSR | S_IWGRP | S_IWOTH))) - fattr |= FILE_ATTRIBUTE_READONLY; - SECURITY_ATTRIBUTES sa = sec_none_nih; - NTSTATUS status; - HANDLE fh; - OBJECT_ATTRIBUTES attr; - IO_STATUS_BLOCK io; - ULONG access = DELETE | FILE_GENERIC_WRITE; - - /* If the filesystem supports ACLs, we will overwrite the DACL after the - call to NtCreateFile. This requires a handle with READ_CONTROL and - WRITE_DAC access, otherwise get_file_sd and set_file_sd both have to - open the file again. - FIXME: On remote NTFS shares open sometimes fails because even the - creator of the file doesn't have the right to change the DACL. - I don't know what setting that is or how to recognize such a share, - so for now we don't request WRITE_DAC on remote drives. */ - if (pc.has_acls () && !pc.isremote ()) - access |= READ_CONTROL | WRITE_DAC | WRITE_OWNER; - - status = NtCreateFile (&fh, access, pc.get_object_attr (attr, sa), &io, - NULL, fattr, 0, FILE_CREATE, - FILE_NON_DIRECTORY_FILE - | FILE_SYNCHRONOUS_IO_NONALERT - | FILE_OPEN_FOR_BACKUP_INTENT, - NULL, 0); - if (!NT_SUCCESS (status)) - { - if (io.Information == FILE_EXISTS) - set_errno (EADDRINUSE); - else - __seterrno_from_nt_status (status); - } - else - { - if (pc.has_acls ()) - set_created_file_access (fh, pc, mode); - char buf[sizeof (SOCKET_COOKIE) + 80]; - __small_sprintf (buf, "%s%u %c ", SOCKET_COOKIE, sin.sin_port, - get_socket_type () == SOCK_STREAM ? 's' - : get_socket_type () == SOCK_DGRAM ? 'd' : '-'); - af_local_set_secret (strchr (buf, '\0')); - DWORD blen = strlen (buf) + 1; - status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, blen, NULL, 0); - if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - FILE_DISPOSITION_INFORMATION fdi = { TRUE }; - status = NtSetInformationFile (fh, &io, &fdi, sizeof fdi, - FileDispositionInformation); - if (!NT_SUCCESS (status)) - debug_printf ("Setting delete dispostion failed, status = %y", - status); - } - else - { - set_sun_path (sun_path); - res = 0; - } - NtClose (fh); - } -#undef un_addr - } - else - { - if (!saw_reuseaddr ()) - { - /* If the application didn't explicitely request SO_REUSEADDR, - enforce POSIX standard socket binding behaviour by setting the - SO_EXCLUSIVEADDRUSE socket option. See cygwin_setsockopt() - for a more detailed description. */ - int on = 1; - int ret = ::setsockopt (get_socket (), SOL_SOCKET, - SO_EXCLUSIVEADDRUSE, - (const char *) &on, sizeof on); - debug_printf ("%d = setsockopt(SO_EXCLUSIVEADDRUSE), %E", ret); - } - if (::bind (get_socket (), name, namelen)) - set_winsock_errno (); - else - res = 0; - } - -out: - return res; -} - -int -fhandler_socket::connect (const struct sockaddr *name, int namelen) -{ - struct sockaddr_storage sst; - int type = 0; - - if (get_inet_addr (name, namelen, &sst, &namelen, &type, connect_secret) - == SOCKET_ERROR) - return SOCKET_ERROR; - - if (get_addr_family () == AF_LOCAL) - { - if (get_socket_type () != type) - { - WSASetLastError (WSAEPROTOTYPE); - set_winsock_errno (); - return SOCKET_ERROR; - } - - set_peer_sun_path (name->sa_data); - - /* Don't move af_local_set_cred into af_local_connect which may be called - via select, possibly running under another identity. Call early here, - because af_local_connect is called in wait_for_events. */ - if (get_socket_type () == SOCK_STREAM) - af_local_set_cred (); - } - - /* Initialize connect state to "connect_pending". State is ultimately set - to "connected" or "connect_failed" in wait_for_events when the FD_CONNECT - event occurs. Note that the underlying OS sockets are always non-blocking - and a successfully initiated non-blocking Winsock connect always returns - WSAEWOULDBLOCK. Thus it's safe to rely on event handling. - - Check for either unconnected or connect_failed since in both cases it's - allowed to retry connecting the socket. It's also ok (albeit ugly) to - call connect to check if a previous non-blocking connect finished. - - Set connect_state before calling connect, otherwise a race condition with - an already running select or poll might occur. */ - if (connect_state () == unconnected || connect_state () == connect_failed) - connect_state (connect_pending); - - int res = ::connect (get_socket (), (struct sockaddr *) &sst, namelen); - if (!is_nonblocking () - && res == SOCKET_ERROR - && WSAGetLastError () == WSAEWOULDBLOCK) - res = wait_for_events (FD_CONNECT | FD_CLOSE, 0); - - if (res) - { - DWORD err = WSAGetLastError (); - - /* Some applications use the ugly technique to check if a non-blocking - connect succeeded by calling connect again, until it returns EISCONN. - This circumvents the event handling and connect_state is never set. - Thus we check for this situation here. */ - if (err == WSAEISCONN) - connect_state (connected); - /* Winsock returns WSAEWOULDBLOCK if the non-blocking socket cannot be - conected immediately. Convert to POSIX/Linux compliant EINPROGRESS. */ - else if (is_nonblocking () && err == WSAEWOULDBLOCK) - WSASetLastError (WSAEINPROGRESS); - /* Winsock returns WSAEINVAL if the socket is already a listener. - Convert to POSIX/Linux compliant EISCONN. */ - else if (err == WSAEINVAL && connect_state () == listener) - WSASetLastError (WSAEISCONN); - /* Any other error except WSAEALREADY during connect_pending means the - connect failed. */ - else if (connect_state () == connect_pending && err != WSAEALREADY) - connect_state (connect_failed); - set_winsock_errno (); - } - - return res; -} - -int -fhandler_socket::listen (int backlog) -{ - int res = ::listen (get_socket (), backlog); - if (res && WSAGetLastError () == WSAEINVAL) - { - /* It's perfectly valid to call listen on an unbound INET socket. - In this case the socket is automatically bound to an unused - port number, listening on all interfaces. On WinSock, listen - fails with WSAEINVAL when it's called on an unbound socket. - So we have to bind manually here to have POSIX semantics. */ - if (get_addr_family () == AF_INET) - { - struct sockaddr_in sin; - sin.sin_family = AF_INET; - sin.sin_port = 0; - sin.sin_addr.s_addr = INADDR_ANY; - if (!::bind (get_socket (), (struct sockaddr *) &sin, sizeof sin)) - res = ::listen (get_socket (), backlog); - } - else if (get_addr_family () == AF_INET6) - { - struct sockaddr_in6 sin6; - memset (&sin6, 0, sizeof sin6); - sin6.sin6_family = AF_INET6; - if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6)) - res = ::listen (get_socket (), backlog); - } - } - if (!res) - { - if (get_addr_family () == AF_LOCAL && get_socket_type () == SOCK_STREAM) - af_local_set_cred (); - connect_state (listener); /* gets set to connected on accepted socket. */ - } - else - set_winsock_errno (); - return res; -} - -int -fhandler_socket::accept4 (struct sockaddr *peer, int *len, int flags) -{ - /* Allows NULL peer and len parameters. */ - struct sockaddr_storage lpeer; - int llen = sizeof (struct sockaddr_storage); - - int res = (int) INVALID_SOCKET; - - /* Windows event handling does not check for the validity of the desired - flags so we have to do it here. */ - if (connect_state () != listener) - { - WSASetLastError (WSAEINVAL); - set_winsock_errno (); - goto out; - } - - while (!(res = wait_for_events (FD_ACCEPT | FD_CLOSE, 0)) - && (res = ::accept (get_socket (), (struct sockaddr *) &lpeer, &llen)) - == SOCKET_ERROR - && WSAGetLastError () == WSAEWOULDBLOCK) - ; - if (res == (int) INVALID_SOCKET) - set_winsock_errno (); - else - { - cygheap_fdnew res_fd; - if (res_fd >= 0 && fdsock (res_fd, &dev (), res)) - { - fhandler_socket *sock = (fhandler_socket *) res_fd; - sock->set_addr_family (get_addr_family ()); - sock->set_socket_type (get_socket_type ()); - sock->async_io (false); /* fdsock switches async mode off. */ - if (get_addr_family () == AF_LOCAL) - { - sock->set_sun_path (get_sun_path ()); - sock->set_peer_sun_path (get_peer_sun_path ()); - if (get_socket_type () == SOCK_STREAM) - { - /* Don't forget to copy credentials from accepting - socket to accepted socket and start transaction - on accepted socket! */ - af_local_copy (sock); - res = sock->af_local_accept (); - if (res == -1) - { - res_fd.release (); - set_winsock_errno (); - goto out; - } - } - } - sock->set_nonblocking (flags & SOCK_NONBLOCK); - if (flags & SOCK_CLOEXEC) - sock->set_close_on_exec (true); - /* No locking necessary at this point. */ - sock->wsock_events->events = wsock_events->events | FD_WRITE; - sock->wsock_events->owner = wsock_events->owner; - sock->connect_state (connected); - res = res_fd; - if (peer) - { - if (get_addr_family () == AF_LOCAL) - { - /* FIXME: Right now we have no way to determine the - bound socket name of the peer's socket. For now - we just fake an unbound socket on the other side. */ - static struct sockaddr_un un = { AF_LOCAL, "" }; - memcpy (peer, &un, MIN (*len, (int) sizeof (un.sun_family))); - *len = (int) sizeof (un.sun_family); - } - else - { - memcpy (peer, &lpeer, MIN (*len, llen)); - *len = llen; - } - } - } - else - { - ::closesocket (res); - res = -1; - } - } - -out: - debug_printf ("res %d", res); - return res; -} - -int -fhandler_socket::getsockname (struct sockaddr *name, int *namelen) -{ - int res = -1; - - if (get_addr_family () == AF_LOCAL) - { - struct sockaddr_un sun; - sun.sun_family = AF_LOCAL; - sun.sun_path[0] = '\0'; - if (get_sun_path ()) - strncat (sun.sun_path, get_sun_path (), UNIX_PATH_MAX - 1); - memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); - *namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0); - res = 0; - } - else - { - /* WinSock just returns WSAEFAULT if the buffer is too small. Use a - big enough local buffer and truncate later as necessary, per POSIX. */ - struct sockaddr_storage sock; - int len = sizeof sock; - res = ::getsockname (get_socket (), (struct sockaddr *) &sock, &len); - if (!res) - { - memcpy (name, &sock, MIN (*namelen, len)); - *namelen = len; - } - else - { - if (WSAGetLastError () == WSAEINVAL) - { - /* WinSock returns WSAEINVAL if the socket is locally - unbound. Per SUSv3 this is not an error condition. - We're faking a valid return value here by creating the - same content in the sockaddr structure as on Linux. */ - memset (&sock, 0, sizeof sock); - sock.ss_family = get_addr_family (); - switch (get_addr_family ()) - { - case AF_INET: - res = 0; - len = (int) sizeof (struct sockaddr_in); - break; - case AF_INET6: - res = 0; - len = (int) sizeof (struct sockaddr_in6); - break; - default: - WSASetLastError (WSAEOPNOTSUPP); - break; - } - if (!res) - { - memcpy (name, &sock, MIN (*namelen, len)); - *namelen = len; - } - } - if (res) - set_winsock_errno (); - } - } - - return res; -} - -int -fhandler_socket::getpeername (struct sockaddr *name, int *namelen) -{ - /* Always use a local big enough buffer and truncate later as necessary - per POSIX. WinSock unfortunately only returns WSAEFAULT if the buffer - is too small. */ - struct sockaddr_storage sock; - int len = sizeof sock; - int res = ::getpeername (get_socket (), (struct sockaddr *) &sock, &len); - if (res) - set_winsock_errno (); - else if (get_addr_family () == AF_LOCAL) - { - struct sockaddr_un sun; - memset (&sun, 0, sizeof sun); - sun.sun_family = AF_LOCAL; - sun.sun_path[0] = '\0'; - if (get_peer_sun_path ()) - strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_MAX - 1); - memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); - *namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0); - } - else - { - memcpy (name, &sock, MIN (*namelen, len)); - *namelen = len; - } - - return res; -} - -/* There's no DLL which exports the symbol WSARecvMsg. One has to call - WSAIoctl as below to fetch the function pointer. Why on earth did the - MS developers decide not to export a normal symbol for these extension - functions? */ -inline int -get_ext_funcptr (SOCKET sock, void *funcptr) -{ - DWORD bret; - const GUID guid = WSAID_WSARECVMSG; - return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, - (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), - &bret, NULL, NULL); -} - -inline ssize_t -fhandler_socket::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) -{ - ssize_t res = 0; - DWORD ret = 0, wret; - int evt_mask = FD_READ | ((wsamsg->dwFlags & MSG_OOB) ? FD_OOB : 0); - LPWSABUF &wsabuf = wsamsg->lpBuffers; - ULONG &wsacnt = wsamsg->dwBufferCount; - static NO_COPY LPFN_WSARECVMSG WSARecvMsg; - int orig_namelen = wsamsg->namelen; - - /* CV 2014-10-26: Do not check for the connect_state at this point. In - certain scenarios there's no way to check the connect state reliably. - Example (hexchat): Parent process creates socket, forks, child process - calls connect, parent process calls read. Even if the event handling - allows to check for FD_CONNECT in the parent, there is always yet another - scenario we can easily break. */ - - DWORD wait_flags = wsamsg->dwFlags; - bool waitall = !!(wait_flags & MSG_WAITALL); - wsamsg->dwFlags &= (MSG_OOB | MSG_PEEK | MSG_DONTROUTE); - if (use_recvmsg) - { - if (!WSARecvMsg - && get_ext_funcptr (get_socket (), &WSARecvMsg) == SOCKET_ERROR) - { - if (wsamsg->Control.len > 0) - { - set_winsock_errno (); - return SOCKET_ERROR; - } - use_recvmsg = false; - } - else /* Only MSG_PEEK is supported by WSARecvMsg. */ - wsamsg->dwFlags &= MSG_PEEK; - } - if (waitall) - { - if (get_socket_type () != SOCK_STREAM) - { - WSASetLastError (WSAEOPNOTSUPP); - set_winsock_errno (); - return SOCKET_ERROR; - } - if (is_nonblocking () || (wsamsg->dwFlags & (MSG_OOB | MSG_PEEK))) - waitall = false; - } - - /* Note: Don't call WSARecvFrom(MSG_PEEK) without actually having data - waiting in the buffers, otherwise the event handling gets messed up - for some reason. */ - while (!(res = wait_for_events (evt_mask | FD_CLOSE, wait_flags)) - || saw_shutdown_read ()) - { - if (use_recvmsg) - res = WSARecvMsg (get_socket (), wsamsg, &wret, NULL, NULL); - /* This is working around a really weird problem in WinSock. - - Assume you create a socket, fork the process (thus duplicating - the socket), connect the socket in the child, then call recv - on the original socket handle in the parent process. - In this scenario, calls to WinSock's recvfrom and WSARecvFrom - in the parent will fail with WSAEINVAL, regardless whether both - address parameters, name and namelen, are NULL or point to valid - storage. However, calls to recv and WSARecv succeed as expected. - Per MSDN, WSAEINVAL in the context of recv means "The socket has not - been bound". It is as if the recvfrom functions test if the socket - is bound locally, but in the parent process, WinSock doesn't know - about that and fails, while the same test is omitted in the recv - functions. - - This also covers another weird case: WinSock returns WSAEFAULT if - namelen is a valid pointer while name is NULL. Both parameters are - ignored for TCP sockets, so this only occurs when using UDP socket. */ - else if (!wsamsg->name || get_socket_type () == SOCK_STREAM) - res = WSARecv (get_socket (), wsabuf, wsacnt, &wret, &wsamsg->dwFlags, - NULL, NULL); - else - res = WSARecvFrom (get_socket (), wsabuf, wsacnt, &wret, - &wsamsg->dwFlags, wsamsg->name, &wsamsg->namelen, - NULL, NULL); - if (!res) - { - ret += wret; - if (!waitall) - break; - while (wret && wsacnt) - { - if (wsabuf->len > wret) - { - wsabuf->len -= wret; - wsabuf->buf += wret; - wret = 0; - } - else - { - wret -= wsabuf->len; - ++wsabuf; - --wsacnt; - } - } - if (!wret) - break; - } - else if (WSAGetLastError () != WSAEWOULDBLOCK) - break; - } - - if (res) - { - /* According to SUSv3, errno isn't set in that case and no error - condition is returned. */ - if (WSAGetLastError () == WSAEMSGSIZE) - ret += wret; - else if (!ret) - { - /* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned - in this case. */ - if (WSAGetLastError () == WSAESHUTDOWN) - ret = 0; - else - { - set_winsock_errno (); - return SOCKET_ERROR; - } - } - } - - if (get_addr_family () == AF_LOCAL && wsamsg->name != NULL - && orig_namelen >= (int) sizeof (sa_family_t)) - { - /* WSARecvFrom copied the sockaddr_in block to wsamsg->name. We have to - overwrite it with a sockaddr_un block. For datagram sockets we - generate a sockaddr_un with a filename analogue to abstract socket - names under Linux. See `man 7 unix' under Linux for a description. */ - sockaddr_un *un = (sockaddr_un *) wsamsg->name; - un->sun_family = AF_LOCAL; - int len = orig_namelen - offsetof (struct sockaddr_un, sun_path); - if (len > 0) - { - if (get_socket_type () == SOCK_DGRAM) - { - if (len >= 7) - { - __small_sprintf (un->sun_path + 1, "d%04x", - ((struct sockaddr_in *) wsamsg->name)->sin_port); - wsamsg->namelen = offsetof (struct sockaddr_un, sun_path) + 7; - } - else - wsamsg->namelen = offsetof (struct sockaddr_un, sun_path) + 1; - un->sun_path[0] = '\0'; - } - else if (!get_peer_sun_path ()) - wsamsg->namelen = sizeof (sa_family_t); - else - { - memset (un->sun_path, 0, len); - strncpy (un->sun_path, get_peer_sun_path (), len); - if (un->sun_path[len - 1] == '\0') - len = strlen (un->sun_path) + 1; - if (len > UNIX_PATH_MAX) - len = UNIX_PATH_MAX; - wsamsg->namelen = offsetof (struct sockaddr_un, sun_path) + len; - } - } - } - + int ret = 0; + if (is_nonblocking ()) + ret |= SOCK_NONBLOCK; + if (close_on_exec ()) + ret |= SOCK_CLOEXEC; return ret; } -void __reg3 -fhandler_socket::read (void *in_ptr, size_t& len) -{ - char *ptr = (char *) in_ptr; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; -#endif - - len = recv_internal (&wsamsg, false); -} - -ssize_t -fhandler_socket::readv (const struct iovec *const iov, const int iovcnt, - ssize_t tot) -{ - WSABUF wsabuf[iovcnt]; - WSABUF *wsaptr = wsabuf + iovcnt; - const struct iovec *iovptr = iov + iovcnt; - while (--wsaptr >= wsabuf) - { - wsaptr->len = (--iovptr)->iov_len; - wsaptr->buf = (char *) iovptr->iov_base; - } - WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; - return recv_internal (&wsamsg, false); -} - -ssize_t -fhandler_socket::recvfrom (void *in_ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen) -{ - char *ptr = (char *) in_ptr; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, - wsabuf, bufcnt, - { 0, NULL }, - (DWORD) flags }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, - &wsabuf, 1, - { 0, NULL}, - (DWORD) flags }; -#endif - ssize_t ret = recv_internal (&wsamsg, false); - if (fromlen) - *fromlen = wsamsg.namelen; - return ret; -} - -ssize_t -fhandler_socket::recvmsg (struct msghdr *msg, int flags) -{ - /* TODO: Descriptor passing on AF_LOCAL sockets. */ - - /* Disappointing but true: Even if WSARecvMsg is supported, it's only - supported for datagram and raw sockets. */ - bool use_recvmsg = true; - if (get_socket_type () == SOCK_STREAM || get_addr_family () == AF_LOCAL) - { - use_recvmsg = false; - msg->msg_controllen = 0; - } - - WSABUF wsabuf[msg->msg_iovlen]; - WSABUF *wsaptr = wsabuf + msg->msg_iovlen; - const struct iovec *iovptr = msg->msg_iov + msg->msg_iovlen; - while (--wsaptr >= wsabuf) - { - wsaptr->len = (--iovptr)->iov_len; - wsaptr->buf = (char *) iovptr->iov_base; - } - WSAMSG wsamsg = { (struct sockaddr *) msg->msg_name, msg->msg_namelen, - wsabuf, (DWORD) msg->msg_iovlen, - { (DWORD) msg->msg_controllen, (char *) msg->msg_control }, - (DWORD) flags }; - ssize_t ret = recv_internal (&wsamsg, use_recvmsg); - if (ret >= 0) - { - msg->msg_namelen = wsamsg.namelen; - msg->msg_controllen = wsamsg.Control.len; - if (!CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR) - msg->msg_flags = wsamsg.dwFlags; - } - return ret; -} - -inline ssize_t -fhandler_socket::send_internal (struct _WSAMSG *wsamsg, int flags) -{ - ssize_t res = 0; - DWORD ret = 0, sum = 0; - WSABUF out_buf[wsamsg->dwBufferCount]; - bool use_sendmsg = false; - DWORD wait_flags = flags & MSG_DONTWAIT; - bool nosignal = !!(flags & MSG_NOSIGNAL); - - flags &= (MSG_OOB | MSG_DONTROUTE); - if (wsamsg->Control.len > 0) - use_sendmsg = true; - /* Workaround for MSDN KB 823764: Split a message into chunks <= SO_SNDBUF. - in_idx is the index of the current lpBuffers from the input wsamsg buffer. - in_off is used to keep track of the next byte to write from a wsamsg - buffer which only gets partially written. */ - for (DWORD in_idx = 0, in_off = 0; - in_idx < wsamsg->dwBufferCount; - in_off >= wsamsg->lpBuffers[in_idx].len && (++in_idx, in_off = 0)) - { - /* Split a message into the least number of pieces to minimize the - number of WsaSendTo calls. Don't split datagram messages (bad idea). - out_idx is the index of the next buffer in the out_buf WSABUF, - also the number of buffers given to WSASendTo. - out_len is the number of bytes in the buffers given to WSASendTo. - Don't split datagram messages (very bad idea). */ - DWORD out_idx = 0; - DWORD out_len = 0; - if (get_socket_type () == SOCK_STREAM) - { - do - { - out_buf[out_idx].buf = wsamsg->lpBuffers[in_idx].buf + in_off; - out_buf[out_idx].len = wsamsg->lpBuffers[in_idx].len - in_off; - out_len += out_buf[out_idx].len; - out_idx++; - } - while (out_len < (unsigned) wmem () - && (in_off = 0, ++in_idx < wsamsg->dwBufferCount)); - /* Tweak len of the last out_buf buffer so the entire number of bytes - is (less than or) equal to wmem (). Fix out_len as well since it's - used in a subsequent test expression. */ - if (out_len > (unsigned) wmem ()) - { - out_buf[out_idx - 1].len -= out_len - (unsigned) wmem (); - out_len = (unsigned) wmem (); - } - /* Add the bytes written from the current last buffer to in_off, - so in_off points to the next byte to be written from that buffer, - or beyond which lets the outper loop skip to the next buffer. */ - in_off += out_buf[out_idx - 1].len; - } - - do - { - if (use_sendmsg) - res = WSASendMsg (get_socket (), wsamsg, flags, &ret, NULL, NULL); - else if (get_socket_type () == SOCK_STREAM) - res = WSASendTo (get_socket (), out_buf, out_idx, &ret, flags, - wsamsg->name, wsamsg->namelen, NULL, NULL); - else - res = WSASendTo (get_socket (), wsamsg->lpBuffers, - wsamsg->dwBufferCount, &ret, flags, - wsamsg->name, wsamsg->namelen, NULL, NULL); - if (res && (WSAGetLastError () == WSAEWOULDBLOCK)) - { - LOCK_EVENTS; - wsock_events->events &= ~FD_WRITE; - UNLOCK_EVENTS; - } - } - while (res && (WSAGetLastError () == WSAEWOULDBLOCK) - && !(res = wait_for_events (FD_WRITE | FD_CLOSE, wait_flags))); - - if (!res) - { - sum += ret; - /* For streams, return to application if the number of bytes written - is less than the number of bytes we intended to write in a single - call to WSASendTo. Otherwise we would have to add code to - backtrack in the input buffers, which is questionable. There was - probably a good reason we couldn't write more. */ - if (get_socket_type () != SOCK_STREAM || ret < out_len) - break; - } - else if (is_nonblocking () || WSAGetLastError() != WSAEWOULDBLOCK) - break; - } - - if (sum) - res = sum; - else if (res == SOCKET_ERROR) - { - set_winsock_errno (); - - /* Special handling for EPIPE and SIGPIPE. - - EPIPE is generated if the local end has been shut down on a connection - oriented socket. In this case the process will also receive a SIGPIPE - unless MSG_NOSIGNAL is set. */ - if ((get_errno () == ECONNABORTED || get_errno () == ESHUTDOWN) - && get_socket_type () == SOCK_STREAM) - { - set_errno (EPIPE); - if (!nosignal) - raise (SIGPIPE); - } - } - - return res; -} - -ssize_t -fhandler_socket::write (const void *in_ptr, size_t len) -{ - char *ptr = (char *) in_ptr; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; -#endif - return send_internal (&wsamsg, 0); -} - -ssize_t -fhandler_socket::writev (const struct iovec *const iov, const int iovcnt, - ssize_t tot) -{ - WSABUF wsabuf[iovcnt]; - WSABUF *wsaptr = wsabuf; - const struct iovec *iovptr = iov; - for (int i = 0; i < iovcnt; ++i) - { - wsaptr->len = iovptr->iov_len; - (wsaptr++)->buf = (char *) (iovptr++)->iov_base; - } - WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; - return send_internal (&wsamsg, 0); -} - -ssize_t -fhandler_socket::sendto (const void *in_ptr, size_t len, int flags, - const struct sockaddr *to, int tolen) -{ - char *ptr = (char *) in_ptr; - struct sockaddr_storage sst; - - if (to && get_inet_addr (to, tolen, &sst, &tolen) == SOCKET_ERROR) - return SOCKET_ERROR; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen, - wsabuf, bufcnt, - { 0, NULL }, - 0 }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen, - &wsabuf, 1, - { 0, NULL}, - 0 }; -#endif - return send_internal (&wsamsg, flags); -} - -ssize_t -fhandler_socket::sendmsg (const struct msghdr *msg, int flags) -{ - /* TODO: Descriptor passing on AF_LOCAL sockets. */ - - struct sockaddr_storage sst; - int len = 0; - - if (msg->msg_name - && get_inet_addr ((struct sockaddr *) msg->msg_name, msg->msg_namelen, - &sst, &len) == SOCKET_ERROR) - return SOCKET_ERROR; - - WSABUF wsabuf[msg->msg_iovlen]; - WSABUF *wsaptr = wsabuf; - const struct iovec *iovptr = msg->msg_iov; - for (int i = 0; i < msg->msg_iovlen; ++i) - { - wsaptr->len = iovptr->iov_len; - (wsaptr++)->buf = (char *) (iovptr++)->iov_base; - } - /* Disappointing but true: Even if WSASendMsg is supported, it's only - supported for datagram and raw sockets. */ - DWORD controllen = (DWORD) (get_socket_type () == SOCK_STREAM - || get_addr_family () == AF_LOCAL - ? 0 : msg->msg_controllen); - WSAMSG wsamsg = { msg->msg_name ? (struct sockaddr *) &sst : NULL, len, - wsabuf, (DWORD) msg->msg_iovlen, - { controllen, (char *) msg->msg_control }, - 0 }; - return send_internal (&wsamsg, flags); -} - int fhandler_socket::shutdown (int how) { @@ -2640,378 +1085,9 @@ fhandler_socket::set_close_on_exec (bool val) fhandler_base::set_close_on_exec (val); } -void -fhandler_socket::set_sun_path (const char *path) -{ - sun_path = path ? cstrdup (path) : NULL; -} - -void -fhandler_socket::set_peer_sun_path (const char *path) -{ - peer_sun_path = path ? cstrdup (path) : NULL; -} - int fhandler_socket::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) { - if (get_addr_family () != AF_LOCAL || get_socket_type () != SOCK_STREAM) - { - set_errno (EINVAL); - return -1; - } - if (no_getpeereid ()) - { - set_errno (ENOTSUP); - return -1; - } - if (connect_state () != connected) - { - set_errno (ENOTCONN); - return -1; - } - - __try - { - if (pid) - *pid = sec_peer_pid; - if (euid) - *euid = sec_peer_uid; - if (egid) - *egid = sec_peer_gid; - return 0; - } - __except (EFAULT) {} - __endtry + set_errno (EINVAL); return -1; } - -static int -convert_ws1_ip_optname (int optname) -{ - static int ws2_optname[] = - { - 0, - IP_OPTIONS, - IP_MULTICAST_IF, - IP_MULTICAST_TTL, - IP_MULTICAST_LOOP, - IP_ADD_MEMBERSHIP, - IP_DROP_MEMBERSHIP, - IP_TTL, - IP_TOS, - IP_DONTFRAGMENT - }; - return (optname < 1 || optname > _WS1_IP_DONTFRAGMENT) - ? optname - : ws2_optname[optname]; -} - -int -fhandler_socket::setsockopt (int level, int optname, const void *optval, - socklen_t optlen) -{ - bool ignore = false; - int ret = -1; - - /* Preprocessing setsockopt. Set ignore to true if setsockopt call should - get skipped entirely. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_PEERCRED: - /* Switch off the AF_LOCAL handshake and thus SO_PEERCRED handling - for AF_LOCAL/SOCK_STREAM sockets. This allows to handle special - situations in which connect is called before a listening socket - accepts connections. - FIXME: In the long run we should find a more generic solution - which doesn't require a blocking handshake in accept/connect - to exchange SO_PEERCRED credentials. */ - if (optval || optlen) - set_errno (EINVAL); - else - ret = af_local_set_no_getpeereid (); - return ret; - - case SO_REUSEADDR: - /* Per POSIX we must not be able to reuse a complete duplicate of a - local TCP address (same IP, same port), even if SO_REUSEADDR has - been set. This behaviour is maintained in WinSock for backward - compatibility, while the WinSock standard behaviour of stream - socket binding is equivalent to the POSIX behaviour as if - SO_REUSEADDR has been set. The SO_EXCLUSIVEADDRUSE option has - been added to allow an application to request POSIX standard - behaviour in the non-SO_REUSEADDR case. - - To emulate POSIX socket binding behaviour, note that SO_REUSEADDR - has been set but don't call setsockopt. Instead - fhandler_socket::bind sets SO_EXCLUSIVEADDRUSE if the application - did not set SO_REUSEADDR. */ - if (optlen < (socklen_t) sizeof (int)) - { - set_errno (EINVAL); - return ret; - } - if (get_socket_type () == SOCK_STREAM) - ignore = true; - break; - - case SO_RCVTIMEO: - case SO_SNDTIMEO: - if (optlen < (socklen_t) sizeof (struct timeval)) - { - set_errno (EINVAL); - return ret; - } - if (timeval_to_ms ((struct timeval *) optval, - (optname == SO_RCVTIMEO) ? rcvtimeo () - : sndtimeo ())) - ret = 0; - else - set_errno (EDOM); - return ret; - - default: - break; - } - break; - - case IPPROTO_IP: - /* Old applications still use the old WinSock1 IPPROTO_IP values. */ - if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) - optname = convert_ws1_ip_optname (optname); - switch (optname) - { - case IP_TOS: - /* Winsock doesn't support setting the IP_TOS field with setsockopt - and TOS was never implemented for TCP anyway. setsockopt returns - WinSock error 10022, WSAEINVAL when trying to set the IP_TOS - field. We just return 0 instead. */ - ignore = true; - break; - - default: - break; - } - break; - - case IPPROTO_IPV6: - { - switch (optname) - { - case IPV6_TCLASS: - /* Unsupported */ - ignore = true; - break; - - default: - break; - } - } - default: - break; - } - - /* Call Winsock setsockopt (or not) */ - if (ignore) - ret = 0; - else - { - ret = ::setsockopt (get_socket (), level, optname, (const char *) optval, - optlen); - if (ret == SOCKET_ERROR) - { - set_winsock_errno (); - return ret; - } - } - - if (optlen == (socklen_t) sizeof (int)) - debug_printf ("setsockopt optval=%x", *(int *) optval); - - /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_REUSEADDR: - saw_reuseaddr (*(int *) optval); - break; - - case SO_RCVBUF: - rmem (*(int *) optval); - break; - - case SO_SNDBUF: - wmem (*(int *) optval); - break; - - default: - break; - } - break; - - default: - break; - } - - return ret; -} - -int -fhandler_socket::getsockopt (int level, int optname, const void *optval, - socklen_t *optlen) -{ - bool ignore = false; - bool onebyte = false; - int ret = -1; - - /* Preprocessing getsockopt. Set ignore to true if getsockopt call should - get skipped entirely. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_PEERCRED: - { - struct ucred *cred = (struct ucred *) optval; - - if (*optlen < (socklen_t) sizeof *cred) - { - set_errno (EINVAL); - return ret; - } - ret = getpeereid (&cred->pid, &cred->uid, &cred->gid); - if (!ret) - *optlen = (socklen_t) sizeof *cred; - return ret; - } - break; - - case SO_REUSEADDR: - { - unsigned int *reuseaddr = (unsigned int *) optval; - - if (*optlen < (socklen_t) sizeof *reuseaddr) - { - set_errno (EINVAL); - return ret; - } - *reuseaddr = saw_reuseaddr(); - *optlen = (socklen_t) sizeof *reuseaddr; - ignore = true; - } - break; - - case SO_RCVTIMEO: - case SO_SNDTIMEO: - { - struct timeval *time_out = (struct timeval *) optval; - - if (*optlen < (socklen_t) sizeof *time_out) - { - set_errno (EINVAL); - return ret; - } - DWORD ms = (optname == SO_RCVTIMEO) ? rcvtimeo () : sndtimeo (); - if (ms == 0 || ms == INFINITE) - { - time_out->tv_sec = 0; - time_out->tv_usec = 0; - } - else - { - time_out->tv_sec = ms / MSPERSEC; - time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; - } - *optlen = (socklen_t) sizeof *time_out; - ret = 0; - return ret; - } - - default: - break; - } - break; - - case IPPROTO_IP: - /* Old applications still use the old WinSock1 IPPROTO_IP values. */ - if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) - optname = convert_ws1_ip_optname (optname); - break; - - default: - break; - } - - /* Call Winsock getsockopt (or not) */ - if (ignore) - ret = 0; - else - { - ret = ::getsockopt (get_socket (), level, optname, (char *) optval, - (int *) optlen); - if (ret == SOCKET_ERROR) - { - set_winsock_errno (); - return ret; - } - } - - /* Postprocessing getsockopt, setting fhandler_socket members, etc. Set - onebyte true for options returning BOOLEAN instead of a boolean DWORD. */ - switch (level) - { - case SOL_SOCKET: - switch (optname) - { - case SO_ERROR: - { - int *e = (int *) optval; - debug_printf ("WinSock SO_ERROR = %d", *e); - *e = find_winsock_errno (*e); - } - break; - - case SO_KEEPALIVE: - case SO_DONTROUTE: - onebyte = true; - break; - - default: - break; - } - break; - case IPPROTO_TCP: - switch (optname) - { - case TCP_NODELAY: - onebyte = true; - break; - - default: - break; - } - default: - break; - } - - if (onebyte) - { - /* Regression in Vista and later: instead of a 4 byte BOOL value, a - 1 byte BOOLEAN value is returned, in contrast to older systems and - the documentation. Since an int type is expected by the calling - application, we convert the result here. For some reason only three - BSD-compatible socket options seem to be affected. */ - BOOLEAN *in = (BOOLEAN *) optval; - int *out = (int *) optval; - *out = *in; - *optlen = 4; - } - - return ret; -} diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc new file mode 100644 index 000000000..91da47cd1 --- /dev/null +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -0,0 +1,1163 @@ +/* fhandler_socket_inet.cc. + + See fhandler.h for a description of the fhandler classes. + + This file is part of Cygwin. + + This software is a copyrighted work licensed under the terms of the + Cygwin license. Please consult the file "CYGWIN_LICENSE" for + details. */ + +#define __INSIDE_CYGWIN_NET__ +#define USE_SYS_TYPES_FD_SET + +#include "winsup.h" +#ifdef __x86_64__ +/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) + because a redefinition for LP64 systems is missing. This leads to a wrong + definition and size of sockaddr_in6 when building with winsock headers. + This definition is also required to use the right u_long type in subsequent + function calls. */ +#undef u_long +#define u_long __ms_u_long +#endif +#include +#include +#include +#include +#include "cygerrno.h" +#include "security.h" +#include "path.h" +#include "fhandler.h" +#include "dtable.h" +#include "cygheap.h" +#include +#include "cygwin/version.h" +#include "perprocess.h" +#include "shared_info.h" +#include "sigproc.h" +#include "wininfo.h" +#include +#include +#include +#include +#include "cygtls.h" +#include +#include "ntdll.h" +#include "miscfuncs.h" +#include "tls_pbuf.h" + +#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) +#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) + +#define LOCK_EVENTS \ + if (wsock_mtx && \ + WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) \ + { + +#define UNLOCK_EVENTS \ + ReleaseMutex (wsock_mtx); \ + } + +/* cygwin internal: map sockaddr into internet domain address */ +static int +get_inet_addr_inet (const struct sockaddr *in, int inlen, + struct sockaddr_storage *out, int *outlen) +{ + switch (in->sa_family) + { + case AF_INET: + memcpy (out, in, inlen); + *outlen = inlen; + /* If the peer address given in connect or sendto is the ANY address, + Winsock fails with WSAEADDRNOTAVAIL, while Linux converts that into + a connection/send attempt to LOOPBACK. We're doing the same here. */ + if (((struct sockaddr_in *) out)->sin_addr.s_addr == htonl (INADDR_ANY)) + ((struct sockaddr_in *) out)->sin_addr.s_addr = htonl (INADDR_LOOPBACK); + return 0; + case AF_INET6: + memcpy (out, in, inlen); + *outlen = inlen; + /* See comment in AF_INET case. */ + if (IN6_IS_ADDR_UNSPECIFIED (&((struct sockaddr_in6 *) out)->sin6_addr)) + ((struct sockaddr_in6 *) out)->sin6_addr = in6addr_loopback; + return 0; + default: + set_errno (EAFNOSUPPORT); + return SOCKET_ERROR; + } +} + +static int +convert_ws1_ip_optname (int optname) +{ + static int ws2_optname[] = + { + 0, + IP_OPTIONS, + IP_MULTICAST_IF, + IP_MULTICAST_TTL, + IP_MULTICAST_LOOP, + IP_ADD_MEMBERSHIP, + IP_DROP_MEMBERSHIP, + IP_TTL, + IP_TOS, + IP_DONTFRAGMENT + }; + return (optname < 1 || optname > _WS1_IP_DONTFRAGMENT) + ? optname + : ws2_optname[optname]; +} + +fhandler_socket_inet::fhandler_socket_inet () : + fhandler_socket () +{ +} + +fhandler_socket_inet::~fhandler_socket_inet () +{ +} + +int +fhandler_socket_inet::socket (int af, int type, int protocol, int flags) +{ + SOCKET sock; + int ret; + + sock = ::socket (af, type, protocol); + if (sock == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + ret = set_socket_handle (sock, af, type, flags); + if (ret < 0) + ::closesocket (sock); + return ret; +} + +/* socketpair is called on the fhandler handling the accepting socket, + fh_out is the fhandler for the connecting socket. */ +int +fhandler_socket_inet::socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_inet::bind (const struct sockaddr *name, int namelen) +{ + int res = -1; + + if (!saw_reuseaddr ()) + { + /* If the application didn't explicitely request SO_REUSEADDR, + enforce POSIX standard socket binding behaviour by setting the + SO_EXCLUSIVEADDRUSE socket option. See cygwin_setsockopt() + for a more detailed description. */ + int on = 1; + int ret = ::setsockopt (get_socket (), SOL_SOCKET, + SO_EXCLUSIVEADDRUSE, + (const char *) &on, sizeof on); + debug_printf ("%d = setsockopt(SO_EXCLUSIVEADDRUSE), %E", ret); + } + if (::bind (get_socket (), name, namelen)) + set_winsock_errno (); + else + res = 0; + + return res; +} + +int +fhandler_socket_inet::connect (const struct sockaddr *name, int namelen) +{ + struct sockaddr_storage sst; + + if (get_inet_addr_inet (name, namelen, &sst, &namelen) == SOCKET_ERROR) + return SOCKET_ERROR; + + /* Initialize connect state to "connect_pending". State is ultimately set + to "connected" or "connect_failed" in wait_for_events when the FD_CONNECT + event occurs. Note that the underlying OS sockets are always non-blocking + and a successfully initiated non-blocking Winsock connect always returns + WSAEWOULDBLOCK. Thus it's safe to rely on event handling. + + Check for either unconnected or connect_failed since in both cases it's + allowed to retry connecting the socket. It's also ok (albeit ugly) to + call connect to check if a previous non-blocking connect finished. + + Set connect_state before calling connect, otherwise a race condition with + an already running select or poll might occur. */ + if (connect_state () == unconnected || connect_state () == connect_failed) + connect_state (connect_pending); + + int res = ::connect (get_socket (), (struct sockaddr *) &sst, namelen); + if (!is_nonblocking () + && res == SOCKET_ERROR + && WSAGetLastError () == WSAEWOULDBLOCK) + res = wait_for_events (FD_CONNECT | FD_CLOSE, 0); + + if (res) + { + DWORD err = WSAGetLastError (); + + /* Some applications use the ugly technique to check if a non-blocking + connect succeeded by calling connect again, until it returns EISCONN. + This circumvents the event handling and connect_state is never set. + Thus we check for this situation here. */ + if (err == WSAEISCONN) + connect_state (connected); + /* Winsock returns WSAEWOULDBLOCK if the non-blocking socket cannot be + conected immediately. Convert to POSIX/Linux compliant EINPROGRESS. */ + else if (is_nonblocking () && err == WSAEWOULDBLOCK) + WSASetLastError (WSAEINPROGRESS); + /* Winsock returns WSAEINVAL if the socket is already a listener. + Convert to POSIX/Linux compliant EISCONN. */ + else if (err == WSAEINVAL && connect_state () == listener) + WSASetLastError (WSAEISCONN); + /* Any other error except WSAEALREADY during connect_pending means the + connect failed. */ + else if (connect_state () == connect_pending && err != WSAEALREADY) + connect_state (connect_failed); + set_winsock_errno (); + } + + return res; +} + +int +fhandler_socket_inet::listen (int backlog) +{ + int res = ::listen (get_socket (), backlog); + if (res && WSAGetLastError () == WSAEINVAL) + { + /* It's perfectly valid to call listen on an unbound INET socket. + In this case the socket is automatically bound to an unused + port number, listening on all interfaces. On WinSock, listen + fails with WSAEINVAL when it's called on an unbound socket. + So we have to bind manually here to have POSIX semantics. */ + if (get_addr_family () == AF_INET) + { + struct sockaddr_in sin; + sin.sin_family = AF_INET; + sin.sin_port = 0; + sin.sin_addr.s_addr = INADDR_ANY; + if (!::bind (get_socket (), (struct sockaddr *) &sin, sizeof sin)) + res = ::listen (get_socket (), backlog); + } + else if (get_addr_family () == AF_INET6) + { + struct sockaddr_in6 sin6; + memset (&sin6, 0, sizeof sin6); + sin6.sin6_family = AF_INET6; + if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6)) + res = ::listen (get_socket (), backlog); + } + } + if (!res) + connect_state (listener); /* gets set to connected on accepted socket. */ + else + set_winsock_errno (); + return res; +} + +int +fhandler_socket_inet::accept4 (struct sockaddr *peer, int *len, int flags) +{ + int ret = -1; + /* Allows NULL peer and len parameters. */ + struct sockaddr_storage lpeer; + int llen = sizeof (struct sockaddr_storage); + + /* Windows event handling does not check for the validity of the desired + flags so we have to do it here. */ + if (connect_state () != listener) + { + WSASetLastError (WSAEINVAL); + set_winsock_errno (); + return -1; + } + + SOCKET res = INVALID_SOCKET; + while (!(res = wait_for_events (FD_ACCEPT | FD_CLOSE, 0)) + && (res = ::accept (get_socket (), (struct sockaddr *) &lpeer, &llen)) + == INVALID_SOCKET + && WSAGetLastError () == WSAEWOULDBLOCK) + ; + if (res == INVALID_SOCKET) + set_winsock_errno (); + else + { + cygheap_fdnew fd; + + if (fd >= 0) + { + fhandler_socket_inet *sock = (fhandler_socket_inet *) + build_fh_dev (dev ()); + if (sock && sock->set_socket_handle (res, get_addr_family (), + get_socket_type (), + get_socket_flags ())) + { + sock->async_io (false); /* set_socket_handle disables async. */ + /* No locking necessary at this point. */ + sock->wsock_events->events = wsock_events->events | FD_WRITE; + sock->wsock_events->owner = wsock_events->owner; + sock->connect_state (connected); + fd = sock; + if (fd <= 2) + set_std_handle (fd); + ret = fd; + if (peer) + { + memcpy (peer, &lpeer, MIN (*len, llen)); + *len = llen; + } + } + } + if (ret == -1) + ::closesocket (res); + } + return ret; +} + +int +fhandler_socket_inet::getsockname (struct sockaddr *name, int *namelen) +{ + int res = -1; + + /* WinSock just returns WSAEFAULT if the buffer is too small. Use a + big enough local buffer and truncate later as necessary, per POSIX. */ + struct sockaddr_storage sock; + int len = sizeof sock; + res = ::getsockname (get_socket (), (struct sockaddr *) &sock, &len); + if (!res) + { + memcpy (name, &sock, MIN (*namelen, len)); + *namelen = len; + } + else + { + if (WSAGetLastError () == WSAEINVAL) + { + /* WinSock returns WSAEINVAL if the socket is locally + unbound. Per SUSv3 this is not an error condition. + We're faking a valid return value here by creating the + same content in the sockaddr structure as on Linux. */ + memset (&sock, 0, sizeof sock); + sock.ss_family = get_addr_family (); + switch (get_addr_family ()) + { + case AF_INET: + res = 0; + len = (int) sizeof (struct sockaddr_in); + break; + case AF_INET6: + res = 0; + len = (int) sizeof (struct sockaddr_in6); + break; + default: + WSASetLastError (WSAEOPNOTSUPP); + break; + } + if (!res) + { + memcpy (name, &sock, MIN (*namelen, len)); + *namelen = len; + } + } + if (res) + set_winsock_errno (); + } + return res; +} + +int +fhandler_socket_inet::getpeername (struct sockaddr *name, int *namelen) +{ + /* Always use a local big enough buffer and truncate later as necessary + per POSIX. WinSock unfortunately only returns WSAEFAULT if the buffer + is too small. */ + struct sockaddr_storage sock; + int len = sizeof sock; + int res = ::getpeername (get_socket (), (struct sockaddr *) &sock, &len); + if (res) + set_winsock_errno (); + else + { + memcpy (name, &sock, MIN (*namelen, len)); + *namelen = len; + } + return res; +} + +/* There's no DLL which exports the symbol WSARecvMsg. One has to call + WSAIoctl as below to fetch the function pointer. Why on earth did the + MS developers decide not to export a normal symbol for these extension + functions? */ +inline int +get_ext_funcptr (SOCKET sock, void *funcptr) +{ + DWORD bret; + const GUID guid = WSAID_WSARECVMSG; + return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, + (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), + &bret, NULL, NULL); +} + +inline ssize_t +fhandler_socket_inet::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) +{ + ssize_t res = 0; + DWORD ret = 0, wret; + int evt_mask = FD_READ | ((wsamsg->dwFlags & MSG_OOB) ? FD_OOB : 0); + LPWSABUF &wsabuf = wsamsg->lpBuffers; + ULONG &wsacnt = wsamsg->dwBufferCount; + static NO_COPY LPFN_WSARECVMSG WSARecvMsg; + + /* CV 2014-10-26: Do not check for the connect_state at this point. In + certain scenarios there's no way to check the connect state reliably. + Example (hexchat): Parent process creates socket, forks, child process + calls connect, parent process calls read. Even if the event handling + allows to check for FD_CONNECT in the parent, there is always yet another + scenario we can easily break. */ + + DWORD wait_flags = wsamsg->dwFlags; + bool waitall = !!(wait_flags & MSG_WAITALL); + wsamsg->dwFlags &= (MSG_OOB | MSG_PEEK | MSG_DONTROUTE); + if (use_recvmsg) + { + if (!WSARecvMsg + && get_ext_funcptr (get_socket (), &WSARecvMsg) == SOCKET_ERROR) + { + if (wsamsg->Control.len > 0) + { + set_winsock_errno (); + return SOCKET_ERROR; + } + use_recvmsg = false; + } + else /* Only MSG_PEEK is supported by WSARecvMsg. */ + wsamsg->dwFlags &= MSG_PEEK; + } + if (waitall) + { + if (get_socket_type () != SOCK_STREAM) + { + WSASetLastError (WSAEOPNOTSUPP); + set_winsock_errno (); + return SOCKET_ERROR; + } + if (is_nonblocking () || (wsamsg->dwFlags & (MSG_OOB | MSG_PEEK))) + waitall = false; + } + + /* Note: Don't call WSARecvFrom(MSG_PEEK) without actually having data + waiting in the buffers, otherwise the event handling gets messed up + for some reason. */ + while (!(res = wait_for_events (evt_mask | FD_CLOSE, wait_flags)) + || saw_shutdown_read ()) + { + if (use_recvmsg) + res = WSARecvMsg (get_socket (), wsamsg, &wret, NULL, NULL); + /* This is working around a really weird problem in WinSock. + + Assume you create a socket, fork the process (thus duplicating + the socket), connect the socket in the child, then call recv + on the original socket handle in the parent process. + In this scenario, calls to WinSock's recvfrom and WSARecvFrom + in the parent will fail with WSAEINVAL, regardless whether both + address parameters, name and namelen, are NULL or point to valid + storage. However, calls to recv and WSARecv succeed as expected. + Per MSDN, WSAEINVAL in the context of recv means "The socket has not + been bound". It is as if the recvfrom functions test if the socket + is bound locally, but in the parent process, WinSock doesn't know + about that and fails, while the same test is omitted in the recv + functions. + + This also covers another weird case: WinSock returns WSAEFAULT if + namelen is a valid pointer while name is NULL. Both parameters are + ignored for TCP sockets, so this only occurs when using UDP socket. */ + else if (!wsamsg->name || get_socket_type () == SOCK_STREAM) + res = WSARecv (get_socket (), wsabuf, wsacnt, &wret, &wsamsg->dwFlags, + NULL, NULL); + else + res = WSARecvFrom (get_socket (), wsabuf, wsacnt, &wret, + &wsamsg->dwFlags, wsamsg->name, &wsamsg->namelen, + NULL, NULL); + if (!res) + { + ret += wret; + if (!waitall) + break; + while (wret && wsacnt) + { + if (wsabuf->len > wret) + { + wsabuf->len -= wret; + wsabuf->buf += wret; + wret = 0; + } + else + { + wret -= wsabuf->len; + ++wsabuf; + --wsacnt; + } + } + if (!wret) + break; + } + else if (WSAGetLastError () != WSAEWOULDBLOCK) + break; + } + + if (res) + { + /* According to SUSv3, errno isn't set in that case and no error + condition is returned. */ + if (WSAGetLastError () == WSAEMSGSIZE) + ret += wret; + else if (!ret) + { + /* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned + in this case. */ + if (WSAGetLastError () == WSAESHUTDOWN) + ret = 0; + else + { + set_winsock_errno (); + return SOCKET_ERROR; + } + } + } + + return ret; +} + +ssize_t +fhandler_socket_inet::recvfrom (void *in_ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen) +{ + char *ptr = (char *) in_ptr; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, + wsabuf, bufcnt, + { 0, NULL }, + (DWORD) flags }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, + &wsabuf, 1, + { 0, NULL}, + (DWORD) flags }; +#endif + ssize_t ret = recv_internal (&wsamsg, false); + if (fromlen) + *fromlen = wsamsg.namelen; + return ret; +} + +ssize_t +fhandler_socket_inet::recvmsg (struct msghdr *msg, int flags) +{ + /* Disappointing but true: Even if WSARecvMsg is supported, it's only + supported for datagram and raw sockets. */ + bool use_recvmsg = true; + if (get_socket_type () == SOCK_STREAM || get_addr_family () == AF_LOCAL) + { + use_recvmsg = false; + msg->msg_controllen = 0; + } + + WSABUF wsabuf[msg->msg_iovlen]; + WSABUF *wsaptr = wsabuf + msg->msg_iovlen; + const struct iovec *iovptr = msg->msg_iov + msg->msg_iovlen; + while (--wsaptr >= wsabuf) + { + wsaptr->len = (--iovptr)->iov_len; + wsaptr->buf = (char *) iovptr->iov_base; + } + WSAMSG wsamsg = { (struct sockaddr *) msg->msg_name, msg->msg_namelen, + wsabuf, (DWORD) msg->msg_iovlen, + { (DWORD) msg->msg_controllen, (char *) msg->msg_control }, + (DWORD) flags }; + ssize_t ret = recv_internal (&wsamsg, use_recvmsg); + if (ret >= 0) + { + msg->msg_namelen = wsamsg.namelen; + msg->msg_controllen = wsamsg.Control.len; + if (!CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR) + msg->msg_flags = wsamsg.dwFlags; + } + return ret; +} + +void __reg3 +fhandler_socket_inet::read (void *in_ptr, size_t& len) +{ + char *ptr = (char *) in_ptr; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; +#endif + + len = recv_internal (&wsamsg, false); +} + +ssize_t +fhandler_socket_inet::readv (const struct iovec *const iov, const int iovcnt, + ssize_t tot) +{ + WSABUF wsabuf[iovcnt]; + WSABUF *wsaptr = wsabuf + iovcnt; + const struct iovec *iovptr = iov + iovcnt; + while (--wsaptr >= wsabuf) + { + wsaptr->len = (--iovptr)->iov_len; + wsaptr->buf = (char *) iovptr->iov_base; + } + WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; + return recv_internal (&wsamsg, false); +} + +inline ssize_t +fhandler_socket_inet::send_internal (struct _WSAMSG *wsamsg, int flags) +{ + ssize_t res = 0; + DWORD ret = 0, sum = 0; + WSABUF out_buf[wsamsg->dwBufferCount]; + bool use_sendmsg = false; + DWORD wait_flags = flags & MSG_DONTWAIT; + bool nosignal = !!(flags & MSG_NOSIGNAL); + + flags &= (MSG_OOB | MSG_DONTROUTE); + if (wsamsg->Control.len > 0) + use_sendmsg = true; + /* Workaround for MSDN KB 823764: Split a message into chunks <= SO_SNDBUF. + in_idx is the index of the current lpBuffers from the input wsamsg buffer. + in_off is used to keep track of the next byte to write from a wsamsg + buffer which only gets partially written. */ + for (DWORD in_idx = 0, in_off = 0; + in_idx < wsamsg->dwBufferCount; + in_off >= wsamsg->lpBuffers[in_idx].len && (++in_idx, in_off = 0)) + { + /* Split a message into the least number of pieces to minimize the + number of WsaSendTo calls. Don't split datagram messages (bad idea). + out_idx is the index of the next buffer in the out_buf WSABUF, + also the number of buffers given to WSASendTo. + out_len is the number of bytes in the buffers given to WSASendTo. + Don't split datagram messages (very bad idea). */ + DWORD out_idx = 0; + DWORD out_len = 0; + if (get_socket_type () == SOCK_STREAM) + { + do + { + out_buf[out_idx].buf = wsamsg->lpBuffers[in_idx].buf + in_off; + out_buf[out_idx].len = wsamsg->lpBuffers[in_idx].len - in_off; + out_len += out_buf[out_idx].len; + out_idx++; + } + while (out_len < (unsigned) wmem () + && (in_off = 0, ++in_idx < wsamsg->dwBufferCount)); + /* Tweak len of the last out_buf buffer so the entire number of bytes + is (less than or) equal to wmem (). Fix out_len as well since it's + used in a subsequent test expression. */ + if (out_len > (unsigned) wmem ()) + { + out_buf[out_idx - 1].len -= out_len - (unsigned) wmem (); + out_len = (unsigned) wmem (); + } + /* Add the bytes written from the current last buffer to in_off, + so in_off points to the next byte to be written from that buffer, + or beyond which lets the outper loop skip to the next buffer. */ + in_off += out_buf[out_idx - 1].len; + } + + do + { + if (use_sendmsg) + res = WSASendMsg (get_socket (), wsamsg, flags, &ret, NULL, NULL); + else if (get_socket_type () == SOCK_STREAM) + res = WSASendTo (get_socket (), out_buf, out_idx, &ret, flags, + wsamsg->name, wsamsg->namelen, NULL, NULL); + else + res = WSASendTo (get_socket (), wsamsg->lpBuffers, + wsamsg->dwBufferCount, &ret, flags, + wsamsg->name, wsamsg->namelen, NULL, NULL); + if (res && (WSAGetLastError () == WSAEWOULDBLOCK)) + { + LOCK_EVENTS; + wsock_events->events &= ~FD_WRITE; + UNLOCK_EVENTS; + } + } + while (res && (WSAGetLastError () == WSAEWOULDBLOCK) + && !(res = wait_for_events (FD_WRITE | FD_CLOSE, wait_flags))); + + if (!res) + { + sum += ret; + /* For streams, return to application if the number of bytes written + is less than the number of bytes we intended to write in a single + call to WSASendTo. Otherwise we would have to add code to + backtrack in the input buffers, which is questionable. There was + probably a good reason we couldn't write more. */ + if (get_socket_type () != SOCK_STREAM || ret < out_len) + break; + } + else if (is_nonblocking () || WSAGetLastError() != WSAEWOULDBLOCK) + break; + } + + if (sum) + res = sum; + else if (res == SOCKET_ERROR) + { + set_winsock_errno (); + + /* Special handling for EPIPE and SIGPIPE. + + EPIPE is generated if the local end has been shut down on a connection + oriented socket. In this case the process will also receive a SIGPIPE + unless MSG_NOSIGNAL is set. */ + if ((get_errno () == ECONNABORTED || get_errno () == ESHUTDOWN) + && get_socket_type () == SOCK_STREAM) + { + set_errno (EPIPE); + if (!nosignal) + raise (SIGPIPE); + } + } + + return res; +} + +ssize_t +fhandler_socket_inet::sendto (const void *in_ptr, size_t len, int flags, + const struct sockaddr *to, int tolen) +{ + char *ptr = (char *) in_ptr; + struct sockaddr_storage sst; + + if (to && get_inet_addr_inet (to, tolen, &sst, &tolen) == SOCKET_ERROR) + return SOCKET_ERROR; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen, + wsabuf, bufcnt, + { 0, NULL }, + 0 }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen, + &wsabuf, 1, + { 0, NULL}, + 0 }; +#endif + return send_internal (&wsamsg, flags); +} + +ssize_t +fhandler_socket_inet::sendmsg (const struct msghdr *msg, int flags) +{ + /* TODO: Descriptor passing on AF_LOCAL sockets. */ + + struct sockaddr_storage sst; + int len = 0; + + if (msg->msg_name + && get_inet_addr_inet ((struct sockaddr *) msg->msg_name, + msg->msg_namelen, &sst, &len) == SOCKET_ERROR) + return SOCKET_ERROR; + + WSABUF wsabuf[msg->msg_iovlen]; + WSABUF *wsaptr = wsabuf; + const struct iovec *iovptr = msg->msg_iov; + for (int i = 0; i < msg->msg_iovlen; ++i) + { + wsaptr->len = iovptr->iov_len; + (wsaptr++)->buf = (char *) (iovptr++)->iov_base; + } + /* Disappointing but true: Even if WSASendMsg is supported, it's only + supported for datagram and raw sockets. */ + DWORD controllen = (DWORD) (get_socket_type () == SOCK_STREAM + || get_addr_family () == AF_LOCAL + ? 0 : msg->msg_controllen); + WSAMSG wsamsg = { msg->msg_name ? (struct sockaddr *) &sst : NULL, len, + wsabuf, (DWORD) msg->msg_iovlen, + { controllen, (char *) msg->msg_control }, + 0 }; + return send_internal (&wsamsg, flags); +} + +ssize_t +fhandler_socket_inet::write (const void *in_ptr, size_t len) +{ + char *ptr = (char *) in_ptr; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; +#endif + return send_internal (&wsamsg, 0); +} + +ssize_t +fhandler_socket_inet::writev (const struct iovec *const iov, const int iovcnt, + ssize_t tot) +{ + WSABUF wsabuf[iovcnt]; + WSABUF *wsaptr = wsabuf; + const struct iovec *iovptr = iov; + for (int i = 0; i < iovcnt; ++i) + { + wsaptr->len = iovptr->iov_len; + (wsaptr++)->buf = (char *) (iovptr++)->iov_base; + } + WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; + return send_internal (&wsamsg, 0); +} + +int +fhandler_socket_inet::setsockopt (int level, int optname, const void *optval, + socklen_t optlen) +{ + bool ignore = false; + int ret = -1; + + /* Preprocessing setsockopt. Set ignore to true if setsockopt call should + get skipped entirely. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + set_errno (ENOPROTOOPT); + return -1; + + case SO_REUSEADDR: + /* Per POSIX we must not be able to reuse a complete duplicate of a + local TCP address (same IP, same port), even if SO_REUSEADDR has + been set. This behaviour is maintained in WinSock for backward + compatibility, while the WinSock standard behaviour of stream + socket binding is equivalent to the POSIX behaviour as if + SO_REUSEADDR has been set. The SO_EXCLUSIVEADDRUSE option has + been added to allow an application to request POSIX standard + behaviour in the non-SO_REUSEADDR case. + + To emulate POSIX socket binding behaviour, note that SO_REUSEADDR + has been set but don't call setsockopt. Instead + fhandler_socket::bind sets SO_EXCLUSIVEADDRUSE if the application + did not set SO_REUSEADDR. */ + if (optlen < (socklen_t) sizeof (int)) + { + set_errno (EINVAL); + return ret; + } + if (get_socket_type () == SOCK_STREAM) + ignore = true; + break; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + if (optlen < (socklen_t) sizeof (struct timeval)) + { + set_errno (EINVAL); + return ret; + } + if (timeval_to_ms ((struct timeval *) optval, + (optname == SO_RCVTIMEO) ? rcvtimeo () + : sndtimeo ())) + ret = 0; + else + set_errno (EDOM); + return ret; + + default: + break; + } + break; + + case IPPROTO_IP: + /* Old applications still use the old WinSock1 IPPROTO_IP values. */ + if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) + optname = convert_ws1_ip_optname (optname); + switch (optname) + { + case IP_TOS: + /* Winsock doesn't support setting the IP_TOS field with setsockopt + and TOS was never implemented for TCP anyway. setsockopt returns + WinSock error 10022, WSAEINVAL when trying to set the IP_TOS + field. We just return 0 instead. */ + ignore = true; + break; + + default: + break; + } + break; + + case IPPROTO_IPV6: + { + switch (optname) + { + case IPV6_TCLASS: + /* Unsupported */ + ignore = true; + break; + + default: + break; + } + } + default: + break; + } + + /* Call Winsock setsockopt (or not) */ + if (ignore) + ret = 0; + else + { + ret = ::setsockopt (get_socket (), level, optname, (const char *) optval, + optlen); + if (ret == SOCKET_ERROR) + { + set_winsock_errno (); + return ret; + } + } + + if (optlen == (socklen_t) sizeof (int)) + debug_printf ("setsockopt optval=%x", *(int *) optval); + + /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_REUSEADDR: + saw_reuseaddr (*(int *) optval); + break; + + case SO_RCVBUF: + rmem (*(int *) optval); + break; + + case SO_SNDBUF: + wmem (*(int *) optval); + break; + + default: + break; + } + break; + + default: + break; + } + + return ret; +} + +int +fhandler_socket_inet::getsockopt (int level, int optname, const void *optval, + socklen_t *optlen) +{ + bool onebyte = false; + int ret = -1; + + /* Preprocessing getsockopt. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + set_errno (ENOPROTOOPT); + return -1; + + case SO_REUSEADDR: + { + unsigned int *reuseaddr = (unsigned int *) optval; + + if (*optlen < (socklen_t) sizeof *reuseaddr) + { + set_errno (EINVAL); + return -1; + } + *reuseaddr = saw_reuseaddr(); + *optlen = (socklen_t) sizeof *reuseaddr; + return 0; + } + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + struct timeval *time_out = (struct timeval *) optval; + + if (*optlen < (socklen_t) sizeof *time_out) + { + set_errno (EINVAL); + return -1; + } + DWORD ms = (optname == SO_RCVTIMEO) ? rcvtimeo () : sndtimeo (); + if (ms == 0 || ms == INFINITE) + { + time_out->tv_sec = 0; + time_out->tv_usec = 0; + } + else + { + time_out->tv_sec = ms / MSPERSEC; + time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; + } + *optlen = (socklen_t) sizeof *time_out; + return 0; + } + + case SO_TYPE: + { + unsigned int *type = (unsigned int *) optval; + *type = get_socket_type (); + *optlen = (socklen_t) sizeof *type; + return 0; + } + + default: + break; + } + break; + + case IPPROTO_IP: + /* Old applications still use the old WinSock1 IPPROTO_IP values. */ + if (CYGWIN_VERSION_CHECK_FOR_USING_WINSOCK1_VALUES) + optname = convert_ws1_ip_optname (optname); + break; + + default: + break; + } + + /* Call Winsock getsockopt */ + ret = ::getsockopt (get_socket (), level, optname, (char *) optval, + (int *) optlen); + if (ret == SOCKET_ERROR) + { + set_winsock_errno (); + return ret; + } + + /* Postprocessing getsockopt, setting fhandler_socket members, etc. Set + onebyte true for options returning BOOLEAN instead of a boolean DWORD. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_ERROR: + { + int *e = (int *) optval; + debug_printf ("WinSock SO_ERROR = %d", *e); + *e = find_winsock_errno (*e); + } + break; + + case SO_KEEPALIVE: + case SO_DONTROUTE: + onebyte = true; + break; + + default: + break; + } + break; + case IPPROTO_TCP: + switch (optname) + { + case TCP_NODELAY: + onebyte = true; + break; + + default: + break; + } + default: + break; + } + + if (onebyte) + { + /* Regression in Vista and later: instead of a 4 byte BOOL value, a + 1 byte BOOLEAN value is returned, in contrast to older systems and + the documentation. Since an int type is expected by the calling + application, we convert the result here. For some reason only three + BSD-compatible socket options seem to be affected. */ + BOOLEAN *in = (BOOLEAN *) optval; + int *out = (int *) optval; + *out = *in; + *optlen = 4; + } + + return ret; +} diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc new file mode 100644 index 000000000..3d48a8159 --- /dev/null +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -0,0 +1,1844 @@ +/* fhandler_socket_local.cc. + + See fhandler.h for a description of the fhandler classes. + + This file is part of Cygwin. + + This software is a copyrighted work licensed under the terms of the + Cygwin license. Please consult the file "CYGWIN_LICENSE" for + details. */ + +#define __INSIDE_CYGWIN_NET__ +#define USE_SYS_TYPES_FD_SET + +#include "winsup.h" +#ifdef __x86_64__ +/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) + because a redefinition for LP64 systems is missing. This leads to a wrong + definition and size of sockaddr_in6 when building with winsock headers. + This definition is also required to use the right u_long type in subsequent + function calls. */ +#undef u_long +#define u_long __ms_u_long +#endif +#include +#include +#include +#include +#include "cygerrno.h" +#include "security.h" +#include "path.h" +#include "fhandler.h" +#include "dtable.h" +#include "cygheap.h" +#include +#include "cygwin/version.h" +#include "perprocess.h" +#include "shared_info.h" +#include "sigproc.h" +#include "wininfo.h" +#include +#include +#include +#include +#include "cygtls.h" +#include +#include "ntdll.h" +#include "miscfuncs.h" +#include "tls_pbuf.h" + +extern "C" { + int sscanf (const char *, const char *, ...); +} /* End of "C" section */ + +#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) +#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) + +#define LOCK_EVENTS \ + if (wsock_mtx && \ + WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) \ + { + +#define UNLOCK_EVENTS \ + ReleaseMutex (wsock_mtx); \ + } + +static inline mode_t +adjust_socket_file_mode (mode_t mode) +{ + /* Kludge: Don't allow to remove read bit on socket files for + user/group/other, if the accompanying write bit is set. It would + be nice to have exact permissions on a socket file, but it's + necessary that somebody able to access the socket can always read + the contents of the socket file to avoid spurious "permission + denied" messages. */ + return mode | ((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) << 1); +} + +/* cygwin internal: map sockaddr into internet domain address */ +static int +get_inet_addr_local (const struct sockaddr *in, int inlen, + struct sockaddr_storage *out, int *outlen, + int *type = NULL, int *secret = NULL) +{ + int secret_buf [4]; + int* secret_ptr = (secret ? : secret_buf); + + /* Check for abstract socket. These are generated for AF_LOCAL datagram + sockets in recv_internal, to allow a datagram server to use sendto + after recvfrom. */ + if (inlen >= (int) sizeof (in->sa_family) + 7 + && in->sa_data[0] == '\0' && in->sa_data[1] == 'd' + && in->sa_data[6] == '\0') + { + struct sockaddr_in addr; + addr.sin_family = AF_INET; + sscanf (in->sa_data + 2, "%04hx", &addr.sin_port); + addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + *outlen = sizeof addr; + memcpy (out, &addr, *outlen); + return 0; + } + + /* AF_LOCAL/AF_UNIX only */ + path_conv pc (in->sa_data, PC_SYM_FOLLOW); + if (pc.error) + { + set_errno (pc.error); + return SOCKET_ERROR; + } + if (!pc.exists ()) + { + set_errno (ENOENT); + return SOCKET_ERROR; + } + /* Do NOT test for the file being a socket file here. The socket file + creation is not an atomic operation, so there is a chance that socket + files which are just in the process of being created are recognized + as non-socket files. To work around this problem we now create the + file with all sharing disabled. If the below NtOpenFile fails + with STATUS_SHARING_VIOLATION we know that the file already exists, + but the creating process isn't finished yet. So we yield and try + again, until we can either open the file successfully, or some error + other than STATUS_SHARING_VIOLATION occurs. + Since we now don't know if the file is actually a socket file, we + perform this check here explicitely. */ + NTSTATUS status; + HANDLE fh; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + + pc.get_object_attr (attr, sec_none_nih); + do + { + status = NtOpenFile (&fh, GENERIC_READ | SYNCHRONIZE, &attr, &io, + FILE_SHARE_VALID_FLAGS, + FILE_SYNCHRONOUS_IO_NONALERT + | FILE_OPEN_FOR_BACKUP_INTENT + | FILE_NON_DIRECTORY_FILE); + if (status == STATUS_SHARING_VIOLATION) + { + /* While we hope that the sharing violation is only temporary, we + also could easily get stuck here, waiting for a file in use by + some greedy Win32 application. Therefore we should never wait + endlessly without checking for signals and thread cancel event. */ + pthread_testcancel (); + if (cygwait (NULL, cw_nowait, cw_sig_eintr) == WAIT_SIGNALED + && !_my_tls.call_signal_handler ()) + { + set_errno (EINTR); + return SOCKET_ERROR; + } + yield (); + } + else if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return SOCKET_ERROR; + } + } + while (status == STATUS_SHARING_VIOLATION); + /* Now test for the SYSTEM bit. */ + FILE_BASIC_INFORMATION fbi; + status = NtQueryInformationFile (fh, &io, &fbi, sizeof fbi, + FileBasicInformation); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return SOCKET_ERROR; + } + if (!(fbi.FileAttributes & FILE_ATTRIBUTE_SYSTEM)) + { + NtClose (fh); + set_errno (EBADF); + return SOCKET_ERROR; + } + /* Eventually check the content and fetch the required information. */ + char buf[128]; + memset (buf, 0, sizeof buf); + status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, 128, NULL, NULL); + NtClose (fh); + if (NT_SUCCESS (status)) + { + struct sockaddr_in sin; + char ctype; + sin.sin_family = AF_INET; + if (strncmp (buf, SOCKET_COOKIE, strlen (SOCKET_COOKIE))) + { + set_errno (EBADF); + return SOCKET_ERROR; + } + sscanf (buf + strlen (SOCKET_COOKIE), "%hu %c %08x-%08x-%08x-%08x", + &sin.sin_port, + &ctype, + secret_ptr, secret_ptr + 1, secret_ptr + 2, secret_ptr + 3); + sin.sin_port = htons (sin.sin_port); + sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + memcpy (out, &sin, sizeof sin); + *outlen = sizeof sin; + if (type) + *type = (ctype == 's' ? SOCK_STREAM : + ctype == 'd' ? SOCK_DGRAM + : 0); + return 0; + } + __seterrno_from_nt_status (status); + return SOCKET_ERROR; +} + +fhandler_socket_local::fhandler_socket_local () : + fhandler_socket (), + sun_path (NULL), + peer_sun_path (NULL) +{ +} + +fhandler_socket_local::~fhandler_socket_local () +{ + if (sun_path) + cfree (sun_path); + if (peer_sun_path) + cfree (peer_sun_path); +} + +int +fhandler_socket_local::socket (int af, int type, int protocol, int flags) +{ + SOCKET sock; + int ret; + + sock = ::socket (AF_INET, type, protocol); + if (sock == INVALID_SOCKET) + { + set_winsock_errno (); + return -1; + } + ret = set_socket_handle (sock, af, type, flags); + if (ret < 0) + ::closesocket (sock); + return ret; +} + +int +fhandler_socket_local::socketpair (int af, int type, int protocol, int flags, + fhandler_socket *_fh_out) +{ + SOCKET insock = INVALID_SOCKET; + SOCKET outsock = INVALID_SOCKET; + SOCKET sock = INVALID_SOCKET; + struct sockaddr_in sock_in, sock_out; + int len; + + fhandler_socket_local *fh_out = (fhandler_socket_local *) _fh_out; + /* create listening socket */ + sock = ::socket (AF_INET, type, 0); + if (sock == INVALID_SOCKET) + { + set_winsock_errno (); + goto err; + } + /* bind to unused port */ + sock_in.sin_family = AF_INET; + sock_in.sin_port = 0; + sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (::bind (sock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) + { + set_winsock_errno (); + goto err; + } + /* fetch socket name */ + len = sizeof (sock_in); + if (::getsockname (sock, (struct sockaddr *) &sock_in, &len) < 0) + { + set_winsock_errno (); + goto err; + } + /* on stream sockets, create listener */ + if (type == SOCK_STREAM && ::listen (sock, 2) < 0) + { + set_winsock_errno (); + goto err; + } + /* create connecting socket */ + outsock = ::socket (AF_INET, type, 0); + if (outsock == INVALID_SOCKET) + { + set_winsock_errno (); + goto err; + } + /* on datagram sockets, bind connecting socket */ + if (type == SOCK_DGRAM) + { + sock_out.sin_family = AF_INET; + sock_out.sin_port = 0; + sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (::bind (outsock, (struct sockaddr *) &sock_out, + sizeof (sock_out)) < 0) + { + set_winsock_errno (); + goto err; + } + /* ...and fetch name */ + len = sizeof (sock_out); + if (::getsockname (outsock, (struct sockaddr *) &sock_out, &len) < 0) + { + set_winsock_errno (); + goto err; + } + } + sock_in.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (type == SOCK_DGRAM) + sock_out.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + /* connect */ + if (::connect (outsock, (struct sockaddr *) &sock_in, sizeof (sock_in)) < 0) + { + set_winsock_errno (); + goto err; + } + if (type == SOCK_STREAM) + { + /* on stream sockets, accept connection and close listener */ + len = sizeof (sock_in); + insock = ::accept (sock, (struct sockaddr *) &sock_in, &len); + if (insock == INVALID_SOCKET) + { + set_winsock_errno (); + goto err; + } + ::closesocket (sock); + } + else + { + /* on datagram sockets, connect vice versa */ + if (::connect (sock, (struct sockaddr *) &sock_out, + sizeof (sock_out)) < 0) + { + set_winsock_errno (); + goto err; + } + insock = sock; + } + sock = INVALID_SOCKET; + + /* postprocessing */ + connect_state (connected); + fh_out->connect_state (connected); + if (af == AF_LOCAL && type == SOCK_STREAM) + { + af_local_set_sockpair_cred (); + fh_out->af_local_set_sockpair_cred (); + } + if (set_socket_handle (insock, af, type, flags) < 0 + || fh_out->set_socket_handle (outsock, af, type, flags) < 0) + goto err; + + return 0; + +err: + if (sock != INVALID_SOCKET) + ::closesocket (sock); + if (insock != INVALID_SOCKET) + ::closesocket (insock); + if (outsock != INVALID_SOCKET) + ::closesocket (outsock); + return -1; +} + +void +fhandler_socket_local::af_local_set_sockpair_cred () +{ + sec_pid = sec_peer_pid = getpid (); + sec_uid = sec_peer_uid = geteuid32 (); + sec_gid = sec_peer_gid = getegid32 (); +} + +void +fhandler_socket_local::af_local_setblocking (bool &async, bool &nonblocking) +{ + async = async_io (); + nonblocking = is_nonblocking (); + if (async) + { + WSAAsyncSelect (get_socket (), winmsg, 0, 0); + WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); + } + set_nonblocking (false); + async_io (false); +} + +void +fhandler_socket_local::af_local_unsetblocking (bool async, bool nonblocking) +{ + if (nonblocking) + set_nonblocking (true); + if (async) + { + WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, ASYNC_MASK); + async_io (true); + } +} + +bool +fhandler_socket_local::af_local_recv_secret () +{ + int out[4] = { 0, 0, 0, 0 }; + int rest = sizeof out; + char *ptr = (char *) out; + while (rest > 0) + { + int ret = recvfrom (ptr, rest, 0, NULL, NULL); + if (ret <= 0) + break; + rest -= ret; + ptr += ret; + } + if (rest == 0) + { + debug_printf ("Received af_local secret: %08x-%08x-%08x-%08x", + out[0], out[1], out[2], out[3]); + if (out[0] != connect_secret[0] || out[1] != connect_secret[1] + || out[2] != connect_secret[2] || out[3] != connect_secret[3]) + { + debug_printf ("Receiving af_local secret mismatch"); + return false; + } + } + else + debug_printf ("Receiving af_local secret failed"); + return rest == 0; +} + +bool +fhandler_socket_local::af_local_send_secret () +{ + int rest = sizeof connect_secret; + char *ptr = (char *) connect_secret; + while (rest > 0) + { + int ret = sendto (ptr, rest, 0, NULL, 0); + if (ret <= 0) + break; + rest -= ret; + ptr += ret; + } + debug_printf ("Sending af_local secret %s", rest == 0 ? "succeeded" + : "failed"); + return rest == 0; +} + +bool +fhandler_socket_local::af_local_recv_cred () +{ + struct ucred out = { (pid_t) 0, (uid_t) -1, (gid_t) -1 }; + int rest = sizeof out; + char *ptr = (char *) &out; + while (rest > 0) + { + int ret = recvfrom (ptr, rest, 0, NULL, NULL); + if (ret <= 0) + break; + rest -= ret; + ptr += ret; + } + if (rest == 0) + { + debug_printf ("Received eid credentials: pid: %d, uid: %d, gid: %d", + out.pid, out.uid, out.gid); + sec_peer_pid = out.pid; + sec_peer_uid = out.uid; + sec_peer_gid = out.gid; + } + else + debug_printf ("Receiving eid credentials failed"); + return rest == 0; +} + +bool +fhandler_socket_local::af_local_send_cred () +{ + struct ucred in = { sec_pid, sec_uid, sec_gid }; + int rest = sizeof in; + char *ptr = (char *) ∈ + while (rest > 0) + { + int ret = sendto (ptr, rest, 0, NULL, 0); + if (ret <= 0) + break; + rest -= ret; + ptr += ret; + } + if (rest == 0) + debug_printf ("Sending eid credentials succeeded"); + else + debug_printf ("Sending eid credentials failed"); + return rest == 0; +} + +int +fhandler_socket_local::af_local_connect () +{ + bool orig_async_io, orig_is_nonblocking; + + if (get_socket_type () != SOCK_STREAM) + return 0; + + debug_printf ("af_local_connect called, no_getpeereid=%d", no_getpeereid ()); + if (no_getpeereid ()) + return 0; + + af_local_setblocking (orig_async_io, orig_is_nonblocking); + if (!af_local_send_secret () || !af_local_recv_secret () + || !af_local_send_cred () || !af_local_recv_cred ()) + { + debug_printf ("accept from unauthorized server"); + ::shutdown (get_socket (), SD_BOTH); + WSASetLastError (WSAECONNREFUSED); + return -1; + } + af_local_unsetblocking (orig_async_io, orig_is_nonblocking); + return 0; +} + +int +fhandler_socket_local::af_local_accept () +{ + bool orig_async_io, orig_is_nonblocking; + + debug_printf ("af_local_accept called, no_getpeereid=%d", no_getpeereid ()); + if (no_getpeereid ()) + return 0; + + af_local_setblocking (orig_async_io, orig_is_nonblocking); + if (!af_local_recv_secret () || !af_local_send_secret () + || !af_local_recv_cred () || !af_local_send_cred ()) + { + debug_printf ("connect from unauthorized client"); + ::shutdown (get_socket (), SD_BOTH); + ::closesocket (get_socket ()); + WSASetLastError (WSAECONNABORTED); + return -1; + } + af_local_unsetblocking (orig_async_io, orig_is_nonblocking); + return 0; +} + +int +fhandler_socket_local::af_local_set_no_getpeereid () +{ + if (get_addr_family () != AF_LOCAL || get_socket_type () != SOCK_STREAM) + { + set_errno (EINVAL); + return -1; + } + if (connect_state () != unconnected) + { + set_errno (EALREADY); + return -1; + } + + debug_printf ("no_getpeereid set"); + no_getpeereid (true); + return 0; +} + +void +fhandler_socket_local::af_local_set_cred () +{ + sec_pid = getpid (); + sec_uid = geteuid32 (); + sec_gid = getegid32 (); + sec_peer_pid = (pid_t) 0; + sec_peer_uid = (uid_t) -1; + sec_peer_gid = (gid_t) -1; +} + +void +fhandler_socket_local::af_local_copy (fhandler_socket_local *sock) +{ + sock->connect_secret[0] = connect_secret[0]; + sock->connect_secret[1] = connect_secret[1]; + sock->connect_secret[2] = connect_secret[2]; + sock->connect_secret[3] = connect_secret[3]; + sock->sec_pid = sec_pid; + sock->sec_uid = sec_uid; + sock->sec_gid = sec_gid; + sock->sec_peer_pid = sec_peer_pid; + sock->sec_peer_uid = sec_peer_uid; + sock->sec_peer_gid = sec_peer_gid; + sock->no_getpeereid (no_getpeereid ()); +} + +void +fhandler_socket_local::af_local_set_secret (char *buf) +{ + if (!RtlGenRandom (connect_secret, sizeof (connect_secret))) + bzero ((char*) connect_secret, sizeof (connect_secret)); + __small_sprintf (buf, "%08x-%08x-%08x-%08x", + connect_secret [0], connect_secret [1], + connect_secret [2], connect_secret [3]); +} + +int +fhandler_socket_local::dup (fhandler_base *child, int flags) +{ + fhandler_socket_local *fhs = (fhandler_socket_local *) child; + fhs->set_sun_path (get_sun_path ()); + fhs->set_peer_sun_path (get_peer_sun_path ()); + return fhandler_socket::dup (child, flags); +} + +int __reg2 +fhandler_socket_local::fstat (struct stat *buf) +{ + int res; + + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fstat (buf); + res = fhandler_base::fstat_fs (buf); + if (!res) + { + buf->st_mode = (buf->st_mode & ~S_IFMT) | S_IFSOCK; + buf->st_size = 0; + } + return res; +} + +int __reg2 +fhandler_socket_local::fstatvfs (struct statvfs *sfs) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fstatvfs (sfs); + fhandler_disk_file fh (pc); + fh.get_device () = FH_FS; + return fh.fstatvfs (sfs); +} + +int +fhandler_socket_local::fchmod (mode_t newmode) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return 0; + fhandler_disk_file fh (pc); + fh.get_device () = FH_FS; + return fh.fchmod (S_IFSOCK | adjust_socket_file_mode (newmode)); +} + +int +fhandler_socket_local::fchown (uid_t uid, gid_t gid) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fchown (uid, gid); + fhandler_disk_file fh (pc); + return fh.fchown (uid, gid); +} + +int +fhandler_socket_local::facl (int cmd, int nentries, aclent_t *aclbufp) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::facl (cmd, nentries, aclbufp); + fhandler_disk_file fh (pc); + return fh.facl (cmd, nentries, aclbufp); +} + +int +fhandler_socket_local::link (const char *newpath) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::link (newpath); + fhandler_disk_file fh (pc); + return fh.link (newpath); +} + +int +fhandler_socket_local::bind (const struct sockaddr *name, int namelen) +{ + int res = -1; + +#define un_addr ((struct sockaddr_un *) name) + struct sockaddr_in sin; + int len = namelen - offsetof (struct sockaddr_un, sun_path); + + /* Check that name is within bounds. Don't check if the string is + NUL-terminated, because there are projects out there which set + namelen to a value which doesn't cover the trailing NUL. */ + if (len <= 1 || (len = strnlen (un_addr->sun_path, len)) > UNIX_PATH_MAX) + { + set_errno (len <= 1 ? (len == 1 ? ENOENT : EINVAL) : ENAMETOOLONG); + return -1; + } + /* Copy over the sun_path string into a buffer big enough to add a + trailing NUL. */ + char sun_path[len + 1]; + strncpy (sun_path, un_addr->sun_path, len); + sun_path[len] = '\0'; + + /* This isn't entirely foolproof, but we check first if the file exists + so we can return with EADDRINUSE before having bound the socket. + This allows an application to call bind again on the same socket using + another filename. If we bind first, the application will not be able + to call bind successfully ever again. */ + path_conv pc (sun_path, PC_SYM_FOLLOW); + if (pc.error) + { + set_errno (pc.error); + return -1; + } + if (pc.exists ()) + { + set_errno (EADDRINUSE); + return -1; + } + + sin.sin_family = AF_INET; + sin.sin_port = 0; + sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + if (::bind (get_socket (), (sockaddr *) &sin, len = sizeof sin)) + { + syscall_printf ("AF_LOCAL: bind failed"); + set_winsock_errno (); + return -1; + } + if (::getsockname (get_socket (), (sockaddr *) &sin, &len)) + { + syscall_printf ("AF_LOCAL: getsockname failed"); + set_winsock_errno (); + return -1; + } + + sin.sin_port = ntohs (sin.sin_port); + debug_printf ("AF_LOCAL: socket bound to port %u", sin.sin_port); + + mode_t mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; + DWORD fattr = FILE_ATTRIBUTE_SYSTEM; + if (!pc.has_acls () + && !(mode & ~cygheap->umask & (S_IWUSR | S_IWGRP | S_IWOTH))) + fattr |= FILE_ATTRIBUTE_READONLY; + SECURITY_ATTRIBUTES sa = sec_none_nih; + NTSTATUS status; + HANDLE fh; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + ULONG access = DELETE | FILE_GENERIC_WRITE; + + /* If the filesystem supports ACLs, we will overwrite the DACL after the + call to NtCreateFile. This requires a handle with READ_CONTROL and + WRITE_DAC access, otherwise get_file_sd and set_file_sd both have to + open the file again. + FIXME: On remote NTFS shares open sometimes fails because even the + creator of the file doesn't have the right to change the DACL. + I don't know what setting that is or how to recognize such a share, + so for now we don't request WRITE_DAC on remote drives. */ + if (pc.has_acls () && !pc.isremote ()) + access |= READ_CONTROL | WRITE_DAC | WRITE_OWNER; + + status = NtCreateFile (&fh, access, pc.get_object_attr (attr, sa), &io, + NULL, fattr, 0, FILE_CREATE, + FILE_NON_DIRECTORY_FILE + | FILE_SYNCHRONOUS_IO_NONALERT + | FILE_OPEN_FOR_BACKUP_INTENT, + NULL, 0); + if (!NT_SUCCESS (status)) + { + if (io.Information == FILE_EXISTS) + set_errno (EADDRINUSE); + else + __seterrno_from_nt_status (status); + } + else + { + if (pc.has_acls ()) + set_created_file_access (fh, pc, mode); + char buf[sizeof (SOCKET_COOKIE) + 80]; + __small_sprintf (buf, "%s%u %c ", SOCKET_COOKIE, sin.sin_port, + get_socket_type () == SOCK_STREAM ? 's' + : get_socket_type () == SOCK_DGRAM ? 'd' : '-'); + af_local_set_secret (strchr (buf, '\0')); + DWORD blen = strlen (buf) + 1; + status = NtWriteFile (fh, NULL, NULL, NULL, &io, buf, blen, NULL, 0); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + FILE_DISPOSITION_INFORMATION fdi = { TRUE }; + status = NtSetInformationFile (fh, &io, &fdi, sizeof fdi, + FileDispositionInformation); + if (!NT_SUCCESS (status)) + debug_printf ("Setting delete dispostion failed, status = %y", + status); + } + else + { + set_sun_path (sun_path); + res = 0; + } + NtClose (fh); + } +#undef un_addr + + return res; +} + +int +fhandler_socket_local::connect (const struct sockaddr *name, int namelen) +{ + struct sockaddr_storage sst; + int type = 0; + + if (get_inet_addr_local (name, namelen, &sst, &namelen, &type, connect_secret) + == SOCKET_ERROR) + return SOCKET_ERROR; + + if (get_socket_type () != type) + { + WSASetLastError (WSAEPROTOTYPE); + set_winsock_errno (); + return SOCKET_ERROR; + } + + set_peer_sun_path (name->sa_data); + + /* Don't move af_local_set_cred into af_local_connect which may be called + via select, possibly running under another identity. Call early here, + because af_local_connect is called in wait_for_events. */ + if (get_socket_type () == SOCK_STREAM) + af_local_set_cred (); + + /* Initialize connect state to "connect_pending". State is ultimately set + to "connected" or "connect_failed" in wait_for_events when the FD_CONNECT + event occurs. Note that the underlying OS sockets are always non-blocking + and a successfully initiated non-blocking Winsock connect always returns + WSAEWOULDBLOCK. Thus it's safe to rely on event handling. + + Check for either unconnected or connect_failed since in both cases it's + allowed to retry connecting the socket. It's also ok (albeit ugly) to + call connect to check if a previous non-blocking connect finished. + + Set connect_state before calling connect, otherwise a race condition with + an already running select or poll might occur. */ + if (connect_state () == unconnected || connect_state () == connect_failed) + connect_state (connect_pending); + + int res = ::connect (get_socket (), (struct sockaddr *) &sst, namelen); + if (!is_nonblocking () + && res == SOCKET_ERROR + && WSAGetLastError () == WSAEWOULDBLOCK) + res = wait_for_events (FD_CONNECT | FD_CLOSE, 0); + + if (res) + { + DWORD err = WSAGetLastError (); + + /* Some applications use the ugly technique to check if a non-blocking + connect succeeded by calling connect again, until it returns EISCONN. + This circumvents the event handling and connect_state is never set. + Thus we check for this situation here. */ + if (err == WSAEISCONN) + connect_state (connected); + /* Winsock returns WSAEWOULDBLOCK if the non-blocking socket cannot be + conected immediately. Convert to POSIX/Linux compliant EINPROGRESS. */ + else if (is_nonblocking () && err == WSAEWOULDBLOCK) + WSASetLastError (WSAEINPROGRESS); + /* Winsock returns WSAEINVAL if the socket is already a listener. + Convert to POSIX/Linux compliant EISCONN. */ + else if (err == WSAEINVAL && connect_state () == listener) + WSASetLastError (WSAEISCONN); + /* Any other error except WSAEALREADY during connect_pending means the + connect failed. */ + else if (connect_state () == connect_pending && err != WSAEALREADY) + connect_state (connect_failed); + set_winsock_errno (); + } + + return res; +} + +int +fhandler_socket_local::listen (int backlog) +{ + int res = ::listen (get_socket (), backlog); + if (res && WSAGetLastError () == WSAEINVAL) + { + /* It's perfectly valid to call listen on an unbound INET socket. + In this case the socket is automatically bound to an unused + port number, listening on all interfaces. On WinSock, listen + fails with WSAEINVAL when it's called on an unbound socket. + So we have to bind manually here to have POSIX semantics. */ + if (get_addr_family () == AF_INET) + { + struct sockaddr_in sin; + sin.sin_family = AF_INET; + sin.sin_port = 0; + sin.sin_addr.s_addr = INADDR_ANY; + if (!::bind (get_socket (), (struct sockaddr *) &sin, sizeof sin)) + res = ::listen (get_socket (), backlog); + } + else if (get_addr_family () == AF_INET6) + { + struct sockaddr_in6 sin6; + memset (&sin6, 0, sizeof sin6); + sin6.sin6_family = AF_INET6; + if (!::bind (get_socket (), (struct sockaddr *) &sin6, sizeof sin6)) + res = ::listen (get_socket (), backlog); + } + } + if (!res) + { + if (get_addr_family () == AF_LOCAL && get_socket_type () == SOCK_STREAM) + af_local_set_cred (); + connect_state (listener); /* gets set to connected on accepted socket. */ + } + else + set_winsock_errno (); + return res; +} + +int +fhandler_socket_local::accept4 (struct sockaddr *peer, int *len, int flags) +{ + int ret = -1; + /* Allows NULL peer and len parameters. */ + struct sockaddr_storage lpeer; + int llen = sizeof (struct sockaddr_storage); + + /* Windows event handling does not check for the validity of the desired + flags so we have to do it here. */ + if (connect_state () != listener) + { + WSASetLastError (WSAEINVAL); + set_winsock_errno (); + return -1; + } + + SOCKET res = INVALID_SOCKET; + while (!(res = wait_for_events (FD_ACCEPT | FD_CLOSE, 0)) + && (res = ::accept (get_socket (), (struct sockaddr *) &lpeer, &llen)) + == INVALID_SOCKET + && WSAGetLastError () == WSAEWOULDBLOCK) + ; + if (res == INVALID_SOCKET) + set_winsock_errno (); + else + { + cygheap_fdnew fd; + + if (fd >= 0) + { + fhandler_socket_local *sock = (fhandler_socket_local *) + build_fh_dev (dev ()); + if (sock && sock->set_socket_handle (res, get_addr_family (), + get_socket_type (), + get_socket_flags ())) + { + sock->async_io (false); /* set_socket_handle disables async. */ + sock->set_sun_path (get_sun_path ()); + sock->set_peer_sun_path (get_peer_sun_path ()); + if (get_socket_type () == SOCK_STREAM) + { + /* Don't forget to copy credentials from accepting + socket to accepted socket and start transaction + on accepted socket! */ + af_local_copy (sock); + ret = sock->af_local_accept (); + if (ret == -1) + { + fd.release (); + delete sock; + set_winsock_errno (); + return -1; + } + } + /* No locking necessary at this point. */ + sock->wsock_events->events = wsock_events->events | FD_WRITE; + sock->wsock_events->owner = wsock_events->owner; + sock->connect_state (connected); + fd = sock; + if (fd <= 2) + set_std_handle (fd); + ret = fd; + if (peer) + { + /* FIXME: Right now we have no way to determine the + bound socket name of the peer's socket. For now + we just fake an unbound socket on the other side. */ + static struct sockaddr_un un = { AF_LOCAL, "" }; + memcpy (peer, &un, MIN (*len, (int) sizeof (un.sun_family))); + *len = (int) sizeof (un.sun_family); + } + } + } + if (ret == -1) + ::closesocket (res); + } + return ret; +} + +int +fhandler_socket_local::getsockname (struct sockaddr *name, int *namelen) +{ + struct sockaddr_un sun; + + sun.sun_family = AF_LOCAL; + sun.sun_path[0] = '\0'; + if (get_sun_path ()) + strncat (sun.sun_path, get_sun_path (), UNIX_PATH_MAX - 1); + memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); + *namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0); + return 0; +} + +int +fhandler_socket_local::getpeername (struct sockaddr *name, int *namelen) +{ + /* Always use a local big enough buffer and truncate later as necessary + per POSIX. WinSock unfortunately only returns WSAEFAULT if the buffer + is too small. */ + struct sockaddr_storage sock; + int len = sizeof sock; + int res = ::getpeername (get_socket (), (struct sockaddr *) &sock, &len); + if (res) + set_winsock_errno (); + else + { + struct sockaddr_un sun; + memset (&sun, 0, sizeof sun); + sun.sun_family = AF_LOCAL; + sun.sun_path[0] = '\0'; + if (get_peer_sun_path ()) + strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_MAX - 1); + memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); + *namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0); + } + return res; +} + +/* There's no DLL which exports the symbol WSARecvMsg. One has to call + WSAIoctl as below to fetch the function pointer. Why on earth did the + MS developers decide not to export a normal symbol for these extension + functions? */ +inline int +get_ext_funcptr (SOCKET sock, void *funcptr) +{ + DWORD bret; + const GUID guid = WSAID_WSARECVMSG; + return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, + (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), + &bret, NULL, NULL); +} + +inline ssize_t +fhandler_socket_local::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) +{ + ssize_t res = 0; + DWORD ret = 0, wret; + int evt_mask = FD_READ | ((wsamsg->dwFlags & MSG_OOB) ? FD_OOB : 0); + LPWSABUF &wsabuf = wsamsg->lpBuffers; + ULONG &wsacnt = wsamsg->dwBufferCount; + static NO_COPY LPFN_WSARECVMSG WSARecvMsg; + int orig_namelen = wsamsg->namelen; + + /* CV 2014-10-26: Do not check for the connect_state at this point. In + certain scenarios there's no way to check the connect state reliably. + Example (hexchat): Parent process creates socket, forks, child process + calls connect, parent process calls read. Even if the event handling + allows to check for FD_CONNECT in the parent, there is always yet another + scenario we can easily break. */ + + DWORD wait_flags = wsamsg->dwFlags; + bool waitall = !!(wait_flags & MSG_WAITALL); + wsamsg->dwFlags &= (MSG_OOB | MSG_PEEK | MSG_DONTROUTE); + if (use_recvmsg) + { + if (!WSARecvMsg + && get_ext_funcptr (get_socket (), &WSARecvMsg) == SOCKET_ERROR) + { + if (wsamsg->Control.len > 0) + { + set_winsock_errno (); + return SOCKET_ERROR; + } + use_recvmsg = false; + } + else /* Only MSG_PEEK is supported by WSARecvMsg. */ + wsamsg->dwFlags &= MSG_PEEK; + } + if (waitall) + { + if (get_socket_type () != SOCK_STREAM) + { + WSASetLastError (WSAEOPNOTSUPP); + set_winsock_errno (); + return SOCKET_ERROR; + } + if (is_nonblocking () || (wsamsg->dwFlags & (MSG_OOB | MSG_PEEK))) + waitall = false; + } + + /* Note: Don't call WSARecvFrom(MSG_PEEK) without actually having data + waiting in the buffers, otherwise the event handling gets messed up + for some reason. */ + while (!(res = wait_for_events (evt_mask | FD_CLOSE, wait_flags)) + || saw_shutdown_read ()) + { + if (use_recvmsg) + res = WSARecvMsg (get_socket (), wsamsg, &wret, NULL, NULL); + /* This is working around a really weird problem in WinSock. + + Assume you create a socket, fork the process (thus duplicating + the socket), connect the socket in the child, then call recv + on the original socket handle in the parent process. + In this scenario, calls to WinSock's recvfrom and WSARecvFrom + in the parent will fail with WSAEINVAL, regardless whether both + address parameters, name and namelen, are NULL or point to valid + storage. However, calls to recv and WSARecv succeed as expected. + Per MSDN, WSAEINVAL in the context of recv means "The socket has not + been bound". It is as if the recvfrom functions test if the socket + is bound locally, but in the parent process, WinSock doesn't know + about that and fails, while the same test is omitted in the recv + functions. + + This also covers another weird case: WinSock returns WSAEFAULT if + namelen is a valid pointer while name is NULL. Both parameters are + ignored for TCP sockets, so this only occurs when using UDP socket. */ + else if (!wsamsg->name || get_socket_type () == SOCK_STREAM) + res = WSARecv (get_socket (), wsabuf, wsacnt, &wret, &wsamsg->dwFlags, + NULL, NULL); + else + res = WSARecvFrom (get_socket (), wsabuf, wsacnt, &wret, + &wsamsg->dwFlags, wsamsg->name, &wsamsg->namelen, + NULL, NULL); + if (!res) + { + ret += wret; + if (!waitall) + break; + while (wret && wsacnt) + { + if (wsabuf->len > wret) + { + wsabuf->len -= wret; + wsabuf->buf += wret; + wret = 0; + } + else + { + wret -= wsabuf->len; + ++wsabuf; + --wsacnt; + } + } + if (!wret) + break; + } + else if (WSAGetLastError () != WSAEWOULDBLOCK) + break; + } + + if (res) + { + /* According to SUSv3, errno isn't set in that case and no error + condition is returned. */ + if (WSAGetLastError () == WSAEMSGSIZE) + ret += wret; + else if (!ret) + { + /* ESHUTDOWN isn't defined for recv in SUSv3. Simply EOF is returned + in this case. */ + if (WSAGetLastError () == WSAESHUTDOWN) + ret = 0; + else + { + set_winsock_errno (); + return SOCKET_ERROR; + } + } + } + + if (wsamsg->name != NULL && orig_namelen >= (int) sizeof (sa_family_t)) + { + /* WSARecvFrom copied the sockaddr_in block to wsamsg->name. We have to + overwrite it with a sockaddr_un block. For datagram sockets we + generate a sockaddr_un with a filename analogue to abstract socket + names under Linux. See `man 7 unix' under Linux for a description. */ + sockaddr_un *un = (sockaddr_un *) wsamsg->name; + un->sun_family = AF_LOCAL; + int len = orig_namelen - offsetof (struct sockaddr_un, sun_path); + if (len > 0) + { + if (get_socket_type () == SOCK_DGRAM) + { + if (len >= 7) + { + __small_sprintf (un->sun_path + 1, "d%04x", + ((struct sockaddr_in *) wsamsg->name)->sin_port); + wsamsg->namelen = offsetof (struct sockaddr_un, sun_path) + 7; + } + else + wsamsg->namelen = offsetof (struct sockaddr_un, sun_path) + 1; + un->sun_path[0] = '\0'; + } + else if (!get_peer_sun_path ()) + wsamsg->namelen = sizeof (sa_family_t); + else + { + memset (un->sun_path, 0, len); + strncpy (un->sun_path, get_peer_sun_path (), len); + if (un->sun_path[len - 1] == '\0') + len = strlen (un->sun_path) + 1; + if (len > UNIX_PATH_MAX) + len = UNIX_PATH_MAX; + wsamsg->namelen = offsetof (struct sockaddr_un, sun_path) + len; + } + } + } + + return ret; +} + +ssize_t +fhandler_socket_local::recvfrom (void *in_ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen) +{ + char *ptr = (char *) in_ptr; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, + wsabuf, bufcnt, + { 0, NULL }, + (DWORD) flags }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, + &wsabuf, 1, + { 0, NULL}, + (DWORD) flags }; +#endif + ssize_t ret = recv_internal (&wsamsg, false); + if (fromlen) + *fromlen = wsamsg.namelen; + return ret; +} + +ssize_t +fhandler_socket_local::recvmsg (struct msghdr *msg, int flags) +{ + /* TODO: Descriptor passing on AF_LOCAL sockets. */ + + /* Disappointing but true: Even if WSARecvMsg is supported, it's only + supported for datagram and raw sockets. */ + bool use_recvmsg = true; + if (get_socket_type () == SOCK_STREAM || get_addr_family () == AF_LOCAL) + { + use_recvmsg = false; + msg->msg_controllen = 0; + } + + WSABUF wsabuf[msg->msg_iovlen]; + WSABUF *wsaptr = wsabuf + msg->msg_iovlen; + const struct iovec *iovptr = msg->msg_iov + msg->msg_iovlen; + while (--wsaptr >= wsabuf) + { + wsaptr->len = (--iovptr)->iov_len; + wsaptr->buf = (char *) iovptr->iov_base; + } + WSAMSG wsamsg = { (struct sockaddr *) msg->msg_name, msg->msg_namelen, + wsabuf, (DWORD) msg->msg_iovlen, + { (DWORD) msg->msg_controllen, (char *) msg->msg_control }, + (DWORD) flags }; + ssize_t ret = recv_internal (&wsamsg, use_recvmsg); + if (ret >= 0) + { + msg->msg_namelen = wsamsg.namelen; + msg->msg_controllen = wsamsg.Control.len; + if (!CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR) + msg->msg_flags = wsamsg.dwFlags; + } + return ret; +} + +void __reg3 +fhandler_socket_local::read (void *in_ptr, size_t& len) +{ + char *ptr = (char *) in_ptr; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; +#endif + + len = recv_internal (&wsamsg, false); +} + +ssize_t +fhandler_socket_local::readv (const struct iovec *const iov, const int iovcnt, + ssize_t tot) +{ + WSABUF wsabuf[iovcnt]; + WSABUF *wsaptr = wsabuf + iovcnt; + const struct iovec *iovptr = iov + iovcnt; + while (--wsaptr >= wsabuf) + { + wsaptr->len = (--iovptr)->iov_len; + wsaptr->buf = (char *) iovptr->iov_base; + } + WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; + return recv_internal (&wsamsg, false); +} + +inline ssize_t +fhandler_socket_local::send_internal (struct _WSAMSG *wsamsg, int flags) +{ + ssize_t res = 0; + DWORD ret = 0, sum = 0; + WSABUF out_buf[wsamsg->dwBufferCount]; + bool use_sendmsg = false; + DWORD wait_flags = flags & MSG_DONTWAIT; + bool nosignal = !!(flags & MSG_NOSIGNAL); + + flags &= (MSG_OOB | MSG_DONTROUTE); + if (wsamsg->Control.len > 0) + use_sendmsg = true; + /* Workaround for MSDN KB 823764: Split a message into chunks <= SO_SNDBUF. + in_idx is the index of the current lpBuffers from the input wsamsg buffer. + in_off is used to keep track of the next byte to write from a wsamsg + buffer which only gets partially written. */ + for (DWORD in_idx = 0, in_off = 0; + in_idx < wsamsg->dwBufferCount; + in_off >= wsamsg->lpBuffers[in_idx].len && (++in_idx, in_off = 0)) + { + /* Split a message into the least number of pieces to minimize the + number of WsaSendTo calls. Don't split datagram messages (bad idea). + out_idx is the index of the next buffer in the out_buf WSABUF, + also the number of buffers given to WSASendTo. + out_len is the number of bytes in the buffers given to WSASendTo. + Don't split datagram messages (very bad idea). */ + DWORD out_idx = 0; + DWORD out_len = 0; + if (get_socket_type () == SOCK_STREAM) + { + do + { + out_buf[out_idx].buf = wsamsg->lpBuffers[in_idx].buf + in_off; + out_buf[out_idx].len = wsamsg->lpBuffers[in_idx].len - in_off; + out_len += out_buf[out_idx].len; + out_idx++; + } + while (out_len < (unsigned) wmem () + && (in_off = 0, ++in_idx < wsamsg->dwBufferCount)); + /* Tweak len of the last out_buf buffer so the entire number of bytes + is (less than or) equal to wmem (). Fix out_len as well since it's + used in a subsequent test expression. */ + if (out_len > (unsigned) wmem ()) + { + out_buf[out_idx - 1].len -= out_len - (unsigned) wmem (); + out_len = (unsigned) wmem (); + } + /* Add the bytes written from the current last buffer to in_off, + so in_off points to the next byte to be written from that buffer, + or beyond which lets the outper loop skip to the next buffer. */ + in_off += out_buf[out_idx - 1].len; + } + + do + { + if (use_sendmsg) + res = WSASendMsg (get_socket (), wsamsg, flags, &ret, NULL, NULL); + else if (get_socket_type () == SOCK_STREAM) + res = WSASendTo (get_socket (), out_buf, out_idx, &ret, flags, + wsamsg->name, wsamsg->namelen, NULL, NULL); + else + res = WSASendTo (get_socket (), wsamsg->lpBuffers, + wsamsg->dwBufferCount, &ret, flags, + wsamsg->name, wsamsg->namelen, NULL, NULL); + if (res && (WSAGetLastError () == WSAEWOULDBLOCK)) + { + LOCK_EVENTS; + wsock_events->events &= ~FD_WRITE; + UNLOCK_EVENTS; + } + } + while (res && (WSAGetLastError () == WSAEWOULDBLOCK) + && !(res = wait_for_events (FD_WRITE | FD_CLOSE, wait_flags))); + + if (!res) + { + sum += ret; + /* For streams, return to application if the number of bytes written + is less than the number of bytes we intended to write in a single + call to WSASendTo. Otherwise we would have to add code to + backtrack in the input buffers, which is questionable. There was + probably a good reason we couldn't write more. */ + if (get_socket_type () != SOCK_STREAM || ret < out_len) + break; + } + else if (is_nonblocking () || WSAGetLastError() != WSAEWOULDBLOCK) + break; + } + + if (sum) + res = sum; + else if (res == SOCKET_ERROR) + { + set_winsock_errno (); + + /* Special handling for EPIPE and SIGPIPE. + + EPIPE is generated if the local end has been shut down on a connection + oriented socket. In this case the process will also receive a SIGPIPE + unless MSG_NOSIGNAL is set. */ + if ((get_errno () == ECONNABORTED || get_errno () == ESHUTDOWN) + && get_socket_type () == SOCK_STREAM) + { + set_errno (EPIPE); + if (!nosignal) + raise (SIGPIPE); + } + } + + return res; +} + +ssize_t +fhandler_socket_local::sendto (const void *in_ptr, size_t len, int flags, + const struct sockaddr *to, int tolen) +{ + char *ptr = (char *) in_ptr; + struct sockaddr_storage sst; + + if (to && get_inet_addr_local (to, tolen, &sst, &tolen) == SOCKET_ERROR) + return SOCKET_ERROR; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen, + wsabuf, bufcnt, + { 0, NULL }, + 0 }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { to ? (struct sockaddr *) &sst : NULL, tolen, + &wsabuf, 1, + { 0, NULL}, + 0 }; +#endif + return send_internal (&wsamsg, flags); +} + +ssize_t +fhandler_socket_local::sendmsg (const struct msghdr *msg, int flags) +{ + /* TODO: Descriptor passing on AF_LOCAL sockets. */ + + struct sockaddr_storage sst; + int len = 0; + + if (msg->msg_name + && get_inet_addr_local ((struct sockaddr *) msg->msg_name, + msg->msg_namelen, &sst, &len) == SOCKET_ERROR) + return SOCKET_ERROR; + + WSABUF wsabuf[msg->msg_iovlen]; + WSABUF *wsaptr = wsabuf; + const struct iovec *iovptr = msg->msg_iov; + for (int i = 0; i < msg->msg_iovlen; ++i) + { + wsaptr->len = iovptr->iov_len; + (wsaptr++)->buf = (char *) (iovptr++)->iov_base; + } + /* Disappointing but true: Even if WSASendMsg is supported, it's only + supported for datagram and raw sockets. */ + DWORD controllen = (DWORD) (get_socket_type () == SOCK_STREAM + || get_addr_family () == AF_LOCAL + ? 0 : msg->msg_controllen); + WSAMSG wsamsg = { msg->msg_name ? (struct sockaddr *) &sst : NULL, len, + wsabuf, (DWORD) msg->msg_iovlen, + { controllen, (char *) msg->msg_control }, + 0 }; + return send_internal (&wsamsg, flags); +} + +ssize_t +fhandler_socket_local::write (const void *in_ptr, size_t len) +{ + char *ptr = (char *) in_ptr; + +#ifdef __x86_64__ + /* size_t is 64 bit, but the len member in WSABUF is 32 bit. + Split buffer if necessary. */ + DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); + WSABUF wsabuf[bufcnt]; + WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; + /* Don't use len as loop condition, it could be 0. */ + for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) + { + wsaptr->len = MIN (len, UINT32_MAX); + wsaptr->buf = ptr; + len -= wsaptr->len; + ptr += wsaptr->len; + } +#else + WSABUF wsabuf = { len, ptr }; + WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; +#endif + return send_internal (&wsamsg, 0); +} + +ssize_t +fhandler_socket_local::writev (const struct iovec *const iov, const int iovcnt, + ssize_t tot) +{ + WSABUF wsabuf[iovcnt]; + WSABUF *wsaptr = wsabuf; + const struct iovec *iovptr = iov; + for (int i = 0; i < iovcnt; ++i) + { + wsaptr->len = iovptr->iov_len; + (wsaptr++)->buf = (char *) (iovptr++)->iov_base; + } + WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; + return send_internal (&wsamsg, 0); +} + +void +fhandler_socket_local::set_sun_path (const char *path) +{ + sun_path = path ? cstrdup (path) : NULL; +} + +void +fhandler_socket_local::set_peer_sun_path (const char *path) +{ + peer_sun_path = path ? cstrdup (path) : NULL; +} + +int +fhandler_socket_local::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) +{ + if (get_socket_type () != SOCK_STREAM) + { + set_errno (EINVAL); + return -1; + } + if (no_getpeereid ()) + { + set_errno (ENOTSUP); + return -1; + } + if (connect_state () != connected) + { + set_errno (ENOTCONN); + return -1; + } + + __try + { + if (pid) + *pid = sec_peer_pid; + if (euid) + *euid = sec_peer_uid; + if (egid) + *egid = sec_peer_gid; + return 0; + } + __except (EFAULT) {} + __endtry + return -1; +} + +int +fhandler_socket_local::setsockopt (int level, int optname, const void *optval, + socklen_t optlen) +{ + int ret = -1; + + /* Preprocessing setsockopt. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + /* Switch off the AF_LOCAL handshake and thus SO_PEERCRED handling + for AF_LOCAL/SOCK_STREAM sockets. This allows to handle special + situations in which connect is called before a listening socket + accepts connections. + FIXME: In the long run we should find a more generic solution + which doesn't require a blocking handshake in accept/connect + to exchange SO_PEERCRED credentials. */ + if (optval || optlen) + set_errno (EINVAL); + else + ret = af_local_set_no_getpeereid (); + return ret; + + case SO_REUSEADDR: + saw_reuseaddr (*(int *) optval); + return 0; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + if (optlen < (socklen_t) sizeof (struct timeval)) + { + set_errno (EINVAL); + return ret; + } + if (timeval_to_ms ((struct timeval *) optval, + (optname == SO_RCVTIMEO) ? rcvtimeo () + : sndtimeo ())) + return 0; + set_errno (EDOM); + return -1; + + case SO_DEBUG: + case SO_RCVBUF: + case SO_RCVLOWAT: + case SO_SNDBUF: + case SO_SNDLOWAT: + break; + + default: + /* AF_LOCAL sockets simply ignore all other SOL_SOCKET options. */ + return 0; + } + break; + + default: + set_errno (ENOPROTOOPT); + return -1; + } + + /* Call Winsock setsockopt */ + ret = ::setsockopt (get_socket (), level, optname, (const char *) optval, + optlen); + if (ret == SOCKET_ERROR) + { + set_winsock_errno (); + return ret; + } + + if (optlen == (socklen_t) sizeof (int)) + debug_printf ("setsockopt optval=%x", *(int *) optval); + + /* Postprocessing setsockopt, setting fhandler_socket members, etc. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_RCVBUF: + rmem (*(int *) optval); + break; + + case SO_SNDBUF: + wmem (*(int *) optval); + break; + + default: + break; + } + break; + + default: + break; + } + + return ret; +} + +int +fhandler_socket_local::getsockopt (int level, int optname, const void *optval, + socklen_t *optlen) +{ + int ret = -1; + + /* Preprocessing getsockopt.*/ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PEERCRED: + { + struct ucred *cred = (struct ucred *) optval; + + if (*optlen < (socklen_t) sizeof *cred) + { + set_errno (EINVAL); + return ret; + } + ret = getpeereid (&cred->pid, &cred->uid, &cred->gid); + if (!ret) + *optlen = (socklen_t) sizeof *cred; + return ret; + } + + case SO_REUSEADDR: + { + unsigned int *reuseaddr = (unsigned int *) optval; + + if (*optlen < (socklen_t) sizeof *reuseaddr) + { + set_errno (EINVAL); + return -1; + } + *reuseaddr = saw_reuseaddr(); + *optlen = (socklen_t) sizeof *reuseaddr; + return 0; + } + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + struct timeval *time_out = (struct timeval *) optval; + + if (*optlen < (socklen_t) sizeof *time_out) + { + set_errno (EINVAL); + return ret; + } + DWORD ms = (optname == SO_RCVTIMEO) ? rcvtimeo () : sndtimeo (); + if (ms == 0 || ms == INFINITE) + { + time_out->tv_sec = 0; + time_out->tv_usec = 0; + } + else + { + time_out->tv_sec = ms / MSPERSEC; + time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; + } + *optlen = (socklen_t) sizeof *time_out; + return 0; + } + + case SO_TYPE: + { + unsigned int *type = (unsigned int *) optval; + *type = get_socket_type (); + *optlen = (socklen_t) sizeof *type; + return 0; + } + + case SO_ACCEPTCONN: + case SO_DEBUG: + case SO_ERROR: + case SO_RCVBUF: + case SO_RCVLOWAT: + case SO_SNDBUF: + case SO_SNDLOWAT: + break; + + /* AF_LOCAL sockets simply ignore all other SOL_SOCKET options. */ + + case SO_LINGER: + { + struct linger *linger = (struct linger *) optval; + memset (linger, 0, sizeof *linger); + *optlen = (socklen_t) sizeof *linger; + return 0; + } + + default: + { + unsigned int *val = (unsigned int *) optval; + *val = 0; + *optlen = (socklen_t) sizeof *val; + return 0; + } + } + break; + + default: + set_errno (ENOPROTOOPT); + return -1; + } + + /* Call Winsock getsockopt */ + ret = ::getsockopt (get_socket (), level, optname, (char *) optval, + (int *) optlen); + if (ret == SOCKET_ERROR) + { + set_winsock_errno (); + return ret; + } + + /* Postprocessing getsockopt, setting fhandler_socket members, etc. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_ERROR: + { + int *e = (int *) optval; + debug_printf ("WinSock SO_ERROR = %d", *e); + *e = find_winsock_errno (*e); + } + break; + + default: + break; + } + break; + default: + break; + } + + return ret; +} diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 0d853327e..e849b04cc 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -500,146 +500,6 @@ cygwin_getprotobynumber (int number) return dup_ent (getprotobynumber (number)); } -#ifndef SIO_BASE_HANDLE -#define SIO_BASE_HANDLE _WSAIOR(IOC_WS2,34) -#endif - -bool -fdsock (cygheap_fdmanip& fd, const device *dev, SOCKET soc) -{ - fd = build_fh_dev (*dev); - if (!fd.isopen ()) - return false; - - /* Usually sockets are inheritable IFS objects. Unfortunately some virus - scanners or other network-oriented software replace normal sockets - with their own kind, which is running through a filter driver called - "layered service provider" (LSP). - - LSP sockets are not kernel objects. They are typically not marked as - inheritable, nor are they IFS handles. They are in fact not inheritable - to child processes, and it does not help to mark them inheritable via - SetHandleInformation. Subsequent socket calls in the child process fail - with error 10038, WSAENOTSOCK. - - There's a neat way to workaround these annoying LSP sockets. WSAIoctl - allows to fetch the underlying base socket, which is a normal, inheritable - IFS handle. So we fetch the base socket, duplicate it, and close the - original socket. Now we have a standard IFS socket which (hopefully) - works as expected. - - If that doesn't work for some reason, mark the sockets for duplication - via WSADuplicateSocket/WSASocket. This requires to start the child - process in SUSPENDED state so we only do this if really necessary. */ - DWORD flags; - bool fixup = false; - if (!GetHandleInformation ((HANDLE) soc, &flags) - || !(flags & HANDLE_FLAG_INHERIT)) - { - int ret; - SOCKET base_soc; - DWORD bret; - - fixup = true; - debug_printf ("LSP handle: %p", soc); - ret = WSAIoctl (soc, SIO_BASE_HANDLE, NULL, 0, (void *) &base_soc, - sizeof (base_soc), &bret, NULL, NULL); - if (ret) - debug_printf ("WSAIoctl: %u", WSAGetLastError ()); - else if (base_soc != soc) - { - if (GetHandleInformation ((HANDLE) base_soc, &flags) - && (flags & HANDLE_FLAG_INHERIT)) - { - if (!DuplicateHandle (GetCurrentProcess (), (HANDLE) base_soc, - GetCurrentProcess (), (PHANDLE) &base_soc, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - debug_printf ("DuplicateHandle failed, %E"); - else - { - closesocket (soc); - soc = base_soc; - fixup = false; - } - } - } - } - fd->set_io_handle ((HANDLE) soc); - if (!((fhandler_socket *) fd)->init_events ()) - return false; - if (fixup) - ((fhandler_socket *) fd)->init_fixup_before (); - fd->set_flags (O_RDWR | O_BINARY); - debug_printf ("fd %d, name '%s', soc %p", (int) fd, dev->name (), soc); - - /* Raise default buffer sizes (instead of WinSock default 8K). - - 64K appear to have the best size/performance ratio for a default - value. Tested with ssh/scp on Vista over Gigabit LAN. - - NOTE. If the SO_RCVBUF size exceeds 65535(*), and if the socket is - connected to a remote machine, then calling WSADuplicateSocket on - fork/exec fails with WinSock error 10022, WSAEINVAL. Fortunately - we don't use WSADuplicateSocket anymore, rather we just utilize - handle inheritance. An explanation for this weird behaviour would - be nice, though. - - NOTE 2. Testing on x86_64 (Vista, 2008 R2, W8) indicates that - this is no problem on 64 bit. So we set the default buffer size to - the default values in current 3.x Linux versions. - - NOTE 3. Setting the window size to 65535 results in extremely bad - performance for apps that send data in multiples of Kb, as they - eventually end up sending 1 byte on the network and naggle + delay - ack kicks in. For example, iperf on a 10Gb network gives only 10 - Mbits/sec with a 65535 send buffer. We want this to be a multiple - of 1k, but since 64k breaks WSADuplicateSocket we use 63Kb. - - NOTE 4. Tests with iperf uncover a problem in setting the SO_RCVBUF - and SO_SNDBUF sizes. Windows is using autotuning since Windows Vista. - Manually setting SO_RCVBUF/SO_SNDBUF disables autotuning and leads to - inferior send/recv performance in scenarios with larger RTTs, as is - basically standard when accessing the internet. For a discussion, - see https://cygwin.com/ml/cygwin-patches/2017-q1/msg00010.html. - - (*) Maximum normal TCP window size. Coincidence? */ -#ifdef __x86_64__ - ((fhandler_socket *) fd)->rmem () = 212992; - ((fhandler_socket *) fd)->wmem () = 212992; -#else - ((fhandler_socket *) fd)->rmem () = 64512; - ((fhandler_socket *) fd)->wmem () = 64512; -#endif -#if 0 /* See NOTE 4 above. */ - int size; - - if (::setsockopt (soc, SOL_SOCKET, SO_RCVBUF, - (char *) &((fhandler_socket *) fd)->rmem (), sizeof (int))) - { - debug_printf ("setsockopt(SO_RCVBUF) failed, %u", WSAGetLastError ()); - if (::getsockopt (soc, SOL_SOCKET, SO_RCVBUF, - (char *) &((fhandler_socket *) fd)->rmem (), - (size = sizeof (int), &size))) - system_printf ("getsockopt(SO_RCVBUF) failed, %u", WSAGetLastError ()); - } - if (::setsockopt (soc, SOL_SOCKET, SO_SNDBUF, - (char *) &((fhandler_socket *) fd)->wmem (), sizeof (int))) - { - debug_printf ("setsockopt(SO_SNDBUF) failed, %u", WSAGetLastError ()); - if (::getsockopt (soc, SOL_SOCKET, SO_SNDBUF, - (char *) &((fhandler_socket *) fd)->wmem (), - (size = sizeof (int), &size))) - system_printf ("getsockopt(SO_SNDBUF) failed, %u", WSAGetLastError ()); - } -#endif - /* A unique ID is necessary to recognize fhandler entries which are - duplicated by dup(2) or fork(2). This is used in BSD flock calls - to identify the descriptor. */ - ((fhandler_socket *) fd)->set_unique_id (); - - return true; -} - /* exported as socket: POSIX.1-2001, POSIX.1-2008, 4.4BSD */ extern "C" int cygwin_socket (int af, int type, int protocol) diff --git a/winsup/cygwin/security.h b/winsup/cygwin/security.h index 3faa99c23..2f9d0ad4d 100644 --- a/winsup/cygwin/security.h +++ b/winsup/cygwin/security.h @@ -17,6 +17,7 @@ details. */ /* UID/GID */ void uinfo_init (); +bool check_token_membership (PSID); #define ILLEGAL_UID ((uid_t)-1) #define ILLEGAL_GID ((gid_t)-1) diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index 81717c645..7ea00d7c3 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -185,17 +185,12 @@ static enum { static int syslogd_sock = -1; extern "C" int cygwin_socket (int, int, int); extern "C" int cygwin_connect (int, const struct sockaddr *, int); -extern int get_inet_addr (const struct sockaddr *, int, - struct sockaddr_storage *, int *, - int * = NULL, int * = NULL); static void connect_syslogd () { int fd; struct sockaddr_un sun; - struct sockaddr_storage sst; - int len, type; if (syslogd_inited != not_inited && syslogd_sock >= 0) close (syslogd_sock); @@ -203,20 +198,38 @@ connect_syslogd () syslogd_sock = -1; sun.sun_family = AF_LOCAL; strncpy (sun.sun_path, _PATH_LOG, sizeof sun.sun_path); - if (get_inet_addr ((struct sockaddr *) &sun, sizeof sun, &sst, &len, &type)) - return; - if ((fd = cygwin_socket (AF_LOCAL, type, 0)) < 0) + if ((fd = cygwin_socket (AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0)) < 0) return; if (cygwin_connect (fd, (struct sockaddr *) &sun, sizeof sun) == 0) + syslogd_inited = inited_stream; + else { - /* connect on a dgram socket always succeeds. We still don't know - if syslogd is actually listening. */ - if (type == SOCK_DGRAM) + close (fd); + if ((fd = cygwin_socket (AF_LOCAL, SOCK_DGRAM | SOCK_CLOEXEC, 0)) < 0) + return; + if (cygwin_connect (fd, (struct sockaddr *) &sun, sizeof sun) == 0) { + /* + * FIXME + * + * As soon as AF_LOCAL sockets are using pipes, this code has to + * got away. + */ + + /* connect on a dgram socket always succeeds. We still don't know + if syslogd is actually listening. */ + cygheap_fdget cfd (fd); + fhandler_socket_local *const fh = (fhandler_socket_local *) + cfd->is_socket (); tmp_pathbuf tp; PMIB_UDPTABLE tab = (PMIB_UDPTABLE) tp.w_get (); DWORD size = 65536; bool found = false; + struct sockaddr_storage sst; + int len; + + len = sizeof sst; + ::getsockname (fh->get_socket (), (struct sockaddr *) &sst, &len); struct sockaddr_in *sa = (struct sockaddr_in *) &sst; if (GetUdpTable (tab, &size, FALSE) == NO_ERROR) @@ -235,11 +248,12 @@ connect_syslogd () return; } } + syslogd_inited = inited_dgram; } - syslogd_inited = type == SOCK_DGRAM ? inited_dgram : inited_stream; + else + close (fd); } syslogd_sock = fd; - fcntl64 (syslogd_sock, F_SETFD, FD_CLOEXEC); debug_printf ("found /dev/log, fd = %d, type = %s", fd, syslogd_inited == inited_stream ? "STREAM" : "DGRAM"); return; diff --git a/winsup/cygwin/uinfo.cc b/winsup/cygwin/uinfo.cc index 286105057..c7aedfe10 100644 --- a/winsup/cygwin/uinfo.cc +++ b/winsup/cygwin/uinfo.cc @@ -117,7 +117,7 @@ cygheap_user::init () This needs careful checking should we use check_token_membership in other circumstances. */ -static bool +bool check_token_membership (PSID sid) { NTSTATUS status; @@ -142,7 +142,7 @@ check_token_membership (PSID sid) return false; } -void +static void internal_getlogin (cygheap_user &user) { struct passwd *pwd; From 8906a4d33504561cbdbb56187d04eeaa83476b21 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 21 Feb 2018 21:43:44 +0100 Subject: [PATCH 274/649] Cygwin: fix whitespaces in socket code Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_inet.cc | 10 +++++----- winsup/cygwin/fhandler_socket_local.cc | 2 +- winsup/cygwin/syslog.cc | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index 91da47cd1..a161050e4 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -203,7 +203,7 @@ fhandler_socket_inet::connect (const struct sockaddr *name, int namelen) if (res) { DWORD err = WSAGetLastError (); - + /* Some applications use the ugly technique to check if a non-blocking connect succeeded by calling connect again, until it returns EISCONN. This circumvents the event handling and connect_state is never set. @@ -215,13 +215,13 @@ fhandler_socket_inet::connect (const struct sockaddr *name, int namelen) else if (is_nonblocking () && err == WSAEWOULDBLOCK) WSASetLastError (WSAEINPROGRESS); /* Winsock returns WSAEINVAL if the socket is already a listener. - Convert to POSIX/Linux compliant EISCONN. */ + Convert to POSIX/Linux compliant EISCONN. */ else if (err == WSAEINVAL && connect_state () == listener) WSASetLastError (WSAEISCONN); /* Any other error except WSAEALREADY during connect_pending means the connect failed. */ else if (connect_state () == connect_pending && err != WSAEALREADY) - connect_state (connect_failed); + connect_state (connect_failed); set_winsock_errno (); } @@ -631,7 +631,7 @@ fhandler_socket_inet::read (void *in_ptr, size_t& len) WSABUF wsabuf = { len, ptr }; WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; #endif - + len = recv_internal (&wsamsg, false); } @@ -1132,7 +1132,7 @@ fhandler_socket_inet::getsockopt (int level, int optname, const void *optval, break; } break; - case IPPROTO_TCP: + case IPPROTO_TCP: switch (optname) { case TCP_NODELAY: diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index 3d48a8159..ca1fe5e3c 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -1310,7 +1310,7 @@ fhandler_socket_local::read (void *in_ptr, size_t& len) WSABUF wsabuf = { len, ptr }; WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; #endif - + len = recv_internal (&wsamsg, false); } diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index 7ea00d7c3..2f4e5e8c0 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -251,7 +251,7 @@ connect_syslogd () syslogd_inited = inited_dgram; } else - close (fd); + close (fd); } syslogd_sock = fd; debug_printf ("found /dev/log, fd = %d, type = %s", From a5dfbc69407d5a60f5b0c4d92ada6d022f23bee1 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 21 Feb 2018 22:00:04 +0100 Subject: [PATCH 275/649] Cygwin: inline get_socket_flags() Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 13 +++++++++++-- winsup/cygwin/fhandler_socket.cc | 11 ----------- winsup/cygwin/include/cygwin/_socketflags.h | 20 ++++++++++++++++++++ winsup/cygwin/include/cygwin/socket.h | 9 ++------- 4 files changed, 33 insertions(+), 20 deletions(-) create mode 100644 winsup/cygwin/include/cygwin/_socketflags.h diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index d912e1cb7..c50667ca9 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -10,6 +10,8 @@ details. */ #include "pinfo.h" #include "tty.h" +#include + /* fcntl flags used only internaly. */ #define O_NOSYMLINK 0x080000 #define O_DIROPEN 0x100000 @@ -488,8 +490,15 @@ class fhandler_socket: public fhandler_base int addr_family; int type; virtual int af_local_connect () = 0; - int get_socket_flags (); - + inline int get_socket_flags () + { + int ret = 0; + if (is_nonblocking ()) + ret |= SOCK_NONBLOCK; + if (close_on_exec ()) + ret |= SOCK_CLOEXEC; + return ret; + } wsa_event *wsock_events; HANDLE wsock_mtx; HANDLE wsock_evt; diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 371cc398c..aafc09c43 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -720,17 +720,6 @@ fhandler_socket::link (const char *newpath) return fhandler_base::link (newpath); } -int -fhandler_socket::get_socket_flags () -{ - int ret = 0; - if (is_nonblocking ()) - ret |= SOCK_NONBLOCK; - if (close_on_exec ()) - ret |= SOCK_CLOEXEC; - return ret; -} - int fhandler_socket::shutdown (int how) { diff --git a/winsup/cygwin/include/cygwin/_socketflags.h b/winsup/cygwin/include/cygwin/_socketflags.h new file mode 100644 index 000000000..07a5e8b22 --- /dev/null +++ b/winsup/cygwin/include/cygwin/_socketflags.h @@ -0,0 +1,20 @@ +/* cygwin/_socketflags.h + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _CYGWIN__SOCKETFLAGS_H +#define _CYGWIN__SOCKETFLAGS_H + +/* GNU extension flags. Or them to the type parameter in calls to + socket(2) to mark socket as nonblocking and/or close-on-exec. */ +#define SOCK_NONBLOCK 0x01000000 +#define SOCK_CLOEXEC 0x02000000 +#ifdef __INSIDE_CYGWIN__ +#define _SOCK_FLAG_MASK 0xff000000 /* Bits left for more extensions */ +#endif + +#endif /* _CYGWIN__SOCKETFLAGS_H */ diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index 87cee0747..b1ab5c28c 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -130,13 +130,8 @@ struct OLD_msghdr #define SOCK_RDM 4 /* reliably-delivered message */ #define SOCK_SEQPACKET 5 /* sequential packet socket */ -/* GNU extension flags. Or them to the type parameter in calls to - socket(2) to mark socket as nonblocking and/or close-on-exec. */ -#define SOCK_NONBLOCK 0x01000000 -#define SOCK_CLOEXEC 0x02000000 -#ifdef __INSIDE_CYGWIN__ -#define _SOCK_FLAG_MASK 0xff000000 /* Bits left for more extensions */ -#endif +/* defines SOCK_NONBLOCK / SOCK_CLOEXEC */ +#include /* Supported address families. */ /* From a3b5795b06e0fb37b60aa8ba2d6ecf464feacb02 Mon Sep 17 00:00:00 2001 From: David Macek Date: Wed, 21 Feb 2018 18:09:47 +0100 Subject: [PATCH 276/649] doc/ntsec.xml: Fix typo --- winsup/doc/ntsec.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/doc/ntsec.xml b/winsup/doc/ntsec.xml index df1d54930..03293591b 100644 --- a/winsup/doc/ntsec.xml +++ b/winsup/doc/ntsec.xml @@ -914,7 +914,7 @@ This is not valid: -Apart from this restriction, the reminder of the line can have as +Apart from this restriction, the remainder of the line can have as many spaces and TABs as you like. From 84c5e0fd3dd263e1e59076e88e65998865d1d9cd Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2018 16:25:28 +0100 Subject: [PATCH 277/649] Cygwin: make socketpair an AF_LOCAL-only method Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 6 +----- winsup/cygwin/fhandler_socket_inet.cc | 10 ---------- winsup/cygwin/fhandler_socket_local.cc | 3 +-- winsup/cygwin/net.cc | 18 +++--------------- 4 files changed, 5 insertions(+), 32 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index c50667ca9..4b1d8ddaf 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -574,8 +574,6 @@ class fhandler_socket: public fhandler_base IMPLEMENT_STATUS_FLAG (bool, no_getpeereid) virtual int socket (int af, int type, int protocol, int flags) = 0; - virtual int socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out) = 0; virtual int bind (const struct sockaddr *name, int namelen) = 0; virtual int listen (int backlog) = 0; virtual int accept4 (struct sockaddr *peer, int *len, int flags) = 0; @@ -650,8 +648,6 @@ class fhandler_socket_inet: public fhandler_socket ~fhandler_socket_inet (); int socket (int af, int type, int protocol, int flags); - int socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out); int bind (const struct sockaddr *name, int namelen); int listen (int backlog); int accept4 (struct sockaddr *peer, int *len, int flags); @@ -736,7 +732,7 @@ class fhandler_socket_local: public fhandler_socket int socket (int af, int type, int protocol, int flags); int socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out); + fhandler_socket_local *fh_out); int bind (const struct sockaddr *name, int namelen); int listen (int backlog); int accept4 (struct sockaddr *peer, int *len, int flags); diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index a161050e4..06091973f 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -136,16 +136,6 @@ fhandler_socket_inet::socket (int af, int type, int protocol, int flags) return ret; } -/* socketpair is called on the fhandler handling the accepting socket, - fh_out is the fhandler for the connecting socket. */ -int -fhandler_socket_inet::socketpair (int af, int type, int protocol, int flags, - fhandler_socket *fh_out) -{ - set_errno (EAFNOSUPPORT); - return -1; -} - int fhandler_socket_inet::bind (const struct sockaddr *name, int namelen) { diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index ca1fe5e3c..c5e4bfb67 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -241,7 +241,7 @@ fhandler_socket_local::socket (int af, int type, int protocol, int flags) int fhandler_socket_local::socketpair (int af, int type, int protocol, int flags, - fhandler_socket *_fh_out) + fhandler_socket_local *fh_out) { SOCKET insock = INVALID_SOCKET; SOCKET outsock = INVALID_SOCKET; @@ -249,7 +249,6 @@ fhandler_socket_local::socketpair (int af, int type, int protocol, int flags, struct sockaddr_in sock_in, sock_out; int len; - fhandler_socket_local *fh_out = (fhandler_socket_local *) _fh_out; /* create listening socket */ sock = ::socket (AF_INET, type, 0); if (sock == INVALID_SOCKET) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index e849b04cc..7c58b91fb 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2303,7 +2303,7 @@ socketpair (int af, int type, int protocol, int *sb) { int res = -1; const device *dev; - fhandler_socket *fh_in, *fh_out; + fhandler_socket_local *fh_in, *fh_out; int flags = type & _SOCK_FLAG_MASK; type &= ~_SOCK_FLAG_MASK; @@ -2325,18 +2325,6 @@ socketpair (int af, int type, int protocol, int *sb) } dev = type == SOCK_STREAM ? stream_dev : dgram_dev; break; -#if 0 /* FIXME: Given neither BSD nor Linux support anything other than AF_LOCAL - sockets, we deliberately disable AF_INIT socketpairs now and hope for - the best. */ - case AF_INET: - if (type != SOCK_STREAM && type != SOCK_DGRAM) - { - set_errno (EINVAL); - goto done; - } - dev = type == SOCK_STREAM ? tcp_dev : udp_dev; - break; -#endif default: set_errno (EAFNOSUPPORT); goto done; @@ -2360,8 +2348,8 @@ socketpair (int af, int type, int protocol, int *sb) goto done; } - fh_in = (fhandler_socket *) build_fh_dev (*dev); - fh_out = (fhandler_socket *) build_fh_dev (*dev); + fh_in = reinterpret_cast (build_fh_dev (*dev)); + fh_out = reinterpret_cast (build_fh_dev (*dev)); if (fh_in && fh_out && fh_in->socketpair (af, type, protocol, flags, fh_out) == 0) { From 233bde312546ee60346588803570221389fd89f2 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2018 16:28:14 +0100 Subject: [PATCH 278/649] Cygwin: fhandler_socket: Move shutdown and close methods into derived classes Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 8 ++- winsup/cygwin/fhandler_socket.cc | 66 ------------------- winsup/cygwin/fhandler_socket_inet.cc | 88 ++++++++++++++++++++++---- winsup/cygwin/fhandler_socket_local.cc | 88 ++++++++++++++++++++++---- 4 files changed, 160 insertions(+), 90 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 4b1d8ddaf..51a4a46da 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -580,6 +580,8 @@ class fhandler_socket: public fhandler_base virtual int connect (const struct sockaddr *name, int namelen) = 0; virtual int getsockname (struct sockaddr *name, int *namelen) = 0; virtual int getpeername (struct sockaddr *name, int *namelen) = 0; + virtual int shutdown (int how) = 0; + virtual int close () = 0; virtual int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); virtual int setsockopt (int level, int optname, const void *optval, __socklen_t optlen) = 0; @@ -607,8 +609,6 @@ class fhandler_socket: public fhandler_base set_errno (ESPIPE); return -1; } - int shutdown (int how); - int close (); void hclose (HANDLE) {close ();} int dup (fhandler_base *child, int); @@ -654,6 +654,8 @@ class fhandler_socket_inet: public fhandler_socket int connect (const struct sockaddr *name, int namelen); int getsockname (struct sockaddr *name, int *namelen); int getpeername (struct sockaddr *name, int *namelen); + int shutdown (int how); + int close (); int setsockopt (int level, int optname, const void *optval, __socklen_t optlen); int getsockopt (int level, int optname, const void *optval, @@ -739,6 +741,8 @@ class fhandler_socket_local: public fhandler_socket int connect (const struct sockaddr *name, int namelen); int getsockname (struct sockaddr *name, int *namelen); int getpeername (struct sockaddr *name, int *namelen); + int shutdown (int how); + int close (); int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); int setsockopt (int level, int optname, const void *optval, __socklen_t optlen); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index aafc09c43..98c4467fa 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -720,72 +720,6 @@ fhandler_socket::link (const char *newpath) return fhandler_base::link (newpath); } -int -fhandler_socket::shutdown (int how) -{ - int res = ::shutdown (get_socket (), how); - - /* Linux allows to call shutdown for any socket, even if it's not connected. - This also disables to call accept on this socket, if shutdown has been - called with the SHUT_RD or SHUT_RDWR parameter. In contrast, WinSock - only allows to call shutdown on a connected socket. The accept function - is in no way affected. So, what we do here is to fake success, and to - change the event settings so that an FD_CLOSE event is triggered for the - calling Cygwin function. The evaluate_events method handles the call - from accept specially to generate a Linux-compatible behaviour. */ - if (res && WSAGetLastError () != WSAENOTCONN) - set_winsock_errno (); - else - { - res = 0; - switch (how) - { - case SHUT_RD: - saw_shutdown_read (true); - wsock_events->events |= FD_CLOSE; - SetEvent (wsock_evt); - break; - case SHUT_WR: - saw_shutdown_write (true); - break; - case SHUT_RDWR: - saw_shutdown_read (true); - saw_shutdown_write (true); - wsock_events->events |= FD_CLOSE; - SetEvent (wsock_evt); - break; - } - } - return res; -} - -int -fhandler_socket::close () -{ - int res = 0; - - release_events (); - while ((res = ::closesocket (get_socket ())) != 0) - { - if (WSAGetLastError () != WSAEWOULDBLOCK) - { - set_winsock_errno (); - res = -1; - break; - } - if (cygwait (10) == WAIT_SIGNALED) - { - set_errno (EINTR); - res = -1; - break; - } - WSASetLastError (0); - } - - debug_printf ("%d = fhandler_socket::close()", res); - return res; -} - /* Definitions of old ifreq stuff used prior to Cygwin 1.7.0. */ #define OLD_SIOCGIFFLAGS _IOW('s', 101, struct __old_ifreq) #define OLD_SIOCGIFADDR _IOW('s', 102, struct __old_ifreq) diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index 06091973f..d1808414a 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -88,6 +88,20 @@ get_inet_addr_inet (const struct sockaddr *in, int inlen, } } +/* There's no DLL which exports the symbol WSARecvMsg. One has to call + WSAIoctl as below to fetch the function pointer. Why on earth did the + MS developers decide not to export a normal symbol for these extension + functions? */ +inline int +get_ext_funcptr (SOCKET sock, void *funcptr) +{ + DWORD bret; + const GUID guid = WSAID_WSARECVMSG; + return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, + (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), + &bret, NULL, NULL); +} + static int convert_ws1_ip_optname (int optname) { @@ -383,18 +397,70 @@ fhandler_socket_inet::getpeername (struct sockaddr *name, int *namelen) return res; } -/* There's no DLL which exports the symbol WSARecvMsg. One has to call - WSAIoctl as below to fetch the function pointer. Why on earth did the - MS developers decide not to export a normal symbol for these extension - functions? */ -inline int -get_ext_funcptr (SOCKET sock, void *funcptr) +int +fhandler_socket_inet::shutdown (int how) { - DWORD bret; - const GUID guid = WSAID_WSARECVMSG; - return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, - (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), - &bret, NULL, NULL); + int res = ::shutdown (get_socket (), how); + + /* Linux allows to call shutdown for any socket, even if it's not connected. + This also disables to call accept on this socket, if shutdown has been + called with the SHUT_RD or SHUT_RDWR parameter. In contrast, WinSock + only allows to call shutdown on a connected socket. The accept function + is in no way affected. So, what we do here is to fake success, and to + change the event settings so that an FD_CLOSE event is triggered for the + calling Cygwin function. The evaluate_events method handles the call + from accept specially to generate a Linux-compatible behaviour. */ + if (res && WSAGetLastError () != WSAENOTCONN) + set_winsock_errno (); + else + { + res = 0; + switch (how) + { + case SHUT_RD: + saw_shutdown_read (true); + wsock_events->events |= FD_CLOSE; + SetEvent (wsock_evt); + break; + case SHUT_WR: + saw_shutdown_write (true); + break; + case SHUT_RDWR: + saw_shutdown_read (true); + saw_shutdown_write (true); + wsock_events->events |= FD_CLOSE; + SetEvent (wsock_evt); + break; + } + } + return res; +} + +int +fhandler_socket_inet::close () +{ + int res = 0; + + release_events (); + while ((res = ::closesocket (get_socket ())) != 0) + { + if (WSAGetLastError () != WSAEWOULDBLOCK) + { + set_winsock_errno (); + res = -1; + break; + } + if (cygwait (10) == WAIT_SIGNALED) + { + set_errno (EINTR); + res = -1; + break; + } + WSASetLastError (0); + } + + debug_printf ("%d = fhandler_socket::close()", res); + return res; } inline ssize_t diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index c5e4bfb67..4c8f3340b 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -206,6 +206,20 @@ get_inet_addr_local (const struct sockaddr *in, int inlen, return SOCKET_ERROR; } +/* There's no DLL which exports the symbol WSARecvMsg. One has to call + WSAIoctl as below to fetch the function pointer. Why on earth did the + MS developers decide not to export a normal symbol for these extension + functions? */ +inline int +get_ext_funcptr (SOCKET sock, void *funcptr) +{ + DWORD bret; + const GUID guid = WSAID_WSARECVMSG; + return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, + (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), + &bret, NULL, NULL); +} + fhandler_socket_local::fhandler_socket_local () : fhandler_socket (), sun_path (NULL), @@ -1030,18 +1044,70 @@ fhandler_socket_local::getpeername (struct sockaddr *name, int *namelen) return res; } -/* There's no DLL which exports the symbol WSARecvMsg. One has to call - WSAIoctl as below to fetch the function pointer. Why on earth did the - MS developers decide not to export a normal symbol for these extension - functions? */ -inline int -get_ext_funcptr (SOCKET sock, void *funcptr) +int +fhandler_socket_local::shutdown (int how) { - DWORD bret; - const GUID guid = WSAID_WSARECVMSG; - return WSAIoctl (sock, SIO_GET_EXTENSION_FUNCTION_POINTER, - (void *) &guid, sizeof (GUID), funcptr, sizeof (void *), - &bret, NULL, NULL); + int res = ::shutdown (get_socket (), how); + + /* Linux allows to call shutdown for any socket, even if it's not connected. + This also disables to call accept on this socket, if shutdown has been + called with the SHUT_RD or SHUT_RDWR parameter. In contrast, WinSock + only allows to call shutdown on a connected socket. The accept function + is in no way affected. So, what we do here is to fake success, and to + change the event settings so that an FD_CLOSE event is triggered for the + calling Cygwin function. The evaluate_events method handles the call + from accept specially to generate a Linux-compatible behaviour. */ + if (res && WSAGetLastError () != WSAENOTCONN) + set_winsock_errno (); + else + { + res = 0; + switch (how) + { + case SHUT_RD: + saw_shutdown_read (true); + wsock_events->events |= FD_CLOSE; + SetEvent (wsock_evt); + break; + case SHUT_WR: + saw_shutdown_write (true); + break; + case SHUT_RDWR: + saw_shutdown_read (true); + saw_shutdown_write (true); + wsock_events->events |= FD_CLOSE; + SetEvent (wsock_evt); + break; + } + } + return res; +} + +int +fhandler_socket_local::close () +{ + int res = 0; + + release_events (); + while ((res = ::closesocket (get_socket ())) != 0) + { + if (WSAGetLastError () != WSAEWOULDBLOCK) + { + set_winsock_errno (); + res = -1; + break; + } + if (cygwait (10) == WAIT_SIGNALED) + { + set_errno (EINTR); + res = -1; + break; + } + WSASetLastError (0); + } + + debug_printf ("%d = fhandler_socket::close()", res); + return res; } inline ssize_t From 79598f94f75d9423a382ec108291619ff45f2912 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2018 16:30:08 +0100 Subject: [PATCH 279/649] Cygwin: fhandler_socket: Add derived ioctl methods Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 2 + winsup/cygwin/fhandler_socket.cc | 51 +------------------ winsup/cygwin/fhandler_socket_inet.cc | 68 ++++++++++++++++++++++++++ winsup/cygwin/fhandler_socket_local.cc | 57 +++++++++++++++++++++ 4 files changed, 128 insertions(+), 50 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 51a4a46da..18de57c39 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -670,6 +670,7 @@ class fhandler_socket_inet: public fhandler_socket ssize_t sendmsg (const struct msghdr *msg, int flags); ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int ioctl (unsigned int cmd, void *); /* from here on: CLONING */ fhandler_socket_inet (void *) {} @@ -758,6 +759,7 @@ class fhandler_socket_local: public fhandler_socket ssize_t sendmsg (const struct msghdr *msg, int flags); ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int ioctl (unsigned int cmd, void *); int __reg2 fstat (struct stat *buf); int __reg2 fstatvfs (struct statvfs *buf); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 98c4467fa..dfcb8d490 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -895,57 +895,8 @@ fhandler_socket::ioctl (unsigned int cmd, void *p) } break; } - /* From this point on we handle only ioctl commands which are understood by - Winsock. However, we have a problem, which is, the different size of - u_long in Windows and 64 bit Cygwin. This affects the definitions of - FIOASYNC, etc, because they are defined in terms of sizeof(u_long). - So we have to use case labels which are independent of the sizeof - u_long. Since we're redefining u_long at the start of this file to - matching Winsock's idea of u_long, we can use the real definitions in - calls to Windows. In theory we also have to make sure to convert the - different ideas of u_long between the application and Winsock, but - fortunately, the parameters defined as u_long pointers are on Linux - and BSD systems defined as int pointer, so the applications will - use a type of the expected size. Hopefully. */ - case FIOASYNC: -#ifdef __x86_64__ - case _IOW('f', 125, u_long): -#endif - res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, - *(int *) p ? ASYNC_MASK : 0); - syscall_printf ("Async I/O on socket %s", - *(int *) p ? "started" : "cancelled"); - async_io (*(int *) p != 0); - /* If async_io is switched off, revert the event handling. */ - if (*(int *) p == 0) - WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); - break; - case FIONREAD: -#ifdef __x86_64__ - case _IOR('f', 127, u_long): -#endif - /* Make sure to use the Winsock definition of FIONREAD. */ - res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); - if (res == SOCKET_ERROR) - set_winsock_errno (); - break; default: - /* Sockets are always non-blocking internally. So we just note the - state here. */ -#ifdef __x86_64__ - /* Convert the different idea of u_long in the definition of cmd. */ - if (((cmd >> 16) & IOCPARM_MASK) == sizeof (unsigned long)) - cmd = (cmd & ~(IOCPARM_MASK << 16)) | (sizeof (u_long) << 16); -#endif - if (cmd == FIONBIO) - { - syscall_printf ("socket is now %sblocking", - *(int *) p ? "non" : ""); - set_nonblocking (*(int *) p); - res = 0; - } - else - res = ::ioctlsocket (get_socket (), cmd, (u_long *) p); + res = fhandler_base::ioctl (cmd, p); break; } syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index d1808414a..d5fe393de 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -1217,3 +1217,71 @@ fhandler_socket_inet::getsockopt (int level, int optname, const void *optval, return ret; } + +int +fhandler_socket_inet::ioctl (unsigned int cmd, void *p) +{ + int res; + + switch (cmd) + { + /* Here we handle only ioctl commands which are understood by Winsock. + However, we have a problem, which is, the different size of u_long + in Windows and 64 bit Cygwin. This affects the definitions of + FIOASYNC, etc, because they are defined in terms of sizeof(u_long). + So we have to use case labels which are independent of the sizeof + u_long. Since we're redefining u_long at the start of this file to + matching Winsock's idea of u_long, we can use the real definitions in + calls to Windows. In theory we also have to make sure to convert the + different ideas of u_long between the application and Winsock, but + fortunately, the parameters defined as u_long pointers are on Linux + and BSD systems defined as int pointer, so the applications will + use a type of the expected size. Hopefully. */ + case FIOASYNC: +#ifdef __x86_64__ + case _IOW('f', 125, u_long): +#endif + res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, + *(int *) p ? ASYNC_MASK : 0); + syscall_printf ("Async I/O on socket %s", + *(int *) p ? "started" : "cancelled"); + async_io (*(int *) p != 0); + /* If async_io is switched off, revert the event handling. */ + if (*(int *) p == 0) + WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); + break; + case FIONREAD: +#ifdef __x86_64__ + case _IOR('f', 127, u_long): +#endif + /* Make sure to use the Winsock definition of FIONREAD. */ + res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); + if (res == SOCKET_ERROR) + set_winsock_errno (); + break; + case FIONBIO: + case SIOCATMARK: + /* Sockets are always non-blocking internally. So we just note the + state here. */ +#ifdef __x86_64__ + /* Convert the different idea of u_long in the definition of cmd. */ + if (((cmd >> 16) & IOCPARM_MASK) == sizeof (unsigned long)) + cmd = (cmd & ~(IOCPARM_MASK << 16)) | (sizeof (u_long) << 16); +#endif + if (cmd == FIONBIO) + { + syscall_printf ("socket is now %sblocking", + *(int *) p ? "non" : ""); + set_nonblocking (*(int *) p); + res = 0; + } + else + res = ::ioctlsocket (get_socket (), cmd, (u_long *) p); + break; + default: + res = fhandler_socket::ioctl (cmd, p); + break; + } + syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); + return res; +} diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index 4c8f3340b..bf34377a0 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -1907,3 +1907,60 @@ fhandler_socket_local::getsockopt (int level, int optname, const void *optval, return ret; } + +int +fhandler_socket_local::ioctl (unsigned int cmd, void *p) +{ + int res; + + switch (cmd) + { + /* FIXME: These have to be handled differently in future. */ + case FIOASYNC: +#ifdef __x86_64__ + case _IOW('f', 125, u_long): +#endif + res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, + *(int *) p ? ASYNC_MASK : 0); + syscall_printf ("Async I/O on socket %s", + *(int *) p ? "started" : "cancelled"); + async_io (*(int *) p != 0); + /* If async_io is switched off, revert the event handling. */ + if (*(int *) p == 0) + WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); + break; + case FIONREAD: +#ifdef __x86_64__ + case _IOR('f', 127, u_long): +#endif + /* Make sure to use the Winsock definition of FIONREAD. */ + res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); + if (res == SOCKET_ERROR) + set_winsock_errno (); + break; + case FIONBIO: + case SIOCATMARK: + /* Sockets are always non-blocking internally. So we just note the + state here. */ +#ifdef __x86_64__ + /* Convert the different idea of u_long in the definition of cmd. */ + if (((cmd >> 16) & IOCPARM_MASK) == sizeof (unsigned long)) + cmd = (cmd & ~(IOCPARM_MASK << 16)) | (sizeof (u_long) << 16); +#endif + if (cmd == FIONBIO) + { + syscall_printf ("socket is now %sblocking", + *(int *) p ? "non" : ""); + set_nonblocking (*(int *) p); + res = 0; + } + else + res = ::ioctlsocket (get_socket (), cmd, (u_long *) p); + break; + default: + res = fhandler_socket::ioctl (cmd, p); + break; + } + syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); + return res; +} From 9c593d9b39e9ad5bb02a02ace5418c3ef98aa59f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2018 16:37:12 +0100 Subject: [PATCH 280/649] Cygwin: fhandler_socket: Add derived fcntl methods Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 7 +++++-- winsup/cygwin/fhandler_socket.cc | 12 ------------ winsup/cygwin/fhandler_socket_inet.cc | 26 ++++++++++++++++++++++++++ winsup/cygwin/fhandler_socket_local.cc | 26 ++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 14 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 18de57c39..bf0666830 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -602,8 +602,9 @@ class fhandler_socket: public fhandler_base virtual ssize_t __stdcall write (const void *ptr, size_t len) = 0; virtual ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1) = 0; - int ioctl (unsigned int cmd, void *); - int fcntl (int cmd, intptr_t); + virtual int ioctl (unsigned int cmd, void *); + virtual int fcntl (int cmd, intptr_t); + off_t lseek (off_t, int) { set_errno (ESPIPE); @@ -671,6 +672,7 @@ class fhandler_socket_inet: public fhandler_socket ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); int ioctl (unsigned int cmd, void *); + int fcntl (int cmd, intptr_t); /* from here on: CLONING */ fhandler_socket_inet (void *) {} @@ -760,6 +762,7 @@ class fhandler_socket_local: public fhandler_socket ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); int ioctl (unsigned int cmd, void *); + int fcntl (int cmd, intptr_t); int __reg2 fstat (struct stat *buf); int __reg2 fstatvfs (struct statvfs *buf); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index dfcb8d490..b1a5136ed 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -911,18 +911,6 @@ fhandler_socket::fcntl (int cmd, intptr_t arg) switch (cmd) { - case F_SETOWN: - { - pid_t pid = (pid_t) arg; - LOCK_EVENTS; - wsock_events->owner = pid; - UNLOCK_EVENTS; - debug_printf ("owner set to %d", pid); - } - break; - case F_GETOWN: - res = wsock_events->owner; - break; case F_SETFL: { /* Carefully test for the O_NONBLOCK or deprecated OLD_O_NDELAY flag. diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index d5fe393de..b2bc1934a 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -1285,3 +1285,29 @@ fhandler_socket_inet::ioctl (unsigned int cmd, void *p) syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); return res; } + +int +fhandler_socket_inet::fcntl (int cmd, intptr_t arg) +{ + int res = 0; + + switch (cmd) + { + case F_SETOWN: + { + pid_t pid = (pid_t) arg; + LOCK_EVENTS; + wsock_events->owner = pid; + UNLOCK_EVENTS; + debug_printf ("owner set to %d", pid); + } + break; + case F_GETOWN: + res = wsock_events->owner; + break; + default: + res = fhandler_socket::fcntl (cmd, arg); + break; + } + return res; +} diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index bf34377a0..0649fa0a7 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -1964,3 +1964,29 @@ fhandler_socket_local::ioctl (unsigned int cmd, void *p) syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); return res; } + +int +fhandler_socket_local::fcntl (int cmd, intptr_t arg) +{ + int res = 0; + + switch (cmd) + { + case F_SETOWN: + { + pid_t pid = (pid_t) arg; + LOCK_EVENTS; + wsock_events->owner = pid; + UNLOCK_EVENTS; + debug_printf ("owner set to %d", pid); + } + break; + case F_GETOWN: + res = wsock_events->owner; + break; + default: + res = fhandler_socket::fcntl (cmd, arg); + break; + } + return res; +} From 479080baec4b10e2b6c195a3fc9405c8458ffbde Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2018 16:54:08 +0100 Subject: [PATCH 281/649] Cygwin: fhandler_socket: Rearrange methods Follow the same pattern in all fhandler_socket classes. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 73 +++++------ winsup/cygwin/fhandler_socket.cc | 216 +++++++++++++++---------------- 2 files changed, 145 insertions(+), 144 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index bf0666830..191560829 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -499,17 +499,18 @@ class fhandler_socket: public fhandler_base ret |= SOCK_CLOEXEC; return ret; } + + protected: wsa_event *wsock_events; HANDLE wsock_mtx; HANDLE wsock_evt; - public: bool init_events (); - int evaluate_events (const long event_mask, long &events, const bool erase); - const HANDLE wsock_event () const { return wsock_evt; } - const LONG serial_number () const { return wsock_events->serial_number; } - protected: int wait_for_events (const long event_mask, const DWORD flags); void release_events (); + public: + const HANDLE wsock_event () const { return wsock_evt; } + int evaluate_events (const long event_mask, long &events, const bool erase); + const LONG serial_number () const { return wsock_events->serial_number; } protected: int _rmem; @@ -529,9 +530,6 @@ class fhandler_socket: public fhandler_base protected: struct _WSAPROTOCOL_INFOW *prot_info_ptr; - public: - void init_fixup_before (); - bool need_fixup_before () const {return prot_info_ptr != NULL;} protected: struct status_flags @@ -573,6 +571,15 @@ class fhandler_socket: public fhandler_base IMPLEMENT_STATUS_FLAG (conn_state, connect_state) IMPLEMENT_STATUS_FLAG (bool, no_getpeereid) + bool need_fixup_before () const {return prot_info_ptr != NULL;} + void set_close_on_exec (bool val); + void init_fixup_before (); + int fixup_before_fork_exec (DWORD); + void fixup_after_fork (HANDLE); + void fixup_after_exec (); + int dup (fhandler_base *child, int); + char *get_proc_fd_name (char *buf); + virtual int socket (int af, int type, int protocol, int flags) = 0; virtual int bind (const struct sockaddr *name, int namelen) = 0; virtual int listen (int backlog) = 0; @@ -583,12 +590,6 @@ class fhandler_socket: public fhandler_base virtual int shutdown (int how) = 0; virtual int close () = 0; virtual int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); - virtual int setsockopt (int level, int optname, const void *optval, - __socklen_t optlen) = 0; - virtual int getsockopt (int level, int optname, const void *optval, - __socklen_t *optlen) = 0; - - int open (int flags, mode_t mode = 0); virtual ssize_t recvfrom (void *ptr, size_t len, int flags, struct sockaddr *from, int *fromlen) = 0; virtual ssize_t recvmsg (struct msghdr *msg, int flags) = 0; @@ -601,23 +602,28 @@ class fhandler_socket: public fhandler_base virtual ssize_t sendmsg (const struct msghdr *msg, int flags) = 0; virtual ssize_t __stdcall write (const void *ptr, size_t len) = 0; virtual ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1) = 0; + virtual int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen) = 0; + virtual int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen) = 0; virtual int ioctl (unsigned int cmd, void *); virtual int fcntl (int cmd, intptr_t); + int open (int flags, mode_t mode = 0); + int __reg2 fstat (struct stat *buf); + int __reg2 fstatvfs (struct statvfs *buf); + int __reg1 fchmod (mode_t newmode); + int __reg2 fchown (uid_t newuid, gid_t newgid); + int __reg3 facl (int, int, struct acl *); + int __reg2 link (const char *); off_t lseek (off_t, int) { set_errno (ESPIPE); return -1; } - void hclose (HANDLE) {close ();} - int dup (fhandler_base *child, int); - void set_close_on_exec (bool val); - int fixup_before_fork_exec (DWORD); - void fixup_after_fork (HANDLE); - void fixup_after_exec (); - char *get_proc_fd_name (char *buf); + void hclose (HANDLE) {close ();} select_record *select_read (select_stuff *); select_record *select_write (select_stuff *); @@ -626,13 +632,6 @@ class fhandler_socket: public fhandler_base int get_addr_family () {return addr_family;} void set_socket_type (int st) { type = st;} int get_socket_type () {return type;} - - int __reg2 fstat (struct stat *buf); - int __reg2 fstatvfs (struct statvfs *buf); - int __reg1 fchmod (mode_t newmode); - int __reg2 fchown (uid_t newuid, gid_t newgid); - int __reg3 facl (int, int, struct acl *); - int __reg2 link (const char *); }; class fhandler_socket_inet: public fhandler_socket @@ -657,10 +656,6 @@ class fhandler_socket_inet: public fhandler_socket int getpeername (struct sockaddr *name, int *namelen); int shutdown (int how); int close (); - int setsockopt (int level, int optname, const void *optval, - __socklen_t optlen); - int getsockopt (int level, int optname, const void *optval, - __socklen_t *optlen); ssize_t recvfrom (void *ptr, size_t len, int flags, struct sockaddr *from, int *fromlen); ssize_t recvmsg (struct msghdr *msg, int flags); @@ -671,6 +666,11 @@ class fhandler_socket_inet: public fhandler_socket ssize_t sendmsg (const struct msghdr *msg, int flags); ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen); + int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen); + int ioctl (unsigned int cmd, void *); int fcntl (int cmd, intptr_t); @@ -747,10 +747,6 @@ class fhandler_socket_local: public fhandler_socket int shutdown (int how); int close (); int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); - int setsockopt (int level, int optname, const void *optval, - __socklen_t optlen); - int getsockopt (int level, int optname, const void *optval, - __socklen_t *optlen); ssize_t recvfrom (void *ptr, size_t len, int flags, struct sockaddr *from, int *fromlen); ssize_t recvmsg (struct msghdr *msg, int flags); @@ -761,6 +757,11 @@ class fhandler_socket_local: public fhandler_socket ssize_t sendmsg (const struct msghdr *msg, int flags); ssize_t __stdcall write (const void *ptr, size_t len); ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen); + int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen); + int ioctl (unsigned int cmd, void *); int fcntl (int cmd, intptr_t); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index b1a5136ed..09c367846 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -77,20 +77,6 @@ fhandler_socket::~fhandler_socket () cfree (prot_info_ptr); } -char * -fhandler_socket::get_proc_fd_name (char *buf) -{ - __small_sprintf (buf, "socket:[%lu]", get_plain_ino ()); - return buf; -} - -int -fhandler_socket::open (int flags, mode_t mode) -{ - set_errno (ENXIO); - return 0; -} - int fhandler_socket::set_socket_handle (SOCKET sock, int af, int type, int flags) { @@ -521,6 +507,20 @@ fhandler_socket::release_events () } } +void +fhandler_socket::set_close_on_exec (bool val) +{ + set_no_inheritance (wsock_mtx, val); + set_no_inheritance (wsock_evt, val); + if (need_fixup_before ()) + { + close_on_exec (val); + debug_printf ("set close_on_exec for %s to %d", get_name (), val); + } + else + fhandler_base::set_close_on_exec (val); +} + /* Called if a freshly created socket is not inheritable. In that case we have to use fixup_before_fork_exec. See comment in set_socket_handle for a description of the problem. */ @@ -629,97 +629,20 @@ fhandler_socket::dup (fhandler_base *child, int flags) return -1; } -int __reg2 -fhandler_socket::fstat (struct stat *buf) +char * +fhandler_socket::get_proc_fd_name (char *buf) { - int res; - - res = fhandler_socket::fstat (buf); - if (!res) - { - buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0); - if (!(buf->st_ino = get_plain_ino ())) - sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]", - (long long *) &buf->st_ino); - buf->st_uid = uid; - buf->st_gid = gid; - buf->st_mode = mode; - buf->st_size = 0; - } - return res; -} - -int __reg2 -fhandler_socket::fstatvfs (struct statvfs *sfs) -{ - memset (sfs, 0, sizeof (*sfs)); - sfs->f_bsize = sfs->f_frsize = 4096; - sfs->f_namemax = NAME_MAX; - return 0; + __small_sprintf (buf, "socket:[%lu]", get_plain_ino ()); + return buf; } int -fhandler_socket::fchmod (mode_t newmode) +fhandler_socket::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) { - mode = (newmode & ~S_IFMT) | S_IFSOCK; - return 0; -} - -int -fhandler_socket::fchown (uid_t newuid, gid_t newgid) -{ - bool perms = check_token_membership (&well_known_admins_sid); - - /* Admin rulez */ - if (!perms) - { - /* Otherwise, new uid == old uid or current uid is fine */ - if (newuid == ILLEGAL_UID || newuid == uid || newuid == myself->uid) - perms = true; - /* Otherwise, new gid == old gid or current gid is fine */ - else if (newgid == ILLEGAL_GID || newgid == gid || newgid == myself->gid) - perms = true; - else - { - /* Last but not least, newgid in supplementary group list is fine */ - tmp_pathbuf tp; - gid_t *gids = (gid_t *) tp.w_get (); - int num = getgroups (65536 / sizeof (*gids), gids); - - for (int idx = 0; idx < num; ++idx) - if (newgid == gids[idx]) - { - perms = true; - break; - } - } - } - - if (perms) - { - if (newuid != ILLEGAL_UID) - uid = newuid; - if (newgid != ILLEGAL_GID) - gid = newgid; - return 0; - } - set_errno (EPERM); + set_errno (EINVAL); return -1; } -int -fhandler_socket::facl (int cmd, int nentries, aclent_t *aclbufp) -{ - set_errno (EOPNOTSUPP); - return -1; -} - -int -fhandler_socket::link (const char *newpath) -{ - return fhandler_base::link (newpath); -} - /* Definitions of old ifreq stuff used prior to Cygwin 1.7.0. */ #define OLD_SIOCGIFFLAGS _IOW('s', 101, struct __old_ifreq) #define OLD_SIOCGIFADDR _IOW('s', 102, struct __old_ifreq) @@ -933,23 +856,100 @@ fhandler_socket::fcntl (int cmd, intptr_t arg) return res; } -void -fhandler_socket::set_close_on_exec (bool val) +int +fhandler_socket::open (int flags, mode_t mode) { - set_no_inheritance (wsock_mtx, val); - set_no_inheritance (wsock_evt, val); - if (need_fixup_before ()) + set_errno (ENXIO); + return 0; +} + +int __reg2 +fhandler_socket::fstat (struct stat *buf) +{ + int res; + + res = fhandler_socket::fstat (buf); + if (!res) { - close_on_exec (val); - debug_printf ("set close_on_exec for %s to %d", get_name (), val); + buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0); + if (!(buf->st_ino = get_plain_ino ())) + sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]", + (long long *) &buf->st_ino); + buf->st_uid = uid; + buf->st_gid = gid; + buf->st_mode = mode; + buf->st_size = 0; } - else - fhandler_base::set_close_on_exec (val); + return res; +} + +int __reg2 +fhandler_socket::fstatvfs (struct statvfs *sfs) +{ + memset (sfs, 0, sizeof (*sfs)); + sfs->f_bsize = sfs->f_frsize = 4096; + sfs->f_namemax = NAME_MAX; + return 0; } int -fhandler_socket::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) +fhandler_socket::fchmod (mode_t newmode) { - set_errno (EINVAL); + mode = (newmode & ~S_IFMT) | S_IFSOCK; + return 0; +} + +int +fhandler_socket::fchown (uid_t newuid, gid_t newgid) +{ + bool perms = check_token_membership (&well_known_admins_sid); + + /* Admin rulez */ + if (!perms) + { + /* Otherwise, new uid == old uid or current uid is fine */ + if (newuid == ILLEGAL_UID || newuid == uid || newuid == myself->uid) + perms = true; + /* Otherwise, new gid == old gid or current gid is fine */ + else if (newgid == ILLEGAL_GID || newgid == gid || newgid == myself->gid) + perms = true; + else + { + /* Last but not least, newgid in supplementary group list is fine */ + tmp_pathbuf tp; + gid_t *gids = (gid_t *) tp.w_get (); + int num = getgroups (65536 / sizeof (*gids), gids); + + for (int idx = 0; idx < num; ++idx) + if (newgid == gids[idx]) + { + perms = true; + break; + } + } + } + + if (perms) + { + if (newuid != ILLEGAL_UID) + uid = newuid; + if (newgid != ILLEGAL_GID) + gid = newgid; + return 0; + } + set_errno (EPERM); return -1; } + +int +fhandler_socket::facl (int cmd, int nentries, aclent_t *aclbufp) +{ + set_errno (EOPNOTSUPP); + return -1; +} + +int +fhandler_socket::link (const char *newpath) +{ + return fhandler_base::link (newpath); +} From b8a57a2d2a13887ef7e7b60bbc3b9666bab64c71 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 22 Feb 2018 16:59:55 +0100 Subject: [PATCH 282/649] Cygwin: fhandler_socket: Move select functions into derived classes Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 18 ++++++++++-- winsup/cygwin/select.cc | 60 ++++++++++++++++++++++++++++++++++++++-- 2 files changed, 72 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 191560829..79991bd36 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -625,13 +625,15 @@ class fhandler_socket: public fhandler_base void hclose (HANDLE) {close ();} - select_record *select_read (select_stuff *); - select_record *select_write (select_stuff *); - select_record *select_except (select_stuff *); void set_addr_family (int af) {addr_family = af;} int get_addr_family () {return addr_family;} void set_socket_type (int st) { type = st;} int get_socket_type () {return type;} + + /* select.cc */ + virtual select_record *select_read (select_stuff *) = 0; + virtual select_record *select_write (select_stuff *) = 0; + virtual select_record *select_except (select_stuff *) = 0; }; class fhandler_socket_inet: public fhandler_socket @@ -674,6 +676,11 @@ class fhandler_socket_inet: public fhandler_socket int ioctl (unsigned int cmd, void *); int fcntl (int cmd, intptr_t); + /* select.cc */ + select_record *select_read (select_stuff *); + select_record *select_write (select_stuff *); + select_record *select_except (select_stuff *); + /* from here on: CLONING */ fhandler_socket_inet (void *) {} @@ -772,6 +779,11 @@ class fhandler_socket_local: public fhandler_socket int __reg3 facl (int, int, struct acl *); int __reg2 link (const char *); + /* select.cc */ + select_record *select_read (select_stuff *); + select_record *select_write (select_stuff *); + select_record *select_except (select_stuff *); + /* from here on: CLONING */ fhandler_socket_local (void *) {} diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index ca2cd5ab2..86e7cd8fd 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -1549,7 +1549,7 @@ socket_cleanup (select_record *, select_stuff *stuff) } select_record * -fhandler_socket::select_read (select_stuff *ss) +fhandler_socket_inet::select_read (select_stuff *ss) { select_record *s = ss->start.next; if (!s->startup) @@ -1565,7 +1565,7 @@ fhandler_socket::select_read (select_stuff *ss) } select_record * -fhandler_socket::select_write (select_stuff *ss) +fhandler_socket_inet::select_write (select_stuff *ss) { select_record *s = ss->start.next; if (!s->startup) @@ -1586,7 +1586,61 @@ fhandler_socket::select_write (select_stuff *ss) } select_record * -fhandler_socket::select_except (select_stuff *ss) +fhandler_socket_inet::select_except (select_stuff *ss) +{ + select_record *s = ss->start.next; + if (!s->startup) + { + s->startup = start_thread_socket; + s->verify = verify_true; + s->cleanup = socket_cleanup; + } + s->peek = peek_socket; + /* FIXME: Is this right? Should these be used as criteria for except? */ + s->except_ready = saw_shutdown_write () || saw_shutdown_read (); + s->except_selected = true; + return s; +} + +select_record * +fhandler_socket_local::select_read (select_stuff *ss) +{ + select_record *s = ss->start.next; + if (!s->startup) + { + s->startup = start_thread_socket; + s->verify = verify_true; + s->cleanup = socket_cleanup; + } + s->peek = peek_socket; + s->read_ready = saw_shutdown_read (); + s->read_selected = true; + return s; +} + +select_record * +fhandler_socket_local::select_write (select_stuff *ss) +{ + select_record *s = ss->start.next; + if (!s->startup) + { + s->startup = start_thread_socket; + s->verify = verify_true; + s->cleanup = socket_cleanup; + } + s->peek = peek_socket; + s->write_ready = saw_shutdown_write () || connect_state () == unconnected; + s->write_selected = true; + if (connect_state () != unconnected) + { + s->except_ready = saw_shutdown_write () || saw_shutdown_read (); + s->except_on_write = true; + } + return s; +} + +select_record * +fhandler_socket_local::select_except (select_stuff *ss) { select_record *s = ss->start.next; if (!s->startup) From 03f380c2bc12bae32e8e0718c195e5d744011108 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 13:32:51 +0100 Subject: [PATCH 283/649] Cygwin: drop unused device nodes and clean up socket devices * Rename DEV_TCP_MAJOR to DEV_SOCK_MAJOR * Drop FH_TCP, FH_UDP, FH_ICMP in favor of single FH_INET * Drop FH_UNIX, FH_STREAM, FH_DGRAM in favor of single FH_LOCAL Signed-off-by: Corinna Vinschen --- winsup/cygwin/devices.cc | 14 ++++---------- winsup/cygwin/devices.h | 22 +++++++--------------- winsup/cygwin/devices.in | 14 ++++---------- winsup/cygwin/dtable.cc | 10 +++------- winsup/cygwin/fhandler_socket.cc | 2 +- winsup/cygwin/net.cc | 6 +++--- winsup/cygwin/path.cc | 4 ++-- winsup/cygwin/path.h | 2 +- 8 files changed, 25 insertions(+), 49 deletions(-) diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index c2df919d4..2b65108a3 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -120,17 +120,11 @@ const _device dev_piper_storage = const _device dev_pipew_storage = {"", {FH_PIPEW}, "", exists_internal}; -const _device dev_tcp_storage = - {"", {FH_TCP}, "", exists_internal}; +const _device dev_af_inet_storage = + {"", {FH_INET}, "", exists_internal}; -const _device dev_udp_storage = - {"", {FH_UDP}, "", exists_internal}; - -const _device dev_stream_storage = - {"", {FH_STREAM}, "", exists_internal}; - -const _device dev_dgram_storage = - {"", {FH_DGRAM}, "", exists_internal}; +const _device dev_af_local_storage = + {"", {FH_LOCAL}, "", exists_internal}; const _device dev_bad_storage = {"", {FH_NADA}, "", exists_internal}; diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h index 5fb3396c0..9924bad01 100644 --- a/winsup/cygwin/devices.h +++ b/winsup/cygwin/devices.h @@ -241,13 +241,9 @@ enum fh_devices DEV_SOUND_MAJOR = 14, FH_OSS_DSP = FHDEV (DEV_SOUND_MAJOR, 3), - DEV_TCP_MAJOR = 30, - FH_TCP = FHDEV (DEV_TCP_MAJOR, 36), - FH_UDP = FHDEV (DEV_TCP_MAJOR, 39), - FH_ICMP = FHDEV (DEV_TCP_MAJOR, 33), - FH_UNIX = FHDEV (DEV_TCP_MAJOR, 120), - FH_STREAM = FHDEV (DEV_TCP_MAJOR, 121), - FH_DGRAM = FHDEV (DEV_TCP_MAJOR, 122), + DEV_SOCK_MAJOR = 30, + FH_INET = FHDEV (DEV_SOCK_MAJOR, 36), + FH_LOCAL = FHDEV (DEV_SOCK_MAJOR, 120), FH_NADA = FHDEV (0, 0), FH_ERROR = FHDEV (255, 255) /* Set by fh constructor when error detected */ @@ -394,14 +390,10 @@ extern const _device *ptmx_dev; extern const _device *ptys_dev; extern const _device *urandom_dev; -extern const _device dev_dgram_storage; -#define dgram_dev ((device *) &dev_dgram_storage) -extern const _device dev_stream_storage; -#define stream_dev ((device *) &dev_stream_storage) -extern const _device dev_tcp_storage; -#define tcp_dev ((device *) &dev_tcp_storage) -extern const _device dev_udp_storage; -#define udp_dev ((device *) &dev_udp_storage) +extern const _device dev_af_local_storage; +#define af_local_dev ((device *) &dev_af_local_storage) +extern const _device dev_af_inet_storage; +#define af_inet_dev ((device *) &dev_af_inet_storage) extern const _device dev_piper_storage; #define piper_dev ((device *) &dev_piper_storage) diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index 3ec32493b..47d127cb3 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -116,17 +116,11 @@ const _device dev_piper_storage = const _device dev_pipew_storage = {"", {FH_PIPEW}, "", exists_internal}; -const _device dev_tcp_storage = - {"", {FH_TCP}, "", exists_internal}; +const _device dev_af_inet_storage = + {"", {FH_INET}, "", exists_internal}; -const _device dev_udp_storage = - {"", {FH_UDP}, "", exists_internal}; - -const _device dev_stream_storage = - {"", {FH_STREAM}, "", exists_internal}; - -const _device dev_dgram_storage = - {"", {FH_DGRAM}, "", exists_internal}; +const _device dev_af_local_storage = + {"", {FH_LOCAL}, "", exists_internal}; const _device dev_bad_storage = {"", {FH_NADA}, "", exists_internal}; diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index eb3081e49..ae0315cd3 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -311,7 +311,7 @@ dtable::init_std_file_from_handle (int fd, HANDLE handle) (char *) &rcv, &len))) { /* socket */ - dev = *tcp_dev; + dev = *af_inet_dev; name[0] = '\0'; } else if (fd == 0) @@ -514,14 +514,10 @@ fh_alloc (path_conv& pc) case FH_PIPEW: fh = cnew (fhandler_pipe); break; - case FH_TCP: - case FH_UDP: - case FH_ICMP: + case FH_INET: fh = cnew (fhandler_socket_inet); break; - case FH_UNIX: - case FH_STREAM: - case FH_DGRAM: + case FH_LOCAL: fh = cnew (fhandler_socket_local); break; case FH_FS: diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 09c367846..0cdf6fa69 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -871,7 +871,7 @@ fhandler_socket::fstat (struct stat *buf) res = fhandler_socket::fstat (buf); if (!res) { - buf->st_dev = FHDEV (DEV_TCP_MAJOR, 0); + buf->st_dev = FHDEV (DEV_SOCK_MAJOR, 0); if (!(buf->st_ino = get_plain_ino ())) sscanf (get_name (), "/proc/%*d/fd/socket:[%lld]", (long long *) &buf->st_ino); diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 7c58b91fb..6b88f9105 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -526,7 +526,7 @@ cygwin_socket (int af, int type, int protocol) set_errno (EPROTONOSUPPORT); goto done; } - dev = type == SOCK_STREAM ? stream_dev : dgram_dev; + dev = af_local_dev; break; case AF_INET: case AF_INET6: @@ -535,7 +535,7 @@ cygwin_socket (int af, int type, int protocol) set_errno (EINVAL); goto done; } - dev = type == SOCK_STREAM ? tcp_dev : udp_dev; + dev = af_inet_dev; break; default: set_errno (EAFNOSUPPORT); @@ -2323,7 +2323,7 @@ socketpair (int af, int type, int protocol, int *sb) set_errno (EPROTONOSUPPORT); goto done; } - dev = type == SOCK_STREAM ? stream_dev : dgram_dev; + dev = af_local_dev; break; default: set_errno (EAFNOSUPPORT); diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index cf6422341..2bf84abbe 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -864,7 +864,7 @@ path_conv::check (const char *src, unsigned opt, if (component == 0) { fileattr = 0; - dev.parse (FH_TCP); + dev.parse (FH_INET); } break; case virt_fsdir: @@ -959,7 +959,7 @@ path_conv::check (const char *src, unsigned opt, return; } fileattr = sym.fileattr; - dev.parse (FH_UNIX); + dev.parse (FH_LOCAL); dev.setfs (1); goto out; } diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 469d6076d..8a7354017 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -192,7 +192,7 @@ class path_conv int is_fs_device () const {return isdevice () && is_fs_special ();} int is_fs_special () const {return dev.is_fs_special ();} int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();} - int issocket () const {return dev.is_device (FH_UNIX);} + int issocket () const {return dev.is_device (FH_LOCAL);} int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;} int isopen () const {return path_flags & PATH_OPEN;} int isctty_capable () const {return path_flags & PATH_CTTY;} From b89b6f434939b3ab256afd476467e6189c3a4ab9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 13:33:23 +0100 Subject: [PATCH 284/649] Cygwin: socket.h: Add SIOCINQ, equivalent to FIONREAD Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/asm/socket.h | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/cygwin/include/asm/socket.h b/winsup/cygwin/include/asm/socket.h index 8c0132997..712a46092 100644 --- a/winsup/cygwin/include/asm/socket.h +++ b/winsup/cygwin/include/asm/socket.h @@ -22,6 +22,7 @@ details. */ #define SIOCATMARK _IOR('s', 7, long) /* at oob mark? */ #define FIONREAD _IOR('f', 127, long) /* get # bytes to read */ +#define SIOCINQ FIONREAD /* Compatible with termios.h */ #define FIONBIO 0x8004667e /* set/clear non-blocking i/o */ #define FIOASYNC _IOW('f', 125, long) /* set/clear async i/o */ From 7bcab422e5f2fb1ee16e177c182005c313be630e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 13:34:08 +0100 Subject: [PATCH 285/649] Cygwin: fix fhandler_socket_local::fchmod Rather than just returning 0, return the result of calling the base class fchmod. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_local.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index 0649fa0a7..298a378e3 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -650,7 +650,7 @@ int fhandler_socket_local::fchmod (mode_t newmode) { if (!get_sun_path () || get_sun_path ()[0] == '\0') - return 0; + return fhandler_socket::fchmod (newmode); fhandler_disk_file fh (pc); fh.get_device () = FH_FS; return fh.fchmod (S_IFSOCK | adjust_socket_file_mode (newmode)); From cc9fe2c71651bf0d88e549d58656194860f5497e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 14:56:30 +0100 Subject: [PATCH 286/649] Cygwin: eliminate unused fhandler method hclose Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 79991bd36..4c7fea3e3 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -311,7 +311,6 @@ class fhandler_base /* Returns name used for /proc//fd in buf. */ virtual char *get_proc_fd_name (char *buf); - virtual void hclose (HANDLE h) {CloseHandle (h);} virtual void set_no_inheritance (HANDLE &, bool); /* fixup fd possibly non-inherited handles after fork */ @@ -623,8 +622,6 @@ class fhandler_socket: public fhandler_base return -1; } - void hclose (HANDLE) {close ();} - void set_addr_family (int af) {addr_family = af;} int get_addr_family () {return addr_family;} void set_socket_type (int st) { type = st;} From b79018ee3a36140a82e2dfa2d7a71fc0bf15d892 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 15:24:18 +0100 Subject: [PATCH 287/649] Cygwin: encapsulate Winsock based fhandler_socket classes Insert another class fhandler_socket_wsock between fhandler_socket and fhandler_socket_inet/fhandler_socket_local. Also, add a new method fhandler::is_wsock_socket to allow asking for sockets in general (is_socket) vs. Winsock-based sockets (is_wsock_socket). This allows to develop a new handler_socket_unix class as derived class from fhandler_socket without any trace of wsock code left in fhandler_socket. While this is basically a temporary measure at this time, it may prove useful for later interoperability with the upcoming Windows 10 AF_UNIX implementation at one point. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.cc | 2 +- winsup/cygwin/fhandler.h | 194 ++++---- winsup/cygwin/fhandler_socket.cc | 559 ----------------------- winsup/cygwin/fhandler_socket_inet.cc | 607 ++++++++++++++++++++++++- winsup/cygwin/fhandler_socket_local.cc | 427 +---------------- winsup/cygwin/net.cc | 3 +- winsup/cygwin/poll.cc | 6 +- winsup/cygwin/select.cc | 70 +-- 8 files changed, 711 insertions(+), 1157 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 086be7311..93bbdfed2 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -1567,7 +1567,7 @@ fhandler_base::fork_fixup (HANDLE parent, HANDLE &h, const char *name) { HANDLE oh = h; bool res = false; - if (/* !is_socket () && */ !close_on_exec ()) + if (!close_on_exec ()) debug_printf ("handle %p already opened", h); else if (!DuplicateHandle (parent, h, GetCurrentProcess (), &h, 0, !close_on_exec (), DUPLICATE_SAME_ACCESS)) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 4c7fea3e3..3816110a0 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -406,6 +406,7 @@ public: virtual bool isfifo () const { return false; } virtual int ptsname_r (char *, size_t); virtual class fhandler_socket *is_socket () { return NULL; } + virtual class fhandler_socket_wsock *is_wsock_socket () { return NULL; } virtual class fhandler_console *is_console () { return 0; } virtual int is_windows () {return 0; } @@ -488,7 +489,6 @@ class fhandler_socket: public fhandler_base protected: int addr_family; int type; - virtual int af_local_connect () = 0; inline int get_socket_flags () { int ret = 0; @@ -499,18 +499,6 @@ class fhandler_socket: public fhandler_base return ret; } - protected: - wsa_event *wsock_events; - HANDLE wsock_mtx; - HANDLE wsock_evt; - bool init_events (); - int wait_for_events (const long event_mask, const DWORD flags); - void release_events (); - public: - const HANDLE wsock_event () const { return wsock_evt; } - int evaluate_events (const long event_mask, long &events, const bool erase); - const LONG serial_number () const { return wsock_events->serial_number; } - protected: int _rmem; int _wmem; @@ -527,56 +515,30 @@ class fhandler_socket: public fhandler_base DWORD &rcvtimeo () { return _rcvtimeo; } DWORD &sndtimeo () { return _sndtimeo; } - protected: - struct _WSAPROTOCOL_INFOW *prot_info_ptr; - protected: struct status_flags { unsigned async_io : 1; /* async I/O */ unsigned saw_shutdown_read : 1; /* Socket saw a SHUT_RD */ unsigned saw_shutdown_write : 1; /* Socket saw a SHUT_WR */ - unsigned saw_reuseaddr : 1; /* Socket saw SO_REUSEADDR call */ unsigned connect_state : 3; - unsigned no_getpeereid : 1; public: status_flags () : async_io (0), saw_shutdown_read (0), saw_shutdown_write (0), - connect_state (unconnected), no_getpeereid (0) + connect_state (unconnected) {} } status; - -#ifdef __INSIDE_CYGWIN_NET__ - int set_socket_handle (SOCKET sock, int af, int type, int flags); -#endif + public: + IMPLEMENT_STATUS_FLAG (bool, async_io) + IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_read) + IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_write) + IMPLEMENT_STATUS_FLAG (conn_state, connect_state) public: fhandler_socket (); ~fhandler_socket (); -/* Originally get_socket returned an int, which is not a good idea - to cast a handle to on 64 bit. The right type here is very certainly - SOCKET instead. On the other hand, we don't want to have to include - winsock.h just to build fhandler.h. Therefore we define get_socket - now only when building network related code. */ -#ifdef __INSIDE_CYGWIN_NET__ - SOCKET get_socket () { return (SOCKET) get_handle(); } -#endif fhandler_socket *is_socket () { return this; } - IMPLEMENT_STATUS_FLAG (bool, async_io) - IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_read) - IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_write) - IMPLEMENT_STATUS_FLAG (bool, saw_reuseaddr) - IMPLEMENT_STATUS_FLAG (conn_state, connect_state) - IMPLEMENT_STATUS_FLAG (bool, no_getpeereid) - - bool need_fixup_before () const {return prot_info_ptr != NULL;} - void set_close_on_exec (bool val); - void init_fixup_before (); - int fixup_before_fork_exec (DWORD); - void fixup_after_fork (HANDLE); - void fixup_after_exec (); - int dup (fhandler_base *child, int); char *get_proc_fd_name (char *buf); virtual int socket (int af, int type, int protocol, int flags) = 0; @@ -633,14 +595,96 @@ class fhandler_socket: public fhandler_base virtual select_record *select_except (select_stuff *) = 0; }; -class fhandler_socket_inet: public fhandler_socket +/* Encapsulate wsock-based socket classes fhandler_socket_inet and + fhandler_socket_local during development of fhandler_socket_unix. + TODO: Perhaps we should keep it that way, under the assumption that + the Windows 10 AF_UNIX class will eventually get useful at one point. */ +class fhandler_socket_wsock: public fhandler_socket +{ + protected: + virtual int af_local_connect () = 0; + + protected: + wsa_event *wsock_events; + HANDLE wsock_mtx; + HANDLE wsock_evt; + bool init_events (); + int wait_for_events (const long event_mask, const DWORD flags); + void release_events (); + public: + const HANDLE wsock_event () const { return wsock_evt; } + int evaluate_events (const long event_mask, long &events, const bool erase); + const LONG serial_number () const { return wsock_events->serial_number; } + + protected: + struct _WSAPROTOCOL_INFOW *prot_info_ptr; + public: + bool need_fixup_before () const {return prot_info_ptr != NULL;} + void set_close_on_exec (bool val); + void init_fixup_before (); + int fixup_before_fork_exec (DWORD); + void fixup_after_fork (HANDLE); + void fixup_after_exec (); + int dup (fhandler_base *child, int); + +#ifdef __INSIDE_CYGWIN_NET__ + protected: + int set_socket_handle (SOCKET sock, int af, int type, int flags); + public: + /* Originally get_socket returned an int, which is not a good idea + to cast a handle to on 64 bit. The right type here is very certainly + SOCKET instead. On the other hand, we don't want to have to include + winsock.h just to build fhandler.h. Therefore we define get_socket + now only when building network related code. */ + SOCKET get_socket () { return (SOCKET) get_handle(); } +#endif + + protected: + struct status_flags + { + unsigned saw_reuseaddr : 1; /* Socket saw SO_REUSEADDR call */ + public: + status_flags () : saw_reuseaddr (0) {} + } status; + public: + IMPLEMENT_STATUS_FLAG (bool, saw_reuseaddr) + + protected: + virtual ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg) = 0; + ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); + + public: + fhandler_socket_wsock (); + ~fhandler_socket_wsock (); + + fhandler_socket_wsock *is_wsock_socket () { return this; } + + ssize_t recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen); + ssize_t recvmsg (struct msghdr *msg, int flags); + void __reg3 read (void *ptr, size_t& len); + ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1); + ssize_t __stdcall write (const void *ptr, size_t len); + ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int shutdown (int how); + int close (); + + int ioctl (unsigned int cmd, void *); + int fcntl (int cmd, intptr_t); + + /* select.cc */ + select_record *select_read (select_stuff *); + select_record *select_write (select_stuff *); + select_record *select_except (select_stuff *); +}; + +class fhandler_socket_inet: public fhandler_socket_wsock { protected: int af_local_connect () { return 0; } - private: - inline ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); - inline ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); + protected: + ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); public: fhandler_socket_inet (); @@ -653,31 +697,14 @@ class fhandler_socket_inet: public fhandler_socket int connect (const struct sockaddr *name, int namelen); int getsockname (struct sockaddr *name, int *namelen); int getpeername (struct sockaddr *name, int *namelen); - int shutdown (int how); - int close (); - ssize_t recvfrom (void *ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen); - ssize_t recvmsg (struct msghdr *msg, int flags); - void __reg3 read (void *ptr, size_t& len); - ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1); ssize_t sendto (const void *ptr, size_t len, int flags, const struct sockaddr *to, int tolen); ssize_t sendmsg (const struct msghdr *msg, int flags); - ssize_t __stdcall write (const void *ptr, size_t len); - ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); int setsockopt (int level, int optname, const void *optval, __socklen_t optlen); int getsockopt (int level, int optname, const void *optval, __socklen_t *optlen); - int ioctl (unsigned int cmd, void *); - int fcntl (int cmd, intptr_t); - - /* select.cc */ - select_record *select_read (select_stuff *); - select_record *select_write (select_stuff *); - select_record *select_except (select_stuff *); - /* from here on: CLONING */ fhandler_socket_inet (void *) {} @@ -697,7 +724,7 @@ class fhandler_socket_inet: public fhandler_socket } }; -class fhandler_socket_local: public fhandler_socket +class fhandler_socket_local: public fhandler_socket_wsock { protected: char *sun_path; @@ -729,9 +756,18 @@ class fhandler_socket_local: public fhandler_socket int af_local_set_no_getpeereid (); void af_local_set_sockpair_cred (); - private: - inline ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); - inline ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); + protected: + ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg); + + protected: + struct status_flags + { + unsigned no_getpeereid : 1; + public: + status_flags () : no_getpeereid (0) {} + } status; + public: + IMPLEMENT_STATUS_FLAG (bool, no_getpeereid) public: fhandler_socket_local (); @@ -748,27 +784,15 @@ class fhandler_socket_local: public fhandler_socket int connect (const struct sockaddr *name, int namelen); int getsockname (struct sockaddr *name, int *namelen); int getpeername (struct sockaddr *name, int *namelen); - int shutdown (int how); - int close (); int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); - ssize_t recvfrom (void *ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen); - ssize_t recvmsg (struct msghdr *msg, int flags); - void __reg3 read (void *ptr, size_t& len); - ssize_t __stdcall readv (const struct iovec *, int iovcnt, ssize_t tot = -1); ssize_t sendto (const void *ptr, size_t len, int flags, const struct sockaddr *to, int tolen); ssize_t sendmsg (const struct msghdr *msg, int flags); - ssize_t __stdcall write (const void *ptr, size_t len); - ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); int setsockopt (int level, int optname, const void *optval, __socklen_t optlen); int getsockopt (int level, int optname, const void *optval, __socklen_t *optlen); - int ioctl (unsigned int cmd, void *); - int fcntl (int cmd, intptr_t); - int __reg2 fstat (struct stat *buf); int __reg2 fstatvfs (struct statvfs *buf); int __reg1 fchmod (mode_t newmode); @@ -776,11 +800,6 @@ class fhandler_socket_local: public fhandler_socket int __reg3 facl (int, int, struct acl *); int __reg2 link (const char *); - /* select.cc */ - select_record *select_read (select_stuff *); - select_record *select_write (select_stuff *); - select_record *select_except (select_stuff *); - /* from here on: CLONING */ fhandler_socket_local (void *) {} @@ -2357,7 +2376,6 @@ typedef union char __pty_master[sizeof (fhandler_pty_master)]; char __registry[sizeof (fhandler_registry)]; char __serial[sizeof (fhandler_serial)]; - char __socket[sizeof (fhandler_socket)]; char __socket_inet[sizeof (fhandler_socket_inet)]; char __socket_local[sizeof (fhandler_socket_local)]; char __termios[sizeof (fhandler_termios)]; diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 0cdf6fa69..292e648c8 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -60,573 +60,14 @@ fhandler_socket::fhandler_socket () : uid (myself->uid), gid (myself->gid), mode (S_IFSOCK | S_IRWXU | S_IRWXG | S_IRWXO), - wsock_events (NULL), - wsock_mtx (NULL), - wsock_evt (NULL), _rcvtimeo (INFINITE), _sndtimeo (INFINITE), - prot_info_ptr (NULL), status () { - need_fork_fixup (true); } fhandler_socket::~fhandler_socket () { - if (prot_info_ptr) - cfree (prot_info_ptr); -} - -int -fhandler_socket::set_socket_handle (SOCKET sock, int af, int type, int flags) -{ - DWORD hdl_flags; - bool lsp_fixup = false; - - /* Usually sockets are inheritable IFS objects. Unfortunately some virus - scanners or other network-oriented software replace normal sockets - with their own kind, which is running through a filter driver called - "layered service provider" (LSP) which, fortunately, are deprecated. - - LSP sockets are not kernel objects. They are typically not marked as - inheritable, nor are they IFS handles. They are in fact not inheritable - to child processes, and it does not help to mark them inheritable via - SetHandleInformation. Subsequent socket calls in the child process fail - with error 10038, WSAENOTSOCK. - - There's a neat way to workaround these annoying LSP sockets. WSAIoctl - allows to fetch the underlying base socket, which is a normal, inheritable - IFS handle. So we fetch the base socket, duplicate it, and close the - original socket. Now we have a standard IFS socket which (hopefully) - works as expected. - - If that doesn't work for some reason, mark the sockets for duplication - via WSADuplicateSocket/WSASocket. This requires to start the child - process in SUSPENDED state so we only do this if really necessary. */ - if (!GetHandleInformation ((HANDLE) sock, &hdl_flags) - || !(hdl_flags & HANDLE_FLAG_INHERIT)) - { - int ret; - SOCKET base_sock; - DWORD bret; - - lsp_fixup = true; - debug_printf ("LSP handle: %p", sock); - ret = WSAIoctl (sock, SIO_BASE_HANDLE, NULL, 0, (void *) &base_sock, - sizeof (base_sock), &bret, NULL, NULL); - if (ret) - debug_printf ("WSAIoctl: %u", WSAGetLastError ()); - else if (base_sock != sock) - { - if (GetHandleInformation ((HANDLE) base_sock, &hdl_flags) - && (flags & HANDLE_FLAG_INHERIT)) - { - if (!DuplicateHandle (GetCurrentProcess (), (HANDLE) base_sock, - GetCurrentProcess (), (PHANDLE) &base_sock, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - debug_printf ("DuplicateHandle failed, %E"); - else - { - ::closesocket (sock); - sock = base_sock; - lsp_fixup = false; - } - } - } - } - set_addr_family (af); - set_socket_type (type); - if (flags & SOCK_NONBLOCK) - set_nonblocking (true); - if (flags & SOCK_CLOEXEC) - set_close_on_exec (true); - set_io_handle ((HANDLE) sock); - if (!init_events ()) - return -1; - if (lsp_fixup) - init_fixup_before (); - set_flags (O_RDWR | O_BINARY); - set_unique_id (); - if (get_socket_type () == SOCK_DGRAM) - { - /* Workaround the problem that a missing listener on a UDP socket - in a call to sendto will result in select/WSAEnumNetworkEvents - reporting that the socket has pending data and a subsequent call - to recvfrom will return -1 with error set to WSAECONNRESET. - - This problem is a regression introduced in Windows 2000. - Instead of fixing the problem, a new socket IOCTL code has - been added, see http://support.microsoft.com/kb/263823 */ - BOOL cr = FALSE; - DWORD blen; - if (WSAIoctl (sock, SIO_UDP_CONNRESET, &cr, sizeof cr, NULL, 0, - &blen, NULL, NULL) == SOCKET_ERROR) - debug_printf ("Reset SIO_UDP_CONNRESET: WinSock error %u", - WSAGetLastError ()); - } -#ifdef __x86_64__ - rmem () = 212992; - wmem () = 212992; -#else - rmem () = 64512; - wmem () = 64512; -#endif - return 0; -} - -/* Maximum number of concurrently opened sockets from all Cygwin processes - per session. Note that shared sockets (through dup/fork/exec) are - counted as one socket. */ -#define NUM_SOCKS 2048U - -#define LOCK_EVENTS \ - if (wsock_mtx && \ - WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) \ - { - -#define UNLOCK_EVENTS \ - ReleaseMutex (wsock_mtx); \ - } - -static wsa_event wsa_events[NUM_SOCKS] __attribute__((section (".cygwin_dll_common"), shared)); - -static LONG socket_serial_number __attribute__((section (".cygwin_dll_common"), shared)); - -static HANDLE wsa_slot_mtx; - -static PWCHAR -sock_shared_name (PWCHAR buf, LONG num) -{ - __small_swprintf (buf, L"socket.%d", num); - return buf; -} - -static wsa_event * -search_wsa_event_slot (LONG new_serial_number) -{ - WCHAR name[32], searchname[32]; - UNICODE_STRING uname; - OBJECT_ATTRIBUTES attr; - NTSTATUS status; - - if (!wsa_slot_mtx) - { - RtlInitUnicodeString (&uname, sock_shared_name (name, 0)); - InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF, - get_session_parent_dir (), - everyone_sd (CYG_MUTANT_ACCESS)); - status = NtCreateMutant (&wsa_slot_mtx, CYG_MUTANT_ACCESS, &attr, FALSE); - if (!NT_SUCCESS (status)) - api_fatal ("Couldn't create/open shared socket mutex %S, %y", - &uname, status); - } - switch (WaitForSingleObject (wsa_slot_mtx, INFINITE)) - { - case WAIT_OBJECT_0: - case WAIT_ABANDONED: - break; - default: - api_fatal ("WFSO failed for shared socket mutex, %E"); - break; - } - unsigned int slot = new_serial_number % NUM_SOCKS; - while (wsa_events[slot].serial_number) - { - HANDLE searchmtx; - RtlInitUnicodeString (&uname, sock_shared_name (searchname, - wsa_events[slot].serial_number)); - InitializeObjectAttributes (&attr, &uname, 0, get_session_parent_dir (), - NULL); - status = NtOpenMutant (&searchmtx, READ_CONTROL, &attr); - if (!NT_SUCCESS (status)) - break; - /* Mutex still exists, attached socket is active, try next slot. */ - NtClose (searchmtx); - slot = (slot + 1) % NUM_SOCKS; - if (slot == (new_serial_number % NUM_SOCKS)) - { - /* Did the whole array once. Too bad. */ - debug_printf ("No free socket slot"); - ReleaseMutex (wsa_slot_mtx); - return NULL; - } - } - memset (&wsa_events[slot], 0, sizeof (wsa_event)); - wsa_events[slot].serial_number = new_serial_number; - ReleaseMutex (wsa_slot_mtx); - return wsa_events + slot; -} - -bool -fhandler_socket::init_events () -{ - LONG new_serial_number; - WCHAR name[32]; - UNICODE_STRING uname; - OBJECT_ATTRIBUTES attr; - NTSTATUS status; - - do - { - new_serial_number = - InterlockedIncrement (&socket_serial_number); - if (!new_serial_number) /* 0 is reserved for global mutex */ - InterlockedIncrement (&socket_serial_number); - set_ino (new_serial_number); - RtlInitUnicodeString (&uname, sock_shared_name (name, new_serial_number)); - InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF, - get_session_parent_dir (), - everyone_sd (CYG_MUTANT_ACCESS)); - status = NtCreateMutant (&wsock_mtx, CYG_MUTANT_ACCESS, &attr, FALSE); - if (!NT_SUCCESS (status)) - { - debug_printf ("NtCreateMutant(%S), %y", &uname, status); - set_errno (ENOBUFS); - return false; - } - if (status == STATUS_OBJECT_NAME_EXISTS) - NtClose (wsock_mtx); - } - while (status == STATUS_OBJECT_NAME_EXISTS); - if ((wsock_evt = CreateEvent (&sec_all, TRUE, FALSE, NULL)) - == WSA_INVALID_EVENT) - { - debug_printf ("CreateEvent, %E"); - set_errno (ENOBUFS); - NtClose (wsock_mtx); - return false; - } - if (WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK) == SOCKET_ERROR) - { - debug_printf ("WSAEventSelect, %E"); - set_winsock_errno (); - NtClose (wsock_evt); - NtClose (wsock_mtx); - return false; - } - if (!(wsock_events = search_wsa_event_slot (new_serial_number))) - { - set_errno (ENOBUFS); - NtClose (wsock_evt); - NtClose (wsock_mtx); - return false; - } - if (get_socket_type () == SOCK_DGRAM) - wsock_events->events = FD_WRITE; - return true; -} - -int -fhandler_socket::evaluate_events (const long event_mask, long &events, - const bool erase) -{ - int ret = 0; - long events_now = 0; - - WSANETWORKEVENTS evts = { 0 }; - if (!(WSAEnumNetworkEvents (get_socket (), wsock_evt, &evts))) - { - if (evts.lNetworkEvents) - { - LOCK_EVENTS; - wsock_events->events |= evts.lNetworkEvents; - events_now = (wsock_events->events & event_mask); - if (evts.lNetworkEvents & FD_CONNECT) - { - wsock_events->connect_errorcode = evts.iErrorCode[FD_CONNECT_BIT]; - - /* Setting the connect_state and calling the AF_LOCAL handshake - here allows to handle this stuff from a single point. This - is independent of FD_CONNECT being requested. Consider a - server calling connect(2) and then immediately poll(2) with - only polling for POLLIN (example: postfix), or select(2) just - asking for descriptors ready to read. - - Something weird occurs in Winsock: If you fork off and call - recv/send on the duplicated, already connected socket, another - FD_CONNECT event is generated in the child process. This - would trigger a call to af_local_connect which obviously fail. - Avoid this by calling set_connect_state only if connect_state - is connect_pending. */ - if (connect_state () == connect_pending) - { - if (wsock_events->connect_errorcode) - connect_state (connect_failed); - else if (af_local_connect ()) - { - wsock_events->connect_errorcode = WSAGetLastError (); - connect_state (connect_failed); - } - else - connect_state (connected); - } - } - UNLOCK_EVENTS; - if ((evts.lNetworkEvents & FD_OOB) && wsock_events->owner) - kill (wsock_events->owner, SIGURG); - } - } - - LOCK_EVENTS; - if ((events = events_now) != 0 - || (events = (wsock_events->events & event_mask)) != 0) - { - if (events & FD_CONNECT) - { - int wsa_err = wsock_events->connect_errorcode; - if (wsa_err) - { - /* CV 2014-04-23: This is really weird. If you call connect - asynchronously on a socket and then select, an error like - "Connection refused" is set in the event and in the SO_ERROR - socket option. If you call connect, then dup, then select, - the error is set in the event, but not in the SO_ERROR socket - option, despite the dup'ed socket handle referring to the same - socket. We're trying to workaround this problem here by - taking the connect errorcode from the event and write it back - into the SO_ERROR socket option. - - CV 2014-06-16: Call WSASetLastError *after* setsockopt since, - apparently, setsockopt sets the last WSA error code to 0 on - success. */ - ::setsockopt (get_socket (), SOL_SOCKET, SO_ERROR, - (const char *) &wsa_err, sizeof wsa_err); - WSASetLastError (wsa_err); - ret = SOCKET_ERROR; - } - else - wsock_events->events |= FD_WRITE; - wsock_events->events &= ~FD_CONNECT; - wsock_events->connect_errorcode = 0; - } - /* This test makes accept/connect behave as on Linux when accept/connect - is called on a socket for which shutdown has been called. The second - half of this code is in the shutdown method. */ - if (events & FD_CLOSE) - { - if ((event_mask & FD_ACCEPT) && saw_shutdown_read ()) - { - WSASetLastError (WSAEINVAL); - ret = SOCKET_ERROR; - } - if (event_mask & FD_CONNECT) - { - WSASetLastError (WSAECONNRESET); - ret = SOCKET_ERROR; - } - } - if (erase) - wsock_events->events &= ~(events & ~(FD_WRITE | FD_CLOSE)); - } - UNLOCK_EVENTS; - - return ret; -} - -int -fhandler_socket::wait_for_events (const long event_mask, const DWORD flags) -{ - if (async_io ()) - return 0; - - int ret; - long events = 0; - DWORD wfmo_timeout = 50; - DWORD timeout; - - WSAEVENT ev[3] = { wsock_evt, NULL, NULL }; - wait_signal_arrived here (ev[1]); - DWORD ev_cnt = 2; - if ((ev[2] = pthread::get_cancel_event ()) != NULL) - ++ev_cnt; - - if (is_nonblocking () || (flags & MSG_DONTWAIT)) - timeout = 0; - else if (event_mask & FD_READ) - timeout = rcvtimeo (); - else if (event_mask & FD_WRITE) - timeout = sndtimeo (); - else - timeout = INFINITE; - - while (!(ret = evaluate_events (event_mask, events, !(flags & MSG_PEEK))) - && !events) - { - if (timeout == 0) - { - WSASetLastError (WSAEWOULDBLOCK); - return SOCKET_ERROR; - } - - if (timeout < wfmo_timeout) - wfmo_timeout = timeout; - switch (WSAWaitForMultipleEvents (ev_cnt, ev, FALSE, wfmo_timeout, FALSE)) - { - case WSA_WAIT_TIMEOUT: - case WSA_WAIT_EVENT_0: - if (timeout != INFINITE) - timeout -= wfmo_timeout; - break; - - case WSA_WAIT_EVENT_0 + 1: - if (_my_tls.call_signal_handler ()) - break; - WSASetLastError (WSAEINTR); - return SOCKET_ERROR; - - case WSA_WAIT_EVENT_0 + 2: - pthread::static_cancel_self (); - break; - - default: - /* wsock_evt can be NULL. We're generating the same errno values - as for sockets on which shutdown has been called. */ - if (WSAGetLastError () != WSA_INVALID_HANDLE) - WSASetLastError (WSAEFAULT); - else - WSASetLastError ((event_mask & FD_CONNECT) ? WSAECONNRESET - : WSAEINVAL); - return SOCKET_ERROR; - } - } - return ret; -} - -void -fhandler_socket::release_events () -{ - if (WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) - { - HANDLE evt = wsock_evt; - HANDLE mtx = wsock_mtx; - - wsock_evt = wsock_mtx = NULL; - ReleaseMutex (mtx); - NtClose (evt); - NtClose (mtx); - } -} - -void -fhandler_socket::set_close_on_exec (bool val) -{ - set_no_inheritance (wsock_mtx, val); - set_no_inheritance (wsock_evt, val); - if (need_fixup_before ()) - { - close_on_exec (val); - debug_printf ("set close_on_exec for %s to %d", get_name (), val); - } - else - fhandler_base::set_close_on_exec (val); -} - -/* Called if a freshly created socket is not inheritable. In that case we - have to use fixup_before_fork_exec. See comment in set_socket_handle for - a description of the problem. */ -void -fhandler_socket::init_fixup_before () -{ - prot_info_ptr = (LPWSAPROTOCOL_INFOW) - cmalloc_abort (HEAP_BUF, sizeof (WSAPROTOCOL_INFOW)); - cygheap->fdtab.inc_need_fixup_before (); -} - -int -fhandler_socket::fixup_before_fork_exec (DWORD win_pid) -{ - SOCKET ret = WSADuplicateSocketW (get_socket (), win_pid, prot_info_ptr); - if (ret) - set_winsock_errno (); - else - debug_printf ("WSADuplicateSocket succeeded (%x)", prot_info_ptr->dwProviderReserved); - return (int) ret; -} - -void -fhandler_socket::fixup_after_fork (HANDLE parent) -{ - fork_fixup (parent, wsock_mtx, "wsock_mtx"); - fork_fixup (parent, wsock_evt, "wsock_evt"); - - if (!need_fixup_before ()) - { - fhandler_base::fixup_after_fork (parent); - return; - } - - SOCKET new_sock = WSASocketW (FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, - FROM_PROTOCOL_INFO, prot_info_ptr, 0, - WSA_FLAG_OVERLAPPED); - if (new_sock == INVALID_SOCKET) - { - set_winsock_errno (); - set_io_handle ((HANDLE) INVALID_SOCKET); - } - else - { - /* Even though the original socket was not inheritable, the duplicated - socket is potentially inheritable again. */ - SetHandleInformation ((HANDLE) new_sock, HANDLE_FLAG_INHERIT, 0); - set_io_handle ((HANDLE) new_sock); - debug_printf ("WSASocket succeeded (%p)", new_sock); - } -} - -void -fhandler_socket::fixup_after_exec () -{ - if (need_fixup_before () && !close_on_exec ()) - fixup_after_fork (NULL); -} - -int -fhandler_socket::dup (fhandler_base *child, int flags) -{ - debug_printf ("here"); - fhandler_socket *fhs = (fhandler_socket *) child; - - if (!DuplicateHandle (GetCurrentProcess (), wsock_mtx, - GetCurrentProcess (), &fhs->wsock_mtx, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - { - __seterrno (); - return -1; - } - if (!DuplicateHandle (GetCurrentProcess (), wsock_evt, - GetCurrentProcess (), &fhs->wsock_evt, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - { - __seterrno (); - NtClose (fhs->wsock_mtx); - return -1; - } - if (!need_fixup_before ()) - { - int ret = fhandler_base::dup (child, flags); - if (ret) - { - NtClose (fhs->wsock_evt); - NtClose (fhs->wsock_mtx); - } - return ret; - } - - cygheap->user.deimpersonate (); - fhs->init_fixup_before (); - fhs->set_io_handle (get_io_handle ()); - int ret = fhs->fixup_before_fork_exec (GetCurrentProcessId ()); - cygheap->user.reimpersonate (); - if (!ret) - { - fhs->fixup_after_fork (GetCurrentProcess ()); - if (fhs->get_io_handle() != (HANDLE) INVALID_SOCKET) - return 0; - } - cygheap->fdtab.dec_need_fixup_before (); - NtClose (fhs->wsock_evt); - NtClose (fhs->wsock_mtx); - return -1; } char * diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index b2bc1934a..0668c1063 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -59,6 +59,89 @@ ReleaseMutex (wsock_mtx); \ } +/* Maximum number of concurrently opened sockets from all Cygwin processes + per session. Note that shared sockets (through dup/fork/exec) are + counted as one socket. */ +#define NUM_SOCKS 2048U + +#define LOCK_EVENTS \ + if (wsock_mtx && \ + WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) \ + { + +#define UNLOCK_EVENTS \ + ReleaseMutex (wsock_mtx); \ + } + +static wsa_event wsa_events[NUM_SOCKS] __attribute__((section (".cygwin_dll_common"), shared)); + +static LONG socket_serial_number __attribute__((section (".cygwin_dll_common"), shared)); + +static HANDLE wsa_slot_mtx; + +static PWCHAR +sock_shared_name (PWCHAR buf, LONG num) +{ + __small_swprintf (buf, L"socket.%d", num); + return buf; +} + +static wsa_event * +search_wsa_event_slot (LONG new_serial_number) +{ + WCHAR name[32], searchname[32]; + UNICODE_STRING uname; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + if (!wsa_slot_mtx) + { + RtlInitUnicodeString (&uname, sock_shared_name (name, 0)); + InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF, + get_session_parent_dir (), + everyone_sd (CYG_MUTANT_ACCESS)); + status = NtCreateMutant (&wsa_slot_mtx, CYG_MUTANT_ACCESS, &attr, FALSE); + if (!NT_SUCCESS (status)) + api_fatal ("Couldn't create/open shared socket mutex %S, %y", + &uname, status); + } + switch (WaitForSingleObject (wsa_slot_mtx, INFINITE)) + { + case WAIT_OBJECT_0: + case WAIT_ABANDONED: + break; + default: + api_fatal ("WFSO failed for shared socket mutex, %E"); + break; + } + unsigned int slot = new_serial_number % NUM_SOCKS; + while (wsa_events[slot].serial_number) + { + HANDLE searchmtx; + RtlInitUnicodeString (&uname, sock_shared_name (searchname, + wsa_events[slot].serial_number)); + InitializeObjectAttributes (&attr, &uname, 0, get_session_parent_dir (), + NULL); + status = NtOpenMutant (&searchmtx, READ_CONTROL, &attr); + if (!NT_SUCCESS (status)) + break; + /* Mutex still exists, attached socket is active, try next slot. */ + NtClose (searchmtx); + slot = (slot + 1) % NUM_SOCKS; + if (slot == (new_serial_number % NUM_SOCKS)) + { + /* Did the whole array once. Too bad. */ + debug_printf ("No free socket slot"); + ReleaseMutex (wsa_slot_mtx); + return NULL; + } + } + memset (&wsa_events[slot], 0, sizeof (wsa_event)); + wsa_events[slot].serial_number = new_serial_number; + ReleaseMutex (wsa_slot_mtx); + return wsa_events + slot; +} + /* cygwin internal: map sockaddr into internet domain address */ static int get_inet_addr_inet (const struct sockaddr *in, int inlen, @@ -123,8 +206,496 @@ convert_ws1_ip_optname (int optname) : ws2_optname[optname]; } +fhandler_socket_wsock::fhandler_socket_wsock () : + fhandler_socket (), + wsock_events (NULL), + wsock_mtx (NULL), + wsock_evt (NULL), + prot_info_ptr (NULL), + status () +{ + need_fork_fixup (true); +} + +fhandler_socket_wsock::~fhandler_socket_wsock () +{ + if (prot_info_ptr) + cfree (prot_info_ptr); +} + +bool +fhandler_socket_wsock::init_events () +{ + LONG new_serial_number; + WCHAR name[32]; + UNICODE_STRING uname; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + do + { + new_serial_number = + InterlockedIncrement (&socket_serial_number); + if (!new_serial_number) /* 0 is reserved for global mutex */ + InterlockedIncrement (&socket_serial_number); + set_ino (new_serial_number); + RtlInitUnicodeString (&uname, sock_shared_name (name, new_serial_number)); + InitializeObjectAttributes (&attr, &uname, OBJ_INHERIT | OBJ_OPENIF, + get_session_parent_dir (), + everyone_sd (CYG_MUTANT_ACCESS)); + status = NtCreateMutant (&wsock_mtx, CYG_MUTANT_ACCESS, &attr, FALSE); + if (!NT_SUCCESS (status)) + { + debug_printf ("NtCreateMutant(%S), %y", &uname, status); + set_errno (ENOBUFS); + return false; + } + if (status == STATUS_OBJECT_NAME_EXISTS) + NtClose (wsock_mtx); + } + while (status == STATUS_OBJECT_NAME_EXISTS); + if ((wsock_evt = CreateEvent (&sec_all, TRUE, FALSE, NULL)) + == WSA_INVALID_EVENT) + { + debug_printf ("CreateEvent, %E"); + set_errno (ENOBUFS); + NtClose (wsock_mtx); + return false; + } + if (WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK) == SOCKET_ERROR) + { + debug_printf ("WSAEventSelect, %E"); + set_winsock_errno (); + NtClose (wsock_evt); + NtClose (wsock_mtx); + return false; + } + if (!(wsock_events = search_wsa_event_slot (new_serial_number))) + { + set_errno (ENOBUFS); + NtClose (wsock_evt); + NtClose (wsock_mtx); + return false; + } + if (get_socket_type () == SOCK_DGRAM) + wsock_events->events = FD_WRITE; + return true; +} + +int +fhandler_socket_wsock::evaluate_events (const long event_mask, long &events, + const bool erase) +{ + int ret = 0; + long events_now = 0; + + WSANETWORKEVENTS evts = { 0 }; + if (!(WSAEnumNetworkEvents (get_socket (), wsock_evt, &evts))) + { + if (evts.lNetworkEvents) + { + LOCK_EVENTS; + wsock_events->events |= evts.lNetworkEvents; + events_now = (wsock_events->events & event_mask); + if (evts.lNetworkEvents & FD_CONNECT) + { + wsock_events->connect_errorcode = evts.iErrorCode[FD_CONNECT_BIT]; + + /* Setting the connect_state and calling the AF_LOCAL handshake + here allows to handle this stuff from a single point. This + is independent of FD_CONNECT being requested. Consider a + server calling connect(2) and then immediately poll(2) with + only polling for POLLIN (example: postfix), or select(2) just + asking for descriptors ready to read. + + Something weird occurs in Winsock: If you fork off and call + recv/send on the duplicated, already connected socket, another + FD_CONNECT event is generated in the child process. This + would trigger a call to af_local_connect which obviously fail. + Avoid this by calling set_connect_state only if connect_state + is connect_pending. */ + if (connect_state () == connect_pending) + { + if (wsock_events->connect_errorcode) + connect_state (connect_failed); + else if (af_local_connect ()) + { + wsock_events->connect_errorcode = WSAGetLastError (); + connect_state (connect_failed); + } + else + connect_state (connected); + } + } + UNLOCK_EVENTS; + if ((evts.lNetworkEvents & FD_OOB) && wsock_events->owner) + kill (wsock_events->owner, SIGURG); + } + } + + LOCK_EVENTS; + if ((events = events_now) != 0 + || (events = (wsock_events->events & event_mask)) != 0) + { + if (events & FD_CONNECT) + { + int wsa_err = wsock_events->connect_errorcode; + if (wsa_err) + { + /* CV 2014-04-23: This is really weird. If you call connect + asynchronously on a socket and then select, an error like + "Connection refused" is set in the event and in the SO_ERROR + socket option. If you call connect, then dup, then select, + the error is set in the event, but not in the SO_ERROR socket + option, despite the dup'ed socket handle referring to the same + socket. We're trying to workaround this problem here by + taking the connect errorcode from the event and write it back + into the SO_ERROR socket option. + + CV 2014-06-16: Call WSASetLastError *after* setsockopt since, + apparently, setsockopt sets the last WSA error code to 0 on + success. */ + ::setsockopt (get_socket (), SOL_SOCKET, SO_ERROR, + (const char *) &wsa_err, sizeof wsa_err); + WSASetLastError (wsa_err); + ret = SOCKET_ERROR; + } + else + wsock_events->events |= FD_WRITE; + wsock_events->events &= ~FD_CONNECT; + wsock_events->connect_errorcode = 0; + } + /* This test makes accept/connect behave as on Linux when accept/connect + is called on a socket for which shutdown has been called. The second + half of this code is in the shutdown method. */ + if (events & FD_CLOSE) + { + if ((event_mask & FD_ACCEPT) && saw_shutdown_read ()) + { + WSASetLastError (WSAEINVAL); + ret = SOCKET_ERROR; + } + if (event_mask & FD_CONNECT) + { + WSASetLastError (WSAECONNRESET); + ret = SOCKET_ERROR; + } + } + if (erase) + wsock_events->events &= ~(events & ~(FD_WRITE | FD_CLOSE)); + } + UNLOCK_EVENTS; + + return ret; +} + +int +fhandler_socket_wsock::wait_for_events (const long event_mask, + const DWORD flags) +{ + if (async_io ()) + return 0; + + int ret; + long events = 0; + DWORD wfmo_timeout = 50; + DWORD timeout; + + WSAEVENT ev[3] = { wsock_evt, NULL, NULL }; + wait_signal_arrived here (ev[1]); + DWORD ev_cnt = 2; + if ((ev[2] = pthread::get_cancel_event ()) != NULL) + ++ev_cnt; + + if (is_nonblocking () || (flags & MSG_DONTWAIT)) + timeout = 0; + else if (event_mask & FD_READ) + timeout = rcvtimeo (); + else if (event_mask & FD_WRITE) + timeout = sndtimeo (); + else + timeout = INFINITE; + + while (!(ret = evaluate_events (event_mask, events, !(flags & MSG_PEEK))) + && !events) + { + if (timeout == 0) + { + WSASetLastError (WSAEWOULDBLOCK); + return SOCKET_ERROR; + } + + if (timeout < wfmo_timeout) + wfmo_timeout = timeout; + switch (WSAWaitForMultipleEvents (ev_cnt, ev, FALSE, wfmo_timeout, FALSE)) + { + case WSA_WAIT_TIMEOUT: + case WSA_WAIT_EVENT_0: + if (timeout != INFINITE) + timeout -= wfmo_timeout; + break; + + case WSA_WAIT_EVENT_0 + 1: + if (_my_tls.call_signal_handler ()) + break; + WSASetLastError (WSAEINTR); + return SOCKET_ERROR; + + case WSA_WAIT_EVENT_0 + 2: + pthread::static_cancel_self (); + break; + + default: + /* wsock_evt can be NULL. We're generating the same errno values + as for sockets on which shutdown has been called. */ + if (WSAGetLastError () != WSA_INVALID_HANDLE) + WSASetLastError (WSAEFAULT); + else + WSASetLastError ((event_mask & FD_CONNECT) ? WSAECONNRESET + : WSAEINVAL); + return SOCKET_ERROR; + } + } + return ret; +} + +void +fhandler_socket_wsock::release_events () +{ + if (WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) + { + HANDLE evt = wsock_evt; + HANDLE mtx = wsock_mtx; + + wsock_evt = wsock_mtx = NULL; + ReleaseMutex (mtx); + NtClose (evt); + NtClose (mtx); + } +} + +void +fhandler_socket_wsock::set_close_on_exec (bool val) +{ + set_no_inheritance (wsock_mtx, val); + set_no_inheritance (wsock_evt, val); + if (need_fixup_before ()) + { + close_on_exec (val); + debug_printf ("set close_on_exec for %s to %d", get_name (), val); + } + else + fhandler_base::set_close_on_exec (val); +} + +/* Called if a freshly created socket is not inheritable. In that case we + have to use fixup_before_fork_exec. See comment in set_socket_handle for + a description of the problem. */ +void +fhandler_socket_wsock::init_fixup_before () +{ + prot_info_ptr = (LPWSAPROTOCOL_INFOW) + cmalloc_abort (HEAP_BUF, sizeof (WSAPROTOCOL_INFOW)); + cygheap->fdtab.inc_need_fixup_before (); +} + +int +fhandler_socket_wsock::fixup_before_fork_exec (DWORD win_pid) +{ + SOCKET ret = WSADuplicateSocketW (get_socket (), win_pid, prot_info_ptr); + if (ret) + set_winsock_errno (); + else + debug_printf ("WSADuplicateSocket succeeded (%x)", prot_info_ptr->dwProviderReserved); + return (int) ret; +} + +void +fhandler_socket_wsock::fixup_after_fork (HANDLE parent) +{ + fork_fixup (parent, wsock_mtx, "wsock_mtx"); + fork_fixup (parent, wsock_evt, "wsock_evt"); + + if (!need_fixup_before ()) + { + fhandler_base::fixup_after_fork (parent); + return; + } + + SOCKET new_sock = WSASocketW (FROM_PROTOCOL_INFO, FROM_PROTOCOL_INFO, + FROM_PROTOCOL_INFO, prot_info_ptr, 0, + WSA_FLAG_OVERLAPPED); + if (new_sock == INVALID_SOCKET) + { + set_winsock_errno (); + set_io_handle ((HANDLE) INVALID_SOCKET); + } + else + { + /* Even though the original socket was not inheritable, the duplicated + socket is potentially inheritable again. */ + SetHandleInformation ((HANDLE) new_sock, HANDLE_FLAG_INHERIT, 0); + set_io_handle ((HANDLE) new_sock); + debug_printf ("WSASocket succeeded (%p)", new_sock); + } +} + +void +fhandler_socket_wsock::fixup_after_exec () +{ + if (need_fixup_before () && !close_on_exec ()) + fixup_after_fork (NULL); +} + +int +fhandler_socket_wsock::dup (fhandler_base *child, int flags) +{ + debug_printf ("here"); + fhandler_socket_wsock *fhs = (fhandler_socket_wsock *) child; + + if (!DuplicateHandle (GetCurrentProcess (), wsock_mtx, + GetCurrentProcess (), &fhs->wsock_mtx, + 0, TRUE, DUPLICATE_SAME_ACCESS)) + { + __seterrno (); + return -1; + } + if (!DuplicateHandle (GetCurrentProcess (), wsock_evt, + GetCurrentProcess (), &fhs->wsock_evt, + 0, TRUE, DUPLICATE_SAME_ACCESS)) + { + __seterrno (); + NtClose (fhs->wsock_mtx); + return -1; + } + if (!need_fixup_before ()) + { + int ret = fhandler_base::dup (child, flags); + if (ret) + { + NtClose (fhs->wsock_evt); + NtClose (fhs->wsock_mtx); + } + return ret; + } + + cygheap->user.deimpersonate (); + fhs->init_fixup_before (); + fhs->set_io_handle (get_io_handle ()); + int ret = fhs->fixup_before_fork_exec (GetCurrentProcessId ()); + cygheap->user.reimpersonate (); + if (!ret) + { + fhs->fixup_after_fork (GetCurrentProcess ()); + if (fhs->get_io_handle() != (HANDLE) INVALID_SOCKET) + return 0; + } + cygheap->fdtab.dec_need_fixup_before (); + NtClose (fhs->wsock_evt); + NtClose (fhs->wsock_mtx); + return -1; +} + +int +fhandler_socket_wsock::set_socket_handle (SOCKET sock, int af, int type, + int flags) +{ + DWORD hdl_flags; + bool lsp_fixup = false; + + /* Usually sockets are inheritable IFS objects. Unfortunately some virus + scanners or other network-oriented software replace normal sockets + with their own kind, which is running through a filter driver called + "layered service provider" (LSP) which, fortunately, are deprecated. + + LSP sockets are not kernel objects. They are typically not marked as + inheritable, nor are they IFS handles. They are in fact not inheritable + to child processes, and it does not help to mark them inheritable via + SetHandleInformation. Subsequent socket calls in the child process fail + with error 10038, WSAENOTSOCK. + + There's a neat way to workaround these annoying LSP sockets. WSAIoctl + allows to fetch the underlying base socket, which is a normal, inheritable + IFS handle. So we fetch the base socket, duplicate it, and close the + original socket. Now we have a standard IFS socket which (hopefully) + works as expected. + + If that doesn't work for some reason, mark the sockets for duplication + via WSADuplicateSocket/WSASocket. This requires to start the child + process in SUSPENDED state so we only do this if really necessary. */ + if (!GetHandleInformation ((HANDLE) sock, &hdl_flags) + || !(hdl_flags & HANDLE_FLAG_INHERIT)) + { + int ret; + SOCKET base_sock; + DWORD bret; + + lsp_fixup = true; + debug_printf ("LSP handle: %p", sock); + ret = WSAIoctl (sock, SIO_BASE_HANDLE, NULL, 0, (void *) &base_sock, + sizeof (base_sock), &bret, NULL, NULL); + if (ret) + debug_printf ("WSAIoctl: %u", WSAGetLastError ()); + else if (base_sock != sock) + { + if (GetHandleInformation ((HANDLE) base_sock, &hdl_flags) + && (flags & HANDLE_FLAG_INHERIT)) + { + if (!DuplicateHandle (GetCurrentProcess (), (HANDLE) base_sock, + GetCurrentProcess (), (PHANDLE) &base_sock, + 0, TRUE, DUPLICATE_SAME_ACCESS)) + debug_printf ("DuplicateHandle failed, %E"); + else + { + ::closesocket (sock); + sock = base_sock; + lsp_fixup = false; + } + } + } + } + set_addr_family (af); + set_socket_type (type); + if (flags & SOCK_NONBLOCK) + set_nonblocking (true); + if (flags & SOCK_CLOEXEC) + set_close_on_exec (true); + set_io_handle ((HANDLE) sock); + if (!init_events ()) + return -1; + if (lsp_fixup) + init_fixup_before (); + set_flags (O_RDWR | O_BINARY); + set_unique_id (); + if (get_socket_type () == SOCK_DGRAM) + { + /* Workaround the problem that a missing listener on a UDP socket + in a call to sendto will result in select/WSAEnumNetworkEvents + reporting that the socket has pending data and a subsequent call + to recvfrom will return -1 with error set to WSAECONNRESET. + + This problem is a regression introduced in Windows 2000. + Instead of fixing the problem, a new socket IOCTL code has + been added, see http://support.microsoft.com/kb/263823 */ + BOOL cr = FALSE; + DWORD blen; + if (WSAIoctl (sock, SIO_UDP_CONNRESET, &cr, sizeof cr, NULL, 0, + &blen, NULL, NULL) == SOCKET_ERROR) + debug_printf ("Reset SIO_UDP_CONNRESET: WinSock error %u", + WSAGetLastError ()); + } +#ifdef __x86_64__ + rmem () = 212992; + wmem () = 212992; +#else + rmem () = 64512; + wmem () = 64512; +#endif + return 0; +} + fhandler_socket_inet::fhandler_socket_inet () : - fhandler_socket () + fhandler_socket_wsock () { } @@ -398,7 +969,7 @@ fhandler_socket_inet::getpeername (struct sockaddr *name, int *namelen) } int -fhandler_socket_inet::shutdown (int how) +fhandler_socket_wsock::shutdown (int how) { int res = ::shutdown (get_socket (), how); @@ -437,7 +1008,7 @@ fhandler_socket_inet::shutdown (int how) } int -fhandler_socket_inet::close () +fhandler_socket_wsock::close () { int res = 0; @@ -458,12 +1029,10 @@ fhandler_socket_inet::close () } WSASetLastError (0); } - - debug_printf ("%d = fhandler_socket::close()", res); return res; } -inline ssize_t +ssize_t fhandler_socket_inet::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) { ssize_t res = 0; @@ -594,8 +1163,8 @@ fhandler_socket_inet::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) } ssize_t -fhandler_socket_inet::recvfrom (void *in_ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen) +fhandler_socket_wsock::recvfrom (void *in_ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen) { char *ptr = (char *) in_ptr; @@ -630,7 +1199,7 @@ fhandler_socket_inet::recvfrom (void *in_ptr, size_t len, int flags, } ssize_t -fhandler_socket_inet::recvmsg (struct msghdr *msg, int flags) +fhandler_socket_wsock::recvmsg (struct msghdr *msg, int flags) { /* Disappointing but true: Even if WSARecvMsg is supported, it's only supported for datagram and raw sockets. */ @@ -665,7 +1234,7 @@ fhandler_socket_inet::recvmsg (struct msghdr *msg, int flags) } void __reg3 -fhandler_socket_inet::read (void *in_ptr, size_t& len) +fhandler_socket_wsock::read (void *in_ptr, size_t& len) { char *ptr = (char *) in_ptr; @@ -692,8 +1261,8 @@ fhandler_socket_inet::read (void *in_ptr, size_t& len) } ssize_t -fhandler_socket_inet::readv (const struct iovec *const iov, const int iovcnt, - ssize_t tot) +fhandler_socket_wsock::readv (const struct iovec *const iov, const int iovcnt, + ssize_t tot) { WSABUF wsabuf[iovcnt]; WSABUF *wsaptr = wsabuf + iovcnt; @@ -707,8 +1276,8 @@ fhandler_socket_inet::readv (const struct iovec *const iov, const int iovcnt, return recv_internal (&wsamsg, false); } -inline ssize_t -fhandler_socket_inet::send_internal (struct _WSAMSG *wsamsg, int flags) +ssize_t +fhandler_socket_wsock::send_internal (struct _WSAMSG *wsamsg, int flags) { ssize_t res = 0; DWORD ret = 0, sum = 0; @@ -891,7 +1460,7 @@ fhandler_socket_inet::sendmsg (const struct msghdr *msg, int flags) } ssize_t -fhandler_socket_inet::write (const void *in_ptr, size_t len) +fhandler_socket_wsock::write (const void *in_ptr, size_t len) { char *ptr = (char *) in_ptr; @@ -917,8 +1486,8 @@ fhandler_socket_inet::write (const void *in_ptr, size_t len) } ssize_t -fhandler_socket_inet::writev (const struct iovec *const iov, const int iovcnt, - ssize_t tot) +fhandler_socket_wsock::writev (const struct iovec *const iov, const int iovcnt, + ssize_t tot) { WSABUF wsabuf[iovcnt]; WSABUF *wsaptr = wsabuf; @@ -1219,7 +1788,7 @@ fhandler_socket_inet::getsockopt (int level, int optname, const void *optval, } int -fhandler_socket_inet::ioctl (unsigned int cmd, void *p) +fhandler_socket_wsock::ioctl (unsigned int cmd, void *p) { int res; @@ -1287,7 +1856,7 @@ fhandler_socket_inet::ioctl (unsigned int cmd, void *p) } int -fhandler_socket_inet::fcntl (int cmd, intptr_t arg) +fhandler_socket_wsock::fcntl (int cmd, intptr_t arg) { int res = 0; diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index 298a378e3..ca3844291 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -221,9 +221,10 @@ get_ext_funcptr (SOCKET sock, void *funcptr) } fhandler_socket_local::fhandler_socket_local () : - fhandler_socket (), + fhandler_socket_wsock (), sun_path (NULL), - peer_sun_path (NULL) + peer_sun_path (NULL), + status () { } @@ -1044,73 +1045,7 @@ fhandler_socket_local::getpeername (struct sockaddr *name, int *namelen) return res; } -int -fhandler_socket_local::shutdown (int how) -{ - int res = ::shutdown (get_socket (), how); - - /* Linux allows to call shutdown for any socket, even if it's not connected. - This also disables to call accept on this socket, if shutdown has been - called with the SHUT_RD or SHUT_RDWR parameter. In contrast, WinSock - only allows to call shutdown on a connected socket. The accept function - is in no way affected. So, what we do here is to fake success, and to - change the event settings so that an FD_CLOSE event is triggered for the - calling Cygwin function. The evaluate_events method handles the call - from accept specially to generate a Linux-compatible behaviour. */ - if (res && WSAGetLastError () != WSAENOTCONN) - set_winsock_errno (); - else - { - res = 0; - switch (how) - { - case SHUT_RD: - saw_shutdown_read (true); - wsock_events->events |= FD_CLOSE; - SetEvent (wsock_evt); - break; - case SHUT_WR: - saw_shutdown_write (true); - break; - case SHUT_RDWR: - saw_shutdown_read (true); - saw_shutdown_write (true); - wsock_events->events |= FD_CLOSE; - SetEvent (wsock_evt); - break; - } - } - return res; -} - -int -fhandler_socket_local::close () -{ - int res = 0; - - release_events (); - while ((res = ::closesocket (get_socket ())) != 0) - { - if (WSAGetLastError () != WSAEWOULDBLOCK) - { - set_winsock_errno (); - res = -1; - break; - } - if (cygwait (10) == WAIT_SIGNALED) - { - set_errno (EINTR); - res = -1; - break; - } - WSASetLastError (0); - } - - debug_printf ("%d = fhandler_socket::close()", res); - return res; -} - -inline ssize_t +ssize_t fhandler_socket_local::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) { ssize_t res = 0; @@ -1279,235 +1214,6 @@ fhandler_socket_local::recv_internal (LPWSAMSG wsamsg, bool use_recvmsg) return ret; } -ssize_t -fhandler_socket_local::recvfrom (void *in_ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen) -{ - char *ptr = (char *) in_ptr; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, - wsabuf, bufcnt, - { 0, NULL }, - (DWORD) flags }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { from, from && fromlen ? *fromlen : 0, - &wsabuf, 1, - { 0, NULL}, - (DWORD) flags }; -#endif - ssize_t ret = recv_internal (&wsamsg, false); - if (fromlen) - *fromlen = wsamsg.namelen; - return ret; -} - -ssize_t -fhandler_socket_local::recvmsg (struct msghdr *msg, int flags) -{ - /* TODO: Descriptor passing on AF_LOCAL sockets. */ - - /* Disappointing but true: Even if WSARecvMsg is supported, it's only - supported for datagram and raw sockets. */ - bool use_recvmsg = true; - if (get_socket_type () == SOCK_STREAM || get_addr_family () == AF_LOCAL) - { - use_recvmsg = false; - msg->msg_controllen = 0; - } - - WSABUF wsabuf[msg->msg_iovlen]; - WSABUF *wsaptr = wsabuf + msg->msg_iovlen; - const struct iovec *iovptr = msg->msg_iov + msg->msg_iovlen; - while (--wsaptr >= wsabuf) - { - wsaptr->len = (--iovptr)->iov_len; - wsaptr->buf = (char *) iovptr->iov_base; - } - WSAMSG wsamsg = { (struct sockaddr *) msg->msg_name, msg->msg_namelen, - wsabuf, (DWORD) msg->msg_iovlen, - { (DWORD) msg->msg_controllen, (char *) msg->msg_control }, - (DWORD) flags }; - ssize_t ret = recv_internal (&wsamsg, use_recvmsg); - if (ret >= 0) - { - msg->msg_namelen = wsamsg.namelen; - msg->msg_controllen = wsamsg.Control.len; - if (!CYGWIN_VERSION_CHECK_FOR_USING_ANCIENT_MSGHDR) - msg->msg_flags = wsamsg.dwFlags; - } - return ret; -} - -void __reg3 -fhandler_socket_local::read (void *in_ptr, size_t& len) -{ - char *ptr = (char *) in_ptr; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; -#endif - - len = recv_internal (&wsamsg, false); -} - -ssize_t -fhandler_socket_local::readv (const struct iovec *const iov, const int iovcnt, - ssize_t tot) -{ - WSABUF wsabuf[iovcnt]; - WSABUF *wsaptr = wsabuf + iovcnt; - const struct iovec *iovptr = iov + iovcnt; - while (--wsaptr >= wsabuf) - { - wsaptr->len = (--iovptr)->iov_len; - wsaptr->buf = (char *) iovptr->iov_base; - } - WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; - return recv_internal (&wsamsg, false); -} - -inline ssize_t -fhandler_socket_local::send_internal (struct _WSAMSG *wsamsg, int flags) -{ - ssize_t res = 0; - DWORD ret = 0, sum = 0; - WSABUF out_buf[wsamsg->dwBufferCount]; - bool use_sendmsg = false; - DWORD wait_flags = flags & MSG_DONTWAIT; - bool nosignal = !!(flags & MSG_NOSIGNAL); - - flags &= (MSG_OOB | MSG_DONTROUTE); - if (wsamsg->Control.len > 0) - use_sendmsg = true; - /* Workaround for MSDN KB 823764: Split a message into chunks <= SO_SNDBUF. - in_idx is the index of the current lpBuffers from the input wsamsg buffer. - in_off is used to keep track of the next byte to write from a wsamsg - buffer which only gets partially written. */ - for (DWORD in_idx = 0, in_off = 0; - in_idx < wsamsg->dwBufferCount; - in_off >= wsamsg->lpBuffers[in_idx].len && (++in_idx, in_off = 0)) - { - /* Split a message into the least number of pieces to minimize the - number of WsaSendTo calls. Don't split datagram messages (bad idea). - out_idx is the index of the next buffer in the out_buf WSABUF, - also the number of buffers given to WSASendTo. - out_len is the number of bytes in the buffers given to WSASendTo. - Don't split datagram messages (very bad idea). */ - DWORD out_idx = 0; - DWORD out_len = 0; - if (get_socket_type () == SOCK_STREAM) - { - do - { - out_buf[out_idx].buf = wsamsg->lpBuffers[in_idx].buf + in_off; - out_buf[out_idx].len = wsamsg->lpBuffers[in_idx].len - in_off; - out_len += out_buf[out_idx].len; - out_idx++; - } - while (out_len < (unsigned) wmem () - && (in_off = 0, ++in_idx < wsamsg->dwBufferCount)); - /* Tweak len of the last out_buf buffer so the entire number of bytes - is (less than or) equal to wmem (). Fix out_len as well since it's - used in a subsequent test expression. */ - if (out_len > (unsigned) wmem ()) - { - out_buf[out_idx - 1].len -= out_len - (unsigned) wmem (); - out_len = (unsigned) wmem (); - } - /* Add the bytes written from the current last buffer to in_off, - so in_off points to the next byte to be written from that buffer, - or beyond which lets the outper loop skip to the next buffer. */ - in_off += out_buf[out_idx - 1].len; - } - - do - { - if (use_sendmsg) - res = WSASendMsg (get_socket (), wsamsg, flags, &ret, NULL, NULL); - else if (get_socket_type () == SOCK_STREAM) - res = WSASendTo (get_socket (), out_buf, out_idx, &ret, flags, - wsamsg->name, wsamsg->namelen, NULL, NULL); - else - res = WSASendTo (get_socket (), wsamsg->lpBuffers, - wsamsg->dwBufferCount, &ret, flags, - wsamsg->name, wsamsg->namelen, NULL, NULL); - if (res && (WSAGetLastError () == WSAEWOULDBLOCK)) - { - LOCK_EVENTS; - wsock_events->events &= ~FD_WRITE; - UNLOCK_EVENTS; - } - } - while (res && (WSAGetLastError () == WSAEWOULDBLOCK) - && !(res = wait_for_events (FD_WRITE | FD_CLOSE, wait_flags))); - - if (!res) - { - sum += ret; - /* For streams, return to application if the number of bytes written - is less than the number of bytes we intended to write in a single - call to WSASendTo. Otherwise we would have to add code to - backtrack in the input buffers, which is questionable. There was - probably a good reason we couldn't write more. */ - if (get_socket_type () != SOCK_STREAM || ret < out_len) - break; - } - else if (is_nonblocking () || WSAGetLastError() != WSAEWOULDBLOCK) - break; - } - - if (sum) - res = sum; - else if (res == SOCKET_ERROR) - { - set_winsock_errno (); - - /* Special handling for EPIPE and SIGPIPE. - - EPIPE is generated if the local end has been shut down on a connection - oriented socket. In this case the process will also receive a SIGPIPE - unless MSG_NOSIGNAL is set. */ - if ((get_errno () == ECONNABORTED || get_errno () == ESHUTDOWN) - && get_socket_type () == SOCK_STREAM) - { - set_errno (EPIPE); - if (!nosignal) - raise (SIGPIPE); - } - } - - return res; -} - ssize_t fhandler_socket_local::sendto (const void *in_ptr, size_t len, int flags, const struct sockaddr *to, int tolen) @@ -1578,48 +1284,6 @@ fhandler_socket_local::sendmsg (const struct msghdr *msg, int flags) return send_internal (&wsamsg, flags); } -ssize_t -fhandler_socket_local::write (const void *in_ptr, size_t len) -{ - char *ptr = (char *) in_ptr; - -#ifdef __x86_64__ - /* size_t is 64 bit, but the len member in WSABUF is 32 bit. - Split buffer if necessary. */ - DWORD bufcnt = len / UINT32_MAX + ((!len || (len % UINT32_MAX)) ? 1 : 0); - WSABUF wsabuf[bufcnt]; - WSAMSG wsamsg = { NULL, 0, wsabuf, bufcnt, { 0, NULL }, 0 }; - /* Don't use len as loop condition, it could be 0. */ - for (WSABUF *wsaptr = wsabuf; bufcnt--; ++wsaptr) - { - wsaptr->len = MIN (len, UINT32_MAX); - wsaptr->buf = ptr; - len -= wsaptr->len; - ptr += wsaptr->len; - } -#else - WSABUF wsabuf = { len, ptr }; - WSAMSG wsamsg = { NULL, 0, &wsabuf, 1, { 0, NULL }, 0 }; -#endif - return send_internal (&wsamsg, 0); -} - -ssize_t -fhandler_socket_local::writev (const struct iovec *const iov, const int iovcnt, - ssize_t tot) -{ - WSABUF wsabuf[iovcnt]; - WSABUF *wsaptr = wsabuf; - const struct iovec *iovptr = iov; - for (int i = 0; i < iovcnt; ++i) - { - wsaptr->len = iovptr->iov_len; - (wsaptr++)->buf = (char *) (iovptr++)->iov_base; - } - WSAMSG wsamsg = { NULL, 0, wsabuf, (DWORD) iovcnt, { 0, NULL}, 0 }; - return send_internal (&wsamsg, 0); -} - void fhandler_socket_local::set_sun_path (const char *path) { @@ -1907,86 +1571,3 @@ fhandler_socket_local::getsockopt (int level, int optname, const void *optval, return ret; } - -int -fhandler_socket_local::ioctl (unsigned int cmd, void *p) -{ - int res; - - switch (cmd) - { - /* FIXME: These have to be handled differently in future. */ - case FIOASYNC: -#ifdef __x86_64__ - case _IOW('f', 125, u_long): -#endif - res = WSAAsyncSelect (get_socket (), winmsg, WM_ASYNCIO, - *(int *) p ? ASYNC_MASK : 0); - syscall_printf ("Async I/O on socket %s", - *(int *) p ? "started" : "cancelled"); - async_io (*(int *) p != 0); - /* If async_io is switched off, revert the event handling. */ - if (*(int *) p == 0) - WSAEventSelect (get_socket (), wsock_evt, EVENT_MASK); - break; - case FIONREAD: -#ifdef __x86_64__ - case _IOR('f', 127, u_long): -#endif - /* Make sure to use the Winsock definition of FIONREAD. */ - res = ::ioctlsocket (get_socket (), _IOR('f', 127, u_long), (u_long *) p); - if (res == SOCKET_ERROR) - set_winsock_errno (); - break; - case FIONBIO: - case SIOCATMARK: - /* Sockets are always non-blocking internally. So we just note the - state here. */ -#ifdef __x86_64__ - /* Convert the different idea of u_long in the definition of cmd. */ - if (((cmd >> 16) & IOCPARM_MASK) == sizeof (unsigned long)) - cmd = (cmd & ~(IOCPARM_MASK << 16)) | (sizeof (u_long) << 16); -#endif - if (cmd == FIONBIO) - { - syscall_printf ("socket is now %sblocking", - *(int *) p ? "non" : ""); - set_nonblocking (*(int *) p); - res = 0; - } - else - res = ::ioctlsocket (get_socket (), cmd, (u_long *) p); - break; - default: - res = fhandler_socket::ioctl (cmd, p); - break; - } - syscall_printf ("%d = ioctl_socket(%x, %p)", res, cmd, p); - return res; -} - -int -fhandler_socket_local::fcntl (int cmd, intptr_t arg) -{ - int res = 0; - - switch (cmd) - { - case F_SETOWN: - { - pid_t pid = (pid_t) arg; - LOCK_EVENTS; - wsock_events->owner = pid; - UNLOCK_EVENTS; - debug_printf ("owner set to %d", pid); - } - break; - case F_GETOWN: - res = wsock_events->owner; - break; - default: - res = fhandler_socket::fcntl (cmd, arg); - break; - } - return res; -} diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 6b88f9105..fe6576dc9 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -1384,8 +1384,7 @@ cygwin_getpeername (int fd, struct sockaddr *name, socklen_t *len) } __except (EFAULT) {} __endtry - syscall_printf ("%R = getpeername(%d) %p", res, fd, - (fh ? fh->get_socket () : (SOCKET) -1)); + syscall_printf ("%R = getpeername(%d)", res, fd); return res; } diff --git a/winsup/cygwin/poll.cc b/winsup/cygwin/poll.cc index ea45b70ad..440413433 100644 --- a/winsup/cygwin/poll.cc +++ b/winsup/cygwin/poll.cc @@ -94,12 +94,12 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout) { if (fds[i].fd >= 0 && fds[i].revents != POLLNVAL) { - fhandler_socket *sock; + fhandler_socket_wsock *sock; /* Check if the descriptor has been closed, or if shutdown for the read side has been called on a socket. */ if (cygheap->fdtab.not_open (fds[i].fd) - || ((sock = cygheap->fdtab[fds[i].fd]->is_socket ()) + || ((sock = cygheap->fdtab[fds[i].fd]->is_wsock_socket ()) && sock->saw_shutdown_read ())) fds[i].revents = POLLHUP; else @@ -117,7 +117,7 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout) /* Handle failed connect. A failed connect implicitly sets POLLOUT, if requested, but it doesn't set POLLIN. */ if ((fds[i].events & POLLIN) - && (sock = cygheap->fdtab[fds[i].fd]->is_socket ()) + && (sock = cygheap->fdtab[fds[i].fd]->is_wsock_socket ()) && sock->connect_state () == connect_failed) fds[i].revents |= (POLLIN | POLLERR); else diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 86e7cd8fd..023bec048 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -501,7 +501,7 @@ set_bits (select_record *me, fd_set *readfds, fd_set *writefds, fd_set *exceptfds) { int ready = 0; - fhandler_socket *sock; + fhandler_socket_wsock *sock; select_printf ("me %p, testing fd %d (%s)", me, me->fd, me->fh->get_name ()); if (me->read_selected && me->read_ready) { @@ -511,7 +511,7 @@ set_bits (select_record *me, fd_set *readfds, fd_set *writefds, if (me->write_selected && me->write_ready) { UNIX_FD_SET (me->fd, writefds); - if (me->except_on_write && (sock = me->fh->is_socket ())) + if (me->except_on_write && (sock = me->fh->is_wsock_socket ())) { /* Set readfds entry in case of a failed connect. */ if (!me->read_ready && me->read_selected @@ -1364,7 +1364,7 @@ fhandler_base::select_except (select_stuff *ss) static int peek_socket (select_record *me, bool) { - fhandler_socket *fh = (fhandler_socket *) me->fh; + fhandler_socket_wsock *fh = (fhandler_socket_wsock *) me->fh; long events; /* Don't play with the settings again, unless having taken a deep look into Richard W. Stevens Network Programming book. Thank you. */ @@ -1488,7 +1488,7 @@ start_thread_socket (select_record *me, select_stuff *stuff) /* No event/socket should show up multiple times. Every socket is uniquely identified by its serial number in the global wsock_events record. */ - const LONG ser_num = ((fhandler_socket *) s->fh)->serial_number (); + const LONG ser_num = ((fhandler_socket_wsock *) s->fh)->serial_number (); for (int i = 1; i < si->num_w4; ++i) if (si->ser_num[i] == ser_num) goto continue_outer_loop; @@ -1517,7 +1517,7 @@ start_thread_socket (select_record *me, select_stuff *stuff) _my_tls.locals.select.max_w4 += MAXIMUM_WAIT_OBJECTS; } si->ser_num[si->num_w4] = ser_num; - si->w4[si->num_w4++] = ((fhandler_socket *) s->fh)->wsock_event (); + si->w4[si->num_w4++] = ((fhandler_socket_wsock *) s->fh)->wsock_event (); continue_outer_loop: ; } @@ -1549,7 +1549,7 @@ socket_cleanup (select_record *, select_stuff *stuff) } select_record * -fhandler_socket_inet::select_read (select_stuff *ss) +fhandler_socket_wsock::select_read (select_stuff *ss) { select_record *s = ss->start.next; if (!s->startup) @@ -1565,7 +1565,7 @@ fhandler_socket_inet::select_read (select_stuff *ss) } select_record * -fhandler_socket_inet::select_write (select_stuff *ss) +fhandler_socket_wsock::select_write (select_stuff *ss) { select_record *s = ss->start.next; if (!s->startup) @@ -1586,61 +1586,7 @@ fhandler_socket_inet::select_write (select_stuff *ss) } select_record * -fhandler_socket_inet::select_except (select_stuff *ss) -{ - select_record *s = ss->start.next; - if (!s->startup) - { - s->startup = start_thread_socket; - s->verify = verify_true; - s->cleanup = socket_cleanup; - } - s->peek = peek_socket; - /* FIXME: Is this right? Should these be used as criteria for except? */ - s->except_ready = saw_shutdown_write () || saw_shutdown_read (); - s->except_selected = true; - return s; -} - -select_record * -fhandler_socket_local::select_read (select_stuff *ss) -{ - select_record *s = ss->start.next; - if (!s->startup) - { - s->startup = start_thread_socket; - s->verify = verify_true; - s->cleanup = socket_cleanup; - } - s->peek = peek_socket; - s->read_ready = saw_shutdown_read (); - s->read_selected = true; - return s; -} - -select_record * -fhandler_socket_local::select_write (select_stuff *ss) -{ - select_record *s = ss->start.next; - if (!s->startup) - { - s->startup = start_thread_socket; - s->verify = verify_true; - s->cleanup = socket_cleanup; - } - s->peek = peek_socket; - s->write_ready = saw_shutdown_write () || connect_state () == unconnected; - s->write_selected = true; - if (connect_state () != unconnected) - { - s->except_ready = saw_shutdown_write () || saw_shutdown_read (); - s->except_on_write = true; - } - return s; -} - -select_record * -fhandler_socket_local::select_except (select_stuff *ss) +fhandler_socket_wsock::select_except (select_stuff *ss) { select_record *s = ss->start.next; if (!s->startup) From eaf359574d7005cbebdc6603d77c850519265a56 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 19:45:59 +0100 Subject: [PATCH 288/649] Cygwin: Introduce FH_SOCKET for generic socket file ops Signed-off-by: Corinna Vinschen --- winsup/cygwin/devices.cc | 3 +++ winsup/cygwin/devices.h | 7 +++++-- winsup/cygwin/devices.in | 3 +++ winsup/cygwin/path.cc | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index 2b65108a3..8ba199dd9 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -120,6 +120,9 @@ const _device dev_piper_storage = const _device dev_pipew_storage = {"", {FH_PIPEW}, "", exists_internal}; +const _device dev_socket_storage = + {"", {FH_SOCKET}, "", exists_internal}; + const _device dev_af_inet_storage = {"", {FH_INET}, "", exists_internal}; diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h index 9924bad01..87e033040 100644 --- a/winsup/cygwin/devices.h +++ b/winsup/cygwin/devices.h @@ -242,6 +242,7 @@ enum fh_devices FH_OSS_DSP = FHDEV (DEV_SOUND_MAJOR, 3), DEV_SOCK_MAJOR = 30, + FH_SOCKET = FHDEV (DEV_SOCK_MAJOR, 0), FH_INET = FHDEV (DEV_SOCK_MAJOR, 36), FH_LOCAL = FHDEV (DEV_SOCK_MAJOR, 120), @@ -390,10 +391,12 @@ extern const _device *ptmx_dev; extern const _device *ptys_dev; extern const _device *urandom_dev; -extern const _device dev_af_local_storage; -#define af_local_dev ((device *) &dev_af_local_storage) +extern const _device dev_socket_storage; +#define socket_dev ((device *) &dev_socket_storage) extern const _device dev_af_inet_storage; #define af_inet_dev ((device *) &dev_af_inet_storage) +extern const _device dev_af_local_storage; +#define af_local_dev ((device *) &dev_af_local_storage) extern const _device dev_piper_storage; #define piper_dev ((device *) &dev_piper_storage) diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index 47d127cb3..c0108b817 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -116,6 +116,9 @@ const _device dev_piper_storage = const _device dev_pipew_storage = {"", {FH_PIPEW}, "", exists_internal}; +const _device dev_socket_storage = + {"", {FH_SOCKET}, "", exists_internal}; + const _device dev_af_inet_storage = {"", {FH_INET}, "", exists_internal}; diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 2bf84abbe..da4598931 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -864,7 +864,7 @@ path_conv::check (const char *src, unsigned opt, if (component == 0) { fileattr = 0; - dev.parse (FH_INET); + dev.parse (FH_SOCKET); } break; case virt_fsdir: From 5acadbe8afda9ccb97829b9a8f5813464519fcae Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 20:59:55 +0100 Subject: [PATCH 289/649] Cygwin: fix upcalls in some fhandler_socket_local methods Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_local.cc | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index ca3844291..6ec8fe573 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -100,7 +100,6 @@ get_inet_addr_local (const struct sockaddr *in, int inlen, return 0; } - /* AF_LOCAL/AF_UNIX only */ path_conv pc (in->sa_data, PC_SYM_FOLLOW); if (pc.error) { @@ -618,7 +617,7 @@ fhandler_socket_local::dup (fhandler_base *child, int flags) fhandler_socket_local *fhs = (fhandler_socket_local *) child; fhs->set_sun_path (get_sun_path ()); fhs->set_peer_sun_path (get_peer_sun_path ()); - return fhandler_socket::dup (child, flags); + return fhandler_socket_wsock::dup (child, flags); } int __reg2 @@ -627,7 +626,7 @@ fhandler_socket_local::fstat (struct stat *buf) int res; if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_socket::fstat (buf); + return fhandler_socket_wsock::fstat (buf); res = fhandler_base::fstat_fs (buf); if (!res) { @@ -641,7 +640,7 @@ int __reg2 fhandler_socket_local::fstatvfs (struct statvfs *sfs) { if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_socket::fstatvfs (sfs); + return fhandler_socket_wsock::fstatvfs (sfs); fhandler_disk_file fh (pc); fh.get_device () = FH_FS; return fh.fstatvfs (sfs); @@ -651,7 +650,7 @@ int fhandler_socket_local::fchmod (mode_t newmode) { if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_socket::fchmod (newmode); + return fhandler_socket_wsock::fchmod (newmode); fhandler_disk_file fh (pc); fh.get_device () = FH_FS; return fh.fchmod (S_IFSOCK | adjust_socket_file_mode (newmode)); @@ -661,7 +660,7 @@ int fhandler_socket_local::fchown (uid_t uid, gid_t gid) { if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_socket::fchown (uid, gid); + return fhandler_socket_wsock::fchown (uid, gid); fhandler_disk_file fh (pc); return fh.fchown (uid, gid); } @@ -670,7 +669,7 @@ int fhandler_socket_local::facl (int cmd, int nentries, aclent_t *aclbufp) { if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_socket::facl (cmd, nentries, aclbufp); + return fhandler_socket_wsock::facl (cmd, nentries, aclbufp); fhandler_disk_file fh (pc); return fh.facl (cmd, nentries, aclbufp); } @@ -679,7 +678,7 @@ int fhandler_socket_local::link (const char *newpath) { if (!get_sun_path () || get_sun_path ()[0] == '\0') - return fhandler_socket::link (newpath); + return fhandler_socket_wsock::link (newpath); fhandler_disk_file fh (pc); return fh.link (newpath); } From 7f7532fafb0e9787bc9c789f14e9344b8da16244 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 20:59:21 +0100 Subject: [PATCH 290/649] Cygwin: Create empty fhandler_socket_unix * Make distinct from AF_LOCAL for testing purposes. This will have to be reverted as soon as fhandler_socket_unix goes life. * Move saw_reuseaddr flag back to fhandler_socket status Signed-off-by: Corinna Vinschen --- winsup/cygwin/Makefile.in | 1 + winsup/cygwin/devices.cc | 3 + winsup/cygwin/devices.h | 3 + winsup/cygwin/devices.in | 3 + winsup/cygwin/dtable.cc | 3 + winsup/cygwin/fhandler.h | 102 +++- winsup/cygwin/fhandler_socket_inet.cc | 8 +- winsup/cygwin/fhandler_socket_unix.cc | 671 ++++++++++++++++++++++++++ winsup/cygwin/include/cygwin/socket.h | 6 + winsup/cygwin/net.cc | 6 +- winsup/cygwin/select.cc | 45 ++ 11 files changed, 832 insertions(+), 19 deletions(-) create mode 100644 winsup/cygwin/fhandler_socket_unix.cc diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in index 75ec29707..ac22cfba8 100644 --- a/winsup/cygwin/Makefile.in +++ b/winsup/cygwin/Makefile.in @@ -298,6 +298,7 @@ DLL_OFILES:= \ fhandler_socket.o \ fhandler_socket_inet.o \ fhandler_socket_local.o \ + fhandler_socket_unix.o \ fhandler_tape.o \ fhandler_termios.o \ fhandler_tty.o \ diff --git a/winsup/cygwin/devices.cc b/winsup/cygwin/devices.cc index 8ba199dd9..963069bd7 100644 --- a/winsup/cygwin/devices.cc +++ b/winsup/cygwin/devices.cc @@ -126,6 +126,9 @@ const _device dev_socket_storage = const _device dev_af_inet_storage = {"", {FH_INET}, "", exists_internal}; +const _device dev_af_unix_storage = + {"", {FH_UNIX}, "", exists_internal}; + const _device dev_af_local_storage = {"", {FH_LOCAL}, "", exists_internal}; diff --git a/winsup/cygwin/devices.h b/winsup/cygwin/devices.h index 87e033040..3b6730002 100644 --- a/winsup/cygwin/devices.h +++ b/winsup/cygwin/devices.h @@ -244,6 +244,7 @@ enum fh_devices DEV_SOCK_MAJOR = 30, FH_SOCKET = FHDEV (DEV_SOCK_MAJOR, 0), FH_INET = FHDEV (DEV_SOCK_MAJOR, 36), + FH_UNIX = FHDEV (DEV_SOCK_MAJOR, 42), FH_LOCAL = FHDEV (DEV_SOCK_MAJOR, 120), FH_NADA = FHDEV (0, 0), @@ -397,6 +398,8 @@ extern const _device dev_af_inet_storage; #define af_inet_dev ((device *) &dev_af_inet_storage) extern const _device dev_af_local_storage; #define af_local_dev ((device *) &dev_af_local_storage) +extern const _device dev_af_unix_storage; +#define af_unix_dev ((device *) &dev_af_unix_storage) extern const _device dev_piper_storage; #define piper_dev ((device *) &dev_piper_storage) diff --git a/winsup/cygwin/devices.in b/winsup/cygwin/devices.in index c0108b817..ed99b440c 100644 --- a/winsup/cygwin/devices.in +++ b/winsup/cygwin/devices.in @@ -122,6 +122,9 @@ const _device dev_socket_storage = const _device dev_af_inet_storage = {"", {FH_INET}, "", exists_internal}; +const _device dev_af_unix_storage = + {"", {FH_UNIX}, "", exists_internal}; + const _device dev_af_local_storage = {"", {FH_LOCAL}, "", exists_internal}; diff --git a/winsup/cygwin/dtable.cc b/winsup/cygwin/dtable.cc index ae0315cd3..5a263f5a1 100644 --- a/winsup/cygwin/dtable.cc +++ b/winsup/cygwin/dtable.cc @@ -520,6 +520,9 @@ fh_alloc (path_conv& pc) case FH_LOCAL: fh = cnew (fhandler_socket_local); break; + case FH_UNIX: + fh = cnew (fhandler_socket_unix); + break; case FH_FS: fh = cnew (fhandler_disk_file); break; diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 3816110a0..863cd312f 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -521,17 +521,19 @@ class fhandler_socket: public fhandler_base unsigned async_io : 1; /* async I/O */ unsigned saw_shutdown_read : 1; /* Socket saw a SHUT_RD */ unsigned saw_shutdown_write : 1; /* Socket saw a SHUT_WR */ + unsigned saw_reuseaddr : 1; /* Socket saw SO_REUSEADDR call */ unsigned connect_state : 3; public: status_flags () : async_io (0), saw_shutdown_read (0), saw_shutdown_write (0), - connect_state (unconnected) + saw_reuseaddr (0), connect_state (unconnected) {} } status; public: IMPLEMENT_STATUS_FLAG (bool, async_io) IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_read) IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_write) + IMPLEMENT_STATUS_FLAG (bool, saw_reuseaddr) IMPLEMENT_STATUS_FLAG (conn_state, connect_state) public: @@ -639,16 +641,6 @@ class fhandler_socket_wsock: public fhandler_socket SOCKET get_socket () { return (SOCKET) get_handle(); } #endif - protected: - struct status_flags - { - unsigned saw_reuseaddr : 1; /* Socket saw SO_REUSEADDR call */ - public: - status_flags () : saw_reuseaddr (0) {} - } status; - public: - IMPLEMENT_STATUS_FLAG (bool, saw_reuseaddr) - protected: virtual ssize_t recv_internal (struct _WSAMSG *wsamsg, bool use_recvmsg) = 0; ssize_t send_internal (struct _WSAMSG *wsamsg, int flags); @@ -819,6 +811,94 @@ class fhandler_socket_local: public fhandler_socket_wsock } }; +class fhandler_socket_unix : public fhandler_socket +{ + protected: + char *sun_path; + char *peer_sun_path; + void set_sun_path (const char *path); + char *get_sun_path () {return sun_path;} + void set_peer_sun_path (const char *path); + char *get_peer_sun_path () {return peer_sun_path;} + void set_cred (); + + protected: + pid_t sec_pid; + uid_t sec_uid; + gid_t sec_gid; + pid_t sec_peer_pid; + uid_t sec_peer_uid; + gid_t sec_peer_gid; + + public: + fhandler_socket_unix (); + ~fhandler_socket_unix (); + + int dup (fhandler_base *child, int); + + int socket (int af, int type, int protocol, int flags); + int socketpair (int af, int type, int protocol, int flags, + fhandler_socket_unix *fh_out); + int bind (const struct sockaddr *name, int namelen); + int listen (int backlog); + int accept4 (struct sockaddr *peer, int *len, int flags); + int connect (const struct sockaddr *name, int namelen); + int getsockname (struct sockaddr *name, int *namelen); + int getpeername (struct sockaddr *name, int *namelen); + int shutdown (int how); + int close (); + int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); + ssize_t recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen); + ssize_t recvmsg (struct msghdr *msg, int flags); + void __reg3 read (void *ptr, size_t& len); + ssize_t __stdcall readv (const struct iovec *, int iovcnt, + ssize_t tot = -1); + + ssize_t sendto (const void *ptr, size_t len, int flags, + const struct sockaddr *to, int tolen); + ssize_t sendmsg (const struct msghdr *msg, int flags); + ssize_t __stdcall write (const void *ptr, size_t len); + ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + int setsockopt (int level, int optname, const void *optval, + __socklen_t optlen); + int getsockopt (int level, int optname, const void *optval, + __socklen_t *optlen); + + virtual int ioctl (unsigned int cmd, void *); + virtual int fcntl (int cmd, intptr_t); + + int __reg2 fstat (struct stat *buf); + int __reg2 fstatvfs (struct statvfs *buf); + int __reg1 fchmod (mode_t newmode); + int __reg2 fchown (uid_t newuid, gid_t newgid); + int __reg3 facl (int, int, struct acl *); + int __reg2 link (const char *); + + /* select.cc */ + select_record *select_read (select_stuff *); + select_record *select_write (select_stuff *); + select_record *select_except (select_stuff *); + + /* from here on: CLONING */ + fhandler_socket_unix (void *) {} + + void copyto (fhandler_base *x) + { + x->pc.free_strings (); + *reinterpret_cast (x) = *this; + x->reset (this); + } + + fhandler_socket_unix *clone (cygheap_types malloc_type = HEAP_FHANDLER) + { + void *ptr = (void *) ccalloc (malloc_type, 1, sizeof (fhandler_socket_unix)); + fhandler_socket_unix *fh = new (ptr) fhandler_socket_unix (ptr); + copyto (fh); + return fh; + } +}; + class fhandler_base_overlapped: public fhandler_base { static HANDLE asio_done; diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index 0668c1063..aa3ead7ae 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -211,8 +211,7 @@ fhandler_socket_wsock::fhandler_socket_wsock () : wsock_events (NULL), wsock_mtx (NULL), wsock_evt (NULL), - prot_info_ptr (NULL), - status () + prot_info_ptr (NULL) { need_fork_fixup (true); } @@ -1429,8 +1428,6 @@ fhandler_socket_inet::sendto (const void *in_ptr, size_t len, int flags, ssize_t fhandler_socket_inet::sendmsg (const struct msghdr *msg, int flags) { - /* TODO: Descriptor passing on AF_LOCAL sockets. */ - struct sockaddr_storage sst; int len = 0; @@ -1449,8 +1446,7 @@ fhandler_socket_inet::sendmsg (const struct msghdr *msg, int flags) } /* Disappointing but true: Even if WSASendMsg is supported, it's only supported for datagram and raw sockets. */ - DWORD controllen = (DWORD) (get_socket_type () == SOCK_STREAM - || get_addr_family () == AF_LOCAL + DWORD controllen = (DWORD) ((get_socket_type () == SOCK_STREAM) ? 0 : msg->msg_controllen); WSAMSG wsamsg = { msg->msg_name ? (struct sockaddr *) &sst : NULL, len, wsabuf, (DWORD) msg->msg_iovlen, diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc new file mode 100644 index 000000000..21d2ad62d --- /dev/null +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -0,0 +1,671 @@ +/* fhandler_socket_unix.cc. + + See fhandler.h for a description of the fhandler classes. + + This file is part of Cygwin. + + This software is a copyrighted work licensed under the terms of the + Cygwin license. Please consult the file "CYGWIN_LICENSE" for + details. */ + +#include "winsup.h" +#include +#include "cygerrno.h" +#include "security.h" +#include "path.h" +#include "fhandler.h" +#include "dtable.h" +#include "cygheap.h" +#include +#include "cygwin/version.h" +#include "perprocess.h" +#include "shared_info.h" +#include "sigproc.h" +#include "wininfo.h" +#include +#include +#include +#include +#include "cygtls.h" +#include +#include "ntdll.h" +#include "miscfuncs.h" +#include "tls_pbuf.h" + +extern "C" { + int sscanf (const char *, const char *, ...); +} /* End of "C" section */ + +#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) +#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) + +#define LOCK_EVENTS \ + if (wsock_mtx && \ + WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) \ + { + +#define UNLOCK_EVENTS \ + ReleaseMutex (wsock_mtx); \ + } + +static inline mode_t +adjust_socket_file_mode (mode_t mode) +{ + /* Kludge: Don't allow to remove read bit on socket files for + user/group/other, if the accompanying write bit is set. It would + be nice to have exact permissions on a socket file, but it's + necessary that somebody able to access the socket can always read + the contents of the socket file to avoid spurious "permission + denied" messages. */ + return mode | ((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) << 1); +} + +/* cygwin internal: map sockaddr into internet domain address */ +static int __unused +get_inet_addr_unix (const struct sockaddr *in, int inlen, + struct sockaddr_storage *out, int *outlen, + int *type = NULL) +{ + /* Check for abstract socket. */ + if (inlen >= (int) sizeof (in->sa_family) + 7 + && in->sa_data[0] == '\0' && in->sa_data[1] == 'd' + && in->sa_data[6] == '\0') + { + /* TODO */ + return 0; + } + + path_conv pc (in->sa_data, PC_SYM_FOLLOW); + if (pc.error) + { + set_errno (pc.error); + return -1; + } + if (!pc.exists ()) + { + set_errno (ENOENT); + return -1; + } + /* Do NOT test for the file being a socket file here. The socket file + creation is not an atomic operation, so there is a chance that socket + files which are just in the process of being created are recognized + as non-socket files. To work around this problem we now create the + file with all sharing disabled. If the below NtOpenFile fails + with STATUS_SHARING_VIOLATION we know that the file already exists, + but the creating process isn't finished yet. So we yield and try + again, until we can either open the file successfully, or some error + other than STATUS_SHARING_VIOLATION occurs. + Since we now don't know if the file is actually a socket file, we + perform this check here explicitely. */ + NTSTATUS status; + HANDLE fh; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + + pc.get_object_attr (attr, sec_none_nih); + do + { + status = NtOpenFile (&fh, GENERIC_READ | SYNCHRONIZE, &attr, &io, + FILE_SHARE_VALID_FLAGS, + FILE_SYNCHRONOUS_IO_NONALERT + | FILE_OPEN_FOR_BACKUP_INTENT + | FILE_NON_DIRECTORY_FILE); + if (status == STATUS_SHARING_VIOLATION) + { + /* While we hope that the sharing violation is only temporary, we + also could easily get stuck here, waiting for a file in use by + some greedy Win32 application. Therefore we should never wait + endlessly without checking for signals and thread cancel event. */ + pthread_testcancel (); + if (cygwait (NULL, cw_nowait, cw_sig_eintr) == WAIT_SIGNALED + && !_my_tls.call_signal_handler ()) + { + set_errno (EINTR); + return -1; + } + yield (); + } + else if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return -1; + } + } + while (status == STATUS_SHARING_VIOLATION); + /* Now test for the SYSTEM bit. */ + FILE_BASIC_INFORMATION fbi; + status = NtQueryInformationFile (fh, &io, &fbi, sizeof fbi, + FileBasicInformation); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return -1; + } + if (!(fbi.FileAttributes & FILE_ATTRIBUTE_SYSTEM)) + { + NtClose (fh); + set_errno (EBADF); + return -1; + } + /* Eventually check the content and fetch the required information. */ + char buf[128]; + memset (buf, 0, sizeof buf); + status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, 128, NULL, NULL); + NtClose (fh); + if (NT_SUCCESS (status)) + { +#if 0 /* TODO */ + struct sockaddr_in sin; + char ctype; + sin.sin_family = AF_INET; + if (strncmp (buf, SOCKET_COOKIE, strlen (SOCKET_COOKIE))) + { + set_errno (EBADF); + return -1; + } + sscanf (buf + strlen (SOCKET_COOKIE), "%hu %c", &sin.sin_port, &ctype); + sin.sin_port = htons (sin.sin_port); + sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); + memcpy (out, &sin, sizeof sin); + *outlen = sizeof sin; + if (type) + *type = (ctype == 's' ? SOCK_STREAM : + ctype == 'd' ? SOCK_DGRAM + : 0); +#endif + return 0; + } + __seterrno_from_nt_status (status); + return -1; +} + +fhandler_socket_unix::fhandler_socket_unix () : + sun_path (NULL), + peer_sun_path (NULL) +{ + set_cred (); +} + +fhandler_socket_unix::~fhandler_socket_unix () +{ + if (sun_path) + cfree (sun_path); + if (peer_sun_path) + cfree (peer_sun_path); +} + +void +fhandler_socket_unix::set_sun_path (const char *path) +{ + sun_path = path ? cstrdup (path) : NULL; +} + +void +fhandler_socket_unix::set_peer_sun_path (const char *path) +{ + peer_sun_path = path ? cstrdup (path) : NULL; +} + +void +fhandler_socket_unix::set_cred () +{ + sec_pid = getpid (); + sec_uid = geteuid32 (); + sec_gid = getegid32 (); + sec_peer_pid = (pid_t) 0; + sec_peer_uid = (uid_t) -1; + sec_peer_gid = (gid_t) -1; +} + +int +fhandler_socket_unix::dup (fhandler_base *child, int flags) +{ + fhandler_socket_unix *fhs = (fhandler_socket_unix *) child; + fhs->set_sun_path (get_sun_path ()); + fhs->set_peer_sun_path (get_peer_sun_path ()); + return fhandler_socket::dup (child, flags); +} + +int +fhandler_socket_unix::socket (int af, int type, int protocol, int flags) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, + fhandler_socket_unix *fh_out) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::listen (int backlog) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::accept4 (struct sockaddr *peer, int *len, int flags) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::connect (const struct sockaddr *name, int namelen) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::getsockname (struct sockaddr *name, int *namelen) +{ + struct sockaddr_un sun; + + sun.sun_family = AF_UNIX; + sun.sun_path[0] = '\0'; + if (get_sun_path ()) + strncat (sun.sun_path, get_sun_path (), UNIX_PATH_MAX - 1); + memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); + *namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0); + return 0; +} + +int +fhandler_socket_unix::getpeername (struct sockaddr *name, int *namelen) +{ + struct sockaddr_un sun; + memset (&sun, 0, sizeof sun); + sun.sun_family = AF_UNIX; + sun.sun_path[0] = '\0'; + if (get_peer_sun_path ()) + strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_MAX - 1); + memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); + *namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0); + return 0; +} + +int +fhandler_socket_unix::shutdown (int how) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::close () +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) +{ + if (get_socket_type () != SOCK_STREAM) + { + set_errno (EINVAL); + return -1; + } + if (connect_state () != connected) + { + set_errno (ENOTCONN); + return -1; + } + + __try + { + if (pid) + *pid = sec_peer_pid; + if (euid) + *euid = sec_peer_uid; + if (egid) + *egid = sec_peer_gid; + return 0; + } + __except (EFAULT) {} + __endtry + return -1; +} + +ssize_t +fhandler_socket_unix::recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +ssize_t +fhandler_socket_unix::recvmsg (struct msghdr *msg, int flags) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +void __reg3 +fhandler_socket_unix::read (void *ptr, size_t& len) +{ + set_errno (EAFNOSUPPORT); + len = 0; +} + +ssize_t __stdcall +fhandler_socket_unix::readv (const struct iovec *, int iovcnt, ssize_t tot) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +ssize_t +fhandler_socket_unix::sendto (const void *in_ptr, size_t len, int flags, + const struct sockaddr *to, int tolen) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +ssize_t +fhandler_socket_unix::sendmsg (const struct msghdr *msg, int flags) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +ssize_t __stdcall +fhandler_socket_unix::write (const void *ptr, size_t len) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +ssize_t __stdcall +fhandler_socket_unix::writev (const struct iovec *, int iovcnt, ssize_t tot) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + +int +fhandler_socket_unix::setsockopt (int level, int optname, const void *optval, + socklen_t optlen) +{ + /* Preprocessing setsockopt. */ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_PASSCRED: + break; + + case SO_REUSEADDR: + saw_reuseaddr (*(int *) optval); + break; + + case SO_RCVBUF: + rmem (*(int *) optval); + break; + + case SO_SNDBUF: + wmem (*(int *) optval); + break; + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + if (optlen < (socklen_t) sizeof (struct timeval)) + { + set_errno (EINVAL); + return -1; + } + if (!timeval_to_ms ((struct timeval *) optval, + (optname == SO_RCVTIMEO) ? rcvtimeo () + : sndtimeo ())) + { + set_errno (EDOM); + return -1; + } + break; + + default: + /* AF_UNIX sockets simply ignore all other SOL_SOCKET options. */ + break; + } + break; + + default: + set_errno (ENOPROTOOPT); + return -1; + } + + return 0; +} + +int +fhandler_socket_unix::getsockopt (int level, int optname, const void *optval, + socklen_t *optlen) +{ + /* Preprocessing getsockopt.*/ + switch (level) + { + case SOL_SOCKET: + switch (optname) + { + case SO_ERROR: + { + int *e = (int *) optval; + *e = 0; + break; + } + + case SO_PASSCRED: + break; + + case SO_PEERCRED: + { + struct ucred *cred = (struct ucred *) optval; + + if (*optlen < (socklen_t) sizeof *cred) + { + set_errno (EINVAL); + return -1; + } + int ret = getpeereid (&cred->pid, &cred->uid, &cred->gid); + if (!ret) + *optlen = (socklen_t) sizeof *cred; + return ret; + } + + case SO_REUSEADDR: + { + unsigned int *reuseaddr = (unsigned int *) optval; + + if (*optlen < (socklen_t) sizeof *reuseaddr) + { + set_errno (EINVAL); + return -1; + } + *reuseaddr = saw_reuseaddr(); + *optlen = (socklen_t) sizeof *reuseaddr; + break; + } + + case SO_RCVTIMEO: + case SO_SNDTIMEO: + { + struct timeval *time_out = (struct timeval *) optval; + + if (*optlen < (socklen_t) sizeof *time_out) + { + set_errno (EINVAL); + return -1; + } + DWORD ms = (optname == SO_RCVTIMEO) ? rcvtimeo () : sndtimeo (); + if (ms == 0 || ms == INFINITE) + { + time_out->tv_sec = 0; + time_out->tv_usec = 0; + } + else + { + time_out->tv_sec = ms / MSPERSEC; + time_out->tv_usec = ((ms % MSPERSEC) * USPERSEC) / MSPERSEC; + } + *optlen = (socklen_t) sizeof *time_out; + break; + } + + case SO_TYPE: + { + unsigned int *type = (unsigned int *) optval; + *type = get_socket_type (); + *optlen = (socklen_t) sizeof *type; + break; + } + + /* AF_UNIX sockets simply ignore all other SOL_SOCKET options. */ + + case SO_LINGER: + { + struct linger *linger = (struct linger *) optval; + memset (linger, 0, sizeof *linger); + *optlen = (socklen_t) sizeof *linger; + break; + } + + default: + { + unsigned int *val = (unsigned int *) optval; + *val = 0; + *optlen = (socklen_t) sizeof *val; + break; + } + } + break; + + default: + set_errno (ENOPROTOOPT); + return -1; + } + + return 0; +} + +int +fhandler_socket_unix::ioctl (unsigned int cmd, void *p) +{ + int ret; + + switch (cmd) + { + case FIOASYNC: +#ifdef __x86_64__ + case _IOW('f', 125, int): +#endif + break; + case FIONREAD: +#ifdef __x86_64__ + case _IOR('f', 127, int): +#endif + case FIONBIO: + case SIOCATMARK: + break; + default: + ret = fhandler_socket::ioctl (cmd, p); + break; + } + return ret; +} + +int +fhandler_socket_unix::fcntl (int cmd, intptr_t arg) +{ + int ret; + + switch (cmd) + { + case F_SETOWN: + break; + case F_GETOWN: + break; + default: + ret = fhandler_socket::fcntl (cmd, arg); + break; + } + return ret; +} + +int __reg2 +fhandler_socket_unix::fstat (struct stat *buf) +{ + int ret; + + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fstat (buf); + ret = fhandler_base::fstat_fs (buf); + if (!ret) + { + buf->st_mode = (buf->st_mode & ~S_IFMT) | S_IFSOCK; + buf->st_size = 0; + } + return ret; +} + +int __reg2 +fhandler_socket_unix::fstatvfs (struct statvfs *sfs) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fstatvfs (sfs); + fhandler_disk_file fh (pc); + fh.get_device () = FH_FS; + return fh.fstatvfs (sfs); +} + +int +fhandler_socket_unix::fchmod (mode_t newmode) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fchmod (newmode); + fhandler_disk_file fh (pc); + fh.get_device () = FH_FS; + return fh.fchmod (S_IFSOCK | adjust_socket_file_mode (newmode)); +} + +int +fhandler_socket_unix::fchown (uid_t uid, gid_t gid) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::fchown (uid, gid); + fhandler_disk_file fh (pc); + return fh.fchown (uid, gid); +} + +int +fhandler_socket_unix::facl (int cmd, int nentries, aclent_t *aclbufp) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::facl (cmd, nentries, aclbufp); + fhandler_disk_file fh (pc); + return fh.facl (cmd, nentries, aclbufp); +} + +int +fhandler_socket_unix::link (const char *newpath) +{ + if (!get_sun_path () || get_sun_path ()[0] == '\0') + return fhandler_socket::link (newpath); + fhandler_disk_file fh (pc); + return fh.link (newpath); +} diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index b1ab5c28c..15e132738 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -138,7 +138,13 @@ struct OLD_msghdr * Address families. */ #define AF_UNSPEC 0 /* unspecified */ +/* FIXME: This is for testing only, while developing the new + fhandler_socket_unix class. */ +#ifdef __INSIDE_CYGWIN__ +#define AF_UNIX 31 +#else #define AF_UNIX 1 /* local to host (pipes, portals) */ +#endif #define AF_LOCAL 1 /* POSIX name for AF_UNIX */ #define AF_INET 2 /* internetwork: UDP, TCP, etc. */ #define AF_IMPLINK 3 /* arpanet imp addresses */ diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index fe6576dc9..89945c5a1 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -516,6 +516,7 @@ cygwin_socket (int af, int type, int protocol) switch (af) { case AF_LOCAL: + case AF_UNIX: if (type != SOCK_STREAM && type != SOCK_DGRAM) { set_errno (EINVAL); @@ -526,7 +527,7 @@ cygwin_socket (int af, int type, int protocol) set_errno (EPROTONOSUPPORT); goto done; } - dev = af_local_dev; + dev = (af == AF_LOCAL) ? af_local_dev : af_unix_dev; break; case AF_INET: case AF_INET6: @@ -2312,6 +2313,7 @@ socketpair (int af, int type, int protocol, int *sb) switch (af) { case AF_LOCAL: + case AF_UNIX: if (type != SOCK_STREAM && type != SOCK_DGRAM) { set_errno (EINVAL); @@ -2322,7 +2324,7 @@ socketpair (int af, int type, int protocol, int *sb) set_errno (EPROTONOSUPPORT); goto done; } - dev = af_local_dev; + dev = (af == AF_LOCAL) ? af_local_dev : af_unix_dev; break; default: set_errno (EAFNOSUPPORT); diff --git a/winsup/cygwin/select.cc b/winsup/cygwin/select.cc index 023bec048..e489fcfca 100644 --- a/winsup/cygwin/select.cc +++ b/winsup/cygwin/select.cc @@ -1602,6 +1602,51 @@ fhandler_socket_wsock::select_except (select_stuff *ss) return s; } +select_record * +fhandler_socket_unix::select_read (select_stuff *ss) +{ + select_record *s = ss->start.next; + if (!s->startup) + { + s->startup = no_startup; + s->verify = verify_ok; + } + s->h = get_io_handle_cyg (); + s->read_selected = true; + s->read_ready = true; + return s; +} + +select_record * +fhandler_socket_unix::select_write (select_stuff *ss) +{ + select_record *s = ss->start.next; + if (!s->startup) + { + s->startup = no_startup; + s->verify = verify_ok; + } + s->h = get_handle (); + s->write_selected = true; + s->write_ready = true; + return s; +} + +select_record * +fhandler_socket_unix::select_except (select_stuff *ss) +{ + select_record *s = ss->start.next; + if (!s->startup) + { + s->startup = no_startup; + s->verify = verify_ok; + } + s->h = NULL; + s->except_selected = true; + s->except_ready = false; + return s; +} + static int peek_windows (select_record *me, bool) { From c70761df66d7313fd875c7a342304b07b1788889 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 23 Feb 2018 21:00:17 +0100 Subject: [PATCH 291/649] Cygwin: Define SO_PASSCRED and SCM_CREDENTIALS Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/asm/socket.h | 1 + winsup/cygwin/include/cygwin/socket.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/include/asm/socket.h b/winsup/cygwin/include/asm/socket.h index 712a46092..9aeb889b8 100644 --- a/winsup/cygwin/include/asm/socket.h +++ b/winsup/cygwin/include/asm/socket.h @@ -58,6 +58,7 @@ details. */ #define SO_OOBINLINE 0x0100 /* leave received OOB data in line */ #define SO_DONTLINGER (unsigned int)(~SO_LINGER) #define SO_PEERCRED 0x0200 /* same as getpeereid */ +#define SO_PASSCRED 0x0400 /* enable receiving of credentials */ /* * Additional options. diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index 15e132738..79c925948 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -107,7 +107,8 @@ struct cmsghdr ((unsigned char *) ((struct cmsghdr *)(cmsg) + 1)) /* "Socket"-level control message types: */ -#define SCM_RIGHTS 0x01 /* access rights (array of int) */ +#define SCM_RIGHTS 0x01 /* descriptor passing (array of int) */ +#define SCM_CREDENTIALS 0x02 /* credential passing (struct ucred) */ #ifdef __INSIDE_CYGWIN__ /* Definition of struct msghdr up to release 1.5.18 */ From 5b6cbef9e087419ffe1dcf039910c26b1fed30b6 Mon Sep 17 00:00:00 2001 From: David Macek Date: Fri, 23 Feb 2018 14:22:44 +0100 Subject: [PATCH 292/649] doc/faq-using.xml: Add BeyondTrust and Cylance to BLODA Cylance: - https://github.com/git-for-windows/git/issues/1244 - https://cygwin.com/ml/cygwin/2017-04/msg00238.html BeyondTrust: - https://cygwin.com/ml/cygwin/2017-04/msg00092.html - https://cygwin.com/ml/cygwin/2017-05/msg00422.html --- winsup/doc/faq-using.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/winsup/doc/faq-using.xml b/winsup/doc/faq-using.xml index f583b36ef..4fca00525 100644 --- a/winsup/doc/faq-using.xml +++ b/winsup/doc/faq-using.xml @@ -1269,6 +1269,7 @@ behaviour which affect the operation of other programs, such as Cygwin. ATI Catalyst (some versions) AVAST (disable FILESYSTEM and BEHAVIOR realtime shields) Avira AntiVir +BeyondTrust PowerBroker BitDefender Bufferzone from Trustware ByteMobile laptop optimization client @@ -1277,6 +1278,7 @@ behaviour which affect the operation of other programs, such as Cygwin. ConEmu (try disabling "Inject ConEmuHk" or see ConEmuHk documentation) Citrix Metaframe Presentation Server/XenApp (see Citrix Support page) Credant Guardian Shield +CylancePROTECT Earthlink Total-Access Forefront TMG Google Desktop From 1e5e44a9a5fa0b7f0bfc876f534221f709f01d66 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 26 Feb 2018 17:53:50 +0100 Subject: [PATCH 293/649] Cygwin: fhandler_socket: define socketpair as virtual function ...in preparation of moving the type and protocol test into the actual classes. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 8 ++++++-- winsup/cygwin/fhandler_socket_inet.cc | 8 ++++++++ winsup/cygwin/fhandler_socket_local.cc | 4 +++- winsup/cygwin/fhandler_socket_unix.cc | 2 +- winsup/cygwin/net.cc | 6 +++--- 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 863cd312f..1b7e49cc1 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -544,6 +544,8 @@ class fhandler_socket: public fhandler_base char *get_proc_fd_name (char *buf); virtual int socket (int af, int type, int protocol, int flags) = 0; + virtual int socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out) = 0; virtual int bind (const struct sockaddr *name, int namelen) = 0; virtual int listen (int backlog) = 0; virtual int accept4 (struct sockaddr *peer, int *len, int flags) = 0; @@ -683,6 +685,8 @@ class fhandler_socket_inet: public fhandler_socket_wsock ~fhandler_socket_inet (); int socket (int af, int type, int protocol, int flags); + int socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out); int bind (const struct sockaddr *name, int namelen); int listen (int backlog); int accept4 (struct sockaddr *peer, int *len, int flags); @@ -769,7 +773,7 @@ class fhandler_socket_local: public fhandler_socket_wsock int socket (int af, int type, int protocol, int flags); int socketpair (int af, int type, int protocol, int flags, - fhandler_socket_local *fh_out); + fhandler_socket *fh_out); int bind (const struct sockaddr *name, int namelen); int listen (int backlog); int accept4 (struct sockaddr *peer, int *len, int flags); @@ -838,7 +842,7 @@ class fhandler_socket_unix : public fhandler_socket int socket (int af, int type, int protocol, int flags); int socketpair (int af, int type, int protocol, int flags, - fhandler_socket_unix *fh_out); + fhandler_socket *fh_out); int bind (const struct sockaddr *name, int namelen); int listen (int backlog); int accept4 (struct sockaddr *peer, int *len, int flags); diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index aa3ead7ae..42a3bd265 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -720,6 +720,14 @@ fhandler_socket_inet::socket (int af, int type, int protocol, int flags) return ret; } +int +fhandler_socket_inet::socketpair (int af, int type, int protocol, int flags, + fhandler_socket *fh_out) +{ + set_errno (EAFNOSUPPORT); + return -1; +} + int fhandler_socket_inet::bind (const struct sockaddr *name, int namelen) { diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index 6ec8fe573..d88476d1c 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -255,13 +255,15 @@ fhandler_socket_local::socket (int af, int type, int protocol, int flags) int fhandler_socket_local::socketpair (int af, int type, int protocol, int flags, - fhandler_socket_local *fh_out) + fhandler_socket *_fh_out) { SOCKET insock = INVALID_SOCKET; SOCKET outsock = INVALID_SOCKET; SOCKET sock = INVALID_SOCKET; struct sockaddr_in sock_in, sock_out; int len; + fhandler_socket_local *fh_out = reinterpret_cast + (_fh_out); /* create listening socket */ sock = ::socket (AF_INET, type, 0); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 21d2ad62d..48d0d4c54 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -235,7 +235,7 @@ fhandler_socket_unix::socket (int af, int type, int protocol, int flags) int fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, - fhandler_socket_unix *fh_out) + fhandler_socket *fh_out) { set_errno (EAFNOSUPPORT); return -1; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 89945c5a1..bd0a169dd 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2303,7 +2303,7 @@ socketpair (int af, int type, int protocol, int *sb) { int res = -1; const device *dev; - fhandler_socket_local *fh_in, *fh_out; + fhandler_socket *fh_in, *fh_out; int flags = type & _SOCK_FLAG_MASK; type &= ~_SOCK_FLAG_MASK; @@ -2349,8 +2349,8 @@ socketpair (int af, int type, int protocol, int *sb) goto done; } - fh_in = reinterpret_cast (build_fh_dev (*dev)); - fh_out = reinterpret_cast (build_fh_dev (*dev)); + fh_in = reinterpret_cast (build_fh_dev (*dev)); + fh_out = reinterpret_cast (build_fh_dev (*dev)); if (fh_in && fh_out && fh_in->socketpair (af, type, protocol, flags, fh_out) == 0) { From d35bd22992cc08d5c04ff822959bacd863abf41b Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 26 Feb 2018 17:56:47 +0100 Subject: [PATCH 294/649] Cygwin: sockets: move type and proto checks into fhandler_socket classes Encapsulation required Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_inet.cc | 7 +++++++ winsup/cygwin/fhandler_socket_local.cc | 20 ++++++++++++++++++++ winsup/cygwin/fhandler_socket_unix.cc | 20 ++++++++++++++++++++ winsup/cygwin/net.cc | 25 ------------------------- 4 files changed, 47 insertions(+), 25 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index 42a3bd265..b0dc6581c 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -708,6 +708,13 @@ fhandler_socket_inet::socket (int af, int type, int protocol, int flags) SOCKET sock; int ret; + /* This test should be covered by ::socket, but make sure we don't + accidentally try anything else. */ + if (type != SOCK_STREAM && type != SOCK_DGRAM && type != SOCK_RAW) + { + set_errno (EINVAL); + return -1; + } sock = ::socket (af, type, protocol); if (sock == INVALID_SOCKET) { diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index d88476d1c..ad2df6568 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -241,6 +241,16 @@ fhandler_socket_local::socket (int af, int type, int protocol, int flags) SOCKET sock; int ret; + if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + return -1; + } + if (protocol != 0) + { + set_errno (EPROTONOSUPPORT); + return -1; + } sock = ::socket (AF_INET, type, protocol); if (sock == INVALID_SOCKET) { @@ -265,6 +275,16 @@ fhandler_socket_local::socketpair (int af, int type, int protocol, int flags, fhandler_socket_local *fh_out = reinterpret_cast (_fh_out); + if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + return -1; + } + if (protocol != 0) + { + set_errno (EPROTONOSUPPORT); + return -1; + } /* create listening socket */ sock = ::socket (AF_INET, type, 0); if (sock == INVALID_SOCKET) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 48d0d4c54..1e4d33901 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -229,6 +229,16 @@ fhandler_socket_unix::dup (fhandler_base *child, int flags) int fhandler_socket_unix::socket (int af, int type, int protocol, int flags) { + if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + return -1; + } + if (protocol != 0) + { + set_errno (EPROTONOSUPPORT); + return -1; + } set_errno (EAFNOSUPPORT); return -1; } @@ -237,6 +247,16 @@ int fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, fhandler_socket *fh_out) { + if (type != SOCK_STREAM && type != SOCK_DGRAM) + { + set_errno (EINVAL); + return -1; + } + if (protocol != 0) + { + set_errno (EPROTONOSUPPORT); + return -1; + } set_errno (EAFNOSUPPORT); return -1; } diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index bd0a169dd..4fcc577bb 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -517,25 +517,10 @@ cygwin_socket (int af, int type, int protocol) { case AF_LOCAL: case AF_UNIX: - if (type != SOCK_STREAM && type != SOCK_DGRAM) - { - set_errno (EINVAL); - goto done; - } - if (protocol != 0) - { - set_errno (EPROTONOSUPPORT); - goto done; - } dev = (af == AF_LOCAL) ? af_local_dev : af_unix_dev; break; case AF_INET: case AF_INET6: - if (type != SOCK_STREAM && type != SOCK_DGRAM && type != SOCK_RAW) - { - set_errno (EINVAL); - goto done; - } dev = af_inet_dev; break; default: @@ -2314,16 +2299,6 @@ socketpair (int af, int type, int protocol, int *sb) { case AF_LOCAL: case AF_UNIX: - if (type != SOCK_STREAM && type != SOCK_DGRAM) - { - set_errno (EINVAL); - goto done; - } - if (protocol != 0) - { - set_errno (EPROTONOSUPPORT); - goto done; - } dev = (af == AF_LOCAL) ? af_local_dev : af_unix_dev; break; default: From 4d75035244042e478626ac0e124bd314a8fe9864 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 26 Feb 2018 17:58:46 +0100 Subject: [PATCH 295/649] Cygwin: fhandler_socket_unix: Tiny cleanup Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 39 +++++++-------------------- 1 file changed, 10 insertions(+), 29 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 1e4d33901..c539c00a1 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -32,33 +32,7 @@ #include "miscfuncs.h" #include "tls_pbuf.h" -extern "C" { - int sscanf (const char *, const char *, ...); -} /* End of "C" section */ -#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) -#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) - -#define LOCK_EVENTS \ - if (wsock_mtx && \ - WaitForSingleObject (wsock_mtx, INFINITE) != WAIT_FAILED) \ - { - -#define UNLOCK_EVENTS \ - ReleaseMutex (wsock_mtx); \ - } - -static inline mode_t -adjust_socket_file_mode (mode_t mode) -{ - /* Kludge: Don't allow to remove read bit on socket files for - user/group/other, if the accompanying write bit is set. It would - be nice to have exact permissions on a socket file, but it's - necessary that somebody able to access the socket can always read - the contents of the socket file to avoid spurious "permission - denied" messages. */ - return mode | ((mode & (S_IWUSR | S_IWGRP | S_IWOTH)) << 1); -} /* cygwin internal: map sockaddr into internet domain address */ static int __unused @@ -612,7 +586,7 @@ fhandler_socket_unix::ioctl (unsigned int cmd, void *p) int fhandler_socket_unix::fcntl (int cmd, intptr_t arg) { - int ret; + int ret = 0; switch (cmd) { @@ -630,7 +604,7 @@ fhandler_socket_unix::fcntl (int cmd, intptr_t arg) int __reg2 fhandler_socket_unix::fstat (struct stat *buf) { - int ret; + int ret = 0; if (!get_sun_path () || get_sun_path ()[0] == '\0') return fhandler_socket::fstat (buf); @@ -660,7 +634,14 @@ fhandler_socket_unix::fchmod (mode_t newmode) return fhandler_socket::fchmod (newmode); fhandler_disk_file fh (pc); fh.get_device () = FH_FS; - return fh.fchmod (S_IFSOCK | adjust_socket_file_mode (newmode)); + /* Kludge: Don't allow to remove read bit on socket files for + user/group/other, if the accompanying write bit is set. It would + be nice to have exact permissions on a socket file, but it's + necessary that somebody able to access the socket can always read + the contents of the socket file to avoid spurious "permission + denied" messages. */ + newmode |= (newmode & (S_IWUSR | S_IWGRP | S_IWOTH)) << 1; + return fh.fchmod (S_IFSOCK | newmode); } int From b995936ab5ab43a28da5f82fae6abb70a0746492 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 26 Feb 2018 18:02:36 +0100 Subject: [PATCH 296/649] Cygwin: sockets: Add missing cleanup if socket/socketpair creation fails Signed-off-by: Corinna Vinschen --- winsup/cygwin/net.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 4fcc577bb..25f94d684 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -548,7 +548,10 @@ cygwin_socket (int af, int type, int protocol) res = fd; } else - fd.release (); + { + delete fh; + fd.release (); + } } done: @@ -2346,6 +2349,8 @@ socketpair (int af, int type, int protocol, int *sb) } else { + delete fh_in; + delete fh_out; fd_in.release (); fd_out.release (); } From fbdae2c216c8713d07843b68181129e2806362ab Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 26 Feb 2018 20:39:48 +0100 Subject: [PATCH 297/649] Cygwin: reduce size of fhandler_cygdrive fhandler_cygdrive has a size of 696 bytes on x86_64, while the next biggest fhandler type, fhandler_pty_master, is 584 bytes. The members responsible for the size are private to opendir/readdir/closedir usage. fhandler_disk_file stores private readdir data in DIR->__d_internal instead. Use equivalent method with fhandler_cygdrive. This drops the size to 464 bytes. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 8 ----- winsup/cygwin/fhandler_disk_file.cc | 45 +++++++++++++++++------------ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 1b7e49cc1..3d8d745af 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -1350,14 +1350,6 @@ public: class fhandler_cygdrive: public fhandler_disk_file { - enum - { - DRVSZ = sizeof ("x:\\") - }; - int ndrives; - const char *pdrive; - char pdrive_buf[1 + (2 * 26 * DRVSZ)]; - void set_drives (); public: fhandler_cygdrive (); int open (int flags, mode_t mode); diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index cb6be2590..439f0ebaf 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -2362,7 +2362,7 @@ fhandler_disk_file::closedir (DIR *dir) } fhandler_cygdrive::fhandler_cygdrive () : - fhandler_disk_file (), ndrives (0), pdrive (NULL) + fhandler_disk_file () { } @@ -2383,13 +2383,6 @@ fhandler_cygdrive::open (int flags, mode_t mode) return open_null (flags); } -void -fhandler_cygdrive::set_drives () -{ - pdrive = pdrive_buf; - ndrives = GetLogicalDriveStrings (sizeof pdrive_buf, pdrive_buf) / DRVSZ; -} - int fhandler_cygdrive::fstat (struct stat *buf) { @@ -2412,14 +2405,28 @@ fhandler_cygdrive::fstatvfs (struct statvfs *sfs) return 0; } +#define MAX_DRIVE_BUF_LEN (sizeof ("x:\\") * 26 + 2) + +struct __DIR_drives +{ + char *pdrive; + char pbuf[MAX_DRIVE_BUF_LEN]; +}; + +#define d_drives(d) ((__DIR_drives *) (d)->__d_internal) + DIR * fhandler_cygdrive::opendir (int fd) { DIR *dir; dir = fhandler_disk_file::opendir (fd); - if (dir && !ndrives) - set_drives (); + if (dir) + { + dir->__d_internal = (uintptr_t) new __DIR_drives; + GetLogicalDriveStrings (MAX_DRIVE_BUF_LEN, d_drives(dir)->pbuf); + d_drives(dir)->pdrive = d_drives(dir)->pbuf; + } return dir; } @@ -2431,7 +2438,7 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de) while (true) { - if (!pdrive || !*pdrive) + if (!d_drives(dir)->pdrive || !*d_drives(dir)->pdrive) { if (!(dir->__flags & dirent_saw_dot)) { @@ -2441,7 +2448,7 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de) } return ENMFILE; } - disk_type dt = get_disk_type ((drive[0] = *pdrive, drive)); + disk_type dt = get_disk_type ((drive[0] = *d_drives(dir)->pdrive, drive)); if (dt == DT_SHARE_SMB) { /* Calling NetUseGetInfo on SMB drives allows to fetch the @@ -2463,16 +2470,16 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de) } } else if (dt != DT_FLOPPY - && GetFileAttributes (pdrive) != INVALID_FILE_ATTRIBUTES) + && GetFileAttributes (d_drives(dir)->pdrive) != INVALID_FILE_ATTRIBUTES) break; - pdrive = strchr (pdrive, '\0') + 1; + d_drives(dir)->pdrive = strchr (d_drives(dir)->pdrive, '\0') + 1; } - *de->d_name = cyg_tolower (*pdrive); + *de->d_name = cyg_tolower (*d_drives(dir)->pdrive); de->d_name[1] = '\0'; user_shared->warned_msdos = true; - de->d_ino = readdir_get_ino (pdrive, false); + de->d_ino = readdir_get_ino (d_drives(dir)->pdrive, false); dir->__d_position++; - pdrive = strchr (pdrive, '\0') + 1; + d_drives(dir)->pdrive = strchr (d_drives(dir)->pdrive, '\0') + 1; syscall_printf ("%p = readdir (%p) (%s)", &de, dir, de->d_name); return 0; } @@ -2480,13 +2487,13 @@ fhandler_cygdrive::readdir (DIR *dir, dirent *de) void fhandler_cygdrive::rewinddir (DIR *dir) { - pdrive = pdrive_buf; + d_drives(dir)->pdrive = d_drives(dir)->pbuf; dir->__d_position = 0; } int fhandler_cygdrive::closedir (DIR *dir) { - pdrive = pdrive_buf; + delete d_drives(dir); return 0; } From d02f3a1238270102b70594deec2a9c68d3e5d330 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 27 Feb 2018 15:30:00 +0100 Subject: [PATCH 298/649] Cygwin: sockets: Fix fstat on unnamed sockets Calling fhandler_socket::fstat from fhandler_socket::fstat recursively is not a good idea... Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 292e648c8..5f00e6946 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -309,7 +309,7 @@ fhandler_socket::fstat (struct stat *buf) { int res; - res = fhandler_socket::fstat (buf); + res = fhandler_base::fstat (buf); if (!res) { buf->st_dev = FHDEV (DEV_SOCK_MAJOR, 0); From 25ea6af1720c3040feb4826d905ad14832c638b8 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 28 Feb 2018 18:56:13 +0100 Subject: [PATCH 299/649] Cygwin: cleanup header including within network-releated files * Rearrange includes and drop unneccessary ones. * Don't pull in cygwin/socket.h into sys/un.h just to get sa_family_t. Include sys/types.h and use __sa_family_t instead. * start including Windows headers using the w32api/ path prefix Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_procnet.cc | 14 +++------- winsup/cygwin/fhandler_socket.cc | 38 +++----------------------- winsup/cygwin/fhandler_socket_inet.cc | 26 ++++++------------ winsup/cygwin/fhandler_socket_local.cc | 28 +++++++------------ winsup/cygwin/fhandler_socket_unix.cc | 23 ++++++---------- winsup/cygwin/include/sys/un.h | 5 ++-- winsup/cygwin/net.cc | 24 +++------------- winsup/cygwin/syslog.cc | 1 + 8 files changed, 43 insertions(+), 116 deletions(-) diff --git a/winsup/cygwin/fhandler_procnet.cc b/winsup/cygwin/fhandler_procnet.cc index a81ddecf9..452f33c57 100644 --- a/winsup/cygwin/fhandler_procnet.cc +++ b/winsup/cygwin/fhandler_procnet.cc @@ -16,21 +16,15 @@ details. */ #undef u_long #define u_long __ms_u_long #endif -#include -#include +#include +#include +#include +#include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "fhandler_virtual.h" #include "dtable.h" -#include "cygheap.h" -#include - -#define _COMPILING_NEWLIB -#include -#include -#include bool get_adapters_addresses (PIP_ADAPTER_ADDRESSES *pa0, ULONG family); diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc index 5f00e6946..4ef4a755b 100644 --- a/winsup/cygwin/fhandler_socket.cc +++ b/winsup/cygwin/fhandler_socket.cc @@ -6,48 +6,18 @@ Cygwin license. Please consult the file "CYGWIN_LICENSE" for details. */ -#define __INSIDE_CYGWIN_NET__ -#define USE_SYS_TYPES_FD_SET - #include "winsup.h" -#ifdef __x86_64__ -/* 2014-04-24: Current Mingw headers define sockaddr_in6 using u_long (8 byte) - because a redefinition for LP64 systems is missing. This leads to a wrong - definition and size of sockaddr_in6 when building with winsock headers. - This definition is also required to use the right u_long type in subsequent - function calls. */ -#undef u_long -#define u_long __ms_u_long -#endif -#include -#include -#include -#include -#include "cygerrno.h" -#include "security.h" -#include "path.h" -#include "fhandler.h" -#include "dtable.h" -#include "cygheap.h" +#include #include -#include "cygwin/version.h" -#include "perprocess.h" -#include "shared_info.h" -#include "sigproc.h" -#include "wininfo.h" #include #include #include #include -#include "cygtls.h" -#include -#include "ntdll.h" -#include "miscfuncs.h" +#include "cygerrno.h" +#include "path.h" +#include "fhandler.h" #include "tls_pbuf.h" -#define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) -#define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) - extern "C" { int sscanf (const char *, const char *, ...); } /* End of "C" section */ diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index b0dc6581c..a3aeccc82 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -21,31 +21,21 @@ #undef u_long #define u_long __ms_u_long #endif -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" #include "cygheap.h" -#include -#include "cygwin/version.h" -#include "perprocess.h" #include "shared_info.h" -#include "sigproc.h" #include "wininfo.h" -#include -#include -#include -#include -#include "cygtls.h" -#include -#include "ntdll.h" -#include "miscfuncs.h" -#include "tls_pbuf.h" #define ASYNC_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT) #define EVENT_MASK (FD_READ|FD_WRITE|FD_OOB|FD_ACCEPT|FD_CONNECT|FD_CLOSE) diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index ad2df6568..844cb9d11 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -21,31 +21,23 @@ #undef u_long #define u_long __ms_u_long #endif -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" #include "cygheap.h" -#include -#include "cygwin/version.h" -#include "perprocess.h" -#include "shared_info.h" -#include "sigproc.h" #include "wininfo.h" -#include -#include -#include -#include -#include "cygtls.h" -#include #include "ntdll.h" -#include "miscfuncs.h" -#include "tls_pbuf.h" extern "C" { int sscanf (const char *, const char *, ...); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index c539c00a1..ec4170ff5 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -9,25 +9,20 @@ details. */ #include "winsup.h" -#include -#include "cygerrno.h" -#include "security.h" -#include "path.h" -#include "fhandler.h" -#include "dtable.h" -#include "cygheap.h" +#include #include -#include "cygwin/version.h" -#include "perprocess.h" -#include "shared_info.h" -#include "sigproc.h" -#include "wininfo.h" #include +#include +#include #include #include #include -#include "cygtls.h" -#include +#include "cygerrno.h" +#include "path.h" +#include "fhandler.h" +#include "dtable.h" +#include "hires.h" +#include "shared_info.h" #include "ntdll.h" #include "miscfuncs.h" #include "tls_pbuf.h" diff --git a/winsup/cygwin/include/sys/un.h b/winsup/cygwin/include/sys/un.h index fa5ce278f..53be57b38 100644 --- a/winsup/cygwin/include/sys/un.h +++ b/winsup/cygwin/include/sys/un.h @@ -9,14 +9,15 @@ details. */ #ifndef _SYS_UN_H #define _SYS_UN_H +#include #include /* for strlen */ -#include + /* POSIX requires only at least 100 bytes */ #define UNIX_PATH_MAX 108 struct sockaddr_un { - sa_family_t sun_family; /* address family AF_LOCAL/AF_UNIX */ + __sa_family_t sun_family; /* address family AF_LOCAL/AF_UNIX */ char sun_path[UNIX_PATH_MAX]; /* 108 bytes of socket address */ }; diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 25f94d684..38a53f815 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -19,35 +19,21 @@ details. */ #undef u_long #define u_long __ms_u_long #endif -#include -#include -#include -#include "miscfuncs.h" -#include -#include -#include +#include +#include +#include #define gethostname cygwin_gethostname #include #undef gethostname +#include #include -#include #include -#include -#include "cygerrno.h" -#include "security.h" -#include "cygwin/version.h" #include "shared_info.h" -#include "perprocess.h" #include "path.h" #include "fhandler.h" #include "dtable.h" #include "cygheap.h" -#include "sigproc.h" -#include "registry.h" -#include "cygtls.h" -#include "ifaddrs.h" #include "tls_pbuf.h" -#include "ntdll.h" /* Unfortunately defined in Windows header files and arpa/nameser_compat.h. */ #undef NOERROR @@ -455,8 +441,6 @@ dup_ent (unionent *&dst, unionent *src, unionent::struct_type type) dp += DWORD_round (src->h_len); } } - /* Sanity check that we did our bookkeeping correctly. */ - assert ((dp - (char *) dst) == sz); } debug_printf ("duped %sent \"%s\", %p", entnames[type], dst ? dst->name : "", dst); return dst; diff --git a/winsup/cygwin/syslog.cc b/winsup/cygwin/syslog.cc index 2f4e5e8c0..e753b60dd 100644 --- a/winsup/cygwin/syslog.cc +++ b/winsup/cygwin/syslog.cc @@ -15,6 +15,7 @@ details. */ #include #include #include +#include #include #include "cygerrno.h" #include "security.h" From 892efccb2579b2c69b57bbf0d00f5705531c12f7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 28 Feb 2018 19:01:29 +0100 Subject: [PATCH 300/649] Cygwin: fhandler_socket_unix: store peer credentials in ucred member * Split out cygwin/_ucred.h file * drop local credentials Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 10 +++------- winsup/cygwin/fhandler_socket_unix.cc | 15 ++++++--------- winsup/cygwin/include/cygwin/_ucred.h | 20 ++++++++++++++++++++ winsup/cygwin/include/cygwin/socket.h | 7 +------ 4 files changed, 30 insertions(+), 22 deletions(-) create mode 100644 winsup/cygwin/include/cygwin/_ucred.h diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 3d8d745af..d222494af 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -11,6 +11,7 @@ details. */ #include "tty.h" #include +#include /* fcntl flags used only internaly. */ #define O_NOSYMLINK 0x080000 @@ -824,15 +825,10 @@ class fhandler_socket_unix : public fhandler_socket char *get_sun_path () {return sun_path;} void set_peer_sun_path (const char *path); char *get_peer_sun_path () {return peer_sun_path;} - void set_cred (); protected: - pid_t sec_pid; - uid_t sec_uid; - gid_t sec_gid; - pid_t sec_peer_pid; - uid_t sec_peer_uid; - gid_t sec_peer_gid; + struct ucred peer_cred; + void set_cred (); public: fhandler_socket_unix (); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index ec4170ff5..d912759fb 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -178,12 +178,9 @@ fhandler_socket_unix::set_peer_sun_path (const char *path) void fhandler_socket_unix::set_cred () { - sec_pid = getpid (); - sec_uid = geteuid32 (); - sec_gid = getegid32 (); - sec_peer_pid = (pid_t) 0; - sec_peer_uid = (uid_t) -1; - sec_peer_gid = (gid_t) -1; + peer_cred.pid = (pid_t) 0; + peer_cred.uid = (uid_t) -1; + peer_cred.gid = (gid_t) -1; } int @@ -317,11 +314,11 @@ fhandler_socket_unix::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) __try { if (pid) - *pid = sec_peer_pid; + *pid = peer_cred.pid; if (euid) - *euid = sec_peer_uid; + *euid = peer_cred.uid; if (egid) - *egid = sec_peer_gid; + *egid = peer_cred.gid; return 0; } __except (EFAULT) {} diff --git a/winsup/cygwin/include/cygwin/_ucred.h b/winsup/cygwin/include/cygwin/_ucred.h new file mode 100644 index 000000000..2bcba4202 --- /dev/null +++ b/winsup/cygwin/include/cygwin/_ucred.h @@ -0,0 +1,20 @@ +/* cygwin/_ucred.h + +This file is part of Cygwin. + +This software is a copyrighted work licensed under the terms of the +Cygwin license. Please consult the file "CYGWIN_LICENSE" for +details. */ + +#ifndef _CYGWIN__UCRED_H +#define _CYGWIN__UCRED_H + +#include + +struct ucred { + pid_t pid; + uid_t uid; + gid_t gid; +}; + +#endif /* _CYGWIN__UCRED_H */ diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index 79c925948..295885256 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -47,12 +47,7 @@ struct sockaddr_storage { #include /* arch-dependent defines */ #include /* the SIOCxxx I/O controls */ #include /* iovec support */ - -struct ucred { - pid_t pid; - uid_t uid; - gid_t gid; -}; +#include /* struct ucred */ struct linger { unsigned short l_onoff; /* Linger active */ From a27a7752ec68f32a826223db958effc0d98ef837 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 28 Feb 2018 19:06:41 +0100 Subject: [PATCH 301/649] Cygwin: improve storage and handling of AF_UNIX socket path Define new struct sun_name_t and use throughout internally. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 29 +++++++--- winsup/cygwin/fhandler_socket_unix.cc | 77 +++++++++++++++++++-------- 2 files changed, 77 insertions(+), 29 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index d222494af..1d4e681c4 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -12,6 +12,7 @@ details. */ #include "tty.h" #include #include +#include /* fcntl flags used only internaly. */ #define O_NOSYMLINK 0x080000 @@ -816,15 +817,31 @@ class fhandler_socket_local: public fhandler_socket_wsock } }; +struct sun_name_t +{ + __socklen_t un_len; + union + { + struct sockaddr_un un; + /* Allows 108 bytes sun_path plus trailing NUL */ + char _nul[sizeof (struct sockaddr_un) + 1]; + }; +}; + class fhandler_socket_unix : public fhandler_socket { protected: - char *sun_path; - char *peer_sun_path; - void set_sun_path (const char *path); - char *get_sun_path () {return sun_path;} - void set_peer_sun_path (const char *path); - char *get_peer_sun_path () {return peer_sun_path;} + sun_name_t *sun_path; + sun_name_t *peer_sun_path; + sun_name_t *get_sun_path () {return sun_path;} + sun_name_t *get_peer_sun_path () {return peer_sun_path;} + void set_sun_path (struct sockaddr_un *un, __socklen_t unlen); + void set_sun_path (sun_name_t *snt) + { snt ? set_sun_path (&snt->un, snt->un_len) : set_sun_path (NULL, 0); } + void set_peer_sun_path (struct sockaddr_un *un, __socklen_t unlen); + void set_peer_sun_path (sun_name_t *snt) + { snt ? set_peer_sun_path (&snt->un, snt->un_len) + : set_peer_sun_path (NULL, 0); } protected: struct ucred peer_cred; diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index d912759fb..1d8c4c4cd 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -164,15 +164,28 @@ fhandler_socket_unix::~fhandler_socket_unix () } void -fhandler_socket_unix::set_sun_path (const char *path) +fhandler_socket_unix::set_sun_path (struct sockaddr_un *un, socklen_t unlen) { - sun_path = path ? cstrdup (path) : NULL; + if (!un) + sun_path = NULL; + sun_path = (struct sun_name_t *) cmalloc_abort (HEAP_FHANDLER, + sizeof *sun_path); + sun_path->un_len = unlen; + memcpy (&sun_path->un, un, sizeof (*un)); + sun_path->_nul[sizeof (struct sockaddr_un)] = '\0'; } void -fhandler_socket_unix::set_peer_sun_path (const char *path) +fhandler_socket_unix::set_peer_sun_path (struct sockaddr_un *un, + socklen_t unlen) { - peer_sun_path = path ? cstrdup (path) : NULL; + if (!un) + peer_sun_path = NULL; + peer_sun_path = (struct sun_name_t *) cmalloc_abort (HEAP_FHANDLER, + sizeof *peer_sun_path); + peer_sun_path->un_len = unlen; + memcpy (&peer_sun_path->un, un, sizeof (*un)); + peer_sun_path->_nul[sizeof (struct sockaddr_un)] = '\0'; } void @@ -258,28 +271,34 @@ fhandler_socket_unix::connect (const struct sockaddr *name, int namelen) int fhandler_socket_unix::getsockname (struct sockaddr *name, int *namelen) { - struct sockaddr_un sun; + sun_name_t sun; - sun.sun_family = AF_UNIX; - sun.sun_path[0] = '\0'; if (get_sun_path ()) - strncat (sun.sun_path, get_sun_path (), UNIX_PATH_MAX - 1); - memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); - *namelen = (int) SUN_LEN (&sun) + (get_sun_path () ? 1 : 0); + memcpy (&sun, &get_sun_path ()->un, get_sun_path ()->un_len); + else + { + sun.un_len = sizeof (sa_family_t); + sun.un.sun_family = AF_UNIX; + sun.un.sun_path[0] = '\0'; + } + memcpy (name, &sun, MIN (*namelen, sun.un_len)); return 0; } int fhandler_socket_unix::getpeername (struct sockaddr *name, int *namelen) { - struct sockaddr_un sun; - memset (&sun, 0, sizeof sun); - sun.sun_family = AF_UNIX; - sun.sun_path[0] = '\0'; + sun_name_t sun; + if (get_peer_sun_path ()) - strncat (sun.sun_path, get_peer_sun_path (), UNIX_PATH_MAX - 1); - memcpy (name, &sun, MIN (*namelen, (int) SUN_LEN (&sun) + 1)); - *namelen = (int) SUN_LEN (&sun) + (get_peer_sun_path () ? 1 : 0); + memcpy (&sun, &get_peer_sun_path ()->un, get_peer_sun_path ()->un_len); + else + { + sun.un_len = sizeof (sa_family_t); + sun.un.sun_family = AF_UNIX; + sun.un.sun_path[0] = '\0'; + } + memcpy (name, &sun, MIN (*namelen, sun.un_len)); return 0; } @@ -598,7 +617,9 @@ fhandler_socket_unix::fstat (struct stat *buf) { int ret = 0; - if (!get_sun_path () || get_sun_path ()[0] == '\0') + if (!get_sun_path () + || get_sun_path ()->un_len <= (socklen_t) sizeof (sa_family_t) + || get_sun_path ()->un.sun_path[0] == '\0') return fhandler_socket::fstat (buf); ret = fhandler_base::fstat_fs (buf); if (!ret) @@ -612,7 +633,9 @@ fhandler_socket_unix::fstat (struct stat *buf) int __reg2 fhandler_socket_unix::fstatvfs (struct statvfs *sfs) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') + if (!get_sun_path () + || get_sun_path ()->un_len <= (socklen_t) sizeof (sa_family_t) + || get_sun_path ()->un.sun_path[0] == '\0') return fhandler_socket::fstatvfs (sfs); fhandler_disk_file fh (pc); fh.get_device () = FH_FS; @@ -622,7 +645,9 @@ fhandler_socket_unix::fstatvfs (struct statvfs *sfs) int fhandler_socket_unix::fchmod (mode_t newmode) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') + if (!get_sun_path () + || get_sun_path ()->un_len <= (socklen_t) sizeof (sa_family_t) + || get_sun_path ()->un.sun_path[0] == '\0') return fhandler_socket::fchmod (newmode); fhandler_disk_file fh (pc); fh.get_device () = FH_FS; @@ -639,7 +664,9 @@ fhandler_socket_unix::fchmod (mode_t newmode) int fhandler_socket_unix::fchown (uid_t uid, gid_t gid) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') + if (!get_sun_path () + || get_sun_path ()->un_len <= (socklen_t) sizeof (sa_family_t) + || get_sun_path ()->un.sun_path[0] == '\0') return fhandler_socket::fchown (uid, gid); fhandler_disk_file fh (pc); return fh.fchown (uid, gid); @@ -648,7 +675,9 @@ fhandler_socket_unix::fchown (uid_t uid, gid_t gid) int fhandler_socket_unix::facl (int cmd, int nentries, aclent_t *aclbufp) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') + if (!get_sun_path () + || get_sun_path ()->un_len <= (socklen_t) sizeof (sa_family_t) + || get_sun_path ()->un.sun_path[0] == '\0') return fhandler_socket::facl (cmd, nentries, aclbufp); fhandler_disk_file fh (pc); return fh.facl (cmd, nentries, aclbufp); @@ -657,7 +686,9 @@ fhandler_socket_unix::facl (int cmd, int nentries, aclent_t *aclbufp) int fhandler_socket_unix::link (const char *newpath) { - if (!get_sun_path () || get_sun_path ()[0] == '\0') + if (!get_sun_path () + || get_sun_path ()->un_len <= (socklen_t) sizeof (sa_family_t) + || get_sun_path ()->un.sun_path[0] == '\0') return fhandler_socket::link (newpath); fhandler_disk_file fh (pc); return fh.link (newpath); From 7ae89fe708a8137a3f47d39ff2f93bea1c1ef3fc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 16:41:45 +0100 Subject: [PATCH 302/649] Cygwin: path_conv: rename is_rep_symlink to is_known_reparse_point ...in preparation of reusing this flag for other types of reparse points, not only symlinks. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.cc | 6 +++--- winsup/cygwin/fhandler_disk_file.cc | 2 +- winsup/cygwin/path.cc | 2 +- winsup/cygwin/path.h | 2 +- winsup/cygwin/syscalls.cc | 15 ++++++++------- 5 files changed, 14 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/fhandler.cc b/winsup/cygwin/fhandler.cc index 93bbdfed2..45ae1ad97 100644 --- a/winsup/cygwin/fhandler.cc +++ b/winsup/cygwin/fhandler.cc @@ -594,9 +594,9 @@ fhandler_base::open (int flags, mode_t mode) if (get_device () == FH_FS) { - /* Add the reparse point flag to native symlinks, otherwise we open the - target, not the symlink. This would break lstat. */ - if (pc.is_rep_symlink ()) + /* Add the reparse point flag to known repares points, otherwise we + open the target, not the reparse point. This would break lstat. */ + if (pc.is_known_reparse_point ()) options |= FILE_OPEN_REPARSE_POINT; /* O_TMPFILE files are created with delete-on-close semantics, as well diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 439f0ebaf..66ebee8c6 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1977,7 +1977,7 @@ readdir_get_ino (const char *path, bool dot_dot) pc.get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | (pc.is_rep_symlink () + | (pc.is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0))) ) { diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index da4598931..d9968ee2f 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -1013,7 +1013,7 @@ path_conv::check (const char *src, unsigned opt, saw_symlinks = 1; if (component == 0 && !need_directory && (!(opt & PC_SYM_FOLLOW) - || (is_rep_symlink () + || (is_known_reparse_point () && (opt & PC_SYM_NOFOLLOW_REP)))) { /* last component of path is a symlink. */ diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index 8a7354017..f55804d72 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -183,7 +183,7 @@ class path_conv } int issymlink () const {return path_flags & PATH_SYMLINK;} int is_lnk_symlink () const {return path_flags & PATH_LNK;} - int is_rep_symlink () const {return path_flags & PATH_REP;} + int is_known_reparse_point () const {return path_flags & PATH_REP;} int isdevice () const {return dev.not_device (FH_FS) && dev.not_device (FH_FIFO);} int isfifo () const {return dev.is_device (FH_FIFO);} int isspecial () const {return dev.not_device (FH_FS);} diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 31b7629e8..9bae6dc0b 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -705,9 +705,9 @@ unlink_nt (path_conv &pc) pc.get_nt_native_path (), pc.isdir ()); ACCESS_MASK access = DELETE; ULONG flags = FILE_OPEN_FOR_BACKUP_INTENT; - /* Add the reparse point flag to native symlinks, otherwise we remove the - target, not the symlink. */ - if (pc.is_rep_symlink ()) + /* Add the reparse point flag to known reparse points, otherwise we remove + the target, not the reparse point. */ + if (pc.is_known_reparse_point ()) flags |= FILE_OPEN_REPARSE_POINT; pc.get_object_attr (attr, sec_none_nih); @@ -2477,7 +2477,8 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) ULONG sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | (oldpc.fs_is_samba () ? 0 : FILE_SHARE_DELETE); ULONG flags = FILE_OPEN_FOR_BACKUP_INTENT - | (oldpc.is_rep_symlink () ? FILE_OPEN_REPARSE_POINT : 0); + | (oldpc.is_known_reparse_point () + ? FILE_OPEN_REPARSE_POINT : 0); status = NtOpenFile (&fh, access, oldpc.get_object_attr (attr, sec_none_nih), &io, sharing, flags); @@ -2541,7 +2542,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) dstpc->get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | (dstpc->is_rep_symlink () + | (dstpc->is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0)); if (!NT_SUCCESS (status)) { @@ -2575,7 +2576,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) (removepc ?: dstpc)->get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | ((removepc ?: dstpc)->is_rep_symlink () + | ((removepc ?: dstpc)->is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0)))) { FILE_INTERNAL_INFORMATION ofii, nfii; @@ -2651,7 +2652,7 @@ rename2 (const char *oldpath, const char *newpath, unsigned int flags) oldpc.get_object_attr (attr, sec_none_nih), &io, FILE_SHARE_VALID_FLAGS, FILE_OPEN_FOR_BACKUP_INTENT - | (oldpc.is_rep_symlink () + | (oldpc.is_known_reparse_point () ? FILE_OPEN_REPARSE_POINT : 0)); if (NT_SUCCESS (status)) { From 28cf818c2eb7045c5a60ba4d4ae0a524f5c0162e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 16:44:09 +0100 Subject: [PATCH 303/649] Cygwin: path.cc: clean up includes Signed-off-by: Corinna Vinschen --- winsup/cygwin/path.cc | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index d9968ee2f..025acd6e2 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -52,26 +52,20 @@ declaration error with the XPG variant implemented herein. */ #define basename basename #include "winsup.h" -#include "miscfuncs.h" -#include -#include -#include +#include +#include #include #include +#include #include "cygerrno.h" -#include "security.h" #include "path.h" #include "fhandler.h" #include "dtable.h" #include "cygheap.h" #include "shared_info.h" -#include "cygtls.h" #include "tls_pbuf.h" #include "environ.h" -#include -#include -#include -#include +#include "uuid.h" #undef basename suffix_info stat_suffixes[] = @@ -710,8 +704,6 @@ path_conv::check (const char *src, unsigned opt, /* This loop handles symlink expansion. */ for (;;) { - assert (src); - is_relpath = !isabspath (src); error = normalize_posix_path (src, path_copy, tail); if (error > 0) From 3e16fd698645f8d197ea2d9e01bd00e6afe8f2fa Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 16:50:41 +0100 Subject: [PATCH 304/649] Cygwin: ntdll.h: drop macros available in mingw-w64 headers Signed-off-by: Corinna Vinschen --- winsup/cygwin/ntdll.h | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 448eadf20..58d63425e 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -8,18 +8,12 @@ #pragma once -#include +#include + /* custom status code: */ #define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269) -/* As of March 2013, Mingw doesn't define these status codes yet. */ -#ifndef STATUS_NETWORK_OPEN_RESTRICTION -#define STATUS_NETWORK_OPEN_RESTRICTION ((NTSTATUS)0xC0000201) -#endif -#ifndef STATUS_SYMLINK_CLASS_DISABLED -#define STATUS_SYMLINK_CLASS_DISABLED ((NTSTATUS)0xC0000715) -#endif #define NtCurrentProcess() ((HANDLE) (LONG_PTR) -1) #define NtCurrentThread() ((HANDLE) (LONG_PTR) -2) From 65267a9a340f2a36884eea3034128781323520d3 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 16:51:12 +0100 Subject: [PATCH 305/649] Cygwin: move transaction helpers into ntdll.h We'll need them elsewhere in future. Signed-off-by: Corinna Vinschen = (ULONG)STATUS_TRANSACTIONAL_CONFLICT) \ + && ((ULONG)(s) <= (ULONG)STATUS_TRANSACTION_NOT_ENLISTED)) #define NtCurrentProcess() ((HANDLE) (LONG_PTR) -1) #define NtCurrentThread() ((HANDLE) (LONG_PTR) -2) @@ -1601,5 +1605,36 @@ extern "C" && ebi.SignalState != 0; } + + static inline void + start_transaction (HANDLE &old_trans, HANDLE &trans) + { + NTSTATUS status = NtCreateTransaction (&trans, + SYNCHRONIZE | TRANSACTION_ALL_ACCESS, + NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + if (NT_SUCCESS (status)) + { + old_trans = RtlGetCurrentTransaction (); + RtlSetCurrentTransaction (trans); + } + else + { + debug_printf ("NtCreateTransaction failed, %y", status); + old_trans = trans = NULL; + } + } + + static inline NTSTATUS + stop_transaction (NTSTATUS status, HANDLE old_trans, HANDLE &trans) + { + RtlSetCurrentTransaction (old_trans); + if (NT_SUCCESS (status)) + status = NtCommitTransaction (trans, TRUE); + else + status = NtRollbackTransaction (trans, TRUE); + NtClose (trans); + trans = NULL; + return status; + } } #endif diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 9bae6dc0b..6d1085539 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -182,42 +182,6 @@ dup3 (int oldfd, int newfd, int flags) return res; } -/* Define macro to simplify checking for a transactional error code. */ -#define NT_TRANSACTIONAL_ERROR(s) \ - (((ULONG)(s) >= (ULONG)STATUS_TRANSACTIONAL_CONFLICT) \ - && ((ULONG)(s) <= (ULONG)STATUS_TRANSACTION_NOT_ENLISTED)) - -static inline void -start_transaction (HANDLE &old_trans, HANDLE &trans) -{ - NTSTATUS status = NtCreateTransaction (&trans, - SYNCHRONIZE | TRANSACTION_ALL_ACCESS, - NULL, NULL, NULL, 0, 0, 0, NULL, NULL); - if (NT_SUCCESS (status)) - { - old_trans = RtlGetCurrentTransaction (); - RtlSetCurrentTransaction (trans); - } - else - { - debug_printf ("NtCreateTransaction failed, %y", status); - old_trans = trans = NULL; - } -} - -static inline NTSTATUS -stop_transaction (NTSTATUS status, HANDLE old_trans, HANDLE &trans) -{ - RtlSetCurrentTransaction (old_trans); - if (NT_SUCCESS (status)) - status = NtCommitTransaction (trans, TRUE); - else - status = NtRollbackTransaction (trans, TRUE); - NtClose (trans); - trans = NULL; - return status; -} - static const char desktop_ini[] = "[.ShellClassInfo]\r\n" "CLSID={645FF040-5081-101B-9F08-00AA002F954E}\r\n" From aa467e6e3305a63a06161374d3ebb0c56f6c6193 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 16:54:57 +0100 Subject: [PATCH 306/649] Cygwin: add AF_UNIX reparse points to path handling * check_reparse_point_target returns a path flag mask, rather than just 1. Return PATH_SYMLINK | PATH_REP for symlinks and directory mount points, PATH_SOCKET | PATH_REP for AF_UNIX sockets. * Define Cygwin AF_UNIX socket reparse tag and GUID in ntdll.h. Signed-off-by: Corinna Vinschen --- winsup/cygwin/ntdll.h | 3 +++ winsup/cygwin/path.cc | 25 ++++++++++++++++++------- winsup/cygwin/path.h | 3 ++- 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 0112349d3..b77fa3966 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -10,6 +10,9 @@ #include +/* Special values for Cygwin AF_UNIX socket reparse points. */ +#define IO_REPARSE_TAG_CYGUNIX (0x00006375) +#define CYGWIN_SOCKET_UUID L"efc1714d-7b19-4407-bab3-c5b1f92cb88c" /* custom status code: */ #define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index 025acd6e2..f608257f3 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -951,8 +951,9 @@ path_conv::check (const char *src, unsigned opt, return; } fileattr = sym.fileattr; - dev.parse (FH_LOCAL); + dev.parse ((sym.pflags & PATH_REP) ? FH_UNIX : FH_LOCAL); dev.setfs (1); + path_flags = sym.pflags; goto out; } @@ -2329,7 +2330,7 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp, rp->SymbolicLinkReparseBuffer.SubstituteNameLength); if ((rp->SymbolicLinkReparseBuffer.Flags & SYMLINK_FLAG_RELATIVE) || check_reparse_point_string (psymbuf)) - return 1; + return PATH_SYMLINK | PATH_REP; } else if (!remote && rp->ReparseTag == IO_REPARSE_TAG_MOUNT_POINT) { @@ -2350,7 +2351,16 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp, return -EPERM; } if (check_reparse_point_string (psymbuf)) - return 1; + return PATH_SYMLINK | PATH_REP; + } + else if (rp->ReparseTag == IO_REPARSE_TAG_CYGUNIX) + { + PREPARSE_GUID_DATA_BUFFER rgp = (PREPARSE_GUID_DATA_BUFFER) rp; + UUID uuid; + + uuid_from_string (CYGWIN_SOCKET_UUID, uuid); + if (memcmp (&uuid, &rgp->ReparseGuid, sizeof (UUID)) == 0) + return PATH_SOCKET | PATH_REP; } return 0; } @@ -2377,10 +2387,11 @@ symlink_info::check_reparse_point (HANDLE h, bool remote) fileattr &= ~FILE_ATTRIBUTE_REPARSE_POINT; return ret; } - /* ret is > 0, so it's a reparse point, path in symbuf. */ - sys_wcstombs (srcbuf, SYMLINK_MAX + 7, symbuf.Buffer, - symbuf.Length / sizeof (WCHAR)); - pflags |= PATH_SYMLINK | PATH_REP; + /* ret is > 0, so it's a known reparse point, path in symbuf. */ + pflags |= ret; + if (ret & PATH_SYMLINK) + sys_wcstombs (srcbuf, SYMLINK_MAX + 7, symbuf.Buffer, + symbuf.Length / sizeof (WCHAR)); /* A symlink is never a directory. */ fileattr &= ~FILE_ATTRIBUTE_DIRECTORY; return posixify (srcbuf); diff --git a/winsup/cygwin/path.h b/winsup/cygwin/path.h index f55804d72..dca1e0498 100644 --- a/winsup/cygwin/path.h +++ b/winsup/cygwin/path.h @@ -192,7 +192,8 @@ class path_conv int is_fs_device () const {return isdevice () && is_fs_special ();} int is_fs_special () const {return dev.is_fs_special ();} int is_lnk_special () const {return is_fs_device () || isfifo () || is_lnk_symlink ();} - int issocket () const {return dev.is_device (FH_LOCAL);} + int issocket () const {return dev.is_device (FH_LOCAL) + || dev.is_device (FH_UNIX);} int iscygexec () const {return path_flags & PATH_CYGWIN_EXEC;} int isopen () const {return path_flags & PATH_OPEN;} int isctty_capable () const {return path_flags & PATH_CTTY;} From dc3928fc75550422306f9630d34430634767d87a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Thu, 1 Mar 2018 18:14:23 +0100 Subject: [PATCH 307/649] Cygwin: convert sun_name_t into class Add constructors and new/delete operators to make sure sun_name_t objects are allocated on the cygheap. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 19 ++++++++++++++++++- winsup/cygwin/fhandler_socket_unix.cc | 16 ++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 1d4e681c4..cfd93d2c8 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -817,8 +817,9 @@ class fhandler_socket_local: public fhandler_socket_wsock } }; -struct sun_name_t +class sun_name_t { + public: __socklen_t un_len; union { @@ -826,6 +827,22 @@ struct sun_name_t /* Allows 108 bytes sun_path plus trailing NUL */ char _nul[sizeof (struct sockaddr_un) + 1]; }; + sun_name_t () + { + un_len = 0; + un.sun_family = 0; + _nul[sizeof (struct sockaddr_un)] = '\0'; + } + sun_name_t (const struct sockaddr *name, __socklen_t namelen) + { + un_len = namelen < (__socklen_t) sizeof un ? namelen : sizeof un; + memcpy (&un, name, un_len); + _nul[sizeof (struct sockaddr_un)] = '\0'; + } + + void *operator new (size_t) __attribute__ ((nothrow)) + { return cmalloc_abort (HEAP_FHANDLER, sizeof (sun_name_t)); } + void operator delete (void *p) {cfree (p);} }; class fhandler_socket_unix : public fhandler_socket diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 1d8c4c4cd..506befc51 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -158,9 +158,9 @@ fhandler_socket_unix::fhandler_socket_unix () : fhandler_socket_unix::~fhandler_socket_unix () { if (sun_path) - cfree (sun_path); + delete sun_path; if (peer_sun_path) - cfree (peer_sun_path); + delete peer_sun_path; } void @@ -168,11 +168,7 @@ fhandler_socket_unix::set_sun_path (struct sockaddr_un *un, socklen_t unlen) { if (!un) sun_path = NULL; - sun_path = (struct sun_name_t *) cmalloc_abort (HEAP_FHANDLER, - sizeof *sun_path); - sun_path->un_len = unlen; - memcpy (&sun_path->un, un, sizeof (*un)); - sun_path->_nul[sizeof (struct sockaddr_un)] = '\0'; + sun_path = new sun_name_t ((const struct sockaddr *) un, unlen); } void @@ -181,11 +177,7 @@ fhandler_socket_unix::set_peer_sun_path (struct sockaddr_un *un, { if (!un) peer_sun_path = NULL; - peer_sun_path = (struct sun_name_t *) cmalloc_abort (HEAP_FHANDLER, - sizeof *peer_sun_path); - peer_sun_path->un_len = unlen; - memcpy (&peer_sun_path->un, un, sizeof (*un)); - peer_sun_path->_nul[sizeof (struct sockaddr_un)] = '\0'; + peer_sun_path = new sun_name_t ((const struct sockaddr *) un, unlen); } void From b7520b14d5fe175d9bc60266700fb7b988600a84 Mon Sep 17 00:00:00 2001 From: Our Air Quality Date: Wed, 28 Feb 2018 23:31:48 +1100 Subject: [PATCH 308/649] Add global stdio streams support for reent small. --- newlib/libc/include/sys/reent.h | 45 ++++++++++++++++++++++++++++++--- newlib/libc/stdio/findfp.c | 16 ++++++++---- newlib/libc/stdio/local.h | 6 ++--- 3 files changed, 56 insertions(+), 11 deletions(-) diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/reent.h index 1ef226194..6e55e1c1f 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -144,7 +144,7 @@ struct __sbuf { * _ub._base!=NULL) and _up and _ur save the current values of _p and _r. */ -#ifdef _REENT_SMALL +#if defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS) /* * struct __sFILE_fake is the start of a struct __sFILE, with only the * minimal fields allocated. In __sinit() we really allocate the 3 @@ -174,9 +174,9 @@ extern void __sinit (struct _reent *); __sinit (ptr); \ } \ while (0) -#else +#else /* _REENT_SMALL && !_REENT_GLOBAL_STDIO_STREAMS */ # define _REENT_SMALL_CHECK_INIT(ptr) /* nothing */ -#endif +#endif /* _REENT_SMALL && !_REENT_GLOBAL_STDIO_STREAMS */ struct __sFILE { unsigned char *_p; /* current position in (some) buffer */ @@ -418,6 +418,43 @@ struct _reent char *_signal_buf; /* strsignal */ }; +#ifdef _REENT_GLOBAL_STDIO_STREAMS +extern __FILE __sf[3]; + +# define _REENT_INIT(var) \ + { 0, \ + &__sf[0], \ + &__sf[1], \ + &__sf[2], \ + 0, \ + _NULL, \ + 0, \ + 0, \ + _NULL, \ + _NULL, \ + _NULL, \ + 0, \ + 0, \ + _NULL, \ + _NULL, \ + _NULL, \ + _NULL, \ + _NULL, \ + _REENT_INIT_ATEXIT \ + {_NULL, 0, _NULL}, \ + _NULL, \ + _NULL, \ + _NULL \ + } + +#define _REENT_INIT_PTR_ZEROED(var) \ + { (var)->_stdin = &__sf[0]; \ + (var)->_stdout = &__sf[1]; \ + (var)->_stderr = &__sf[2]; \ + } + +#else /* _REENT_GLOBAL_STDIO_STREAMS */ + extern const struct __sFILE_fake __sf_fake_stdin; extern const struct __sFILE_fake __sf_fake_stdout; extern const struct __sFILE_fake __sf_fake_stderr; @@ -454,6 +491,8 @@ extern const struct __sFILE_fake __sf_fake_stderr; (var)->_stderr = (__FILE *)&__sf_fake_stderr; \ } +#endif /* _REENT_GLOBAL_STDIO_STREAMS */ + /* Only add assert() calls if we are specified to debug. */ #ifdef _REENT_CHECK_DEBUG #include diff --git a/newlib/libc/stdio/findfp.c b/newlib/libc/stdio/findfp.c index cf924536f..7119c051b 100644 --- a/newlib/libc/stdio/findfp.c +++ b/newlib/libc/stdio/findfp.c @@ -26,7 +26,7 @@ #include #include "local.h" -#ifdef _REENT_SMALL +#if defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS) const struct __sFILE_fake __sf_fake_stdin = {_NULL, 0, 0, 0, 0, {_NULL, 0}, 0, _NULL}; const struct __sFILE_fake __sf_fake_stdout = @@ -73,7 +73,7 @@ std (FILE *ptr, #else /* _STDIO_CLOSE_STD_STREAMS */ ptr->_close = NULL; #endif /* _STDIO_CLOSE_STD_STREAMS */ -#if !defined(__SINGLE_THREAD__) && !defined(_REENT_SMALL) +#if !defined(__SINGLE_THREAD__) && !(defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS)) __lock_init_recursive (ptr->_lock); /* * #else @@ -260,7 +260,7 @@ __sinit (struct _reent *s) # ifndef _REENT_GLOBAL_STDIO_STREAMS s->__sglue._niobs = 3; s->__sglue._iobs = &s->__sf[0]; -# endif +# endif /* _REENT_GLOBAL_STDIO_STREAMS */ #else s->__sglue._niobs = 0; s->__sglue._iobs = NULL; @@ -269,9 +269,15 @@ __sinit (struct _reent *s) __sinit if it's 0. */ if (s == _GLOBAL_REENT) s->__sdidinit = 1; +# ifndef _REENT_GLOBAL_STDIO_STREAMS s->_stdin = __sfp(s); s->_stdout = __sfp(s); s->_stderr = __sfp(s); +# else /* _REENT_GLOBAL_STDIO_STREAMS */ + s->_stdin = &__sf[0]; + s->_stdout = &__sf[1]; + s->_stderr = &__sf[2]; +# endif /* _REENT_GLOBAL_STDIO_STREAMS */ #endif #ifdef _REENT_GLOBAL_STDIO_STREAMS @@ -282,11 +288,11 @@ __sinit (struct _reent *s) stdout_init (&__sf[1]); stderr_init (&__sf[2]); } -#else +#else /* _REENT_GLOBAL_STDIO_STREAMS */ stdin_init (s->_stdin); stdout_init (s->_stdout); stderr_init (s->_stderr); -#endif +#endif /* _REENT_GLOBAL_STDIO_STREAMS */ s->__sdidinit = 1; diff --git a/newlib/libc/stdio/local.h b/newlib/libc/stdio/local.h index 5f56792de..53694aa1c 100644 --- a/newlib/libc/stdio/local.h +++ b/newlib/libc/stdio/local.h @@ -197,7 +197,7 @@ extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *, /* Called by the main entry point fns to ensure stdio has been initialized. */ -#ifdef _REENT_SMALL +#if defined(_REENT_SMALL) && !defined(_REENT_GLOBAL_STDIO_STREAMS) #define CHECK_INIT(ptr, fp) \ do \ { \ @@ -212,7 +212,7 @@ extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *, (fp) = _stderr_r(_check_init_ptr); \ } \ while (0) -#else /* !_REENT_SMALL */ +#else /* !_REENT_SMALL || _REENT_GLOBAL_STDIO_STREAMS */ #define CHECK_INIT(ptr, fp) \ do \ { \ @@ -221,7 +221,7 @@ extern _READ_WRITE_RETURN_TYPE __swrite64 (struct _reent *, void *, __sinit (_check_init_ptr); \ } \ while (0) -#endif /* !_REENT_SMALL */ +#endif /* !_REENT_SMALL || _REENT_GLOBAL_STDIO_STREAMS */ #define CHECK_STD_INIT(ptr) \ do \ From d87ef0dac99a453497d5b53d18cd4661500b963a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 18:03:11 +0100 Subject: [PATCH 309/649] Cygwin: ntdll.h: add definitions required for pipe-based AF_UNIX Also remove redundant declaration of RtlInitEmptyUnicodeString Signed-off-by: Corinna Vinschen --- winsup/cygwin/ntdll.h | 48 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index b77fa3966..68c359e32 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -65,6 +65,7 @@ /* Symbolic link access rights (only in NT namespace). */ #define SYMBOLIC_LINK_QUERY 1 +#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1) /* Transaction access rights. */ #ifndef TRANSACTION_ALL_ACCESS @@ -939,6 +940,18 @@ typedef struct _FILE_ALL_INFORMATION { FILE_NAME_INFORMATION NameInformation; } FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION; +enum +{ + FILE_PIPE_QUEUE_OPERATION = 0, + FILE_PIPE_COMPLETE_OPERATION = 1 +}; + +enum +{ + FILE_PIPE_BYTE_STREAM_MODE = 0, + FILE_PIPE_MESSAGE_MODE = 1 +}; + enum { FILE_PIPE_DISCONNECTED_STATE = 1, @@ -947,6 +960,32 @@ enum FILE_PIPE_CLOSING_STATE = 4 }; +enum +{ + FILE_PIPE_INBOUND = 0, + FILE_PIPE_OUTBOUND = 1, + FILE_PIPE_FULL_DUPLEX = 2 +}; + +enum +{ + FILE_PIPE_CLIENT_END = 0, + FILE_PIPE_SERVER_END = 1 +}; + +enum +{ + FILE_PIPE_BYTE_STREAM_TYPE = 0, + FILE_PIPE_MESSAGE_TYPE = 1 +}; + +/* Checked on 64 bit. */ +typedef struct _FILE_PIPE_INFORMATION +{ + ULONG ReadMode; + ULONG CompletionMode; +} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION; + /* Checked on 64 bit. */ typedef struct _FILE_PIPE_LOCAL_INFORMATION { @@ -1273,10 +1312,18 @@ extern "C" PLARGE_INTEGER); NTSTATUS NTAPI NtCreateMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, BOOLEAN); + NTSTATUS NTAPI NtCreateNamedPipeFile (PHANDLE, ACCESS_MASK, + POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK, + ULONG, ULONG, ULONG, ULONG, ULONG, + ULONG, ULONG, ULONG, ULONG, + PLARGE_INTEGER); NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, PLARGE_INTEGER, ULONG, ULONG, HANDLE); NTSTATUS NTAPI NtCreateSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, LONG, LONG); + NTSTATUS NTAPI NtCreateSymbolicLinkObject (PHANDLE, ACCESS_MASK, + POBJECT_ATTRIBUTES, + PUNICODE_STRING); NTSTATUS NTAPI NtCreateTimer (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, TIMER_TYPE); NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, @@ -1455,7 +1502,6 @@ extern "C" PBOOLEAN); NTSTATUS NTAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW); PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID); - VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT); VOID NTAPI RtlInitAnsiString (PANSI_STRING, PCSTR); NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR); VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR); From 1949db782917f6703da736f9f15665ca7e5d6e0d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 18:07:39 +0100 Subject: [PATCH 310/649] Cygwin: drop CYGWIN_SOCKET_UUID, define CYGWIN_SOCKET_GUID as GUID pointer Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 8 ++++++++ winsup/cygwin/ntdll.h | 5 +++-- winsup/cygwin/path.cc | 5 +---- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 506befc51..ee43b1f7b 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -34,6 +34,14 @@ static int __unused get_inet_addr_unix (const struct sockaddr *in, int inlen, struct sockaddr_storage *out, int *outlen, int *type = NULL) +GUID __cygwin_socket_guid = { + .Data1 = 0xefc1714d, + .Data2 = 0x7b19, + .Data3 = 0x4407, + .Data4 = { 0xba, 0xb3, 0xc5, 0xb1, 0xf9, 0x2c, 0xb8, 0x8c } +}; + +HANDLE { /* Check for abstract socket. */ if (inlen >= (int) sizeof (in->sa_family) + 7 diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index 68c359e32..c89591f44 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -10,9 +10,10 @@ #include -/* Special values for Cygwin AF_UNIX socket reparse points. */ +/* Values for Cygwin AF_UNIX socket reparse points. */ #define IO_REPARSE_TAG_CYGUNIX (0x00006375) -#define CYGWIN_SOCKET_UUID L"efc1714d-7b19-4407-bab3-c5b1f92cb88c" +extern GUID __cygwin_socket_guid; +#define CYGWIN_SOCKET_GUID (&__cygwin_socket_guid) /* custom status code: */ #define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269) diff --git a/winsup/cygwin/path.cc b/winsup/cygwin/path.cc index f608257f3..a132a0a7e 100644 --- a/winsup/cygwin/path.cc +++ b/winsup/cygwin/path.cc @@ -65,7 +65,6 @@ #include "shared_info.h" #include "tls_pbuf.h" #include "environ.h" -#include "uuid.h" #undef basename suffix_info stat_suffixes[] = @@ -2356,10 +2355,8 @@ check_reparse_point_target (HANDLE h, bool remote, PREPARSE_DATA_BUFFER rp, else if (rp->ReparseTag == IO_REPARSE_TAG_CYGUNIX) { PREPARSE_GUID_DATA_BUFFER rgp = (PREPARSE_GUID_DATA_BUFFER) rp; - UUID uuid; - uuid_from_string (CYGWIN_SOCKET_UUID, uuid); - if (memcmp (&uuid, &rgp->ReparseGuid, sizeof (UUID)) == 0) + if (memcmp (CYGWIN_SOCKET_GUID, &rgp->ReparseGuid, sizeof (GUID)) == 0) return PATH_SOCKET | PATH_REP; } return 0; From 488221cf5c5263ba1a82391c80c00b8157e362cc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 18:09:35 +0100 Subject: [PATCH 311/649] Cygwin: small_s[w]printf: add '_' modifier to print lower case hex digits Signed-off-by: Corinna Vinschen --- winsup/cygwin/smallprint.cc | 120 ++++++++++++++++++++++-------------- 1 file changed, 74 insertions(+), 46 deletions(-) diff --git a/winsup/cygwin/smallprint.cc b/winsup/cygwin/smallprint.cc index 8553f7002..9a4a1c897 100644 --- a/winsup/cygwin/smallprint.cc +++ b/winsup/cygwin/smallprint.cc @@ -13,13 +13,46 @@ details. */ #include #include +/* + Meaning of format conversion specifiers. If 'l' isn't explicitely mentioned, + it's ignored! + + 0 modifier: pad with zero instead of spaces + 0-9 modifier: field length + + modifier: always add sign + l modifier to d, o, R, u, x, y: 4 byte on 32 bit, 8 byte on 64 bit + l modifier to s, S, W: non-ASCII tweaking + _ modifier: print lower case hex chars a-f instead of A-F + + c char + C WCHAR/wchar_t + d signed int, 4 byte + D signed long long, 8 byte + E GetLastError + o octal unsigned int, 4 byte + O octal unsigned long long, 8 byte + p address + P process name + R return value, 4 byte. + s char * + S PUNICODE_STRING + u unsigned int, 4 byte + U unsigned long long, 8 byte + W PWCHAR/wchar_t * + x hex unsigned int, 4 byte + X hex unsigned long long, 8 byte + y 0x hex unsigned int, 4 byte + Y 0x hex unsigned long long, 8 byte +*/ + #define LLMASK (0xffffffffffffffffULL) #define LMASK (0xffffffff) #define rnarg(dst, base, dosign, len, pad) __rn ((dst), (base), (dosign), va_arg (ap, int32_t), len, pad, LMASK) #define rnargLL(dst, base, dosign, len, pad) __rn ((dst), (base), (dosign), va_arg (ap, uint64_t), len, pad, LLMASK) -static const char hex_str[] = "0123456789ABCDEF"; +static const char hex_str_upper[] = "0123456789ABCDEF"; +static const char hex_str_lower[] = "0123456789abcdef"; class tmpbuf { @@ -56,6 +89,15 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned unsigned long long uval = 0; char res[20]; int l = 0; + const char *hex_str; + + if (base < 0) + { + base = -base; + hex_str = hex_str_lower; + } + else + hex_str = hex_str_upper; if (dosign && val < 0) { @@ -88,40 +130,6 @@ __rn (char *dst, int base, int dosign, long long val, int len, int pad, unsigned return dst; } -/* - Meaning of format conversion specifiers. If 'l' isn't explicitely mentioned, - it's ignored! - - c char - C WCHAR/wchar_t - d signed int, 4 byte - ld signed long, 4 byte on 32 bit, 8 byte on 64 bit - D signed long long, 8 byte - E GetLastError - o octal unsigned int, 4 byte - lo octal unsigned long, 4 byte on 32 bit, 8 byte on 64 bit - O octal unsigned long long, 8 byte - p address - P process name - R return value, 4 byte. - lR return value, 4 byte on 32 bit, 8 byte on 64 bit. - s char * - ls char * w/ non-ASCII tweaking - S PUNICODE_STRING - lS PUNICODE_STRING w/ non-ASCII tweaking - u unsigned int, 4 byte - lu unsigned long, 4 byte on 32 bit, 8 byte on 64 bit - U unsigned long long, 8 byte - W PWCHAR/wchar_t * - lW PWCHAR/wchar_t * w/ non-ASCII tweaking - x hex unsigned int, 4 byte - lx hex unsigned long, 4 byte on 32 bit, 8 byte on 64 bit - X hex unsigned long long, 8 byte - y 0x hex unsigned int, 4 byte - ly 0x hex unsigned long, 4 byte on 32 bit, 8 byte on 64 bit - Y 0x hex unsigned long long, 8 byte -*/ - int __small_vsprintf (char *dst, const char *fmt, va_list ap) { @@ -139,6 +147,9 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) { int i, n = 0x7fff; bool l_opt = false; + /* set to -1 on '_', indicates upper (1)/lower(-1) case */ + int h_opt = 1; + const char *hex_str = hex_str_upper; if (*fmt != '%') *dst++ = *fmt++; else @@ -170,13 +181,16 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) continue; } /*FALLTHRU*/ - case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': + case '1' ... '9': len = len * 10 + (c - '0'); continue; case 'l': l_opt = true; continue; + case '_': + h_opt = -1; + hex_str = hex_str_lower; + continue; case 'c': { unsigned char c = (va_arg (ap, int) & 0xff); @@ -186,7 +200,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) { *dst++ = '0'; *dst++ = 'x'; - dst = __rn (dst, 16, 0, c, len, pad, LMASK); + dst = __rn (dst, h_opt * 16, 0, c, len, pad, LMASK); } } break; @@ -249,7 +263,7 @@ __small_vsprintf (char *dst, const char *fmt, va_list ap) goto gen_decimalLL; #endif gen_decimal: - dst = rnarg (dst, base, addsign, len, pad); + dst = rnarg (dst, h_opt * base, addsign, len, pad); break; case 'D': base = 10; @@ -270,15 +284,15 @@ gen_decimal: base = 16; addsign = 0; gen_decimalLL: - dst = rnargLL (dst, base, addsign, len, pad); + dst = rnargLL (dst, h_opt * base, addsign, len, pad); break; case 'p': *dst++ = '0'; *dst++ = 'x'; #ifdef __x86_64__ - dst = rnargLL (dst, 16, 0, len, pad); + dst = rnargLL (dst, h_opt * 16, 0, len, pad); #else - dst = rnarg (dst, 16, 0, len, pad); + dst = rnarg (dst, h_opt * 16, 0, len, pad); #endif break; case '.': @@ -432,6 +446,15 @@ __wrn (PWCHAR dst, int base, int dosign, long long val, int len, int pad, unsign unsigned long long uval = 0; WCHAR res[20]; int l = 0; + const char *hex_str; + + if (base < 0) + { + base = -base; + hex_str = hex_str_lower; + } + else + hex_str = hex_str_upper; if (dosign && val < 0) { @@ -483,6 +506,8 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) #ifdef __x86_64__ bool l_opt = false; #endif + /* set to -1 on '_', indicates upper (1)/lower(-1) case */ + int h_opt = 1; if (*fmt != L'%') *dst++ = *fmt++; else @@ -522,6 +547,9 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) l_opt = true; #endif continue; + case '_': + h_opt = -1; + continue; case L'c': case L'C': *dst++ = va_arg (ap, unsigned); @@ -576,7 +604,7 @@ __small_vswprintf (PWCHAR dst, const WCHAR *fmt, va_list ap) goto gen_decimalLL; #endif gen_decimal: - dst = wrnarg (dst, base, addsign, len, pad); + dst = wrnarg (dst, h_opt * base, addsign, len, pad); break; case 'D': base = 10; @@ -597,15 +625,15 @@ gen_decimal: base = 16; addsign = 0; gen_decimalLL: - dst = wrnargLL (dst, base, addsign, len, pad); + dst = wrnargLL (dst, h_opt * base, addsign, len, pad); break; case L'p': *dst++ = L'0'; *dst++ = L'x'; #ifdef __x86_64__ - dst = wrnargLL (dst, 16, 0, len, pad); + dst = wrnargLL (dst, h_opt * 16, 0, len, pad); #else - dst = wrnarg (dst, 16, 0, len, pad); + dst = wrnarg (dst, h_opt * 16, 0, len, pad); #endif break; case L'P': From 7d260cfac42db6af3a1c8dd5f1f27491d3963371 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 18:11:57 +0100 Subject: [PATCH 312/649] Cygwin: add transform_chars_af_unix helper This function is going to be used for transposing sun_path of abstract sockets. This also adds a transposition of the NUL character to tfx_chars since NUL-bytes in abstract socket names are perfectly valid. Signed-off-by: Corinna Vinschen --- winsup/cygwin/miscfuncs.h | 2 ++ winsup/cygwin/strfuncs.cc | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/miscfuncs.h b/winsup/cygwin/miscfuncs.h index 3960b5429..8ad9643a3 100644 --- a/winsup/cygwin/miscfuncs.h +++ b/winsup/cygwin/miscfuncs.h @@ -96,6 +96,8 @@ transform_chars (PUNICODE_STRING upath, USHORT start_idx) upath->Buffer + upath->Length / sizeof (WCHAR) - 1); } +PWCHAR transform_chars_af_unix (PWCHAR, const char *, __socklen_t); + /* Memory checking */ int __reg2 check_invalid_virtual_addr (const void *s, unsigned sz); diff --git a/winsup/cygwin/strfuncs.cc b/winsup/cygwin/strfuncs.cc index e0e5703d3..e0a4c7182 100644 --- a/winsup/cygwin/strfuncs.cc +++ b/winsup/cygwin/strfuncs.cc @@ -22,7 +22,7 @@ details. */ is affected as well, but we can't transform it as long as we accept Win32 paths as input. */ static const WCHAR tfx_chars[] = { - 0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3, + 0xf000 | 0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3, 0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7, 0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11, 0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15, @@ -61,7 +61,7 @@ static const WCHAR tfx_chars[] = { converting back space and dot on filesystems only supporting DOS filenames. */ static const WCHAR tfx_rev_chars[] = { - 0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3, + 0xf000 | 0, 0xf000 | 1, 0xf000 | 2, 0xf000 | 3, 0xf000 | 4, 0xf000 | 5, 0xf000 | 6, 0xf000 | 7, 0xf000 | 8, 0xf000 | 9, 0xf000 | 10, 0xf000 | 11, 0xf000 | 12, 0xf000 | 13, 0xf000 | 14, 0xf000 | 15, @@ -103,6 +103,15 @@ transform_chars (PWCHAR path, PWCHAR path_end) *path = tfx_chars[*path]; } +PWCHAR +transform_chars_af_unix (PWCHAR out, const char *path, __socklen_t len) +{ + len -= sizeof (__sa_family_t); + for (const unsigned char *p = (const unsigned char *) path; len-- > 0; ++p) + *out++ = (*p <= 0x7f) ? tfx_chars[*p] : *p; + return out; +} + /* The SJIS, JIS and eucJP conversion in newlib does not use UTF as wchar_t character representation. That's unfortunate for us since we require UTF for the OS. What we do here is to have our own From 97b7aaaeb7fb8055b48318468652eaeec3a428e2 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 18:14:11 +0100 Subject: [PATCH 313/649] Cygwin: fhandler_socket_unix: implement socket, bind, and close ...plus lots of helper functions. Add comment to explain how everything works. This comment will be improved while implementing the yet missing parts. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 18 + winsup/cygwin/fhandler_socket_unix.cc | 567 ++++++++++++++++++++++---- 2 files changed, 495 insertions(+), 90 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index cfd93d2c8..ec9294ab0 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -847,6 +847,24 @@ class sun_name_t class fhandler_socket_unix : public fhandler_socket { + protected: + HANDLE file; /* Either NT symlink or reparse point */ + + HANDLE create_abstract_link (const sun_name_t *sun, + PUNICODE_STRING pipe_name); + HANDLE create_reparse_point (const sun_name_t *sun, + PUNICODE_STRING pipe_name); + HANDLE create_file (const sun_name_t *sun); + int open_abstract_link (sun_name_t *sun, PUNICODE_STRING pipe_name); + int open_reparse_point (sun_name_t *sun, PUNICODE_STRING pipe_name); + int open_file (sun_name_t *sun, int &type, PUNICODE_STRING pipe_name); + HANDLE autobind (sun_name_t *sun); + wchar_t get_type_char (); + void gen_pipe_name (); + void set_wait_state (DWORD wait_state); + HANDLE create_pipe (); + HANDLE create_pipe_instance (); + protected: sun_name_t *sun_path; sun_name_t *peer_sun_path; diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index ee43b1f7b..359593cd8 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -21,19 +21,47 @@ #include "path.h" #include "fhandler.h" #include "dtable.h" +#include "cygheap.h" #include "hires.h" #include "shared_info.h" #include "ntdll.h" #include "miscfuncs.h" #include "tls_pbuf.h" +/* + Abstract socket: + An abstract socket is represented by a symlink in the native + NT namespace, within the Cygin subdir in BasedNamedObjects. + So it's globally available but only exists as long as at least on + descriptor on the socket is open, as desired. + + The name of the symlink is: "af-unix-" + + is the transposed sun_path string, including the leading + NUL. The transposition is simplified in that it uses every byte + in the valid sun_path name as is, no extra multibyte conversion. + The content of the symlink is the name of the underlying pipe. + + Named socket: + + A named socket is represented by a reparse point with a Cygwin-specific + tag and GUID. The GenericReparseBuffer content is the name of the + underlying pipe. + + Pipe: + + The pipe is named \\.\pipe\cygwin--unix-[sd]- + + - is the 8 byte hex Cygwin installation key + - [sd] is s for SOCK_STREAM, d for SOCK_DGRAM + - is an 8 byte hex unique number + + Note: We use MAX_PATH here for convenience where sufficient. It's + big enough to hold sun_path's as well as pipe names so we don't have + to use tmp_pathbuf as often. +*/ -/* cygwin internal: map sockaddr into internet domain address */ -static int __unused -get_inet_addr_unix (const struct sockaddr *in, int inlen, - struct sockaddr_storage *out, int *outlen, - int *type = NULL) GUID __cygwin_socket_guid = { .Data1 = 0xefc1714d, .Data2 = 0x7b19, @@ -42,17 +70,215 @@ GUID __cygwin_socket_guid = { }; HANDLE +fhandler_socket_unix::create_abstract_link (const sun_name_t *sun, + PUNICODE_STRING pipe_name) { - /* Check for abstract socket. */ - if (inlen >= (int) sizeof (in->sa_family) + 7 - && in->sa_data[0] == '\0' && in->sa_data[1] == 'd' - && in->sa_data[6] == '\0') + WCHAR name[MAX_PATH]; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + UNICODE_STRING uname; + HANDLE fh = NULL; + + PWCHAR p = wcpcpy (name, L"af-unix-"); + /* NUL bytes have no special meaning in an abstract socket name, so + we assume iso-8859-1 for simplicity and transpose the string. + transform_chars_af_unix is doing just that. */ + transform_chars_af_unix (p, sun->un.sun_path, sun->un_len); + RtlInitUnicodeString (&uname, name); + InitializeObjectAttributes (&attr, &uname, OBJ_CASE_INSENSITIVE, + get_shared_parent_dir (), NULL); + /* Fill symlink with name of pipe */ + status = NtCreateSymbolicLinkObject (&fh, SYMBOLIC_LINK_ALL_ACCESS, + &attr, pipe_name); + if (!NT_SUCCESS (status)) { - /* TODO */ - return 0; + if (status == STATUS_OBJECT_NAME_EXISTS + || status == STATUS_OBJECT_NAME_COLLISION) + set_errno (EADDRINUSE); + else + __seterrno_from_nt_status (status); + } + return fh; +} + +struct rep_pipe_name_t +{ + USHORT Length; + WCHAR PipeName[1]; +}; + +HANDLE +fhandler_socket_unix::create_reparse_point (const sun_name_t *sun, + PUNICODE_STRING pipe_name) +{ + ULONG access; + HANDLE old_trans = NULL, trans = NULL; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + NTSTATUS status; + HANDLE fh = NULL; + PREPARSE_GUID_DATA_BUFFER rp; + rep_pipe_name_t *rep_pipe_name; + + const DWORD data_len = sizeof (*rep_pipe_name) + pipe_name->Length; + + path_conv pc (sun->un.sun_path, PC_SYM_FOLLOW); + if (pc.error) + { + set_errno (pc.error); + return NULL; + } + if (pc.exists ()) + { + set_errno (EADDRINUSE); + return NULL; + } + /* We will overwrite the DACL after the call to NtCreateFile. This + requires READ_CONTROL and WRITE_DAC access, otherwise get_file_sd + and set_file_sd both have to open the file again. + FIXME: On remote NTFS shares open sometimes fails because even the + creator of the file doesn't have the right to change the DACL. + I don't know what setting that is or how to recognize such a share, + so for now we don't request WRITE_DAC on remote drives. */ + access = DELETE | FILE_GENERIC_WRITE; + if (!pc.isremote ()) + access |= READ_CONTROL | WRITE_DAC | WRITE_OWNER; + if ((pc.fs_flags () & FILE_SUPPORTS_TRANSACTIONS)) + start_transaction (old_trans, trans); + +retry_after_transaction_error: + status = NtCreateFile (&fh, DELETE | FILE_GENERIC_WRITE, + pc.get_object_attr (attr, sec_none_nih), &io, + NULL, FILE_ATTRIBUTE_NORMAL, 0, FILE_CREATE, + FILE_SYNCHRONOUS_IO_NONALERT + | FILE_NON_DIRECTORY_FILE + | FILE_OPEN_FOR_BACKUP_INTENT + | FILE_OPEN_REPARSE_POINT, + NULL, 0); + if (NT_TRANSACTIONAL_ERROR (status) && trans) + { + stop_transaction (status, old_trans, trans); + goto retry_after_transaction_error; } - path_conv pc (in->sa_data, PC_SYM_FOLLOW); + if (!NT_SUCCESS (status)) + { + if (io.Information == FILE_EXISTS) + set_errno (EADDRINUSE); + else + __seterrno_from_nt_status (status); + goto out; + } + rp = (PREPARSE_GUID_DATA_BUFFER) + alloca (REPARSE_GUID_DATA_BUFFER_HEADER_SIZE + data_len); + rp->ReparseTag = IO_REPARSE_TAG_CYGUNIX; + rp->ReparseDataLength = data_len; + rp->Reserved = 0; + memcpy (&rp->ReparseGuid, CYGWIN_SOCKET_GUID, sizeof (GUID)); + rep_pipe_name = (rep_pipe_name_t *) rp->GenericReparseBuffer.DataBuffer; + rep_pipe_name->Length = pipe_name->Length; + memcpy (rep_pipe_name->PipeName, pipe_name->Buffer, pipe_name->Length); + rep_pipe_name->PipeName[pipe_name->Length / sizeof (WCHAR)] = L'\0'; + status = NtFsControlFile (fh, NULL, NULL, NULL, &io, + FSCTL_SET_REPARSE_POINT, rp, + REPARSE_GUID_DATA_BUFFER_HEADER_SIZE + + rp->ReparseDataLength, NULL, 0); + if (NT_SUCCESS (status)) + { + set_created_file_access (fh, pc, S_IRUSR | S_IWUSR + | S_IRGRP | S_IWGRP + | S_IROTH | S_IWOTH); + NtClose (fh); + /* We don't have to keep the file open, but the caller needs to + get a value != NULL to know the file creation went fine. */ + fh = INVALID_HANDLE_VALUE; + } + else if (!trans) + { + FILE_DISPOSITION_INFORMATION fdi = { TRUE }; + + __seterrno_from_nt_status (status); + status = NtSetInformationFile (fh, &io, &fdi, sizeof fdi, + FileDispositionInformation); + if (!NT_SUCCESS (status)) + debug_printf ("Setting delete dispostion failed, status = %y", + status); + NtClose (fh); + fh = NULL; + } + +out: + if (trans) + stop_transaction (status, old_trans, trans); + return fh; +} + +HANDLE +fhandler_socket_unix::create_file (const sun_name_t *sun) +{ + if (sun->un_len <= (socklen_t) sizeof (sa_family_t) + || (sun->un_len == 3 && sun->un.sun_path[0] == '\0') + || sun->un_len > (socklen_t) sizeof sun->un) + { + set_errno (EINVAL); + return NULL; + } + if (sun->un.sun_path[0] == '\0') + return create_abstract_link (sun, pc.get_nt_native_path ()); + return create_reparse_point (sun, pc.get_nt_native_path ()); +} + +int +fhandler_socket_unix::open_abstract_link (sun_name_t *sun, + PUNICODE_STRING pipe_name) +{ + WCHAR name[MAX_PATH]; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + UNICODE_STRING uname; + HANDLE fh; + + PWCHAR p = wcpcpy (name, L"af-unix-"); + p = transform_chars_af_unix (p, sun->un.sun_path, sun->un_len); + *p = L'\0'; + RtlInitUnicodeString (&uname, name); + InitializeObjectAttributes (&attr, &uname, OBJ_CASE_INSENSITIVE, + get_shared_parent_dir (), NULL); + status = NtOpenSymbolicLinkObject (&fh, SYMBOLIC_LINK_QUERY, &attr); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return -1; + } + if (pipe_name) + status = NtQuerySymbolicLinkObject (fh, pipe_name, NULL); + NtClose (fh); + if (pipe_name) + { + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return -1; + } + /* Enforce NUL-terminated pipe name. */ + pipe_name->Buffer[pipe_name->Length / sizeof (WCHAR)] = L'\0'; + } + return 0; +} + +int +fhandler_socket_unix::open_reparse_point (sun_name_t *sun, + PUNICODE_STRING pipe_name) +{ + /* TODO: Open reparse point and fetch type and pipe name */ + NTSTATUS status; + HANDLE fh; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + PREPARSE_GUID_DATA_BUFFER rp; + tmp_pathbuf tp; + + path_conv pc (sun->un.sun_path, PC_SYM_FOLLOW); if (pc.error) { set_errno (pc.error); @@ -63,99 +289,222 @@ HANDLE set_errno (ENOENT); return -1; } - /* Do NOT test for the file being a socket file here. The socket file - creation is not an atomic operation, so there is a chance that socket - files which are just in the process of being created are recognized - as non-socket files. To work around this problem we now create the - file with all sharing disabled. If the below NtOpenFile fails - with STATUS_SHARING_VIOLATION we know that the file already exists, - but the creating process isn't finished yet. So we yield and try - again, until we can either open the file successfully, or some error - other than STATUS_SHARING_VIOLATION occurs. - Since we now don't know if the file is actually a socket file, we - perform this check here explicitely. */ - NTSTATUS status; - HANDLE fh; - OBJECT_ATTRIBUTES attr; - IO_STATUS_BLOCK io; - pc.get_object_attr (attr, sec_none_nih); do { status = NtOpenFile (&fh, GENERIC_READ | SYNCHRONIZE, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_SYNCHRONOUS_IO_NONALERT + | FILE_NON_DIRECTORY_FILE | FILE_OPEN_FOR_BACKUP_INTENT - | FILE_NON_DIRECTORY_FILE); + | FILE_OPEN_REPARSE_POINT); if (status == STATUS_SHARING_VIOLATION) - { - /* While we hope that the sharing violation is only temporary, we - also could easily get stuck here, waiting for a file in use by - some greedy Win32 application. Therefore we should never wait - endlessly without checking for signals and thread cancel event. */ - pthread_testcancel (); - if (cygwait (NULL, cw_nowait, cw_sig_eintr) == WAIT_SIGNALED - && !_my_tls.call_signal_handler ()) - { - set_errno (EINTR); - return -1; - } - yield (); - } + { + /* While we hope that the sharing violation is only temporary, we + also could easily get stuck here, waiting for a file in use by + some greedy Win32 application. Therefore we should never wait + endlessly without checking for signals and thread cancel event. */ + pthread_testcancel (); + if (cygwait (NULL, cw_nowait, cw_sig_eintr) == WAIT_SIGNALED + && !_my_tls.call_signal_handler ()) + { + set_errno (EINTR); + return -1; + } + yield (); + } else if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - return -1; - } + { + __seterrno_from_nt_status (status); + return -1; + } } while (status == STATUS_SHARING_VIOLATION); - /* Now test for the SYSTEM bit. */ - FILE_BASIC_INFORMATION fbi; - status = NtQueryInformationFile (fh, &io, &fbi, sizeof fbi, - FileBasicInformation); - if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - return -1; - } - if (!(fbi.FileAttributes & FILE_ATTRIBUTE_SYSTEM)) - { - NtClose (fh); - set_errno (EBADF); - return -1; - } - /* Eventually check the content and fetch the required information. */ - char buf[128]; - memset (buf, 0, sizeof buf); - status = NtReadFile (fh, NULL, NULL, NULL, &io, buf, 128, NULL, NULL); + rp = (PREPARSE_GUID_DATA_BUFFER) tp.c_get (); + status = NtFsControlFile (fh, NULL, NULL, NULL, &io, FSCTL_GET_REPARSE_POINT, + NULL, 0, rp, MAXIMUM_REPARSE_DATA_BUFFER_SIZE); NtClose (fh); - if (NT_SUCCESS (status)) + if (rp->ReparseTag == IO_REPARSE_TAG_CYGUNIX + && memcmp (CYGWIN_SOCKET_GUID, &rp->ReparseGuid, sizeof (GUID)) == 0) { -#if 0 /* TODO */ - struct sockaddr_in sin; - char ctype; - sin.sin_family = AF_INET; - if (strncmp (buf, SOCKET_COOKIE, strlen (SOCKET_COOKIE))) + if (pipe_name) { - set_errno (EBADF); - return -1; + rep_pipe_name_t *rep_pipe_name = (rep_pipe_name_t *) + rp->GenericReparseBuffer.DataBuffer; + pipe_name->Length = rep_pipe_name->Length; + /* pipe name in reparse point is NUL-terminated */ + memcpy (pipe_name->Buffer, rep_pipe_name->PipeName, + rep_pipe_name->Length + sizeof (WCHAR)); } - sscanf (buf + strlen (SOCKET_COOKIE), "%hu %c", &sin.sin_port, &ctype); - sin.sin_port = htons (sin.sin_port); - sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK); - memcpy (out, &sin, sizeof sin); - *outlen = sizeof sin; - if (type) - *type = (ctype == 's' ? SOCK_STREAM : - ctype == 'd' ? SOCK_DGRAM - : 0); -#endif return 0; } - __seterrno_from_nt_status (status); return -1; } +int +fhandler_socket_unix::open_file (sun_name_t *sun, int &type, + PUNICODE_STRING pipe_name) +{ + int ret = -1; + + if (sun->un_len <= (socklen_t) sizeof (sa_family_t) + || (sun->un_len == 3 && sun->un.sun_path[0] == '\0') + || sun->un_len > (socklen_t) sizeof sun->un) + set_errno (EINVAL); + else if (sun->un.sun_path[0] == '\0') + ret = open_abstract_link (sun, pipe_name); + else + ret = open_reparse_point (sun, pipe_name); + if (!ret) + switch (pipe_name->Buffer[38]) + { + case 'd': + type = SOCK_DGRAM; + break; + case 's': + type = SOCK_STREAM; + break; + default: + set_errno (EINVAL); + ret = -1; + break; + } + return ret; +} + +HANDLE +fhandler_socket_unix::autobind (sun_name_t* sun) +{ + uint32_t id; + HANDLE fh; + + do + { + /* Use only 5 hex digits (up to 2^20 sockets) for Linux compat */ + set_unique_id (); + id = get_unique_id () & 0xfffff; + sun->un.sun_path[0] = '\0'; + sun->un_len = sizeof (sa_family_t) + + 1 /* leading NUL */ + + __small_sprintf (sun->un.sun_path + 1, "%5X", id); + } + while ((fh = create_abstract_link (sun, pc.get_nt_native_path ())) == NULL); + return fh; +} + +wchar_t +fhandler_socket_unix::get_type_char () +{ + switch (get_socket_type ()) + { + case SOCK_STREAM: + return 's'; + case SOCK_DGRAM: + return 'd'; + default: + return '?'; + } +} + +void +fhandler_socket_unix::gen_pipe_name () +{ + WCHAR pipe_name_buf[MAX_PATH]; + UNICODE_STRING pipe_name; + + __small_swprintf (pipe_name_buf, + L"\\Device\\NamedPipe\\cygwin-%S-unix-%C-%016_X", + &cygheap->installation_key, + get_type_char (), + get_plain_ino ()); + RtlInitUnicodeString (&pipe_name, pipe_name_buf); + pc.set_nt_native_path (&pipe_name); +} + +void +fhandler_socket_unix::set_wait_state (DWORD wait_state) +{ + if (get_handle ()) + { + NTSTATUS status; + IO_STATUS_BLOCK io; + FILE_PIPE_INFORMATION fpi; + + fpi.ReadMode = FILE_PIPE_MESSAGE_MODE; + fpi.CompletionMode = wait_state; + status = NtSetInformationFile (get_handle (), &io, &fpi, sizeof fpi, + FilePipeInformation); + if (!NT_SUCCESS (status)) + system_printf ("NtSetInformationFile(FilePipeInformation): %y", status); + } +} + +HANDLE +fhandler_socket_unix::create_pipe () +{ + NTSTATUS status; + HANDLE ph; + ACCESS_MASK access; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + ULONG sharing; + ULONG nonblocking; + ULONG max_instances; + LARGE_INTEGER timeout; + + access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE; + sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; + InitializeObjectAttributes (&attr, pc.get_nt_native_path (), OBJ_INHERIT, + NULL, NULL); + nonblocking = is_nonblocking () ? FILE_PIPE_COMPLETE_OPERATION + : FILE_PIPE_QUEUE_OPERATION; + max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; + timeout.QuadPart = -500000; + status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing, + FILE_CREATE, FILE_SYNCHRONOUS_IO_NONALERT, + FILE_PIPE_MESSAGE_TYPE, + FILE_PIPE_MESSAGE_MODE, + nonblocking, max_instances, + PREFERRED_IO_BLKSIZE, PREFERRED_IO_BLKSIZE, + &timeout); + if (!NT_SUCCESS (status)) + system_printf ("NtCreateNamedPipeFile: %y", status); + return ph; +} + +HANDLE +fhandler_socket_unix::create_pipe_instance () +{ + NTSTATUS status; + HANDLE ph; + ACCESS_MASK access; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + ULONG sharing; + ULONG nonblocking; + ULONG max_instances; + LARGE_INTEGER timeout; + + access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE; + sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; + InitializeObjectAttributes (&attr, pc.get_nt_native_path (), OBJ_INHERIT, + NULL, NULL); + nonblocking = is_nonblocking () ? FILE_PIPE_COMPLETE_OPERATION + : FILE_PIPE_QUEUE_OPERATION; + max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; + timeout.QuadPart = -500000; + status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing, + FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, + FILE_PIPE_MESSAGE_TYPE, + FILE_PIPE_MESSAGE_MODE, + nonblocking, max_instances, + PREFERRED_IO_BLKSIZE, PREFERRED_IO_BLKSIZE, + &timeout); + if (!NT_SUCCESS (status)) + system_printf ("NtCreateNamedPipeFile: %y", status); + return ph; +} + fhandler_socket_unix::fhandler_socket_unix () : sun_path (NULL), peer_sun_path (NULL) @@ -218,8 +567,16 @@ fhandler_socket_unix::socket (int af, int type, int protocol, int flags) set_errno (EPROTONOSUPPORT); return -1; } - set_errno (EAFNOSUPPORT); - return -1; + set_addr_family (af); + set_socket_type (type); + if (flags & SOCK_NONBLOCK) + set_nonblocking (true); + if (flags & SOCK_CLOEXEC) + set_close_on_exec (true); + set_io_handle (NULL); + set_unique_id (); + set_ino (get_unique_id ()); + return 0; } int @@ -243,7 +600,34 @@ fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, int fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) { - set_errno (EAFNOSUPPORT); + __try + { + sun_name_t sun (name, namelen); + bool unnamed = (sun.un_len == sizeof sun.un.sun_family); + HANDLE pipe = NULL; + + if (get_handle ()) + { + set_errno (EINVAL); + __leave; + } + gen_pipe_name (); + pipe = create_pipe (); + if (pipe) + { + file = unnamed ? autobind (&sun) : create_file (&sun); + if (!file) + { + NtClose (pipe); + __leave; + } + set_io_handle (pipe); + set_sun_path (&sun); + return 0; + } + } + __except (EFAULT) {} + __endtry return -1; } @@ -312,8 +696,11 @@ fhandler_socket_unix::shutdown (int how) int fhandler_socket_unix::close () { - set_errno (EAFNOSUPPORT); - return -1; + if (get_handle ()) + NtClose (get_handle ()); + if (file && file != INVALID_HANDLE_VALUE) + NtClose (file); + return 0; } int From 984c8beeffa912833409400fffdbfac16dd7a731 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 18:22:45 +0100 Subject: [PATCH 314/649] Cygwin: remove outdated comment Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 359593cd8..e865f9ecc 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -270,7 +270,6 @@ int fhandler_socket_unix::open_reparse_point (sun_name_t *sun, PUNICODE_STRING pipe_name) { - /* TODO: Open reparse point and fetch type and pipe name */ NTSTATUS status; HANDLE fh; OBJECT_ATTRIBUTES attr; From 00e87078302dcfca3b6ad04fd5af5d8f473171a9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 23:33:05 +0100 Subject: [PATCH 315/649] Cygwin: accept4: Fix resource leak The new implementation neglected to release the file descriptor in case of error. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_inet.cc | 2 ++ winsup/cygwin/fhandler_socket_local.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/winsup/cygwin/fhandler_socket_inet.cc b/winsup/cygwin/fhandler_socket_inet.cc index a3aeccc82..e65acffdf 100644 --- a/winsup/cygwin/fhandler_socket_inet.cc +++ b/winsup/cygwin/fhandler_socket_inet.cc @@ -895,6 +895,8 @@ fhandler_socket_inet::accept4 (struct sockaddr *peer, int *len, int flags) *len = llen; } } + else + fd.release (); } if (ret == -1) ::closesocket (res); diff --git a/winsup/cygwin/fhandler_socket_local.cc b/winsup/cygwin/fhandler_socket_local.cc index 844cb9d11..11f2c209e 100644 --- a/winsup/cygwin/fhandler_socket_local.cc +++ b/winsup/cygwin/fhandler_socket_local.cc @@ -1012,6 +1012,8 @@ fhandler_socket_local::accept4 (struct sockaddr *peer, int *len, int flags) *len = (int) sizeof (un.sun_family); } } + else + fd.release (); } if (ret == -1) ::closesocket (res); From be6da79713fcfd157cf84d9efb6d4c4afd6ccf33 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 23:39:15 +0100 Subject: [PATCH 316/649] Cygwin: AF_UNIX: create pipes with file attribute R/W access Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index e865f9ecc..2a439001c 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -451,7 +451,9 @@ fhandler_socket_unix::create_pipe () ULONG max_instances; LARGE_INTEGER timeout; - access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE; + access = GENERIC_READ | FILE_READ_ATTRIBUTES + | GENERIC_WRITE | FILE_WRITE_ATTRIBUTES + | SYNCHRONIZE; sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; InitializeObjectAttributes (&attr, pc.get_nt_native_path (), OBJ_INHERIT, NULL, NULL); @@ -484,8 +486,11 @@ fhandler_socket_unix::create_pipe_instance () ULONG max_instances; LARGE_INTEGER timeout; - access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE; + access = GENERIC_READ | FILE_READ_ATTRIBUTES + | GENERIC_WRITE | FILE_WRITE_ATTRIBUTES + | SYNCHRONIZE; sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; + /* NPFS doesn't understand reopening by handle, unfortunately. */ InitializeObjectAttributes (&attr, pc.get_nt_native_path (), OBJ_INHERIT, NULL, NULL); nonblocking = is_nonblocking () ? FILE_PIPE_COMPLETE_OPERATION From df14d97fff68fc9597b5769a3a077c73e38859d7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 2 Mar 2018 23:40:36 +0100 Subject: [PATCH 317/649] Cygwin: AF_UNIX: drop try/except block in bind method The caller already does it anyway. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 48 ++++++++++++--------------- 1 file changed, 21 insertions(+), 27 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 2a439001c..36a3cb3c4 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -604,35 +604,29 @@ fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, int fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) { - __try - { - sun_name_t sun (name, namelen); - bool unnamed = (sun.un_len == sizeof sun.un.sun_family); - HANDLE pipe = NULL; + sun_name_t sun (name, namelen); + bool unnamed = (sun.un_len == sizeof sun.un.sun_family); + HANDLE pipe = NULL; - if (get_handle ()) - { - set_errno (EINVAL); - __leave; - } - gen_pipe_name (); - pipe = create_pipe (); - if (pipe) - { - file = unnamed ? autobind (&sun) : create_file (&sun); - if (!file) - { - NtClose (pipe); - __leave; - } - set_io_handle (pipe); - set_sun_path (&sun); - return 0; - } + /* If we have a handle, we're already bound. */ + if (get_handle () || sun.un.sun_family != AF_UNIX) + { + set_errno (EINVAL); + return -1; } - __except (EFAULT) {} - __endtry - return -1; + gen_pipe_name (); + pipe = create_pipe (); + if (!pipe) + return -1; + file = unnamed ? autobind (&sun) : create_file (&sun); + if (!file) + { + NtClose (pipe); + return -1; + } + set_io_handle (pipe); + set_sun_path (&sun); + return 0; } int From f92f048528e6f74a0a0d11e897e536080cc012e3 Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Fri, 2 Mar 2018 20:21:09 +0100 Subject: [PATCH 318/649] Locale modifier @cjkwide to adjust ambiguous-width in non-CJK locales Locale modifier @cjkwide makes Unicode "ambiguous width" characters wide. So ambiguous width characters can be enforced to have width 2 even in non-CJK locales. This gives e.g. users of "Powerline symbols" the opportunity to adjust their width to the desired behaviour (and the behaviour apparently expected by some tools) without having to set a CJK locale and without losing consistence of terminal character width with wcwidth/wcswidth locale width. --- newlib/libc/locale/locale.c | 39 ++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/newlib/libc/locale/locale.c b/newlib/libc/locale/locale.c index baa5451a6..557982d6e 100644 --- a/newlib/libc/locale/locale.c +++ b/newlib/libc/locale/locale.c @@ -74,15 +74,16 @@ Cygwin additionally supports locales from the file (<<"">> is also accepted; if given, the settings are read from the corresponding LC_* environment variables and $LANG according to POSIX rules.) -This implementation also supports the modifier <<"cjknarrow">>, which -affects how the functions <> and <> handle characters -from the "CJK Ambiguous Width" category of characters described at -http://www.unicode.org/reports/tr11/#Ambiguous. These characters have a width -of 1 for singlebyte charsets and a width of 2 for multibyte charsets -other than UTF-8. For UTF-8, their width depends on the language specifier: +This implementation also supports the modifiers <<"cjknarrow">> and +<<"cjkwide">>, which affect how the functions <> and <> +handle characters from the "CJK Ambiguous Width" category of characters +described at http://www.unicode.org/reports/tr11/#Ambiguous. +These characters have a width of 1 for singlebyte charsets and a width of 2 +for multibyte charsets other than UTF-8. +For UTF-8, their width depends on the language specifier: it is 2 for <<"zh">> (Chinese), <<"ja">> (Japanese), and <<"ko">> (Korean), -and 1 for everything else. Specifying <<"cjknarrow">> forces a width of 1, -independent of charset and language. +and 1 for everything else. Specifying <<"cjknarrow">> or <<"cjkwide">> +forces a width of 1 or 2, respectively, independent of charset and language. If you use <> as the <[locale]> argument, <> returns a pointer to the string representing the current locale. The acceptable @@ -480,6 +481,7 @@ __loadlocale (struct __locale_t *loc, int category, const char *new_locale) wctomb_p l_wctomb; mbtowc_p l_mbtowc; int cjknarrow = 0; + int cjkwide = 0; /* Avoid doing everything twice if nothing has changed. @@ -593,11 +595,13 @@ restart: if (c && c[0] == '@') { /* Modifier */ - /* Only one modifier is recognized right now. "cjknarrow" is used - to modify the behaviour of wcwidth() for East Asian languages. + /* Modifiers "cjknarrow" or "cjkwide" are recognized to modify the + behaviour of wcwidth() and wcswidth() for East Asian languages. For details see the comment at the end of this function. */ if (!strcmp (c + 1, "cjknarrow")) cjknarrow = 1; + else if (!strcmp (c + 1, "cjkwide")) + cjkwide = 1; } /* We only support this subset of charsets. */ switch (charset[0]) @@ -894,12 +898,15 @@ restart: single-byte charsets, and double width for multi-byte charsets other than UTF-8. For UTF-8, use double width for the East Asian languages ("ja", "ko", "zh"), and single width for everything else. - Single width can also be forced with the "@cjknarrow" modifier. */ - loc->cjk_lang = !cjknarrow && mbc_max > 1 - && (charset[0] != 'U' - || strncmp (locale, "ja", 2) == 0 - || strncmp (locale, "ko", 2) == 0 - || strncmp (locale, "zh", 2) == 0); + Single width can also be forced with the "@cjknarrow" modifier. + Double width can also be forced with the "@cjkwide" modifier. + */ + loc->cjk_lang = cjkwide || + (!cjknarrow && mbc_max > 1 + && (charset[0] != 'U' + || strncmp (locale, "ja", 2) == 0 + || strncmp (locale, "ko", 2) == 0 + || strncmp (locale, "zh", 2) == 0)); #ifdef __HAVE_LOCALE_INFO__ ret = __ctype_load_locale (loc, locale, (void *) l_wctomb, charset, mbc_max); From 011fc3b508292ebdc972775a98ee3b22cd17e820 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Mar 2018 17:49:50 +0100 Subject: [PATCH 319/649] Cygwin: cygwait.cc: fix formatting of debug statement Signed-off-by: Corinna Vinschen --- winsup/cygwin/cygwait.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/cygwait.cc b/winsup/cygwin/cygwait.cc index e520843f0..1d6c7c9cc 100644 --- a/winsup/cygwin/cygwait.cc +++ b/winsup/cygwin/cygwait.cc @@ -39,7 +39,8 @@ cygwait (HANDLE object, PLARGE_INTEGER timeout, unsigned mask) wait_objects[num++] = object; wait_signal_arrived thread_waiting (is_cw_sig_handle, wait_objects[num]); - debug_only_printf ("object %p, thread waiting %d, signal_arrived %p", object, (int) thread_waiting, _my_tls.signal_arrived); + debug_only_printf ("object %p, thread waiting %d, signal_arrived %p", + object, (int) thread_waiting, _my_tls.signal_arrived); DWORD sig_n; if (!thread_waiting) sig_n = WAIT_TIMEOUT + 1; From fe8e2c9b1f480c5b939574510b3ed10ea3c9028d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Mar 2018 17:50:52 +0100 Subject: [PATCH 320/649] Cygwin: drop debug_printf statement from start_transaction start_transaction is now defined in ntdll.h and we can't rely on debug_printf being available Signed-off-by: Corinna Vinschen --- winsup/cygwin/ntdll.h | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index c89591f44..b322d4b9e 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -1668,10 +1668,7 @@ extern "C" RtlSetCurrentTransaction (trans); } else - { - debug_printf ("NtCreateTransaction failed, %y", status); - old_trans = trans = NULL; - } + old_trans = trans = NULL; } static inline NTSTATUS From a2c02d78be1f8d53bfbfe4cb3d398858b397105c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Mar 2018 17:59:04 +0100 Subject: [PATCH 321/649] Cygwin: sockets: add bind state, and split out connect state to allow atomic operation The connect state was stored in a bitfield which is not safe to do atomic operations on. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index ec9294ab0..e9a247256 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -76,13 +76,21 @@ enum dirent_states dirent_info_mask = 0x0078 }; +enum bind_state +{ + unbound = 0, + bind_pending = 1, + bound = 2 +}; + enum conn_state { unconnected = 0, connect_pending = 1, connected = 2, listener = 3, - connect_failed = 4 + connect_failed = 4 /* FIXME: Do we really need this? It's basically + the same thing as unconnected. */ }; enum line_edit_status @@ -524,19 +532,26 @@ class fhandler_socket: public fhandler_base unsigned saw_shutdown_read : 1; /* Socket saw a SHUT_RD */ unsigned saw_shutdown_write : 1; /* Socket saw a SHUT_WR */ unsigned saw_reuseaddr : 1; /* Socket saw SO_REUSEADDR call */ - unsigned connect_state : 3; public: status_flags () : async_io (0), saw_shutdown_read (0), saw_shutdown_write (0), - saw_reuseaddr (0), connect_state (unconnected) + saw_reuseaddr (0) {} } status; + LONG _connection_state; + LONG _binding_state; public: IMPLEMENT_STATUS_FLAG (bool, async_io) IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_read) IMPLEMENT_STATUS_FLAG (bool, saw_shutdown_write) IMPLEMENT_STATUS_FLAG (bool, saw_reuseaddr) - IMPLEMENT_STATUS_FLAG (conn_state, connect_state) + + conn_state connect_state (conn_state val) + { return (conn_state) InterlockedExchange (&_connection_state, val); } + conn_state connect_state () const { return (conn_state) _connection_state; } + bind_state binding_state (bind_state val) + { return (bind_state) InterlockedExchange (&_binding_state, val); } + bind_state binding_state () const { return (bind_state) _binding_state; } public: fhandler_socket (); From ae67198d55bf5bab903eb01d049f15d7a35c38ba Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Mon, 5 Mar 2018 18:08:47 +0100 Subject: [PATCH 322/649] Cygwin: move sun_name_t constructors into fhandler_socket_unix.cc They are only used there anyway and it allows to use the AF_UNIX macro without tweaking header files. While at it, improve both constructors. The default constructor now creates the name of an unnamed socket, the constructor taking parameters carefully checks its input. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 14 ++------------ winsup/cygwin/fhandler_socket_unix.cc | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index e9a247256..da600f2dc 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -842,18 +842,8 @@ class sun_name_t /* Allows 108 bytes sun_path plus trailing NUL */ char _nul[sizeof (struct sockaddr_un) + 1]; }; - sun_name_t () - { - un_len = 0; - un.sun_family = 0; - _nul[sizeof (struct sockaddr_un)] = '\0'; - } - sun_name_t (const struct sockaddr *name, __socklen_t namelen) - { - un_len = namelen < (__socklen_t) sizeof un ? namelen : sizeof un; - memcpy (&un, name, un_len); - _nul[sizeof (struct sockaddr_un)] = '\0'; - } + sun_name_t (); + sun_name_t (const struct sockaddr *name, __socklen_t namelen); void *operator new (size_t) __attribute__ ((nothrow)) { return cmalloc_abort (HEAP_FHANDLER, sizeof (sun_name_t)); } diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 36a3cb3c4..f93b91221 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -69,6 +69,23 @@ GUID __cygwin_socket_guid = { .Data4 = { 0xba, 0xb3, 0xc5, 0xb1, 0xf9, 0x2c, 0xb8, 0x8c } }; +sun_name_t::sun_name_t () +{ + un_len = sizeof (sa_family_t); + un.sun_family = AF_UNIX; + _nul[sizeof (struct sockaddr_un)] = '\0'; +} + +sun_name_t::sun_name_t (const struct sockaddr *name, socklen_t namelen) +{ + if (namelen < 0) + namelen = 0; + un_len = namelen < (__socklen_t) sizeof un ? namelen : sizeof un; + if (name) + memcpy (&un, name, un_len); + _nul[sizeof (struct sockaddr_un)] = '\0'; +} + HANDLE fhandler_socket_unix::create_abstract_link (const sun_name_t *sun, PUNICODE_STRING pipe_name) From a9c8434527cc1115bd410a9d4c3b6aab56282a61 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 8 Feb 2018 13:00:42 +0100 Subject: [PATCH 323/649] Make _CLOCKID_T_ system configurable Let systems optionally provide the _CLOCKID_T_ type via . Signed-off-by: Sebastian Huber --- newlib/libc/include/sys/_types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newlib/libc/include/sys/_types.h b/newlib/libc/include/sys/_types.h index 72e1dc17a..d8e8c0b52 100644 --- a/newlib/libc/include/sys/_types.h +++ b/newlib/libc/include/sys/_types.h @@ -193,7 +193,10 @@ typedef _CLOCK_T_ __clock_t; #endif typedef _TIME_T_ __time_t; +#ifndef __machine_clockid_t_defined #define _CLOCKID_T_ unsigned long +#endif + typedef _CLOCKID_T_ __clockid_t; #define _TIMER_T_ unsigned long From f641474cb2dfdac86504479e9b4afe30833fc0b8 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Thu, 8 Feb 2018 13:02:41 +0100 Subject: [PATCH 324/649] RTEMS: Use int for _CLOCKID_T_ Linux and FreeBSD use int as well. In addition, this fixes an Ada incompatiblity problem on 64-bit targets. See also GCC: gcc/ada/libgnarl/s-osinte__rtems.ads Signed-off-by: Sebastian Huber --- newlib/libc/sys/rtems/include/machine/_types.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/newlib/libc/sys/rtems/include/machine/_types.h b/newlib/libc/sys/rtems/include/machine/_types.h index a30d5a3c1..a3144e8fd 100644 --- a/newlib/libc/sys/rtems/include/machine/_types.h +++ b/newlib/libc/sys/rtems/include/machine/_types.h @@ -31,6 +31,9 @@ typedef __uint32_t __mode_t; typedef __uint64_t _CLOCK_T_; #define __machine_clock_t_defined +typedef int _CLOCKID_T_; +#define __machine_clockid_t_defined + typedef int __accmode_t; /* access permissions */ typedef __uint32_t __fixpt_t; /* fixed point number */ typedef int __lwpid_t; /* Thread ID (a.k.a. LWP) */ From 6d2f1d79a8ee0ae5bd6ac5f1f865a5ca761028a0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:23:23 +0100 Subject: [PATCH 325/649] Cygwin: export hires counter ntod Needed it new AF_UNIX socket code Signed-off-by: Corinna Vinschen --- winsup/cygwin/hires.h | 1 + 1 file changed, 1 insertion(+) diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h index 5c75cf65a..04ee6066a 100644 --- a/winsup/cygwin/hires.h +++ b/winsup/cygwin/hires.h @@ -67,4 +67,5 @@ class hires_ms : public hires_base }; extern hires_ms gtod; +extern hires_ns ntod; #endif /*__HIRES_H__*/ From f6ce72e623b18fffde3e99735c9252005ea62e32 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:23:48 +0100 Subject: [PATCH 326/649] Cygwin: sys/socket.h: define MSG_CMSG_CLOEXEC Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/cygwin/socket.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/include/cygwin/socket.h b/winsup/cygwin/include/cygwin/socket.h index 295885256..0360e71e8 100644 --- a/winsup/cygwin/include/cygwin/socket.h +++ b/winsup/cygwin/include/cygwin/socket.h @@ -204,6 +204,9 @@ struct OLD_msghdr /* Windows-specific flag values returned by recvmsg. */ #define MSG_BCAST 0x0400 /* Broadcast datagram */ #define MSG_MCAST 0x0800 /* Multicast datagram */ +/* AF_UNIX specific */ +#define MSG_CMSG_CLOEXEC 0x1000 /* Set O_CLOEXEC on fd's passed via + SCM_RIGHTS */ /* Setsockoptions(2) level. Thanks to BSD these must match IPPROTO_xxx */ #define SOL_IP 0 From c0df506b83c287cc2b4fb43ec6fad67c914fa300 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:24:13 +0100 Subject: [PATCH 327/649] Cygwin: ntdll.h: Add some missing pipe-related definitions Signed-off-by: Corinna Vinschen --- winsup/cygwin/ntdll.h | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index b322d4b9e..b251055f6 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -157,8 +157,14 @@ extern GUID __cygwin_socket_guid; #define FILE_VC_VALID_MASK 0x000003ff /* IOCTL code to impersonate client of named pipe. */ -#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \ - METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \ + METHOD_BUFFERED, FILE_ANY_ACCESS) typedef enum _FILE_INFORMATION_CLASS { @@ -1002,6 +1008,23 @@ typedef struct _FILE_PIPE_LOCAL_INFORMATION ULONG NamedPipeEnd; } FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION; +/* Checked on 64 bit. */ +typedef struct _FILE_PIPE_PEEK_BUFFER { + ULONG NamedPipeState; + ULONG ReadDataAvailable; + ULONG NumberOfMessages; + ULONG MessageLength; + CHAR Data[1]; +} FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER; + +/* Checked on 64 bit. */ +typedef struct _FILE_PIPE_WAIT_FOR_BUFFER { + LARGE_INTEGER Timeout; + ULONG NameLength; + BOOLEAN TimeoutSpecified; + WCHAR Name[1]; +} FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER; + /* Checked on 64 bit. */ typedef struct _FILE_COMPRESSION_INFORMATION { From c502700231b607cc8b45463980bc9ee482e3700e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:28:15 +0100 Subject: [PATCH 328/649] Cygwin: AF_UNIX: initialize rmem/wmem to 256K and use in pipe creation Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index f93b91221..17d6f021f 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -483,8 +483,7 @@ fhandler_socket_unix::create_pipe () FILE_PIPE_MESSAGE_TYPE, FILE_PIPE_MESSAGE_MODE, nonblocking, max_instances, - PREFERRED_IO_BLKSIZE, PREFERRED_IO_BLKSIZE, - &timeout); + rmem (), wmem (), &timeout); if (!NT_SUCCESS (status)) system_printf ("NtCreateNamedPipeFile: %y", status); return ph; @@ -519,8 +518,7 @@ fhandler_socket_unix::create_pipe_instance () FILE_PIPE_MESSAGE_TYPE, FILE_PIPE_MESSAGE_MODE, nonblocking, max_instances, - PREFERRED_IO_BLKSIZE, PREFERRED_IO_BLKSIZE, - &timeout); + rmem (), wmem (), &timeout); if (!NT_SUCCESS (status)) system_printf ("NtCreateNamedPipeFile: %y", status); return ph; @@ -588,6 +586,8 @@ fhandler_socket_unix::socket (int af, int type, int protocol, int flags) set_errno (EPROTONOSUPPORT); return -1; } + rmem (262144); + wmem (262144); set_addr_family (af); set_socket_type (type); if (flags & SOCK_NONBLOCK) From cabfef78e9019e777872f180450e5366b8190c2d Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:37:09 +0100 Subject: [PATCH 329/649] Cygwin: AF_UNIX: create/open pipes relativ to NPFS rootdir handle Only store and manipulate pipe basename. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 6 ++ winsup/cygwin/fhandler_socket_unix.cc | 84 ++++++++++++++++++++------- 2 files changed, 68 insertions(+), 22 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index da600f2dc..fc831798d 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -852,6 +852,11 @@ class sun_name_t class fhandler_socket_unix : public fhandler_socket { + enum npfs_hdl_t + { + NPFS_DEVICE, + NPFS_DIR + }; protected: HANDLE file; /* Either NT symlink or reparse point */ @@ -873,6 +878,7 @@ class fhandler_socket_unix : public fhandler_socket protected: sun_name_t *sun_path; sun_name_t *peer_sun_path; + static NTSTATUS npfs_handle (HANDLE &nph, npfs_hdl_t type); sun_name_t *get_sun_path () {return sun_path;} sun_name_t *get_peer_sun_path () {return peer_sun_path;} void set_sun_path (struct sockaddr_un *un, __socklen_t unlen); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 17d6f021f..9d3c3161a 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -41,12 +41,12 @@ is the transposed sun_path string, including the leading NUL. The transposition is simplified in that it uses every byte in the valid sun_path name as is, no extra multibyte conversion. - The content of the symlink is the name of the underlying pipe. + The content of the symlink is the basename of the underlying pipe. Named socket: A named socket is represented by a reparse point with a Cygwin-specific - tag and GUID. The GenericReparseBuffer content is the name of the + tag and GUID. The GenericReparseBuffer content is the basename of the underlying pipe. Pipe: @@ -61,6 +61,8 @@ big enough to hold sun_path's as well as pipe names so we don't have to use tmp_pathbuf as often. */ +/* Character length of pipe name, excluding trailing NUL. */ +#define CYGWIN_PIPE_SOCKET_NAME_LEN 47 GUID __cygwin_socket_guid = { .Data1 = 0xefc1714d, @@ -86,6 +88,23 @@ sun_name_t::sun_name_t (const struct sockaddr *name, socklen_t namelen) _nul[sizeof (struct sockaddr_un)] = '\0'; } +/* Character position encoding the socket type in a pipe name. */ +#define CYGWIN_PIPE_SOCKET_TYPE_POS 29 + +void +fhandler_socket_unix::gen_pipe_name () +{ + WCHAR pipe_name_buf[CYGWIN_PIPE_SOCKET_NAME_LEN + 1]; + UNICODE_STRING pipe_name; + + __small_swprintf (pipe_name_buf, L"cygwin-%S-unix-%C-%016_X", + &cygheap->installation_key, + get_type_char (), + get_plain_ino ()); + RtlInitUnicodeString (&pipe_name, pipe_name_buf); + pc.set_nt_native_path (&pipe_name); +} + HANDLE fhandler_socket_unix::create_abstract_link (const sun_name_t *sun, PUNICODE_STRING pipe_name) @@ -372,7 +391,7 @@ fhandler_socket_unix::open_file (sun_name_t *sun, int &type, else ret = open_reparse_point (sun, pipe_name); if (!ret) - switch (pipe_name->Buffer[38]) + switch (pipe_name->Buffer[CYGWIN_PIPE_SOCKET_TYPE_POS]) { case 'd': type = SOCK_DGRAM; @@ -423,22 +442,6 @@ fhandler_socket_unix::get_type_char () } void -fhandler_socket_unix::gen_pipe_name () -{ - WCHAR pipe_name_buf[MAX_PATH]; - UNICODE_STRING pipe_name; - - __small_swprintf (pipe_name_buf, - L"\\Device\\NamedPipe\\cygwin-%S-unix-%C-%016_X", - &cygheap->installation_key, - get_type_char (), - get_plain_ino ()); - RtlInitUnicodeString (&pipe_name, pipe_name_buf); - pc.set_nt_native_path (&pipe_name); -} - -void -fhandler_socket_unix::set_wait_state (DWORD wait_state) { if (get_handle ()) { @@ -452,13 +455,36 @@ fhandler_socket_unix::set_wait_state (DWORD wait_state) FilePipeInformation); if (!NT_SUCCESS (status)) system_printf ("NtSetInformationFile(FilePipeInformation): %y", status); +NTSTATUS +fhandler_socket_unix::npfs_handle (HANDLE &nph, npfs_hdl_t type) +{ + static NO_COPY HANDLE npfs_devh; + static NO_COPY HANDLE npfs_dirh; + + HANDLE &npfs_ref = (type == NPFS_DEVICE) ? npfs_devh : npfs_dirh; + PUNICODE_STRING path = (type == NPFS_DEVICE) ? &ro_u_npfs : &ro_u_npfs_dir; + NTSTATUS status; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + + if (!npfs_ref) + { + InitializeObjectAttributes (&attr, path, 0, NULL, NULL); + status = NtOpenFile (&npfs_ref, FILE_READ_ATTRIBUTES | SYNCHRONIZE, + &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE, + FILE_SYNCHRONOUS_IO_NONALERT); + if (!NT_SUCCESS (status)) + return status; } + nph = npfs_ref; + return STATUS_SUCCESS; } HANDLE fhandler_socket_unix::create_pipe () { NTSTATUS status; + HANDLE npfsh; HANDLE ph; ACCESS_MASK access; OBJECT_ATTRIBUTES attr; @@ -468,12 +494,19 @@ fhandler_socket_unix::create_pipe () ULONG max_instances; LARGE_INTEGER timeout; + status = npfs_handle (npfsh, NPFS_DIR); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return NULL; + } access = GENERIC_READ | FILE_READ_ATTRIBUTES | GENERIC_WRITE | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; - InitializeObjectAttributes (&attr, pc.get_nt_native_path (), OBJ_INHERIT, - NULL, NULL); + InitializeObjectAttributes (&attr, pc.get_nt_native_path (), + OBJ_INHERIT | OBJ_CASE_INSENSITIVE, + npfsh, NULL); nonblocking = is_nonblocking () ? FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION; max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; @@ -493,6 +526,7 @@ HANDLE fhandler_socket_unix::create_pipe_instance () { NTSTATUS status; + HANDLE npfsh; HANDLE ph; ACCESS_MASK access; OBJECT_ATTRIBUTES attr; @@ -502,13 +536,19 @@ fhandler_socket_unix::create_pipe_instance () ULONG max_instances; LARGE_INTEGER timeout; + status = npfs_handle (npfsh, NPFS_DIR); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return NULL; + } access = GENERIC_READ | FILE_READ_ATTRIBUTES | GENERIC_WRITE | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE; sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; /* NPFS doesn't understand reopening by handle, unfortunately. */ InitializeObjectAttributes (&attr, pc.get_nt_native_path (), OBJ_INHERIT, - NULL, NULL); + npfsh, NULL); nonblocking = is_nonblocking () ? FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION; max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; From e2909e2805056e3f90533f8d97e79b664079de2f Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:42:12 +0100 Subject: [PATCH 330/649] Cygwin: AF_UNIX: fix a couple of thinkos and typos Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 44 +++++++++++---------------- 1 file changed, 18 insertions(+), 26 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 9d3c3161a..9ea9f45ed 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -57,8 +57,8 @@ - [sd] is s for SOCK_STREAM, d for SOCK_DGRAM - is an 8 byte hex unique number - Note: We use MAX_PATH here for convenience where sufficient. It's - big enough to hold sun_path's as well as pipe names so we don't have + Note: We use MAX_PATH below for convenience where sufficient. It's + big enough to hold sun_paths as well as pipe names so we don't have to use tmp_pathbuf as often. */ /* Character length of pipe name, excluding trailing NUL. */ @@ -156,7 +156,8 @@ fhandler_socket_unix::create_reparse_point (const sun_name_t *sun, PREPARSE_GUID_DATA_BUFFER rp; rep_pipe_name_t *rep_pipe_name; - const DWORD data_len = sizeof (*rep_pipe_name) + pipe_name->Length; + const DWORD data_len = offsetof (rep_pipe_name_t, PipeName) + + pipe_name->Length + sizeof (WCHAR); path_conv pc (sun->un.sun_path, PC_SYM_FOLLOW); if (pc.error) @@ -221,9 +222,8 @@ retry_after_transaction_error: + rp->ReparseDataLength, NULL, 0); if (NT_SUCCESS (status)) { - set_created_file_access (fh, pc, S_IRUSR | S_IWUSR - | S_IRGRP | S_IWGRP - | S_IROTH | S_IWOTH); + mode_t perms = (S_IRWXU | S_IRWXG | S_IRWXO) & ~cygheap->umask; + set_created_file_access (fh, pc, perms); NtClose (fh); /* We don't have to keep the file open, but the caller needs to get a value != NULL to know the file creation went fine. */ @@ -253,8 +253,7 @@ HANDLE fhandler_socket_unix::create_file (const sun_name_t *sun) { if (sun->un_len <= (socklen_t) sizeof (sa_family_t) - || (sun->un_len == 3 && sun->un.sun_path[0] == '\0') - || sun->un_len > (socklen_t) sizeof sun->un) + || (sun->un_len == 3 && sun->un.sun_path[0] == '\0')) { set_errno (EINVAL); return NULL; @@ -327,7 +326,7 @@ fhandler_socket_unix::open_reparse_point (sun_name_t *sun, pc.get_object_attr (attr, sec_none_nih); do { - status = NtOpenFile (&fh, GENERIC_READ | SYNCHRONIZE, &attr, &io, + status = NtOpenFile (&fh, FILE_GENERIC_READ, &attr, &io, FILE_SHARE_VALID_FLAGS, FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE @@ -383,8 +382,7 @@ fhandler_socket_unix::open_file (sun_name_t *sun, int &type, int ret = -1; if (sun->un_len <= (socklen_t) sizeof (sa_family_t) - || (sun->un_len == 3 && sun->un.sun_path[0] == '\0') - || sun->un_len > (socklen_t) sizeof sun->un) + || (sun->un_len == 3 && sun->un.sun_path[0] == '\0')) set_errno (EINVAL); else if (sun->un.sun_path[0] == '\0') ret = open_abstract_link (sun, pipe_name); @@ -512,13 +510,13 @@ fhandler_socket_unix::create_pipe () max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; timeout.QuadPart = -500000; status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing, - FILE_CREATE, FILE_SYNCHRONOUS_IO_NONALERT, + FILE_CREATE, 0, FILE_PIPE_MESSAGE_TYPE, FILE_PIPE_MESSAGE_MODE, nonblocking, max_instances, rmem (), wmem (), &timeout); if (!NT_SUCCESS (status)) - system_printf ("NtCreateNamedPipeFile: %y", status); + __seterrno_from_nt_status (status); return ph; } @@ -554,13 +552,13 @@ fhandler_socket_unix::create_pipe_instance () max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; timeout.QuadPart = -500000; status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing, - FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT, + FILE_OPEN, 0, FILE_PIPE_MESSAGE_TYPE, FILE_PIPE_MESSAGE_MODE, nonblocking, max_instances, rmem (), wmem (), &timeout); if (!NT_SUCCESS (status)) - system_printf ("NtCreateNamedPipeFile: %y", status); + __seterrno_from_nt_status (status); return ph; } @@ -715,12 +713,9 @@ fhandler_socket_unix::getsockname (struct sockaddr *name, int *namelen) if (get_sun_path ()) memcpy (&sun, &get_sun_path ()->un, get_sun_path ()->un_len); else - { - sun.un_len = sizeof (sa_family_t); - sun.un.sun_family = AF_UNIX; - sun.un.sun_path[0] = '\0'; - } + sun.un_len = 0; memcpy (name, &sun, MIN (*namelen, sun.un_len)); + *namelen = sun.un_len; return 0; } @@ -732,12 +727,9 @@ fhandler_socket_unix::getpeername (struct sockaddr *name, int *namelen) if (get_peer_sun_path ()) memcpy (&sun, &get_peer_sun_path ()->un, get_peer_sun_path ()->un_len); else - { - sun.un_len = sizeof (sa_family_t); - sun.un.sun_family = AF_UNIX; - sun.un.sun_path[0] = '\0'; - } + sun.un_len = 0; memcpy (name, &sun, MIN (*namelen, sun.un_len)); + *namelen = sun.un_len; return 0; } @@ -1013,7 +1005,7 @@ fhandler_socket_unix::getsockopt (int level, int optname, const void *optval, int fhandler_socket_unix::ioctl (unsigned int cmd, void *p) { - int ret; + int ret = -1; switch (cmd) { From 4cd57934be32395107960625c207854db949d7b7 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Tue, 6 Mar 2018 18:55:03 +0100 Subject: [PATCH 331/649] Cygwin: AF_UNIX: Implement listen, accept4, connect, and others * Implement helper functions * Improve bind * Implement setting blocking, ioctl(FIONBIO), fcntl(F_SETFL) * Implement close_on_exec and fixup_after_fork * Allow overriding sun_path and peer_sun_path * Improve comments Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 56 +- winsup/cygwin/fhandler_socket_unix.cc | 783 ++++++++++++++++++++++++-- winsup/cygwin/globals.cc | 2 + 3 files changed, 775 insertions(+), 66 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index fc831798d..392ba6c4e 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -857,28 +857,43 @@ class fhandler_socket_unix : public fhandler_socket NPFS_DEVICE, NPFS_DIR }; - protected: - HANDLE file; /* Either NT symlink or reparse point */ - - HANDLE create_abstract_link (const sun_name_t *sun, - PUNICODE_STRING pipe_name); - HANDLE create_reparse_point (const sun_name_t *sun, - PUNICODE_STRING pipe_name); - HANDLE create_file (const sun_name_t *sun); - int open_abstract_link (sun_name_t *sun, PUNICODE_STRING pipe_name); - int open_reparse_point (sun_name_t *sun, PUNICODE_STRING pipe_name); - int open_file (sun_name_t *sun, int &type, PUNICODE_STRING pipe_name); - HANDLE autobind (sun_name_t *sun); - wchar_t get_type_char (); - void gen_pipe_name (); - void set_wait_state (DWORD wait_state); - HANDLE create_pipe (); - HANDLE create_pipe_instance (); protected: + SRWLOCK conn_lock; + SRWLOCK bind_lock; + SRWLOCK io_lock; + HANDLE backing_file_handle; /* Either NT symlink or INVALID_HANDLE_VALUE, + if the socket is backed by a file in the + file system (actually a reparse point) */ + HANDLE connect_wait_thr; + PVOID cwt_param; + LONG so_error; sun_name_t *sun_path; sun_name_t *peer_sun_path; + struct ucred peer_cred; + + void gen_pipe_name (); + static HANDLE create_abstract_link (const sun_name_t *sun, + PUNICODE_STRING pipe_name); + static HANDLE create_reparse_point (const sun_name_t *sun, + PUNICODE_STRING pipe_name); + HANDLE create_file (const sun_name_t *sun); + static int open_abstract_link (sun_name_t *sun, PUNICODE_STRING pipe_name); + static int open_reparse_point (sun_name_t *sun, PUNICODE_STRING pipe_name); + static int open_file (sun_name_t *sun, int &type, PUNICODE_STRING pipe_name); + HANDLE autobind (sun_name_t *sun); + wchar_t get_type_char (); + void set_pipe_non_blocking (bool nonblocking); + int send_my_name (); + int recv_peer_name (); static NTSTATUS npfs_handle (HANDLE &nph, npfs_hdl_t type); + HANDLE create_pipe (); + HANDLE create_pipe_instance (); + NTSTATUS open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name); + int wait_pipe (PUNICODE_STRING pipe_name); + int connect_pipe (PUNICODE_STRING pipe_name); + int listen_pipe (); + int disconnect_pipe (HANDLE ph); sun_name_t *get_sun_path () {return sun_path;} sun_name_t *get_peer_sun_path () {return peer_sun_path;} void set_sun_path (struct sockaddr_un *un, __socklen_t unlen); @@ -888,10 +903,9 @@ class fhandler_socket_unix : public fhandler_socket void set_peer_sun_path (sun_name_t *snt) { snt ? set_peer_sun_path (&snt->un, snt->un_len) : set_peer_sun_path (NULL, 0); } - - protected: - struct ucred peer_cred; void set_cred (); + void fixup_after_fork (HANDLE parent); + void set_close_on_exec (bool val); public: fhandler_socket_unix (); @@ -899,6 +913,8 @@ class fhandler_socket_unix : public fhandler_socket int dup (fhandler_base *child, int); + DWORD wait_pipe_thread (PUNICODE_STRING pipe_name); + int socket (int af, int type, int protocol, int flags); int socketpair (int af, int type, int protocol, int flags, fhandler_socket *fh_out); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 9ea9f45ed..ae422dda4 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -60,7 +60,70 @@ Note: We use MAX_PATH below for convenience where sufficient. It's big enough to hold sun_paths as well as pipe names so we don't have to use tmp_pathbuf as often. + + Every packet sent to a peer is a combination of the socket name of the + local socket, the ancillary data, and the actual user data. The data + is always sent in this order. The header contains length information + for the entire packet, as well as for all three data blocks. The + combined maximum size of a packet is 64K, including the header. + + A connecting, bound STREAM socket send it's local sun_path once after + a successful connect. An already connected socket also sends its local + sun_path after a successful bind (border case, but still...). These + packages don't contain any other data (cmsg_len == 0, data_len == 0). + + A bound DGRAM socket send its sun_path with each sendmsg/sendto. */ +class af_unix_pkt_hdr_t +{ + public: + uint16_t pckt_len; /* size of packet including header */ + uint8_t shut_info; /* shutdown info. SHUT_RD means + SHUT_RD on the local side, so the + peer must not send further packets, + vice versa for SHUT_WR. SHUT_RDWR + is followed by closing the pipe + handle. */ + uint8_t name_len; /* size of name, a sockaddr_un */ + uint16_t cmsg_len; /* size of ancillary data block */ + uint16_t data_len; /* size of user data */ + + void init (uint8_t s, uint8_t n, uint16_t c, uint16_t d) + { + shut_info = s; + name_len = n; + cmsg_len = c; + data_len = d; + pckt_len = sizeof (*this) + name_len + cmsg_len + data_len; + } +}; + +#define AF_UNIX_PKT_OFFSETOF_NAME(phdr) \ + (sizeof (af_unix_pkt_hdr_t)) +#define AF_UNIX_PKT_OFFSETOF_CMSG(phdr) \ + (sizeof (af_unix_pkt_hdr_t) + (phdr)->name_len) +#define AF_UNIX_PKT_OFFSETOF_DATA(phdr) \ + ({ \ + af_unix_pkt_hdr_t *_p = phdr; \ + sizeof (af_unix_pkt_hdr_t) + (_p)->name_len + (_p)->cmsg_len; \ + }) +#define AF_UNIX_PKT_NAME(phdr) \ + ({ \ + af_unix_pkt_hdr_t *_p = phdr; \ + (struct sockaddr_un *)(((PBYTE)(_p)) \ + + AF_UNIX_PKT_OFFSETOF_NAME (_p)); \ + }) +#define AF_UNIX_PKT_CMSG(phdr) \ + ({ \ + af_unix_pkt_hdr_t *_p = phdr; \ + (void *)(((PBYTE)(_p)) + AF_UNIX_PKT_OFFSETOF_CMSG (_p)); \ + }) +#define AF_UNIX_PKT_DATA(phdr) \ + ({ \ + af_unix_pkt_hdr_t _p = phdr; \ + (void *)(((PBYTE)(_p)) + AF_UNIX_PKT_OFFSETOF_DATA (_p)); \ + }) + /* Character length of pipe name, excluding trailing NUL. */ #define CYGWIN_PIPE_SOCKET_NAME_LEN 47 @@ -439,7 +502,9 @@ fhandler_socket_unix::get_type_char () } } +/* This also sets the pipe to message mode unconditionally. */ void +fhandler_socket_unix::set_pipe_non_blocking (bool nonblocking) { if (get_handle ()) { @@ -448,11 +513,94 @@ void FILE_PIPE_INFORMATION fpi; fpi.ReadMode = FILE_PIPE_MESSAGE_MODE; - fpi.CompletionMode = wait_state; + fpi.CompletionMode = nonblocking ? FILE_PIPE_COMPLETE_OPERATION + : FILE_PIPE_QUEUE_OPERATION; status = NtSetInformationFile (get_handle (), &io, &fpi, sizeof fpi, FilePipeInformation); if (!NT_SUCCESS (status)) - system_printf ("NtSetInformationFile(FilePipeInformation): %y", status); + debug_printf ("NtSetInformationFile(FilePipeInformation): %y", status); + } +} + +int +fhandler_socket_unix::send_my_name () +{ + size_t name_len = 0; + af_unix_pkt_hdr_t *packet; + NTSTATUS status; + IO_STATUS_BLOCK io; + + AcquireSRWLockShared (&bind_lock); + name_len = get_sun_path ()->un_len; + packet = (af_unix_pkt_hdr_t *) alloca (sizeof *packet + name_len); + memcpy (AF_UNIX_PKT_NAME (packet), &get_sun_path ()->un, name_len); + ReleaseSRWLockShared (&bind_lock); + + packet->init (0, name_len, 0, 0); + + /* The theory: Fire and forget. */ + AcquireSRWLockExclusive (&io_lock); + set_pipe_non_blocking (true); + status = NtWriteFile (get_handle (), NULL, NULL, NULL, &io, packet, + packet->pckt_len, NULL, NULL); + set_pipe_non_blocking (is_nonblocking ()); + ReleaseSRWLockExclusive (&io_lock); + if (!NT_SUCCESS (status)) + { + debug_printf ("Couldn't send my name: NtWriteFile: %y", status); + return -1; + } + return 0; +} + +/* Returns an error code. Locking is not required, user space doesn't know + about this socket yet. */ +int +fhandler_socket_unix::recv_peer_name () +{ + NTSTATUS status; + IO_STATUS_BLOCK io; + af_unix_pkt_hdr_t *packet; + struct sockaddr_un *un; + ULONG len; + int ret = 0; + + len = sizeof *packet + sizeof *un; + packet = (af_unix_pkt_hdr_t *) alloca (len); + set_pipe_non_blocking (false); + status = NtReadFile (get_handle (), NULL, NULL, NULL, &io, packet, len, + NULL, NULL); + if (status == STATUS_PENDING) + { + DWORD ret; + LARGE_INTEGER timeout; + + timeout.QuadPart = -20 * NS100PERSEC; /* 20 secs */ + ret = cygwait (connect_wait_thr, &timeout, cw_sig_eintr); + switch (ret) + { + case WAIT_OBJECT_0: + status = io.Status; + break; + case WAIT_TIMEOUT: + ret = ECONNABORTED; + break; + case WAIT_SIGNALED: + ret = EINTR; + break; + default: + ret = EPROTO; + break; + } + } + if (!NT_SUCCESS (status) && ret == 0) + ret = geterrno_from_nt_status (status); + if (ret == 0 && packet->name_len > 0) + set_peer_sun_path (AF_UNIX_PKT_NAME (packet), packet->name_len); + set_pipe_non_blocking (is_nonblocking ()); + return ret; +} + NTSTATUS fhandler_socket_unix::npfs_handle (HANDLE &nph, npfs_hdl_t type) { @@ -562,24 +710,189 @@ fhandler_socket_unix::create_pipe_instance () return ph; } -fhandler_socket_unix::fhandler_socket_unix () : - sun_path (NULL), - peer_sun_path (NULL) +NTSTATUS +fhandler_socket_unix::open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name) { - set_cred (); + NTSTATUS status; + HANDLE npfsh; + ACCESS_MASK access; + OBJECT_ATTRIBUTES attr; + IO_STATUS_BLOCK io; + ULONG sharing; + + status = npfs_handle (npfsh, NPFS_DIR); + if (!NT_SUCCESS (status)) + return status; + access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE; + InitializeObjectAttributes (&attr, pipe_name, OBJ_INHERIT, npfsh, NULL); + sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; + status = NtOpenFile (&ph, access, &attr, &io, sharing, 0); + if (NT_SUCCESS (status)) + { + set_io_handle (ph); + send_my_name (); + } + return status; } -fhandler_socket_unix::~fhandler_socket_unix () +struct conn_wait_info_t { - if (sun_path) - delete sun_path; - if (peer_sun_path) - delete peer_sun_path; + fhandler_socket_unix *fh; + UNICODE_STRING pipe_name; + WCHAR pipe_name_buf[CYGWIN_PIPE_SOCKET_NAME_LEN + 1]; +}; + +/* Just hop to the wait_pipe_thread method. */ +DWORD WINAPI +connect_wait_func (LPVOID param) +{ + conn_wait_info_t *wait_info = (conn_wait_info_t *) param; + return wait_info->fh->wait_pipe_thread (&wait_info->pipe_name); +} + +/* Start a waiter thread to wait for a pipe instance to become available. + in blocking mode, wait for the thread to finish. In nonblocking mode + just return with errno set to EINPROGRESS. */ +int +fhandler_socket_unix::wait_pipe (PUNICODE_STRING pipe_name) +{ + conn_wait_info_t *wait_info; + DWORD waitret, err; + int ret = -1; + + wait_info = (conn_wait_info_t *) + cmalloc_abort (HEAP_FHANDLER, sizeof *wait_info); + wait_info->fh = this; + RtlInitEmptyUnicodeString (&wait_info->pipe_name, wait_info->pipe_name_buf, + sizeof wait_info->pipe_name_buf); + RtlCopyUnicodeString (&wait_info->pipe_name, pipe_name); + + cwt_param = (PVOID) wait_info; + connect_wait_thr = CreateThread (NULL, PREFERRED_IO_BLKSIZE, + connect_wait_func, cwt_param, 0, NULL); + if (!connect_wait_thr) + { + cfree (wait_info); + __seterrno (); + return -1; + } + if (is_nonblocking ()) + { + set_errno (EINPROGRESS); + return -1; + } + + waitret = cygwait (connect_wait_thr, cw_infinite, cw_cancel | cw_sig_eintr); + if (waitret == WAIT_OBJECT_0) + GetExitCodeThread (connect_wait_thr, &err); + else + TerminateThread (connect_wait_thr, 0); + HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL); + if (thr) + CloseHandle (thr); + PVOID param = InterlockedExchangePointer (&cwt_param, NULL); + if (param) + cfree (param); + switch (waitret) + { + case WAIT_CANCELED: + pthread::static_cancel_self (); + /*NOTREACHED*/ + case WAIT_SIGNALED: + set_errno (EINTR); + break; + default: + InterlockedExchange (&so_error, err); + if (err) + set_errno (err); + else + ret = 0; + break; + } + return ret; +} + +int +fhandler_socket_unix::connect_pipe (PUNICODE_STRING pipe_name) +{ + NTSTATUS status; + HANDLE ph = NULL; + + /* Try connecting first. If it doesn't work, wait for the pipe + to become available. */ + status = open_pipe (ph, pipe_name); + if (status == STATUS_PIPE_BUSY) + return wait_pipe (pipe_name); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + InterlockedExchange (&so_error, get_errno ()); + return -1; + } + InterlockedExchange (&so_error, 0); + return 0; +} + +int +fhandler_socket_unix::listen_pipe () +{ + NTSTATUS status; + IO_STATUS_BLOCK io; + OBJECT_ATTRIBUTES attr; + HANDLE evt = NULL; + + io.Status = STATUS_PENDING; + if (!is_nonblocking ()) + { + /* Create event object and set APC context pointer. */ + InitializeObjectAttributes (&attr, NULL, 0, NULL, NULL); + status = NtCreateEvent (&evt, EVENT_ALL_ACCESS, &attr, + NotificationEvent, FALSE); + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return -1; + } + } + status = NtFsControlFile (get_handle (), evt, NULL, NULL, &io, + FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0); + if (status == STATUS_PENDING) + { + if (cygwait (evt ?: get_handle ()) == WAIT_OBJECT_0) + status = io.Status; + } + if (evt) + NtClose (evt); + if (status == STATUS_PIPE_LISTENING) + set_errno (EAGAIN); + else if (status != STATUS_PIPE_CONNECTED) + __seterrno_from_nt_status (status); + return (status == STATUS_PIPE_CONNECTED) ? 0 : -1; +} + +int +fhandler_socket_unix::disconnect_pipe (HANDLE ph) +{ + NTSTATUS status; + IO_STATUS_BLOCK io; + + status = NtFsControlFile (ph, NULL, NULL, NULL, &io, FSCTL_PIPE_DISCONNECT, + NULL, 0, NULL, 0); + if (status == STATUS_PENDING && cygwait (ph) == WAIT_OBJECT_0) + status = io.Status; + if (!NT_SUCCESS (status)) + { + __seterrno_from_nt_status (status); + return -1; + } + return 0; } void fhandler_socket_unix::set_sun_path (struct sockaddr_un *un, socklen_t unlen) { + if (peer_sun_path) + delete peer_sun_path; if (!un) sun_path = NULL; sun_path = new sun_name_t ((const struct sockaddr *) un, unlen); @@ -589,6 +902,8 @@ void fhandler_socket_unix::set_peer_sun_path (struct sockaddr_un *un, socklen_t unlen) { + if (peer_sun_path) + delete peer_sun_path; if (!un) peer_sun_path = NULL; peer_sun_path = new sun_name_t ((const struct sockaddr *) un, unlen); @@ -602,15 +917,143 @@ fhandler_socket_unix::set_cred () peer_cred.gid = (gid_t) -1; } +void +fhandler_socket_unix::fixup_after_fork (HANDLE parent) +{ + fhandler_socket::fixup_after_fork (parent); + if (backing_file_handle && backing_file_handle != INVALID_HANDLE_VALUE) + fork_fixup (parent, backing_file_handle, "backing_file_handle"); + InitializeSRWLock (&conn_lock); + InitializeSRWLock (&bind_lock); + InitializeSRWLock (&io_lock); + connect_wait_thr = NULL; + cwt_param = NULL; +} + +void +fhandler_socket_unix::set_close_on_exec (bool val) +{ + fhandler_base::set_close_on_exec (val); + if (backing_file_handle && backing_file_handle != INVALID_HANDLE_VALUE) + set_no_inheritance (backing_file_handle, val); +} + +/* ========================== public methods ========================= */ + +fhandler_socket_unix::fhandler_socket_unix () +{ + set_cred (); +} + +fhandler_socket_unix::~fhandler_socket_unix () +{ + if (sun_path) + delete sun_path; + if (peer_sun_path) + delete peer_sun_path; +} + int fhandler_socket_unix::dup (fhandler_base *child, int flags) { fhandler_socket_unix *fhs = (fhandler_socket_unix *) child; fhs->set_sun_path (get_sun_path ()); fhs->set_peer_sun_path (get_peer_sun_path ()); + InitializeSRWLock (&fhs->conn_lock); + InitializeSRWLock (&fhs->bind_lock); + InitializeSRWLock (&fhs->io_lock); + fhs->connect_wait_thr = NULL; + fhs->cwt_param = NULL; return fhandler_socket::dup (child, flags); } +/* Waiter thread method. Here we wait for a pipe instance to become + available and connect to it, if so. This function is running + asynchronously if called on a non-blocking pipe. The important + things to do: + + - Set the peer pipe handle if successful + - Send own sun_path to peer if successful TODO + - Set connect_state + - Set so_error for later call to select +*/ +DWORD +fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) +{ + HANDLE npfsh; + LONG error = 0; + NTSTATUS status; + IO_STATUS_BLOCK io; + ULONG pwbuf_size; + PFILE_PIPE_WAIT_FOR_BUFFER pwbuf; + LONGLONG stamp; + HANDLE ph = NULL; + + status = npfs_handle (npfsh, NPFS_DEVICE); + if (!NT_SUCCESS (status)) + { + error = geterrno_from_nt_status (status); + goto out; + } + pwbuf_size = offsetof (FILE_PIPE_WAIT_FOR_BUFFER, Name) + pipe_name->Length; + pwbuf = (PFILE_PIPE_WAIT_FOR_BUFFER) alloca (pwbuf_size); + pwbuf->Timeout.QuadPart = -20 * NS100PERSEC; /* 20 secs */ + pwbuf->NameLength = pipe_name->Length; + pwbuf->TimeoutSpecified = TRUE; + memcpy (pwbuf->Name, pipe_name->Buffer, pipe_name->Length); + stamp = ntod.nsecs (); + do + { + status = NtFsControlFile (npfsh, NULL, NULL, NULL, &io, FSCTL_PIPE_WAIT, + pwbuf, pwbuf_size, NULL, 0); + switch (status) + { + case STATUS_SUCCESS: + { + status = open_pipe (ph, pipe_name); + if (status == STATUS_PIPE_BUSY) + { + /* Another concurrent connect grabbed the pipe instance + under our nose. Fix the timeout value and go waiting + again, unless the timeout has passed. */ + pwbuf->Timeout.QuadPart -= (stamp - ntod.nsecs ()) / 100LL; + if (pwbuf->Timeout.QuadPart >= 0) + { + status = STATUS_IO_TIMEOUT; + error = ETIMEDOUT; + } + } + else if (!NT_SUCCESS (status)) + error = geterrno_from_nt_status (status); + } + break; + case STATUS_OBJECT_NAME_NOT_FOUND: + error = EADDRNOTAVAIL; + break; + case STATUS_IO_TIMEOUT: + error = ETIMEDOUT; + break; + case STATUS_INSUFFICIENT_RESOURCES: + error = ENOBUFS; + break; + case STATUS_INVALID_DEVICE_REQUEST: + default: + error = EIO; + break; + } + } + while (status == STATUS_PIPE_BUSY); +out: + PVOID param = InterlockedExchangePointer (&cwt_param, NULL); + if (param) + cfree (param); + AcquireSRWLockExclusive (&conn_lock); + InterlockedExchange (&so_error, error); + connect_state (error ? connect_failed : connected); + ReleaseSRWLockExclusive (&conn_lock); + return error; +} + int fhandler_socket_unix::socket (int af, int type, int protocol, int flags) { @@ -656,6 +1099,9 @@ fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, return -1; } +/* Bind creates the backing file, generates the pipe name and sets + bind_state. On DGRAM sockets it also creates the pipe. On STREAM + sockets either listen or connect will do that. */ int fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) { @@ -663,46 +1109,253 @@ fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) bool unnamed = (sun.un_len == sizeof sun.un.sun_family); HANDLE pipe = NULL; - /* If we have a handle, we're already bound. */ - if (get_handle () || sun.un.sun_family != AF_UNIX) + if (sun.un.sun_family != AF_UNIX) { set_errno (EINVAL); return -1; } - gen_pipe_name (); - pipe = create_pipe (); - if (!pipe) - return -1; - file = unnamed ? autobind (&sun) : create_file (&sun); - if (!file) + AcquireSRWLockExclusive (&bind_lock); + if (binding_state () == bind_pending) { - NtClose (pipe); + set_errno (EALREADY); + ReleaseSRWLockExclusive (&bind_lock); + return -1; + } + if (binding_state () == bound) + { + set_errno (EINVAL); + ReleaseSRWLockExclusive (&bind_lock); + return -1; + } + binding_state (bind_pending); + ReleaseSRWLockExclusive (&bind_lock); + gen_pipe_name (); + if (get_socket_type () == SOCK_DGRAM) + { + pipe = create_pipe (); + if (!pipe) + { + binding_state (unbound); + return -1; + } + set_io_handle (pipe); + } + backing_file_handle = unnamed ? autobind (&sun) : create_file (&sun); + if (!backing_file_handle) + { + set_io_handle (NULL); + if (pipe) + NtClose (pipe); + binding_state (unbound); return -1; } - set_io_handle (pipe); set_sun_path (&sun); + /* If we're already connected, send name to peer. */ + if (connect_state () == connected) + send_my_name (); + binding_state (bound); return 0; } +/* Create pipe on non-DGRAM sockets and set conn_state to listener. */ int fhandler_socket_unix::listen (int backlog) { - set_errno (EAFNOSUPPORT); - return -1; + if (get_socket_type () == SOCK_DGRAM) + { + set_errno (EOPNOTSUPP); + return -1; + } + AcquireSRWLockShared (&bind_lock); + while (binding_state () == bind_pending) + yield (); + if (binding_state () == unbound) + { + set_errno (EDESTADDRREQ); + ReleaseSRWLockShared (&bind_lock); + return -1; + } + ReleaseSRWLockShared (&bind_lock); + AcquireSRWLockExclusive (&conn_lock); + if (connect_state () != unconnected && connect_state () != connect_failed) + { + set_errno (connect_state () == listener ? EADDRINUSE : EINVAL); + ReleaseSRWLockExclusive (&conn_lock); + return -1; + } + if (get_socket_type () != SOCK_DGRAM) + { + HANDLE pipe = create_pipe (); + if (!pipe) + { + connect_state (unconnected); + return -1; + } + set_io_handle (pipe); + } + connect_state (listener); + ReleaseSRWLockExclusive (&conn_lock); + return 0; } int fhandler_socket_unix::accept4 (struct sockaddr *peer, int *len, int flags) { - set_errno (EAFNOSUPPORT); + if (get_socket_type () != SOCK_STREAM) + { + set_errno (EOPNOTSUPP); + return -1; + } + if (connect_state () != listener + || (peer && (!len || *len < (int) sizeof (sa_family_t)))) + { + set_errno (EINVAL); + return -1; + } + if (listen_pipe () == 0) + { + /* Our handle is now connected with a client. This handle is used + for the accepted socket. Our handle has to be replaced with a + new instance handle for the next accept. */ + HANDLE accepted = get_handle (); + HANDLE new_inst = create_pipe_instance (); + int error = ENOBUFS; + if (new_inst) + { + /* Set new io handle. */ + set_io_handle (new_inst); + /* Prepare new file descriptor. */ + cygheap_fdnew fd; + + if (fd >= 0) + { + fhandler_socket_unix *sock = (fhandler_socket_unix *) + build_fh_dev (dev ()); + if (sock) + { + sock->set_addr_family (get_addr_family ()); + sock->set_socket_type (get_socket_type ()); + if (flags & SOCK_NONBLOCK) + sock->set_nonblocking (true); + if (flags & SOCK_CLOEXEC) + sock->set_close_on_exec (true); + sock->set_unique_id (); + sock->set_ino (sock->get_unique_id ()); + sock->pc.set_nt_native_path (pc.get_nt_native_path ()); + sock->connect_state (connected); + sock->binding_state (binding_state ()); + sock->set_io_handle (accepted); + + sock->set_sun_path (get_sun_path ()); + error = sock->recv_peer_name (); + if (error == 0) + { + if (peer) + { + sun_name_t *sun = sock->get_peer_sun_path (); + if (sun) + { + memcpy (peer, &sun->un, MIN (*len, sun->un_len)); + *len = sun->un_len; + } + else if (len) + *len = 0; + } + fd = sock; + if (fd <= 2) + set_std_handle (fd); + return fd; + } + delete sock; + } + fd.release (); + } + } + /* Ouch! We can't handle the client if we couldn't + create a new instance to accept more connections.*/ + disconnect_pipe (accepted); + set_errno (error); + } return -1; } int fhandler_socket_unix::connect (const struct sockaddr *name, int namelen) { - set_errno (EAFNOSUPPORT); - return -1; + sun_name_t sun (name, namelen); + int peer_type; + WCHAR pipe_name_buf[CYGWIN_PIPE_SOCKET_NAME_LEN + 1]; + UNICODE_STRING pipe_name; + + /* Test and set connection state. */ + AcquireSRWLockExclusive (&conn_lock); + if (connect_state () == connect_pending) + { + set_errno (EALREADY); + ReleaseSRWLockExclusive (&conn_lock); + return -1; + } + if (connect_state () == listener) + { + set_errno (EADDRINUSE); + ReleaseSRWLockExclusive (&conn_lock); + return -1; + } + if (connect_state () == connected && get_socket_type () != SOCK_DGRAM) + { + set_errno (EISCONN); + ReleaseSRWLockExclusive (&conn_lock); + return -1; + } + connect_state (connect_pending); + ReleaseSRWLockExclusive (&conn_lock); + /* Check validity of name */ + if (sun.un_len <= (int) sizeof (sa_family_t)) + { + set_errno (EINVAL); + connect_state (unconnected); + return -1; + } + if (sun.un.sun_family != AF_UNIX) + { + set_errno (EAFNOSUPPORT); + connect_state (unconnected); + return -1; + } + if (sun.un_len == 3 && sun.un.sun_path[0] == '\0') + { + set_errno (EINVAL); + connect_state (unconnected); + return -1; + } + /* Check if peer address exists. */ + RtlInitEmptyUnicodeString (&pipe_name, pipe_name_buf, sizeof pipe_name_buf); + if (open_file (&sun, peer_type, &pipe_name) < 0) + { + connect_state (unconnected); + return -1; + } + if (peer_type != get_socket_type ()) + { + set_errno (EINVAL); + connect_state (unconnected); + return -1; + } + set_peer_sun_path (&sun); + if (get_socket_type () != SOCK_DGRAM) + { + if (connect_pipe (&pipe_name) < 0) + { + if (get_errno () != EINPROGRESS) + { + set_peer_sun_path (NULL); + connect_state (connect_failed); + } + return -1; + } + } + connect_state (connected); + return 0; } int @@ -743,40 +1396,52 @@ fhandler_socket_unix::shutdown (int how) int fhandler_socket_unix::close () { + HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL); + if (thr) + { + TerminateThread (thr, 0); + CloseHandle (thr); + } + PVOID param = InterlockedExchangePointer (&cwt_param, NULL); + if (param) + cfree (param); if (get_handle ()) NtClose (get_handle ()); - if (file && file != INVALID_HANDLE_VALUE) - NtClose (file); + if (backing_file_handle && backing_file_handle != INVALID_HANDLE_VALUE) + NtClose (backing_file_handle); return 0; } int fhandler_socket_unix::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) { + int ret = -1; + if (get_socket_type () != SOCK_STREAM) { set_errno (EINVAL); return -1; } + AcquireSRWLockShared (&conn_lock); if (connect_state () != connected) + set_errno (ENOTCONN); + else { - set_errno (ENOTCONN); - return -1; + __try + { + if (pid) + *pid = peer_cred.pid; + if (euid) + *euid = peer_cred.uid; + if (egid) + *egid = peer_cred.gid; + ret = 0; + } + __except (EFAULT) {} + __endtry } - - __try - { - if (pid) - *pid = peer_cred.pid; - if (euid) - *euid = peer_cred.uid; - if (egid) - *egid = peer_cred.gid; - return 0; - } - __except (EFAULT) {} - __endtry - return -1; + ReleaseSRWLockShared (&conn_lock); + return ret; } ssize_t @@ -905,7 +1570,10 @@ fhandler_socket_unix::getsockopt (int level, int optname, const void *optval, case SO_ERROR: { int *e = (int *) optval; - *e = 0; + LONG err; + + err = InterlockedExchange (&so_error, 0); + *e = err; break; } @@ -1019,6 +1687,15 @@ fhandler_socket_unix::ioctl (unsigned int cmd, void *p) case _IOR('f', 127, int): #endif case FIONBIO: + { + const bool was_nonblocking = is_nonblocking (); + set_nonblocking (*(int *) p); + const bool now_nonblocking = is_nonblocking (); + if (was_nonblocking != now_nonblocking) + set_pipe_non_blocking (now_nonblocking); + ret = 0; + break; + } case SIOCATMARK: break; default: @@ -1031,7 +1708,7 @@ fhandler_socket_unix::ioctl (unsigned int cmd, void *p) int fhandler_socket_unix::fcntl (int cmd, intptr_t arg) { - int ret = 0; + int ret = -1; switch (cmd) { @@ -1039,6 +1716,20 @@ fhandler_socket_unix::fcntl (int cmd, intptr_t arg) break; case F_GETOWN: break; + case F_SETFL: + { + const bool was_nonblocking = is_nonblocking (); + const int allowed_flags = O_APPEND | O_NONBLOCK_MASK; + int new_flags = arg & allowed_flags; + if ((new_flags & OLD_O_NDELAY) && (new_flags & O_NONBLOCK)) + new_flags &= ~OLD_O_NDELAY; + set_flags ((get_flags () & ~allowed_flags) | new_flags); + const bool now_nonblocking = is_nonblocking (); + if (was_nonblocking != now_nonblocking) + set_pipe_non_blocking (now_nonblocking); + ret = 0; + break; + } default: ret = fhandler_socket::fcntl (cmd, arg); break; diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc index d94a4f844..9dac030ff 100644 --- a/winsup/cygwin/globals.cc +++ b/winsup/cygwin/globals.cc @@ -149,6 +149,8 @@ const int __collate_load_error = 0; extern UNICODE_STRING _RDATA ro_u_natdir = _ROU (L"Directory"); extern UNICODE_STRING _RDATA ro_u_natsyml = _ROU (L"SymbolicLink"); extern UNICODE_STRING _RDATA ro_u_natdev = _ROU (L"Device"); + extern UNICODE_STRING _RDATA ro_u_npfs = _ROU (L"\\Device\\NamedPipe"); + extern UNICODE_STRING _RDATA ro_u_npfs_dir = _ROU (L"\\Device\\NamedPipe\\"); #undef _ROU /* This is an exported copy of environ which can be used by DLLs From e94fa4ebf39384446f89a44b3769756fb51cb4f9 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 15:43:26 +0100 Subject: [PATCH 332/649] Cygwin: AF_UNIX: fix comments and move a macro Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index ae422dda4..d5f617d92 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -67,12 +67,12 @@ for the entire packet, as well as for all three data blocks. The combined maximum size of a packet is 64K, including the header. - A connecting, bound STREAM socket send it's local sun_path once after + A connecting, bound STREAM socket sends it's local sun_path once after a successful connect. An already connected socket also sends its local sun_path after a successful bind (border case, but still...). These packages don't contain any other data (cmsg_len == 0, data_len == 0). - A bound DGRAM socket send its sun_path with each sendmsg/sendto. + A bound DGRAM socket sends its sun_path with each sendmsg/sendto. */ class af_unix_pkt_hdr_t { @@ -124,9 +124,6 @@ class af_unix_pkt_hdr_t (void *)(((PBYTE)(_p)) + AF_UNIX_PKT_OFFSETOF_DATA (_p)); \ }) -/* Character length of pipe name, excluding trailing NUL. */ -#define CYGWIN_PIPE_SOCKET_NAME_LEN 47 - GUID __cygwin_socket_guid = { .Data1 = 0xefc1714d, .Data2 = 0x7b19, @@ -973,7 +970,7 @@ fhandler_socket_unix::dup (fhandler_base *child, int flags) things to do: - Set the peer pipe handle if successful - - Send own sun_path to peer if successful TODO + - Send own sun_path to peer if successful - Set connect_state - Set so_error for later call to select */ From d69bcdd671539caea906f18e327dfd2eb9f1da85 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 16:00:36 +0100 Subject: [PATCH 333/649] Cygwin: AF_UNIX: Add create_event helper and use throughout Minimize overhead in creating a nameless event object. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 40 +++++++++++++++++---------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index d5f617d92..ea8aeced2 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -148,6 +148,24 @@ sun_name_t::sun_name_t (const struct sockaddr *name, socklen_t namelen) _nul[sizeof (struct sockaddr_un)] = '\0'; } +static HANDLE +create_event () +{ + NTSTATUS status; + OBJECT_ATTRIBUTES attr; + HANDLE evt = NULL; + + InitializeObjectAttributes (&attr, NULL, 0, NULL, NULL); + status = NtCreateEvent (&evt, EVENT_ALL_ACCESS, &attr, + NotificationEvent, FALSE); + if (!NT_SUCCESS (status)) + __seterrno_from_nt_status (status); + return evt; +} + +/* Character length of pipe name, excluding trailing NUL. */ +#define CYGWIN_PIPE_SOCKET_NAME_LEN 47 + /* Character position encoding the socket type in a pipe name. */ #define CYGWIN_PIPE_SOCKET_TYPE_POS 29 @@ -555,6 +573,7 @@ fhandler_socket_unix::send_my_name () int fhandler_socket_unix::recv_peer_name () { + HANDLE evt; NTSTATUS status; IO_STATUS_BLOCK io; af_unix_pkt_hdr_t *packet; @@ -562,10 +581,12 @@ fhandler_socket_unix::recv_peer_name () ULONG len; int ret = 0; + if (!(evt = create_event ())) + return ENOBUFS; len = sizeof *packet + sizeof *un; packet = (af_unix_pkt_hdr_t *) alloca (len); set_pipe_non_blocking (false); - status = NtReadFile (get_handle (), NULL, NULL, NULL, &io, packet, len, + status = NtReadFile (get_handle (), evt, NULL, NULL, &io, packet, len, NULL, NULL); if (status == STATUS_PENDING) { @@ -573,7 +594,7 @@ fhandler_socket_unix::recv_peer_name () LARGE_INTEGER timeout; timeout.QuadPart = -20 * NS100PERSEC; /* 20 secs */ - ret = cygwait (connect_wait_thr, &timeout, cw_sig_eintr); + ret = cygwait (evt, &timeout, cw_sig_eintr); switch (ret) { case WAIT_OBJECT_0: @@ -835,22 +856,11 @@ fhandler_socket_unix::listen_pipe () { NTSTATUS status; IO_STATUS_BLOCK io; - OBJECT_ATTRIBUTES attr; HANDLE evt = NULL; io.Status = STATUS_PENDING; - if (!is_nonblocking ()) - { - /* Create event object and set APC context pointer. */ - InitializeObjectAttributes (&attr, NULL, 0, NULL, NULL); - status = NtCreateEvent (&evt, EVENT_ALL_ACCESS, &attr, - NotificationEvent, FALSE); - if (!NT_SUCCESS (status)) - { - __seterrno_from_nt_status (status); - return -1; - } - } + if (!is_nonblocking () && !(evt = create_event ())) + return -1; status = NtFsControlFile (get_handle (), evt, NULL, NULL, &io, FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0); if (status == STATUS_PENDING) From 2f2a75b7bbf521057f3e8e502f1a6641a2baf376 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 15:48:21 +0100 Subject: [PATCH 334/649] Cygwin: AF_UNIX: fix creation of npfs handle The handle to the device is never needed. As the name impies, FSCTL_PIPE_WAIT works on the file system, not on the device level. Drop opening the device and make sure to open only one handle to NPFS. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 8 +----- winsup/cygwin/fhandler_socket_unix.cc | 37 +++++++++++++++------------ winsup/cygwin/globals.cc | 3 +-- 3 files changed, 23 insertions(+), 25 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 392ba6c4e..4166126fc 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -852,12 +852,6 @@ class sun_name_t class fhandler_socket_unix : public fhandler_socket { - enum npfs_hdl_t - { - NPFS_DEVICE, - NPFS_DIR - }; - protected: SRWLOCK conn_lock; SRWLOCK bind_lock; @@ -886,7 +880,7 @@ class fhandler_socket_unix : public fhandler_socket void set_pipe_non_blocking (bool nonblocking); int send_my_name (); int recv_peer_name (); - static NTSTATUS npfs_handle (HANDLE &nph, npfs_hdl_t type); + static NTSTATUS npfs_handle (HANDLE &nph); HANDLE create_pipe (); HANDLE create_pipe_instance (); NTSTATUS open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index ea8aeced2..f32045361 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -620,28 +620,33 @@ fhandler_socket_unix::recv_peer_name () } NTSTATUS -fhandler_socket_unix::npfs_handle (HANDLE &nph, npfs_hdl_t type) +fhandler_socket_unix::npfs_handle (HANDLE &nph) { - static NO_COPY HANDLE npfs_devh; + static NO_COPY SRWLOCK npfs_lock; static NO_COPY HANDLE npfs_dirh; - HANDLE &npfs_ref = (type == NPFS_DEVICE) ? npfs_devh : npfs_dirh; - PUNICODE_STRING path = (type == NPFS_DEVICE) ? &ro_u_npfs : &ro_u_npfs_dir; - NTSTATUS status; + NTSTATUS status = STATUS_SUCCESS; OBJECT_ATTRIBUTES attr; IO_STATUS_BLOCK io; - if (!npfs_ref) + /* Lockless after first call. */ + if (npfs_dirh) { - InitializeObjectAttributes (&attr, path, 0, NULL, NULL); - status = NtOpenFile (&npfs_ref, FILE_READ_ATTRIBUTES | SYNCHRONIZE, + nph = npfs_dirh; + return STATUS_SUCCESS; + } + AcquireSRWLockExclusive (&npfs_lock); + if (!npfs_dirh) + { + InitializeObjectAttributes (&attr, &ro_u_npfs, 0, NULL, NULL); + status = NtOpenFile (&npfs_dirh, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_SYNCHRONOUS_IO_NONALERT); - if (!NT_SUCCESS (status)) - return status; } - nph = npfs_ref; - return STATUS_SUCCESS; + ReleaseSRWLockExclusive (&npfs_lock); + if (NT_SUCCESS (status)) + nph = npfs_dirh; + return status; } HANDLE @@ -658,7 +663,7 @@ fhandler_socket_unix::create_pipe () ULONG max_instances; LARGE_INTEGER timeout; - status = npfs_handle (npfsh, NPFS_DIR); + status = npfs_handle (npfsh); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); @@ -700,7 +705,7 @@ fhandler_socket_unix::create_pipe_instance () ULONG max_instances; LARGE_INTEGER timeout; - status = npfs_handle (npfsh, NPFS_DIR); + status = npfs_handle (npfsh); if (!NT_SUCCESS (status)) { __seterrno_from_nt_status (status); @@ -738,7 +743,7 @@ fhandler_socket_unix::open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name) IO_STATUS_BLOCK io; ULONG sharing; - status = npfs_handle (npfsh, NPFS_DIR); + status = npfs_handle (npfsh); if (!NT_SUCCESS (status)) return status; access = GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE; @@ -996,7 +1001,7 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) LONGLONG stamp; HANDLE ph = NULL; - status = npfs_handle (npfsh, NPFS_DEVICE); + status = npfs_handle (npfsh); if (!NT_SUCCESS (status)) { error = geterrno_from_nt_status (status); diff --git a/winsup/cygwin/globals.cc b/winsup/cygwin/globals.cc index 9dac030ff..7c84eb637 100644 --- a/winsup/cygwin/globals.cc +++ b/winsup/cygwin/globals.cc @@ -149,8 +149,7 @@ const int __collate_load_error = 0; extern UNICODE_STRING _RDATA ro_u_natdir = _ROU (L"Directory"); extern UNICODE_STRING _RDATA ro_u_natsyml = _ROU (L"SymbolicLink"); extern UNICODE_STRING _RDATA ro_u_natdev = _ROU (L"Device"); - extern UNICODE_STRING _RDATA ro_u_npfs = _ROU (L"\\Device\\NamedPipe"); - extern UNICODE_STRING _RDATA ro_u_npfs_dir = _ROU (L"\\Device\\NamedPipe\\"); + extern UNICODE_STRING _RDATA ro_u_npfs = _ROU (L"\\Device\\NamedPipe\\"); #undef _ROU /* This is an exported copy of environ which can be used by DLLs From 4de52a0fe1009d2a5318a731400dbf4280b184cc Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 16:08:15 +0100 Subject: [PATCH 335/649] Cygwin: AF_UNIX: fix SEGV when sending an empty socket name from connect Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index f32045361..27ac95876 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -540,15 +540,18 @@ fhandler_socket_unix::set_pipe_non_blocking (bool nonblocking) int fhandler_socket_unix::send_my_name () { + sun_name_t *sun; size_t name_len = 0; af_unix_pkt_hdr_t *packet; NTSTATUS status; IO_STATUS_BLOCK io; AcquireSRWLockShared (&bind_lock); - name_len = get_sun_path ()->un_len; + sun = get_sun_path (); + name_len = sun ? sun->un_len : 0; packet = (af_unix_pkt_hdr_t *) alloca (sizeof *packet + name_len); - memcpy (AF_UNIX_PKT_NAME (packet), &get_sun_path ()->un, name_len); + if (sun) + memcpy (AF_UNIX_PKT_NAME (packet), &sun->un, name_len); ReleaseSRWLockShared (&bind_lock); packet->init (0, name_len, 0, 0); From 27a63d4ef2d062d318330682e01f88b4a7298f97 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 16:12:55 +0100 Subject: [PATCH 336/649] Cygwin: AF_UNIX: some pipe errors may have multiple status codes Depending on the exact circumstances, some erros are indicated by different status codes. Add helper macros to handle them together. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 27ac95876..099000d0d 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -131,6 +131,29 @@ GUID __cygwin_socket_guid = { .Data4 = { 0xba, 0xb3, 0xc5, 0xb1, 0xf9, 0x2c, 0xb8, 0x8c } }; +/* Some error conditions on pipes have multiple status codes, unfortunately. */ +#define STATUS_PIPE_NO_INSTANCE_AVAILABLE(status) \ + ({ NTSTATUS _s = (status); \ + _s == STATUS_INSTANCE_NOT_AVAILABLE \ + || _s == STATUS_PIPE_NOT_AVAILABLE \ + || _s == STATUS_PIPE_BUSY; }) + +#define STATUS_PIPE_IS_CLOSING(status) \ + ({ NTSTATUS _s = (status); \ + _s == STATUS_PIPE_CLOSING \ + || _s == STATUS_PIPE_EMPTY; }) + +#define STATUS_PIPE_INVALID(status) \ + ({ NTSTATUS _s = (status); \ + _s == STATUS_INVALID_INFO_CLASS \ + || _s == STATUS_INVALID_PIPE_STATE \ + || _s == STATUS_INVALID_READ_MODE; }) + +#define STATUS_PIPE_MORE_DATA(status) \ + ({ NTSTATUS _s = (status); \ + _s == STATUS_BUFFER_OVERFLOW \ + || _s == STATUS_MORE_PROCESSING_REQUIRED; }) + sun_name_t::sun_name_t () { un_len = sizeof (sa_family_t); @@ -847,7 +870,7 @@ fhandler_socket_unix::connect_pipe (PUNICODE_STRING pipe_name) /* Try connecting first. If it doesn't work, wait for the pipe to become available. */ status = open_pipe (ph, pipe_name); - if (status == STATUS_PIPE_BUSY) + if (STATUS_PIPE_NO_INSTANCE_AVAILABLE (status)) return wait_pipe (pipe_name); if (!NT_SUCCESS (status)) { @@ -1026,7 +1049,7 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) case STATUS_SUCCESS: { status = open_pipe (ph, pipe_name); - if (status == STATUS_PIPE_BUSY) + if (STATUS_PIPE_NO_INSTANCE_AVAILABLE (status)) { /* Another concurrent connect grabbed the pipe instance under our nose. Fix the timeout value and go waiting @@ -1057,7 +1080,7 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) break; } } - while (status == STATUS_PIPE_BUSY); + while (STATUS_PIPE_NO_INSTANCE_AVAILABLE (status)); out: PVOID param = InterlockedExchangePointer (&cwt_param, NULL); if (param) From cde2648c2250eb373d1e245160e2aca26dc0555c Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 16:19:32 +0100 Subject: [PATCH 337/649] Cygwin: AF_UNIX: make sure connect wait thread is cleanly interruptible Using TerminateThread potentially leaks resources. In our case, the connect wait thread may be forcefully terminated after having successfully opened a client side pipe handle. If this occurs, we have a stale pipe server instance, so the pipe will never be closed as long as the process lives. Avoid this by changing the npfs handle to non-blocking, so we can wait on a termination event object from inside the thread itself and cleanly exit from the thread instead of terminating. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_socket_unix.cc | 56 +++++++++++++++++++++++---- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 4166126fc..13f406821 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -860,6 +860,7 @@ class fhandler_socket_unix : public fhandler_socket if the socket is backed by a file in the file system (actually a reparse point) */ HANDLE connect_wait_thr; + HANDLE cwt_termination_evt; PVOID cwt_param; LONG so_error; sun_name_t *sun_path; diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 099000d0d..dcd493856 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -667,7 +667,7 @@ fhandler_socket_unix::npfs_handle (HANDLE &nph) InitializeObjectAttributes (&attr, &ro_u_npfs, 0, NULL, NULL); status = NtOpenFile (&npfs_dirh, FILE_READ_ATTRIBUTES | SYNCHRONIZE, &attr, &io, FILE_SHARE_READ | FILE_SHARE_WRITE, - FILE_SYNCHRONOUS_IO_NONALERT); + 0); } ReleaseSRWLockExclusive (&npfs_lock); if (NT_SUCCESS (status)) @@ -808,7 +808,11 @@ fhandler_socket_unix::wait_pipe (PUNICODE_STRING pipe_name) conn_wait_info_t *wait_info; DWORD waitret, err; int ret = -1; + HANDLE thr, evt; + PVOID param; + if (!(cwt_termination_evt = create_event ())) + return -1; wait_info = (conn_wait_info_t *) cmalloc_abort (HEAP_FHANDLER, sizeof *wait_info); wait_info->fh = this; @@ -823,23 +827,28 @@ fhandler_socket_unix::wait_pipe (PUNICODE_STRING pipe_name) { cfree (wait_info); __seterrno (); - return -1; + goto out; } if (is_nonblocking ()) { set_errno (EINPROGRESS); - return -1; + goto out; } waitret = cygwait (connect_wait_thr, cw_infinite, cw_cancel | cw_sig_eintr); if (waitret == WAIT_OBJECT_0) GetExitCodeThread (connect_wait_thr, &err); else - TerminateThread (connect_wait_thr, 0); - HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL); + { + SetEvent (cwt_termination_evt); + WaitForSingleObject (connect_wait_thr, INFINITE); + GetExitCodeThread (connect_wait_thr, &err); + waitret = WAIT_SIGNALED; + } + thr = InterlockedExchangePointer (&connect_wait_thr, NULL); if (thr) CloseHandle (thr); - PVOID param = InterlockedExchangePointer (&cwt_param, NULL); + param = InterlockedExchangePointer (&cwt_param, NULL); if (param) cfree (param); switch (waitret) @@ -858,6 +867,10 @@ fhandler_socket_unix::wait_pipe (PUNICODE_STRING pipe_name) ret = 0; break; } +out: + evt = InterlockedExchangePointer (&cwt_termination_evt, NULL); + if (evt) + NtClose (evt); return ret; } @@ -965,6 +978,7 @@ fhandler_socket_unix::fixup_after_fork (HANDLE parent) InitializeSRWLock (&bind_lock); InitializeSRWLock (&io_lock); connect_wait_thr = NULL; + cwt_termination_evt = NULL; cwt_param = NULL; } @@ -1001,6 +1015,7 @@ fhandler_socket_unix::dup (fhandler_base *child, int flags) InitializeSRWLock (&fhs->bind_lock); InitializeSRWLock (&fhs->io_lock); fhs->connect_wait_thr = NULL; + fhs->cwt_termination_evt = NULL; fhs->cwt_param = NULL; return fhandler_socket::dup (child, flags); } @@ -1019,6 +1034,7 @@ DWORD fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) { HANDLE npfsh; + HANDLE evt; LONG error = 0; NTSTATUS status; IO_STATUS_BLOCK io; @@ -1033,6 +1049,8 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) error = geterrno_from_nt_status (status); goto out; } + if (!(evt = create_event ())) + goto out; pwbuf_size = offsetof (FILE_PIPE_WAIT_FOR_BUFFER, Name) + pipe_name->Length; pwbuf = (PFILE_PIPE_WAIT_FOR_BUFFER) alloca (pwbuf_size); pwbuf->Timeout.QuadPart = -20 * NS100PERSEC; /* 20 secs */ @@ -1042,8 +1060,22 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) stamp = ntod.nsecs (); do { - status = NtFsControlFile (npfsh, NULL, NULL, NULL, &io, FSCTL_PIPE_WAIT, + status = NtFsControlFile (npfsh, evt, NULL, NULL, &io, FSCTL_PIPE_WAIT, pwbuf, pwbuf_size, NULL, 0); + if (status == STATUS_PENDING) + { + HANDLE w[2] = { evt, cwt_termination_evt }; + switch (WaitForMultipleObjects (2, w, FALSE, INFINITE)) + { + case WAIT_OBJECT_0: + status = io.Status; + break; + case WAIT_OBJECT_0 + 1: + default: + status = STATUS_THREAD_IS_TERMINATING; + break; + } + } switch (status) { case STATUS_SUCCESS: @@ -1074,6 +1106,9 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) case STATUS_INSUFFICIENT_RESOURCES: error = ENOBUFS; break; + case STATUS_THREAD_IS_TERMINATING: + error = EINTR; + break; case STATUS_INVALID_DEVICE_REQUEST: default: error = EIO; @@ -1434,12 +1469,17 @@ fhandler_socket_unix::shutdown (int how) int fhandler_socket_unix::close () { + HANDLE evt = InterlockedExchangePointer (&cwt_termination_evt, NULL); HANDLE thr = InterlockedExchangePointer (&connect_wait_thr, NULL); if (thr) { - TerminateThread (thr, 0); + if (evt) + SetEvent (evt); + WaitForSingleObject (thr, INFINITE); CloseHandle (thr); } + if (evt) + NtClose (evt); PVOID param = InterlockedExchangePointer (&cwt_param, NULL); if (param) cfree (param); From 855e5d7e144ac1e302087cf08c37eec13c62f75a Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 16:23:44 +0100 Subject: [PATCH 338/649] Cygwin: AF_UNIX: fix accept behaviour * Use correct cygwait/WFSO invocation to not die on cancel and signals uncontrolled. * Manage io handles under io_lock. * Copy peer address to user space under SEH to avoid a resource leak. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 52 +++++++++++++++++++-------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index dcd493856..6eca66800 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -901,6 +901,7 @@ fhandler_socket_unix::listen_pipe () NTSTATUS status; IO_STATUS_BLOCK io; HANDLE evt = NULL; + DWORD waitret = WAIT_OBJECT_0; io.Status = STATUS_PENDING; if (!is_nonblocking () && !(evt = create_event ())) @@ -909,12 +910,18 @@ fhandler_socket_unix::listen_pipe () FSCTL_PIPE_LISTEN, NULL, 0, NULL, 0); if (status == STATUS_PENDING) { - if (cygwait (evt ?: get_handle ()) == WAIT_OBJECT_0) + waitret = cygwait (evt ?: get_handle (), cw_infinite, + cw_cancel | cw_sig_eintr); + if (waitret == WAIT_OBJECT_0) status = io.Status; } if (evt) NtClose (evt); - if (status == STATUS_PIPE_LISTENING) + if (waitret == WAIT_CANCELED) + pthread::static_cancel_self (); + else if (waitret == WAIT_SIGNALED) + set_errno (EINTR); + else if (status == STATUS_PIPE_LISTENING) set_errno (EAGAIN); else if (status != STATUS_PIPE_CONNECTED) __seterrno_from_nt_status (status); @@ -929,7 +936,9 @@ fhandler_socket_unix::disconnect_pipe (HANDLE ph) status = NtFsControlFile (ph, NULL, NULL, NULL, &io, FSCTL_PIPE_DISCONNECT, NULL, 0, NULL, 0); - if (status == STATUS_PENDING && cygwait (ph) == WAIT_OBJECT_0) + /* Short-lived. Don't use cygwait. We don't want to be interrupted. */ + if (status == STATUS_PENDING + && WaitForSingleObject (ph, INFINITE) == WAIT_OBJECT_0) status = io.Status; if (!NT_SUCCESS (status)) { @@ -1290,13 +1299,17 @@ fhandler_socket_unix::accept4 (struct sockaddr *peer, int *len, int flags) /* Our handle is now connected with a client. This handle is used for the accepted socket. Our handle has to be replaced with a new instance handle for the next accept. */ + AcquireSRWLockExclusive (&io_lock); HANDLE accepted = get_handle (); HANDLE new_inst = create_pipe_instance (); int error = ENOBUFS; - if (new_inst) + if (!new_inst) + ReleaseSRWLockExclusive (&io_lock); + else { /* Set new io handle. */ set_io_handle (new_inst); + ReleaseSRWLockExclusive (&io_lock); /* Prepare new file descriptor. */ cygheap_fdnew fd; @@ -1323,21 +1336,30 @@ fhandler_socket_unix::accept4 (struct sockaddr *peer, int *len, int flags) error = sock->recv_peer_name (); if (error == 0) { - if (peer) + __try { - sun_name_t *sun = sock->get_peer_sun_path (); - if (sun) + if (peer) { - memcpy (peer, &sun->un, MIN (*len, sun->un_len)); - *len = sun->un_len; + sun_name_t *sun = sock->get_peer_sun_path (); + if (sun) + { + memcpy (peer, &sun->un, + MIN (*len, sun->un_len)); + *len = sun->un_len; + } + else if (len) + *len = 0; } - else if (len) - *len = 0; + fd = sock; + if (fd <= 2) + set_std_handle (fd); + return fd; } - fd = sock; - if (fd <= 2) - set_std_handle (fd); - return fd; + __except (NO_ERROR) + { + error = EFAULT; + } + __endtry } delete sock; } From d7f7d292d83e2a3cd41d8da66d5abe0951b331b0 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 21:52:29 +0100 Subject: [PATCH 339/649] Cygwin: reorder read/write calls in fhandler_socket_unix Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 13f406821..7d45aa084 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -922,18 +922,19 @@ class fhandler_socket_unix : public fhandler_socket int shutdown (int how); int close (); int getpeereid (pid_t *pid, uid_t *euid, gid_t *egid); + ssize_t recvmsg (struct msghdr *msg, int flags); ssize_t recvfrom (void *ptr, size_t len, int flags, struct sockaddr *from, int *fromlen); - ssize_t recvmsg (struct msghdr *msg, int flags); void __reg3 read (void *ptr, size_t& len); - ssize_t __stdcall readv (const struct iovec *, int iovcnt, + ssize_t __stdcall readv (const struct iovec *const iov, int iovcnt, ssize_t tot = -1); + ssize_t sendmsg (const struct msghdr *msg, int flags); ssize_t sendto (const void *ptr, size_t len, int flags, const struct sockaddr *to, int tolen); - ssize_t sendmsg (const struct msghdr *msg, int flags); ssize_t __stdcall write (const void *ptr, size_t len); - ssize_t __stdcall writev (const struct iovec *, int iovcnt, ssize_t tot = -1); + ssize_t __stdcall writev (const struct iovec *const iov, int iovcnt, + ssize_t tot = -1); int setsockopt (int level, int optname, const void *optval, __socklen_t optlen); int getsockopt (int level, int optname, const void *optval, From 5bb4cc1e6cfba2d3246bd72c419e89c54b15ad56 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 21:53:56 +0100 Subject: [PATCH 340/649] Cygwin: AF_UNIX: Implement read, readv, recvfrom, write, writev, sendto All of these functions just call recvfrom/sendmsg which are still TODO Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 112 +++++++++++++++++++++----- 1 file changed, 90 insertions(+), 22 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 6eca66800..d27cdad73 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -1545,18 +1545,33 @@ fhandler_socket_unix::getpeereid (pid_t *pid, uid_t *euid, gid_t *egid) } ssize_t -fhandler_socket_unix::recvfrom (void *ptr, size_t len, int flags, - struct sockaddr *from, int *fromlen) +fhandler_socket_unix::recvmsg (struct msghdr *msg, int flags) { set_errno (EAFNOSUPPORT); return -1; } ssize_t -fhandler_socket_unix::recvmsg (struct msghdr *msg, int flags) +fhandler_socket_unix::recvfrom (void *ptr, size_t len, int flags, + struct sockaddr *from, int *fromlen) { - set_errno (EAFNOSUPPORT); - return -1; + struct iovec iov; + struct msghdr msg; + ssize_t ret; + + iov.iov_base = ptr; + iov.iov_len = len; + msg.msg_name = from; + msg.msg_namelen = from && fromlen ? *fromlen : 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + ret = recvmsg (&msg, flags); + if (ret >= 0 && from && fromlen) + *fromlen = msg.msg_namelen; + return ret; } void __reg3 @@ -1564,21 +1579,35 @@ fhandler_socket_unix::read (void *ptr, size_t& len) { set_errno (EAFNOSUPPORT); len = 0; + struct iovec iov; + struct msghdr msg; + + iov.iov_base = ptr; + iov.iov_len = len; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + len = recvmsg (&msg, 0); } ssize_t __stdcall -fhandler_socket_unix::readv (const struct iovec *, int iovcnt, ssize_t tot) +fhandler_socket_unix::readv (const struct iovec *const iov, int iovcnt, + ssize_t tot) { - set_errno (EAFNOSUPPORT); - return -1; -} + struct msghdr msg; -ssize_t -fhandler_socket_unix::sendto (const void *in_ptr, size_t len, int flags, - const struct sockaddr *to, int tolen) -{ - set_errno (EAFNOSUPPORT); - return -1; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = (struct iovec *) iov; + msg.msg_iovlen = iovcnt; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + return recvmsg (&msg, 0); } ssize_t @@ -1588,18 +1617,57 @@ fhandler_socket_unix::sendmsg (const struct msghdr *msg, int flags) return -1; } -ssize_t __stdcall -fhandler_socket_unix::write (const void *ptr, size_t len) +ssize_t +fhandler_socket_unix::sendto (const void *in_ptr, size_t len, int flags, + const struct sockaddr *to, int tolen) { - set_errno (EAFNOSUPPORT); - return -1; + struct iovec iov; + struct msghdr msg; + + iov.iov_base = (void *) in_ptr; + iov.iov_len = len; + msg.msg_name = (void *) to; + msg.msg_namelen = to ? tolen : 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + return sendmsg (&msg, flags); } ssize_t __stdcall -fhandler_socket_unix::writev (const struct iovec *, int iovcnt, ssize_t tot) +fhandler_socket_unix::write (const void *ptr, size_t len) { - set_errno (EAFNOSUPPORT); - return -1; + struct iovec iov; + struct msghdr msg; + + iov.iov_base = (void *) ptr; + iov.iov_len = len; + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = &iov; + msg.msg_iovlen = 1; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + return sendmsg (&msg, 0); +} + +ssize_t __stdcall +fhandler_socket_unix::writev (const struct iovec *const iov, int iovcnt, + ssize_t tot) +{ + struct msghdr msg; + + msg.msg_name = NULL; + msg.msg_namelen = 0; + msg.msg_iov = (struct iovec *) iov; + msg.msg_iovlen = iovcnt; + msg.msg_control = NULL; + msg.msg_controllen = 0; + msg.msg_flags = 0; + return sendmsg (&msg, 0); } int From 2f48ddb1ca45055eaeaa61af766653251b575a72 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 21:54:46 +0100 Subject: [PATCH 341/649] Cygwin: Define FSCTL_PIPE_FLUSH This fsctl might come in handy at one point... Signed-off-by: Corinna Vinschen --- winsup/cygwin/ntdll.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h index b251055f6..64babefc3 100644 --- a/winsup/cygwin/ntdll.h +++ b/winsup/cygwin/ntdll.h @@ -157,6 +157,7 @@ extern GUID __cygwin_socket_guid; #define FILE_VC_VALID_MASK 0x000003ff /* IOCTL code to impersonate client of named pipe. */ + #define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, \ METHOD_BUFFERED, FILE_ANY_ACCESS) #define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, \ @@ -165,6 +166,8 @@ extern GUID __cygwin_socket_guid; METHOD_BUFFERED, FILE_ANY_ACCESS) #define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \ METHOD_BUFFERED, FILE_ANY_ACCESS) +#define FSCTL_PIPE_FLUSH CTL_CODE(FILE_DEVICE_NAMED_PIPE, 16, \ + METHOD_BUFFERED, FILE_WRITE_DATA) typedef enum _FILE_INFORMATION_CLASS { From 483cbf89549545051717d3afabadf31c9c70c2f5 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 21:55:34 +0100 Subject: [PATCH 342/649] Cygwin: AF_UNIX: define AF_UNIX_CONNECT_TIMEOUT Use macro AF_UNIX_CONNECT_TIMEOUT instead of numerical constant for connect timeout. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index d27cdad73..afd57fc42 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -154,6 +154,9 @@ GUID __cygwin_socket_guid = { _s == STATUS_BUFFER_OVERFLOW \ || _s == STATUS_MORE_PROCESSING_REQUIRED; }) +/* Default timeout value of connect: 20 secs, as on Linux. */ +#define AF_UNIX_CONNECT_TIMEOUT (-20 * NS100PERSEC) + sun_name_t::sun_name_t () { un_len = sizeof (sa_family_t); @@ -619,7 +622,7 @@ fhandler_socket_unix::recv_peer_name () DWORD ret; LARGE_INTEGER timeout; - timeout.QuadPart = -20 * NS100PERSEC; /* 20 secs */ + timeout.QuadPart = AF_UNIX_CONNECT_TIMEOUT; ret = cygwait (evt, &timeout, cw_sig_eintr); switch (ret) { @@ -1062,7 +1065,7 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) goto out; pwbuf_size = offsetof (FILE_PIPE_WAIT_FOR_BUFFER, Name) + pipe_name->Length; pwbuf = (PFILE_PIPE_WAIT_FOR_BUFFER) alloca (pwbuf_size); - pwbuf->Timeout.QuadPart = -20 * NS100PERSEC; /* 20 secs */ + pwbuf->Timeout.QuadPart = AF_UNIX_CONNECT_TIMEOUT; pwbuf->NameLength = pipe_name->Length; pwbuf->TimeoutSpecified = TRUE; memcpy (pwbuf->Name, pipe_name->Buffer, pipe_name->Length); From 7d525c171f79243de864d7a736d1cf85209b62db Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Wed, 7 Mar 2018 21:56:42 +0100 Subject: [PATCH 343/649] Cygwin: AF_UNIX: implement getsockopt SO_RCVBUF/SO_SNDBUF Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index afd57fc42..388fbdf57 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -1780,6 +1780,16 @@ fhandler_socket_unix::getsockopt (int level, int optname, const void *optval, break; } + case SO_RCVBUF: + case SO_SNDBUF: + if (*optlen < (socklen_t) sizeof (int)) + { + set_errno (EINVAL); + return -1; + } + *(int *) optval = (optname == SO_RCVBUF) ? rmem () : wmem (); + break; + case SO_RCVTIMEO: case SO_SNDTIMEO: { From e4c65b2e918107287845ab345bc0607bde0323f7 Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Thu, 8 Mar 2018 00:29:25 +0100 Subject: [PATCH 344/649] describe new locale modifier @cjkwide for user guide --- winsup/doc/setup-locale.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/winsup/doc/setup-locale.xml b/winsup/doc/setup-locale.xml index 29502a23f..4872ae202 100644 --- a/winsup/doc/setup-locale.xml +++ b/winsup/doc/setup-locale.xml @@ -166,6 +166,19 @@ can be used to force wcwidth/wcswidth to return 1 for the ambiguous width characters. + +For the same class of "CJK Ambiguous Width" characters, it may be +desirable to handle them as double-width even when a non-CJK language +setting is selected. This supports e.g. certain graphic symbols used +by "Powerline" and provided by "Powerline fonts". Some terminals have +options to enforce this width handling (xterm -cjk_width, +mintty -o Charwidth=ambig-wide, putty configuration) but that alone +makes character rendering and locale information inconsistent for those +characters. The locale modifier "@cjkwide" supports consistent locale +response with this option; it forces wcwidth/wcswidth to return 2 for the +ambiguous width characters. + + From f4a1a186f9f3550b930738d0472bff97728f39e6 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 9 Mar 2018 14:17:39 +0100 Subject: [PATCH 345/649] Cygwin: fix socketpair prototype Last parameter is a vector of 2 ints, not a pointer to int Signed-off-by: Corinna Vinschen --- winsup/cygwin/include/sys/socket.h | 2 +- winsup/cygwin/net.cc | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/winsup/cygwin/include/sys/socket.h b/winsup/cygwin/include/sys/socket.h index e6b92eef8..4b61cb0ef 100644 --- a/winsup/cygwin/include/sys/socket.h +++ b/winsup/cygwin/include/sys/socket.h @@ -40,7 +40,7 @@ extern "C" int shutdown (int, int); int socket (int __family, int __type, int __protocol); int sockatmark (int __fd); - int socketpair (int __domain, int __type, int __protocol, int *__socket_vec); + int socketpair (int __domain, int __type, int __protocol, int __fds[2]); struct servent *getservbyname (const char *__name, const char *__proto); #endif diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc index 38a53f815..67cd96755 100644 --- a/winsup/cygwin/net.cc +++ b/winsup/cygwin/net.cc @@ -2271,7 +2271,7 @@ cygwin_bindresvport (int fd, struct sockaddr_in *sin) /* socketpair: POSIX.1-2001, POSIX.1-2008, 4.4BSD. */ extern "C" int -socketpair (int af, int type, int protocol, int *sb) +socketpair (int af, int type, int protocol, int sv[2]) { int res = -1; const device *dev; @@ -2324,8 +2324,8 @@ socketpair (int af, int type, int protocol, int *sb) set_std_handle (fd_out); __try { - sb[0] = fd_in; - sb[1] = fd_out; + sv[0] = fd_in; + sv[1] = fd_out; res = 0; } __except (EFAULT) {} From b194d65615462d5dc84030059e22de33c61a7a02 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 9 Mar 2018 14:19:36 +0100 Subject: [PATCH 346/649] Cygwin: AF_UNIX: Implemant socketpair Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 4 +- winsup/cygwin/fhandler_socket_unix.cc | 84 +++++++++++++++++++++------ 2 files changed, 67 insertions(+), 21 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 7d45aa084..5ceedd9ff 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -882,9 +882,9 @@ class fhandler_socket_unix : public fhandler_socket int send_my_name (); int recv_peer_name (); static NTSTATUS npfs_handle (HANDLE &nph); - HANDLE create_pipe (); + HANDLE create_pipe (bool single_instance); HANDLE create_pipe_instance (); - NTSTATUS open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name); + NTSTATUS open_pipe (PUNICODE_STRING pipe_name, bool send_name); int wait_pipe (PUNICODE_STRING pipe_name); int connect_pipe (PUNICODE_STRING pipe_name); int listen_pipe (); diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 388fbdf57..f3f3fba99 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -679,7 +679,7 @@ fhandler_socket_unix::npfs_handle (HANDLE &nph) } HANDLE -fhandler_socket_unix::create_pipe () +fhandler_socket_unix::create_pipe (bool single_instance) { NTSTATUS status; HANDLE npfsh; @@ -707,7 +707,7 @@ fhandler_socket_unix::create_pipe () npfsh, NULL); nonblocking = is_nonblocking () ? FILE_PIPE_COMPLETE_OPERATION : FILE_PIPE_QUEUE_OPERATION; - max_instances = (get_socket_type () == SOCK_DGRAM) ? 1 : -1; + max_instances = single_instance ? 1 : -1; timeout.QuadPart = -500000; status = NtCreateNamedPipeFile (&ph, access, &attr, &io, sharing, FILE_CREATE, 0, @@ -763,7 +763,7 @@ fhandler_socket_unix::create_pipe_instance () } NTSTATUS -fhandler_socket_unix::open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name) +fhandler_socket_unix::open_pipe (PUNICODE_STRING pipe_name, bool send_name) { NTSTATUS status; HANDLE npfsh; @@ -771,6 +771,7 @@ fhandler_socket_unix::open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name) OBJECT_ATTRIBUTES attr; IO_STATUS_BLOCK io; ULONG sharing; + HANDLE ph = NULL; status = npfs_handle (npfsh); if (!NT_SUCCESS (status)) @@ -782,7 +783,8 @@ fhandler_socket_unix::open_pipe (HANDLE &ph, PUNICODE_STRING pipe_name) if (NT_SUCCESS (status)) { set_io_handle (ph); - send_my_name (); + if (send_name) + send_my_name (); } return status; } @@ -881,11 +883,10 @@ int fhandler_socket_unix::connect_pipe (PUNICODE_STRING pipe_name) { NTSTATUS status; - HANDLE ph = NULL; /* Try connecting first. If it doesn't work, wait for the pipe to become available. */ - status = open_pipe (ph, pipe_name); + status = open_pipe (pipe_name, get_socket_type () != SOCK_DGRAM); if (STATUS_PIPE_NO_INSTANCE_AVAILABLE (status)) return wait_pipe (pipe_name); if (!NT_SUCCESS (status)) @@ -1053,7 +1054,6 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) ULONG pwbuf_size; PFILE_PIPE_WAIT_FOR_BUFFER pwbuf; LONGLONG stamp; - HANDLE ph = NULL; status = npfs_handle (npfsh); if (!NT_SUCCESS (status)) @@ -1092,7 +1092,7 @@ fhandler_socket_unix::wait_pipe_thread (PUNICODE_STRING pipe_name) { case STATUS_SUCCESS: { - status = open_pipe (ph, pipe_name); + status = open_pipe (pipe_name, get_socket_type () != SOCK_DGRAM); if (STATUS_PIPE_NO_INSTANCE_AVAILABLE (status)) { /* Another concurrent connect grabbed the pipe instance @@ -1170,6 +1170,10 @@ int fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, fhandler_socket *fh_out) { + HANDLE pipe; + sun_name_t sun; + fhandler_socket_unix *fh = (fhandler_socket_unix *) fh_out; + if (type != SOCK_STREAM && type != SOCK_DGRAM) { set_errno (EINVAL); @@ -1180,8 +1184,53 @@ fhandler_socket_unix::socketpair (int af, int type, int protocol, int flags, set_errno (EPROTONOSUPPORT); return -1; } - set_errno (EAFNOSUPPORT); - return -1; + + /* socket() on both sockets */ + rmem (262144); + fh->rmem (262144); + wmem (262144); + fh->wmem (262144); + set_addr_family (af); + fh->set_addr_family (af); + set_socket_type (type); + fh->set_socket_type (type); + set_unique_id (); + set_ino (get_unique_id ()); + /* bind/listen 1st socket */ + gen_pipe_name (); + pipe = create_pipe (true); + if (!pipe) + return -1; + set_io_handle (pipe); + backing_file_handle = autobind (&sun); + if (!backing_file_handle) + { + NtClose (pipe); + return -1; + } + set_sun_path (&sun); + fh->set_peer_sun_path (&sun); + binding_state (bound); + connect_state (listener); + /* connect 2nd socket */ + if (type != SOCK_DGRAM + && fh->open_pipe (pc.get_nt_native_path (), false) < 0) + { + NtClose (pipe); + return -1; + } + fh->connect_state (connected); + if (flags & SOCK_NONBLOCK) + { + set_nonblocking (true); + fh->set_nonblocking (true); + } + if (flags & SOCK_CLOEXEC) + { + set_close_on_exec (true); + fh->set_close_on_exec (true); + } + return 0; } /* Bind creates the backing file, generates the pipe name and sets @@ -1217,7 +1266,7 @@ fhandler_socket_unix::bind (const struct sockaddr *name, int namelen) gen_pipe_name (); if (get_socket_type () == SOCK_DGRAM) { - pipe = create_pipe (); + pipe = create_pipe (true); if (!pipe) { binding_state (unbound); @@ -1268,16 +1317,13 @@ fhandler_socket_unix::listen (int backlog) ReleaseSRWLockExclusive (&conn_lock); return -1; } - if (get_socket_type () != SOCK_DGRAM) + HANDLE pipe = create_pipe (false); + if (!pipe) { - HANDLE pipe = create_pipe (); - if (!pipe) - { - connect_state (unconnected); - return -1; - } - set_io_handle (pipe); + connect_state (unconnected); + return -1; } + set_io_handle (pipe); connect_state (listener); ReleaseSRWLockExclusive (&conn_lock); return 0; From 8b6804b8a8816be67843d694851331d97909998e Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Fri, 9 Mar 2018 21:13:28 +0100 Subject: [PATCH 347/649] Cygwin: don't skip O_TMPFILE files in readdir Bad idea. A file hidden from directory listings is not seen by rm either, so it never calls unlink for the file and a recursive removal of the parent directory fails with "directory not empty". Fix comments accordingly. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_disk_file.cc | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/winsup/cygwin/fhandler_disk_file.cc b/winsup/cygwin/fhandler_disk_file.cc index 66ebee8c6..fc87d91c1 100644 --- a/winsup/cygwin/fhandler_disk_file.cc +++ b/winsup/cygwin/fhandler_disk_file.cc @@ -1249,19 +1249,18 @@ fhandler_disk_file::link (const char *newpath) /* An O_TMPFILE file has FILE_ATTRIBUTE_TEMPORARY and FILE_ATTRIBUTE_HIDDEN set. After a successful hardlink the file is not temporary anymore in the usual sense. So we remove these - attributes here, even if this makes the original link (temporarily) - visible in directory enumeration. + attributes here. Note that we don't create a reopen attribute for the original link but rather a normal attribute for the just created link. - The reason is a curious behaviour of Windows: If we remove - the O_TMPFILE attributes on the original link, the new link - will not show up in file system listings, long after the original - link has been closed and removed. The file and its metadata will - be kept in memory only as long as Windows sees fit. By opening - the new link, we request the attribute changes on the new link, - so after closing it Windows will have an increased interest to - write back the metadata. */ + The reason is a curious behaviour of Windows: If we remove the + O_TMPFILE attributes on the original link, the new link will not + show up in file system listings (not even native ones from , e.g., + `cmd /c dir'), long after the original link has been closed and + removed. The file and its metadata will be kept in memory only + as long as Windows sees fit. By opening the new link, we request + the attribute changes on the new link, so after closing it Windows + will have an increased interest to write back the metadata. */ OBJECT_ATTRIBUTES attr; status = NtOpenFile (&fh, FILE_WRITE_ATTRIBUTES, newpc.get_object_attr (attr, sec_none_nih), &io, @@ -2107,7 +2106,6 @@ fhandler_disk_file::readdir (DIR *dir, dirent *de) /* d_cachepos always refers to the next cache entry to use. If it's 0 we must reload the cache. */ -restart: FileAttributes = 0; if (d_cachepos (dir) == 0) { @@ -2222,10 +2220,6 @@ go_ahead: FileAttributes = ((PFILE_BOTH_DIR_INFORMATION) buf)->FileAttributes; } - /* We don't show O_TMPFILE files in the filesystem. This is a kludge, - so we may end up removing this snippet again. */ - if ((FileAttributes & O_TMPFILE_FILE_ATTRS) == O_TMPFILE_FILE_ATTRS) - goto restart; RtlInitCountedUnicodeString (&fname, FileName, FileNameLength); d_mounts (dir)->check_mount (&fname); if (de->d_ino == 0 && (dir->__flags & dirent_set_d_ino)) From 1bb3d6518222fad8e8a40d9af431459b47d03554 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 10 Mar 2018 21:07:46 +0100 Subject: [PATCH 348/649] Cygwin: AF_UNIX: fix creating abstract socket symlink name Add missing NUL termination when creating symlink representing abstract socket. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index f3f3fba99..9ac9b2452 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -223,7 +223,8 @@ fhandler_socket_unix::create_abstract_link (const sun_name_t *sun, /* NUL bytes have no special meaning in an abstract socket name, so we assume iso-8859-1 for simplicity and transpose the string. transform_chars_af_unix is doing just that. */ - transform_chars_af_unix (p, sun->un.sun_path, sun->un_len); + p = transform_chars_af_unix (p, sun->un.sun_path, sun->un_len); + *p = L'\0'; RtlInitUnicodeString (&uname, name); InitializeObjectAttributes (&attr, &uname, OBJ_CASE_INSENSITIVE, get_shared_parent_dir (), NULL); From 7b1028974b529b22a20566c4fdf50440abefe725 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 10 Mar 2018 21:09:28 +0100 Subject: [PATCH 349/649] Cygwin: AF_UNIX: Add fixup_after_exec method Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler.h | 1 + winsup/cygwin/fhandler_socket_unix.cc | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/winsup/cygwin/fhandler.h b/winsup/cygwin/fhandler.h index 5ceedd9ff..2a3b3662d 100644 --- a/winsup/cygwin/fhandler.h +++ b/winsup/cygwin/fhandler.h @@ -900,6 +900,7 @@ class fhandler_socket_unix : public fhandler_socket : set_peer_sun_path (NULL, 0); } void set_cred (); void fixup_after_fork (HANDLE parent); + void fixup_after_exec (); void set_close_on_exec (bool val); public: diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 9ac9b2452..6e7d6f147 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -982,6 +982,8 @@ fhandler_socket_unix::set_cred () peer_cred.gid = (gid_t) -1; } +/* ========================== public methods ========================= */ + void fhandler_socket_unix::fixup_after_fork (HANDLE parent) { @@ -996,6 +998,13 @@ fhandler_socket_unix::fixup_after_fork (HANDLE parent) cwt_param = NULL; } +void +fhandler_socket_unix::fixup_after_exec () +{ + if (!close_on_exec ()) + fixup_after_fork (NULL); +} + void fhandler_socket_unix::set_close_on_exec (bool val) { @@ -1004,8 +1013,6 @@ fhandler_socket_unix::set_close_on_exec (bool val) set_no_inheritance (backing_file_handle, val); } -/* ========================== public methods ========================= */ - fhandler_socket_unix::fhandler_socket_unix () { set_cred (); From 4f1ee1a3e787009bbf1b13e163e92a7616418a04 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sat, 10 Mar 2018 21:12:27 +0100 Subject: [PATCH 350/649] Cygwin: AF_UNIX: fix dup Reorder so fhandler_socket::dup is called first. Add missing duplication of backing_file_handle. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 6e7d6f147..4f7d9e00e 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -1029,7 +1029,21 @@ fhandler_socket_unix::~fhandler_socket_unix () int fhandler_socket_unix::dup (fhandler_base *child, int flags) { + if (fhandler_socket::dup (child, flags)) + { + __seterrno (); + return -1; + } fhandler_socket_unix *fhs = (fhandler_socket_unix *) child; + if (backing_file_handle && backing_file_handle != INVALID_HANDLE_VALUE + && !DuplicateHandle (GetCurrentProcess (), backing_file_handle, + GetCurrentProcess (), &fhs->backing_file_handle, + 0, TRUE, DUPLICATE_SAME_ACCESS)) + { + __seterrno (); + fhs->close (); + return -1; + } fhs->set_sun_path (get_sun_path ()); fhs->set_peer_sun_path (get_peer_sun_path ()); InitializeSRWLock (&fhs->conn_lock); @@ -1038,7 +1052,7 @@ fhandler_socket_unix::dup (fhandler_base *child, int flags) fhs->connect_wait_thr = NULL; fhs->cwt_termination_evt = NULL; fhs->cwt_param = NULL; - return fhandler_socket::dup (child, flags); + return 0; } /* Waiter thread method. Here we wait for a pipe instance to become From de29476ed5ea1298389f20c8f3b1b57d887f0b27 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 11 Mar 2018 14:54:20 +0100 Subject: [PATCH 351/649] Cygwin: AF_UNIX: use get_unique_id to create pipe name It's the same as get_plain_ino in this case, but it's cleaner and easier to understand. Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index 4f7d9e00e..ec5611a44 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -204,7 +204,7 @@ fhandler_socket_unix::gen_pipe_name () __small_swprintf (pipe_name_buf, L"cygwin-%S-unix-%C-%016_X", &cygheap->installation_key, get_type_char (), - get_plain_ino ()); + get_unique_id ()); RtlInitUnicodeString (&pipe_name, pipe_name_buf); pc.set_nt_native_path (&pipe_name); } From 99796906abc9d0be0249fbb33bfefc8573d77852 Mon Sep 17 00:00:00 2001 From: Corinna Vinschen Date: Sun, 11 Mar 2018 14:56:02 +0100 Subject: [PATCH 352/649] Cygwin: AF_UNIX: fix up thread parameter block allocation * don't abort on failing allocation, just return with error * make sure the allocation is restricted to a single process Signed-off-by: Corinna Vinschen --- winsup/cygwin/fhandler_socket_unix.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/winsup/cygwin/fhandler_socket_unix.cc b/winsup/cygwin/fhandler_socket_unix.cc index ec5611a44..2fc70f122 100644 --- a/winsup/cygwin/fhandler_socket_unix.cc +++ b/winsup/cygwin/fhandler_socket_unix.cc @@ -818,9 +818,10 @@ fhandler_socket_unix::wait_pipe (PUNICODE_STRING pipe_name) PVOID param; if (!(cwt_termination_evt = create_event ())) - return -1; - wait_info = (conn_wait_info_t *) - cmalloc_abort (HEAP_FHANDLER, sizeof *wait_info); + return -1; + wait_info = (conn_wait_info_t *) cmalloc (HEAP_3_FHANDLER, sizeof *wait_info); + if (!wait_info) + return -1; wait_info->fh = this; RtlInitEmptyUnicodeString (&wait_info->pipe_name, wait_info->pipe_name_buf, sizeof wait_info->pipe_name_buf); From 71291047e291f43cccaec73069dff04c67aee6ab Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Sun, 25 Feb 2018 16:25:25 +0100 Subject: [PATCH 353/649] generated width data, Unicode 10.0 These tables provide character width properties for use by the wcwidth/wcswidth functions. They are generated from Unicode. --- newlib/libc/string/ambiguous.t | 61 +++++++++++++++++++ newlib/libc/string/combining.t | 107 +++++++++++++++++++++++++++++++++ newlib/libc/string/wide.t | 33 ++++++++++ 3 files changed, 201 insertions(+) create mode 100644 newlib/libc/string/ambiguous.t create mode 100644 newlib/libc/string/combining.t create mode 100644 newlib/libc/string/wide.t diff --git a/newlib/libc/string/ambiguous.t b/newlib/libc/string/ambiguous.t new file mode 100644 index 000000000..f8b78428e --- /dev/null +++ b/newlib/libc/string/ambiguous.t @@ -0,0 +1,61 @@ +{ + { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, + { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, + { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, + { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, + { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, + { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, + { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, + { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, + { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, + { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, + { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, + { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, + { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, + { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, + { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, + { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, + { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, + { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, + { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, + { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, + { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, + { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, + { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, + { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, + { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, + { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, + { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, + { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, + { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, + { 0x2189, 0x2189 }, { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, + { 0x21D2, 0x21D2 }, { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, + { 0x2200, 0x2200 }, { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, + { 0x220B, 0x220B }, { 0x220F, 0x220F }, { 0x2211, 0x2211 }, + { 0x2215, 0x2215 }, { 0x221A, 0x221A }, { 0x221D, 0x2220 }, + { 0x2223, 0x2223 }, { 0x2225, 0x2225 }, { 0x2227, 0x222C }, + { 0x222E, 0x222E }, { 0x2234, 0x2237 }, { 0x223C, 0x223D }, + { 0x2248, 0x2248 }, { 0x224C, 0x224C }, { 0x2252, 0x2252 }, + { 0x2260, 0x2261 }, { 0x2264, 0x2267 }, { 0x226A, 0x226B }, + { 0x226E, 0x226F }, { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, + { 0x2295, 0x2295 }, { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, + { 0x22BF, 0x22BF }, { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, + { 0x24EB, 0x254B }, { 0x2550, 0x2573 }, { 0x2580, 0x258F }, + { 0x2592, 0x2595 }, { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, + { 0x25B2, 0x25B3 }, { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, + { 0x25C0, 0x25C1 }, { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, + { 0x25CE, 0x25D1 }, { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, + { 0x2605, 0x2606 }, { 0x2609, 0x2609 }, { 0x260E, 0x260F }, + { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, + { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, + { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, + { 0x269E, 0x269F }, { 0x26BF, 0x26BF }, { 0x26C6, 0x26CD }, + { 0x26CF, 0x26D3 }, { 0x26D5, 0x26E1 }, { 0x26E3, 0x26E3 }, + { 0x26E8, 0x26E9 }, { 0x26EB, 0x26F1 }, { 0x26F4, 0x26F4 }, + { 0x26F6, 0x26F9 }, { 0x26FB, 0x26FC }, { 0x26FE, 0x26FF }, + { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0x2B56, 0x2B59 }, + { 0x3248, 0x324F }, { 0xE000, 0xF8FF }, { 0xFFFD, 0xFFFD }, + { 0x1F100, 0x1F10A }, { 0x1F110, 0x1F12D }, { 0x1F130, 0x1F169 }, + { 0x1F170, 0x1F18D }, { 0x1F18F, 0x1F190 }, { 0x1F19B, 0x1F1AC }, + { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } +}; diff --git a/newlib/libc/string/combining.t b/newlib/libc/string/combining.t new file mode 100644 index 000000000..629d8f891 --- /dev/null +++ b/newlib/libc/string/combining.t @@ -0,0 +1,107 @@ +{ + { 0x0300, 0x036F }, { 0x0483, 0x0489 }, { 0x0591, 0x05BD }, + { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, { 0x05C4, 0x05C5 }, + { 0x05C7, 0x05C7 }, { 0x0600, 0x0605 }, { 0x0610, 0x061A }, + { 0x061C, 0x061C }, { 0x064B, 0x065F }, { 0x0670, 0x0670 }, + { 0x06D6, 0x06DD }, { 0x06DF, 0x06E4 }, { 0x06E7, 0x06E8 }, + { 0x06EA, 0x06ED }, { 0x070F, 0x070F }, { 0x0711, 0x0711 }, + { 0x0730, 0x074A }, { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, + { 0x0816, 0x0819 }, { 0x081B, 0x0823 }, { 0x0825, 0x0827 }, + { 0x0829, 0x082D }, { 0x0859, 0x085B }, { 0x08D4, 0x0902 }, + { 0x093A, 0x093A }, { 0x093C, 0x093C }, { 0x0941, 0x0948 }, + { 0x094D, 0x094D }, { 0x0951, 0x0957 }, { 0x0962, 0x0963 }, + { 0x0981, 0x0981 }, { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, + { 0x09CD, 0x09CD }, { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, + { 0x0A3C, 0x0A3C }, { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, + { 0x0A4B, 0x0A4D }, { 0x0A51, 0x0A51 }, { 0x0A70, 0x0A71 }, + { 0x0A75, 0x0A75 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, + { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, + { 0x0AE2, 0x0AE3 }, { 0x0AFA, 0x0AFF }, { 0x0B01, 0x0B01 }, + { 0x0B3C, 0x0B3C }, { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B44 }, + { 0x0B4D, 0x0B4D }, { 0x0B56, 0x0B56 }, { 0x0B62, 0x0B63 }, + { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, { 0x0BCD, 0x0BCD }, + { 0x0C00, 0x0C00 }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, + { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0C62, 0x0C63 }, + { 0x0C81, 0x0C81 }, { 0x0CBC, 0x0CBC }, { 0x0CBF, 0x0CBF }, + { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, { 0x0CE2, 0x0CE3 }, + { 0x0D00, 0x0D01 }, { 0x0D3B, 0x0D3C }, { 0x0D41, 0x0D44 }, + { 0x0D4D, 0x0D4D }, { 0x0D62, 0x0D63 }, { 0x0DCA, 0x0DCA }, + { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, { 0x0E31, 0x0E31 }, + { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, { 0x0EB1, 0x0EB1 }, + { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, { 0x0EC8, 0x0ECD }, + { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, { 0x0F37, 0x0F37 }, + { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, { 0x0F80, 0x0F84 }, + { 0x0F86, 0x0F87 }, { 0x0F8D, 0x0F97 }, { 0x0F99, 0x0FBC }, + { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, { 0x1032, 0x1037 }, + { 0x1039, 0x103A }, { 0x103D, 0x103E }, { 0x1058, 0x1059 }, + { 0x105E, 0x1060 }, { 0x1071, 0x1074 }, { 0x1082, 0x1082 }, + { 0x1085, 0x1086 }, { 0x108D, 0x108D }, { 0x109D, 0x109D }, + { 0x1160, 0x11FF }, { 0x135D, 0x135F }, { 0x1712, 0x1714 }, + { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, { 0x1772, 0x1773 }, + { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, { 0x17C6, 0x17C6 }, + { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, { 0x180B, 0x180E }, + { 0x1885, 0x1886 }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, + { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, + { 0x1A17, 0x1A18 }, { 0x1A1B, 0x1A1B }, { 0x1A56, 0x1A56 }, + { 0x1A58, 0x1A5E }, { 0x1A60, 0x1A60 }, { 0x1A62, 0x1A62 }, + { 0x1A65, 0x1A6C }, { 0x1A73, 0x1A7C }, { 0x1A7F, 0x1A7F }, + { 0x1AB0, 0x1ABE }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, + { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, + { 0x1B6B, 0x1B73 }, { 0x1B80, 0x1B81 }, { 0x1BA2, 0x1BA5 }, + { 0x1BA8, 0x1BA9 }, { 0x1BAB, 0x1BAD }, { 0x1BE6, 0x1BE6 }, + { 0x1BE8, 0x1BE9 }, { 0x1BED, 0x1BED }, { 0x1BEF, 0x1BF1 }, + { 0x1C2C, 0x1C33 }, { 0x1C36, 0x1C37 }, { 0x1CD0, 0x1CD2 }, + { 0x1CD4, 0x1CE0 }, { 0x1CE2, 0x1CE8 }, { 0x1CED, 0x1CED }, + { 0x1CF4, 0x1CF4 }, { 0x1CF8, 0x1CF9 }, { 0x1DC0, 0x1DF9 }, + { 0x1DFB, 0x1DFF }, { 0x200B, 0x200F }, { 0x202A, 0x202E }, + { 0x2060, 0x2064 }, { 0x2066, 0x206F }, { 0x20D0, 0x20F0 }, + { 0x2CEF, 0x2CF1 }, { 0x2D7F, 0x2D7F }, { 0x2DE0, 0x2DFF }, + { 0x302A, 0x302D }, { 0x3099, 0x309A }, { 0xA66F, 0xA672 }, + { 0xA674, 0xA67D }, { 0xA69E, 0xA69F }, { 0xA6F0, 0xA6F1 }, + { 0xA802, 0xA802 }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, + { 0xA825, 0xA826 }, { 0xA8C4, 0xA8C5 }, { 0xA8E0, 0xA8F1 }, + { 0xA926, 0xA92D }, { 0xA947, 0xA951 }, { 0xA980, 0xA982 }, + { 0xA9B3, 0xA9B3 }, { 0xA9B6, 0xA9B9 }, { 0xA9BC, 0xA9BC }, + { 0xA9E5, 0xA9E5 }, { 0xAA29, 0xAA2E }, { 0xAA31, 0xAA32 }, + { 0xAA35, 0xAA36 }, { 0xAA43, 0xAA43 }, { 0xAA4C, 0xAA4C }, + { 0xAA7C, 0xAA7C }, { 0xAAB0, 0xAAB0 }, { 0xAAB2, 0xAAB4 }, + { 0xAAB7, 0xAAB8 }, { 0xAABE, 0xAABF }, { 0xAAC1, 0xAAC1 }, + { 0xAAEC, 0xAAED }, { 0xAAF6, 0xAAF6 }, { 0xABE5, 0xABE5 }, + { 0xABE8, 0xABE8 }, { 0xABED, 0xABED }, { 0xD7B0, 0xD7C6 }, + { 0xD7CB, 0xD7FB }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, + { 0xFE20, 0xFE2F }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, + { 0x101FD, 0x101FD }, { 0x102E0, 0x102E0 }, { 0x10376, 0x1037A }, + { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, + { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x10AE5, 0x10AE6 }, + { 0x11001, 0x11001 }, { 0x11038, 0x11046 }, { 0x1107F, 0x11081 }, + { 0x110B3, 0x110B6 }, { 0x110B9, 0x110BA }, { 0x110BD, 0x110BD }, + { 0x11100, 0x11102 }, { 0x11127, 0x1112B }, { 0x1112D, 0x11134 }, + { 0x11173, 0x11173 }, { 0x11180, 0x11181 }, { 0x111B6, 0x111BE }, + { 0x111CA, 0x111CC }, { 0x1122F, 0x11231 }, { 0x11234, 0x11234 }, + { 0x11236, 0x11237 }, { 0x1123E, 0x1123E }, { 0x112DF, 0x112DF }, + { 0x112E3, 0x112EA }, { 0x11300, 0x11301 }, { 0x1133C, 0x1133C }, + { 0x11340, 0x11340 }, { 0x11366, 0x1136C }, { 0x11370, 0x11374 }, + { 0x11438, 0x1143F }, { 0x11442, 0x11444 }, { 0x11446, 0x11446 }, + { 0x114B3, 0x114B8 }, { 0x114BA, 0x114BA }, { 0x114BF, 0x114C0 }, + { 0x114C2, 0x114C3 }, { 0x115B2, 0x115B5 }, { 0x115BC, 0x115BD }, + { 0x115BF, 0x115C0 }, { 0x115DC, 0x115DD }, { 0x11633, 0x1163A }, + { 0x1163D, 0x1163D }, { 0x1163F, 0x11640 }, { 0x116AB, 0x116AB }, + { 0x116AD, 0x116AD }, { 0x116B0, 0x116B5 }, { 0x116B7, 0x116B7 }, + { 0x1171D, 0x1171F }, { 0x11722, 0x11725 }, { 0x11727, 0x1172B }, + { 0x11A01, 0x11A06 }, { 0x11A09, 0x11A0A }, { 0x11A33, 0x11A38 }, + { 0x11A3B, 0x11A3E }, { 0x11A47, 0x11A47 }, { 0x11A51, 0x11A56 }, + { 0x11A59, 0x11A5B }, { 0x11A8A, 0x11A96 }, { 0x11A98, 0x11A99 }, + { 0x11C30, 0x11C36 }, { 0x11C38, 0x11C3D }, { 0x11C3F, 0x11C3F }, + { 0x11C92, 0x11CA7 }, { 0x11CAA, 0x11CB0 }, { 0x11CB2, 0x11CB3 }, + { 0x11CB5, 0x11CB6 }, { 0x11D31, 0x11D36 }, { 0x11D3A, 0x11D3A }, + { 0x11D3C, 0x11D3D }, { 0x11D3F, 0x11D45 }, { 0x11D47, 0x11D47 }, + { 0x16AF0, 0x16AF4 }, { 0x16B30, 0x16B36 }, { 0x16F8F, 0x16F92 }, + { 0x1BC9D, 0x1BC9E }, { 0x1BCA0, 0x1BCA3 }, { 0x1D167, 0x1D169 }, + { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, + { 0x1D242, 0x1D244 }, { 0x1DA00, 0x1DA36 }, { 0x1DA3B, 0x1DA6C }, + { 0x1DA75, 0x1DA75 }, { 0x1DA84, 0x1DA84 }, { 0x1DA9B, 0x1DA9F }, + { 0x1DAA1, 0x1DAAF }, { 0x1E000, 0x1E006 }, { 0x1E008, 0x1E018 }, + { 0x1E01B, 0x1E021 }, { 0x1E023, 0x1E024 }, { 0x1E026, 0x1E02A }, + { 0x1E8D0, 0x1E8D6 }, { 0x1E944, 0x1E94A }, { 0xE0001, 0xE0001 }, + { 0xE0020, 0xE007F }, { 0xE0100, 0xE01EF } +}; diff --git a/newlib/libc/string/wide.t b/newlib/libc/string/wide.t new file mode 100644 index 000000000..8d0e243d2 --- /dev/null +++ b/newlib/libc/string/wide.t @@ -0,0 +1,33 @@ +//# EastAsianWidth-10.0.0.txt +//# Blocks-10.0.0.txt +{ + { 0x1100, 0x115F }, { 0x231A, 0x231B }, { 0x2329, 0x232A }, + { 0x23E9, 0x23EC }, { 0x23F0, 0x23F0 }, { 0x23F3, 0x23F3 }, + { 0x25FD, 0x25FE }, { 0x2614, 0x2615 }, { 0x2648, 0x2653 }, + { 0x267F, 0x267F }, { 0x2693, 0x2693 }, { 0x26A1, 0x26A1 }, + { 0x26AA, 0x26AB }, { 0x26BD, 0x26BE }, { 0x26C4, 0x26C5 }, + { 0x26CE, 0x26CE }, { 0x26D4, 0x26D4 }, { 0x26EA, 0x26EA }, + { 0x26F2, 0x26F3 }, { 0x26F5, 0x26F5 }, { 0x26FA, 0x26FA }, + { 0x26FD, 0x26FD }, { 0x2705, 0x2705 }, { 0x270A, 0x270B }, + { 0x2728, 0x2728 }, { 0x274C, 0x274C }, { 0x274E, 0x274E }, + { 0x2753, 0x2755 }, { 0x2757, 0x2757 }, { 0x2795, 0x2797 }, + { 0x27B0, 0x27B0 }, { 0x27BF, 0x27BF }, { 0x2B1B, 0x2B1C }, + { 0x2B50, 0x2B50 }, { 0x2B55, 0x2B55 }, { 0x2E80, 0x303E }, + { 0x3040, 0x321E }, { 0x3220, 0x3247 }, { 0x3250, 0x32FE }, + { 0x3300, 0x4DBF }, { 0x4E00, 0xA4CF }, { 0xA960, 0xA97F }, + { 0xAC00, 0xD7AF }, { 0xF900, 0xFAFF }, { 0xFE10, 0xFE1F }, + { 0xFE30, 0xFE6F }, { 0xFF01, 0xFF60 }, { 0xFFE0, 0xFFE6 }, + { 0x16FE0, 0x18AFF }, { 0x1B000, 0x1B12F }, { 0x1B170, 0x1B2FF }, + { 0x1F004, 0x1F004 }, { 0x1F0CF, 0x1F0CF }, { 0x1F18E, 0x1F18E }, + { 0x1F191, 0x1F19A }, { 0x1F200, 0x1F320 }, { 0x1F32D, 0x1F335 }, + { 0x1F337, 0x1F37C }, { 0x1F37E, 0x1F393 }, { 0x1F3A0, 0x1F3CA }, + { 0x1F3CF, 0x1F3D3 }, { 0x1F3E0, 0x1F3F0 }, { 0x1F3F4, 0x1F3F4 }, + { 0x1F3F8, 0x1F43E }, { 0x1F440, 0x1F440 }, { 0x1F442, 0x1F4FC }, + { 0x1F4FF, 0x1F53D }, { 0x1F54B, 0x1F54E }, { 0x1F550, 0x1F567 }, + { 0x1F57A, 0x1F57A }, { 0x1F595, 0x1F596 }, { 0x1F5A4, 0x1F5A4 }, + { 0x1F5FB, 0x1F64F }, { 0x1F680, 0x1F6C5 }, { 0x1F6CC, 0x1F6CC }, + { 0x1F6D0, 0x1F6D2 }, { 0x1F6EB, 0x1F6EC }, { 0x1F6F4, 0x1F6F8 }, + { 0x1F910, 0x1F93E }, { 0x1F940, 0x1F94C }, { 0x1F950, 0x1F96B }, + { 0x1F980, 0x1F997 }, { 0x1F9C0, 0x1F9C0 }, { 0x1F9D0, 0x1F9E6 }, + { 0x20000, 0x2FFFD }, { 0x30000, 0x3FFFD } +}; From 8e8fd6c849472d7bfe3949c44880abfcca7aed48 Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Sun, 25 Feb 2018 16:25:49 +0100 Subject: [PATCH 354/649] use generated width data --- newlib/libc/string/wcwidth.c | 150 ++++++----------------------------- 1 file changed, 24 insertions(+), 126 deletions(-) diff --git a/newlib/libc/string/wcwidth.c b/newlib/libc/string/wcwidth.c index fc40afd21..62e76edc3 100644 --- a/newlib/libc/string/wcwidth.c +++ b/newlib/libc/string/wcwidth.c @@ -7,13 +7,14 @@ INDEX SYNOPSIS #include - int wcwidth(const wchar_t <[wc]>); + int wcwidth(const wint_t <[wc]>); DESCRIPTION The <> function shall determine the number of column positions required for the wide character <[wc]>. The application shall ensure that the value of <[wc]> is a character representable - as a wchar_t, and is a wide-character code corresponding to a + as a wint_t (combining Unicode surrogate pairs into single 21-bit + Unicode code points), and is a wide-character code corresponding to a valid character in the current locale. RETURNS @@ -166,114 +167,19 @@ int __wcwidth (const wint_t ucs) { #ifdef _MB_CAPABLE - /* sorted list of non-overlapping intervals of East Asian Ambiguous - * characters, generated by "uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c" */ - static const struct interval ambiguous[] = { - { 0x00A1, 0x00A1 }, { 0x00A4, 0x00A4 }, { 0x00A7, 0x00A8 }, - { 0x00AA, 0x00AA }, { 0x00AE, 0x00AE }, { 0x00B0, 0x00B4 }, - { 0x00B6, 0x00BA }, { 0x00BC, 0x00BF }, { 0x00C6, 0x00C6 }, - { 0x00D0, 0x00D0 }, { 0x00D7, 0x00D8 }, { 0x00DE, 0x00E1 }, - { 0x00E6, 0x00E6 }, { 0x00E8, 0x00EA }, { 0x00EC, 0x00ED }, - { 0x00F0, 0x00F0 }, { 0x00F2, 0x00F3 }, { 0x00F7, 0x00FA }, - { 0x00FC, 0x00FC }, { 0x00FE, 0x00FE }, { 0x0101, 0x0101 }, - { 0x0111, 0x0111 }, { 0x0113, 0x0113 }, { 0x011B, 0x011B }, - { 0x0126, 0x0127 }, { 0x012B, 0x012B }, { 0x0131, 0x0133 }, - { 0x0138, 0x0138 }, { 0x013F, 0x0142 }, { 0x0144, 0x0144 }, - { 0x0148, 0x014B }, { 0x014D, 0x014D }, { 0x0152, 0x0153 }, - { 0x0166, 0x0167 }, { 0x016B, 0x016B }, { 0x01CE, 0x01CE }, - { 0x01D0, 0x01D0 }, { 0x01D2, 0x01D2 }, { 0x01D4, 0x01D4 }, - { 0x01D6, 0x01D6 }, { 0x01D8, 0x01D8 }, { 0x01DA, 0x01DA }, - { 0x01DC, 0x01DC }, { 0x0251, 0x0251 }, { 0x0261, 0x0261 }, - { 0x02C4, 0x02C4 }, { 0x02C7, 0x02C7 }, { 0x02C9, 0x02CB }, - { 0x02CD, 0x02CD }, { 0x02D0, 0x02D0 }, { 0x02D8, 0x02DB }, - { 0x02DD, 0x02DD }, { 0x02DF, 0x02DF }, { 0x0391, 0x03A1 }, - { 0x03A3, 0x03A9 }, { 0x03B1, 0x03C1 }, { 0x03C3, 0x03C9 }, - { 0x0401, 0x0401 }, { 0x0410, 0x044F }, { 0x0451, 0x0451 }, - { 0x2010, 0x2010 }, { 0x2013, 0x2016 }, { 0x2018, 0x2019 }, - { 0x201C, 0x201D }, { 0x2020, 0x2022 }, { 0x2024, 0x2027 }, - { 0x2030, 0x2030 }, { 0x2032, 0x2033 }, { 0x2035, 0x2035 }, - { 0x203B, 0x203B }, { 0x203E, 0x203E }, { 0x2074, 0x2074 }, - { 0x207F, 0x207F }, { 0x2081, 0x2084 }, { 0x20AC, 0x20AC }, - { 0x2103, 0x2103 }, { 0x2105, 0x2105 }, { 0x2109, 0x2109 }, - { 0x2113, 0x2113 }, { 0x2116, 0x2116 }, { 0x2121, 0x2122 }, - { 0x2126, 0x2126 }, { 0x212B, 0x212B }, { 0x2153, 0x2154 }, - { 0x215B, 0x215E }, { 0x2160, 0x216B }, { 0x2170, 0x2179 }, - { 0x2190, 0x2199 }, { 0x21B8, 0x21B9 }, { 0x21D2, 0x21D2 }, - { 0x21D4, 0x21D4 }, { 0x21E7, 0x21E7 }, { 0x2200, 0x2200 }, - { 0x2202, 0x2203 }, { 0x2207, 0x2208 }, { 0x220B, 0x220B }, - { 0x220F, 0x220F }, { 0x2211, 0x2211 }, { 0x2215, 0x2215 }, - { 0x221A, 0x221A }, { 0x221D, 0x2220 }, { 0x2223, 0x2223 }, - { 0x2225, 0x2225 }, { 0x2227, 0x222C }, { 0x222E, 0x222E }, - { 0x2234, 0x2237 }, { 0x223C, 0x223D }, { 0x2248, 0x2248 }, - { 0x224C, 0x224C }, { 0x2252, 0x2252 }, { 0x2260, 0x2261 }, - { 0x2264, 0x2267 }, { 0x226A, 0x226B }, { 0x226E, 0x226F }, - { 0x2282, 0x2283 }, { 0x2286, 0x2287 }, { 0x2295, 0x2295 }, - { 0x2299, 0x2299 }, { 0x22A5, 0x22A5 }, { 0x22BF, 0x22BF }, - { 0x2312, 0x2312 }, { 0x2460, 0x24E9 }, { 0x24EB, 0x254B }, - { 0x2550, 0x2573 }, { 0x2580, 0x258F }, { 0x2592, 0x2595 }, - { 0x25A0, 0x25A1 }, { 0x25A3, 0x25A9 }, { 0x25B2, 0x25B3 }, - { 0x25B6, 0x25B7 }, { 0x25BC, 0x25BD }, { 0x25C0, 0x25C1 }, - { 0x25C6, 0x25C8 }, { 0x25CB, 0x25CB }, { 0x25CE, 0x25D1 }, - { 0x25E2, 0x25E5 }, { 0x25EF, 0x25EF }, { 0x2605, 0x2606 }, - { 0x2609, 0x2609 }, { 0x260E, 0x260F }, { 0x2614, 0x2615 }, - { 0x261C, 0x261C }, { 0x261E, 0x261E }, { 0x2640, 0x2640 }, - { 0x2642, 0x2642 }, { 0x2660, 0x2661 }, { 0x2663, 0x2665 }, - { 0x2667, 0x266A }, { 0x266C, 0x266D }, { 0x266F, 0x266F }, - { 0x273D, 0x273D }, { 0x2776, 0x277F }, { 0xE000, 0xF8FF }, - { 0xFFFD, 0xFFFD }, { 0xF0000, 0xFFFFD }, { 0x100000, 0x10FFFD } - }; + /* sorted list of non-overlapping intervals of East Asian Ambiguous chars */ + static const struct interval ambiguous[] = +#include "ambiguous.t" + /* sorted list of non-overlapping intervals of non-spacing characters */ - /* generated by "uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B c" */ - static const struct interval combining[] = { - { 0x0300, 0x036F }, { 0x0483, 0x0486 }, { 0x0488, 0x0489 }, - { 0x0591, 0x05BD }, { 0x05BF, 0x05BF }, { 0x05C1, 0x05C2 }, - { 0x05C4, 0x05C5 }, { 0x05C7, 0x05C7 }, { 0x0600, 0x0603 }, - { 0x0610, 0x0615 }, { 0x064B, 0x065E }, { 0x0670, 0x0670 }, - { 0x06D6, 0x06E4 }, { 0x06E7, 0x06E8 }, { 0x06EA, 0x06ED }, - { 0x070F, 0x070F }, { 0x0711, 0x0711 }, { 0x0730, 0x074A }, - { 0x07A6, 0x07B0 }, { 0x07EB, 0x07F3 }, { 0x0901, 0x0902 }, - { 0x093C, 0x093C }, { 0x0941, 0x0948 }, { 0x094D, 0x094D }, - { 0x0951, 0x0954 }, { 0x0962, 0x0963 }, { 0x0981, 0x0981 }, - { 0x09BC, 0x09BC }, { 0x09C1, 0x09C4 }, { 0x09CD, 0x09CD }, - { 0x09E2, 0x09E3 }, { 0x0A01, 0x0A02 }, { 0x0A3C, 0x0A3C }, - { 0x0A41, 0x0A42 }, { 0x0A47, 0x0A48 }, { 0x0A4B, 0x0A4D }, - { 0x0A70, 0x0A71 }, { 0x0A81, 0x0A82 }, { 0x0ABC, 0x0ABC }, - { 0x0AC1, 0x0AC5 }, { 0x0AC7, 0x0AC8 }, { 0x0ACD, 0x0ACD }, - { 0x0AE2, 0x0AE3 }, { 0x0B01, 0x0B01 }, { 0x0B3C, 0x0B3C }, - { 0x0B3F, 0x0B3F }, { 0x0B41, 0x0B43 }, { 0x0B4D, 0x0B4D }, - { 0x0B56, 0x0B56 }, { 0x0B82, 0x0B82 }, { 0x0BC0, 0x0BC0 }, - { 0x0BCD, 0x0BCD }, { 0x0C3E, 0x0C40 }, { 0x0C46, 0x0C48 }, - { 0x0C4A, 0x0C4D }, { 0x0C55, 0x0C56 }, { 0x0CBC, 0x0CBC }, - { 0x0CBF, 0x0CBF }, { 0x0CC6, 0x0CC6 }, { 0x0CCC, 0x0CCD }, - { 0x0CE2, 0x0CE3 }, { 0x0D41, 0x0D43 }, { 0x0D4D, 0x0D4D }, - { 0x0DCA, 0x0DCA }, { 0x0DD2, 0x0DD4 }, { 0x0DD6, 0x0DD6 }, - { 0x0E31, 0x0E31 }, { 0x0E34, 0x0E3A }, { 0x0E47, 0x0E4E }, - { 0x0EB1, 0x0EB1 }, { 0x0EB4, 0x0EB9 }, { 0x0EBB, 0x0EBC }, - { 0x0EC8, 0x0ECD }, { 0x0F18, 0x0F19 }, { 0x0F35, 0x0F35 }, - { 0x0F37, 0x0F37 }, { 0x0F39, 0x0F39 }, { 0x0F71, 0x0F7E }, - { 0x0F80, 0x0F84 }, { 0x0F86, 0x0F87 }, { 0x0F90, 0x0F97 }, - { 0x0F99, 0x0FBC }, { 0x0FC6, 0x0FC6 }, { 0x102D, 0x1030 }, - { 0x1032, 0x1032 }, { 0x1036, 0x1037 }, { 0x1039, 0x1039 }, - { 0x1058, 0x1059 }, { 0x1160, 0x11FF }, { 0x135F, 0x135F }, - { 0x1712, 0x1714 }, { 0x1732, 0x1734 }, { 0x1752, 0x1753 }, - { 0x1772, 0x1773 }, { 0x17B4, 0x17B5 }, { 0x17B7, 0x17BD }, - { 0x17C6, 0x17C6 }, { 0x17C9, 0x17D3 }, { 0x17DD, 0x17DD }, - { 0x180B, 0x180D }, { 0x18A9, 0x18A9 }, { 0x1920, 0x1922 }, - { 0x1927, 0x1928 }, { 0x1932, 0x1932 }, { 0x1939, 0x193B }, - { 0x1A17, 0x1A18 }, { 0x1B00, 0x1B03 }, { 0x1B34, 0x1B34 }, - { 0x1B36, 0x1B3A }, { 0x1B3C, 0x1B3C }, { 0x1B42, 0x1B42 }, - { 0x1B6B, 0x1B73 }, { 0x1DC0, 0x1DCA }, { 0x1DFE, 0x1DFF }, - { 0x200B, 0x200F }, { 0x202A, 0x202E }, { 0x2060, 0x2063 }, - { 0x206A, 0x206F }, { 0x20D0, 0x20EF }, { 0x302A, 0x302F }, - { 0x3099, 0x309A }, { 0xA806, 0xA806 }, { 0xA80B, 0xA80B }, - { 0xA825, 0xA826 }, { 0xFB1E, 0xFB1E }, { 0xFE00, 0xFE0F }, - { 0xFE20, 0xFE23 }, { 0xFEFF, 0xFEFF }, { 0xFFF9, 0xFFFB }, - { 0x10A01, 0x10A03 }, { 0x10A05, 0x10A06 }, { 0x10A0C, 0x10A0F }, - { 0x10A38, 0x10A3A }, { 0x10A3F, 0x10A3F }, { 0x1D167, 0x1D169 }, - { 0x1D173, 0x1D182 }, { 0x1D185, 0x1D18B }, { 0x1D1AA, 0x1D1AD }, - { 0x1D242, 0x1D244 }, { 0xE0001, 0xE0001 }, { 0xE0020, 0xE007F }, - { 0xE0100, 0xE01EF } - }; + static const struct interval combining[] = +#include "combining.t" + + /* sorted list of non-overlapping intervals of wide characters, + ranges extended to Blocks where possible + */ + static const struct interval wide[] = +#include "wide.t" /* Test for NUL character */ if (ucs == 0) @@ -304,20 +210,12 @@ __wcwidth (const wint_t ucs) /* if we arrive here, ucs is not a combining or C0/C1 control character */ - return 1 + - (ucs >= 0x1100 && - (ucs <= 0x115f || /* Hangul Jamo init. consonants */ - ucs == 0x2329 || ucs == 0x232a || - (ucs >= 0x2e80 && ucs <= 0xa4cf && - ucs != 0x303f) || /* CJK ... Yi */ - (ucs >= 0xac00 && ucs <= 0xd7a3) || /* Hangul Syllables */ - (ucs >= 0xf900 && ucs <= 0xfaff) || /* CJK Compatibility Ideographs */ - (ucs >= 0xfe10 && ucs <= 0xfe19) || /* Vertical forms */ - (ucs >= 0xfe30 && ucs <= 0xfe6f) || /* CJK Compatibility Forms */ - (ucs >= 0xff00 && ucs <= 0xff60) || /* Fullwidth Forms */ - (ucs >= 0xffe0 && ucs <= 0xffe6) || - (ucs >= 0x20000 && ucs <= 0x2fffd) || - (ucs >= 0x30000 && ucs <= 0x3fffd))); + /* binary search in table of wide character codes */ + if (bisearch(ucs, wide, + sizeof(wide) / sizeof(struct interval) - 1)) + return 2; + else + return 1; #else /* !_MB_CAPABLE */ if (iswprint (ucs)) return 1; @@ -327,9 +225,9 @@ __wcwidth (const wint_t ucs) #endif /* _MB_CAPABLE */ } -int -wcwidth (const wchar_t wc) -{ +int +wcwidth (const wint_t wc) +{ wint_t wi = wc; #ifdef _MB_CAPABLE From 37132125bcda103dd723f0cb4226c190ffbc9966 Mon Sep 17 00:00:00 2001 From: Thomas Wolff Date: Wed, 7 Mar 2018 23:55:52 +0100 Subject: [PATCH 355/649] width data generation --- newlib/libc/string/WIDTH-A | 569 ++++++++++++++++++++++++++++ newlib/libc/string/mkunidata | 54 +++ newlib/libc/string/mkwide | 49 +++ newlib/libc/string/mkwidthA | 20 + newlib/libc/string/uniset | 696 +++++++++++++++++++++++++++++++++++ 5 files changed, 1388 insertions(+) create mode 100644 newlib/libc/string/WIDTH-A create mode 100755 newlib/libc/string/mkunidata create mode 100755 newlib/libc/string/mkwide create mode 100755 newlib/libc/string/mkwidthA create mode 100755 newlib/libc/string/uniset diff --git a/newlib/libc/string/WIDTH-A b/newlib/libc/string/WIDTH-A new file mode 100644 index 000000000..51e8f2339 --- /dev/null +++ b/newlib/libc/string/WIDTH-A @@ -0,0 +1,569 @@ +# UAX #11: East Asian Ambiguous + +# Plane 00 +# Rows Positions (Cells) + + 00 A1 A4 A7-A8 AA AD-AE B0-B4 B6-BA BC-BF C6 D0 D7-D8 DE-E1 E6 E8-EA + 00 EC-ED F0 F2-F3 F7-FA FC FE + 01 01 11 13 1B 26-27 2B 31-33 38 3F-42 44 48-4B 4D 52-53 66-67 6B + 01 CE D0 D2 D4 D6 D8 DA DC + 02 51 61 C4 C7 C9-CB CD D0 D8-DB DD DF + 03 00-6F 91-A1 A3-A9 B1-C1 C3-C9 + 04 01 10-4F 51 + 20 10 13-16 18-19 1C-1D 20-22 24-27 30 32-33 35 3B 3E 74 7F 81-84 + 20 AC + 21 03 05 09 13 16 21-22 26 2B 53-54 5B-5E 60-6B 70-79 89 90-99 B8-B9 + 21 D2 D4 E7 + 22 00 02-03 07-08 0B 0F 11 15 1A 1D-20 23 25 27-2C 2E 34-37 3C-3D + 22 48 4C 52 60-61 64-67 6A-6B 6E-6F 82-83 86-87 95 99 A5 BF + 23 12 + 24 60-E9 EB-FF + 25 00-4B 50-73 80-8F 92-95 A0-A1 A3-A9 B2-B3 B6-B7 BC-BD C0-C1 C6-C8 + 25 CB CE-D1 E2-E5 EF + 26 05-06 09 0E-0F 1C 1E 40 42 60-61 63-65 67-6A 6C-6D 6F 9E-9F BF + 26 C6-CD CF-D3 D5-E1 E3 E8-E9 EB-F1 F4 F6-F9 FB-FC FE-FF + 27 3D 76-7F + 2B 56-59 + 32 48-4F + E0 00-FF + E1 00-FF + E2 00-FF + E3 00-FF + E4 00-FF + E5 00-FF + E6 00-FF + E7 00-FF + E8 00-FF + E9 00-FF + EA 00-FF + EB 00-FF + EC 00-FF + ED 00-FF + EE 00-FF + EF 00-FF + F0 00-FF + F1 00-FF + F2 00-FF + F3 00-FF + F4 00-FF + F5 00-FF + F6 00-FF + F7 00-FF + F8 00-FF + FE 00-0F + FF FD + 1F1 00-0A 10-2D 30-69 70-8D 8F-90 9B-AC + E01 00-EF + F00 00-FF + F01 00-FF + F02 00-FF + F03 00-FF + F04 00-FF + F05 00-FF + F06 00-FF + F07 00-FF + F08 00-FF + F09 00-FF + F0A 00-FF + F0B 00-FF + F0C 00-FF + F0D 00-FF + F0E 00-FF + F0F 00-FF + F10 00-FF + F11 00-FF + F12 00-FF + F13 00-FF + F14 00-FF + F15 00-FF + F16 00-FF + F17 00-FF + F18 00-FF + F19 00-FF + F1A 00-FF + F1B 00-FF + F1C 00-FF + F1D 00-FF + F1E 00-FF + F1F 00-FF + F20 00-FF + F21 00-FF + F22 00-FF + F23 00-FF + F24 00-FF + F25 00-FF + F26 00-FF + F27 00-FF + F28 00-FF + F29 00-FF + F2A 00-FF + F2B 00-FF + F2C 00-FF + F2D 00-FF + F2E 00-FF + F2F 00-FF + F30 00-FF + F31 00-FF + F32 00-FF + F33 00-FF + F34 00-FF + F35 00-FF + F36 00-FF + F37 00-FF + F38 00-FF + F39 00-FF + F3A 00-FF + F3B 00-FF + F3C 00-FF + F3D 00-FF + F3E 00-FF + F3F 00-FF + F40 00-FF + F41 00-FF + F42 00-FF + F43 00-FF + F44 00-FF + F45 00-FF + F46 00-FF + F47 00-FF + F48 00-FF + F49 00-FF + F4A 00-FF + F4B 00-FF + F4C 00-FF + F4D 00-FF + F4E 00-FF + F4F 00-FF + F50 00-FF + F51 00-FF + F52 00-FF + F53 00-FF + F54 00-FF + F55 00-FF + F56 00-FF + F57 00-FF + F58 00-FF + F59 00-FF + F5A 00-FF + F5B 00-FF + F5C 00-FF + F5D 00-FF + F5E 00-FF + F5F 00-FF + F60 00-FF + F61 00-FF + F62 00-FF + F63 00-FF + F64 00-FF + F65 00-FF + F66 00-FF + F67 00-FF + F68 00-FF + F69 00-FF + F6A 00-FF + F6B 00-FF + F6C 00-FF + F6D 00-FF + F6E 00-FF + F6F 00-FF + F70 00-FF + F71 00-FF + F72 00-FF + F73 00-FF + F74 00-FF + F75 00-FF + F76 00-FF + F77 00-FF + F78 00-FF + F79 00-FF + F7A 00-FF + F7B 00-FF + F7C 00-FF + F7D 00-FF + F7E 00-FF + F7F 00-FF + F80 00-FF + F81 00-FF + F82 00-FF + F83 00-FF + F84 00-FF + F85 00-FF + F86 00-FF + F87 00-FF + F88 00-FF + F89 00-FF + F8A 00-FF + F8B 00-FF + F8C 00-FF + F8D 00-FF + F8E 00-FF + F8F 00-FF + F90 00-FF + F91 00-FF + F92 00-FF + F93 00-FF + F94 00-FF + F95 00-FF + F96 00-FF + F97 00-FF + F98 00-FF + F99 00-FF + F9A 00-FF + F9B 00-FF + F9C 00-FF + F9D 00-FF + F9E 00-FF + F9F 00-FF + FA0 00-FF + FA1 00-FF + FA2 00-FF + FA3 00-FF + FA4 00-FF + FA5 00-FF + FA6 00-FF + FA7 00-FF + FA8 00-FF + FA9 00-FF + FAA 00-FF + FAB 00-FF + FAC 00-FF + FAD 00-FF + FAE 00-FF + FAF 00-FF + FB0 00-FF + FB1 00-FF + FB2 00-FF + FB3 00-FF + FB4 00-FF + FB5 00-FF + FB6 00-FF + FB7 00-FF + FB8 00-FF + FB9 00-FF + FBA 00-FF + FBB 00-FF + FBC 00-FF + FBD 00-FF + FBE 00-FF + FBF 00-FF + FC0 00-FF + FC1 00-FF + FC2 00-FF + FC3 00-FF + FC4 00-FF + FC5 00-FF + FC6 00-FF + FC7 00-FF + FC8 00-FF + FC9 00-FF + FCA 00-FF + FCB 00-FF + FCC 00-FF + FCD 00-FF + FCE 00-FF + FCF 00-FF + FD0 00-FF + FD1 00-FF + FD2 00-FF + FD3 00-FF + FD4 00-FF + FD5 00-FF + FD6 00-FF + FD7 00-FF + FD8 00-FF + FD9 00-FF + FDA 00-FF + FDB 00-FF + FDC 00-FF + FDD 00-FF + FDE 00-FF + FDF 00-FF + FE0 00-FF + FE1 00-FF + FE2 00-FF + FE3 00-FF + FE4 00-FF + FE5 00-FF + FE6 00-FF + FE7 00-FF + FE8 00-FF + FE9 00-FF + FEA 00-FF + FEB 00-FF + FEC 00-FF + FED 00-FF + FEE 00-FF + FEF 00-FF + FF0 00-FF + FF1 00-FF + FF2 00-FF + FF3 00-FF + FF4 00-FF + FF5 00-FF + FF6 00-FF + FF7 00-FF + FF8 00-FF + FF9 00-FF + FFA 00-FF + FFB 00-FF + FFC 00-FF + FFD 00-FF + FFE 00-FF + FFF 00-FD + 1000 00-FF + 1001 00-FF + 1002 00-FF + 1003 00-FF + 1004 00-FF + 1005 00-FF + 1006 00-FF + 1007 00-FF + 1008 00-FF + 1009 00-FF + 100A 00-FF + 100B 00-FF + 100C 00-FF + 100D 00-FF + 100E 00-FF + 100F 00-FF + 1010 00-FF + 1011 00-FF + 1012 00-FF + 1013 00-FF + 1014 00-FF + 1015 00-FF + 1016 00-FF + 1017 00-FF + 1018 00-FF + 1019 00-FF + 101A 00-FF + 101B 00-FF + 101C 00-FF + 101D 00-FF + 101E 00-FF + 101F 00-FF + 1020 00-FF + 1021 00-FF + 1022 00-FF + 1023 00-FF + 1024 00-FF + 1025 00-FF + 1026 00-FF + 1027 00-FF + 1028 00-FF + 1029 00-FF + 102A 00-FF + 102B 00-FF + 102C 00-FF + 102D 00-FF + 102E 00-FF + 102F 00-FF + 1030 00-FF + 1031 00-FF + 1032 00-FF + 1033 00-FF + 1034 00-FF + 1035 00-FF + 1036 00-FF + 1037 00-FF + 1038 00-FF + 1039 00-FF + 103A 00-FF + 103B 00-FF + 103C 00-FF + 103D 00-FF + 103E 00-FF + 103F 00-FF + 1040 00-FF + 1041 00-FF + 1042 00-FF + 1043 00-FF + 1044 00-FF + 1045 00-FF + 1046 00-FF + 1047 00-FF + 1048 00-FF + 1049 00-FF + 104A 00-FF + 104B 00-FF + 104C 00-FF + 104D 00-FF + 104E 00-FF + 104F 00-FF + 1050 00-FF + 1051 00-FF + 1052 00-FF + 1053 00-FF + 1054 00-FF + 1055 00-FF + 1056 00-FF + 1057 00-FF + 1058 00-FF + 1059 00-FF + 105A 00-FF + 105B 00-FF + 105C 00-FF + 105D 00-FF + 105E 00-FF + 105F 00-FF + 1060 00-FF + 1061 00-FF + 1062 00-FF + 1063 00-FF + 1064 00-FF + 1065 00-FF + 1066 00-FF + 1067 00-FF + 1068 00-FF + 1069 00-FF + 106A 00-FF + 106B 00-FF + 106C 00-FF + 106D 00-FF + 106E 00-FF + 106F 00-FF + 1070 00-FF + 1071 00-FF + 1072 00-FF + 1073 00-FF + 1074 00-FF + 1075 00-FF + 1076 00-FF + 1077 00-FF + 1078 00-FF + 1079 00-FF + 107A 00-FF + 107B 00-FF + 107C 00-FF + 107D 00-FF + 107E 00-FF + 107F 00-FF + 1080 00-FF + 1081 00-FF + 1082 00-FF + 1083 00-FF + 1084 00-FF + 1085 00-FF + 1086 00-FF + 1087 00-FF + 1088 00-FF + 1089 00-FF + 108A 00-FF + 108B 00-FF + 108C 00-FF + 108D 00-FF + 108E 00-FF + 108F 00-FF + 1090 00-FF + 1091 00-FF + 1092 00-FF + 1093 00-FF + 1094 00-FF + 1095 00-FF + 1096 00-FF + 1097 00-FF + 1098 00-FF + 1099 00-FF + 109A 00-FF + 109B 00-FF + 109C 00-FF + 109D 00-FF + 109E 00-FF + 109F 00-FF + 10A0 00-FF + 10A1 00-FF + 10A2 00-FF + 10A3 00-FF + 10A4 00-FF + 10A5 00-FF + 10A6 00-FF + 10A7 00-FF + 10A8 00-FF + 10A9 00-FF + 10AA 00-FF + 10AB 00-FF + 10AC 00-FF + 10AD 00-FF + 10AE 00-FF + 10AF 00-FF + 10B0 00-FF + 10B1 00-FF + 10B2 00-FF + 10B3 00-FF + 10B4 00-FF + 10B5 00-FF + 10B6 00-FF + 10B7 00-FF + 10B8 00-FF + 10B9 00-FF + 10BA 00-FF + 10BB 00-FF + 10BC 00-FF + 10BD 00-FF + 10BE 00-FF + 10BF 00-FF + 10C0 00-FF + 10C1 00-FF + 10C2 00-FF + 10C3 00-FF + 10C4 00-FF + 10C5 00-FF + 10C6 00-FF + 10C7 00-FF + 10C8 00-FF + 10C9 00-FF + 10CA 00-FF + 10CB 00-FF + 10CC 00-FF + 10CD 00-FF + 10CE 00-FF + 10CF 00-FF + 10D0 00-FF + 10D1 00-FF + 10D2 00-FF + 10D3 00-FF + 10D4 00-FF + 10D5 00-FF + 10D6 00-FF + 10D7 00-FF + 10D8 00-FF + 10D9 00-FF + 10DA 00-FF + 10DB 00-FF + 10DC 00-FF + 10DD 00-FF + 10DE 00-FF + 10DF 00-FF + 10E0 00-FF + 10E1 00-FF + 10E2 00-FF + 10E3 00-FF + 10E4 00-FF + 10E5 00-FF + 10E6 00-FF + 10E7 00-FF + 10E8 00-FF + 10E9 00-FF + 10EA 00-FF + 10EB 00-FF + 10EC 00-FF + 10ED 00-FF + 10EE 00-FF + 10EF 00-FF + 10F0 00-FF + 10F1 00-FF + 10F2 00-FF + 10F3 00-FF + 10F4 00-FF + 10F5 00-FF + 10F6 00-FF + 10F7 00-FF + 10F8 00-FF + 10F9 00-FF + 10FA 00-FF + 10FB 00-FF + 10FC 00-FF + 10FD 00-FF + 10FE 00-FF + 10FF 00-FD + diff --git a/newlib/libc/string/mkunidata b/newlib/libc/string/mkunidata new file mode 100755 index 000000000..c0bf5de6c --- /dev/null +++ b/newlib/libc/string/mkunidata @@ -0,0 +1,54 @@ +#! /bin/sh + +echo generating Unicode width data for newlib/libc/string/wcwidth.c + +cd `dirname $0` +PATH="$PATH":. # ensure access to uniset tool + +############################################################################# +# checks and (with option -u) downloads + +case "$1" in +-u) + #WGET=wget -N -t 1 --timeout=55 + WGET=curl -R -O --connect-timeout 55 + WGET+=-z $@ + + echo downloading uniset tool + $WGET http://www.cl.cam.ac.uk/~mgk25/download/uniset.tar.gz + gzip -dc uniset.tar.gz | tar xvf - uniset + + echo downloading data from unicode.org + for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt + do $WGET http://unicode.org/Public/UNIDATA/$data + done + ;; +*) echo checking package unicode-ucd + grep unicode-ucd /etc/setup/installed.db || exit 9 + ;; +esac + +echo checking uniset tool +type uniset || exit 9 + +for data in UnicodeData.txt Blocks.txt EastAsianWidth.txt +do test -r $data || ln -s /usr/share/unicode/ucd/$data . || exit 9 +done + +echo generating from Unicode version `sed -e 's,[^.0-9],,g' -e 1q Blocks.txt` +exit + +############################################################################# +# table generation + +echo generating combining characters table +uniset +cat=Me +cat=Mn +cat=Cf -00AD +1160-11FF +200B +D7B0-D7C6 +D7CB-D7FB c > combining.t + +echo generating ambiguous width characters table +sh ./mkwidthA && uniset +WIDTH-A -cat=Me -cat=Mn -cat=Cf c > ambiguous.t + +echo generating wide characters table +sh ./mkwide + +############################################################################# +# end diff --git a/newlib/libc/string/mkwide b/newlib/libc/string/mkwide new file mode 100755 index 000000000..55a0bab43 --- /dev/null +++ b/newlib/libc/string/mkwide @@ -0,0 +1,49 @@ +#! /bin/sh + +# generate list of wide characters, with convex closure + +skipcheck=false + +if [ ! -r EastAsianWidth.txt ] +then ln -s /usr/share/unicode/ucd/EastAsianWidth.txt . || exit 1 +fi +if [ ! -r UnicodeData.txt ] +then ln -s /usr/share/unicode/ucd/UnicodeData.txt . || exit 1 +fi +if [ ! -r Blocks.txt ] +then ln -s /usr/share/unicode/ucd/Blocks.txt . || exit 1 +fi + +sed -e "s,^\([^;]*\);[NAH],\1," -e t -e d EastAsianWidth.txt > wide.na +sed -e "s,^\([^;]*\);[WF],\1," -e t -e d EastAsianWidth.txt > wide.fw + +PATH="$PATH:." # for uniset + +nrfw=`uniset +wide.fw nr | sed -e 's,.*:,,'` +echo FW $nrfw +nrna=`uniset +wide.na nr | sed -e 's,.*:,,'` +echo NAH $nrna + +extrablocks="2E80-303E" + +# check all blocks +includes () { + nr=`uniset +wide.$2 -$1 nr | sed -e 's,.*:,,'` + test $nr != $3 +} +echo "adding compact closure of wide ranges, this may take ~10min" +for b in $extrablocks `sed -e 's,^\([0-9A-F]*\)\.\.\([0-9A-F]*\).*,\1-\2,' -e t -e d Blocks.txt` +do range=$b + echo checking $range $* >&2 + if includes $range fw $nrfw && ! includes $range na $nrna + then echo $range + fi +done > wide.blocks + +( +sed -e "s,^,//," -e 1q EastAsianWidth.txt +sed -e "s,^,//," -e 1q Blocks.txt +uniset `sed -e 's,^,+,' wide.blocks` +wide.fw c +) > wide.t + +rm -f wide.na wide.fw wide.blocks diff --git a/newlib/libc/string/mkwidthA b/newlib/libc/string/mkwidthA new file mode 100755 index 000000000..343ab4016 --- /dev/null +++ b/newlib/libc/string/mkwidthA @@ -0,0 +1,20 @@ +#! /bin/sh + +# generate WIDTH-A file, listing Unicode characters with width property +# Ambiguous, from EastAsianWidth.txt + +if [ ! -r EastAsianWidth.txt ] +then ln -s /usr/share/unicode/ucd/EastAsianWidth.txt . || exit 1 +fi +if [ ! -r UnicodeData.txt ] +then ln -s /usr/share/unicode/ucd/UnicodeData.txt . || exit 1 +fi +if [ ! -r Blocks.txt ] +then ln -s /usr/share/unicode/ucd/Blocks.txt . || exit 1 +fi + +sed -e "s,^\([^;]*\);A,\1," -e t -e d EastAsianWidth.txt > width-a-new +rm -f WIDTH-A +echo "# UAX #11: East Asian Ambiguous" > WIDTH-A +PATH="$PATH:." uniset +width-a-new compact >> WIDTH-A +rm -f width-a-new diff --git a/newlib/libc/string/uniset b/newlib/libc/string/uniset new file mode 100755 index 000000000..85d3b2a6f --- /dev/null +++ b/newlib/libc/string/uniset @@ -0,0 +1,696 @@ +#!/usr/bin/perl +# Uniset -- Unicode subset manager -- Markus Kuhn +# http://www.cl.cam.ac.uk/~mgk25/download/uniset.tar.gz + +require 5.008; +use open ':utf8'; +use FindBin qw($RealBin); # to find directory where this file is located + +binmode(STDOUT, ":utf8"); +binmode(STDIN, ":utf8"); + +my (%name, %invname, %category, %comment); + +print <. + +yyyy yyyy (optionally prefixed with 0x) is a Unicode character + belonging to the specified subset. + +yyyy-yyyy a range of Unicode characters belonging to +yyyy..yyyy the specified subset. + +xx yy yy yy-yy yy xx denotes a row (high-byte) and the yy specify + corresponding low bytes or with a hyphen also ranges of + low bytes in the Unicode values that belong to this + subset. This is also the format that is generated by + the compact command. +End +exit 1 if $#ARGV < 0; + + +# Subroutine to identify whether the ISO 10646/Unicode character code +# ucs belongs into the East Asian Wide (W) or East Asian FullWidth +# (F) category as defined in Unicode Technical Report #11. + +sub iswide ($) { + my $ucs = shift(@_); + + return ($ucs >= 0x1100 && + ($ucs <= 0x115f || # Hangul Jamo + $ucs == 0x2329 || $ucs == 0x232a || + ($ucs >= 0x2e80 && $ucs <= 0xa4cf && + $ucs != 0x303f) || # CJK .. Yi + ($ucs >= 0xac00 && $ucs <= 0xd7a3) || # Hangul Syllables + ($ucs >= 0xf900 && $ucs <= 0xfaff) || # CJK Comp. Ideographs + ($ucs >= 0xfe30 && $ucs <= 0xfe6f) || # CJK Comp. Forms + ($ucs >= 0xff00 && $ucs <= 0xff60) || # Fullwidth Forms + ($ucs >= 0xffe0 && $ucs <= 0xffe6) || + ($ucs >= 0x20000 && $ucs <= 0x2fffd) || + ($ucs >= 0x30000 && $ucs <= 0x3fffd))); +} + +# Return the Unicode name that belongs to a given character code + +# Jamo short names, see Unicode 3.0, table 4-4, page 86 + +my @lname = ('G', 'GG', 'N', 'D', 'DD', 'R', 'M', 'B', 'BB', 'S', 'SS', '', + 'J', 'JJ', 'C', 'K', 'T', 'P', 'H'); # 1100..1112 +my @vname = ('A', 'AE', 'YA', 'YAE', 'EO', 'E', 'YEO', 'YE', 'O', + 'WA', 'WAE', 'OE', 'YO', 'U', 'WEO', 'WE', 'WI', 'YU', + 'EU', 'YI', 'I'); # 1161..1175 +my @tname = ('G', 'GG', 'GS', 'N', 'NJ', 'NH', 'D', 'L', 'LG', 'LM', + 'LB', 'LS', 'LT', 'LP', 'LH', 'M', 'B', 'BS', 'S', 'SS', + 'NG', 'J', 'C', 'K', 'T', 'P', 'H'); # 11a8..11c2 + +sub name { + my $ucs = shift(@_); + + # The intervals used here reflect Unicode Version 3.2 + if (($ucs >= 0x3400 && $ucs <= 0x4db5) || + ($ucs >= 0x4e00 && $ucs <= 0x9fa5) || + ($ucs >= 0x20000 && $ucs <= 0x2a6d6)) { + return "CJK UNIFIED IDEOGRAPH-" . sprintf("%04X", $ucs); + } + + if ($ucs >= 0xac00 && $ucs <= 0xd7a3) { + my $s = $ucs - 0xac00; + my $l = 0x1100 + int($s / (21 * 28)); + my $v = 0x1161 + int(($s % (21 * 28)) / 28); + my $t = 0x11a7 + $s % 28; + return "HANGUL SYLLABLE " . + ($lname[int($s / (21 * 28))] . + $vname[int(($s % (21 * 28)) / 28)] . + $tname[$s % 28 - 1]); + } + + return $name{$ucs}; +} + +sub is_unicode { + my $ucs = shift(@_); + + # The intervals used here reflect Unicode Version 3.2 + if (($ucs >= 0x3400 && $ucs <= 0x4db5) || + ($ucs >= 0x4e00 && $ucs <= 0x9fa5) || + ($ucs >= 0xac00 && $ucs <= 0xd7a3) || + ($ucs >= 0x20000 && $ucs <= 0x2a6d6)) { + return 1; + } + + return exists $name{$ucs}; +} + +my @search_path; +push @search_path, "$ENV{HOME}/local/share/uniset" + if -d "$ENV{HOME}/local/share/uniset"; +push @search_path, "/usr/share/uniset" if -d "/usr/share/uniset"; +push @search_path, $RealBin unless $RealBin =~ m|^/usr/bin|; + +sub search_open { + my ($mode, $fn) = @_; + my $file; + return $file if open($file, $mode, $fn); + return undef if $fn =~ m|/|; + for my $path (@search_path) { + return $file if open($file, $mode, "$path/$fn"); + } + return undef; +} + +my $html = 0; +my $image = 0; +my $adducs = 0; +my $unicodedata = "UnicodeData.txt"; +my $blockdata = "Blocks.txt"; + +# read list of all Unicode names +my $data = search_open('<', $unicodedata); +unless ($data) { + die ("Can't open Unicode database '$unicodedata':\n$!\n\n" . + "Please make sure that you have downloaded the file\n" . + "http://www.unicode.org/Public/UNIDATA/UnicodeData.txt\n"); +} +while (<$data>) { + if (/^([0-9,A-F]{4,8});([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*);([^;]*)$/) { + next if $2 ne '' && substr($2, 0, 1) eq '<'; + $ucs = hex($1); + $name{$ucs} = $2; + $invname{$2} = $ucs; + $category{$ucs} = $3; + $comment{$ucs} = $12; + } else { + die("Syntax error in line '$_' in file '$unicodedata'"); + } +} +close($data); + +# read list of all Unicode blocks +$data = search_open('<', $blockdata); +unless ($data) { + die ("Can't open Unicode blockname list '$blockdata':\n$!\n\n" . + "Please make sure that you have downloaded the file\n" . + "http://www.unicode.org/Public/UNIDATA/Blocks.txt\n"); +} +my $blocks = 0; +my (@blockstart, @blockend, @blockname); +while (<$data>) { + if (/^\s*([0-9,A-F]{4,8})\s*\.\.\s*([0-9,A-F]{4,8})\s*;\s*(.*)$/) { + $blockstart[$blocks] = hex($1); + $blockend [$blocks] = hex($2); + $blockname [$blocks] = $3; + $blocks++; + } elsif (/^\s*\#/ || /^\s*$/) { + # ignore comments and empty lines + } else { + die("Syntax error in line '$_' in file '$blockdata'"); + } +} +close($data); +if ($blockend[$blocks-1] < 0x110000) { + $blockstart[$blocks] = 0x110000; + $blockend [$blocks] = 0x7FFFFFFF; + $blockname [$blocks] = "Beyond Plane 16"; + $blocks++; +} + +# process command line arguments +while ($_ = shift(@ARGV)) { + if (/^html$/) { + $html = 1; + } elsif (/^ucs$/) { + $adducs = 1; + } elsif (/^img$/) { + $html = 1; + $image = 1; + } elsif (/^template$/) { + $template = shift(@ARGV); + open(TEMPLATE, $template) || die("Can't open template file '$template': '$!'"); + while (