Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 5 Jan 2014 00:32:38 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r260310 - in head/contrib: gcc/config gcclibs/libcpp
Message-ID:  <201401050032.s050Wcx5085421@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Sun Jan  5 00:32:38 2014
New Revision: 260310
URL: http://svnweb.freebsd.org/changeset/base/260310

Log:
  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
  MFC after:	1 week

Modified:
  head/contrib/gcc/config/darwin.h
  head/contrib/gcclibs/libcpp/ChangeLog.apple
  head/contrib/gcclibs/libcpp/charset.c
  head/contrib/gcclibs/libcpp/directives.c
  head/contrib/gcclibs/libcpp/internal.h
  head/contrib/gcclibs/libcpp/lex.c

Modified: head/contrib/gcc/config/darwin.h
==============================================================================
--- head/contrib/gcc/config/darwin.h	Sat Jan  4 23:53:11 2014	(r260309)
+++ head/contrib/gcc/config/darwin.h	Sun Jan  5 00:32:38 2014	(r260310)
@@ -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: head/contrib/gcclibs/libcpp/ChangeLog.apple
==============================================================================
--- head/contrib/gcclibs/libcpp/ChangeLog.apple	Sat Jan  4 23:53:11 2014	(r260309)
+++ head/contrib/gcclibs/libcpp/ChangeLog.apple	Sun Jan  5 00:32:38 2014	(r260310)
@@ -3,6 +3,11 @@
         Radar 6121572
         * charset.c (_cpp_convert_input): Don't read to.text[-1].
 
+2008-05-01  Mike Stump  <mrs@apple.com>
+
+	Radar 5774975
+	* charset.c (_cpp_convert_input): Eat UTF-8 BOM.
+
 2005-02-17  Devang Patel  <dpatel@apple.com>
 
 	Radar 3958387

Modified: head/contrib/gcclibs/libcpp/charset.c
==============================================================================
--- head/contrib/gcclibs/libcpp/charset.c	Sat Jan  4 23:53:11 2014	(r260309)
+++ head/contrib/gcclibs/libcpp/charset.c	Sun Jan  5 00:32:38 2014	(r260310)
@@ -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: head/contrib/gcclibs/libcpp/directives.c
==============================================================================
--- head/contrib/gcclibs/libcpp/directives.c	Sat Jan  4 23:53:11 2014	(r260309)
+++ head/contrib/gcclibs/libcpp/directives.c	Sun Jan  5 00:32:38 2014	(r260310)
@@ -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: head/contrib/gcclibs/libcpp/internal.h
==============================================================================
--- head/contrib/gcclibs/libcpp/internal.h	Sat Jan  4 23:53:11 2014	(r260309)
+++ head/contrib/gcclibs/libcpp/internal.h	Sun Jan  5 00:32:38 2014	(r260310)
@@ -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: head/contrib/gcclibs/libcpp/lex.c
==============================================================================
--- head/contrib/gcclibs/libcpp/lex.c	Sat Jan  4 23:53:11 2014	(r260309)
+++ head/contrib/gcclibs/libcpp/lex.c	Sun Jan  5 00:32:38 2014	(r260310)
@@ -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);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401050032.s050Wcx5085421>