Assertions should be enabled/disabled independently of DOLFIN

Issue #35 new
Jan Blechta created an issue

As it showed up in #34, preprocessor directive -D[N]DEBUG may be inherited from DOLFIN independently of -DCMAKE_BUILD_TYPE cmake command-line directive when building mshr. As a result assertions in mshr cannot be switched on or off.

This is best observed by investigating file <mshr>/build/CMakeFiles/mshr.dir/flags.make. (As a workaround the file can be manually modified (before running make) to achieve expected behaviour.)

Comments (5)

  1. Benjamin Dam Kehlet

    Isn't it very adhoc to "manually" filter out -D[N]DEBUG these values from DOLFIN_CXX_DEFINITIONS? I would argue that Dolfin, in the first place, shouldn't export these flags at all.

  2. Jan Blechta reporter

    I would argue that Dolfin, in the first place, shouldn't export these flags at all.

    Possibly you're right. Any opinion here, @garth-wells, @johannes_ring?

  3. Jan Blechta reporter

    I'm not totally sure what would be the correct solution. The same DOLFINConfig.cmake is probably used when configuring DOLFIN extension modules (including compiled Expressions), demo, bench and test programs. It is usually useful to build all of these with same debugging flags.

    Maybe dolfin_assert could be triggered by -D[N]DOLFINDEBUG directive which could be exported while not exporting -D[N]DEBUG which is general purpose. mshr could then define its own mshr_assert and -D[N]MSHRDEBUG.

  4. Prof Garth Wells

    We could add an extra field to DOLFINConfig.cmake to handle JIT options. The user should then be able to choose whether or not these are used. The test framework would grab the extra options from the CMake file.

  5. Log in to comment