Skip to content

Commit 1687373

Browse files
committed
8349933: Mixing of includes and snippets stack causes the wrong -post snippet to be included
Reviewed-by: ihse
1 parent 53db576 commit 1687373

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

make/common/MakeIncludeEnd.gmk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ ifneq ($(NO_CUSTOM_EXTENSIONS), true)
3434
endif
3535

3636
# Pop our helper name off the stack
37-
HELPER_STACK := $(wordlist 2, $(words $(HELPER_STACK)), $(HELPER_STACK))
37+
INCLUDE_STACK := $(wordlist 2, $(words $(INCLUDE_STACK)), $(INCLUDE_STACK))
3838

3939
# Print an indented message, also counting the top-level makefile as a level
4040
ifeq ($(LOG_FLOW), true)
41-
$(info :$(foreach s, top $(HELPER_STACK), )Leave $(THIS_INCLUDE))
41+
$(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Leave $(THIS_INCLUDE))
4242
endif
4343

4444
# Restore the previous helper name
45-
THIS_INCLUDE := $(firstword $(HELPER_STACK))
45+
THIS_INCLUDE := $(firstword $(INCLUDE_STACK))

make/common/MakeIncludeStart.gmk

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ else
3939
endif
4040

4141
ifeq ($(LOG_FLOW), true)
42-
$(info :$(foreach s, top $(HELPER_STACK), )Enter $(THIS_INCLUDE) [$(THIS_INCLUDE_MSG)])
42+
$(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Enter $(THIS_INCLUDE) [$(THIS_INCLUDE_MSG)])
4343
endif
4444

45-
ifneq ($(filter $(THIS_INCLUDE), $(HELPER_STACK)), )
46-
$(error Internal makefile error: Include loop detected: $(THIS_INCLUDE) $(HELPER_STACK))
45+
ifneq ($(filter $(THIS_INCLUDE), $(INCLUDE_STACK)), )
46+
$(error Internal makefile error: Include loop detected: $(THIS_INCLUDE) $(INCLUDE_STACK))
4747
endif
4848

4949
ifeq ($(words $(MAKEFILE_LIST)), 2)
@@ -66,7 +66,7 @@ ifneq ($(IS_PREINIT_ENV), true)
6666
endif
6767

6868
# Push our helper name onto the stack
69-
HELPER_STACK := $(THIS_INCLUDE) $(HELPER_STACK)
69+
INCLUDE_STACK := $(THIS_INCLUDE) $(INCLUDE_STACK)
7070

7171
# Setup an automatic include guard
7272
ifneq ($(INCLUDE_GUARD_$(THIS_INCLUDE)), true)

make/common/MakeSnippetEnd.gmk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ ifneq ($(NO_CUSTOM_EXTENSIONS), true)
3434
endif
3535

3636
# Pop our helper name off the stack
37-
HELPER_STACK := $(wordlist 2, $(words $(HELPER_STACK)), $(HELPER_STACK))
37+
SNIPPET_STACK := $(wordlist 2, $(words $(SNIPPET_STACK)), $(SNIPPET_STACK))
3838

3939
# Print an indented message, also counting the top-level makefile as a level
4040
ifeq ($(LOG_FLOW), true)
41-
$(info :$(foreach s, top $(HELPER_STACK), )Leave $(THIS_SNIPPET))
41+
$(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Leave $(THIS_SNIPPET))
4242
endif
4343

4444
# Restore the previous helper name
45-
THIS_SNIPPET := $(firstword $(HELPER_STACK))
45+
THIS_SNIPPET := $(firstword $(SNIPPET_STACK))

make/common/MakeSnippetStart.gmk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ endif
3333

3434
# Print an indented message, also counting the top-level makefile as a level
3535
ifeq ($(LOG_FLOW), true)
36-
$(info :$(foreach s, top $(HELPER_STACK), )Enter $(THIS_SNIPPET) [snippet])
36+
$(info :$(foreach s, top $(INCLUDE_STACK) $(SNIPPET_STACK), )Enter $(THIS_SNIPPET) [snippet])
3737
endif
3838

3939
# Push our helper name onto the stack
40-
HELPER_STACK := $(THIS_SNIPPET) $(HELPER_STACK)
40+
SNIPPET_STACK := $(THIS_SNIPPET) $(SNIPPET_STACK)
4141

4242
# Hook to include the corresponding custom file, if present.
4343
ifneq ($(NO_CUSTOM_EXTENSIONS), true)

0 commit comments

Comments
 (0)