From 1bb9403938cecf3909b53c2ca987cd2b7425336b Mon Sep 17 00:00:00 2001 From: Patrik Stridvall Date: Sat, 8 May 1999 15:47:44 +0000 Subject: [PATCH] ANSI C fixes. --- configure | 360 ++++++++++++++++++++++++++++++++-------- configure.in | 1 + controls/edit.c | 31 ++-- controls/menu.c | 8 +- debugger/dbg.y | 5 + graphics/x11drv/xfont.c | 4 +- if1632/snoop.c | 6 +- include/config.h.in | 22 +++ include/server.h | 3 + include/stackframe.h | 4 +- ipc/bit_array.c | 15 +- misc/wsprintf.c | 2 +- miscemu/instr.c | 20 ++- msdos/ioports.c | 12 +- ole/datacache.c | 10 +- ole/defaulthandler.c | 6 +- ole/hglobalstream.c | 4 +- ole/memlockbytes.c | 4 +- scheduler/client.c | 66 ++++++-- scheduler/sysdeps.c | 2 +- server/socket.c | 65 ++++++-- server/trace.c | 3 + tools/build.c | 8 +- tools/wrc/parser.y | 6 +- 24 files changed, 515 insertions(+), 152 deletions(-) diff --git a/configure b/configure index e21af9730f1..4e5f5554f44 100755 --- a/configure +++ b/configure @@ -3953,31 +3953,138 @@ EOF 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 < +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 < +# 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 <&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 <&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 <&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 < 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 <&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 < +/* 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 @@ for ac_hdr in \ 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 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 @@ fi 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 < #include @@ -4154,12 +4383,12 @@ fi 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 <&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 @@ EOF 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 <&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 @@ EOF 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 < #include @@ -4282,7 +4511,7 @@ else #include 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 @@ rm -f conftest* 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 @@ -4317,7 +4546,7 @@ fi 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 @@ -4338,7 +4567,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -4349,7 +4578,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); 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 @@ EOF 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 < #if STDC_HEADERS @@ -4406,7 +4635,7 @@ EOF 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 @@ else ac_cv_sizeof_long_long=0 else cat > conftest.$ac_ext < main() @@ -4425,7 +4654,7 @@ main() 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 @@ EOF 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 < @@ -4471,7 +4700,7 @@ int main() { ; 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 @@ fi 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 < @@ -4518,7 +4747,7 @@ int main() { ; 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 @@ fi 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 < @@ -4565,7 +4794,7 @@ int main() { ; 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 @@ fi 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 @@ else wine_cv_statfs_bfree=no else cat > conftest.$ac_ext < @@ -4627,7 +4856,7 @@ int main() { ; 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 @@ EOF 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 @@ else wine_cv_statfs_bavail=no else cat > conftest.$ac_ext < @@ -4687,7 +4916,7 @@ int main() { ; 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 @@ fi 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 else cat > conftest.$ac_ext < @@ -4759,7 +4988,7 @@ else } 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 @@ fi 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 < #include @@ -4799,7 +5028,7 @@ int main() { 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%@C2MAN@%$C2MAN%g 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 516b211b3f5..7bd0ad754ae 100644 --- a/configure.in +++ b/configure.in @@ -438,6 +438,7 @@ fi dnl **** Check for functions **** +AC_FUNC_ALLOCA() AC_CHECK_FUNCS(\ _lwp_create \ clone \ diff --git a/controls/edit.c b/controls/edit.c index 8aa1e026d63..b2401263eee 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 #include "winnt.h" #include "win.h" @@ -113,8 +115,9 @@ typedef struct #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 @@ typedef struct (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 @@ typedef struct /* * 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 @@ static LRESULT EDIT_WM_VScroll(WND *wnd, EDITSTATE *es, INT action, INT pos, HWN * 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 @@ static __inline__ BOOL EDIT_EM_CanUndo(WND *wnd, EDITSTATE *es) * 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 @@ static __inline__ void EDIT_EM_EmptyUndoBuffer(WND *wnd, EDITSTATE *es) * 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 @@ static __inline__ void EDIT_WM_Clear(WND *wnd, EDITSTATE *es) * 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 4f4c712a50f..c2534faea0c 100644 --- a/controls/menu.c +++ b/controls/menu.c @@ -756,7 +756,7 @@ static void MENU_CalcItemSize( HDC hdc, MENUITEM *lpitem, HWND hwndOwner, 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 @@ static void MENU_DrawMenuItem( HWND hwnd, HMENU hmenu, HWND hwndOwner, HDC hdc, 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 26e56bacb29..2bd5302508d 100644 --- a/debugger/dbg.y +++ b/debugger/dbg.y @@ -6,12 +6,17 @@ * Copyright 1995 Morten Welinder */ +#include "config.h" + #include #include #include #include #include #include +#ifdef HAVE_ALLOCA_H +#include +#endif #include "winbase.h" #include "class.h" diff --git a/graphics/x11drv/xfont.c b/graphics/x11drv/xfont.c index bf18b88bba1..18acd08092d 100644 --- a/graphics/x11drv/xfont.c +++ b/graphics/x11drv/xfont.c @@ -2637,9 +2637,9 @@ BOOL X11DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT count, 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 6914d46b509..41989f334f1 100644 --- a/if1632/snoop.c +++ b/if1632/snoop.c @@ -265,19 +265,19 @@ void WINAPI SNOOP16_Entry(CONTEXT *context) { 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(""); 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 2a5a5c33be7..1438c12052a 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 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 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 do not work properly. */ #undef STAT_MACROS_BROKEN diff --git a/include/server.h b/include/server.h index 4581dbce5bd..228c4bb0623 100644 --- a/include/server.h +++ b/include/server.h @@ -501,12 +501,14 @@ struct create_pipe_reply /* 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_request }; struct read_console_input_reply { + int dummy; /* INPUT_RECORD records[0]; */ /* input records */ }; diff --git a/include/stackframe.h b/include/stackframe.h index cbe87e09557..5b9cb52077e 100644 --- a/include/stackframe.h +++ b/include/stackframe.h @@ -79,10 +79,10 @@ typedef void *VA_LIST16; (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 2a896651f56..0f9a5aaa15c 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 #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 @@ static void initialize_arrays() ** 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 @@ static __inline__ int find_zbit_in_integer(unsigned int integer) } /* 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 @@ static __inline__ int find_first_zero_bit(unsigned *array, int bits) 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 @@ static __inline__ int test_bit(int pos, unsigned *array) /* 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 @@ static __inline__ int clear_bit(int bit, int *mem) 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 dc282a02a81..e429971a085 100644 --- a/misc/wsprintf.c +++ b/misc/wsprintf.c @@ -382,7 +382,7 @@ INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, 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 95b5827c0ec..4ff44dc7794 100644 --- a/miscemu/instr.c +++ b/miscemu/instr.c @@ -23,7 +23,11 @@ DECLARE_DEBUG_CHANNEL(io) (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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) 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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) 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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) 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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) *(--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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) 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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) 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 @@ BOOL INSTR_EmulateInstruction( SIGCONTEXT *context ) 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 77940145e77..41f0931cd83 100644 --- a/msdos/ioports.c +++ b/msdos/ioports.c @@ -184,38 +184,38 @@ static void do_IO_port_init_read_or_write(char* temp, char rw) } } -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 ee03198d1b8..365878d7936 100644 --- a/ole/datacache.c +++ b/ole/datacache.c @@ -114,11 +114,11 @@ typedef struct DataCache DataCache; * 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 a25ae100380..51787a40218 100644 --- a/ole/defaulthandler.c +++ b/ole/defaulthandler.c @@ -107,9 +107,9 @@ typedef struct DefaultHandler DefaultHandler; * 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 73247c2f3e0..6346c8e0c32 100644 --- a/ole/hglobalstream.c +++ b/ole/hglobalstream.c @@ -426,7 +426,7 @@ HRESULT WINAPI HGLOBALStreamImpl_Read( */ 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 @@ HRESULT WINAPI HGLOBALStreamImpl_Write( */ 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 56f5cf67fb6..2381db89265 100644 --- a/ole/memlockbytes.c +++ b/ole/memlockbytes.c @@ -380,7 +380,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_ReadAt( supportBuffer = GlobalLock(This->supportHandle); memcpy(pv, - supportBuffer + ulOffset.LowPart, + (char *) supportBuffer + ulOffset.LowPart, bytesToReadFromBuffer); /* @@ -458,7 +458,7 @@ HRESULT WINAPI HGLOBALLockBytesImpl_WriteAt( */ 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 e013044a351..0bbac9d80ee 100644 --- a/scheduler/client.c +++ b/scheduler/client.c @@ -64,9 +64,9 @@ static void CLIENT_SendRequest_v( enum request req, int pass_fd, { 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 @@ static void CLIENT_SendRequest_v( enum request req, int pass_fd, 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 @@ void CLIENT_SendRequest( enum request req, int pass_fd, 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 @@ static unsigned int CLIENT_WaitReply_v( int *len, int *passed_fd, { 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 764a366ba76..08912177180 100644 --- a/scheduler/sysdeps.c +++ b/scheduler/sysdeps.c @@ -158,7 +158,7 @@ int SYSDEPS_SpawnThread( THDB *thread ) #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 ee0b023e1bb..371b10b06fb 100644 --- a/server/socket.c +++ b/server/socket.c @@ -70,10 +70,9 @@ static void do_write( struct client *client, int client_fd ) { 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 @@ static void do_write( struct client *client, int client_fd ) /* 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 @@ static void do_write( struct client *client, int client_fd ) 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 @@ static void do_read( struct client *client, int client_fd ) { 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 a51f954a679..a0a5e498615 100644 --- a/server/trace.c +++ b/server/trace.c @@ -453,11 +453,13 @@ static int dump_create_pipe_reply( struct create_pipe_reply *req, int len ) 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_request( struct read_console_input_request *r 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 4499b783053..f8789f014c0 100644 --- a/tools/build.c +++ b/tools/build.c @@ -1007,6 +1007,9 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) /* 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 @@ static int BuildSpec32File( char * specfile, FILE *outfile ) 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 26593b1f54a..9c6591f41a9 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 #include #include #include #include #include +#ifdef HAVE_ALLOCA_H +#include +#endif -#include #include "wrc.h" #include "utils.h" #include "newstruc.h"