ANSI C fixes.
diff --git a/configure b/configure
index e21af97..4e5f555 100755
--- a/configure
+++ b/configure
@@ -3953,31 +3953,138 @@
fi
-for ac_func in \
- _lwp_create \
- clone \
- getpagesize \
- memmove \
- rfork \
- sendmsg \
- sigaltstack \
- strerror \
- stricmp \
- tcgetattr \
- timegm \
- usleep \
- vfscanf \
- wait4 \
- waitpid \
+# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
+# for constant arguments. Useless!
+echo $ac_n "checking for working alloca.h""... $ac_c" 1>&6
+echo "configure:3960: checking for working alloca.h" >&5
+if eval "test \"`echo '$''{'ac_cv_header_alloca_h'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3965 "configure"
+#include "confdefs.h"
+#include <alloca.h>
+int main() {
+char *p = alloca(2 * sizeof(int));
+; return 0; }
+EOF
+if { (eval echo configure:3972: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ac_cv_header_alloca_h=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_header_alloca_h=no
+fi
+rm -f conftest*
+fi
-do
-echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:3976: checking for $ac_func" >&5
+echo "$ac_t""$ac_cv_header_alloca_h" 1>&6
+if test $ac_cv_header_alloca_h = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA_H 1
+EOF
+
+fi
+
+echo $ac_n "checking for alloca""... $ac_c" 1>&6
+echo "configure:3993: checking for alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_func_alloca_works'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 3998 "configure"
+#include "confdefs.h"
+
+#ifdef __GNUC__
+# define alloca __builtin_alloca
+#else
+# if HAVE_ALLOCA_H
+# include <alloca.h>
+# else
+# ifdef _AIX
+ #pragma alloca
+# else
+# ifndef alloca /* predefined by HP cc +Olibcalls */
+char *alloca ();
+# endif
+# endif
+# endif
+#endif
+
+int main() {
+char *p = (char *) alloca(1);
+; return 0; }
+EOF
+if { (eval echo configure:4021: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ ac_cv_func_alloca_works=yes
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ ac_cv_func_alloca_works=no
+fi
+rm -f conftest*
+fi
+
+echo "$ac_t""$ac_cv_func_alloca_works" 1>&6
+if test $ac_cv_func_alloca_works = yes; then
+ cat >> confdefs.h <<\EOF
+#define HAVE_ALLOCA 1
+EOF
+
+fi
+
+if test $ac_cv_func_alloca_works = no; then
+ # The SVR3 libPW and SVR4 libucb both contain incompatible functions
+ # that cause trouble. Some versions do not even contain alloca or
+ # contain a buggy version. If you still want to use their alloca,
+ # use ar to extract alloca.o from them instead of compiling alloca.c.
+ ALLOCA=alloca.o
+ cat >> confdefs.h <<\EOF
+#define C_ALLOCA 1
+EOF
+
+
+echo $ac_n "checking whether alloca needs Cray hooks""... $ac_c" 1>&6
+echo "configure:4053: checking whether alloca needs Cray hooks" >&5
+if eval "test \"`echo '$''{'ac_cv_os_cray'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4058 "configure"
+#include "confdefs.h"
+#if defined(CRAY) && ! defined(CRAY2)
+webecray
+#else
+wenotbecray
+#endif
+
+EOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ egrep "webecray" >/dev/null 2>&1; then
+ rm -rf conftest*
+ ac_cv_os_cray=yes
+else
+ rm -rf conftest*
+ ac_cv_os_cray=no
+fi
+rm -f conftest*
+
+fi
+
+echo "$ac_t""$ac_cv_os_cray" 1>&6
+if test $ac_cv_os_cray = yes; then
+for ac_func in _getb67 GETB67 getb67; do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4083: checking for $ac_func" >&5
if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 3981 "configure"
+#line 4088 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char $ac_func(); below. */
@@ -4000,7 +4107,129 @@
; return 0; }
EOF
-if { (eval echo configure:4004: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+if { (eval echo configure:4111: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=no"
+fi
+rm -f conftest*
+fi
+
+if eval "test \"`echo '$ac_cv_func_'$ac_func`\" = yes"; then
+ echo "$ac_t""yes" 1>&6
+ cat >> confdefs.h <<EOF
+#define CRAY_STACKSEG_END $ac_func
+EOF
+
+ break
+else
+ echo "$ac_t""no" 1>&6
+fi
+
+done
+fi
+
+echo $ac_n "checking stack direction for C alloca""... $ac_c" 1>&6
+echo "configure:4138: checking stack direction for C alloca" >&5
+if eval "test \"`echo '$''{'ac_cv_c_stack_direction'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ if test "$cross_compiling" = yes; then
+ ac_cv_c_stack_direction=0
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4146 "configure"
+#include "confdefs.h"
+find_stack_direction ()
+{
+ static char *addr = 0;
+ auto char dummy;
+ if (addr == 0)
+ {
+ addr = &dummy;
+ return find_stack_direction ();
+ }
+ else
+ return (&dummy > addr) ? 1 : -1;
+}
+main ()
+{
+ exit (find_stack_direction() < 0);
+}
+EOF
+if { (eval echo configure:4165: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+then
+ ac_cv_c_stack_direction=1
+else
+ echo "configure: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ rm -fr conftest*
+ ac_cv_c_stack_direction=-1
+fi
+rm -fr conftest*
+fi
+
+fi
+
+echo "$ac_t""$ac_cv_c_stack_direction" 1>&6
+cat >> confdefs.h <<EOF
+#define STACK_DIRECTION $ac_cv_c_stack_direction
+EOF
+
+fi
+
+for ac_func in \
+ _lwp_create \
+ clone \
+ getpagesize \
+ memmove \
+ rfork \
+ sendmsg \
+ sigaltstack \
+ strerror \
+ stricmp \
+ tcgetattr \
+ timegm \
+ usleep \
+ vfscanf \
+ wait4 \
+ waitpid \
+
+do
+echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+echo "configure:4205: checking for $ac_func" >&5
+if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+else
+ cat > conftest.$ac_ext <<EOF
+#line 4210 "configure"
+#include "confdefs.h"
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+#include <assert.h>
+/* Override any gcc2 internal prototype to avoid an error. */
+/* We use char because int might match the return type of a gcc2
+ builtin and then its argument prototype would still apply. */
+char $ac_func();
+
+int main() {
+
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined (__stub_$ac_func) || defined (__stub___$ac_func)
+choke me
+#else
+$ac_func();
+#endif
+
+; return 0; }
+EOF
+if { (eval echo configure:4233: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then
rm -rf conftest*
eval "ac_cv_func_$ac_func=yes"
else
@@ -4059,17 +4288,17 @@
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
-echo "configure:4063: checking for $ac_hdr" >&5
+echo "configure:4292: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4068 "configure"
+#line 4297 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4073: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4302: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4096,12 +4325,12 @@
done
echo $ac_n "checking whether stat file-mode macros are broken""... $ac_c" 1>&6
-echo "configure:4100: checking whether stat file-mode macros are broken" >&5
+echo "configure:4329: checking whether stat file-mode macros are broken" >&5
if eval "test \"`echo '$''{'ac_cv_header_stat_broken'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4105 "configure"
+#line 4334 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/stat.h>
@@ -4154,12 +4383,12 @@
echo $ac_n "checking for working const""... $ac_c" 1>&6
-echo "configure:4158: checking for working const" >&5
+echo "configure:4387: checking for working const" >&5
if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4163 "configure"
+#line 4392 "configure"
#include "confdefs.h"
int main() {
@@ -4208,7 +4437,7 @@
; return 0; }
EOF
-if { (eval echo configure:4212: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_const=yes
else
@@ -4229,21 +4458,21 @@
fi
echo $ac_n "checking for inline""... $ac_c" 1>&6
-echo "configure:4233: checking for inline" >&5
+echo "configure:4462: checking for inline" >&5
if eval "test \"`echo '$''{'ac_cv_c_inline'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
cat > conftest.$ac_ext <<EOF
-#line 4240 "configure"
+#line 4469 "configure"
#include "confdefs.h"
int main() {
} $ac_kw foo() {
; return 0; }
EOF
-if { (eval echo configure:4247: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4476: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_inline=$ac_kw; break
else
@@ -4269,12 +4498,12 @@
esac
echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6
-echo "configure:4273: checking for ANSI C header files" >&5
+echo "configure:4502: checking for ANSI C header files" >&5
if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4278 "configure"
+#line 4507 "configure"
#include "confdefs.h"
#include <stdlib.h>
#include <stdarg.h>
@@ -4282,7 +4511,7 @@
#include <float.h>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:4286: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
+{ (eval echo configure:4515: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out`
if test -z "$ac_err"; then
rm -rf conftest*
@@ -4299,7 +4528,7 @@
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4303 "configure"
+#line 4532 "configure"
#include "confdefs.h"
#include <string.h>
EOF
@@ -4317,7 +4546,7 @@
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
cat > conftest.$ac_ext <<EOF
-#line 4321 "configure"
+#line 4550 "configure"
#include "confdefs.h"
#include <stdlib.h>
EOF
@@ -4338,7 +4567,7 @@
:
else
cat > conftest.$ac_ext <<EOF
-#line 4342 "configure"
+#line 4571 "configure"
#include "confdefs.h"
#include <ctype.h>
#define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
@@ -4349,7 +4578,7 @@
exit (0); }
EOF
-if { (eval echo configure:4353: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4582: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
:
else
@@ -4373,12 +4602,12 @@
fi
echo $ac_n "checking for size_t""... $ac_c" 1>&6
-echo "configure:4377: checking for size_t" >&5
+echo "configure:4606: checking for size_t" >&5
if eval "test \"`echo '$''{'ac_cv_type_size_t'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4382 "configure"
+#line 4611 "configure"
#include "confdefs.h"
#include <sys/types.h>
#if STDC_HEADERS
@@ -4406,7 +4635,7 @@
fi
echo $ac_n "checking size of long long""... $ac_c" 1>&6
-echo "configure:4410: checking size of long long" >&5
+echo "configure:4639: checking size of long long" >&5
if eval "test \"`echo '$''{'ac_cv_sizeof_long_long'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4414,7 +4643,7 @@
ac_cv_sizeof_long_long=0
else
cat > conftest.$ac_ext <<EOF
-#line 4418 "configure"
+#line 4647 "configure"
#include "confdefs.h"
#include <stdio.h>
main()
@@ -4425,7 +4654,7 @@
exit(0);
}
EOF
-if { (eval echo configure:4429: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4658: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_sizeof_long_long=`cat conftestval`
else
@@ -4449,12 +4678,12 @@
if test "$ac_cv_header_sys_vfs_h" = "yes"
then
echo $ac_n "checking "whether sys/vfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:4453: checking "whether sys/vfs.h defines statfs"" >&5
+echo "configure:4682: checking "whether sys/vfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_vfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4458 "configure"
+#line 4687 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -4471,7 +4700,7 @@
; return 0; }
EOF
-if { (eval echo configure:4475: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4704: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_vfs_has_statfs=yes
else
@@ -4498,12 +4727,12 @@
if test "$ac_cv_header_sys_statfs_h" = "yes"
then
echo $ac_n "checking "whether sys/statfs.h defines statfs"""... $ac_c" 1>&6
-echo "configure:4502: checking "whether sys/statfs.h defines statfs"" >&5
+echo "configure:4731: checking "whether sys/statfs.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_statfs_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4507 "configure"
+#line 4736 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -4518,7 +4747,7 @@
; return 0; }
EOF
-if { (eval echo configure:4522: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4751: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_statfs_has_statfs=yes
else
@@ -4545,12 +4774,12 @@
if test "$ac_cv_header_sys_mount_h" = "yes"
then
echo $ac_n "checking "whether sys/mount.h defines statfs"""... $ac_c" 1>&6
-echo "configure:4549: checking "whether sys/mount.h defines statfs"" >&5
+echo "configure:4778: checking "whether sys/mount.h defines statfs"" >&5
if eval "test \"`echo '$''{'wine_cv_sys_mount_has_statfs'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4554 "configure"
+#line 4783 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -4565,7 +4794,7 @@
; return 0; }
EOF
-if { (eval echo configure:4569: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4798: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_sys_mount_has_statfs=yes
else
@@ -4591,7 +4820,7 @@
echo $ac_n "checking "for statfs.f_bfree"""... $ac_c" 1>&6
-echo "configure:4595: checking "for statfs.f_bfree"" >&5
+echo "configure:4824: checking "for statfs.f_bfree"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bfree'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4600,7 +4829,7 @@
wine_cv_statfs_bfree=no
else
cat > conftest.$ac_ext <<EOF
-#line 4604 "configure"
+#line 4833 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -4627,7 +4856,7 @@
; return 0; }
EOF
-if { (eval echo configure:4631: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4860: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bfree=yes
else
@@ -4651,7 +4880,7 @@
fi
echo $ac_n "checking "for statfs.f_bavail"""... $ac_c" 1>&6
-echo "configure:4655: checking "for statfs.f_bavail"" >&5
+echo "configure:4884: checking "for statfs.f_bavail"" >&5
if eval "test \"`echo '$''{'wine_cv_statfs_bavail'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4660,7 +4889,7 @@
wine_cv_statfs_bavail=no
else
cat > conftest.$ac_ext <<EOF
-#line 4664 "configure"
+#line 4893 "configure"
#include "confdefs.h"
#include <sys/types.h>
@@ -4687,7 +4916,7 @@
; return 0; }
EOF
-if { (eval echo configure:4691: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:4920: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
wine_cv_statfs_bavail=yes
else
@@ -4712,7 +4941,7 @@
echo $ac_n "checking "for working sigaltstack"""... $ac_c" 1>&6
-echo "configure:4716: checking "for working sigaltstack"" >&5
+echo "configure:4945: checking "for working sigaltstack"" >&5
if eval "test \"`echo '$''{'ac_cv_c_working_sigaltstack'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
@@ -4721,7 +4950,7 @@
else
cat > conftest.$ac_ext <<EOF
-#line 4725 "configure"
+#line 4954 "configure"
#include "confdefs.h"
#include <stdio.h>
@@ -4759,7 +4988,7 @@
}
EOF
-if { (eval echo configure:4763: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:4992: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null
then
ac_cv_c_working_sigaltstack="yes"
else
@@ -4786,12 +5015,12 @@
echo $ac_n "checking "for msg_accrights in struct msghdr"""... $ac_c" 1>&6
-echo "configure:4790: checking "for msg_accrights in struct msghdr"" >&5
+echo "configure:5019: checking "for msg_accrights in struct msghdr"" >&5
if eval "test \"`echo '$''{'ac_cv_c_msg_accrights'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
-#line 4795 "configure"
+#line 5024 "configure"
#include "confdefs.h"
#include <sys/types.h>
#include <sys/socket.h>
@@ -4799,7 +5028,7 @@
struct msghdr hdr; hdr.msg_accrights=0
; return 0; }
EOF
-if { (eval echo configure:4803: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
+if { (eval echo configure:5032: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
ac_cv_c_msg_accrights="yes"
else
@@ -5055,6 +5284,7 @@
s%@XLIB@%$XLIB%g
s%@DLLFLAGS@%$DLLFLAGS%g
s%@LDSHARED@%$LDSHARED%g
+s%@ALLOCA@%$ALLOCA%g
s%@GCC_NO_BUILTIN@%$GCC_NO_BUILTIN%g
/@MAKE_RULES@/r $MAKE_RULES
s%@MAKE_RULES@%%g
diff --git a/configure.in b/configure.in
index 516b211..7bd0ad7 100644
--- a/configure.in
+++ b/configure.in
@@ -438,6 +438,7 @@
dnl **** Check for functions ****
+AC_FUNC_ALLOCA()
AC_CHECK_FUNCS(\
_lwp_create \
clone \
diff --git a/controls/edit.c b/controls/edit.c
index 8aa1e02..b240126 100644
--- a/controls/edit.c
+++ b/controls/edit.c
@@ -11,6 +11,8 @@
* please read EDIT.TODO (and update it when you change things)
*/
+#include "config.h"
+
#include <string.h>
#include "winnt.h"
#include "win.h"
@@ -113,8 +115,9 @@
#define ORDER_UINT(x,y) do { if ((UINT)(y) < (UINT)(x)) SWAP_UINT32((x),(y)); } while(0)
#define DPRINTF_EDIT_NOTIFY(hwnd, str) \
- ({TRACE_(edit)("notification " str " sent to hwnd=%08x\n", \
- (UINT)(hwnd));})
+ do {TRACE_(edit)("notification " str " sent to hwnd=%08x\n", \
+ (UINT)(hwnd));} while(0)
+
/* used for disabled or read-only edit control */
#define EDIT_SEND_CTLCOLORSTATIC(wnd,hdc) \
(SendMessageA((wnd)->parent->hwndSelf, WM_CTLCOLORSTATIC, \
@@ -123,10 +126,10 @@
(SendMessageA((wnd)->parent->hwndSelf, WM_CTLCOLOREDIT, \
(WPARAM)(hdc), (LPARAM)(wnd)->hwndSelf))
#define EDIT_NOTIFY_PARENT(wnd, wNotifyCode, str) \
- (DPRINTF_EDIT_NOTIFY((wnd)->parent->hwndSelf, str), \
+ do {DPRINTF_EDIT_NOTIFY((wnd)->parent->hwndSelf, str); \
SendMessageA((wnd)->parent->hwndSelf, WM_COMMAND, \
- MAKEWPARAM((wnd)->wIDmenu, wNotifyCode), \
- (LPARAM)(wnd)->hwndSelf))
+ MAKEWPARAM((wnd)->wIDmenu, wNotifyCode), \
+ (LPARAM)(wnd)->hwndSelf);} while(0)
#define DPRINTF_EDIT_MSG16(str) \
TRACE_(edit)(\
"16 bit : " str ": hwnd=%08x, wParam=%08x, lParam=%08x\n", \
@@ -145,12 +148,12 @@
/*
* These functions have trivial implementations
* We still like to call them internally
- * "static __inline__" makes them more like macro's
+ * "static inline" makes them more like macro's
*/
-static __inline__ BOOL EDIT_EM_CanUndo(WND *wnd, EDITSTATE *es);
-static __inline__ void EDIT_EM_EmptyUndoBuffer(WND *wnd, EDITSTATE *es);
-static __inline__ void EDIT_WM_Clear(WND *wnd, EDITSTATE *es);
-static __inline__ void EDIT_WM_Cut(WND *wnd, EDITSTATE *es);
+static inline BOOL EDIT_EM_CanUndo(WND *wnd, EDITSTATE *es);
+static inline void EDIT_EM_EmptyUndoBuffer(WND *wnd, EDITSTATE *es);
+static inline void EDIT_WM_Clear(WND *wnd, EDITSTATE *es);
+static inline void EDIT_WM_Cut(WND *wnd, EDITSTATE *es);
/*
* This is the only exported function
*/
@@ -252,7 +255,7 @@
* EM_CANUNDO
*
*/
-static __inline__ BOOL EDIT_EM_CanUndo(WND *wnd, EDITSTATE *es)
+static inline BOOL EDIT_EM_CanUndo(WND *wnd, EDITSTATE *es)
{
return (es->undo_insert_count || lstrlenA(es->undo_text));
}
@@ -263,7 +266,7 @@
* EM_EMPTYUNDOBUFFER
*
*/
-static __inline__ void EDIT_EM_EmptyUndoBuffer(WND *wnd, EDITSTATE *es)
+static inline void EDIT_EM_EmptyUndoBuffer(WND *wnd, EDITSTATE *es)
{
es->undo_insert_count = 0;
*es->undo_text = '\0';
@@ -275,7 +278,7 @@
* WM_CLEAR
*
*/
-static __inline__ void EDIT_WM_Clear(WND *wnd, EDITSTATE *es)
+static inline void EDIT_WM_Clear(WND *wnd, EDITSTATE *es)
{
EDIT_EM_ReplaceSel(wnd, es, TRUE, "");
}
@@ -286,7 +289,7 @@
* WM_CUT
*
*/
-static __inline__ void EDIT_WM_Cut(WND *wnd, EDITSTATE *es)
+static inline void EDIT_WM_Cut(WND *wnd, EDITSTATE *es)
{
EDIT_WM_Copy(wnd, es);
EDIT_WM_Clear(wnd, es);
diff --git a/controls/menu.c b/controls/menu.c
index 4f4c712..c2534fa 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -756,7 +756,7 @@
BITMAP bm;
HBITMAP resBmp = 0;
- // Check if there is a magic menu item associated with this item
+ /* Check if there is a magic menu item associated with this item */
if((LOWORD((int)lpitem->text))<12)
{
resBmp = MENU_LoadMagicItem((int)lpitem->text, (lpitem->fType & MF_HILITE),
@@ -1149,8 +1149,10 @@
HDC hdcMem = CreateCompatibleDC( hdc );
- // Check if there is a magic menu item associated with this item
- // and load the appropriate bitmap
+ /*
+ * Check if there is a magic menu item associated with this item
+ * and load the appropriate bitmap
+ */
if((LOWORD((int)lpitem->text)) < 12)
{
resBmp = MENU_LoadMagicItem((int)lpitem->text, (lpitem->fState & MF_HILITE),
diff --git a/debugger/dbg.y b/debugger/dbg.y
index 26e56ba..2bd5302 100644
--- a/debugger/dbg.y
+++ b/debugger/dbg.y
@@ -6,12 +6,17 @@
* Copyright 1995 Morten Welinder
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/stat.h>
#include <unistd.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
#include "winbase.h"
#include "class.h"
diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c
index bf18b88..18acd08 100644
--- a/graphics/x11drv/xfont.c
+++ b/graphics/x11drv/xfont.c
@@ -2637,9 +2637,9 @@
TRACE(font, "x = %f y = %f\n", x, y);
x *= pfo->lpX11Trans->pixelsize / 1000.0;
y *= pfo->lpX11Trans->pixelsize / 1000.0;
- size->cx = fabsf((x + dc->w.breakRem + count * dc->w.charExtra) *
+ size->cx = fabs((x + dc->w.breakRem + count * dc->w.charExtra) *
dc->wndExtX / dc->vportExtX);
- size->cy = fabsf(y * dc->wndExtY / dc->vportExtY);
+ size->cy = fabs(y * dc->wndExtY / dc->vportExtY);
}
return TRUE;
}
diff --git a/if1632/snoop.c b/if1632/snoop.c
index 6914d46..41989f334 100644
--- a/if1632/snoop.c
+++ b/if1632/snoop.c
@@ -265,19 +265,19 @@
max = fun->nrofargs;
if (max>16) max=16;
for (i=max;i--;)
- DPRINTF("%04x%s",*(WORD*)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8+sizeof(WORD)*i),i?",":"");
+ DPRINTF("%04x%s",*(WORD*)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8+sizeof(WORD)*i),i?",":"");
if (max!=fun->nrofargs)
DPRINTF(" ...");
} else if (fun->nrofargs<0) {
DPRINTF("<unknown, check return>");
ret->args = HeapAlloc(SystemHeap,0,16*sizeof(WORD));
- memcpy(ret->args,(LPBYTE)(PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8),sizeof(WORD)*16);
+ memcpy(ret->args,(LPBYTE)((char *) PTR_SEG_OFF_TO_LIN(SS_reg(context),SP_reg(context))+8),sizeof(WORD)*16);
}
DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn));
}
void WINAPI SNOOP16_Return(CONTEXT *context) {
- SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)(PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5);
+ SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) PTR_SEG_OFF_TO_LIN(CS_reg(context),IP_reg(context))-5);
/* We haven't found out the nrofargs yet. If we called a cdecl
* function it is too late anyway and we can just set '0' (which
diff --git a/include/config.h.in b/include/config.h.in
index 2a5a5c3..1438c12 100644
--- a/include/config.h.in
+++ b/include/config.h.in
@@ -1,14 +1,36 @@
/* include/config.h.in. Generated automatically from configure.in by autoheader. */
+/* Define if using alloca.c. */
+#undef C_ALLOCA
+
/* Define to empty if the keyword does not work. */
#undef const
+/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
+ This function is required for alloca.c support on those systems. */
+#undef CRAY_STACKSEG_END
+
+/* Define if you have alloca, as a function or macro. */
+#undef HAVE_ALLOCA
+
+/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
+#undef HAVE_ALLOCA_H
+
/* Define as __inline if that's what the C compiler calls it. */
#undef inline
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
+/* If using the C implementation of alloca, define if you know the
+ direction of stack growth for your system; otherwise it will be
+ automatically deduced at run-time.
+ STACK_DIRECTION > 0 => grows toward higher addresses
+ STACK_DIRECTION < 0 => grows toward lower addresses
+ STACK_DIRECTION = 0 => direction of growth unknown
+ */
+#undef STACK_DIRECTION
+
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
#undef STAT_MACROS_BROKEN
diff --git a/include/server.h b/include/server.h
index 4581dbc..228c4bb 100644
--- a/include/server.h
+++ b/include/server.h
@@ -501,12 +501,14 @@
/* Allocate a console for the current process */
struct alloc_console_request
{
+ int dummy;
};
/* Free the console of the current process */
struct free_console_request
{
+ int dummy;
};
@@ -597,6 +599,7 @@
};
struct read_console_input_reply
{
+ int dummy;
/* INPUT_RECORD records[0]; */ /* input records */
};
diff --git a/include/stackframe.h b/include/stackframe.h
index cbe87e0..5b9cb52 100644
--- a/include/stackframe.h
+++ b/include/stackframe.h
@@ -79,10 +79,10 @@
(thdb)->cur_stack += (size))
/* Push a DWORD on the 32-bit stack */
-#define STACK32_PUSH(context,val) (*--((DWORD *)ESP_reg(context)) = (val))
+#define STACK32_PUSH(context,val) (*--(*(DWORD **)&ESP_reg(context)) = (val))
/* Pop a DWORD from the 32-bit stack */
-#define STACK32_POP(context) (*((DWORD *)ESP_reg(context))++)
+#define STACK32_POP(context) (*(*(DWORD **)&ESP_reg(context))++)
/* Win32 register functions */
#define REGS_ENTRYPOINT(name) void WINAPI __regs_##name( CONTEXT *context )
diff --git a/ipc/bit_array.c b/ipc/bit_array.c
index 2a89665..0f9a5aa 100644
--- a/ipc/bit_array.c
+++ b/ipc/bit_array.c
@@ -35,11 +35,10 @@
#include "bit_array.h"
#ifdef HAS_BITOPS
-#define inline __inline__ /* So we can compile with -ansi */
#include <asm/bitops.h>
#else
-static __inline__ int clear_bit(int bit, int *mem);
-static __inline__ int set_bit(int bit, int *mem);
+static inline int clear_bit(int bit, int *mem);
+static inline int set_bit(int bit, int *mem);
#endif /* HAS_BITOPS */
@@ -81,7 +80,7 @@
** Find first zero bit in the integer.
** Assume there is at least one zero.
*/
-static __inline__ int find_zbit_in_integer(unsigned int integer)
+static inline int find_zbit_in_integer(unsigned int integer)
{
int i;
@@ -98,7 +97,7 @@
}
/* return -1 on failure */
-static __inline__ int find_first_zero_bit(unsigned *array, int bits)
+static inline int find_first_zero_bit(unsigned *array, int bits)
{
unsigned int integer;
int i;
@@ -120,7 +119,7 @@
return -1;
}
-static __inline__ int test_bit(int pos, unsigned *array)
+static inline int test_bit(int pos, unsigned *array)
{
unsigned int integer;
int bit = BIT_IN_INT(pos);
@@ -139,7 +138,7 @@
/* inputs: bit number and memory address (32 bit) */
/* output: Value of the bit before modification */
-static __inline__ int clear_bit(int bit, int *mem)
+static inline int clear_bit(int bit, int *mem)
{
int ret;
@@ -151,7 +150,7 @@
return (ret);
}
-static __inline__ int set_bit(int bit, int *mem)
+static inline int set_bit(int bit, int *mem)
{
int ret;
__asm__("xor %1,%1\n"
diff --git a/misc/wsprintf.c b/misc/wsprintf.c
index dc282a0..e429971 100644
--- a/misc/wsprintf.c
+++ b/misc/wsprintf.c
@@ -382,7 +382,7 @@
LPSTR p = buffer;
UINT i, len;
CHAR number[20];
- WPRINTF_DATA argData = (WPRINTF_DATA)0;
+ WPRINTF_DATA argData;
while (*spec && (maxlen > 1))
{
diff --git a/miscemu/instr.c b/miscemu/instr.c
index 95b5827..4ff44dc 100644
--- a/miscemu/instr.c
+++ b/miscemu/instr.c
@@ -23,7 +23,11 @@
(IS_V86(context) ? FALSE : IS_SELECTOR_32BIT(seg))
#define STACK_sig(context) \
- (IS_SEL_32(context,SS_sig(context)) ? ESP_sig(context) : SP_sig(context))
+ (IS_SEL_32(context,SS_sig(context)) ? ESP_sig(context) : (DWORD)SP_sig(context))
+
+#define ADD_STACK_sig(context,offset) \
+ do { if (IS_SEL_32(context,SS_sig(context))) ESP_sig(context) += (offset); \
+ else SP_sig(context) += (offset); } while(0)
#define MAKE_PTR(seg,off) \
(IS_SELECTOR_SYSTEM(seg) ? (void *)(off) : PTR_SEG_OFF_TO_LIN(seg,off))
@@ -408,7 +412,7 @@
case 0x17: SS_sig(context) = seg; break;
case 0x1f: DS_sig(context) = seg; break;
}
- STACK_sig(context) += long_op ? 4 : 2;
+ ADD_STACK_sig(context, long_op ? 4 : 2);
EIP_sig(context) += prefixlen + 1;
return TRUE;
}
@@ -465,7 +469,7 @@
if (INSTR_ReplaceSelector( context, &seg ))
{
FS_sig(context) = seg;
- STACK_sig(context) += long_op ? 4 : 2;
+ ADD_STACK_sig(context, long_op ? 4 : 2);
EIP_sig(context) += prefixlen + 2;
return TRUE;
}
@@ -480,7 +484,7 @@
if (INSTR_ReplaceSelector( context, &seg ))
{
GS_sig(context) = seg;
- STACK_sig(context) += long_op ? 4 : 2;
+ ADD_STACK_sig(context, long_op ? 4 : 2);
EIP_sig(context) += prefixlen + 2;
return TRUE;
}
@@ -667,7 +671,7 @@
*(--stack) = FL_sig(context);
*(--stack) = CS_sig(context);
*(--stack) = IP_sig(context) + prefixlen + 2;
- STACK_sig(context) -= 3 * sizeof(WORD);
+ ADD_STACK_sig(context, -3 * sizeof(WORD));
/* Jump to the interrupt handler */
CS_sig(context) = HIWORD(addr);
EIP_sig(context) = LOWORD(addr);
@@ -681,7 +685,7 @@
EIP_sig(context) = *stack++;
CS_sig(context) = *stack++;
EFL_sig(context) = *stack;
- STACK_sig(context) += 3*sizeof(DWORD); /* Pop the return address and flags */
+ ADD_STACK_sig(context, 3*sizeof(DWORD)); /* Pop the return address and flags */
}
else
{
@@ -689,7 +693,7 @@
EIP_sig(context) = *stack++;
CS_sig(context) = *stack++;
FL_sig(context) = *stack;
- STACK_sig(context) += 3*sizeof(WORD); /* Pop the return address and flags */
+ ADD_STACK_sig(context, 3*sizeof(WORD)); /* Pop the return address and flags */
}
return TRUE;
@@ -803,7 +807,7 @@
WORD *stack = (WORD *)STACK_PTR( context );
*--stack = CS_sig(context);
*--stack = EIP_sig(context);
- STACK_sig(context) -= 2*sizeof(WORD);
+ ADD_STACK_sig(context, -2*sizeof(WORD));
CS_sig(context) = SELECTOROF( gpHandler );
EIP_sig(context) = OFFSETOF( gpHandler );
diff --git a/msdos/ioports.c b/msdos/ioports.c
index 7794014..41f0931 100644
--- a/msdos/ioports.c
+++ b/msdos/ioports.c
@@ -184,38 +184,38 @@
}
}
-static __inline__ BYTE inb( WORD port )
+static inline BYTE inb( WORD port )
{
BYTE b;
__asm__ __volatile__( "inb %w1,%0" : "=a" (b) : "d" (port) );
return b;
}
-static __inline__ WORD inw( WORD port )
+static inline WORD inw( WORD port )
{
WORD w;
__asm__ __volatile__( "inw %w1,%0" : "=a" (w) : "d" (port) );
return w;
}
-static __inline__ DWORD inl( WORD port )
+static inline DWORD inl( WORD port )
{
DWORD dw;
__asm__ __volatile__( "inl %w1,%0" : "=a" (dw) : "d" (port) );
return dw;
}
-static __inline__ void outb( BYTE value, WORD port )
+static inline void outb( BYTE value, WORD port )
{
__asm__ __volatile__( "outb %b0,%w1" : : "a" (value), "d" (port) );
}
-static __inline__ void outw( WORD value, WORD port )
+static inline void outw( WORD value, WORD port )
{
__asm__ __volatile__( "outw %w0,%w1" : : "a" (value), "d" (port) );
}
-static __inline__ void outl( DWORD value, WORD port )
+static inline void outl( DWORD value, WORD port )
{
__asm__ __volatile__( "outl %0,%w1" : : "a" (value), "d" (port) );
}
diff --git a/ole/datacache.c b/ole/datacache.c
index ee03198..365878d 100644
--- a/ole/datacache.c
+++ b/ole/datacache.c
@@ -114,11 +114,11 @@
* by this object.
*/
#define _ICOM_THIS_From_IDataObject(class,name) class* this = (class*)name;
-#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((void*)name)-sizeof(void*));
-#define _ICOM_THIS_From_IPersistStorage(class, name) class* this = (class*)(((void*)name)-2*sizeof(void*));
-#define _ICOM_THIS_From_IViewObject2(class, name) class* this = (class*)(((void*)name)-3*sizeof(void*));
-#define _ICOM_THIS_From_IOleCache2(class, name) class* this = (class*)(((void*)name)-4*sizeof(void*));
-#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((void*)name)-5*sizeof(void*));
+#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*));
+#define _ICOM_THIS_From_IPersistStorage(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*));
+#define _ICOM_THIS_From_IViewObject2(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*));
+#define _ICOM_THIS_From_IOleCache2(class, name) class* this = (class*)(((char*)name)-4*sizeof(void*));
+#define _ICOM_THIS_From_IOleCacheControl(class, name) class* this = (class*)(((char*)name)-5*sizeof(void*));
/*
* Prototypes for the methods of the DataCache class.
diff --git a/ole/defaulthandler.c b/ole/defaulthandler.c
index a25ae10..51787a4 100644
--- a/ole/defaulthandler.c
+++ b/ole/defaulthandler.c
@@ -107,9 +107,9 @@
* by this object.
*/
#define _ICOM_THIS_From_IOleObject(class,name) class* this = (class*)name;
-#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((void*)name)-sizeof(void*));
-#define _ICOM_THIS_From_IDataObject(class, name) class* this = (class*)(((void*)name)-2*sizeof(void*));
-#define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((void*)name)-3*sizeof(void*));
+#define _ICOM_THIS_From_NDIUnknown(class, name) class* this = (class*)(((char*)name)-sizeof(void*));
+#define _ICOM_THIS_From_IDataObject(class, name) class* this = (class*)(((char*)name)-2*sizeof(void*));
+#define _ICOM_THIS_From_IRunnableObject(class, name) class* this = (class*)(((char*)name)-3*sizeof(void*));
/*
* Prototypes for the methods of the DefaultHandler class.
diff --git a/ole/hglobalstream.c b/ole/hglobalstream.c
index 73247c2..6346c8e 100644
--- a/ole/hglobalstream.c
+++ b/ole/hglobalstream.c
@@ -426,7 +426,7 @@
*/
supportBuffer = GlobalLock(This->supportHandle);
- memcpy(pv, supportBuffer+This->currentPosition.LowPart, bytesToReadFromBuffer);
+ memcpy(pv, (char *) supportBuffer+This->currentPosition.LowPart, bytesToReadFromBuffer);
/*
* Move the current position to the new position
@@ -510,7 +510,7 @@
*/
supportBuffer = GlobalLock(This->supportHandle);
- memcpy(supportBuffer+This->currentPosition.LowPart, pv, cb);
+ memcpy((char *) supportBuffer+This->currentPosition.LowPart, pv, cb);
/*
* Move the current position to the new position
diff --git a/ole/memlockbytes.c b/ole/memlockbytes.c
index 56f5cf6..2381db8 100644
--- a/ole/memlockbytes.c
+++ b/ole/memlockbytes.c
@@ -380,7 +380,7 @@
supportBuffer = GlobalLock(This->supportHandle);
memcpy(pv,
- supportBuffer + ulOffset.LowPart,
+ (char *) supportBuffer + ulOffset.LowPart,
bytesToReadFromBuffer);
/*
@@ -458,7 +458,7 @@
*/
supportBuffer = GlobalLock(This->supportHandle);
- memcpy(supportBuffer + ulOffset.LowPart, pv, cb);
+ memcpy((char *) supportBuffer + ulOffset.LowPart, pv, cb);
/*
* Return the number of bytes written.
diff --git a/scheduler/client.c b/scheduler/client.c
index e013044..0bbac9d 100644
--- a/scheduler/client.c
+++ b/scheduler/client.c
@@ -64,9 +64,9 @@
{
THDB *thdb = THREAD_Current();
#ifndef HAVE_MSGHDR_ACCRIGHTS
- struct cmsg_fd cmsg = { sizeof(cmsg), SOL_SOCKET, SCM_RIGHTS, pass_fd };
+ struct cmsg_fd cmsg;
#endif
- struct msghdr msghdr = { NULL, 0, vec, veclen, };
+ struct msghdr msghdr;
struct header head;
int i, ret, len;
@@ -80,16 +80,39 @@
head.len = len;
head.seq = thdb->seq++;
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = vec;
+ msghdr.msg_iovlen = veclen;
+
+#ifdef HAVE_MSGHDR_ACCRIGHTS
if (pass_fd != -1) /* we have an fd to send */
{
-#ifdef HAVE_MSGHDR_ACCRIGHTS
- msghdr.msg_accrights = (void *)&pass_fd;
+ msghdr.msg_accrights = (void *)&pass_fd;
msghdr.msg_accrightslen = sizeof(pass_fd);
-#else
+ }
+ else
+ {
+ msghdr.msg_accrights = NULL;
+ msghdr.msg_accrightslen = 0;
+ }
+#else /* HAVE_MSGHDR_ACCRIGHTS */
+ if (pass_fd != -1) /* we have an fd to send */
+ {
+ cmsg.len = sizeof(cmsg);
+ cmsg.level = SOL_SOCKET;
+ cmsg.type = SCM_RIGHTS;
+ cmsg.fd = pass_fd;
msghdr.msg_control = &cmsg;
msghdr.msg_controllen = sizeof(cmsg);
-#endif
}
+ else
+ {
+ msghdr.msg_control = NULL;
+ msghdr.msg_controllen = 0;
+ }
+ msghdr.msg_flags = 0;
+#endif /* HAVE_MSGHDR_ACCRIGHTS */
if ((ret = sendmsg( thdb->socket, &msghdr, 0 )) < len)
{
@@ -122,7 +145,7 @@
vec[i].iov_len = va_arg( args, int );
}
va_end( args );
- return CLIENT_SendRequest_v( req, pass_fd, vec, n );
+ CLIENT_SendRequest_v( req, pass_fd, vec, n );
}
@@ -137,15 +160,32 @@
{
THDB *thdb = THREAD_Current();
int pass_fd = -1;
-#ifdef HAVE_MSGHDR_ACCRIGHTS
- struct msghdr msghdr = { NULL, 0, vec, veclen, (void*)&pass_fd, sizeof(int) };
-#else
- struct cmsg_fd cmsg = { sizeof(cmsg), SOL_SOCKET, SCM_RIGHTS, -1 };
- struct msghdr msghdr = { NULL, 0, vec, veclen, &cmsg, sizeof(cmsg), 0 };
-#endif
struct header head;
int ret, remaining;
+#ifdef HAVE_MSGHDR_ACCRIGHTS
+ struct msghdr msghdr;
+
+ msghdr.msg_accrights = (void *)&pass_fd;
+ msghdr.msg_accrightslen = sizeof(int);
+#else /* HAVE_MSGHDR_ACCRIGHTS */
+ struct msghdr msghdr;
+ struct cmsg_fd cmsg;
+
+ cmsg.len = sizeof(cmsg);
+ cmsg.level = SOL_SOCKET;
+ cmsg.type = SCM_RIGHTS;
+ cmsg.fd = -1;
+ msghdr.msg_control = &cmsg;
+ msghdr.msg_controllen = sizeof(cmsg);
+ msghdr.msg_flags = 0;
+#endif /* HAVE_MSGHDR_ACCRIGHTS */
+
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = vec;
+ msghdr.msg_iovlen = veclen;
+
assert( veclen > 0 );
vec[0].iov_base = &head;
vec[0].iov_len = sizeof(head);
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index 764a366..0891217 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -158,7 +158,7 @@
#ifdef HAVE__LWP_CREATE
ucontext_t context;
_lwp_makecontext( &context, (void(*)(void *))SYSDEPS_StartThread, thread,
- NULL, thread->stack_base, thread->teb.stack_top - thread->stack_base );
+ NULL, thread->stack_base, (char *) thread->teb.stack_top - (char *) thread->stack_base );
if ( _lwp_create( &context, 0, NULL ) )
return -1;
return 0;
diff --git a/server/socket.c b/server/socket.c
index ee0b023..371b10b 100644
--- a/server/socket.c
+++ b/server/socket.c
@@ -70,10 +70,9 @@
{
struct iovec vec[2];
#ifndef HAVE_MSGHDR_ACCRIGHTS
- struct cmsg_fd cmsg = { sizeof(cmsg), SOL_SOCKET, SCM_RIGHTS,
- client->pass_fd };
+ struct cmsg_fd cmsg;
#endif
- struct msghdr msghdr = { NULL, 0, vec, 2, };
+ struct msghdr msghdr;
int ret;
/* make sure we have something to send */
@@ -81,12 +80,17 @@
/* make sure the client is listening */
assert( client->state == READING );
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = vec;
+
if (client->count < sizeof(client->head))
{
vec[0].iov_base = (char *)&client->head + client->count;
vec[0].iov_len = sizeof(client->head) - client->count;
vec[1].iov_base = client->data;
vec[1].iov_len = client->head.len - sizeof(client->head);
+ msghdr.msg_iovlen = 2;
}
else
{
@@ -94,16 +98,36 @@
vec[0].iov_len = client->head.len - client->count;
msghdr.msg_iovlen = 1;
}
+
+#ifdef HAVE_MSGHDR_ACCRIGHTS
if (client->pass_fd != -1) /* we have an fd to send */
{
-#ifdef HAVE_MSGHDR_ACCRIGHTS
msghdr.msg_accrights = (void *)&client->pass_fd;
msghdr.msg_accrightslen = sizeof(client->pass_fd);
-#else
+ }
+ else
+ {
+ msghdr.msg_accrights = NULL;
+ msghdr.msg_accrightslen = 0;
+ }
+#else /* HAVE_MSGHDR_ACCRIGHTS */
+ if (client->pass_fd != -1) /* we have an fd to send */
+ {
+ cmsg.len = sizeof(cmsg);
+ cmsg.level = SOL_SOCKET;
+ cmsg.type = SCM_RIGHTS;
+ cmsg.fd = client->pass_fd;
msghdr.msg_control = &cmsg;
msghdr.msg_controllen = sizeof(cmsg);
-#endif
}
+ else
+ {
+ msghdr.msg_control = NULL;
+ msghdr.msg_controllen = 0;
+ }
+ msghdr.msg_flags = 0;
+#endif /* HAVE_MSGHDR_ACCRIGHTS */
+
ret = sendmsg( client_fd, &msghdr, 0 );
if (ret == -1)
{
@@ -133,14 +157,31 @@
{
struct iovec vec;
int pass_fd = -1;
-#ifdef HAVE_MSGHDR_ACCRIGHTS
- struct msghdr msghdr = { NULL, 0, &vec, 1, (void*)&pass_fd, sizeof(int) };
-#else
- struct cmsg_fd cmsg = { sizeof(cmsg), SOL_SOCKET, SCM_RIGHTS, -1 };
- struct msghdr msghdr = { NULL, 0, &vec, 1, &cmsg, sizeof(cmsg), 0 };
-#endif
int ret;
+#ifdef HAVE_MSGHDR_ACCRIGHTS
+ struct msghdr msghdr;
+
+ msghdr.msg_accrights = (void *)&pass_fd;
+ msghdr.msg_accrightslen = sizeof(int);
+#else /* HAVE_MSGHDR_ACCRIGHTS */
+ struct msghdr msghdr;
+ struct cmsg_fd cmsg;
+
+ cmsg.len = sizeof(cmsg);
+ cmsg.level = SOL_SOCKET;
+ cmsg.type = SCM_RIGHTS;
+ cmsg.fd = -1;
+ msghdr.msg_control = &cmsg;
+ msghdr.msg_controllen = sizeof(cmsg);
+ msghdr.msg_flags = 0;
+#endif /* HAVE_MSGHDR_ACCRIGHTS */
+
+ msghdr.msg_name = NULL;
+ msghdr.msg_namelen = 0;
+ msghdr.msg_iov = &vec;
+ msghdr.msg_iovlen = 1;
+
if (client->count < sizeof(client->head))
{
vec.iov_base = (char *)&client->head + client->count;
diff --git a/server/trace.c b/server/trace.c
index a51f954..a0a5e49 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -453,11 +453,13 @@
static int dump_alloc_console_request( struct alloc_console_request *req, int len )
{
+ fprintf( stderr, " dummy=%d", req->dummy );
return (int)sizeof(*req);
}
static int dump_free_console_request( struct free_console_request *req, int len )
{
+ fprintf( stderr, " dummy=%d", req->dummy );
return (int)sizeof(*req);
}
@@ -548,6 +550,7 @@
static int dump_read_console_input_reply( struct read_console_input_reply *req, int len )
{
+ fprintf( stderr, " dummy=%d", req->dummy );
return (int)sizeof(*req);
}
diff --git a/tools/build.c b/tools/build.c
index 4499b78..f8789f0 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -1007,6 +1007,9 @@
/* Output code for all register functions */
fprintf( outfile, "#ifdef __i386__\n" );
+ fprintf( outfile, "#ifndef __GNUC__\n" );
+ fprintf( outfile, "static void __asm__dummy() {\n" );
+ fprintf( outfile, "#endif /* !defined(__GNUC__) */\n" );
for (i = Base, odp = OrdinalDefinitions + Base; i <= Limit; i++, odp++)
{
if (odp->type != TYPE_REGISTER) continue;
@@ -1021,7 +1024,10 @@
odp->u.func.link_name, odp->u.func.link_name,
odp->u.func.link_name, odp->u.func.link_name );
}
- fprintf( outfile, "#endif\n" );
+ fprintf( outfile, "#ifndef __GNUC__\n" );
+ fprintf( outfile, "}\n" );
+ fprintf( outfile, "#endif /* !defined(__GNUC__) */\n" );
+ fprintf( outfile, "#endif /* defined(__i386__) */\n" );
/* Output the DLL functions prototypes */
diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y
index 26593b1..9c6591f 100644
--- a/tools/wrc/parser.y
+++ b/tools/wrc/parser.y
@@ -85,14 +85,18 @@
* - Corrected syntax problems with an old yacc (;)
* - Added extra comment about grammar
*/
+#include "config.h"
+
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string.h>
+#ifdef HAVE_ALLOCA_H
+#include <alloca.h>
+#endif
-#include <config.h>
#include "wrc.h"
#include "utils.h"
#include "newstruc.h"