From e1b909242628af04ba73da4534249900ad003530 Mon Sep 17 00:00:00 2001 From: George Rhoten Date: Wed, 15 Aug 2012 17:46:17 +0000 Subject: [PATCH] ICU-9469 Improve support for C++11 X-SVN-Rev: 32179 --- icu4c/source/aclocal.m4 | 14 +-- icu4c/source/common/unicode/platform.h | 17 +-- icu4c/source/configure | 111 ++++++++++-------- icu4c/source/configure.in | 64 +++++----- icu4c/source/i18n/unicode/uspoof.h | 2 +- icu4c/source/i18n/uspoof.cpp | 4 +- icu4c/source/io/ufile.c | 8 +- icu4c/source/runConfigureICU | 4 +- icu4c/source/test/cintltst/cmsccoll.c | 4 +- icu4c/source/test/intltest/bytestrietest.cpp | 6 +- icu4c/source/test/intltest/intltest.cpp | 3 +- icu4c/source/test/intltest/numrgts.cpp | 4 +- icu4c/source/test/intltest/ucharstrietest.cpp | 6 +- icu4c/source/tools/ctestfw/uperf.cpp | 5 +- icu4c/source/tools/genrb/derb.c | 14 +-- icu4c/source/tools/toolutil/dbgutil.cpp | 4 +- icu4c/source/tools/toolutil/dbgutil.h | 4 +- 17 files changed, 140 insertions(+), 134 deletions(-) diff --git a/icu4c/source/aclocal.m4 b/icu4c/source/aclocal.m4 index e19cff824fe..a67979c50fc 100644 --- a/icu4c/source/aclocal.m4 +++ b/icu4c/source/aclocal.m4 @@ -452,15 +452,9 @@ AC_DEFUN(AC_CHECK_STRICT_COMPILE, then if test "$GCC" = yes then - case "${host}" in - *-*-solaris*) - CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";; - *-*-hpux*) - echo "# Note: We are not using '-ansi' with HP/UX GCC because int64_t broke, see " - CFLAGS="$CFLAGS -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";; - *) - CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";; - esac + # Do not use -ansi. It limits us to C90, and it breaks some platforms. + # We use -std=c99 to disable the gnu99 defaults and its associated warnings + CFLAGS="$CFLAGS -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" else case "${host}" in *-*-cygwin) @@ -472,7 +466,7 @@ AC_DEFUN(AC_CHECK_STRICT_COMPILE, fi if test "$GXX" = yes then - CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" + CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" else case "${host}" in *-*-cygwin) diff --git a/icu4c/source/common/unicode/platform.h b/icu4c/source/common/unicode/platform.h index 50c121b9b02..e16717376a3 100644 --- a/icu4c/source/common/unicode/platform.h +++ b/icu4c/source/common/unicode/platform.h @@ -635,8 +635,13 @@ * does not support u"abc" string literals. * gcc 4.4 defines the __CHAR16_TYPE__ macro to a usable type but * does not support u"abc" string literals. + * C++11 requires support for UTF-16 literals */ -# define U_HAVE_CHAR16_T 0 +# if (defined(__cplusplus) && __cplusplus >= 201103L) +# define U_HAVE_CHAR16_T 1 +# else +# define U_HAVE_CHAR16_T 0 +# endif #endif /** @@ -648,15 +653,11 @@ */ #ifdef U_DECLARE_UTF16 /* Use the predefined value. */ -#elif (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ +#elif U_HAVE_CHAR16_T \ + || (defined(__xlC__) && defined(__IBM_UTF_LITERAL) && U_SIZEOF_WCHAR_T != 2) \ || (defined(__HP_aCC) && __HP_aCC >= 035000) \ - || (defined(__HP_cc) && __HP_cc >= 111106) \ - || U_HAVE_CHAR16_T + || (defined(__HP_cc) && __HP_cc >= 111106) # define U_DECLARE_UTF16(string) u ## string -#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x550) -/* || (defined(__SUNPRO_C) && __SUNPRO_C >= 0x580) */ -/* Sun's C compiler has issues with this notation, and it's unreliable. */ -# define U_DECLARE_UTF16(string) U ## string #elif U_SIZEOF_WCHAR_T == 2 \ && (U_CHARSET_FAMILY == 0 || (U_PF_OS390 <= U_PLATFORM && U_PLATFORM <= U_PF_OS400 && defined(__UCS2__))) # define U_DECLARE_UTF16(string) L ## string diff --git a/icu4c/source/configure b/icu4c/source/configure index cf4ddb75e1a..337dd70c65c 100755 --- a/icu4c/source/configure +++ b/icu4c/source/configure @@ -621,8 +621,6 @@ pkgicudatadir LAYOUT_TRUE ICUIO_TRUE EXTRAS_TRUE -U_CHECK_UTF16_STRING -U_CHECK_GNUC_UTF16_STRING U_HAVE_WCSCPY U_HAVE_WCHAR_H U_TIMEZONE @@ -634,7 +632,6 @@ U_HAVE_TZSET U_HAVE_POPEN U_HAVE_PLACEMENT_NEW U_OVERRIDE_CXX_ALLOCATION -U_HAVE_NAMESPACE U_NL_LANGINFO_CODESET U_HAVE_NL_LANGINFO_CODESET U_IS_BIG_ENDIAN @@ -2742,7 +2739,7 @@ $as_echo "$enabled" >&6; } : ${CFLAGS=""} : ${CXXFLAGS=""} -# Checks for programs +# Checks for compilers ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3533,6 +3530,8 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu +# Make sure that we try clang++ first, which provides C++11 support. +# The g++ compiler is less likely to support C++11. ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -3543,7 +3542,7 @@ if test -z "$CXX"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe FCC KCC RCC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 @@ -3587,7 +3586,7 @@ fi fi if test -z "$CXX"; then ac_ct_CXX=$CXX - for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC + for ac_prog in clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe FCC KCC RCC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 @@ -4257,15 +4256,9 @@ $as_echo "$ac_use_strict_options" >&6; } then if test "$GCC" = yes then - case "${host}" in - *-*-solaris*) - CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";; - *-*-hpux*) - echo "# Note: We are not using '-ansi' with HP/UX GCC because int64_t broke, see " - CFLAGS="$CFLAGS -Wall -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";; - *) - CFLAGS="$CFLAGS -Wall -ansi -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings -Wno-long-long";; - esac + # Do not use -ansi. It limits us to C90, and it breaks some platforms. + # We use -std=c99 to disable the gnu99 defaults and its associated warnings + CFLAGS="$CFLAGS -Wall -std=c99 -pedantic -Wshadow -Wpointer-arith -Wmissing-prototypes -Wwrite-strings" else case "${host}" in *-*-cygwin) @@ -4277,7 +4270,7 @@ $as_echo "$ac_use_strict_options" >&6; } fi if test "$GXX" = yes then - CXXFLAGS="$CXXFLAGS -W -Wall -ansi -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" + CXXFLAGS="$CXXFLAGS -W -Wall -pedantic -Wpointer-arith -Wwrite-strings -Wno-long-long" else case "${host}" in *-*-cygwin) @@ -5248,7 +5241,7 @@ $as_echo_n "checking whether we can use static library optimization option... " case "${host}" in *-linux*|i*86-*-*bsd*|i*86-pc-gnu) - if test "$ac_cv_c_compiler_gnu" = yes; then + if test "$GCC" = yes; then CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections" LDFLAGS="${LDFLAGS} -Wl,--gc-sections" fi @@ -6503,14 +6496,11 @@ fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_namespace_ok" >&5 $as_echo "$ac_cv_namespace_ok" >&6; } -U_HAVE_NAMESPACE=1 if test $ac_cv_namespace_ok = no then as_fn_error $? "Namespace support is required to build ICU." "$LINENO" 5 - U_HAVE_NAMESPACE=0 fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for properly overriding new and delete" >&5 $as_echo_n "checking for properly overriding new and delete... " >&6; } U_OVERRIDE_CXX_ALLOCATION=0 @@ -7091,7 +7081,7 @@ CHECK_UTF16_STRING_RESULT="unknown" case "${host}" in *-*-aix*|powerpc64-*-linux*) - if test "$ac_cv_c_compiler_gnu" = no; then + if test "$GCC" = no; then OLD_CFLAGS="${CFLAGS}" OLD_CXXFLAGS="${CXXFLAGS}" CFLAGS="${CFLAGS} -qutf" @@ -7122,7 +7112,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ;; *-*-solaris*) - if test "$ac_cv_c_compiler_gnu" = no; then + if test "$GCC" = no; then OLD_CFLAGS="${CFLAGS}" OLD_CXXFLAGS="${CXXFLAGS}" CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort" @@ -7161,7 +7151,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ;; *-*-hpux*) - if test "$ac_cv_c_compiler_gnu" = no; then + if test "$GCC" = no; then # The option will be detected at compile time without additional compiler options. CHECK_UTF16_STRING_RESULT="available" fi @@ -7175,25 +7165,14 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext esac # GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future. -# Since we have to use a different standard, if strict is enable, don't enable UTF16 string literals. -U_CHECK_GNUC_UTF16_STRING=0 -if test "$ac_use_strict_options" = no && test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then - if test "$ac_cv_c_compiler_gnu" = yes; then +if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then + if test "$GCC" = yes; then OLD_CFLAGS="${CFLAGS}" - OLD_CXXFLAGS="${CXXFLAGS}" - CFLAGS="${CFLAGS} -std=gnu99 -D_GCC_" - CXXFLAGS="${CXXFLAGS} -std=c++0x" + CFLAGS="${CFLAGS} -std=gnu99" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -#ifdef _GCC_ -typedef __CHAR16_TYPE__ char16_t; -#endif -char16_t test[] = u"This is a UTF16 literal string."; -#else -GCC IS TOO OLD! -#endif +static const char16_t test[] = u"This is a UTF16 literal string."; int main () @@ -7204,26 +7183,66 @@ main () } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : - U_CHECK_UTF16_STRING=1 + CC_UTF16_STRING=1 else - U_CHECK_UTF16_STRING=0 + CC_UTF16_STRING=0 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - if test "$U_CHECK_UTF16_STRING" = 1; then - CHECK_UTF16_STRING_RESULT="available"; - U_CHECK_GNUC_UTF16_STRING=1 + if test "$CC_UTF16_STRING" = 1; then + CHECK_UTF16_STRING_RESULT="C only"; else CFLAGS="${OLD_CFLAGS}" - CXXFLAGS="${OLD_CXXFLAGS}" fi fi -fi + if test "$GXX" = yes; then + OLD_CXXFLAGS="${CXXFLAGS}" + # -Wno-return-type-c-linkage is desired so that stable ICU API is not warned about. + CXXFLAGS="${CXXFLAGS} -std=c++11" + ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +static const char16_t test[] = u"This is a UTF16 literal string."; + +int +main () +{ + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + CXX_UTF16_STRING=1 +else + CXX_UTF16_STRING=0 +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + if test "$CXX_UTF16_STRING" = 1; then + if test "$CC_UTF16_STRING" = 1; then + CHECK_UTF16_STRING_RESULT="available"; + else + CHECK_UTF16_STRING_RESULT="C++ only"; + fi + else + CXXFLAGS="${OLD_CXXFLAGS}" + fi + fi +fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CHECK_UTF16_STRING_RESULT" >&5 $as_echo "$CHECK_UTF16_STRING_RESULT" >&6; } - # Enable/disable extras # Check whether --enable-extras was given. if test "${enable_extras+set}" = set; then : diff --git a/icu4c/source/configure.in b/icu4c/source/configure.in index 897d1c2c0b3..09ff425a6b0 100644 --- a/icu4c/source/configure.in +++ b/icu4c/source/configure.in @@ -120,9 +120,11 @@ AC_SUBST(ENABLE_RELEASE) : ${CFLAGS=""} : ${CXXFLAGS=""} -# Checks for programs +# Checks for compilers AC_PROG_CC -AC_PROG_CXX +# Make sure that we try clang++ first, which provides C++11 support. +# The g++ compiler is less likely to support C++11. +AC_PROG_CXX([clang++ g++ c++ gpp xlC_r xlC aCC CC cxx cc++ cl.exe FCC KCC RCC]) # Ensure that if CXXFLAGS/CFLAGS were not set when calling configure, set it correctly based on (enable/disable) debug or release option # The release mode use is the default one for autoconf @@ -276,7 +278,7 @@ if test "$ENABLE_STATIC" = "YES"; then case "${host}" in *-linux*|i*86-*-*bsd*|i*86-pc-gnu) - if test "$ac_cv_c_compiler_gnu" = yes; then + if test "$GCC" = yes; then CPPFLAGS="${CPPFLAGS} -ffunction-sections -fdata-sections" LDFLAGS="${LDFLAGS} -Wl,--gc-sections" fi @@ -676,13 +678,10 @@ AC_CACHE_VAL(ac_cv_namespace_ok, using namespace x_version; ], [f();])],[ac_cv_namespace_ok=yes],[ac_cv_namespace_ok=no])] ) AC_MSG_RESULT($ac_cv_namespace_ok) -U_HAVE_NAMESPACE=1 if test $ac_cv_namespace_ok = no then AC_MSG_ERROR(Namespace support is required to build ICU.) - U_HAVE_NAMESPACE=0 fi -AC_SUBST(U_HAVE_NAMESPACE) AC_MSG_CHECKING([for properly overriding new and delete]) U_OVERRIDE_CXX_ALLOCATION=0 @@ -905,7 +904,7 @@ CHECK_UTF16_STRING_RESULT="unknown" case "${host}" in *-*-aix*|powerpc64-*-linux*) - if test "$ac_cv_c_compiler_gnu" = no; then + if test "$GCC" = no; then OLD_CFLAGS="${CFLAGS}" OLD_CXXFLAGS="${CXXFLAGS}" CFLAGS="${CFLAGS} -qutf" @@ -920,7 +919,7 @@ case "${host}" in fi ;; *-*-solaris*) - if test "$ac_cv_c_compiler_gnu" = no; then + if test "$GCC" = no; then OLD_CFLAGS="${CFLAGS}" OLD_CXXFLAGS="${CXXFLAGS}" CFLAGS="${CFLAGS} -xustr=ascii_utf16_ushort" @@ -943,7 +942,7 @@ case "${host}" in fi ;; *-*-hpux*) - if test "$ac_cv_c_compiler_gnu" = no; then + if test "$GCC" = no; then # The option will be detected at compile time without additional compiler options. CHECK_UTF16_STRING_RESULT="available" fi @@ -957,37 +956,40 @@ case "${host}" in esac # GCC >= 4.4 supports UTF16 string literals. The CFLAGS and CXXFLAGS may change in the future. -# Since we have to use a different standard, if strict is enable, don't enable UTF16 string literals. -U_CHECK_GNUC_UTF16_STRING=0 -if test "$ac_use_strict_options" = no && test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then - if test "$ac_cv_c_compiler_gnu" = yes; then +if test "$CHECK_UTF16_STRING_RESULT" = "unknown"; then + if test "$GCC" = yes; then OLD_CFLAGS="${CFLAGS}" - OLD_CXXFLAGS="${CXXFLAGS}" - CFLAGS="${CFLAGS} -std=gnu99 -D_GCC_" - CXXFLAGS="${CXXFLAGS} -std=c++0x" + CFLAGS="${CFLAGS} -std=gnu99" AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ -#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4) -#ifdef _GCC_ -typedef __CHAR16_TYPE__ char16_t; -#endif -char16_t test[] = u"This is a UTF16 literal string."; -#else -GCC IS TOO OLD! -#endif - ]], [[]])],[U_CHECK_UTF16_STRING=1],[U_CHECK_UTF16_STRING=0]) - if test "$U_CHECK_UTF16_STRING" = 1; then - CHECK_UTF16_STRING_RESULT="available"; - U_CHECK_GNUC_UTF16_STRING=1 +static const char16_t test[] = u"This is a UTF16 literal string."; + ]], [[]])],[CC_UTF16_STRING=1],[CC_UTF16_STRING=0]) + if test "$CC_UTF16_STRING" = 1; then + CHECK_UTF16_STRING_RESULT="C only"; else CFLAGS="${OLD_CFLAGS}" + fi + fi + if test "$GXX" = yes; then + OLD_CXXFLAGS="${CXXFLAGS}" + # -Wno-return-type-c-linkage is desired so that stable ICU API is not warned about. + CXXFLAGS="${CXXFLAGS} -std=c++11" + AC_LANG_PUSH([C++]) + AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ +static const char16_t test[] = u"This is a UTF16 literal string."; + ]], [[]])],[CXX_UTF16_STRING=1],[CXX_UTF16_STRING=0]) + AC_LANG_POP([C++]) + if test "$CXX_UTF16_STRING" = 1; then + if test "$CC_UTF16_STRING" = 1; then + CHECK_UTF16_STRING_RESULT="available"; + else + CHECK_UTF16_STRING_RESULT="C++ only"; + fi + else CXXFLAGS="${OLD_CXXFLAGS}" fi fi fi -AC_SUBST(U_CHECK_GNUC_UTF16_STRING) - AC_MSG_RESULT($CHECK_UTF16_STRING_RESULT) -AC_SUBST(U_CHECK_UTF16_STRING) # Enable/disable extras AC_ARG_ENABLE(extras, diff --git a/icu4c/source/i18n/unicode/uspoof.h b/icu4c/source/i18n/unicode/uspoof.h index 478b7b64546..e59d314c266 100644 --- a/icu4c/source/i18n/unicode/uspoof.h +++ b/icu4c/source/i18n/unicode/uspoof.h @@ -847,7 +847,7 @@ uspoof_getSkeletonUTF8(const USpoofChecker *sc, * * @stable ICU 4.2 */ -U_STABLE icu::UnicodeString & U_EXPORT2 +U_I18N_API icu::UnicodeString & U_EXPORT2 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, uint32_t type, const icu::UnicodeString &s, diff --git a/icu4c/source/i18n/uspoof.cpp b/icu4c/source/i18n/uspoof.cpp index 72bb7edae41..a8984329e6b 100644 --- a/icu4c/source/i18n/uspoof.cpp +++ b/icu4c/source/i18n/uspoof.cpp @@ -1,6 +1,6 @@ /* *************************************************************************** -* Copyright (C) 2008-2011, International Business Machines Corporation +* Copyright (C) 2008-2012, International Business Machines Corporation * and others. All Rights Reserved. *************************************************************************** * file name: uspoof.cpp @@ -713,7 +713,7 @@ uspoof_getSkeleton(const USpoofChecker *sc, -U_CAPI UnicodeString & U_EXPORT2 +U_I18N_API UnicodeString & U_EXPORT2 uspoof_getSkeletonUnicodeString(const USpoofChecker *sc, uint32_t type, const UnicodeString &s, diff --git a/icu4c/source/io/ufile.c b/icu4c/source/io/ufile.c index e49d5b95dc5..2aca838fff4 100644 --- a/icu4c/source/io/ufile.c +++ b/icu4c/source/io/ufile.c @@ -1,7 +1,7 @@ /* ****************************************************************************** * -* Copyright (C) 1998-2011, International Business Machines +* Copyright (C) 1998-2012, International Business Machines * Corporation and others. All Rights Reserved. * ****************************************************************************** @@ -18,12 +18,6 @@ ****************************************************************************** */ -/* - * Defines _XOPEN_SOURCE for access to POSIX functions. - * Must be before any other #includes. - */ -#include "uposixdefs.h" - #include "locmap.h" #include "unicode/ustdio.h" #include "ufile.h" diff --git a/icu4c/source/runConfigureICU b/icu4c/source/runConfigureICU index dbedb7814e2..432f9fb3677 100755 --- a/icu4c/source/runConfigureICU +++ b/icu4c/source/runConfigureICU @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (c) 1999-2011, International Business Machines Corporation and +# Copyright (c) 1999-2012, International Business Machines Corporation and # others. All Rights Reserved. # runConfigureICU: This script will run the "configure" script for the appropriate platform @@ -227,8 +227,6 @@ case $platform in Linux*) THE_OS="Linux" THE_COMP="the GNU C++" - CC=gcc; export CC - CXX=g++; export CXX DEBUG_CFLAGS='-g -O0' DEBUG_CXFLAGS='-g -O0' ;; diff --git a/icu4c/source/test/cintltst/cmsccoll.c b/icu4c/source/test/cintltst/cmsccoll.c index 3ec30d377f3..243da6e5555 100644 --- a/icu4c/source/test/cintltst/cmsccoll.c +++ b/icu4c/source/test/cintltst/cmsccoll.c @@ -4674,7 +4674,7 @@ static void TestBeforeTightening(void) { } -#if 0 +/* &m < a &[before 1] a < x <<< X << q <<< Q < z assert: m <<< M < x <<< X << q <<< Q < z < a < n @@ -4732,7 +4732,7 @@ assert: x <<< X << q <<< Q << m <<< \u24DC <<< M < z < n &[before 3] \u24DC <<< x <<< X << q <<< Q < z assert: m <<< x <<< X <<< \u24DC <<< M << q <<< Q < z < n -#endif +*/ #if 0 diff --git a/icu4c/source/test/intltest/bytestrietest.cpp b/icu4c/source/test/intltest/bytestrietest.cpp index 12101d2f0c8..2d7fa6ed082 100644 --- a/icu4c/source/test/intltest/bytestrietest.cpp +++ b/icu4c/source/test/intltest/bytestrietest.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2010-2011, International Business Machines +* Copyright (C) 2010-2012, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: bytetrietest.cpp @@ -170,7 +170,7 @@ void BytesTrieTest::TestBranches() { { "t", 0x400000 }, { "uu", 0x800000 }, { "vv", 0x7fffffff }, - { "zz", 0x80000000 } + { "zz", (int32_t)0x80000000 } }; for(int32_t length=2; length<=LENGTHOF(data); ++length) { infoln("TestBranches length=%d", (int)length); @@ -217,7 +217,7 @@ void BytesTrieTest::TestLongBranch() { { "r", 0x333333 }, { "s2345", 0x4444444 }, { "t234567890", 0x77777777 }, - { "z", 0x80000001 } + { "z", (int32_t)0x80000001 } }; checkData(data, LENGTHOF(data)); } diff --git a/icu4c/source/test/intltest/intltest.cpp b/icu4c/source/test/intltest/intltest.cpp index ff26c64de3e..de4bf25621d 100644 --- a/icu4c/source/test/intltest/intltest.cpp +++ b/icu4c/source/test/intltest/intltest.cpp @@ -653,7 +653,7 @@ UBool IntlTest::runTest( char* name, char* par, char *baseName ) } // call individual tests, to be overriden to call implementations -void IntlTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ) +void IntlTest::runIndexedTest( int32_t /*index*/, UBool /*exec*/, const char* & /*name*/, char* /*par*/ ) { // to be overriden by a method like: /* @@ -664,7 +664,6 @@ void IntlTest::runIndexedTest( int32_t index, UBool exec, const char* &name, cha } */ this->errln("*** runIndexedTest needs to be overriden! ***"); - name = ""; exec = exec; index = index; par = par; } diff --git a/icu4c/source/test/intltest/numrgts.cpp b/icu4c/source/test/intltest/numrgts.cpp index 8617bfc099d..3f725291fcb 100644 --- a/icu4c/source/test/intltest/numrgts.cpp +++ b/icu4c/source/test/intltest/numrgts.cpp @@ -29,10 +29,10 @@ public: virtual UnicodeString& format( double number, UnicodeString& toAppendTo, - FieldPosition& pos, + FieldPositionIterator* posIter, UErrorCode& status) const { - return NumberFormat::format(number, toAppendTo, pos, status); + return NumberFormat::format(number, toAppendTo, posIter, status); } /* Just keep this here to make some of the compilers happy */ diff --git a/icu4c/source/test/intltest/ucharstrietest.cpp b/icu4c/source/test/intltest/ucharstrietest.cpp index b44789f1de6..26c5d720cff 100644 --- a/icu4c/source/test/intltest/ucharstrietest.cpp +++ b/icu4c/source/test/intltest/ucharstrietest.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 2010-2011, International Business Machines +* Copyright (C) 2010-2012, International Business Machines * Corporation and others. All Rights Reserved. ******************************************************************************* * file name: ucharstrietest.cpp @@ -179,7 +179,7 @@ void UCharsTrieTest::TestBranches() { { "t", 0x400000 }, { "uu", 0x800000 }, { "vv", 0x7fffffff }, - { "zz", 0x80000000 } + { "zz", (int32_t)0x80000000 } }; for(int32_t length=2; length<=LENGTHOF(data); ++length) { infoln("TestBranches length=%d", (int)length); @@ -226,7 +226,7 @@ void UCharsTrieTest::TestLongBranch() { { "r", 0x333333 }, { "s2345", 0x4444444 }, { "t234567890", 0x77777777 }, - { "z", 0x80000001 } + { "z", (int32_t)0x80000001 } }; checkData(data, LENGTHOF(data)); } diff --git a/icu4c/source/tools/ctestfw/uperf.cpp b/icu4c/source/tools/ctestfw/uperf.cpp index e8c34391127..9ff20edccaa 100644 --- a/icu4c/source/tools/ctestfw/uperf.cpp +++ b/icu4c/source/tools/ctestfw/uperf.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2002-2011, International Business Machines Corporation and + * Copyright (c) 2002-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -322,7 +322,7 @@ void UPerfTest::setPath( char* pathVal ) } // call individual tests, to be overriden to call implementations -UPerfFunction* UPerfTest::runIndexedTest( int32_t index, UBool exec, const char* &name, char* par ) +UPerfFunction* UPerfTest::runIndexedTest( int32_t /*index*/, UBool /*exec*/, const char* & /*name*/, char* /*par*/ ) { // to be overriden by a method like: /* @@ -333,7 +333,6 @@ UPerfFunction* UPerfTest::runIndexedTest( int32_t index, UBool exec, const char* } */ fprintf(stderr,"*** runIndexedTest needs to be overriden! ***"); - name = ""; exec = exec; index = index; par = par; return NULL; } diff --git a/icu4c/source/tools/genrb/derb.c b/icu4c/source/tools/genrb/derb.c index 65db73eba50..2a48d98f542 100644 --- a/icu4c/source/tools/genrb/derb.c +++ b/icu4c/source/tools/genrb/derb.c @@ -1,7 +1,7 @@ /* ******************************************************************************* * -* Copyright (C) 1999-2011, International Business Machines +* Copyright (C) 1999-2012, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -54,7 +54,7 @@ static UConverter *defaultConverter = 0; static const int32_t indentsize = 4; static int32_t truncsize = DERB_DEFAULT_TRUNC; -static UBool trunc = FALSE; +static UBool truncate = FALSE; static const char *getEncodingName(const char *encoding); static void reportError(const char *pname, UErrorCode *status, const char *when); @@ -152,14 +152,14 @@ main(int argc, char* argv[]) { } if(options[4].doesOccur) { - trunc = TRUE; + truncate = TRUE; if(options[4].value != NULL) { truncsize = atoi(options[4].value); /* user defined printable size */ } else { truncsize = DERB_DEFAULT_TRUNC; /* we'll use default omitting size */ } } else { - trunc = FALSE; + truncate = FALSE; } if(options[5].doesOccur) { @@ -473,7 +473,7 @@ static void printOutAlias(FILE *out, UConverter *converter, UResourceBundle *pa int32_t len = 0; const UChar* thestr = res_getAlias(&(parent->fResData), r, &len); UChar *string = quotedString(thestr); - if(trunc && len > truncsize) { + if(truncate && len > truncsize) { char msg[128]; printIndent(out, converter, indent); sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", @@ -517,7 +517,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re UChar *string = quotedString(thestr); /* TODO: String truncation */ - if(trunc && len > truncsize) { + if(truncate && len > truncsize) { char msg[128]; printIndent(out, converter, indent); sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", @@ -576,7 +576,7 @@ static void printOutBundle(FILE *out, UConverter *converter, UResourceBundle *re { int32_t len = 0; const int8_t *data = (const int8_t *)ures_getBinary(resource, &len, status); - if(trunc && len > truncsize) { + if(truncate && len > truncsize) { char msg[128]; printIndent(out, converter, indent); sprintf(msg, "// WARNING: this resource, size %li is truncated to %li\n", diff --git a/icu4c/source/tools/toolutil/dbgutil.cpp b/icu4c/source/tools/toolutil/dbgutil.cpp index c0254554ae1..d4c87735689 100644 --- a/icu4c/source/tools/toolutil/dbgutil.cpp +++ b/icu4c/source/tools/toolutil/dbgutil.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 2007-2010, International Business Machines Corporation and + * Copyright (c) 2007-2012, International Business Machines Corporation and * others. All Rights Reserved. ********************************************************************/ @@ -74,7 +74,7 @@ static void udbg_setup(void) { -U_CAPI const UnicodeString& U_EXPORT2 udbg_enumString(UDebugEnumType type, int32_t field) { +U_TOOLUTIL_API const UnicodeString& U_EXPORT2 udbg_enumString(UDebugEnumType type, int32_t field) { if(strs == NULL ) { udbg_setup(); } diff --git a/icu4c/source/tools/toolutil/dbgutil.h b/icu4c/source/tools/toolutil/dbgutil.h index 9e5b6c88af8..d76b72baa2f 100644 --- a/icu4c/source/tools/toolutil/dbgutil.h +++ b/icu4c/source/tools/toolutil/dbgutil.h @@ -1,7 +1,7 @@ /* ************************************************************************ -* Copyright (c) 2007-2011, International Business Machines +* Copyright (c) 2007-2012, International Business Machines * Corporation and others. All Rights Reserved. ************************************************************************ */ @@ -17,7 +17,7 @@ #if !UCONFIG_NO_FORMATTING -U_CAPI const icu::UnicodeString& U_EXPORT2 +U_TOOLUTIL_API const icu::UnicodeString& U_EXPORT2 udbg_enumString(UDebugEnumType type, int32_t field); /** -- 2.40.0