From eccbc645aafa485665da05ebf1b7035b99dc9a15 Mon Sep 17 00:00:00 2001
From: Peter Edberg <pedberg@unicode.org>
Date: Wed, 28 Sep 2016 04:17:24 +0000
Subject: [PATCH] ICU-12738 ICU4C BRS, fixes to
 conditionals/includes/makefiles/scripts from testing public/private headers

X-SVN-Rev: 39375
---
 icu4c/source/common/unicode/localpointer.h    |  6 +--
 .../source/common/unicode/stringtriebuilder.h | 12 +++++-
 icu4c/source/common/unicode/ubiditransform.h  |  2 +
 icu4c/source/common/unicode/unistr.h          |  3 +-
 icu4c/source/common/unicode/unorm.h           |  6 ++-
 icu4c/source/i18n/unicode/ucal.h              |  4 +-
 icu4c/source/i18n/unicode/ucol.h              |  5 ++-
 icu4c/source/i18n/unicode/udat.h              |  5 ++-
 icu4c/source/i18n/unicode/udatpg.h            |  5 ++-
 icu4c/source/i18n/unicode/unum.h              |  5 ++-
 icu4c/source/test/cintltst/calldata.h         |  2 +
 icu4c/source/test/cintltst/ccaltst.h          |  2 +
 icu4c/source/test/cintltst/cdattst.h          |  1 +
 icu4c/source/test/cintltst/cdtdptst.h         |  1 +
 icu4c/source/test/cintltst/cdtrgtst.h         |  1 +
 icu4c/source/test/cintltst/cnmdptst.h         |  1 +
 icu4c/source/test/cintltst/creststn.h         |  4 ++
 icu4c/source/test/cintltst/nccbtst.h          |  5 ++-
 icu4c/source/test/hdrtst/Makefile.in          | 14 ++-----
 .../source/test/hdrtst/testinternalheaders.sh | 37 +++++++++----------
 20 files changed, 70 insertions(+), 51 deletions(-)

diff --git a/icu4c/source/common/unicode/localpointer.h b/icu4c/source/common/unicode/localpointer.h
index 401705345a4..9ac5de5f06d 100644
--- a/icu4c/source/common/unicode/localpointer.h
+++ b/icu4c/source/common/unicode/localpointer.h
@@ -242,7 +242,7 @@ public:
         return moveFrom(src);
     }
 #endif
-#ifndef U_HIDE_DRAFT_API
+    // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
     /**
      * Move assignment, leaves src with isNull().
      * The behavior is undefined if *this and src are the same object.
@@ -258,7 +258,6 @@ public:
         src.ptr=NULL;
         return *this;
     }
-#endif /* U_HIDE_DRAFT_API */
     /**
      * Swap pointers.
      * @param other other smart pointer
@@ -392,7 +391,7 @@ public:
         return moveFrom(src);
     }
 #endif
-#ifndef U_HIDE_DRAFT_API
+    // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
     /**
      * Move assignment, leaves src with isNull().
      * The behavior is undefined if *this and src are the same object.
@@ -408,7 +407,6 @@ public:
         src.ptr=NULL;
         return *this;
     }
-#endif /* U_HIDE_DRAFT_API */
     /**
      * Swap pointers.
      * @param other other smart pointer
diff --git a/icu4c/source/common/unicode/stringtriebuilder.h b/icu4c/source/common/unicode/stringtriebuilder.h
index 906273fa18b..95cd841a374 100644
--- a/icu4c/source/common/unicode/stringtriebuilder.h
+++ b/icu4c/source/common/unicode/stringtriebuilder.h
@@ -186,7 +186,8 @@ protected:
     /** @internal */
     UHashtable *nodes;
 
-#ifndef U_HIDE_INTERNAL_API
+    // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
+    // it is needed for layout of other objects.
     /** @internal */
     class Node : public UObject {
     public:
@@ -245,6 +246,7 @@ protected:
         int32_t offset;
     };
 
+#ifndef U_HIDE_INTERNAL_API
     // This class should not be overridden because
     // registerFinalValue() compares a stack-allocated FinalValueNode
     // (stack-allocated so that we don't unnecessarily create lots of duplicate nodes)
@@ -260,7 +262,10 @@ protected:
     protected:
         int32_t value;
     };
+#endif  /* U_HIDE_INTERNAL_API */
 
+    // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
+    // it is needed for layout of other objects.
     /**
      * @internal 
      */
@@ -278,6 +283,7 @@ protected:
         int32_t value;
     };
 
+#ifndef U_HIDE_INTERNAL_API
     /** 
      * @internal 
      */
@@ -291,7 +297,10 @@ protected:
     protected:
         Node *next;
     };
+#endif  /* U_HIDE_INTERNAL_API */
 
+    // Do not conditionalize the following with #ifndef U_HIDE_INTERNAL_API,
+    // it is needed for layout of other objects.
     /**
      * @internal 
      */
@@ -307,6 +316,7 @@ protected:
         Node *next;
     };
 
+#ifndef U_HIDE_INTERNAL_API
     /**
      * @internal 
      */
diff --git a/icu4c/source/common/unicode/ubiditransform.h b/icu4c/source/common/unicode/ubiditransform.h
index ceebf21ba04..509f68bcc01 100644
--- a/icu4c/source/common/unicode/ubiditransform.h
+++ b/icu4c/source/common/unicode/ubiditransform.h
@@ -18,6 +18,8 @@
 #ifndef UBIDITRANSFORM_H
 #define UBIDITRANSFORM_H
 
+#include "unicode/utypes.h"
+#include "unicode/ubidi.h"
 #include "unicode/uchar.h"
 #include "unicode/localpointer.h"
 
diff --git a/icu4c/source/common/unicode/unistr.h b/icu4c/source/common/unicode/unistr.h
index c7e239aa7e3..81ba2c5ca19 100644
--- a/icu4c/source/common/unicode/unistr.h
+++ b/icu4c/source/common/unicode/unistr.h
@@ -1915,7 +1915,7 @@ public:
     return moveFrom(src);
   }
 #endif
-#ifndef U_HIDE_DRAFT_API
+  // do not use #ifndef U_HIDE_DRAFT_API for moveFrom, needed by non-draft API
   /**
    * Move assignment, might leave src in bogus state.
    * This string will have the same contents and state that the source string had.
@@ -1927,7 +1927,6 @@ public:
    * @draft ICU 56
    */
   UnicodeString &moveFrom(UnicodeString &src) U_NOEXCEPT;
-#endif /* U_HIDE_DRAFT_API */
 
   /**
    * Swap strings.
diff --git a/icu4c/source/common/unicode/unorm.h b/icu4c/source/common/unicode/unorm.h
index d553f76299a..f527c263f02 100644
--- a/icu4c/source/common/unicode/unorm.h
+++ b/icu4c/source/common/unicode/unorm.h
@@ -24,8 +24,6 @@
 #include "unicode/uiter.h"
 #include "unicode/unorm2.h"
 
-#ifndef U_HIDE_DEPRECATED_API
-
 /**
  * \file
  * \brief C API: Unicode Normalization
@@ -131,6 +129,8 @@
  * For more usage examples, see the Unicode Standard Annex.
  */
 
+// Do not conditionalize the following enum with #ifndef U_HIDE_DEPRECATED_API,
+// it is needed for layout of Normalizer object.
 /**
  * Constants for normalization modes.
  * @deprecated ICU 56 Use unorm2.h instead.
@@ -155,6 +155,8 @@ typedef enum {
   UNORM_MODE_COUNT
 } UNormalizationMode;
 
+#ifndef U_HIDE_DEPRECATED_API
+
 /**
  * Constants for options flags for normalization.
  * Use 0 for default options,
diff --git a/icu4c/source/i18n/unicode/ucal.h b/icu4c/source/i18n/unicode/ucal.h
index 6605ac948c6..29c084574e1 100644
--- a/icu4c/source/i18n/unicode/ucal.h
+++ b/icu4c/source/i18n/unicode/ucal.h
@@ -425,13 +425,13 @@ enum UCalendarDateFields {
    */
   UCAL_IS_LEAP_MONTH,
 
-#ifndef U_HIDE_DEPRECATED_API
+    // Do not conditionalize with #ifndef U_HIDE_DEPRECATED_API,
+    // it is needed for layout of Calendar, DateFormat, and other objects
     /**
      * One more than the highest normal UCalendarDateFields value.
      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
   UCAL_FIELD_COUNT,
-#endif  // U_HIDE_DEPRECATED_API
 
  /**
    * Field number indicating the
diff --git a/icu4c/source/i18n/unicode/ucol.h b/icu4c/source/i18n/unicode/ucol.h
index b2d760a1cbe..eae88f8ce69 100644
--- a/icu4c/source/i18n/unicode/ucol.h
+++ b/icu4c/source/i18n/unicode/ucol.h
@@ -341,13 +341,14 @@ typedef enum {
       * @stable ICU 2.8
       */
      UCOL_NUMERIC_COLLATION = UCOL_STRENGTH + 2, 
-#ifndef U_HIDE_DEPRECATED_API
+
+    // Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+    // it is needed for layout of RuleBasedCollator object.
     /**
      * One more than the highest normal UColAttribute value.
      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
      UCOL_ATTRIBUTE_COUNT
-#endif  // U_HIDE_DEPRECATED_API
 } UColAttribute;
 
 /** Options for retrieving the rule string 
diff --git a/icu4c/source/i18n/unicode/udat.h b/icu4c/source/i18n/unicode/udat.h
index 74dcc645133..cacfbe85009 100644
--- a/icu4c/source/i18n/unicode/udat.h
+++ b/icu4c/source/i18n/unicode/udat.h
@@ -901,13 +901,14 @@ typedef enum UDateFormatBooleanAttribute {
      * @stable ICU 56
      */
     UDAT_PARSE_MULTIPLE_PATTERNS_FOR_MATCH = 3,
-#ifndef U_HIDE_DEPRECATED_API
+
+    // Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+    // it is needed for layout of DateFormat object.
     /**
      * One more than the highest normal UDateFormatBooleanAttribute value.
      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
     UDAT_BOOLEAN_ATTRIBUTE_COUNT = 4
-#endif  // U_HIDE_DEPRECATED_API
 } UDateFormatBooleanAttribute;
 
 /**
diff --git a/icu4c/source/i18n/unicode/udatpg.h b/icu4c/source/i18n/unicode/udatpg.h
index 59ef956553c..47d3afb1d0c 100644
--- a/icu4c/source/i18n/unicode/udatpg.h
+++ b/icu4c/source/i18n/unicode/udatpg.h
@@ -85,13 +85,14 @@ typedef enum UDateTimePatternField {
     UDATPG_FRACTIONAL_SECOND_FIELD,
     /** @stable ICU 3.8 */
     UDATPG_ZONE_FIELD,
-#ifndef U_HIDE_DEPRECATED_API
+
+    // Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+    // it is needed for layout of DateTimePatternGenerator object.
     /**
      * One more than the highest normal UDateTimePatternField value.
      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
     UDATPG_FIELD_COUNT
-#endif  // U_HIDE_DEPRECATED_API
 } UDateTimePatternField;
 
 /**
diff --git a/icu4c/source/i18n/unicode/unum.h b/icu4c/source/i18n/unicode/unum.h
index e8608a35944..34d54427f05 100644
--- a/icu4c/source/i18n/unicode/unum.h
+++ b/icu4c/source/i18n/unicode/unum.h
@@ -325,13 +325,14 @@ enum UCurrencySpacing {
     UNUM_CURRENCY_SURROUNDING_MATCH,
     /** @stable ICU 4.8 */
     UNUM_CURRENCY_INSERT,
-#ifndef U_HIDE_DEPRECATED_API
+
+    // Do not conditionalize the following with #ifndef U_HIDE_DEPRECATED_API,
+    // it is needed for layout of DecimalFormatSymbols object.
     /**
      * One more than the highest normal UCurrencySpacing value.
      * @deprecated ICU 58 The numeric value may change over time, see ICU ticket #12420.
      */
     UNUM_CURRENCY_SPACING_COUNT
-#endif  // U_HIDE_DEPRECATED_API
 };
 typedef enum UCurrencySpacing UCurrencySpacing; /**< @stable ICU 4.8 */
 
diff --git a/icu4c/source/test/cintltst/calldata.h b/icu4c/source/test/cintltst/calldata.h
index f3179099596..af6495685b7 100644
--- a/icu4c/source/test/cintltst/calldata.h
+++ b/icu4c/source/test/cintltst/calldata.h
@@ -9,6 +9,8 @@
 #ifndef COLLATION_TEST_DATA
 #define COLLATION_TEST_DATA
 
+#include "unicode/utypes.h"
+
 #define COUNT_TEST_CASES 13
 
 const UChar testSourceCases[][16] = {
diff --git a/icu4c/source/test/cintltst/ccaltst.h b/icu4c/source/test/cintltst/ccaltst.h
index c3251c23c39..12b3410a19d 100644
--- a/icu4c/source/test/cintltst/ccaltst.h
+++ b/icu4c/source/test/cintltst/ccaltst.h
@@ -18,6 +18,8 @@
 #define _CCALTST
 
 #include "unicode/utypes.h"
+#include "unicode/ucal.h"
+#include "unicode/udat.h"
 
 #if !UCONFIG_NO_FORMATTING
 
diff --git a/icu4c/source/test/cintltst/cdattst.h b/icu4c/source/test/cintltst/cdattst.h
index 3141e07d45d..7b4e245824d 100644
--- a/icu4c/source/test/cintltst/cdattst.h
+++ b/icu4c/source/test/cintltst/cdattst.h
@@ -19,6 +19,7 @@
 #define _CDATFRMTST
 
 #include "unicode/utypes.h"
+#include "unicode/udat.h"
 
 #if !UCONFIG_NO_FORMATTING
 
diff --git a/icu4c/source/test/cintltst/cdtdptst.h b/icu4c/source/test/cintltst/cdtdptst.h
index 3360fb881c2..caabd3a4255 100644
--- a/icu4c/source/test/cintltst/cdtdptst.h
+++ b/icu4c/source/test/cintltst/cdtdptst.h
@@ -19,6 +19,7 @@
 #define _CDTFRRGSTST
 
 #include "unicode/utypes.h"
+#include "unicode/udat.h"
 
 #if !UCONFIG_NO_FORMATTING
 
diff --git a/icu4c/source/test/cintltst/cdtrgtst.h b/icu4c/source/test/cintltst/cdtrgtst.h
index f621606b7b5..5cfe70f042d 100644
--- a/icu4c/source/test/cintltst/cdtrgtst.h
+++ b/icu4c/source/test/cintltst/cdtrgtst.h
@@ -19,6 +19,7 @@
 #define _CDTFRRGSTST
 
 #include "unicode/utypes.h"
+#include "unicode/udat.h"
 
 #if !UCONFIG_NO_FORMATTING
 
diff --git a/icu4c/source/test/cintltst/cnmdptst.h b/icu4c/source/test/cintltst/cnmdptst.h
index 18f68854aa7..1b680a69f38 100644
--- a/icu4c/source/test/cintltst/cnmdptst.h
+++ b/icu4c/source/test/cintltst/cnmdptst.h
@@ -20,6 +20,7 @@
 #define _CNUMDEPTST
 
 #include "unicode/utypes.h"
+#include "unicode/unum.h"
 
 #if !UCONFIG_NO_FORMATTING
 
diff --git a/icu4c/source/test/cintltst/creststn.h b/icu4c/source/test/cintltst/creststn.h
index be8d4dbd145..48add5d398e 100644
--- a/icu4c/source/test/cintltst/creststn.h
+++ b/icu4c/source/test/cintltst/creststn.h
@@ -17,6 +17,10 @@
 */
 #ifndef _CRESTSTN
 #define _CRESTSTN
+
+#include "unicode/utypes.h"
+#include "unicode/ures.h"
+
 /* C TEST FOR NEW RESOURCEBUNDLE API*/
 #include "cintltst.h"
 
diff --git a/icu4c/source/test/cintltst/nccbtst.h b/icu4c/source/test/cintltst/nccbtst.h
index 6bfceff278a..6562d2a93f6 100644
--- a/icu4c/source/test/cintltst/nccbtst.h
+++ b/icu4c/source/test/cintltst/nccbtst.h
@@ -16,9 +16,12 @@
 */
 #ifndef _NCCBTST
 #define _NCCBTST
+
+#include "unicode/utypes.h"
+#include "unicode/ucnv.h"
+
 /* C API TEST FOR CALL BACK ROUTINES OF CODESET CONVERSION COMPONENT */
 #include "cintltst.h"
-#include "unicode/utypes.h"
 
 
 static void TestSkipCallBack(void);
diff --git a/icu4c/source/test/hdrtst/Makefile.in b/icu4c/source/test/hdrtst/Makefile.in
index 5a69543b373..81aa619435d 100644
--- a/icu4c/source/test/hdrtst/Makefile.in
+++ b/icu4c/source/test/hdrtst/Makefile.in
@@ -53,7 +53,7 @@ E_DEP="[6/$(E_NUM)] Hide Deprecated: "
 E_INT="[7/$(E_NUM)] Hide Internal: "
 E_OBS="[8/$(E_NUM)] Hide Obsolete: "
 
-check: dtest ctest cpptest lotest doclean drafttest deprtest internaltest obsoletetest
+check: dtest ctest cpptest doclean drafttest deprtest internaltest obsoletetest
 ifeq ($(MAKECMDGOALS),check)
 	$(MAKE) clean
 else
@@ -74,15 +74,7 @@ cpptest:
 	done ;\
 	exit $$FAIL
 
-lotest:
-	@FAIL=0;for file in $(prefix)/include/layout/*.h; do \
-	  incfile=`basename $$file .h` ; \
-	  echo "$@ layout/$$incfile.h" ; \
-	  echo '#include "'layout/$$incfile'.h"' > ht_$$incfile.cpp ; \
-	  echo 'void junk(){}' >> ht_$$incfile.cpp ; \
-          $(COMPILE.cc) -c $(cppflags) -I$(prefix)/include/layout ht_$$incfile.cpp || FAIL=1; \
-	done ;\
-	exit $$FAIL
+# layout is removed
 
 dtest:
 	@FAIL=0;NONE="(No deprecated headers)";for stub in `cat $(srcdir)/dfiles.txt | grep -v '^#'` ; do \
@@ -178,5 +170,5 @@ Makefile: $(srcdir)/Makefile.in  $(top_builddir)/config.status
 	cd $(top_builddir) \
 	&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
 
-.PHONY:	doclean check all cpptest lotest dtest ctest clean distclean
+.PHONY:	doclean check all cpptest dtest ctest clean distclean
 
diff --git a/icu4c/source/test/hdrtst/testinternalheaders.sh b/icu4c/source/test/hdrtst/testinternalheaders.sh
index da754f58db3..14106926b05 100755
--- a/icu4c/source/test/hdrtst/testinternalheaders.sh
+++ b/icu4c/source/test/hdrtst/testinternalheaders.sh
@@ -32,22 +32,17 @@ for file in `ls io/*.h`; do
     $CXX -c -I common -I i18n -I io -O0 ht_temp.cpp ;
 done ;
 
-# layout is deprecated, but layoutex is not.
+# layout is removed.
 
-for file in `ls layout/*.h`; do
-    echo $file
-    echo '#include "'$file'"' > ht_temp.cpp ;
-    echo 'void noop() {}' >> ht_temp.cpp ;
-    $CXX -c -I common -I i18n -I io -O0 ht_temp.cpp ;
-done ;
+# layoutex now depends on external additions such as HarfBuzz, skip here
 
 # -I .  for includes of layout/*.h
-for file in `ls layoutex/*.h`; do
-    echo $file
-    echo '#include "'$file'"' > ht_temp.cpp ;
-    echo 'void noop() {}' >> ht_temp.cpp ;
-    $CXX -c -I common -I i18n -I io -I layout -I . -I layoutex -O0 ht_temp.cpp ;
-done ;
+#for file in `ls layoutex/*.h`; do
+#    echo $file
+#    echo '#include "'$file'"' > ht_temp.cpp ;
+#    echo 'void noop() {}' >> ht_temp.cpp ;
+#    $CXX -c -I common -I i18n -I io -I layout -I . -I layoutex -O0 ht_temp.cpp ;
+#done ;
 
 # Tools
 
@@ -83,7 +78,7 @@ for file in `ls tools/ctestfw/unicode/*.h`; do
 done ;
 
 # C not C++ for cintltst
-for file in `ls tools/cintltst/*.h`; do
+for file in `ls test/cintltst/*.h`; do
     echo $file
     echo '#include "'$file'"' > ht_temp.cpp ;
     echo 'void noop() {}' >> ht_temp.cpp ;
@@ -99,12 +94,14 @@ for test in intltest iotest testmap thaitest; do
     done ;
 done ;
 
-for file in `ls test/letest/*.h`; do
-    echo $file
-    echo '#include "'$file'"' > ht_temp.cpp ;
-    echo 'void noop() {}' >> ht_temp.cpp ;
-    $CXX -c -I common -I i18n -I io -I layout -I . -I layoutex -I tools/toolutil -I tools/ctestfw -I test/letest -O0 ht_temp.cpp ;
-done ;
+# layoutex now depends on external additions such as HarfBuzz, skip here
+
+#for file in `ls test/letest/*.h`; do
+#    echo $file
+#    echo '#include "'$file'"' > ht_temp.cpp ;
+#    echo 'void noop() {}' >> ht_temp.cpp ;
+#    $CXX -c -I common -I i18n -I io -I layout -I . -I layoutex -I tools/toolutil -I tools/ctestfw -I test/letest -O0 ht_temp.cpp ;
+#done ;
 
 # TODO: perf/*/*.h
 
-- 
2.40.0