Issue 67166 - empty macros used in target definitions should trigger a warning if redefined later
Summary: empty macros used in target definitions should trigger a warning if redefined...
Status: CLOSED FIXED
Alias: None
Product: Build Tools
Classification: Code
Component: dmake (show other issues)
Version: current
Hardware: All All
: P3 Trivial (vote)
Target Milestone: ---
Assignee: hjs
QA Contact: issues@tools
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-10 01:11 UTC by quetschke
Modified: 2013-08-07 15:34 UTC (History)
2 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments
Patch for dmake (3.28 KB, patch)
2006-07-10 01:17 UTC, quetschke
no flags Details | Diff
New patch for dmake (5.41 KB, patch)
2006-07-16 21:48 UTC, quetschke
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this issue.
Description quetschke 2006-07-10 01:11:33 UTC
dmake should issue a warning for when a previously unset macro (i.e. it is
assumed to be empty) is used and later set to a different value.
The following example, see also issue 67145,

-- makefile.mk --
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

# NEWDEP=

all: $(NEWDEP)
	echo $@

NEWDEP=my_dependency
-- makefile.mk --

shows a case where we currently allow the use of an empty macro without
warning that it is (re-)defined in line 9.

If the macro would have been defined, even by setting it to "", (for example
by uncommenting line 4) the current dmake would warn about the redefinition.

Adding this warning makes it easy to catch faulty target definitions where
the prerequisites are expanded early and late evaluation with $$ should have
been used. See again issue 67145 for such a problem.
Comment 1 quetschke 2006-07-10 01:17:04 UTC
Created attachment 37612 [details]
Patch for dmake
Comment 2 hjs 2006-07-10 13:10:55 UTC
nice to get this! i would suggest to have a CWS for fixing the new warnings
before releasing the dmake issueing this warings
Comment 3 quetschke 2006-07-16 07:14:24 UTC
Previous patch breaks the OOo build in subtle way that can be illustrated by
this testcase:

--- t67166.mk ---
SHELL*:=/bin/sh 
SHELLFLAGS*:=-ce

.IF $(AAA)!=123
BLA=bla
.ENDIF

AAA*=123

all:
	+echo "AAA:$(AAA):"
--- t67166.mk ---

$ ./dmake/dmake.exe -rf t67166_1.mk
AAA::

The expanding of $(AAA) in the .IF condition lets the following *= assignment
think that the macro is already assigned so that it doesn't set the macro.
Comment 4 quetschke 2006-07-16 21:48:10 UTC
Created attachment 37798 [details]
New patch for dmake
Comment 5 quetschke 2006-07-17 04:19:59 UTC
The previous patch survived 2/3 of a full OOo build (still building) so far.

Committed the patch and two testcases to CWS dmake46.

Reassigning for verification.
Comment 6 quetschke 2006-07-17 04:20:36 UTC
@ause: Please verify.
Comment 7 hjs 2006-09-14 14:28:22 UTC
btw.: CWS ause066 does remove lots of these warnings.
Comment 8 hjs 2007-01-03 12:04:52 UTC
.