gcc -Wp,-MD,drivers/net/.virtio_net_tmp.mod.o.d
-nostdinc
-isystem /usr/lib/gcc/x86_64-linux-gnu/7/include -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi
-I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h -include ./include/linux/compiler_types.h
-D__KERNEL__ -Wall -Wundef
-Wstrict-prototypes -Wno-trigraphs
-fno-strict-aliasing -fno-common -fshort-wchar
-Werror-implicit-function-declaration -Wno-format-security
-std=gnu89
import std.bitmanip;
struct MyStruct
{
mixin(bitfields!(
uint, "x", 2,
uint, "", 6));
}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TWO ways: 1) dmd importer.d | |
2) dmd -unittest importer.d | |
import importme; // *importme.d* is opened and semantic analysis on *importme.d* begins; | |
// now you should follow the comments from *importme.d* | |
//imports are solved now; semantic analysis continues | |
void main() | |
{ |
Now let's see how the previous example correlates with compilation taking longer when using -unittest.
Besides the if(compiledWithUnittest) block from the needsCodegen()
which prefers instantiations from root modules,
there's another if(compiledWithUnittest) which enforces the treatment of non-root modules (imports) as root modules.
for reference: https://github.com/dlang/dmd/blob/f5f0b68b8537270fd70cb7fb27c703abd216377d/src/dmd/dtemplate.d#L7139-L7144
This means that if you have the following program:
module test;
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module x; | |
import y; | |
/* | |
Semantic analysis 1 = only TOP-LEVEL declarations are analyzed | |
By TOP-LEVEL declarations I understand: - functions (the header of the function, the parameters and the return type; | |
*the body IS NOT included*) | |
- global variables (templates instantiations included) | |
- struct/classes/templates declarations |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
touchfiles=" | |
touch $HOME/.dub/packages/phobos-master/phobos/std/file.d | |
touch $HOME/.dub/packages/mir-optim-1.5.1/mir-optim/source/mir/optim/least_squares.d | |
touch $HOME/.dub/packages/mir-cpuid-1.2.2/mir-cpuid/source/cpuid/x86_any.d | |
touch $HOME/.dub/packages/mir-core-1.0.3/mir-core/source/mir/conv.d | |
touch $HOME/.dub/packages/mir-3.2.0/mir/source/mir/model/lda/hoffman.d |