Skip to content

Commit 2b171e6

Browse files
author
Jonathan Marler
committed
Document the new -i dmd compiler option
1 parent f184486 commit 2b171e6

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

dcompiler.dd

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,45 @@ dmd -cov -unittest myprog.d
675675
are searched in the same order.
676676
)
677677

678+
$(SWITCH $(SWNAME -i),
679+
same as -i=-std,-core,-etc,-object
680+
)
681+
682+
$(SWITCH $(SWNAME -i=[-]<pkg>,...),
683+
this option enables "include import" mode, where the compiler will
684+
include imported modules in the compilation, as if they were given
685+
on the command line.
686+
687+
Determining which modules to include is based on a set of "module patterns".
688+
These patterns are optionally included after the "-i=" option as a comma
689+
separated list. A pattern matches any module whose fully qualified name
690+
starts with the pattern. For example, the pattern "foo.bar" matches all modules
691+
in the "foo.bar" package, such as "foo.bar" itself, "foo.bar.baz" or even
692+
"foo.bar.package".
693+
694+
The presence of the "-" prefix in a module pattern indicates that matching-modules
695+
should be excluded from compilation. Patterns without this indicate that
696+
matching-modules should be included in compilation.
697+
698+
Note that along with the module patterns given by the user, there is a standard
699+
set of exclusionary module patterns that are always used, namely:
700+
"-std,-core,-etc,-object"
701+
Note that these can be overriden (i.e. -i=std,core,etc,object).
702+
703+
Since module patterns can either be inclusionary or exclusionary, a priority
704+
must be established to handle the case where a module matches multiple patterns.
705+
A pattern's priority is determined by it's component length, where more components
706+
is higher priority, i.e. foo.bar.baz is a higher priority match than foo.bar.
707+
708+
The default behavior to include modules or exclude them is based on whether the user
709+
has provided any "inclusionary" module patterns. If no patterns are
710+
given, or they are all exclusionary, then modules that don't match any pattern
711+
will be included by default. However, if at least one "inclusionary" module
712+
pattern is given, then modules that don't match any pattern will be excluded by
713+
default. Should the user want to override this behavior, they can use the special
714+
"." pattern to "include by default" or "-." to "exclude by default".
715+
)
716+
678717
$(SWITCH $(SWNAME -ignore),
679718
ignore unsupported pragmas
680719
)

0 commit comments

Comments
 (0)