Avoid segfault if user fails to call setdata before a mech FUNCTION.#2460
Avoid segfault if user fails to call setdata before a mech FUNCTION.#2460nrnhines wants to merge 20 commits into
Conversation
|
✔️ fc67786 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
✔️ 510e072 -> Azure artifacts URL |
Codecov Report
@@ Coverage Diff @@
## master #2460 +/- ##
==========================================
- Coverage 61.49% 60.84% -0.65%
==========================================
Files 623 622 -1
Lines 119197 119003 -194
==========================================
- Hits 73296 72412 -884
- Misses 45901 46591 +690
... and 24 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
This comment has been minimized.
This comment has been minimized.
|
✔️ 6174b37 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
✔️ a75659b -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
✔️ 3adc3d4 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
✔️ 600a4ab -> Azure artifacts URL |
…ier_without_container Allows checking of _extcall_prop validity by shadowing with an id.
|
✔️ d107912 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
|
✔️ bab11c8 -> Azure artifacts URL |
|
✔️ b2c182b -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
I think I need some help with the Sonar complaints. The first one I looked at puzzled me. What, precisely, is supposed to be const? The Symbol*? Is there a way to experiment with changes without continually pushing to the PR? |
|
You'll need to ignore that complaint in the context of NEURON. Modern C++ codes don't allow global variables, with only very few exceptions. I think they're making an exception of read-only global variables, which is why they talk about |
|
✔️ 08faeb8 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
✔️ 7307381 -> Azure artifacts URL |
This comment has been minimized.
This comment has been minimized.
|
Any reasons remaining that this PR should not receive an approving review? |
Merge queue setting changed
|
SonarCloud Quality Gate failed.
|
I guess we just didn't get time. Sorry for that. Closing this as #2475 includes this already. |
|
@nrnhines : a minor thing - should we delete this branch then? |











Prior to merging this PR, #2504 should be merged.
Closes #686
This PR solves a legacy issue having to do with interpreter calls to density mechanism FUNCTION and PROCEDURE which
make use of RANGE variables. In that case it was necessary to first call
h.setdata_suffix(segment)in order to specify which instance of the mechanism range variable data was to be used by the subsequent function call. The problem is that it is understandably the case that the user forgets thath.setdatamust first be called, or that in the potentially extensive interval between theh.setdatacall and the subsequent function call, the mechanism instance was destroyed by intervening statements. In either case, a segfault would be generated.The SOA and Data Handle improvements make it possible to fix this issue, by generating a recoverable error message. This is implemented in the nocmodl translator with the introduction of
to shadow the legacy
When the function is called by the interpreter, if
_prop_idis not valid, an error message is generated.The implementation checks whether a FUNCTION or PROCEDURE in fact uses a RANGE variable and, if not, a preliminary call to
h.setdatais not required.POINT_PROCESS behavior of FUNCTION and PROCEDURE is ok since each function call already only uses sec(x).mech.func(args) syntax so that instance is determined at time of the call.
This is most important for HOC users. A subsequent PR (#2475) builds on this for Pyhon to allow something like
which automatically sets the data appropriately. For Python, setdata will never be needed.