Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit ae9581c

Browse files
committedNov 25, 2018
Fix Issue 19433 - Don't consume --DRT-* options if rt_cmdline_enabled is false
1 parent 072b7a4 commit ae9581c

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed
 

‎posix.mak

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ HAS_ADDITIONAL_TESTS:=$(shell test -d test && echo 1)
253253
ifeq ($(HAS_ADDITIONAL_TESTS),1)
254254
ADDITIONAL_TESTS:=test/init_fini test/exceptions test/coverage test/profile test/cycles test/allocations test/typeinfo \
255255
test/aa test/hash \
256-
test/thread test/unittest test/imports test/betterc test/stdcpp
256+
test/thread test/unittest test/imports test/betterc test/stdcpp test/config
257257
ADDITIONAL_TESTS+=$(if $(SHARED),test/shared,)
258258
endif
259259

‎src/rt/dmain2.d

+3-1
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,9 @@ extern (C) int _d_run_main(int argc, char **argv, MainFunc mainFunc)
443443
size_t j = 0;
444444
foreach (arg; args)
445445
{
446-
if (arg.length < 6 || arg[0..6] != "--DRT-") // skip D runtime options
446+
import rt.config : rt_cmdline_enabled;
447+
448+
if (!rt_cmdline_enabled!() || arg.length < 6 || arg[0..6] != "--DRT-") // skip D runtime options
447449
{
448450
argsCopy[j++] = (argBuff[0 .. arg.length] = arg[]);
449451
argBuff += arg.length;

‎test/config/Makefile

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
include ../common.mak
2+
3+
TESTS:=test19433
4+
5+
.PHONY: all clean
6+
all: $(addprefix $(ROOT)/,$(addsuffix .done,$(TESTS)))
7+
8+
$(ROOT)/%: $(SRC)/%.d
9+
$(QUIET)$(DMD) $(DFLAGS) -of$@ $<
10+
11+
$(ROOT)/test19433.done: $(ROOT)/test19433
12+
@echo Testing test19433
13+
$(QUIET)$(ROOT)/test19433 --DRT-dont-eat-me
14+
@touch $@
15+
16+
clean:
17+
rm -rf $(ROOT)

‎test/config/src/test19433.d

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extern(C) __gshared bool rt_cmdline_enabled = false;
2+
3+
void main(string[] args)
4+
{
5+
assert(args.length == 2);
6+
assert(args[1] == "--DRT-dont-eat-me");
7+
}

0 commit comments

Comments
 (0)
This repository has been archived.