Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disallow STATE variables being GLOBAL #1723

Merged
merged 2 commits into from
Mar 23, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/nmodl/modl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ no longer adequate for saying we can not */
}
#endif
chk_thread_safe();
chk_global_state();
parout(); /* print .var file.
* Also #defines which used to be in defs.h
* are printed into .c file at beginning.
Expand Down
1 change: 1 addition & 0 deletions src/nmodl/nmodlfunc.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ void net_receive(Item* qarg, Item* qp1, Item* qp2, Item* qstmt, Item* qend);
void net_init(Item* qinit, Item* qp2);
void fornetcon(Item* keyword, Item* par1, Item* args, Item* par2, Item* stmt, Item* qend);
void chk_thread_safe();
void chk_global_state();
void threadsafe_seen(Item* q1, Item* q2);
void explicit_decl(int level, Item* q);
void parm_array_install(Symbol* n, char* num, char* units, char* limits, int index);
Expand Down
12 changes: 12 additions & 0 deletions src/nmodl/nocpout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2719,6 +2719,18 @@ void chk_thread_safe() {
}


void chk_global_state() {
int i;
Item *q;
SYMLISTITER {
Symbol* s = SYM(q);
if (s->nrntype & NRNGLOBAL && s->subtype & STAT) {
diag(s->name, " is a STATE variable and hence cannot be declared as GLOBAL");
}
}
}


void threadsafe_seen(Item* q1, Item* q2) {
Item* q;
assert_threadsafe = 1;
Expand Down