public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-4680] c++: Make extern-C mismatch an error
@ 2020-11-03 16:49 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-11-03 16:49 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:770ec066b8b5d70921dfab9fcd1bbb87abeb0dc5

commit r11-4680-g770ec066b8b5d70921dfab9fcd1bbb87abeb0dc5
Author: Nathan Sidwell <nathan@acm.org>
Date:   Tue Nov 3 08:35:53 2020 -0800

    c++: Make extern-C mismatch an error
    
    duplicate_decls was being lenient about extern-c mismatches, allowing
    you to have two declarations in the symbol table after emitting an
    error.  This resulted in duplicate error messages in modules, when we
    find the same problem multiple times.  Let's just not let that happen.
    
            gcc/cp/
            * decl.c (duplicate_decls): Return error_mark_node fo extern-c
            mismatch.

Diff:
---
 gcc/cp/decl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
index 114e8d0cb01..9428fa05258 100644
--- a/gcc/cp/decl.c
+++ b/gcc/cp/decl.c
@@ -1776,7 +1776,7 @@ duplicate_decls (tree newdecl, tree olddecl, bool hiding, bool was_hidden)
 			newdecl);
 	      inform (olddecl_loc,
 		      "previous declaration %q#D", olddecl);
-	      return NULL_TREE;
+	      return error_mark_node;
 	    }
 	  /* For function versions, params and types match, but they
 	     are not ambiguous.  */


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-11-03 16:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-03 16:49 [gcc r11-4680] c++: Make extern-C mismatch an error Nathan Sidwell

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).