From 1e25c5a9bb7042d7bca5a4fa840666dcb16f4918 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Pekka=20J=C3=A4=C3=A4skel=C3=A4inen?= Date: Fri, 4 May 2018 18:04:14 +0000 Subject: [PATCH] [BRIGFE] skip multiple forward declarations of the same function From-SVN: r259950 --- gcc/brig/ChangeLog | 5 +++++ gcc/brig/brigfrontend/brig-function-handler.cc | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/gcc/brig/ChangeLog b/gcc/brig/ChangeLog index 7da06bc7d89..73269642058 100644 --- a/gcc/brig/ChangeLog +++ b/gcc/brig/ChangeLog @@ -1,3 +1,8 @@ +2018-05-04 Pekka Jääskeläinen + + * brig/brigfrontend/brig-function-handler.cc: Skip multiple forward + declarations of the same function. + 2018-05-04 Pekka Jääskeläinen * brig/brig-lang.c: Do not allow optimizations based on known C diff --git a/gcc/brig/brigfrontend/brig-function-handler.cc b/gcc/brig/brigfrontend/brig-function-handler.cc index c524dbe092a..d64135db7f2 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.30.2