Remove some compile warnings in the vhdlpp code

This commit is contained in:
Cary R 2014-10-14 09:02:33 -07:00
parent f36bebf0e1
commit e896f0c8e6
2 changed files with 15 additions and 9 deletions

View File

@ -370,7 +370,7 @@ static void touchup_interface_for_functions(std::list<InterfacePort*>*ports)
%type <exp_else> else_when_waveform
%type <exp_else_list> else_when_waveforms
%type <subprogram> function_specification subprogram_specification
%type <subprogram> function_specification subprogram_specification subprogram_body_start
%%
@ -2201,13 +2201,18 @@ signal_assignment_statement
}
;
subprogram_body_start
: subprogram_specification K_is
{ assert(!active_sub);
active_sub = $1;
$$ = $1; }
;
/* This is a function/task body. This may have a matching subprogram
declaration, and if so it will be in the active scope. */
subprogram_body /* IEEE 1076-2008 P4.3 */
: subprogram_specification K_is
{ active_sub = $1; }
subprogram_declarative_part
: subprogram_body_start subprogram_declarative_part
K_begin subprogram_statement_part K_end
subprogram_kind_opt identifier_opt ';'
{ Subprogram*prog = $1;
@ -2219,19 +2224,20 @@ subprogram_body /* IEEE 1076-2008 P4.3 */
errormsg(@1, "Subprogram specification for %s doesn't match specification in package header.\n", prog->name().str());
}
prog->transfer_from(*active_scope);
prog->set_program_body($6);
prog->set_program_body($4);
active_scope->bind_name(prog->name(), prog);
active_sub = NULL;
}
| subprogram_specification K_is
| subprogram_body_start
subprogram_declarative_part
K_begin error K_end
subprogram_kind_opt identifier_opt ';'
{ errormsg(@2, "Syntax errors in subprogram body.\n");
yyerrok;
active_sub = NULL;
if ($1) delete $1;
if ($8) delete[]$8;
if ($7) delete[]$7;
}
;

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013 Stephen Williams (steve@icarus.com)
* Copyright (c) 2013-2014 Stephen Williams (steve@icarus.com)
* Copyright CERN 2013 / Stephen Williams (steve@icarus.com)
*
* This source code is free software; you can redistribute it
@ -96,7 +96,7 @@ const InterfacePort*Subprogram::find_param(perm_string nam) const
const VType*Subprogram::peek_param_type(int idx) const
{
if(!ports_ || idx >= ports_->size())
if(!ports_ || idx < 0 || (size_t)idx >= ports_->size())
return NULL;
std::list<InterfacePort*>::const_iterator p = ports_->begin();