Skip to content

Commit

Permalink
don't warn about chpl_comm primitives from chpldoc tool (#23330)
Browse files Browse the repository at this point in the history
This PR updates a check that was added in
#23275 to not warn about
deprecated behavior of `chpl_comm_put/get` when building docs using
`chpldoc` and adds a test to verify the behavior.

When we generate documentation, we only pass absolute paths of the
internal modules, and this causes the compiler library to not recognize
standard and package modules as bundled code. In this PR we change the
check to also ensure the tool that's processing the AST is not `chpldoc`
before warning about the new behavior.



Thanks to @bradcray for pointing this bug out!


TESTING:

- [x] paratest `[Summary: #Successes = 16970 | #Failures = 0 | #Futures
= 919]`

[reviewed by @ShreyasKhandekar - thanks!]
  • Loading branch information
arezaii authored Sep 14, 2023
2 parents 215f3ca + 3ba9326 commit 05e8c98
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
6 changes: 4 additions & 2 deletions frontend/lib/uast/post-parse-checks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -672,9 +672,11 @@ void Visitor::checkSparseKeyword(const FnCall* node) {

// TODO: remove this check and warning after 1.34?
void Visitor::checkPrimCallInUserCode(const PrimCall* node) {
// suppress this warning from chpldoc
if (isUserCode())
if (node->prim() == PrimitiveTag::PRIM_CHPL_COMM_GET ||
node->prim() == PrimitiveTag::PRIM_CHPL_COMM_PUT)
if ((node->prim() == PrimitiveTag::PRIM_CHPL_COMM_GET ||
node->prim() == PrimitiveTag::PRIM_CHPL_COMM_PUT) &&
context_->configuration().toolName != "chpldoc")
warn(node, "the primitives 'chpl_comm_get' and 'chpl_comm_put',"
" have changed behavior in Chapel 1.32. Please use"
" the 'Communication' module's 'get' and 'put' procedures"
Expand Down
1 change: 1 addition & 0 deletions test/chpldoc/noWarnCommGetPut.doc.chpl
Empty file.
6 changes: 6 additions & 0 deletions test/deprecated/chplCommGetPut.chpl
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
Test to make sure we do/don't warn about the changed behavior (depending on
if using chpl or chpldoc) in these primitives from v1.31 to v1.32.
Should remove when we stop warning about the change, likely with v1.34.
*/

inline proc GET(addr, node, rAddr, size) {
__primitive("chpl_comm_get", addr, node, rAddr, size);
}
Expand Down
8 changes: 4 additions & 4 deletions test/deprecated/chplCommGetPut.good
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
chplCommGetPut.chpl:1: In function 'GET':
chplCommGetPut.chpl:2: warning: the primitives 'chpl_comm_get' and 'chpl_comm_put', have changed behavior in Chapel 1.32. Please use the 'Communication' module's 'get' and 'put' procedures as replacements for calling the primitives directly
chplCommGetPut.chpl:5: In function 'PUT':
chplCommGetPut.chpl:6: warning: the primitives 'chpl_comm_get' and 'chpl_comm_put', have changed behavior in Chapel 1.32. Please use the 'Communication' module's 'get' and 'put' procedures as replacements for calling the primitives directly
chplCommGetPut.chpl:7: In function 'GET':
chplCommGetPut.chpl:8: warning: the primitives 'chpl_comm_get' and 'chpl_comm_put', have changed behavior in Chapel 1.32. Please use the 'Communication' module's 'get' and 'put' procedures as replacements for calling the primitives directly
chplCommGetPut.chpl:11: In function 'PUT':
chplCommGetPut.chpl:12: warning: the primitives 'chpl_comm_get' and 'chpl_comm_put', have changed behavior in Chapel 1.32. Please use the 'Communication' module's 'get' and 'put' procedures as replacements for calling the primitives directly

0 comments on commit 05e8c98

Please sign in to comment.