msvcrt: scanf fix a typo

Alexandre Julliard julliard at winehq.org
Sun Sep 21 06:07:14 CDT 2008


Michael Karcher <wine at mkarcher.dialup.fu-berlin.de> writes:

> Sure I can, this was approach b I suggested. But that may be harmful to
> performance, as it forbids gcc to use any knowledge about the standard
> library (includes inlining of memcpy with small constant sizes or
> built-in pureness annotations).

If performance is an issue you most likely don't want to use msvcrt at
all, native Unix libc will always be faster. And knowing MS, they are
capable of adding an exception handler in memcpy someday...

> But the issue that started the discussion was: What to do about the
> scanf warning? On a system that does not have wchar builtins in gcc,
> currently all built-in functions are enabled. Even on these systems, we
> should disable the built-in scanf to prevent the warning in the scanf
> test. This need has long been unnoticed, as wchar ctype functions are
> built-in on our main development platform.

Just use -fno-builtin if it's supported, regardless of wchar
functions. This will fix scanf and avoid possible similar problems in
the future. Something like this should do the trick:

diff --git a/configure.ac b/configure.ac
index 27ae9ef..cda7f47 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1238,6 +1238,7 @@ then
   WINE_TRY_CFLAGS([-fshort-wchar],
                   [AC_DEFINE(CC_FLAG_SHORT_WCHAR, "-fshort-wchar",
                              [Specifies the compiler flag that forces a short wchar_t])])
+  WINE_TRY_CFLAGS([-fno-builtin],[AC_SUBST(BUILTINFLAG,"-fno-builtin")])
   WINE_TRY_CFLAGS([-fno-strict-aliasing])
   WINE_TRY_CFLAGS([-Wdeclaration-after-statement])
   WINE_TRY_CFLAGS([-Wwrite-strings])
@@ -1253,17 +1254,6 @@ then
   then
     EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith"
   fi
-
-  AC_SUBST(BUILTINFLAG,"")
-  saved_CFLAGS="$CFLAGS"
-  CFLAGS="$CFLAGS -Werror"
-  AC_CACHE_CHECK([for builtin wchar inlines], ac_cv_c_builtin_wchar_ctype,
-      AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[int iswlower(unsigned short);]])],[ac_cv_c_builtin_wchar_ctype=no],[ac_cv_c_builtin_wchar_ctype=yes]))
-  CFLAGS="$saved_CFLAGS"
-  if test "$ac_cv_c_builtin_wchar_ctype" = "yes"
-  then
-    BUILTINFLAG="-fno-builtin"
-  fi
 fi
 
 dnl **** Check how to define a function in assembly code ****

-- 
Alexandre Julliard
julliard at winehq.org



More information about the wine-devel mailing list