[Chapel Merge] Non-debug builds of chpl use -DNDEBUG

Branch: refs/heads/main
Revision: 57bd7d9
Author: mppf
Link: Non-debug builds of chpl use -DNDEBUG by mppf · Pull Request #19299 · chapel-lang/chapel · GitHub
Log Message:

Merge pull request #19299 from mppf/follow-19294-ndebug

Non-debug builds of chpl use -DNDEBUG

Follow-up to PR #19294

Generally, the production compiler doesn't use assert, although it does
appear a bit in some custom LLVM passes and in code from LLVM headers. At
the same time, it is used more heavily in the dyno effort.

This PR changes the non-debug builds of chpl to add -DNDEBUG to
disable assertions. This makes it more consistent with what we do for
runtime builds. Errors that can be user facing should use INT_FATAL in
the production compiler or context->error in dyno.

In slightly more detail, this PR:

  • updates the CI to only do test-dyno for DYNO_ENABLE_ASSERTIONS=1
    since other configurations will check that we can build with
    assertions disabled
  • fixes a variety of "unused variable" and "variable may be used before
    it is set" errors with -DNDEBUG
    • the extraChecks block in llvmGlobalToWide.cpp that I removed is
      just dead code because in that block new_type is never set to
      anything other than NULL
  • adjusted compiler/make/Makefile.compiler.head to include the logic to
    include -DNDEBUG (or not)
  • migrated assert to INT_ASSERT in other places in the production
    compiler - especially convert-uast.cpp
  • adjusted compiler/parser/Makefile to clean bison-chapel.output
    regardless of CHPL_DEVELOPER setting.

Reviewed by @dlongnecke-cray - thanks!

  • [x] full local testing

  • [x] full gasnet testing

    Modified Files:
    M .github/workflows/CI.yml
    M compiler/dyno/lib/resolution/resolution-queries.cpp
    M compiler/llvm/llvmGlobalToWide.cpp
    M compiler/make/Makefile.compiler.head
    M compiler/optimizations/replaceArrayAccessesWithRefTemps.cpp
    M compiler/parser/Makefile
    M compiler/passes/convert-uast.cpp

    Compare: Comparing 02e95746bcca...57bd7d95c5e1 · chapel-lang/chapel · GitHub