cpperror.c: Update comments and copyright.
authorNeil Booth <neil@daikokuya.demon.co.uk>
Thu, 3 Jan 2002 21:43:09 +0000 (21:43 +0000)
committerNeil Booth <neil@gcc.gnu.org>
Thu, 3 Jan 2002 21:43:09 +0000 (21:43 +0000)
* cpperror.c: Update comments and copyright.
* cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.

From-SVN: r48522

12 files changed:
gcc/ChangeLog
gcc/cpperror.c
gcc/cppexp.c
gcc/cppfiles.c
gcc/cpphash.c
gcc/cpphash.h
gcc/cppinit.c
gcc/cpplex.c
gcc/cpplib.c
gcc/cpplib.h
gcc/cppmacro.c
gcc/cppmain.c

index 29302fe6f9ce20136e846ed0ce3a9ae03e9380d8..c7da52f140b98bbabdd42500bc7abd08fc554b75 100644 (file)
@@ -1,3 +1,9 @@
+2002-01-03  Neil Booth  <neil@daikokuya.demon.co.uk>
+
+       * cpperror.c: Update comments and copyright.
+       * cppexp.c, cppfiles.c, cpphash.c, cpphash.h, cppinit.c,
+       cpplex.c, cpplib.c, cpplib.h, cppmacro.c, cppmain.c: Similarly.
+
 2002-01-03  John David Anglin  <dave@hiauly1.hia.nrc.ca>
 
        * collect2.c (main): Use strcmp when testing for "-shared".
index 6a3b0c149d98b1beff2d16acf1a686051bc020ef..375dc2ba5b38143344d7d9eff29ecb4b5e8befad 100644 (file)
@@ -1,6 +1,6 @@
 /* Default error handlers for CPP Library.
-   Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000
-   Free Software Foundation, Inc.
+   Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998, 1999, 2000,
+   2001, 2002  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
@@ -36,6 +36,8 @@ static void print_location PARAMS ((cpp_reader *, unsigned int, unsigned int));
 #define v_message(msgid, ap) \
  do { vfprintf (stderr, _(msgid), ap); putc ('\n', stderr); } while (0)
 
+/* Print the logical file location (LINE, COL) in preparation for a
+   diagnostic.  Outputs the #include chain if it has changed.  */
 static void
 print_location (pfile, line, col)
      cpp_reader *pfile;
@@ -77,7 +79,6 @@ print_location (pfile, line, col)
    counter, etc.  LINE is the logical line number; zero means to print
    at the location of the previously lexed token, which tends to be the
    correct place by default.  Returns 0 if the error has been suppressed.  */
-
 int
 _cpp_begin_message (pfile, code, line, column)
      cpp_reader *pfile;
@@ -137,7 +138,6 @@ _cpp_begin_message (pfile, code, line, column)
 
 /* For reporting internal errors.  Prints "internal error: " for you,
    otherwise identical to cpp_fatal.  */
-
 void
 cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
 {  
@@ -156,7 +156,6 @@ cpp_ice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
    (We do not exit, to support use of cpplib as a library.
    Instead, it is the caller's responsibility to check
    CPP_FATAL_ERRORS.  */
-
 void
 cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
 {  
@@ -170,6 +169,7 @@ cpp_fatal VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
   VA_CLOSE (ap);
 }
 
+/* Print an error at the location of the previously lexed token.  */
 void
 cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
 {
@@ -183,6 +183,7 @@ cpp_error VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
   VA_CLOSE (ap);
 }
 
+/* Print an error at a specific location.  */
 void
 cpp_error_with_line VPARAMS ((cpp_reader *pfile, int line, int column,
                             const char *msgid, ...))
@@ -208,6 +209,7 @@ cpp_error_from_errno (pfile, name)
   cpp_error (pfile, "%s: %s", name, xstrerror (errno));
 }
 
+/* Print a warning at the location of the previously lexed token.  */
 void
 cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
 {
@@ -221,6 +223,7 @@ cpp_warning VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
   VA_CLOSE (ap);
 }
 
+/* Print a warning at a specific location.  */
 void
 cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
                               const char *msgid, ...))
@@ -237,6 +240,7 @@ cpp_warning_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
   VA_CLOSE (ap);
 }
 
+/* Pedwarn at the location of the previously lexed token.  */
 void
 cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
 {
@@ -250,6 +254,7 @@ cpp_pedwarn VPARAMS ((cpp_reader * pfile, const char *msgid, ...))
   VA_CLOSE (ap);
 }
 
+/* Pedwarn at a specific location.  */
 void
 cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
                               const char *msgid, ...))
@@ -266,7 +271,7 @@ cpp_pedwarn_with_line VPARAMS ((cpp_reader * pfile, int line, int column,
   VA_CLOSE (ap);
 }
 
-/* Print an error message not associated with a file.  */
+/* Print an error message not associated with the translation unit.  */
 void
 cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
 {
@@ -282,6 +287,8 @@ cpp_notice VPARAMS ((cpp_reader *pfile, const char *msgid, ...))
   VA_CLOSE (ap);
 }
 
+/* Print an error message originating from ERRNO and not associated
+   with the translation unit.  */
 void
 cpp_notice_from_errno (pfile, name)
      cpp_reader *pfile;
index f7fe054b7e0739e5b0fbce5ed9367e958ec45fc9..1f225c373073f14888bed8ebb86c697cf6a0660a 100644 (file)
@@ -1,6 +1,6 @@
 /* Parse C expressions for cpplib.
-   Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001
-   Free Software Foundation.
+   Copyright (C) 1987, 1992, 1994, 1995, 1997, 1998, 1999, 2000, 2001,
+   2002 Free Software Foundation.
    Contributed by Per Bothner, 1994.
 
 This program is free software; you can redistribute it and/or modify it
@@ -85,10 +85,9 @@ static const struct suffix vsuf_3[] = {
 };
 #define Nsuff(tab) (sizeof tab / sizeof (struct suffix))
 
-/* Parse and convert an integer for #if.  Accepts decimal, hex, or
-   octal with or without size suffixes.  Returned op is CPP_ERROR on
-   error, otherwise it is a CPP_NUMBER.  */
-
+/* Parse and convert what is presumably an integer in TOK.  Accepts
+   decimal, hex, or octal with or without size suffixes.  Returned op
+   is CPP_ERROR on error, otherwise it is a CPP_NUMBER.  */
 static struct op
 parse_number (pfile, tok)
      cpp_reader *pfile;
@@ -206,6 +205,7 @@ parse_number (pfile, tok)
   return op;
 }
 
+/* Handle meeting "defined" in a preprocessor expression.  */
 static struct op
 parse_defined (pfile)
      cpp_reader *pfile;
@@ -275,7 +275,6 @@ parse_defined (pfile)
    (an interpreted preprocessing number or character constant, or the
    result of the "defined" or "#" operators), CPP_ERROR on error,
    CPP_EOF, or the type of an operator token.  */
-
 static struct op
 lex (pfile, skip_evaluation)
      cpp_reader *pfile;
@@ -372,6 +371,7 @@ lex (pfile, skip_evaluation)
   return op;
 }
 
+/* Warn if appropriate on overflow.  */
 static void
 integer_overflow (pfile)
      cpp_reader *pfile;
@@ -380,6 +380,8 @@ integer_overflow (pfile)
     cpp_pedwarn (pfile, "integer overflow in preprocessor expression");
 }
 
+/* Handle shifting A left by B bits.  UNSIGNEDP is non-zero if A is
+   unsigned.  */
 static HOST_WIDEST_INT
 left_shift (pfile, a, unsignedp, b)
      cpp_reader *pfile;
@@ -404,6 +406,8 @@ left_shift (pfile, a, unsignedp, b)
     }
 }
 
+/* Handle shifting A right by B bits.  UNSIGNEDP is non-zero if A is
+   unsigned.  */
 static HOST_WIDEST_INT
 right_shift (pfile, a, unsignedp, b)
      cpp_reader *pfile ATTRIBUTE_UNUSED;
@@ -547,7 +551,6 @@ op_to_prio[] =
 
 /* Parse and evaluate a C expression, reading from PFILE.
    Returns the truth value of the expression.  */
-
 int
 _cpp_parse_expr (pfile)
      cpp_reader *pfile;
@@ -870,6 +873,7 @@ _cpp_parse_expr (pfile)
   return result;
 }
 
+/* Output OP as text for diagnostics.  */
 static const unsigned char *
 op_as_text (pfile, op)
      cpp_reader *pfile;
index 11fc32567035821334ad9d9aade5e04a32953978..b60e4eba0f0241c9ca420c458d3ec683d30f865b 100644 (file)
@@ -1,6 +1,6 @@
 /* Part of CPP library.  (include file handling)
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 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
@@ -212,7 +212,6 @@ _cpp_fake_include (pfile, fname)
 
    Returns an include_file structure with an open file descriptor on
    success, or NULL on failure.  */
-
 static struct include_file *
 open_file (pfile, filename)
      cpp_reader *pfile;
@@ -276,7 +275,6 @@ open_file (pfile, filename)
    stack, unless there are errors, or the file is not re-included
    because of e.g. multiple-include guards.  Returns true if a buffer
    is stacked.  */
-
 static bool
 stack_include_file (pfile, inc)
      cpp_reader *pfile;
@@ -351,7 +349,6 @@ stack_include_file (pfile, inc)
    and block devices.
 
    FIXME: Flush file cache and try again if we run out of memory.  */
-
 static int
 read_include_file (pfile, inc)
      cpp_reader *pfile;
@@ -467,6 +464,7 @@ read_include_file (pfile, inc)
   return 1;
 }
 
+/* Drop INC's buffer from memory, if we are unlikely to need it again.  */
 static void
 purge_cache (inc)
      struct include_file *inc;
@@ -524,8 +522,7 @@ cpp_included (pfile, fname)
    un-openable), in which case an error code will be in errno.  If
    there is no include path to use it returns NO_INCLUDE_PATH,
    otherwise an include_file structure.  If this request originates
-   from a #include_next directive, set INCLUDE_NEXT to true.  */
-
+   from a directive of TYPE #include_next, set INCLUDE_NEXT to true.  */
 static struct include_file *
 find_include_file (pfile, header, type)
      cpp_reader *pfile;
@@ -612,6 +609,7 @@ _cpp_report_missing_guards (pfile)
                      (PTR) &banner);
 }
 
+/* Callback function for splay_tree_foreach().  */
 static int
 report_missing_guard (n, b)
      splay_tree_node n;
@@ -633,7 +631,9 @@ report_missing_guard (n, b)
   return 0;
 }
 
-/* Create a dependency, or issue an error message as appropriate.  */
+/* Create a dependency for file FNAME, or issue an error message as
+   appropriate.  ANGLE_BRACKETS is non-zero if the file was bracketed
+   like <..>.  */
 static void
 handle_missing_header (pfile, fname, angle_brackets)
      cpp_reader *pfile;
@@ -679,8 +679,9 @@ handle_missing_header (pfile, fname, angle_brackets)
     cpp_error_from_errno (pfile, fname);
 }
 
-/* Handles #include-family directives, and the command line -imacros
-   and -include.  Returns true if a buffer was stacked.  */
+/* Handles #include-family directives (distinguished by TYPE),
+   including HEADER, and the command line -imacros and -include.
+   Returns true if a buffer was stacked.  */
 bool
 _cpp_execute_include (pfile, header, type)
      cpp_reader *pfile;
@@ -746,8 +747,8 @@ _cpp_read_file (pfile, fname)
   return stack_include_file (pfile, f);
 }
 
-/* Do appropriate cleanup when a file buffer is popped off the input
-   stack.  Push the next -include file, if any remain.  */
+/* Do appropriate cleanup when a file INC's buffer is popped off the
+   input stack.  Push the next -include file, if any remain.  */
 bool
 _cpp_pop_file_buffer (pfile, inc)
      cpp_reader *pfile;
@@ -841,7 +842,6 @@ search_from (pfile, type)
    such as DOS.  The format of the file name map file is just a series
    of lines with two tokens on each line.  The first token is the name
    to map, and the second token is the actual name to use.  */
-
 struct file_name_map
 {
   struct file_name_map *map_next;
@@ -852,8 +852,7 @@ struct file_name_map
 #define FILE_NAME_MAP_FILE "header.gcc"
 
 /* Read a space delimited string of unlimited length from a stdio
-   file.  */
-
+   file F.  */
 static char *
 read_filename_string (ch, f)
      int ch;
@@ -884,7 +883,6 @@ read_filename_string (ch, f)
 }
 
 /* This structure holds a linked list of file name maps, one per directory.  */
-
 struct file_name_map_list
 {
   struct file_name_map_list *map_list_next;
@@ -893,7 +891,6 @@ struct file_name_map_list
 };
 
 /* Read the file name map file for DIRNAME.  */
-
 static struct file_name_map *
 read_name_map (pfile, dirname)
      cpp_reader *pfile;
@@ -1069,7 +1066,6 @@ remove_component_p (path)
    Guarantees no trailing slashes.  All transforms reduce the length
    of the string.  Returns PATH.  errno is 0 if no error occurred;
    nonzero if an error occurred when using stat () or lstat ().  */
-
 char *
 _cpp_simplify_pathname (path)
     char *path;
index 39a3de77ffaa2c15b1f82fe14bd303f5bc8d953b..8be1b2f1a659417ad19c5f6ec2e8c326bd3e83af 100644 (file)
@@ -1,6 +1,6 @@
 /* Hash tables for the CPP library.
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 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
@@ -32,7 +32,6 @@ static cpp_hashnode *alloc_node PARAMS ((hash_table *));
 
 /* Return an identifier node for hashtable.c.  Used by cpplib except
    when integrated with the C front ends.  */
-
 static cpp_hashnode *
 alloc_node (table)
      hash_table *table;
@@ -47,7 +46,6 @@ alloc_node (table)
 
 /* Set up the identifier hash table.  Use TABLE if non-null, otherwise
    create our own.  */
-
 void
 _cpp_init_hashtable (pfile, table)
      cpp_reader *pfile;
@@ -81,7 +79,6 @@ _cpp_init_hashtable (pfile, table)
 }
 
 /* Tear down the identifier hash table.  */
-
 void
 _cpp_destroy_hashtable (pfile)
      cpp_reader *pfile;
@@ -95,7 +92,6 @@ _cpp_destroy_hashtable (pfile)
 
 /* Returns the hash entry for the STR of length LEN, creating one
    if necessary.  */
-
 cpp_hashnode *
 cpp_lookup (pfile, str, len)
      cpp_reader *pfile;
@@ -107,7 +103,6 @@ cpp_lookup (pfile, str, len)
 }
 
 /* Determine whether the str STR, of length LEN, is a defined macro.  */
-
 int
 cpp_defined (pfile, str, len)
      cpp_reader *pfile;
@@ -124,7 +119,6 @@ cpp_defined (pfile, str, len)
 
 /* For all nodes in the hashtable, callback CB with parameters PFILE,
    the node, and V.  */
-
 void
 cpp_forall_identifiers (pfile, cb, v)
      cpp_reader *pfile;
index 703908fc1393e540e4dadfc4ac0d16fb3fcdbb03..be8d902154b62cbc19a15acf984d31e8cb29d17f 100644 (file)
@@ -1,5 +1,6 @@
 /* Part of CPP library.
-   Copyright (C) 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002
+   Free Software Foundation, Inc.
 
 This program is free software; you can redistribute it and/or modify it
 under the terms of the GNU General Public License as published by the
@@ -43,7 +44,6 @@ struct directive;             /* Deliberately incomplete.  */
 #define CPP_STACK_MAX 200
 
 /* A generic memory buffer, and operations on it.  */
-
 typedef struct _cpp_buff _cpp_buff;
 struct _cpp_buff
 {
@@ -93,6 +93,7 @@ union utoken
   const cpp_token **ptoken;
 };
 
+/* A "run" of tokens; part of a chain of runs.  */
 typedef struct tokenrun tokenrun;
 struct tokenrun
 {
@@ -167,6 +168,7 @@ struct spec_nodes
   cpp_hashnode *n__VA_ARGS__;          /* C99 vararg macros */
 };
 
+/* Represents the contents of a file cpplib has read in.  */
 struct cpp_buffer
 {
   const unsigned char *cur;     /* current position */
@@ -224,7 +226,6 @@ struct cpp_buffer
 /* A cpp_reader encapsulates the "state" of a pre-processor run.
    Applying cpp_get_token repeatedly yields a stream of pre-processor
    tokens.  Usually, there is only one cpp_reader object active.  */
-
 struct cpp_reader
 {
   /* Top of buffer stack.  */
index 3ddf429452a581f8a22913b868df9ee77d3ac5d7..93b27025d47bed8c8062fbf8717db7f18d1fb75f 100644 (file)
@@ -54,7 +54,6 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 /* A `struct pending_option' remembers one -D, -A, -U, -include, or
    -imacros switch.  */
-
 typedef void (* cl_directive_handler) PARAMS ((cpp_reader *, const char *));
 struct pending_option
 {
@@ -158,7 +157,6 @@ END
 
 /* Given a colon-separated list of file names PATH,
    add all the names to the search path for include files.  */
-
 static void
 path_include (pfile, list, path)
      cpp_reader *pfile;
@@ -200,7 +198,9 @@ path_include (pfile, list, path)
 }
 
 /* Append DIR to include path PATH.  DIR must be allocated on the
-   heap; this routine takes responsibility for freeing it.  */
+   heap; this routine takes responsibility for freeing it.  CXX_AWARE
+   is non-zero if the header contains extern "C" guards for C++,
+   otherwise it is zero.  */
 static void
 append_include_chain (pfile, dir, path, cxx_aware)
      cpp_reader *pfile;
@@ -331,11 +331,7 @@ remove_dup_dirs (pfile, head)
    system, after.  Remove duplicate dirs (as determined by
    INO_T_EQ()).  The system_include and after_include chains are never
    referred to again after this function; all access is through the
-   bracket_include path.
-
-   For the future: Check if the directory is empty (but
-   how?) and possibly preload the include hash.  */
-
+   bracket_include path.  */
 static void
 merge_include_chains (pfile)
      cpp_reader *pfile;
@@ -389,9 +385,8 @@ merge_include_chains (pfile)
   CPP_OPTION (pfile, bracket_include) = brack;
 }
 
-/* Sets internal flags correctly for a given language, and defines
-   macros if necessary.  */
-
+/* A set of booleans indicating what CPP features each source language
+   requires.  */
 struct lang_flags
 {
   char c99;
@@ -419,6 +414,7 @@ static const struct lang_flags lang_defaults[] =
   /* ASM    */  { 0,  0,   0,  1,   0,   0,     1,      0     }
 };
 
+/* Sets internal flags correctly for a given language.  */
 static void
 set_lang (pfile, lang)
      cpp_reader *pfile;
@@ -453,7 +449,6 @@ opt_comp (p1, p2)
 
 /* init initializes library global state.  It might not need to
    do anything depending on the platform and compiler.  */
-
 static void
 init_library ()
 {
@@ -540,7 +535,7 @@ cpp_create_reader (lang)
 }
 
 /* Free resources used by PFILE.  Accessing PFILE after this function
-   returns leads to undefined behaviour.  */
+   returns leads to undefined behaviour.  Returns the error count.  */
 int
 cpp_destroy (pfile)
      cpp_reader *pfile;
@@ -613,7 +608,6 @@ cpp_destroy (pfile)
    ULP         value is the global user_label_prefix
 
    Also, macros with CPLUS set in the flags field are entered only for C++.  */
-
 struct builtin
 {
   const U_CHAR *name;
@@ -689,7 +683,7 @@ static const struct builtin builtin_array[] =
  builtin_array + sizeof(builtin_array)/sizeof(struct builtin)
 
 /* Subroutine of cpp_read_main_file; reads the builtins table above and
-   enters the macros into the hash table.  */
+   enters them, and language-specific macros, into the hash table.  */
 static void
 init_builtins (pfile)
      cpp_reader *pfile;
@@ -865,7 +859,7 @@ init_standard_includes (pfile)
     }
 }
 
-/* Pushes a -imacro and -include file given on the command line onto
+/* Pushes a command line -imacro and -include file indicated by P onto
    the buffer stack.  Returns non-zero if successful.  */
 static bool
 push_include (pfile, p)
@@ -1126,6 +1120,7 @@ cpp_finish (pfile)
     _cpp_report_missing_guards (pfile);
 }
 
+/* Add a directive to be handled later in the initialization phase.  */
 static void
 new_pending_directive (pend, text, handler)
      struct cpp_pending *pend;
@@ -1318,7 +1313,6 @@ parse_option (input)
 /* Handle one command-line option in (argc, argv).
    Can be called multiple times, to handle multiple sets of options.
    Returns number of strings consumed.  */
-
 int
 cpp_handle_option (pfile, argc, argv)
      cpp_reader *pfile;
@@ -1871,6 +1865,7 @@ init_dependency_output (pfile)
     }
 }
 
+/* Handle --help output.  */
 static void
 print_help ()
 {
index 45d28b66ab20444b2c970f6fff3f8d76bf0088e9..8465350c654d103b039663436df95f9b70dad282 100644 (file)
@@ -1,5 +1,5 @@
 /* CPP Library - lexical analysis.
-   Copyright (C) 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Per Bothner, 1994-95.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -97,7 +97,6 @@ static _cpp_buff *new_buff PARAMS ((size_t));
 
    Compares, the token TOKEN to the NUL-terminated string STRING.
    TOKEN must be a CPP_NAME.  Returns 1 for equal, 0 for unequal.  */
-
 int
 cpp_ideq (token, string)
      const cpp_token *token;
@@ -414,7 +413,6 @@ name_p (pfile, string)
    Poisson-like).  Second most common case is a new identifier, not
    split and no dollar sign.  The other possibilities are rare and
    have been relegated to parse_identifier_slow.  */
-
 static cpp_hashnode *
 parse_identifier (pfile)
      cpp_reader *pfile;
@@ -517,7 +515,9 @@ parse_identifier_slow (pfile, cur)
     ht_lookup (pfile->hash_table, obstack_finish (stack), len, HT_ALLOCED);
 }
 
-/* Parse a number, skipping embedded backslash-newlines.  */
+/* Parse a number, beginning with character C, skipping embedded
+   backslash-newlines.  LEADING_PERIOD is non-zero if there was a "."
+   before C.  Place the result in NUMBER.  */
 static void
 parse_number (pfile, number, c, leading_period)
      cpp_reader *pfile;
@@ -1289,7 +1289,7 @@ _cpp_lex_direct (pfile)
   return result;
 }
 
-/* An upper bound on the number of bytes needed to spell a token,
+/* An upper bound on the number of bytes needed to spell TOKEN,
    including preceding whitespace.  */
 unsigned int
 cpp_token_len (token)
@@ -1383,8 +1383,8 @@ cpp_spell_token (pfile, token, buffer)
   return buffer;
 }
 
-/* Returns a token as a null-terminated string.  The string is
-   temporary, and automatically freed later.  Useful for diagnostics.  */
+/* Returns TOKEN spelt as a null-terminated string.  The string is
+   freed when the reader is destroyed.  Useful for diagnostics.  */
 unsigned char *
 cpp_token_as_text (pfile, token)
      cpp_reader *pfile;
@@ -1399,7 +1399,8 @@ cpp_token_as_text (pfile, token)
   return start;
 }
 
-/* Used by C front ends.  Should really move to using cpp_token_as_text.  */
+/* Used by C front ends, which really should move to using
+   cpp_token_as_text.  */
 const char *
 cpp_type2name (type)
      enum cpp_ttype type;
@@ -1508,7 +1509,6 @@ _cpp_equiv_tokens (a, b)
    accidental token paste for output.  For simplicity, it is
    conservative, and occasionally advises a space where one is not
    needed, e.g. "." and ".2".  */
-
 int
 cpp_avoid_paste (pfile, token1, token2)
      cpp_reader *pfile;
@@ -1689,7 +1689,6 @@ maybe_read_ucs (pfile, pstr, limit, pc)
    interpret escapes that did not exist in traditional C.
 
    Handles all relevant diagnostics.  */
-
 unsigned int
 cpp_parse_escape (pfile, pstr, limit, mask, traditional)
      cpp_reader *pfile;
index 3746d98410edfe203249b215fbcc8b37bea69889..12baa101ef2d3d8eff9d419f08ed1d42101c249f 100644 (file)
@@ -1,6 +1,6 @@
 /* CPP Library. (Directive handling.)
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    Contributed by Per Bothner, 1994-95.
    Based on CCCP program by Paul Rubin, June 1986
    Adapted to ANSI C, Richard Stallman, Jan 1987
@@ -36,7 +36,6 @@ struct answer
 
 /* Stack of conditionals currently in progress
    (including both successful and failing conditionals).  */
-
 struct if_stack
 {
   struct if_stack *next;
@@ -263,7 +262,6 @@ end_directive (pfile, skip_line)
 
 /* Output diagnostics for a directive DIR.  INDENTED is non-zero if
    the '#' was indented.  */
-
 static void
 directive_diagnostics (pfile, dir, indented)
      cpp_reader *pfile;
@@ -311,7 +309,6 @@ directive_diagnostics (pfile, dir, indented)
    to save unnecessarily exporting dtable etc. to cpplex.c.  Returns
    non-zero if the line of tokens has been handled, zero if we should
    continue processing the line.  */
-
 int
 _cpp_handle_directive (pfile, indented)
      cpp_reader *pfile;
@@ -479,7 +476,7 @@ do_define (pfile)
     }
 }
 
-/* Handle #undef.  Marks the identifier NT_VOID in the hash table.  */
+/* Handle #undef.  Mark the identifier NT_VOID in the hash table.  */
 static void
 do_undef (pfile)
      cpp_reader *pfile;
@@ -659,7 +656,6 @@ do_include_next (pfile)
 /* Subroutine of do_line.  Read possible flags after file name.  LAST
    is the last flag seen; 0 if this is the first flag. Return the flag
    if it is valid, 0 at the end of the directive. Otherwise complain.  */
-
 static unsigned int
 read_flag (pfile, last)
      cpp_reader *pfile;
@@ -709,7 +705,6 @@ strtoul_for_line (str, len, nump)
 /* Interpret #line command.
    Note that the filename string (if any) is treated as if it were an
    include filename.  That means no escape handling.  */
-
 static void
 do_line (pfile)
      cpp_reader *pfile;
@@ -807,11 +802,8 @@ _cpp_do_file_change (pfile, reason, to_file, file_line, sysp)
     (*pfile->cb.file_change) (pfile, pfile->map);
 }
 
-/*
- * Report a warning or error detected by the program we are
- * processing.  Use the directive's tokens in the error message.
- */
-
+/* Report a warning or error detected by the program we are
+   processing.  Use the directive's tokens in the error message.  */
 static void
 do_diagnostic (pfile, code, print_dir)
      cpp_reader *pfile;
@@ -844,7 +836,6 @@ do_warning (pfile)
 }
 
 /* Report program identification.  */
-
 static void
 do_ident (pfile)
      cpp_reader *pfile;
@@ -1015,6 +1006,7 @@ do_pragma (pfile)
   pfile->state.prevent_expansion--;
 }
 
+/* Handle #pragma once.  */
 static void
 do_pragma_once (pfile)
      cpp_reader *pfile;
@@ -1029,12 +1021,12 @@ do_pragma_once (pfile)
   check_eol (pfile);
 }
 
+/* Handle #pragma poison, to poison one or more identifiers so that
+   the lexer produces a hard error for each subsequent usage.  */
 static void
 do_pragma_poison (pfile)
      cpp_reader *pfile;
 {
-  /* Poison these symbols so that all subsequent usage produces an
-     error message.  */
   const cpp_token *tok;
   cpp_hashnode *hp;
 
@@ -1208,6 +1200,7 @@ do_sccs (pfile)
 }
 #endif
 
+/* Handle #ifdef.  */
 static void
 do_ifdef (pfile)
      cpp_reader *pfile;
@@ -1228,6 +1221,7 @@ do_ifdef (pfile)
   push_conditional (pfile, skip, T_IFDEF, 0);
 }
 
+/* Handle #ifndef.  */
 static void
 do_ifndef (pfile)
      cpp_reader *pfile;
@@ -1253,7 +1247,6 @@ do_ifndef (pfile)
    optimisations.  If macro expansion occurs in the expression, we
    cannot treat it as a controlling conditional, since the expansion
    could change in the future.  That is handled by cpp_get_token.  */
-
 static void
 do_if (pfile)
      cpp_reader *pfile;
@@ -1269,7 +1262,6 @@ do_if (pfile)
 /* Flip skipping state if appropriate and continue without changing
    if_stack; this is so that the error message for missing #endif's
    etc. will point to the original #if.  */
-
 static void
 do_else (pfile)
      cpp_reader *pfile;
@@ -1302,9 +1294,8 @@ do_else (pfile)
     }
 }
 
-/* handle a #elif directive by not changing if_stack either.  see the
+/* Handle a #elif directive by not changing if_stack either.  See the
    comment above do_else.  */
-
 static void
 do_elif (pfile)
      cpp_reader *pfile;
@@ -1341,7 +1332,6 @@ do_elif (pfile)
 }
 
 /* #endif pops the if stack and resets pfile->state.skipping.  */
-
 static void
 do_endif (pfile)
      cpp_reader *pfile;
@@ -1370,10 +1360,10 @@ do_endif (pfile)
     }
 }
 
-/* Push an if_stack entry and set pfile->state.skipping accordingly.
-   If this is a #if or #ifndef, CMACRO is a potentially controlling
-   macro - we need to check here that we are at the top of the file.  */
-
+/* Push an if_stack entry for a preprocessor conditional, and set
+   pfile->state.skipping to SKIP.  If TYPE indicates the conditional
+   is #if or #ifndef, CMACRO is a potentially controlling macro, and
+   we need to check here that we are at the top of the file.  */
 static void
 push_conditional (pfile, skip, type, cmacro)
      cpp_reader *pfile;
@@ -1400,10 +1390,10 @@ push_conditional (pfile, skip, type, cmacro)
   buffer->if_stack = ifs;
 }
 
-/* Read the tokens of the answer into the macro pool.  Only commit the
-   memory if we intend it as permanent storage, i.e. the #assert case.
-   Returns 0 on success.  */
-
+/* Read the tokens of the answer into the macro pool, in a directive
+   of type TYPE.  Only commit the memory if we intend it as permanent
+   storage, i.e. the #assert case.  Returns 0 on success, and sets
+   ANSWERP to point to the answer.  */
 static int
 parse_answer (pfile, answerp, type)
      cpp_reader *pfile;
@@ -1480,9 +1470,9 @@ parse_answer (pfile, answerp, type)
   return 0;
 }
 
-/* Parses an assertion, returning a pointer to the hash node of the
-   predicate, or 0 on error.  If an answer was supplied, it is placed
-   in ANSWERP, otherwise it is set to 0.  */
+/* Parses an assertion directive of type TYPE, returning a pointer to
+   the hash node of the predicate, or 0 on error.  If an answer was
+   supplied, it is placed in ANSWERP, otherwise it is set to 0.  */
 static cpp_hashnode *
 parse_assertion (pfile, answerp, type)
      cpp_reader *pfile;
@@ -1516,7 +1506,7 @@ parse_assertion (pfile, answerp, type)
   return result;
 }
 
-/* Returns a pointer to the pointer to the answer in the answer chain,
+/* Returns a pointer to the pointer to CANDIDATE in the answer chain,
    or a pointer to NULL if the answer is not in the chain.  */
 static struct answer **
 find_answer (node, candidate)
@@ -1564,6 +1554,7 @@ _cpp_test_assertion (pfile, value)
   return node == 0;
 }
 
+/* Handle #assert.  */
 static void
 do_assert (pfile)
      cpp_reader *pfile;
@@ -1596,6 +1587,7 @@ do_assert (pfile)
     }
 }
 
+/* Handle #unassert.  */
 static void
 do_unassert (pfile)
      cpp_reader *pfile;
@@ -1635,7 +1627,6 @@ do_unassert (pfile)
    If STR is just an identifier, define it with value 1.
    If STR has anything after the identifier, then it should
    be identifier=definition.  */
-
 void
 cpp_define (pfile, str)
      cpp_reader *pfile;
@@ -1826,6 +1817,7 @@ _cpp_pop_buffer (pfile)
     obstack_free (&pfile->buffer_ob, buffer);
 }
 
+/* Enter all recognised directives in the hash table.  */
 void
 _cpp_init_directives (pfile)
      cpp_reader *pfile;
@@ -1833,7 +1825,6 @@ _cpp_init_directives (pfile)
   unsigned int i;
   cpp_hashnode *node;
 
-  /* Register the directives.  */
   for (i = 0; i < (unsigned int) N_DIRECTIVES; i++)
     {
       node = cpp_lookup (pfile, dtable[i].name, dtable[i].length);
index e9002fb9f954f1dedab2d9af48f220ce8f632bb5..367491b226e250dbfcfa7eab5c1930d76b965a8c 100644 (file)
@@ -1,5 +1,5 @@
 /* Definitions for CPP library.
-   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Per Bothner, 1994-95.
 
@@ -152,7 +152,7 @@ enum cpp_ttype
 enum c_lang {CLK_GNUC89 = 0, CLK_GNUC99, CLK_STDC89, CLK_STDC94, CLK_STDC99,
             CLK_GNUCXX, CLK_CXX98, CLK_OBJC, CLK_OBJCXX, CLK_ASM};
 
-/* Payload of a NUMBER, FLOAT, STRING, or COMMENT token.  */
+/* Payload of a NUMBER, STRING, CHAR or COMMENT token.  */
 struct cpp_string
 {
   unsigned int len;
index c36389eff396fae33eb4549a30b43d9667991faf..538c689b1e5eee11f3996f6e50d93853973c962e 100644 (file)
@@ -1,6 +1,6 @@
 /* Part of CPP library.  (Macro and #define handling.)
    Copyright (C) 1986, 1987, 1989, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000, 2001 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 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
index 70f5bb3a738a0b231dd7f486b753df4183f4b7de..ee157ca61ec4df2e62958a071d275446f2b6b3bd 100644 (file)
@@ -1,5 +1,5 @@
 /* CPP main program, using CPP Library.
-   Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001
+   Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002
    Free Software Foundation, Inc.
    Written by Per Bothner, 1994-95.