Ticket UUID: | 8065d178229d8d335eee64d36ada37c4dedf2579 | |||
Title: | Duplicate -DNDEBUG in compiler command with --disable-symbols | |||
Type: | Bug | Version: | trunk | |
Submitter: | erikleunissen | Created on: | 2015-04-14 20:47:21 | |
Subsystem: | 53. Configure and Build Tools | Assigned To: | jan.nijtmans | |
Priority: | 5 Medium | Severity: | Minor | |
Status: | Closed | Last Modified: | 2015-04-20 11:21:40 | |
Resolution: | Fixed | Closed By: | jan.nijtmans | |
Closed on: | 2015-04-20 11:21:40 | |||
Description: |
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/Makefile.in. 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. - These two assignments occur relatively far apart in the code, in different files (Makefile.in and tcl.m4) - (luckily) 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 -- | |||
User Comments: |
jan.nijtmans added on 2015-04-20 11:21:40:
Fixed in: [0a2e3bb2d9434f88]. Thanks for this report, fully agreed on this analysis! |
Attachments:
- tcl.trunk.patch [download] added by erikleunissen on 2015-04-14 20:47:46. [details]