|
2015-04-20
| ||
| 11:21 | • Closed ticket [8065d17822]: Duplicate -DNDEBUG in compiler command with --disabl... artifact: cc4f6dfb76 user: jan.nijtmans | |
| 10:35 | Fix [8065d178229d8d335eee64d36ada37c4dedf2579|8065d17822]: Duplicate -DNDEBUG in compiler command wi... check-in: 0a2e3bb2d9 user: jan.nijtmans tags: trunk | |
|
2015-04-14
| ||
| 20:51 | • Ticket [8065d17822] Duplicate -DNDEBUG in compiler command with --disable-symbol... artifact: 7581ce7351 user: erikleunissen | |
| 20:50 | • Ticket [8065d17822]: 3 changes artifact: b282f348fd user: erikleunissen | |
| 20:47 | • Add attachment tcl.trunk.patch to ticket [8065d17822] artifact: 3cd32b4079 user: erikleunissen | |
| 20:47 | • New ticket [8065d17822] Duplicate -DNDEBUG in compiler command with --disable-sy... artifact: 6972fd1e3f user: erikleunissen | |
Duplicate -DNDEBUG in compiler command with --disable-symbols
Closed / Fixed8065d178229d8d335eee64d36ada37c4dedf2579Created 12 years agoUpdated 12 years ago
Descriptionplain2015-04-14 20:47:21
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 --
Referenced by1
0a2e3bb2d9Fix [8065d178229d8d335eee64d36ada37c4dedf2579|8065d17822]: Duplicate -DNDEBUG in compiler command with --disable-symbols check-in2015-04-20 10:35:20
erikleunissen Ticket [8065d17822]: 3 changes
[History diff]2015-04-14 20:50:40
erikleunissen Ticket [8065d17822]: 3 changes
[History diff]2015-04-14 20:51:33
jan.nijtmanswiki2015-04-20 11:21:40
Fixed in: [0a2e3bb2d9434f88]. Thanks for this report, fully agreed on this analysis!
Log in (anonymous is fine) to add a comment.