[Chapel Merge] Fix c_ptr conditional checks for --baseline runs

Branch: refs/heads/master
Revision: ea87854
Author: bradcray
Log Message:

Merge pull request #17685 from bradcray/check-cptr-cond-test-baseline

Fix c_ptr conditional checks for --baseline runs

[reviewed by @vasslitvinov]

My previous approach to supporting 'if c_ptr' in an import-based
setting relied on being able to call a method on a null c_ptr pointer
value, but this didn't work when we compile with --baseline. Here,
I'm reverting the routine to a standalone function for this case, but
moving it from CPtr to ChapelBase, so that it's always available
(ChapelBase already used CPtr, so this doesn't add any new
inter-module dependencies).

Modified Files:
M modules/internal/ChapelBase.chpl

M modules/standard/CPtr.chpl

Compare: https://github.com/chapel-lang/chapel/compare/229f4336e3be...ea87854940dd