You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2017/09/21 18:58:02 UTC

svn commit: r1809200 - in /subversion/trunk/subversion/libsvn_subr: utf8proc.c utf8proc/utf8proc.c utf8proc/utf8proc_internal.h

Author: brane
Date: Thu Sep 21 18:58:02 2017
New Revision: 1809200

URL: http://svn.apache.org/viewvc?rev=1809200&view=rev
Log:
Remove diagnostic #pragma magic for utf8proc; GCC doesn't like C++/C99-style
comments no matter what we do. Change the comments instead, even though
that will make merging in future quite painful.

* subversion/libsvn_subr/utf8proc.c:
   Remove the diagnostic #pragmas and revert the inclusion of
   utf8proc/utf8proc.c back to the way it was before r1809189.

* subversion/libsvn_subr/utf8proc/utf8proc.c,
  subversion/libsvn_subr/utf8proc/utf8proc_internal.h:
   Replace // comments with /* */ comments.

Modified:
    subversion/trunk/subversion/libsvn_subr/utf8proc.c
    subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c
    subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h

Modified: subversion/trunk/subversion/libsvn_subr/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc.c?rev=1809200&r1=1809199&r2=1809200&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc.c Thu Sep 21 18:58:02 2017
@@ -30,27 +30,14 @@
 #include "svn_private_config.h"
 
 #if SVN_INTERNAL_UTF8PROC
-#  define UTF8PROC_INLINE
-#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __clang__
-/* With older versions of GCC, the ignored -Wcomment will not be
-   restored and C++/C99-style comments might creep into the rest of
-   this file; but that's still better than having to replace all the
-   comments in utf8proc/utf8proc.c. */
-#    pragma GCC diagnostic push
-#  endif
-#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2) || __clang__
-#    pragma GCC diagnostic ignored "-Wcomment"
-#  endif
+#define UTF8PROC_INLINE
 /* Somehow utf8proc thinks it is nice to use strlen as an argument name,
    while this function is already defined via apr.h */
-#  define strlen svn__strlen_var
-#  include "utf8proc/utf8proc.c"
-#  undef strlen
-#  if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __clang__
-#    pragma GCC diagnostic pop
-#  endif
+#define strlen svn__strlen_var
+#include "utf8proc/utf8proc.c"
+#undef strlen
 #else
-#  include <utf8proc.h>
+#include <utf8proc.h>
 #endif
 
 

Modified: subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c?rev=1809200&r1=1809199&r2=1809200&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc.c Thu Sep 21 18:58:02 2017
@@ -124,18 +124,18 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8
     *dst = uc;
     return 1;
   }
-  // Must be between 0xc2 and 0xf4 inclusive to be valid
+  /* Must be between 0xc2 and 0xf4 inclusive to be valid */
   if ((uc - 0xc2) > (0xf4-0xc2)) return UTF8PROC_ERROR_INVALIDUTF8;
-  if (uc < 0xe0) {         // 2-byte sequence
-     // Must have valid continuation character
+  if (uc < 0xe0) {         /* 2-byte sequence */
+     /* Must have valid continuation character */
      if (str >= end || !utf_cont(*str)) return UTF8PROC_ERROR_INVALIDUTF8;
      *dst = ((uc & 0x1f)<<6) | (*str & 0x3f);
      return 2;
   }
-  if (uc < 0xf0) {        // 3-byte sequence
+  if (uc < 0xf0) {        /* 3-byte sequence */
      if ((str + 1 >= end) || !utf_cont(*str) || !utf_cont(str[1]))
         return UTF8PROC_ERROR_INVALIDUTF8;
-     // Check for surrogate chars
+     /* Check for surrogate chars */
      if (uc == 0xed && *str > 0x9f)
          return UTF8PROC_ERROR_INVALIDUTF8;
      uc = ((uc & 0xf)<<12) | ((*str & 0x3f)<<6) | (str[1] & 0x3f);
@@ -144,11 +144,11 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8
      *dst = uc;
      return 3;
   }
-  // 4-byte sequence
-  // Must have 3 valid continuation characters
+  /* 4-byte sequence
+     Must have 3 valid continuation characters */
   if ((str + 2 >= end) || !utf_cont(*str) || !utf_cont(str[1]) || !utf_cont(str[2]))
      return UTF8PROC_ERROR_INVALIDUTF8;
-  // Make sure in correct range (0x10000 - 0x10ffff)
+  /* Make sure in correct range (0x10000 - 0x10ffff) */
   if (uc == 0xf0) {
     if (*str < 0x90) return UTF8PROC_ERROR_INVALIDUTF8;
   } else if (uc == 0xf4) {
@@ -172,8 +172,8 @@ UTF8PROC_DLLEXPORT utf8proc_ssize_t utf8
     dst[0] = (utf8proc_uint8_t)(0xC0 + (uc >> 6));
     dst[1] = (utf8proc_uint8_t)(0x80 + (uc & 0x3F));
     return 2;
-  // Note: we allow encoding 0xd800-0xdfff here, so as not to change
-  // the API, however, these are actually invalid in UTF-8
+  /* Note: we allow encoding 0xd800-0xdfff here, so as not to change
+     the API, however, these are actually invalid in UTF-8 */
   } else if (uc < 0x10000) {
     dst[0] = (utf8proc_uint8_t)(0xE0 + (uc >> 12));
     dst[1] = (utf8proc_uint8_t)(0x80 + ((uc >> 6) & 0x3F));
@@ -250,36 +250,36 @@ UTF8PROC_DLLEXPORT const utf8proc_proper
 */
 static utf8proc_bool grapheme_break_simple(int lbc, int tbc) {
   return
-    (lbc == UTF8PROC_BOUNDCLASS_START) ? true :       // GB1
-    (lbc == UTF8PROC_BOUNDCLASS_CR &&                 // GB3
-     tbc == UTF8PROC_BOUNDCLASS_LF) ? false :         // ---
-    (lbc >= UTF8PROC_BOUNDCLASS_CR && lbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :  // GB4
-    (tbc >= UTF8PROC_BOUNDCLASS_CR && tbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :  // GB5
-    (lbc == UTF8PROC_BOUNDCLASS_L &&                  // GB6
-     (tbc == UTF8PROC_BOUNDCLASS_L ||                 // ---
-      tbc == UTF8PROC_BOUNDCLASS_V ||                 // ---
-      tbc == UTF8PROC_BOUNDCLASS_LV ||                // ---
-      tbc == UTF8PROC_BOUNDCLASS_LVT)) ? false :      // ---
-    ((lbc == UTF8PROC_BOUNDCLASS_LV ||                // GB7
-      lbc == UTF8PROC_BOUNDCLASS_V) &&                // ---
-     (tbc == UTF8PROC_BOUNDCLASS_V ||                 // ---
-      tbc == UTF8PROC_BOUNDCLASS_T)) ? false :        // ---
-    ((lbc == UTF8PROC_BOUNDCLASS_LVT ||               // GB8
-      lbc == UTF8PROC_BOUNDCLASS_T) &&                // ---
-     tbc == UTF8PROC_BOUNDCLASS_T) ? false :          // ---
-    (tbc == UTF8PROC_BOUNDCLASS_EXTEND ||             // GB9
-     tbc == UTF8PROC_BOUNDCLASS_ZWJ ||                // ---
-     tbc == UTF8PROC_BOUNDCLASS_SPACINGMARK ||        // GB9a
-     lbc == UTF8PROC_BOUNDCLASS_PREPEND) ? false :    // GB9b
-    ((lbc == UTF8PROC_BOUNDCLASS_E_BASE ||            // GB10 (requires additional handling below)
-      lbc == UTF8PROC_BOUNDCLASS_E_BASE_GAZ) &&       // ----
-     tbc == UTF8PROC_BOUNDCLASS_E_MODIFIER) ? false : // ----
-    (lbc == UTF8PROC_BOUNDCLASS_ZWJ &&                         // GB11
-     (tbc == UTF8PROC_BOUNDCLASS_GLUE_AFTER_ZWJ ||             // ----
-      tbc == UTF8PROC_BOUNDCLASS_E_BASE_GAZ)) ? false :        // ----
-    (lbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR &&          // GB12/13 (requires additional handling below)
-     tbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR) ? false :  // ----
-    true; // GB999
+    (lbc == UTF8PROC_BOUNDCLASS_START) ? true :       /* GB1 */
+    (lbc == UTF8PROC_BOUNDCLASS_CR &&                 /* GB3 */
+     tbc == UTF8PROC_BOUNDCLASS_LF) ? false :         /* --- */
+    (lbc >= UTF8PROC_BOUNDCLASS_CR && lbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :  /* GB4 */
+    (tbc >= UTF8PROC_BOUNDCLASS_CR && tbc <= UTF8PROC_BOUNDCLASS_CONTROL) ? true :  /* GB5 */
+    (lbc == UTF8PROC_BOUNDCLASS_L &&                  /* GB6 */
+     (tbc == UTF8PROC_BOUNDCLASS_L ||                 /* --- */
+      tbc == UTF8PROC_BOUNDCLASS_V ||                 /* --- */
+      tbc == UTF8PROC_BOUNDCLASS_LV ||                /* --- */
+      tbc == UTF8PROC_BOUNDCLASS_LVT)) ? false :      /* --- */
+    ((lbc == UTF8PROC_BOUNDCLASS_LV ||                /* GB7 */
+      lbc == UTF8PROC_BOUNDCLASS_V) &&                /* --- */
+     (tbc == UTF8PROC_BOUNDCLASS_V ||                 /* --- */
+      tbc == UTF8PROC_BOUNDCLASS_T)) ? false :        /* --- */
+    ((lbc == UTF8PROC_BOUNDCLASS_LVT ||               /* GB8 */
+      lbc == UTF8PROC_BOUNDCLASS_T) &&                /* --- */
+     tbc == UTF8PROC_BOUNDCLASS_T) ? false :          /* --- */
+    (tbc == UTF8PROC_BOUNDCLASS_EXTEND ||             /* GB9 */
+     tbc == UTF8PROC_BOUNDCLASS_ZWJ ||                /* --- */
+     tbc == UTF8PROC_BOUNDCLASS_SPACINGMARK ||        /* GB9a */
+     lbc == UTF8PROC_BOUNDCLASS_PREPEND) ? false :    /* GB9b */
+    ((lbc == UTF8PROC_BOUNDCLASS_E_BASE ||            /* GB10 (requires additional handling below) */
+      lbc == UTF8PROC_BOUNDCLASS_E_BASE_GAZ) &&       /* ---- */
+     tbc == UTF8PROC_BOUNDCLASS_E_MODIFIER) ? false : /* ---- */
+    (lbc == UTF8PROC_BOUNDCLASS_ZWJ &&                         /* GB11 */
+     (tbc == UTF8PROC_BOUNDCLASS_GLUE_AFTER_ZWJ ||             /* ---- */
+      tbc == UTF8PROC_BOUNDCLASS_E_BASE_GAZ)) ? false :        /* ---- */
+    (lbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR &&          /* GB12/13 (requires additional handling below) */
+     tbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR) ? false :  /* ---- */
+    true; /* GB999 */
 }
 
 static utf8proc_bool grapheme_break_extended(int lbc, int tbc, utf8proc_int32_t *state)
@@ -290,15 +290,15 @@ static utf8proc_bool grapheme_break_exte
     lbc_override = *state;
   break_permitted = grapheme_break_simple(lbc_override, tbc);
   if (state) {
-    // Special support for GB 12/13 made possible by GB999. After two RI
-    // class codepoints we want to force a break. Do this by resetting the
-    // second RI's bound class to UTF8PROC_BOUNDCLASS_OTHER, to force a break
-    // after that character according to GB999 (unless of course such a break is
-    // forbidden by a different rule such as GB9).
+    /* Special support for GB 12/13 made possible by GB999. After two RI
+       class codepoints we want to force a break. Do this by resetting the
+       second RI's bound class to UTF8PROC_BOUNDCLASS_OTHER, to force a break
+       after that character according to GB999 (unless of course such a break is
+       forbidden by a different rule such as GB9). */
     if (*state == tbc && tbc == UTF8PROC_BOUNDCLASS_REGIONAL_INDICATOR)
       *state = UTF8PROC_BOUNDCLASS_OTHER;
-    // Special support for GB10. Fold any EXTEND codepoints into the previous
-    // boundclass if we're dealing with an emoji base boundclass.
+    /* Special support for GB10. Fold any EXTEND codepoints into the previous
+       boundclass if we're dealing with an emoji base boundclass. */
     else if ((*state == UTF8PROC_BOUNDCLASS_E_BASE      ||
               *state == UTF8PROC_BOUNDCLASS_E_BASE_GAZ) &&
              tbc == UTF8PROC_BOUNDCLASS_EXTEND)

Modified: subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h?rev=1809200&r1=1809199&r2=1809200&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h (original)
+++ subversion/trunk/subversion/libsvn_subr/utf8proc/utf8proc_internal.h Thu Sep 21 18:58:02 2017
@@ -103,7 +103,7 @@ typedef bool utf8proc_bool;
 #  include <stdbool.h>
 typedef bool utf8proc_bool;
 #else
-// emulate C99 bool
+/* emulate C99 bool */
 #  ifndef __bool_true_false_are_defined
 #    define false 0
 #    define true 1