aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTristan Gingold <tgingold@free.fr>2015-06-02 21:54:42 +0200
committerTristan Gingold <tgingold@free.fr>2015-06-02 21:54:42 +0200
commitd363464f4a40cd999838aa5d229a3644bfbe2cec (patch)
tree4206b7faa739f3d789ea7ca2d95839ef3dd28ff8
parentc4cb0f1b51fcc1b2a1490e5f7bd9344ce8c05bb6 (diff)
downloadghdl-d363464f4a40cd999838aa5d229a3644bfbe2cec.tar.gz
ghdl-d363464f4a40cd999838aa5d229a3644bfbe2cec.tar.bz2
ghdl-d363464f4a40cd999838aa5d229a3644bfbe2cec.zip
Catch duplicated subprogram body.
Fix bug14.
-rw-r--r--libraries/std/textio.vhdl5
-rw-r--r--libraries/std/textio_body.vhdl5
-rw-r--r--src/vhdl/sem.adb20
3 files changed, 19 insertions, 11 deletions
diff --git a/libraries/std/textio.vhdl b/libraries/std/textio.vhdl
index 3b62d763e..939caf439 100644
--- a/libraries/std/textio.vhdl
+++ b/libraries/std/textio.vhdl
@@ -13,9 +13,8 @@
-- for more details.
--
-- You should have received a copy of the GNU General Public License
--- along with GCC; see the file COPYING. If not, write to the Free
--- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
--- 02111-1307, USA.
+-- along with GCC; see the file COPYING3. If not see
+-- <http://www.gnu.org/licenses/>.
package Textio is
diff --git a/libraries/std/textio_body.vhdl b/libraries/std/textio_body.vhdl
index 4c49670b3..ddf85d7dd 100644
--- a/libraries/std/textio_body.vhdl
+++ b/libraries/std/textio_body.vhdl
@@ -12,9 +12,8 @@
-- for more details.
--
-- You should have received a copy of the GNU General Public License
--- along with GCC; see the file COPYING. If not, write to the Free
--- Software Foundation, 59 Temple Place - Suite 330, Boston, MA
--- 02111-1307, USA.
+-- along with GCC; see the file COPYING3. If not see
+-- <http://www.gnu.org/licenses/>.
package body textio is
--START-V08
diff --git a/src/vhdl/sem.adb b/src/vhdl/sem.adb
index d89eaca65..b78b6cf6e 100644
--- a/src/vhdl/sem.adb
+++ b/src/vhdl/sem.adb
@@ -20,6 +20,7 @@ with Errorout; use Errorout;
with Std_Package; use Std_Package;
with Ieee.Std_Logic_1164;
with Libraries;
+with Files_Map;
with Std_Names;
with Sem_Scopes; use Sem_Scopes;
with Sem_Expr; use Sem_Expr;
@@ -1901,11 +1902,20 @@ package body Sem is
if Spec /= Null_Iir then
-- SUBPRG is the body of the specification SPEC.
- Check_Conformance_Rules (Subprg, Spec);
- Xref_Body (Subprg, Spec);
- Set_Subprogram_Body (Subprg, Subprg_Body);
- Set_Subprogram_Specification (Subprg_Body, Spec);
- Set_Subprogram_Body (Spec, Subprg_Body);
+ if Get_Subprogram_Body (Spec) /= Null_Iir then
+ Error_Msg_Sem
+ (Disp_Node (Spec) & " body already defined at "
+ & Files_Map.Image (Get_Location (Get_Subprogram_Body (Spec))),
+ Subprg);
+ -- Kill warning.
+ Set_Use_Flag (Subprg, True);
+ else
+ Check_Conformance_Rules (Subprg, Spec);
+ Xref_Body (Subprg, Spec);
+ Set_Subprogram_Body (Subprg, Subprg_Body);
+ Set_Subprogram_Specification (Subprg_Body, Spec);
+ Set_Subprogram_Body (Spec, Subprg_Body);
+ end if;
else
-- Forward declaration or specification followed by body.
Set_Subprogram_Overload_Number (Subprg);