public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* c++: Make extern-C mismatch an error
@ 2020-11-03 16:37 Nathan Sidwell
  0 siblings, 0 replies; only message in thread
From: Nathan Sidwell @ 2020-11-03 16:37 UTC (permalink / raw)
  To: GCC Patches

[-- Attachment #1: Type: text/plain, Size: 424 bytes --]


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.

pushing to trunk
-- 
Nathan Sidwell

[-- Attachment #2: externc.diff --]
[-- Type: text/x-patch, Size: 468 bytes --]

diff --git i/gcc/cp/decl.c w/gcc/cp/decl.c
index 114e8d0cb01..9428fa05258 100644
--- i/gcc/cp/decl.c
+++ w/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:37 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:37 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).