From 4934b397a816d8d1772832358d0ea78a45e626f1 Mon Sep 17 00:00:00 2001 From: Jungshik Shin Date: Thu, 28 Jun 2012 23:28:00 +0000 Subject: [PATCH] ICU-8343 fix build errors in Visual Studio when exception is disabled X-SVN-Rev: 32010 --- .gitattributes | 1 + icu4c/source/common/rbbi.cpp | 2 +- icu4c/source/common/schriter.cpp | 4 ++-- icu4c/source/common/stringtriebuilder.cpp | 4 ++-- icu4c/source/common/uchriter.cpp | 4 ++-- icu4c/source/common/ustrenum.cpp | 4 ++-- icu4c/source/common/utypeinfo.h | 27 +++++++++++++++++++++++ icu4c/source/i18n/calendar.cpp | 2 +- icu4c/source/i18n/currfmt.cpp | 2 +- icu4c/source/i18n/currunit.cpp | 4 ++-- icu4c/source/i18n/dtitvfmt.cpp | 4 ++-- icu4c/source/i18n/dtrule.cpp | 4 ++-- icu4c/source/i18n/format.cpp | 4 ++-- icu4c/source/i18n/measure.cpp | 4 ++-- icu4c/source/i18n/nfsubs.cpp | 4 ++-- icu4c/source/i18n/olsontz.cpp | 2 +- icu4c/source/i18n/rbnf.cpp | 2 +- icu4c/source/i18n/rbtz.cpp | 4 ++-- icu4c/source/i18n/selfmt.cpp | 4 ++-- icu4c/source/i18n/simpletz.cpp | 4 ++-- icu4c/source/i18n/tblcoll.cpp | 2 +- icu4c/source/i18n/timezone.cpp | 2 +- icu4c/source/i18n/tmunit.cpp | 4 ++-- icu4c/source/i18n/tmutfmt.cpp | 2 +- icu4c/source/i18n/translit.cpp | 4 ++-- icu4c/source/i18n/tzrule.cpp | 4 ++-- icu4c/source/i18n/tztrans.cpp | 4 ++-- icu4c/source/i18n/ucal.cpp | 2 +- icu4c/source/i18n/vtzone.cpp | 4 ++-- icu4c/source/test/intltest/citrtest.cpp | 4 ++-- icu4c/source/test/intltest/icusvtst.cpp | 4 ++-- icu4c/source/test/intltest/rbbitst.cpp | 2 +- icu4c/source/test/intltest/uobjtest.cpp | 4 ++-- 33 files changed, 80 insertions(+), 52 deletions(-) create mode 100644 icu4c/source/common/utypeinfo.h diff --git a/.gitattributes b/.gitattributes index 4b9402d9774..6a9523dec9f 100644 --- a/.gitattributes +++ b/.gitattributes @@ -52,6 +52,7 @@ icu4c/icu4c.css -text icu4c/source/allinone/icucheck.bat -text icu4c/source/common/common.vcxproj -text icu4c/source/common/common.vcxproj.filters -text +icu4c/source/common/utypeinfo.h -text icu4c/source/data/curr/pool.res -text icu4c/source/data/in/coll/invuca.icu -text icu4c/source/data/in/coll/ucadata.icu -text diff --git a/icu4c/source/common/rbbi.cpp b/icu4c/source/common/rbbi.cpp index f76d02ae294..b251a1dd7e3 100644 --- a/icu4c/source/common/rbbi.cpp +++ b/icu4c/source/common/rbbi.cpp @@ -10,7 +10,7 @@ // class RuleBasedBreakIterator // -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/common/schriter.cpp b/icu4c/source/common/schriter.cpp index b2263390c69..17ce4001869 100644 --- a/icu4c/source/common/schriter.cpp +++ b/icu4c/source/common/schriter.cpp @@ -1,6 +1,6 @@ /* ****************************************************************************** -* Copyright (C) 1998-2010, International Business Machines Corporation and +* Copyright (C) 1998-2012, International Business Machines Corporation and * others. All Rights Reserved. ****************************************************************************** * @@ -13,7 +13,7 @@ ****************************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/chariter.h" #include "unicode/schriter.h" diff --git a/icu4c/source/common/stringtriebuilder.cpp b/icu4c/source/common/stringtriebuilder.cpp index e3e58eb6c4f..32a931130ce 100644 --- a/icu4c/source/common/stringtriebuilder.cpp +++ b/icu4c/source/common/stringtriebuilder.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: stringtriebuilder.cpp @@ -12,7 +12,7 @@ * created by: Markus W. Scherer */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" #include "unicode/stringtriebuilder.h" #include "uassert.h" diff --git a/icu4c/source/common/uchriter.cpp b/icu4c/source/common/uchriter.cpp index 2d59e167a1d..40b06ce5acf 100644 --- a/icu4c/source/common/uchriter.cpp +++ b/icu4c/source/common/uchriter.cpp @@ -1,11 +1,11 @@ /* ****************************************************************************** -* Copyright (C) 1998-2011, International Business Machines Corporation and +* Copyright (C) 1998-2012, International Business Machines Corporation and * others. All Rights Reserved. ****************************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/uchriter.h" #include "unicode/ustring.h" diff --git a/icu4c/source/common/ustrenum.cpp b/icu4c/source/common/ustrenum.cpp index 4f0b721b821..3956615db31 100644 --- a/icu4c/source/common/ustrenum.cpp +++ b/icu4c/source/common/ustrenum.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2002-2011, International Business Machines +* Copyright (c) 2002-2012, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -8,7 +8,7 @@ * Since: ICU 2.4 ********************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/ustring.h" #include "unicode/strenum.h" diff --git a/icu4c/source/common/utypeinfo.h b/icu4c/source/common/utypeinfo.h new file mode 100644 index 00000000000..4de16d6d790 --- /dev/null +++ b/icu4c/source/common/utypeinfo.h @@ -0,0 +1,27 @@ +/* +****************************************************************************** +* +* Copyright (C) 2012, International Business Machines +* Corporation and others. All Rights Reserved. +* +****************************************************************************** +*/ + +#ifndef __UTYPEINFO_H__ +#define __UTYPEINFO_H__ + +// Windows header does not define 'exception' in 'std' namespace. +// Therefore, a project using ICU cannot be compiled with _HAS_EXCEPTION +// set to 0 on Windows with Visual Studio. To work around that, we have to +// include explicilty and add using statement below. +// Whenever 'typeid' is used, this header has to be included +// instead of . +// Visual Stuido 10 emits warning 4275 with this change. If you compile +// with exception disabled, you have to suppress warning 4275. +#if defined(_MSC_VER) && _HAS_EXCEPTIONS == 0 +#include +using std::exception; +#endif +#include // for 'typeid' to work + +#endif diff --git a/icu4c/source/i18n/calendar.cpp b/icu4c/source/i18n/calendar.cpp index 41671de5658..2e5560f2a51 100644 --- a/icu4c/source/i18n/calendar.cpp +++ b/icu4c/source/i18n/calendar.cpp @@ -24,7 +24,7 @@ ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/currfmt.cpp b/icu4c/source/i18n/currfmt.cpp index d3de2ab633d..97be9730f35 100644 --- a/icu4c/source/i18n/currfmt.cpp +++ b/icu4c/source/i18n/currfmt.cpp @@ -8,7 +8,7 @@ * Since: ICU 3.0 ********************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/currunit.cpp b/icu4c/source/i18n/currunit.cpp index 47cba6253aa..870d9d0c4ce 100644 --- a/icu4c/source/i18n/currunit.cpp +++ b/icu4c/source/i18n/currunit.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2004-2010, International Business Machines +* Copyright (c) 2004-2012, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -8,7 +8,7 @@ * Since: ICU 3.0 ********************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/dtitvfmt.cpp b/icu4c/source/i18n/dtitvfmt.cpp index 79f67ab6058..fbf8787c1ec 100644 --- a/icu4c/source/i18n/dtitvfmt.cpp +++ b/icu4c/source/i18n/dtitvfmt.cpp @@ -1,5 +1,5 @@ /******************************************************************************* -* Copyright (C) 2008-2011, International Business Machines Corporation and +* Copyright (C) 2008-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* * @@ -8,7 +8,7 @@ ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/dtitvfmt.h" diff --git a/icu4c/source/i18n/dtrule.cpp b/icu4c/source/i18n/dtrule.cpp index c2eeb052a40..b8fd30ea973 100644 --- a/icu4c/source/i18n/dtrule.cpp +++ b/icu4c/source/i18n/dtrule.cpp @@ -1,11 +1,11 @@ /* ******************************************************************************* -* Copyright (C) 2007-2010, International Business Machines Corporation and +* Copyright (C) 2007-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/format.cpp b/icu4c/source/i18n/format.cpp index d80a44da7a8..e369e4021a7 100644 --- a/icu4c/source/i18n/format.cpp +++ b/icu4c/source/i18n/format.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* -* Copyright (C) 1997-2011, International Business Machines Corporation and * +* Copyright (C) 1997-2012, International Business Machines Corporation and * * others. All Rights Reserved. * ******************************************************************************* * @@ -19,7 +19,7 @@ // This file was generated from the java source file Format.java // ***************************************************************************** -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/measure.cpp b/icu4c/source/i18n/measure.cpp index 7b91677a3c0..639de3e6db1 100644 --- a/icu4c/source/i18n/measure.cpp +++ b/icu4c/source/i18n/measure.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** -* Copyright (c) 2004-2010, International Business Machines +* Copyright (c) 2004-2012, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Author: Alan Liu @@ -8,7 +8,7 @@ * Since: ICU 3.0 ********************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/nfsubs.cpp b/icu4c/source/i18n/nfsubs.cpp index 76274af458d..35c9ce1a3c8 100644 --- a/icu4c/source/i18n/nfsubs.cpp +++ b/icu4c/source/i18n/nfsubs.cpp @@ -1,6 +1,6 @@ /* ****************************************************************************** -* Copyright (C) 1997-2011, International Business Machines +* Copyright (C) 1997-2012, International Business Machines * Corporation and others. All Rights Reserved. ****************************************************************************** * file name: nfsubs.cpp @@ -14,7 +14,7 @@ */ #include -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "nfsubs.h" #include "digitlst.h" diff --git a/icu4c/source/i18n/olsontz.cpp b/icu4c/source/i18n/olsontz.cpp index 7ef662d33fc..992cfe37daa 100644 --- a/icu4c/source/i18n/olsontz.cpp +++ b/icu4c/source/i18n/olsontz.cpp @@ -9,7 +9,7 @@ ********************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "olsontz.h" diff --git a/icu4c/source/i18n/rbnf.cpp b/icu4c/source/i18n/rbnf.cpp index bfd4f4a1bd5..43be8581cd7 100644 --- a/icu4c/source/i18n/rbnf.cpp +++ b/icu4c/source/i18n/rbnf.cpp @@ -5,7 +5,7 @@ ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/rbnf.h" diff --git a/icu4c/source/i18n/rbtz.cpp b/icu4c/source/i18n/rbtz.cpp index c53ccd7dba1..a9d8db5ec4e 100644 --- a/icu4c/source/i18n/rbtz.cpp +++ b/icu4c/source/i18n/rbtz.cpp @@ -1,11 +1,11 @@ /* ******************************************************************************* -* Copyright (C) 2007-2011, International Business Machines Corporation and +* Copyright (C) 2007-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/selfmt.cpp b/icu4c/source/i18n/selfmt.cpp index 0945f036c77..5016e8e30a1 100644 --- a/icu4c/source/i18n/selfmt.cpp +++ b/icu4c/source/i18n/selfmt.cpp @@ -1,6 +1,6 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2011, International Business Machines Corporation and + * Copyright (c) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. * Copyright (C) 2010 , Yahoo! Inc. ******************************************************************** @@ -14,7 +14,7 @@ * 11/16/09 kirtig Improved version ********************************************************************/ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/messagepattern.h" #include "unicode/rbnf.h" diff --git a/icu4c/source/i18n/simpletz.cpp b/icu4c/source/i18n/simpletz.cpp index f04f85f0dbb..2f3b9cc61e9 100644 --- a/icu4c/source/i18n/simpletz.cpp +++ b/icu4c/source/i18n/simpletz.cpp @@ -1,6 +1,6 @@ /* ******************************************************************************* - * Copyright (C) 1997-2011, International Business Machines Corporation and + * Copyright (C) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* * @@ -21,7 +21,7 @@ ******************************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/tblcoll.cpp b/icu4c/source/i18n/tblcoll.cpp index c99c5d480e5..83df78271d0 100644 --- a/icu4c/source/i18n/tblcoll.cpp +++ b/icu4c/source/i18n/tblcoll.cpp @@ -54,7 +54,7 @@ * 01/29/01 synwee Modified into a C++ wrapper calling C APIs (ucol.h) */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/timezone.cpp b/icu4c/source/i18n/timezone.cpp index 429068e54b7..7c85b8ed9db 100644 --- a/icu4c/source/i18n/timezone.cpp +++ b/icu4c/source/i18n/timezone.cpp @@ -35,7 +35,7 @@ * available IDs code. Misc. cleanup. *********************************************************************************/ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" #include "unicode/ustring.h" diff --git a/icu4c/source/i18n/tmunit.cpp b/icu4c/source/i18n/tmunit.cpp index fb31e252091..121b81ce78c 100644 --- a/icu4c/source/i18n/tmunit.cpp +++ b/icu4c/source/i18n/tmunit.cpp @@ -1,11 +1,11 @@ /* ******************************************************************************* - * Copyright (C) 2008-2010, Google, International Business Machines Corporation and + * Copyright (C) 2008-2012, Google, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/tmunit.h" diff --git a/icu4c/source/i18n/tmutfmt.cpp b/icu4c/source/i18n/tmutfmt.cpp index e2c3f6a30d8..347a6a9d65e 100644 --- a/icu4c/source/i18n/tmutfmt.cpp +++ b/icu4c/source/i18n/tmutfmt.cpp @@ -5,7 +5,7 @@ ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/tmutfmt.h" diff --git a/icu4c/source/i18n/translit.cpp b/icu4c/source/i18n/translit.cpp index 94e58c39f32..e82cd59b0ab 100644 --- a/icu4c/source/i18n/translit.cpp +++ b/icu4c/source/i18n/translit.cpp @@ -1,6 +1,6 @@ /* ********************************************************************** - * Copyright (C) 1999-2011, International Business Machines + * Copyright (C) 1999-2012, International Business Machines * Corporation and others. All Rights Reserved. ********************************************************************** * Date Name Description @@ -8,7 +8,7 @@ ********************************************************************** */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/tzrule.cpp b/icu4c/source/i18n/tzrule.cpp index e54b9b875fc..c3e9b4e0354 100644 --- a/icu4c/source/i18n/tzrule.cpp +++ b/icu4c/source/i18n/tzrule.cpp @@ -1,11 +1,11 @@ /* ******************************************************************************* -* Copyright (C) 2007-2010, International Business Machines Corporation and +* Copyright (C) 2007-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/tztrans.cpp b/icu4c/source/i18n/tztrans.cpp index f795e409288..6e0ddf6d39b 100644 --- a/icu4c/source/i18n/tztrans.cpp +++ b/icu4c/source/i18n/tztrans.cpp @@ -1,11 +1,11 @@ /* ******************************************************************************* -* Copyright (C) 2007-2010, International Business Machines Corporation and +* Copyright (C) 2007-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/ucal.cpp b/icu4c/source/i18n/ucal.cpp index 2a8db94b99a..ddbbc9a8c1d 100644 --- a/icu4c/source/i18n/ucal.cpp +++ b/icu4c/source/i18n/ucal.cpp @@ -5,7 +5,7 @@ ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/i18n/vtzone.cpp b/icu4c/source/i18n/vtzone.cpp index 8e8689ffbae..b000b22e03f 100644 --- a/icu4c/source/i18n/vtzone.cpp +++ b/icu4c/source/i18n/vtzone.cpp @@ -1,11 +1,11 @@ /* ******************************************************************************* -* Copyright (C) 2007-2011, International Business Machines Corporation and +* Copyright (C) 2007-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/test/intltest/citrtest.cpp b/icu4c/source/test/intltest/citrtest.cpp index be8803d6268..bc9d7439238 100644 --- a/icu4c/source/test/intltest/citrtest.cpp +++ b/icu4c/source/test/intltest/citrtest.cpp @@ -1,6 +1,6 @@ /**************************************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2011, International Business Machines Corporation and + * Copyright (c) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. * Modification History: * @@ -9,7 +9,7 @@ ****************************************************************************************/ #include -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/chariter.h" #include "unicode/ustring.h" diff --git a/icu4c/source/test/intltest/icusvtst.cpp b/icu4c/source/test/intltest/icusvtst.cpp index c45c68c9dbf..8de38703cf7 100644 --- a/icu4c/source/test/intltest/icusvtst.cpp +++ b/icu4c/source/test/intltest/icusvtst.cpp @@ -1,11 +1,11 @@ /** ******************************************************************************* - * Copyright (C) 2001-2011, International Business Machines Corporation and + * Copyright (C) 2001-2012, International Business Machines Corporation and * others. All Rights Reserved. ******************************************************************************* */ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/test/intltest/rbbitst.cpp b/icu4c/source/test/intltest/rbbitst.cpp index 609241f52f2..d09004b32e7 100644 --- a/icu4c/source/test/intltest/rbbitst.cpp +++ b/icu4c/source/test/intltest/rbbitst.cpp @@ -9,7 +9,7 @@ * 01/12/2000 Madhu Updated for changed API and added new tests ************************************************************************/ -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "unicode/utypes.h" diff --git a/icu4c/source/test/intltest/uobjtest.cpp b/icu4c/source/test/intltest/uobjtest.cpp index 4639966d903..11f1293c5b1 100644 --- a/icu4c/source/test/intltest/uobjtest.cpp +++ b/icu4c/source/test/intltest/uobjtest.cpp @@ -1,13 +1,13 @@ /******************************************************************** * COPYRIGHT: - * Copyright (c) 1997-2011, International Business Machines Corporation and + * Copyright (c) 1997-2012, International Business Machines Corporation and * others. All Rights Reserved. * Copyright (C) 2010 , Yahoo! Inc. ********************************************************************/ #include #include -#include // for 'typeid' to work +#include "utypeinfo.h" // for 'typeid' to work #include "uobjtest.h" #include "cmemory.h" // UAlignedMemory -- 2.40.0