From owner-svn-src-all@FreeBSD.ORG Sun Jan 5 00:32:40 2014 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 42612F88; Sun, 5 Jan 2014 00:32:40 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2178E1FD7; Sun, 5 Jan 2014 00:32:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id s050Wd06085427; Sun, 5 Jan 2014 00:32:39 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id s050Wcx5085421; Sun, 5 Jan 2014 00:32:38 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201401050032.s050Wcx5085421@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Sun, 5 Jan 2014 00:32:38 +0000 (UTC) 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 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 00:32:40 -0000 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 + + Radar 5774975 + * charset.c (_cpp_convert_input): Eat UTF-8 BOM. + 2005-02-17 Devang Patel 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);