---
 gcc/brig/brigfrontend/brig-function-handler.cc | 4 ++++
 1 file changed, 4 insertions(+)

>From 1c7084444e887073960b6142d716d3e85f3453d7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pekka=20J=C3=A4=C3=A4skel=C3=A4inen?=
 <pekka.jaaskelai...@parmance.com>
Date: Sat, 17 Feb 2018 08:59:25 +0200
Subject: [PATCH 6/8] [BRIGFE] skip multiple forward declarations of the same
 function

---
 gcc/brig/brigfrontend/brig-function-handler.cc | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gcc/brig/brigfrontend/brig-function-handler.cc b/gcc/brig/brigfrontend/brig-function-handler.cc
index c524dbe..d64135d 100644
--- a/gcc/brig/brigfrontend/brig-function-handler.cc
+++ b/gcc/brig/brigfrontend/brig-function-handler.cc
@@ -80,6 +80,10 @@ brig_directive_function_handler::operator () (const BrigBase *base)
   if (m_parent.m_analyzing)
     return bytes_consumed;
 
+  /* There can be multiple forward declarations of the same function.
+     Skip all but the first one.  */
+  if (!is_definition && m_parent.function_decl (func_name) != NULL_TREE)
+    return bytes_consumed;
   tree fndecl;
   tree ret_value = NULL_TREE;
 
-- 
2.7.4

Reply via email to