summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpfg <pfg@FreeBSD.org>2014-01-12 21:16:26 +0000
committerpfg <pfg@FreeBSD.org>2014-01-12 21:16:26 +0000
commitf630f6f40f740cb8f2ee6f8b7ca4b87afe4549ed (patch)
tree1583542d675d7245df1abbe37fe4624d8013d8b1
parentd54137712a89d020593dfb73ef2e0814051f5387 (diff)
downloadFreeBSD-src-f630f6f40f740cb8f2ee6f8b7ca4b87afe4549ed.zip
FreeBSD-src-f630f6f40f740cb8f2ee6f8b7ca4b87afe4549ed.tar.gz
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
-rw-r--r--contrib/gcc/config/darwin.h4
-rw-r--r--contrib/gcclibs/libcpp/ChangeLog.apple5
-rw-r--r--contrib/gcclibs/libcpp/charset.c11
-rw-r--r--contrib/gcclibs/libcpp/directives.c17
-rw-r--r--contrib/gcclibs/libcpp/internal.h5
-rw-r--r--contrib/gcclibs/libcpp/lex.c7
6 files changed, 47 insertions, 2 deletions
diff --git a/contrib/gcc/config/darwin.h b/contrib/gcc/config/darwin.h
index e732217..4164e68 100644
--- a/contrib/gcc/config/darwin.h
+++ b/contrib/gcc/config/darwin.h
@@ -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); \
diff --git a/contrib/gcclibs/libcpp/ChangeLog.apple b/contrib/gcclibs/libcpp/ChangeLog.apple
index c38bfe2..5ab2fc0 100644
--- a/contrib/gcclibs/libcpp/ChangeLog.apple
+++ b/contrib/gcclibs/libcpp/ChangeLog.apple
@@ -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
diff --git a/contrib/gcclibs/libcpp/charset.c b/contrib/gcclibs/libcpp/charset.c
index 009106b..079bacc 100644
--- a/contrib/gcclibs/libcpp/charset.c
+++ b/contrib/gcclibs/libcpp/charset.c
@@ -1597,6 +1597,17 @@ _cpp_convert_input (cpp_reader *pfile, const char *input_charset,
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;
diff --git a/contrib/gcclibs/libcpp/directives.c b/contrib/gcclibs/libcpp/directives.c
index 7011842..bf781b6 100644
--- a/contrib/gcclibs/libcpp/directives.c
+++ b/contrib/gcclibs/libcpp/directives.c
@@ -991,7 +991,11 @@ do_diagnostic (cpp_reader *pfile, int code, int print_dir)
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 *pfile, const char *space,
}
}
+/* 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);
diff --git a/contrib/gcclibs/libcpp/internal.h b/contrib/gcclibs/libcpp/internal.h
index ebc2ca9..d685e28 100644
--- a/contrib/gcclibs/libcpp/internal.h
+++ b/contrib/gcclibs/libcpp/internal.h
@@ -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. */
diff --git a/contrib/gcclibs/libcpp/lex.c b/contrib/gcclibs/libcpp/lex.c
index 1a3cad7..dfc432e 100644
--- a/contrib/gcclibs/libcpp/lex.c
+++ b/contrib/gcclibs/libcpp/lex.c
@@ -658,7 +658,12 @@ lex_string (cpp_reader *pfile, cpp_token *token, const uchar *base)
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);
OpenPOWER on IntegriCloud