public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Martin Sebor <msebor@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-3267] Disable gcc_rich_location copying and assignment. Date: Tue, 31 Aug 2021 17:24:58 +0000 (GMT) [thread overview] Message-ID: <20210831172458.0D4823858012@sourceware.org> (raw) https://gcc.gnu.org/g:e4d2305adf4e9d11e396c1c5e5ae6214340cbcc2 commit r12-3267-ge4d2305adf4e9d11e396c1c5e5ae6214340cbcc2 Author: Martin Sebor <msebor@redhat.com> Date: Tue Aug 31 11:15:21 2021 -0600 Disable gcc_rich_location copying and assignment. gcc/cp/ChangeLog: * parser.c (cp_parser_selection_statement): Use direct initialization instead of copy. gcc/ChangeLog: * gcc-rich-location.h (gcc_rich_location): Make ctor explicit. libcpp/ChangeLog: * include/line-map.h (class rich_location): Disable copying and assignment. Diff: --- gcc/cp/parser.c | 4 ++-- gcc/gcc-rich-location.h | 6 ++++-- libcpp/include/line-map.h | 6 ++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index 7dc4eae7102..1e2a4b121ea 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -12848,7 +12848,7 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p, IF_STMT_CONSTEVAL_P (statement) = true; condition = finish_if_stmt_cond (boolean_false_node, statement); - gcc_rich_location richloc = tok->location; + gcc_rich_location richloc (tok->location); bool non_compound_stmt_p = false; if (cp_lexer_next_token_is_not (parser->lexer, CPP_OPEN_BRACE)) { @@ -12876,7 +12876,7 @@ cp_parser_selection_statement (cp_parser* parser, bool *if_p, RID_ELSE)) { cp_token *else_tok = cp_lexer_peek_token (parser->lexer); - gcc_rich_location else_richloc = else_tok->location; + gcc_rich_location else_richloc (else_tok->location); guard_tinfo = get_token_indent_info (else_tok); /* Consume the `else' keyword. */ cp_lexer_consume_token (parser->lexer); diff --git a/gcc/gcc-rich-location.h b/gcc/gcc-rich-location.h index 00747631025..2a9e5db65d5 100644 --- a/gcc/gcc-rich-location.h +++ b/gcc/gcc-rich-location.h @@ -21,14 +21,16 @@ along with GCC; see the file COPYING3. If not see #define GCC_RICH_LOCATION_H /* A gcc_rich_location is libcpp's rich_location with additional - helper methods for working with gcc's types. */ + helper methods for working with gcc's types. The class is not + copyable or assignable because rich_location isn't. */ + class gcc_rich_location : public rich_location { public: /* Constructors. */ /* Constructing from a location. */ - gcc_rich_location (location_t loc, const range_label *label = NULL) + explicit gcc_rich_location (location_t loc, const range_label *label = NULL) : rich_location (line_table, loc, label) { } diff --git a/libcpp/include/line-map.h b/libcpp/include/line-map.h index 7d964172469..464494bfb5b 100644 --- a/libcpp/include/line-map.h +++ b/libcpp/include/line-map.h @@ -1670,6 +1670,12 @@ class rich_location /* Destructor. */ ~rich_location (); + /* The class manages the memory pointed to by the elements of + the M_FIXIT_HINTS vector and is not meant to be copied or + assigned. */ + rich_location (const rich_location &) = delete; + void operator= (const rich_location &) = delete; + /* Accessors. */ location_t get_loc () const { return get_loc (0); } location_t get_loc (unsigned int idx) const;
reply other threads:[~2021-08-31 17:24 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20210831172458.0D4823858012@sourceware.org \ --to=msebor@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).