Overview
| Artifact ID: | 6972fd1e3fc4585523796a98f73d9e19e1a25368 |
|---|---|
| Ticket: | 8065d178229d8d335eee64d36ada37c4dedf2579
Duplicate -DNDEBUG in compiler command with --disable-symbols |
| User & Date: | erikleunissen on 2015-04-14 20:47:21 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/plain"
- comment changed to:
When a unix build is configured with --disable-symbols, the NDEBUG preprocessor directive occurs twice in the compiler command. This indicates cluttered logic somewhere upstream. This patch proposes to resolve the clutter through removal of a specific assignment of this directive in the file unix/tcl.m4. An analysis[*] of tcl.m4 and Makefile.in (fossil trunk) led to the following: - The preprocessor directive NDEBUG is assigned to two different variables, introducing two separate processing paths by which it propagates through the code. - (luckily) These two assignments occur relatively far apart in the code, in different files (Makefile.in and tcl.m4) - These two different processing paths are not (yet) intermingled. They are separately leading to a duplication in the compiler command. The reason is that the two assignments are done under the same conceptual conditions (optimization and --disable-symbols). Other considerations: - -DNDEBUG doesn't merit its place as a part of CFLAGS_OPTIMIZE. It's not an optimization flag for the C compiler; it's a preprocessor directive. The assignment to DEFS through AC_DEFINE() in tcl.m4 is the appropriate way. - The still separate propagation paths leave us with a promise of a simple remedy: eliminating one of these propagations, before more clutter is being introduced on top if it. The attached patch removes the assignment of the NDEBUG preprocessor directive from CFLAGS_OPTIMIZE (Makefile.in). This ticket is in line with patch ticket bc16203b0e. Sincerely, Erik Leunissen -- [*] Analysis details: Commit history in fossil (trunk): 1. artifact [00503f3b97] introduces -DNDEBUG as an assignment to CFLAGS_OPTIMIZE in unix/Makefile.in (2009-07-18) 2. artifact [c0abbe2663] introduces -DNDEBUG as an assignment to DEFS through AC_DEFINE() in unix/tcl.m4 (2012-04-11) 1. The code path w.r.t. assignment to CFLAGS_OPTIMIZE: - _DNDEBUG is assigned to CFLAGS_OPTIMIZE unconditionally - CFLAGS_DEFAULT equals CFLAGS_OPTIMIZE only if ./configured with --disable-symbols (tcl.m4) - CFLAGS_OPTIMIZE is never assigned to another variable than CFLAGS_DEFAULT (tcl.m4) - CFLAGS_DEFAULT is never assigned to another variable than CFLAGS (Makefile.in) 2. The code path w.r.t. assignment to DEFS: - -DNDEBUG is assigned to DEFS only if ./configured with --disable-symbols (tcl.m4) - DEFS == AC_CFLAGS (Makefile.in) 3. The two code paths join: The compiler commands composed by Makefile.in, use variables (like CC_SWITCHES) that are composed of both AC_FLAGS and CFLAGS, without exception. This makes that the compiler commands, if they contain -DNDEBUG, they always end up having it twice, supplied by two different code paths. -- end of message --
- foundin changed to: "trunk"
- is_private changed to: "0"
- login: "erikleunissen"
- priority changed to: "5 Medium"
- private_contact changed to: "609f4c7ecf7dbb7a46acdc7eb164753d196088a6"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "erikleunissen"
- subsystem changed to: "53. Configure and Build Tools"
- title changed to:
Duplicate -DNDEBUG in compiler command with --disable-symbols
- type changed to: "Bug"