[BRIGFE] skip multiple forward declarations of the same function
authorPekka Jääskeläinen <pekka.jaaskelainen@parmance.com>
Fri, 4 May 2018 18:04:14 +0000 (18:04 +0000)
committerPekka Jääskeläinen <visit0r@gcc.gnu.org>
Fri, 4 May 2018 18:04:14 +0000 (18:04 +0000)
From-SVN: r259950

gcc/brig/ChangeLog
gcc/brig/brigfrontend/brig-function-handler.cc

index 7da06bc7d89fdee99ae96e256fead1b428817ecb..732696420584efb0ba06afbe97fe72c1631dc58b 100644 (file)
@@ -1,3 +1,8 @@
+2018-05-04  Pekka Jääskeläinen  <pekka.jaaskelainen@parmance.com>
+
+       * brig/brigfrontend/brig-function-handler.cc: Skip multiple forward
+       declarations of the same function.
+
 2018-05-04  Pekka Jääskeläinen  <pekka.jaaskelainen@parmance.com>
 
        * brig/brig-lang.c: Do not allow optimizations based on known C
index c524dbe092affafb4e50154218f6708d58d4a2f5..d64135db7f25e4b1878680942f6d6c64d26c6e00 100644 (file)
@@ -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;