From owner-svn-src-all@FreeBSD.ORG Wed Dec 25 22:00:28 2013 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 88DD140E; Wed, 25 Dec 2013 22:00:28 +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 7255A16D3; Wed, 25 Dec 2013 22:00:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBPM0SWH029883; Wed, 25 Dec 2013 22:00:28 GMT (envelope-from pfg@svn.freebsd.org) Received: (from pfg@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBPM0QJ2029862; Wed, 25 Dec 2013 22:00:26 GMT (envelope-from pfg@svn.freebsd.org) Message-Id: <201312252200.rBPM0QJ2029862@svn.freebsd.org> From: "Pedro F. Giffuni" Date: Wed, 25 Dec 2013 22:00:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r259891 - in stable/9/contrib: gcc gcc/doc gcclibs/libcpp gcclibs/libcpp/include X-SVN-Group: stable-9 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: Wed, 25 Dec 2013 22:00:28 -0000 Author: pfg Date: Wed Dec 25 22:00:25 2013 New Revision: 259891 URL: http://svnweb.freebsd.org/changeset/base/259891 Log: MFC r258826, r259555, r 259558: libcpp: Merge fixes from upstream Fixes: GCC preprocessor/29966: GCC preprocessor/28709: GCC c/31924 GCC preprocessor/14331 gcc: add Apple-compatible -Wnewline-eof Obtained from: gcc per-4.3 (rev. 121340, 124356, 124358, 124730, 125212, 125255 ; GPLv2) Apple Inc. (Apple GCC 4.2 - 5531) Added: stable/9/contrib/gcclibs/libcpp/ChangeLog.apple - copied unchanged from r259555, head/contrib/gcclibs/libcpp/ChangeLog.apple Modified: stable/9/contrib/gcc/c-opts.c stable/9/contrib/gcc/c.opt stable/9/contrib/gcc/doc/invoke.texi stable/9/contrib/gcclibs/libcpp/ChangeLog.gcc43 stable/9/contrib/gcclibs/libcpp/charset.c stable/9/contrib/gcclibs/libcpp/expr.c stable/9/contrib/gcclibs/libcpp/include/cpplib.h stable/9/contrib/gcclibs/libcpp/init.c stable/9/contrib/gcclibs/libcpp/lex.c stable/9/contrib/gcclibs/libcpp/macro.c stable/9/contrib/gcclibs/libcpp/pch.c Directory Properties: stable/9/ (props changed) stable/9/contrib/gcc/ (props changed) stable/9/contrib/gcclibs/ (props changed) Modified: stable/9/contrib/gcc/c-opts.c ============================================================================== --- stable/9/contrib/gcc/c-opts.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcc/c-opts.c Wed Dec 25 22:00:25 2013 (r259891) @@ -487,6 +487,12 @@ c_common_handle_option (size_t scode, co cpp_opts->warn_multichar = value; break; + /* APPLE LOCAL begin -Wnewline-eof */ + case OPT_Wnewline_eof: + cpp_opts->warn_newline_at_eof = value; + break; + /* APPLE LOCAL end -Wnewline-eof */ + case OPT_Wnormalized_: if (!value || (arg && strcasecmp (arg, "none") == 0)) cpp_opts->warn_normalize = normalized_none; Modified: stable/9/contrib/gcc/c.opt ============================================================================== --- stable/9/contrib/gcc/c.opt Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcc/c.opt Wed Dec 25 22:00:25 2013 (r259891) @@ -292,6 +292,12 @@ Wnested-externs C ObjC Var(warn_nested_externs) Warn about \"extern\" declarations not at file scope +; APPLE LOCAL begin -Wnewline-eof +Wnewline-eof +C ObjC C++ ObjC++ +Warn about files missing a newline at the end of the file +; APPLE LOCAL end -Wnewline-eof + Wnon-template-friend C++ ObjC++ Var(warn_nontemplate_friend) Init(1) Warn when non-templatized friend functions are declared within a template Modified: stable/9/contrib/gcc/doc/invoke.texi ============================================================================== --- stable/9/contrib/gcc/doc/invoke.texi Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcc/doc/invoke.texi Wed Dec 25 22:00:25 2013 (r259891) @@ -169,6 +169,8 @@ in the following sections. -trigraphs -no-integrated-cpp -traditional -traditional-cpp @gol -fallow-single-precision -fcond-mismatch @gol -fsigned-bitfields -fsigned-char @gol +@c APPLE LOCAL -Wnewline-eof 2001-08-23 --sts ** +-Wnewline-eof (Apple compatible) @gol -funsigned-bitfields -funsigned-char} @item C++ Language Options @@ -2041,6 +2043,12 @@ Inhibit all warning messages. @opindex Wno-import Inhibit warning messages about the use of @samp{#import}. +@c APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts ** +@item -Wnewline-eof +@opindex Wnewline-eof +Warn about files missing a newline at the end of the file. (Apple compatible) +@c APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts ** + @item -Wchar-subscripts @opindex Wchar-subscripts Warn if an array subscript has type @code{char}. This is a common cause Copied: stable/9/contrib/gcclibs/libcpp/ChangeLog.apple (from r259555, head/contrib/gcclibs/libcpp/ChangeLog.apple) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/9/contrib/gcclibs/libcpp/ChangeLog.apple Wed Dec 25 22:00:25 2013 (r259891, copy of r259555, head/contrib/gcclibs/libcpp/ChangeLog.apple) @@ -0,0 +1,9 @@ +2008-08-04 Bill Wendling + + Radar 6121572 + * charset.c (_cpp_convert_input): Don't read to.text[-1]. + +2005-02-17 Devang Patel + + Radar 3958387 + * libcpp/lex.c (_cpp_get_fresh_line): Check warn_newline_at_eof. Modified: stable/9/contrib/gcclibs/libcpp/ChangeLog.gcc43 ============================================================================== --- stable/9/contrib/gcclibs/libcpp/ChangeLog.gcc43 Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/ChangeLog.gcc43 Wed Dec 25 22:00:25 2013 (r259891) @@ -7,6 +7,11 @@ * include/cpplib.h: Add CPP_N_BINARY, to be used for 0b-prefixed binary integer constants. +2007-05-31 Dave Korn (r125212) + + PR preprocessor/14331 + * lex.c (_cpp_get_fresh_line): Don't warn if no newline at EOF. + 2007-05-21 Ian Lance Taylor (r124929) * internal.h (struct cpp_reader): Add new fields: @@ -23,6 +28,29 @@ (_cpp_cleanup_files): Free pfile->nonexistent_file_hash and pfile->nonexistent_file_ob. +2007-05-14 Janis Johnson (r124731) + + PR c/31924 + * expr.c (interpret_float_suffix): Check for invalid suffix. + +2007-05-02 Eric Christopher (r124358) + + * expr.c (num_div_op): Don't overflow if the result is + zero. + +2007-05-02 Tom Tromey (r124356) + + PR preprocessor/28709: + * macro.c (paste_tokens): Remove PASTE_LEFT from the old lhs. + +2007-01-30 Tom Tromey (r121340) + + PR preprocessor/29966: + * macro.c (lex_expansion_token): Save and restore cpp_reader's + cur_token. + (_cpp_create_definition): Don't restore cur_token here. + * lex.c (_cpp_lex_token): Added assertion. + 2006-12-29 Ian Lance Taylor (r120263) * lex.c (_cpp_clean_line): Add uses of __builtin_expect. Don't Modified: stable/9/contrib/gcclibs/libcpp/charset.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/charset.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/charset.c Wed Dec 25 22:00:25 2013 (r259891) @@ -1628,6 +1628,7 @@ _cpp_convert_input (cpp_reader *pfile, c terminate with another \r, not an \n, so that we do not mistake the \r\n sequence for a single DOS line ending and erroneously issue the "No newline at end of file" diagnostic. */ + /* APPLE LOCAL don't access to.text[-1] radar 6121572 */ if (to.len > 0 && to.text[to.len - 1] == '\r') to.text[to.len] = '\r'; else Modified: stable/9/contrib/gcclibs/libcpp/expr.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/expr.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/expr.c Wed Dec 25 22:00:25 2013 (r259891) @@ -87,16 +87,19 @@ interpret_float_suffix (const uchar *s, while (len--) switch (s[len]) { - case 'f': case 'F': f++; break; - case 'l': case 'L': l++; break; - case 'i': case 'I': - case 'j': case 'J': i++; break; - case 'd': case 'D': - /* Disallow fd, ld suffixes. */ - if (d && (f || l)) + case 'f': case 'F': + if (d > 0) + return 0; + f++; + break; + case 'l': case 'L': + if (d > 0) return 0; - d++; + l++; break; + case 'i': case 'I': + case 'j': case 'J': i++; break; + case 'd': case 'D': d++; break; default: return 0; } @@ -494,7 +497,7 @@ append_digit (cpp_num num, int digit, in if (add_low + digit < add_low) add_high++; add_low += digit; - + if (result.low + add_low < result.low) add_high++; if (result.high + add_high < result.high) @@ -1580,7 +1583,8 @@ num_div_op (cpp_reader *pfile, cpp_num l { if (negate) result = num_negate (result, precision); - result.overflow = num_positive (result, precision) ^ !negate; + result.overflow = (num_positive (result, precision) ^ !negate + && !num_zerop (result)); } return result; Modified: stable/9/contrib/gcclibs/libcpp/include/cpplib.h ============================================================================== --- stable/9/contrib/gcclibs/libcpp/include/cpplib.h Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/include/cpplib.h Wed Dec 25 22:00:25 2013 (r259891) @@ -320,6 +320,11 @@ struct cpp_options /* Nonzero means warn if there are any trigraphs. */ unsigned char warn_trigraphs; + /* APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts */ + /* Nonzero means warn if no newline at end of file. */ + unsigned char warn_newline_at_eof; + /* APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts */ + /* Nonzero means warn about multicharacter charconsts. */ unsigned char warn_multichar; Modified: stable/9/contrib/gcclibs/libcpp/init.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/init.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/init.c Wed Dec 25 22:00:25 2013 (r259891) @@ -146,6 +146,10 @@ cpp_create_reader (enum c_lang lang, has pfile = XCNEW (cpp_reader); cpp_set_lang (pfile, lang); + /* APPLE LOCAL begin -Wnewline-eof 2001-08-23 --sts */ + /* Suppress warnings about missing newlines at ends of files. */ + CPP_OPTION (pfile, warn_newline_at_eof) = 0; + /* APPLE LOCAL end -Wnewline-eof 2001-08-23 --sts */ CPP_OPTION (pfile, warn_multichar) = 1; CPP_OPTION (pfile, discard_comments) = 1; CPP_OPTION (pfile, discard_comments_in_macro_exp) = 1; Modified: stable/9/contrib/gcclibs/libcpp/lex.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/lex.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/lex.c Wed Dec 25 22:00:25 2013 (r259891) @@ -766,6 +766,11 @@ _cpp_lex_token (cpp_reader *pfile) pfile->cur_run = next_tokenrun (pfile->cur_run); pfile->cur_token = pfile->cur_run->base; } + /* We assume that the current token is somewhere in the current + run. */ + if (pfile->cur_token < pfile->cur_run->base + || pfile->cur_token >= pfile->cur_run->limit) + abort (); if (pfile->lookaheads) { @@ -847,11 +852,16 @@ _cpp_get_fresh_line (cpp_reader *pfile) && buffer->next_line > buffer->rlimit && !buffer->from_stage3) { - /* Only warn once. */ + /* Clip to buffer size. */ buffer->next_line = buffer->rlimit; - cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line_table->highest_line, - CPP_BUF_COLUMN (buffer, buffer->cur), - "no newline at end of file"); + /* APPLE LOCAL begin suppress no newline warning. */ + if ( CPP_OPTION (pfile, warn_newline_at_eof)) + { + cpp_error_with_line (pfile, CPP_DL_PEDWARN, pfile->line_table->highest_line, + CPP_BUF_COLUMN (buffer, buffer->cur), + "no newline at end of file"); + } + /* APPLE LOCAL end suppress no newline warning. */ } return_at_eof = buffer->return_at_eof; Modified: stable/9/contrib/gcclibs/libcpp/macro.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/macro.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/macro.c Wed Dec 25 22:00:25 2013 (r259891) @@ -1,6 +1,7 @@ /* Part of CPP library. (Macro and #define handling.) Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998, - 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. + 1999, 2000, 2001, 2002, 2003, 2004, 2005, + 2006 Free Software Foundation, Inc. Written by Per Bothner, 1994. Based on CCCP program by Paul Rubin, June 1986 Adapted to ANSI C, Richard Stallman, Jan 1987 @@ -438,19 +439,18 @@ static bool paste_tokens (cpp_reader *pfile, const cpp_token **plhs, const cpp_token *rhs) { unsigned char *buf, *end, *lhsend; - const cpp_token *lhs; + cpp_token *lhs; unsigned int len; - lhs = *plhs; - len = cpp_token_len (lhs) + cpp_token_len (rhs) + 1; + len = cpp_token_len (*plhs) + cpp_token_len (rhs) + 1; buf = (unsigned char *) alloca (len); - end = lhsend = cpp_spell_token (pfile, lhs, buf, false); + end = lhsend = cpp_spell_token (pfile, *plhs, buf, false); /* Avoid comment headers, since they are still processed in stage 3. It is simpler to insert a space here, rather than modifying the lexer to ignore comments in some circumstances. Simply returning false doesn't work, since we want to clear the PASTE_LEFT flag. */ - if (lhs->type == CPP_DIV && rhs->type != CPP_EQ) + if ((*plhs)->type == CPP_DIV && rhs->type != CPP_EQ) *end++ = ' '; end = cpp_spell_token (pfile, rhs, end, false); *end = '\n'; @@ -460,13 +460,22 @@ paste_tokens (cpp_reader *pfile, const c /* Set pfile->cur_token as required by _cpp_lex_direct. */ pfile->cur_token = _cpp_temp_token (pfile); - *plhs = _cpp_lex_direct (pfile); + lhs = _cpp_lex_direct (pfile); if (pfile->buffer->cur != pfile->buffer->rlimit) { + source_location saved_loc = lhs->src_loc; + _cpp_pop_buffer (pfile); _cpp_backup_tokens (pfile, 1); *lhsend = '\0'; + /* We have to remove the PASTE_LEFT flag from the old lhs, but + we want to keep the new location. */ + *lhs = **plhs; + *plhs = lhs; + lhs->src_loc = saved_loc; + lhs->flags &= ~PASTE_LEFT; + /* Mandatory error for all apart from assembler. */ if (CPP_OPTION (pfile, lang) != CLK_ASM) cpp_error (pfile, CPP_DL_ERROR, @@ -475,6 +484,7 @@ paste_tokens (cpp_reader *pfile, const c return false; } + *plhs = lhs; _cpp_pop_buffer (pfile); return true; } @@ -1405,10 +1415,12 @@ alloc_expansion_token (cpp_reader *pfile static cpp_token * lex_expansion_token (cpp_reader *pfile, cpp_macro *macro) { - cpp_token *token; + cpp_token *token, *saved_cur_token; + saved_cur_token = pfile->cur_token; pfile->cur_token = alloc_expansion_token (pfile, macro); token = _cpp_lex_direct (pfile); + pfile->cur_token = saved_cur_token; /* Is this a parameter? */ if (token->type == CPP_NAME @@ -1597,18 +1609,12 @@ _cpp_create_definition (cpp_reader *pfil ok = _cpp_create_trad_definition (pfile, macro); else { - cpp_token *saved_cur_token = pfile->cur_token; - ok = create_iso_definition (pfile, macro); - /* Restore lexer position because of games lex_expansion_token() - plays lexing the macro. We set the type for SEEN_EOL() in - directives.c. + /* We set the type for SEEN_EOL() in directives.c. Longer term we should lex the whole line before coming here, and just copy the expansion. */ - saved_cur_token[-1].type = pfile->cur_token[-1].type; - pfile->cur_token = saved_cur_token; /* Stop the lexer accepting __VA_ARGS__. */ pfile->state.va_args_ok = 0; Modified: stable/9/contrib/gcclibs/libcpp/pch.c ============================================================================== --- stable/9/contrib/gcclibs/libcpp/pch.c Wed Dec 25 21:59:56 2013 (r259890) +++ stable/9/contrib/gcclibs/libcpp/pch.c Wed Dec 25 22:00:25 2013 (r259891) @@ -35,14 +35,14 @@ static int write_defs (cpp_reader *, cpp static int save_macros (cpp_reader *, cpp_hashnode *, void *); /* This structure represents a macro definition on disk. */ -struct macrodef_struct +struct macrodef_struct { unsigned int definition_length; unsigned short name_length; unsigned short flags; }; -/* This is how we write out a macro definition. +/* This is how we write out a macro definition. Suitable for being called by cpp_forall_identifiers. */ static int @@ -54,7 +54,7 @@ write_macdef (cpp_reader *pfile, cpp_has case NT_VOID: if (! (hn->flags & NODE_POISONED)) return 1; - + case NT_MACRO: if ((hn->flags & NODE_BUILTIN)) return 1; @@ -76,7 +76,7 @@ write_macdef (cpp_reader *pfile, cpp_has defn = NODE_NAME (hn); s.definition_length = s.name_length; } - + if (fwrite (&s, sizeof (s), 1, f) != 1 || fwrite (defn, 1, s.definition_length, f) != s.definition_length) { @@ -86,7 +86,7 @@ write_macdef (cpp_reader *pfile, cpp_has } } return 1; - + case NT_ASSERTION: /* Not currently implemented. */ return 1; @@ -123,7 +123,7 @@ static int save_idents (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p) { struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p; - + if (hn->type != NT_VOID) { struct cpp_string news; @@ -136,7 +136,7 @@ save_idents (cpp_reader *pfile ATTRIBUTE { struct cpp_string *sp; unsigned char *text; - + sp = XNEW (struct cpp_string); *slot = sp; @@ -157,7 +157,7 @@ hashmem (const void *p_p, size_t sz) const unsigned char *p = (const unsigned char *)p_p; size_t i; hashval_t h; - + h = 0; for (i = 0; i < sz; i++) h = h * 67 - (*p++ - 113); @@ -194,10 +194,10 @@ cpp_save_state (cpp_reader *r, FILE *f) { /* Save the list of non-void identifiers for the dependency checking. */ r->savedstate = XNEW (struct cpp_savedstate); - r->savedstate->definedhash = htab_create (100, cpp_string_hash, + r->savedstate->definedhash = htab_create (100, cpp_string_hash, cpp_string_eq, NULL); cpp_forall_identifiers (r, save_idents, r->savedstate); - + /* Write out the list of defined identifiers. */ cpp_forall_identifiers (r, write_macdef, f); @@ -210,20 +210,20 @@ static int count_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p) { struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p; - + switch (hn->type) { case NT_MACRO: if (hn->flags & NODE_BUILTIN) return 1; - + /* else fall through. */ case NT_VOID: { struct cpp_string news; void **slot; - + news.len = NODE_LEN (hn); news.text = NODE_NAME (hn); slot = (void **) htab_find (ss->definedhash, &news); @@ -249,20 +249,20 @@ static int write_defs (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *hn, void *ss_p) { struct cpp_savedstate *const ss = (struct cpp_savedstate *)ss_p; - + switch (hn->type) { case NT_MACRO: if (hn->flags & NODE_BUILTIN) return 1; - + /* else fall through. */ case NT_VOID: { struct cpp_string news; void **slot; - + news.len = NODE_LEN (hn); news.text = NODE_NAME (hn); slot = (void **) htab_find (ss->definedhash, &news); @@ -303,7 +303,7 @@ cpp_write_pch_deps (cpp_reader *r, FILE struct cpp_savedstate *const ss = r->savedstate; unsigned char *definedstrs; size_t i; - + /* Collect the list of identifiers which have been seen and weren't defined to anything previously. */ ss->hashsize = 0; @@ -404,7 +404,7 @@ collect_ht_nodes (cpp_reader *pfile ATTR with the preprocessor's current definitions. It will be consistent when: - - anything that was defined just before the PCH was generated + - anything that was defined just before the PCH was generated is defined the same way now; and - anything that was not defined then, but is defined now, was not used by the PCH. @@ -430,10 +430,10 @@ cpp_valid_state (cpp_reader *r, const ch { cpp_hashnode *h; const unsigned char *newdefn; - + if (read (fd, &m, sizeof (m)) != sizeof (m)) goto error; - + if (m.name_length == 0) break; @@ -453,10 +453,10 @@ cpp_valid_state (cpp_reader *r, const ch namebuf = XNEWVEC (unsigned char, namebufsz); } - if ((size_t)read (fd, namebuf, m.definition_length) + if ((size_t)read (fd, namebuf, m.definition_length) != m.definition_length) goto error; - + h = cpp_lookup (r, namebuf, m.name_length); if (m.flags & NODE_POISONED || h->type != NT_MACRO @@ -470,7 +470,7 @@ cpp_valid_state (cpp_reader *r, const ch } newdefn = cpp_macro_definition (r, h); - + if (m.definition_length != ustrlen (newdefn) || memcmp (namebuf, newdefn, m.definition_length) != 0) { @@ -498,17 +498,17 @@ cpp_valid_state (cpp_reader *r, const ch nl.defs = XNEWVEC (cpp_hashnode *, nl.asize); cpp_forall_identifiers (r, &collect_ht_nodes, &nl); qsort (nl.defs, nl.n_defs, sizeof (cpp_hashnode *), &comp_hashnodes); - + /* Loop through nl.defs and undeftab, both of which are sorted lists. There should be no matches. */ first = undeftab; last = undeftab + m.definition_length; i = 0; - + while (first < last && i < nl.n_defs) { int cmp = ustrcmp (first, NODE_NAME (nl.defs[i])); - + if (cmp < 0) first += ustrlen (first) + 1; else if (cmp > 0) @@ -516,13 +516,13 @@ cpp_valid_state (cpp_reader *r, const ch else { if (CPP_OPTION (r, warn_invalid_pch)) - cpp_error (r, CPP_DL_WARNING_SYSHDR, + cpp_error (r, CPP_DL_WARNING_SYSHDR, "%s: not used because `%s' is defined", name, first); goto fail; } } - + free(nl.defs); free (undeftab); @@ -545,7 +545,7 @@ cpp_valid_state (cpp_reader *r, const ch /* Save all the existing macros. */ -struct save_macro_data +struct save_macro_data { uchar **defns; size_t count; @@ -567,7 +567,7 @@ struct save_macro_data file were not saved in this way, but this is not done (yet), except for builtins, and for #assert by default. */ -static int +static int save_macros (cpp_reader *r, cpp_hashnode *h, void *data_p) { struct save_macro_data *data = (struct save_macro_data *)data_p; @@ -577,9 +577,9 @@ save_macros (cpp_reader *r, cpp_hashnode if (data->count == data->array_size) { data->array_size *= 2; - data->defns = XRESIZEVEC (uchar *, data->defns, (data->array_size)); + data->defns = XRESIZEVEC (uchar *, data->defns, (data->array_size)); } - + switch (h->type) { case NT_ASSERTION: @@ -596,7 +596,7 @@ save_macros (cpp_reader *r, cpp_hashnode data->defns[data->count][defnlen] = '\n'; } break; - + default: abort (); } @@ -612,7 +612,7 @@ void cpp_prepare_state (cpp_reader *r, struct save_macro_data **data) { struct save_macro_data *d = XNEW (struct save_macro_data); - + d->array_size = 512; d->defns = XNEWVEC (uchar *, d->array_size); d->count = 0; @@ -622,7 +622,7 @@ cpp_prepare_state (cpp_reader *r, struct } /* Given a precompiled header that was previously determined to be valid, - apply all its definitions (and undefinitions) to the current state. + apply all its definitions (and undefinitions) to the current state. DEPNAME is passed to deps_restore. */ int @@ -632,7 +632,7 @@ cpp_read_state (cpp_reader *r, const cha size_t i; struct lexer_state old_state; - /* Restore spec_nodes, which will be full of references to the old + /* Restore spec_nodes, which will be full of references to the old hashtable entries and so will now be invalid. */ { struct spec_nodes *s = &r->spec_nodes; @@ -691,7 +691,7 @@ cpp_read_state (cpp_reader *r, const cha goto error; return 0; - + error: cpp_errno (r, CPP_DL_ERROR, "while reading precompiled header"); return -1;