From 545d2f917780a213385793518076efadb37bf176 Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Sat, 10 Apr 2021 16:33:53 +0200 Subject: [PATCH] Report an error when trying to define ports 'v', 'vd', 'i', and 'id' as 'inout' Parch 105 provided by Giles Atkinson --- src/xspice/cmpp/ifs_yacc.y | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/xspice/cmpp/ifs_yacc.y b/src/xspice/cmpp/ifs_yacc.y index 3f9688ca1..f7cc006a6 100644 --- a/src/xspice/cmpp/ifs_yacc.y +++ b/src/xspice/cmpp/ifs_yacc.y @@ -221,6 +221,11 @@ static void check_port_type_direction (Dir_t dir, Port_Type_t port_type) case DIFF_VOLTAGE: case CURRENT: case DIFF_CURRENT: + if (dir == CMPP_INOUT) { + yyerror ("Port types `v', `vd', `i', `id' are not valid for `inout' ports"); + ifs_num_errors++; + } + break; case DIGITAL: case USER_DEFINED: /* @@ -229,8 +234,8 @@ static void check_port_type_direction (Dir_t dir, Port_Type_t port_type) break; case VSOURCE_CURRENT: if (dir != CMPP_IN) { - yyerror ("Port type `vnam' is only valid for `in' ports"); - ifs_num_errors++; + yyerror ("Port type `vnam' is only valid for `in' ports"); + ifs_num_errors++; } break; case CONDUCTANCE: @@ -238,8 +243,8 @@ static void check_port_type_direction (Dir_t dir, Port_Type_t port_type) case RESISTANCE: case DIFF_RESISTANCE: if (dir != CMPP_INOUT) { - yyerror ("Port types `g', `gd', `h', `hd' are only valid for `inout' ports"); - ifs_num_errors++; + yyerror ("Port types `g', `gd', `h', `hd' are only valid for `inout' ports"); + ifs_num_errors++; } break; default: