]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
c++: more tidying
authorJason Merrill <jason@redhat.com>
Mon, 31 Oct 2022 15:36:05 +0000 (11:36 -0400)
committerJason Merrill <jason@redhat.com>
Tue, 1 Nov 2022 02:13:08 +0000 (22:13 -0400)
gcc/cp/ChangeLog:

* contracts.h: Move lots of decls from...
* cp-tree.h: ...here.
* contracts.cc (cp_contract_assertion_p): Move from parser.cc.
(inherit_base_contracts): Move from search.cc.
* decl.cc (grokdeclarator): Don't use function_declarator_p.
* decl2.cc (cp_tree_defined_p_r)
(cp_tree_defined_p): Remove.
* module.cc (trees_out::fn_parms_init): Tweak comment.
* parser.cc (cp_contract_assertion_p): Moved.
(find_innermost_function_declarator)
(function_declarator_p): Revert.
(cp_parser_function_definition_after_declarator): Remove dead assignment.
(cp_parser_save_default_args): Tweak formatting.
* search.cc (inherit_base_contracts): Moved.

gcc/ChangeLog:

* input.cc (get_source): Tweak comments.

gcc/cp/contracts.cc
gcc/cp/contracts.h
gcc/cp/cp-tree.h
gcc/cp/decl.cc
gcc/cp/decl2.cc
gcc/cp/module.cc
gcc/cp/parser.cc
gcc/cp/search.cc
gcc/input.cc

index 272448d07d83c1983ad3a5aa36d34054c5b7b997..6732b761183cbf360b6d940a930d1422c88df0a9 100644 (file)
@@ -848,6 +848,17 @@ cxx_contract_attribute_p (const_tree attr)
       || TREE_CODE (TREE_VALUE (TREE_VALUE (attr))) == ASSERTION_STMT);
 }
 
+/* True if ATTR is an assertion.  */
+
+bool
+cp_contract_assertion_p (const_tree attr)
+{
+  /* This is only an assertion if it is a valid cxx contract attribute and the
+     statement is an ASSERTION_STMT.  */
+  return cxx_contract_attribute_p (attr)
+    && TREE_CODE (CONTRACT_STATEMENT (attr)) == ASSERTION_STMT;
+}
+
 /* Remove all c++2a style contract attributes from the DECL_ATTRIBUTEs of the
    FUNCTION_DECL FNDECL.  */
 
@@ -2188,4 +2199,36 @@ duplicate_contracts (tree newdecl, tree olddecl)
     }
 }
 
+/* Replace the any contract attributes on OVERRIDER with a copy where any
+   references to BASEFN's PARM_DECLs have been rewritten to the corresponding
+   PARM_DECL in OVERRIDER.  */
+
+void
+inherit_base_contracts (tree overrider, tree basefn)
+{
+  tree last = NULL_TREE, contract_attrs = NULL_TREE;
+  for (tree a = DECL_CONTRACTS (basefn);
+      a != NULL_TREE;
+      a = CONTRACT_CHAIN (a))
+    {
+      tree c = copy_node (a);
+      TREE_VALUE (c) = build_tree_list (TREE_PURPOSE (TREE_VALUE (c)),
+                                       copy_node (CONTRACT_STATEMENT (c)));
+
+      tree src = basefn;
+      tree dst = overrider;
+      remap_contract (src, dst, CONTRACT_STATEMENT (c), /*duplicate_p=*/true);
+
+      CONTRACT_COMMENT (CONTRACT_STATEMENT (c)) =
+       copy_node (CONTRACT_COMMENT (CONTRACT_STATEMENT (c)));
+
+      chainon (last, c);
+      last = c;
+      if (!contract_attrs)
+       contract_attrs = c;
+    }
+
+  set_decl_contracts (overrider, contract_attrs);
+}
+
 #include "gt-cp-contracts.h"
index 81b528397bc56c16b5fa410d80e1d68ff7b03a91..ec48a04da36fda776cebab5a3367b6c22a9a0d7e 100644 (file)
@@ -1,6 +1,6 @@
 /* Definitions for C++ contract levels.  Implements functionality described in
    the N4820 working draft version of contracts, P1290, P1332, and P1429.
-   Copyright (C) 2020 Free Software Foundation, Inc.
+   Copyright (C) 2020-2022 Free Software Foundation, Inc.
    Contributed by Jeff Chapman II (jchapman@lock3software.com)
 
 This file is part of GCC.
@@ -147,6 +147,7 @@ extern contract_level map_contract_level    (const char *);
 
 /* Check if an attribute is a cxx contract attribute.  */
 extern bool cxx_contract_attribute_p (const_tree);
+extern bool cp_contract_assertion_p (const_tree);
 
 /* Returns the default role.  */
 
@@ -163,4 +164,95 @@ extern void handle_OPT_fcontract_continuation_mode_ (const char *);
 extern void handle_OPT_fcontract_role_ (const char *);
 extern void handle_OPT_fcontract_semantic_ (const char *);
 
+enum contract_matching_context
+{
+  cmc_declaration,
+  cmc_override
+};
+
+/* True iff the FUNCTION_DECL NODE currently has any contracts.  */
+#define DECL_HAS_CONTRACTS_P(NODE) \
+  (DECL_CONTRACTS (NODE) != NULL_TREE)
+
+/* For a FUNCTION_DECL of a guarded function, this points to a list of the pre
+   and post contracts of the first decl of NODE in original order. */
+#define DECL_CONTRACTS(NODE) \
+  (find_contract (DECL_ATTRIBUTES (NODE)))
+
+/* The next contract (if any) after this one in an attribute list.  */
+#define CONTRACT_CHAIN(NODE) \
+  (find_contract (TREE_CHAIN (NODE)))
+
+/* The wrapper of the original source location of a list of contracts.  */
+#define CONTRACT_SOURCE_LOCATION_WRAPPER(NODE) \
+  (TREE_PURPOSE (TREE_VALUE (NODE)))
+
+/* The original source location of a list of contracts.  */
+#define CONTRACT_SOURCE_LOCATION(NODE) \
+  (EXPR_LOCATION (CONTRACT_SOURCE_LOCATION_WRAPPER (NODE)))
+
+/* The actual code _STMT for a contract attribute.  */
+#define CONTRACT_STATEMENT(NODE) \
+  (TREE_VALUE (TREE_VALUE (NODE)))
+
+/* For a FUNCTION_DECL of a guarded function, this holds the function decl
+   where pre contract checks are emitted.  */
+#define DECL_PRE_FN(NODE) \
+  (get_precondition_function ((NODE)))
+
+/* For a FUNCTION_DECL of a guarded function, this holds the function decl
+   where post contract checks are emitted.  */
+#define DECL_POST_FN(NODE) \
+  (get_postcondition_function ((NODE)))
+
+/* For a FUNCTION_DECL of a pre/post function, this points back to the
+   original guarded function.  */
+#define DECL_ORIGINAL_FN(NODE) \
+  (DECL_ABSTRACT_ORIGIN (NODE))
+
+/* True iff the FUNCTION_DECL is the pre function for a guarded function.  */
+#define DECL_IS_PRE_FN_P(NODE) \
+  (DECL_ORIGINAL_FN (NODE) && DECL_PRE_FN (DECL_ORIGINAL_FN (NODE)) == NODE)
+
+/* True iff the FUNCTION_DECL is the post function for a guarded function.  */
+#define DECL_IS_POST_FN_P(NODE) \
+  (DECL_ORIGINAL_FN (NODE) && DECL_POST_FN (DECL_ORIGINAL_FN (NODE)) == NODE)
+
+extern tree invalidate_contract                        (tree);
+extern tree finish_contract_attribute          (tree, tree);
+extern void update_late_contract               (tree, tree, tree);
+extern void remove_contract_attributes         (tree);
+extern void copy_contract_attributes           (tree, tree);
+extern tree splice_out_contracts               (tree);
+extern bool check_postcondition_result         (tree, tree, location_t);
+extern void rebuild_postconditions             (tree);
+extern bool match_contract_conditions          (location_t, tree, location_t, tree, contract_matching_context);
+extern void defer_guarded_contract_match       (tree, tree, tree);
+extern void match_deferred_contracts           (tree);
+extern void remap_contract                     (tree, tree, tree, bool);
+extern void remap_contracts                    (tree, tree, tree, bool);
+extern void remap_dummy_this                   (tree, tree *);
+extern bool contract_active_p                  (tree);
+extern bool contract_any_active_p              (tree);
+extern bool contract_any_deferred_p            (tree);
+extern bool all_attributes_are_contracts_p     (tree);
+extern void build_contract_function_decls      (tree);
+extern void set_contract_functions             (tree, tree, tree);
+extern tree start_postcondition_statement      ();
+extern void finish_postcondition_statement     (tree);
+extern tree build_contract_check               (tree);
+extern tree get_postcondition_result_parameter (tree);
+extern tree get_precondition_function          (tree);
+extern tree get_postcondition_function         (tree);
+extern tree get_contracts_original_fn          (tree);
+extern void emit_assertion                     (tree);
+extern void emit_preconditions                 (tree);
+extern void emit_postconditions_cleanup                (tree);
+extern void maybe_update_postconditions                (tree);
+extern void start_function_contracts           (tree);
+extern void finish_function_contracts          (tree);
+extern tree apply_postcondition_to_return      (tree);
+extern void duplicate_contracts                        (tree, tree);
+extern void inherit_base_contracts (tree, tree);
+
 #endif /* ! GCC_CP_CONTRACT_H */
index a212aa2659d457eeeb25dfe339d1bab19b69ce8b..4b5d14f6a2988d370a89eab89fba21679ce56bbc 100644 (file)
@@ -3747,64 +3747,6 @@ struct GTY(()) lang_decl {
 #define DECL_PENDING_INLINE_INFO(NODE) \
   (LANG_DECL_FN_CHECK (NODE)->u.pending_inline_info)
 
-/* Return the first contract in ATTRS, or NULL_TREE if there are none.  */
-
-inline tree
-find_contract (tree attrs)
-{
-  while (attrs && !cxx_contract_attribute_p (attrs))
-    attrs = TREE_CHAIN (attrs);
-  return attrs;
-}
-
-/* True iff the FUNCTION_DECL NODE currently has any contracts.  */
-#define DECL_HAS_CONTRACTS_P(NODE) \
-  (DECL_CONTRACTS (NODE) != NULL_TREE)
-
-/* For a FUNCTION_DECL of a guarded function, this points to a list of the pre
-   and post contracts of the first decl of NODE in original order. */
-#define DECL_CONTRACTS(NODE) \
-  (find_contract (DECL_ATTRIBUTES (NODE)))
-
-/* The next contract (if any) after this one in an attribute list.  */
-#define CONTRACT_CHAIN(NODE) \
-  (find_contract (TREE_CHAIN (NODE)))
-
-/* The wrapper of the original source location of a list of contracts.  */
-#define CONTRACT_SOURCE_LOCATION_WRAPPER(NODE) \
-  (TREE_PURPOSE (TREE_VALUE (NODE)))
-
-/* The original source location of a list of contracts.  */
-#define CONTRACT_SOURCE_LOCATION(NODE) \
-  (EXPR_LOCATION (CONTRACT_SOURCE_LOCATION_WRAPPER (NODE)))
-
-/* The actual code _STMT for a contract attribute.  */
-#define CONTRACT_STATEMENT(NODE) \
-  (TREE_VALUE (TREE_VALUE (NODE)))
-
-/* For a FUNCTION_DECL of a guarded function, this holds the function decl
-   where pre contract checks are emitted.  */
-#define DECL_PRE_FN(NODE) \
-  (get_precondition_function ((NODE)))
-
-/* For a FUNCTION_DECL of a guarded function, this holds the function decl
-   where post contract checks are emitted.  */
-#define DECL_POST_FN(NODE) \
-  (get_postcondition_function ((NODE)))
-
-/* For a FUNCTION_DECL of a pre/post function, this points back to the
-   original guarded function.  */
-#define DECL_ORIGINAL_FN(NODE) \
-  (DECL_ABSTRACT_ORIGIN (NODE))
-
-/* True iff the FUNCTION_DECL is the pre function for a guarded function.  */
-#define DECL_IS_PRE_FN_P(NODE) \
-  (DECL_ORIGINAL_FN (NODE) && DECL_PRE_FN (DECL_ORIGINAL_FN (NODE)) == NODE)
-
-/* True iff the FUNCTION_DECL is the post function for a guarded function.  */
-#define DECL_IS_POST_FN_P(NODE) \
-  (DECL_ORIGINAL_FN (NODE) && DECL_POST_FN (DECL_ORIGINAL_FN (NODE)) == NODE)
-
 /* Nonzero for TYPE_DECL means that it was written 'using name = type'.  */
 #define TYPE_DECL_ALIAS_P(NODE) \
   DECL_LANG_FLAG_6 (TYPE_DECL_CHECK (NODE))
@@ -7146,7 +7088,6 @@ extern void import_export_decl                    (tree);
 extern tree build_cleanup                      (tree);
 extern tree build_offset_ref_call_from_tree    (tree, vec<tree, va_gc> **,
                                                 tsubst_flags_t);
-extern bool cp_tree_defined_p                  (tree);
 extern bool decl_defined_p                     (tree);
 extern bool decl_constant_var_p                        (tree);
 extern bool decl_maybe_constant_var_p          (tree);
@@ -7458,8 +7399,6 @@ extern location_t defparse_location (tree);
 extern void maybe_show_extern_c_location (void);
 extern bool literal_integer_zerop (const_tree);
 extern tree attr_chainon (tree, tree);
-extern bool function_declarator_p (const cp_declarator *);
-extern const cp_declarator *find_innermost_function_declarator (const cp_declarator *);
 
 /* in pt.cc */
 extern tree canonical_type_parameter           (tree);
@@ -7741,62 +7680,6 @@ extern bool perform_or_defer_access_check        (tree, tree, tree,
                                                 tsubst_flags_t,
                                                 access_failure_info *afi = NULL);
 
-/* contracts.cc */
-enum contract_matching_context
-{
-  cmc_declaration,
-  cmc_override
-};
-
-extern void init_contract_processing           ();
-extern tree invalidate_contract                        (tree);
-extern tree make_postcondition_variable                (cp_expr);
-extern tree make_postcondition_variable                (cp_expr, tree);
-extern bool check_postcondition_result         (tree, tree, location_t);
-extern void rebuild_postconditions             (tree);
-extern tree grok_contract                      (tree, tree, tree, cp_expr, location_t);
-extern tree finish_contract_attribute          (tree, tree);
-extern void update_late_contract               (tree, tree, tree);
-extern tree finish_contract_condition          (cp_expr);
-extern void remove_contract_attributes         (tree);
-extern void copy_contract_attributes           (tree, tree);
-extern tree splice_out_contracts               (tree);
-extern bool match_contract_conditions          (location_t, tree, location_t, tree, contract_matching_context);
-extern void defer_guarded_contract_match       (tree, tree, tree);
-extern void match_deferred_contracts           (tree);
-extern void remap_contract                     (tree, tree, tree, bool);
-extern void remap_contracts                    (tree, tree, tree, bool);
-extern void remap_dummy_this                   (tree, tree *);
-extern bool contract_active_p                  (tree);
-extern bool contract_any_active_p              (tree);
-extern bool contract_any_deferred_p            (tree);
-extern bool all_attributes_are_contracts_p     (tree);
-extern void build_contract_function_decls      (tree);
-extern void set_contract_functions             (tree, tree, tree);
-extern tree start_postcondition_statement      ();
-extern void finish_postcondition_statement     (tree);
-extern tree build_contract_check               (tree);
-extern tree get_postcondition_result_parameter (tree);
-extern tree get_precondition_function          (tree);
-extern tree get_postcondition_function         (tree);
-extern tree get_contracts_original_fn          (tree);
-
-extern void emit_assertion                     (tree);
-extern void emit_preconditions                 (tree);
-extern void emit_postconditions_cleanup                (tree);
-extern void maybe_update_postconditions                (tree);
-extern void start_function_contracts           (tree);
-extern void finish_function_contracts          (tree);
-extern tree apply_postcondition_to_return      (tree);
-extern void duplicate_contracts                        (tree, tree);
-
-inline void
-set_decl_contracts (tree decl, tree contract_attrs)
-{
-  remove_contract_attributes (decl);
-  DECL_ATTRIBUTES (decl) = chainon (DECL_ATTRIBUTES (decl), contract_attrs);
-}
-
 /* RAII sentinel to ensures that deferred access checks are popped before
   a function returns.  */
 
@@ -8765,6 +8648,29 @@ extern tree coro_get_actor_function              (tree);
 extern tree coro_get_destroy_function          (tree);
 extern tree coro_get_ramp_function             (tree);
 
+/* contracts.cc */
+extern tree make_postcondition_variable                (cp_expr);
+extern tree make_postcondition_variable                (cp_expr, tree);
+extern tree grok_contract                      (tree, tree, tree, cp_expr, location_t);
+extern tree finish_contract_condition          (cp_expr);
+
+/* Return the first contract in ATTRS, or NULL_TREE if there are none.  */
+
+inline tree
+find_contract (tree attrs)
+{
+  while (attrs && !cxx_contract_attribute_p (attrs))
+    attrs = TREE_CHAIN (attrs);
+  return attrs;
+}
+
+inline void
+set_decl_contracts (tree decl, tree contract_attrs)
+{
+  remove_contract_attributes (decl);
+  DECL_ATTRIBUTES (decl) = chainon (DECL_ATTRIBUTES (decl), contract_attrs);
+}
+
 /* Inline bodies.  */
   
 inline tree
index d6eb50a260bb2fadbf32c6cd27d800088184a3fa..4a85c8586862570a8abb064d5008687e1be09e92 100644 (file)
@@ -12858,9 +12858,10 @@ grokdeclarator (const cp_declarator *declarator,
       inner_declarator = declarator->declarator;
 
       /* Check that contracts aren't misapplied.  */
-      tree contract_attr = find_contract (declarator->std_attributes);
-      if (contract_attr && !function_declarator_p (declarator))
-       diagnose_misapplied_contracts (contract_attr);
+      if (tree contract_attr = find_contract (declarator->std_attributes))
+       if (declarator->kind != cdk_function
+           || innermost_code != cdk_function)
+         diagnose_misapplied_contracts (contract_attr);
 
       /* We don't want to warn in parameter context because we don't
         yet know if the parse will succeed, and this might turn out
@@ -13256,8 +13257,7 @@ grokdeclarator (const cp_declarator *declarator,
              }
 
            /* Contract attributes appertain to the declaration.  */
-           tree *p;
-           for (p = &attrs; *p;)
+           for (tree *p = &attrs; *p;)
              {
                tree l = *p;
                if (cxx_contract_attribute_p (l))
index 6fc6f28999020877f8bd6acde2f2e1f5ba44b99f..a39bcd14015be55738ad0e7717ec1d9134161cad 100644 (file)
@@ -4423,28 +4423,6 @@ collect_ada_namespace (tree namespc, const char *source_file)
       collect_ada_namespace (decl, source_file);
 }
 
-/* cp_tree_defined_p helper -- returns TP if TP is undefined.  */
-
-static tree
-cp_tree_defined_p_r (tree *tp, int *, void *)
-{
-  enum tree_code code = TREE_CODE (*tp);
-  if ((code == FUNCTION_DECL || code == VAR_DECL)
-      && !decl_defined_p (*tp))
-    return *tp;
-  return NULL_TREE;
-}
-
-/* Returns true iff there is a definition for all entities referenced in the
-   tree TP.  */
-
-bool
-cp_tree_defined_p (tree tp)
-{
-  tree undefined_t = walk_tree (&tp, cp_tree_defined_p_r, NULL, NULL);
-  return !undefined_t;
-}
-
 /* Returns true iff there is a definition available for variable or
    function DECL.  */
 
index c218dbcd95fce389f56e321564a71edd8b72d985..1ceac77e662e729100a2bb0ceb383acccafcec6d 100644 (file)
@@ -10178,7 +10178,7 @@ trees_out::fn_parms_init (tree fn)
        tree_node (contract);
     }
 
-  /* Write a reference to contracts pre/post functions, if any to avoid
+  /* Write a reference to contracts pre/post functions, if any, to avoid
      regenerating them in importers.  */
   tree_node (DECL_PRE_FN (fn));
   tree_node (DECL_POST_FN (fn));
index 0f707b57c4c83e5774f1a4ca0263aa320d47d602..a0a1988f76e6c910f6efd1a9d0479ff8e268bbb9 100644 (file)
@@ -1588,17 +1588,6 @@ cp_ensure_no_oacc_routine (cp_parser *parser)
       parser->oacc_routine = NULL;
     }
 }
-
-/* True if ATTR is an assertion.  */
-
-bool
-cp_contract_assertion_p (const_tree attr)
-{
-  /* This is only an assertion if it is a valid cxx contract attribute and the
-     statement is an ASSERTION_STMT.  */
-  return cxx_contract_attribute_p (attr)
-    && TREE_CODE (CONTRACT_STATEMENT (attr)) == ASSERTION_STMT;
-}
 \f
 /* Decl-specifiers.  */
 
@@ -1923,32 +1912,23 @@ make_parameter_declarator (cp_decl_specifier_seq *decl_specifiers,
   return parameter;
 }
 
-/* Returns a pointer to the function declarator iff DECLARATOR is a
-   declaration for a function.  Returns NULL otherwise.  */
+/* Returns true iff DECLARATOR  is a declaration for a function.  */
 
-const cp_declarator *
-find_innermost_function_declarator (const cp_declarator *declarator)
+static bool
+function_declarator_p (const cp_declarator *declarator)
 {
   while (declarator)
     {
       if (declarator->kind == cdk_function
          && declarator->declarator->kind == cdk_id)
-       return declarator;
+       return true;
       if (declarator->kind == cdk_id
          || declarator->kind == cdk_decomp
          || declarator->kind == cdk_error)
-       return NULL;
+       return false;
       declarator = declarator->declarator;
     }
-  return NULL;
-}
-
-/* Returns true iff DECLARATOR  is a declaration for a function.  */
-
-bool
-function_declarator_p (const cp_declarator *declarator)
-{
-  return find_innermost_function_declarator (declarator) != NULL;
+  return false;
 }
 
 /* The parser.  */
@@ -31912,8 +31892,6 @@ cp_parser_function_definition_after_declarator (cp_parser* parser,
     cp_parser_ctor_initializer_opt_and_function_body
       (parser, /*in_function_try_block=*/false);
 
-  fn = current_function_decl;
-
   /* Finish the function.  */
   fn = finish_function (inline_p);
 
@@ -32919,15 +32897,13 @@ cp_parser_save_default_args (cp_parser* parser, tree decl)
   if (UNPARSED_NOEXCEPT_SPEC_P (spec))
     vec_safe_push (unparsed_noexcepts, decl);
 
-  /* If a member function has attributes, they are all deferred.  */
+  /* Contracts are deferred.  */
   for (tree attr = DECL_ATTRIBUTES (decl); attr; attr = TREE_CHAIN (attr))
-    {
-      if (cxx_contract_attribute_p (attr))
-       {
-         vec_safe_push (unparsed_contracts, decl);
-         break;
-       }
-    }
+    if (cxx_contract_attribute_p (attr))
+      {
+       vec_safe_push (unparsed_contracts, decl);
+       break;
+      }
 }
 
 /* DEFAULT_ARG contains the saved tokens for the initializer of DECL,
index b9931a6628b6c0fe9b27251d41c3ad6652392d15..0dbb3be1ee74ec61838898dfaee97c729f6c3f47 100644 (file)
@@ -1918,38 +1918,6 @@ maybe_check_overriding_exception_spec (tree overrider, tree basefn)
   return true;
 }
 
-/* Replace the any contract attributes on OVERRIDER with a copy where any
-   references to BASEFN's PARM_DECLs have been rewritten to the corresponding
-   PARM_DECL in OVERRIDER.  */
-
-static void
-inherit_base_contracts (tree overrider, tree basefn)
-{
-  tree last = NULL_TREE, contract_attrs = NULL_TREE;
-  for (tree a = DECL_CONTRACTS (basefn);
-      a != NULL_TREE;
-      a = CONTRACT_CHAIN (a))
-    {
-      tree c = copy_node (a);
-      TREE_VALUE (c) = build_tree_list (TREE_PURPOSE (TREE_VALUE (c)),
-                                       copy_node (CONTRACT_STATEMENT (c)));
-
-      tree src = basefn;
-      tree dst = overrider;
-      remap_contract (src, dst, CONTRACT_STATEMENT (c), /*duplicate_p=*/true);
-
-      CONTRACT_COMMENT (CONTRACT_STATEMENT (c)) =
-       copy_node (CONTRACT_COMMENT (CONTRACT_STATEMENT (c)));
-
-      chainon (last, c);
-      last = c;
-      if (!contract_attrs)
-       contract_attrs = c;
-    }
-
-  set_decl_contracts (overrider, contract_attrs);
-}
-
 /* Check that virtual overrider OVERRIDER is acceptable for base function
    BASEFN. Issue diagnostic, and return zero, if unacceptable.  */
 
index 8baca776f80bf97235b688a0ae5dc77ec7edbfc4..7166c8108925e3d31fa1c8536321ec4e1064facb 100644 (file)
@@ -995,7 +995,7 @@ get_source (location_t start, location_t end)
       if (line.length () < 1 && (l != expstart.line && l != expend.line))
        continue;
 
-      /* for the first line in the range, only start at expstart.column */
+      /* For the first line in the range, only start at expstart.column */
       if (l == expstart.line)
        {
          if (expstart.column == 0)
@@ -1005,7 +1005,7 @@ get_source (location_t start, location_t end)
          line = line.subspan (expstart.column - 1,
                               line.length() - expstart.column + 1);
        }
-      /* for the last line, don't go past expstart.column */
+      /* For the last line, don't go past expend.column */
       else if (l == expend.line)
        {
          if (line.length () < (size_t)expend.column)
@@ -1016,7 +1016,7 @@ get_source (location_t start, location_t end)
       obstack_grow (&buf_obstack, line.get_buffer (), line.length ());
     }
 
-  /* Null terminate and finish the buf obstack.  */
+  /* NUL-terminate and finish the buf obstack.  */
   obstack_1grow (&buf_obstack, 0);
   const char *buf = (const char *) obstack_finish (&buf_obstack);