util: Drop redundant NDEBUG check #20274

pull hebasto wants to merge 1 commits into bitcoin:master from hebasto:201030-ndebug changing 2 files +1 −7
  1. hebasto commented at 4:44 pm on October 30, 2020: member
  2. in src/util/check.h:47 in 05a315614c outdated
    41@@ -42,10 +42,6 @@ class NonFatalCheckError : public std::runtime_error
    42         }                                                         \
    43     } while (false)
    44 
    45-#if defined(NDEBUG)
    46-#error "Cannot compile without assertions!"
    47-#endif
    


    MarcoFalke commented at 4:56 pm on October 30, 2020:
    This is where our Assert is defined, so I think it makes sense to have the compiler check here.

    hebasto commented at 5:03 pm on October 30, 2020:

    Honestly, I don’t understand why?

    The fault of theNDEBUG check in compat/assumptions.h will stop compilation (at phase 4) as early as possible, because LIBBITCOIN_UTIL is the second in the sequence after LIBBITCOIN_CRYPTO.


    MarcoFalke commented at 5:08 pm on October 30, 2020:

    NDEBUG is a compile flag that can change for each compilation unit, not a fixed architecture property like the other assumptions.

    For example, it might be possible to compile validation.o with NDEBUG (accidentally), the rest of Bitcoin Core without it. The resulting binary will misbehave. (Haven’t checked that though).


    hebasto commented at 5:16 pm on October 30, 2020:

    Thanks for elaboration!

    So redundant code is in compat/assumptions.h, right?


    MarcoFalke commented at 5:20 pm on October 30, 2020:

    So redundant code is in compat/assumptions.h, right?

    Seems fine to remove that


    hebasto commented at 5:29 pm on October 30, 2020:
    Updated.
  3. MarcoFalke added the label Build system on Oct 30, 2020
  4. hebasto force-pushed on Oct 30, 2020
  5. util: Drop redundant NDEBUG check
    util/check.h does this job.
    7c6d8ff05a
  6. hebasto force-pushed on Oct 30, 2020
  7. fanquake commented at 2:58 am on October 31, 2020: member
    NOTE: If this does get merged we’ll also need to update the stripbuildinfo.patch
  8. practicalswift commented at 9:35 am on October 31, 2020: contributor

    The goal of src/compat/assumptions.h is to document all system assumptions we make we make.

    The assumption that the macro NDEBUG is not defined is an important such assumption, so please don’t remove the NDEBUG documentation from src/compat/assumptions.h :)

  9. hebasto closed this on Oct 31, 2020

  10. DrahtBot locked this on Feb 15, 2022

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2024-09-29 01:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me