svn commit: r260574 - in stable/9/contrib: gcc/config gcclibs/libcpp

Pedro F. Giffuni pfg at FreeBSD.org
Sun Jan 12 21:19:51 UTC 2014


Author: pfg
Date: Sun Jan 12 21:19:49 2014
New Revision: 260574
URL: http://svnweb.freebsd.org/changeset/base/260574

Log:
  MFC	r260310:
  
  libcpp: misc fixes from Apple's GCC.
  
  Fixes some bugs detected by Apple:
    #error with unmatched quotes
    pragma mark
  
  Obtained from:	Apple GCC 4.2 - 5553

Modified:
  stable/9/contrib/gcc/config/darwin.h
  stable/9/contrib/gcclibs/libcpp/ChangeLog.apple
  stable/9/contrib/gcclibs/libcpp/charset.c
  stable/9/contrib/gcclibs/libcpp/directives.c
  stable/9/contrib/gcclibs/libcpp/internal.h
  stable/9/contrib/gcclibs/libcpp/lex.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/contrib/gcc/   (props changed)
  stable/9/contrib/gcclibs/   (props changed)

Modified: stable/9/contrib/gcc/config/darwin.h
==============================================================================
--- stable/9/contrib/gcc/config/darwin.h	Sun Jan 12 21:16:26 2014	(r260573)
+++ stable/9/contrib/gcc/config/darwin.h	Sun Jan 12 21:19:49 2014	(r260574)
@@ -873,7 +873,9 @@ enum machopic_addr_class {
 
 #define DARWIN_REGISTER_TARGET_PRAGMAS()			\
   do {								\
-    c_register_pragma (0, "mark", darwin_pragma_ignore);	\
+    /* APPLE LOCAL begin pragma mark 5614511 */			\
+    /* Removed mark.  */					\
+    /* APPLE LOCAL end pragma mark 5614511 */			\
     c_register_pragma (0, "options", darwin_pragma_options);	\
     c_register_pragma (0, "segment", darwin_pragma_ignore);	\
     c_register_pragma (0, "unused", darwin_pragma_unused);	\

Modified: stable/9/contrib/gcclibs/libcpp/ChangeLog.apple
==============================================================================
--- stable/9/contrib/gcclibs/libcpp/ChangeLog.apple	Sun Jan 12 21:16:26 2014	(r260573)
+++ stable/9/contrib/gcclibs/libcpp/ChangeLog.apple	Sun Jan 12 21:19:49 2014	(r260574)
@@ -3,6 +3,11 @@
         Radar 6121572
         * charset.c (_cpp_convert_input): Don't read to.text[-1].
 
+2008-05-01  Mike Stump  <mrs at apple.com>
+
+	Radar 5774975
+	* charset.c (_cpp_convert_input): Eat UTF-8 BOM.
+
 2005-02-17  Devang Patel  <dpatel at apple.com>
 
 	Radar 3958387

Modified: stable/9/contrib/gcclibs/libcpp/charset.c
==============================================================================
--- stable/9/contrib/gcclibs/libcpp/charset.c	Sun Jan 12 21:16:26 2014	(r260573)
+++ stable/9/contrib/gcclibs/libcpp/charset.c	Sun Jan 12 21:19:49 2014	(r260574)
@@ -1597,6 +1597,17 @@ _cpp_convert_input (cpp_reader *pfile, c
   input_cset = init_iconv_desc (pfile, SOURCE_CHARSET, input_charset);
   if (input_cset.func == convert_no_conversion)
     {
+      /* APPLE LOCAL begin UTF-8 BOM 5774975 */
+      /* Eat the UTF-8 BOM.  */
+      if (len >= 3
+	  && input[0] == 0xef
+	  && input[1] == 0xbb
+	  && input[2] == 0xbf)
+	{
+	  memmove (&input[0], &input[3], size-3);
+	  len -= 3;
+	}
+      /* APPLE LOCAL end UTF-8 BOM 5774975 */
       to.text = input;
       to.asize = size;
       to.len = len;

Modified: stable/9/contrib/gcclibs/libcpp/directives.c
==============================================================================
--- stable/9/contrib/gcclibs/libcpp/directives.c	Sun Jan 12 21:16:26 2014	(r260573)
+++ stable/9/contrib/gcclibs/libcpp/directives.c	Sun Jan 12 21:19:49 2014	(r260574)
@@ -991,7 +991,11 @@ do_diagnostic (cpp_reader *pfile, int co
       if (print_dir)
 	fprintf (stderr, "#%s ", pfile->directive->name);
       pfile->state.prevent_expansion++;
+      /* APPLE LOCAL #error with unmatched quotes 5607574 */
+      pfile->state.in_diagnostic++;
       cpp_output_line (pfile, stderr);
+      /* APPLE LOCAL #error with unmatched quotes 5607574 */
+      pfile->state.in_diagnostic--;
       pfile->state.prevent_expansion--;
     }
 }
@@ -1173,12 +1177,25 @@ cpp_register_deferred_pragma (cpp_reader
     }
 }  
 
+/* APPLE LOCAL begin pragma mark 5614511 */
+/* Handle #pragma mark.  */
+static void
+do_pragma_mark (cpp_reader *pfile)
+{
+  ++pfile->state.skipping;
+  skip_rest_of_line (pfile);
+  --pfile->state.skipping;
+}
+/* APPLE LOCAL end pragma mark 5614511 */
+
 /* Register the pragmas the preprocessor itself handles.  */
 void
 _cpp_init_internal_pragmas (cpp_reader *pfile)
 {
   /* Pragmas in the global namespace.  */
   register_pragma_internal (pfile, 0, "once", do_pragma_once);
+  /* APPLE LOCAL pragma mark 5614511 */
+  register_pragma_internal (pfile, 0, "mark", do_pragma_mark);
 
   /* New GCC-specific pragmas should be put in the GCC namespace.  */
   register_pragma_internal (pfile, "GCC", "poison", do_pragma_poison);

Modified: stable/9/contrib/gcclibs/libcpp/internal.h
==============================================================================
--- stable/9/contrib/gcclibs/libcpp/internal.h	Sun Jan 12 21:16:26 2014	(r260573)
+++ stable/9/contrib/gcclibs/libcpp/internal.h	Sun Jan 12 21:19:49 2014	(r260574)
@@ -220,6 +220,11 @@ struct lexer_state
 
   /* Nonzero if the deferred pragma being handled allows macro expansion.  */
   unsigned char pragma_allow_expansion;
+
+  /* APPLE LOCAL begin #error with unmatched quotes 5607574 */
+  /* Nonzero when handling #error and #warning to allow unmatched quotes.  */
+  unsigned char in_diagnostic;
+  /* APPLE LOCAL end #error with unmatched quotes 5607574 */
 };
 
 /* Special nodes - identifiers with predefined significance.  */

Modified: stable/9/contrib/gcclibs/libcpp/lex.c
==============================================================================
--- stable/9/contrib/gcclibs/libcpp/lex.c	Sun Jan 12 21:16:26 2014	(r260573)
+++ stable/9/contrib/gcclibs/libcpp/lex.c	Sun Jan 12 21:19:49 2014	(r260574)
@@ -658,7 +658,12 @@ lex_string (cpp_reader *pfile, cpp_token
     cpp_error (pfile, CPP_DL_WARNING,
 	       "null character(s) preserved in literal");
 
-  if (type == CPP_OTHER && CPP_OPTION (pfile, lang) != CLK_ASM)
+  /* APPLE LOCAL begin #error with unmatched quotes 5607574 */
+  if (type == CPP_OTHER
+      && CPP_OPTION (pfile, lang) != CLK_ASM
+      && !pfile->state.in_diagnostic
+      && !pfile->state.skipping)
+  /* APPLE LOCAL end #error with unmatched quotes 5607574 */
     cpp_error (pfile, CPP_DL_PEDWARN, "missing terminating %c character",
 	       (int) terminator);
 


More information about the svn-src-stable-9 mailing list