Skip to content

Commit 31ef10e

Browse files
committed
ImportC: add more to limitations section
1 parent 09c2699 commit 31ef10e

File tree

1 file changed

+46
-3
lines changed

1 file changed

+46
-3
lines changed

spec/importc.dd

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,9 @@ $(H2 $(LNAME2 command-line, Invoking ImportC))
5151
$(LI indirectly via importing a C file)
5252
)
5353

54-
$(H3 ImportC Files on the Command Line)
54+
$(H3 $(LNAME2 command-line, ImportC Files on the Command Line))
5555

56-
$(H3 Importing C Files)
56+
$(H3 $(LNAME2 importing, Importing C Files))
5757

5858

5959
$(H2 $(LNAME2 preprocessor, Preprocessor))
@@ -97,6 +97,7 @@ $(H2 $(LNAME2 preprocessor, Preprocessor))
9797

9898
$(P and the preprocessed output is written to $(TT file.i).)
9999

100+
100101
$(H2 $(LNAME2 preprocessor-directives, Preprocessor Directives))
101102

102103
$(P Nevertheless, ImportC supports these preprocessor directives:)
@@ -110,20 +111,62 @@ $(H2 $(LNAME2 preprocessor-directives, Preprocessor Directives))
110111
$(P $(LINK2 https://gcc.gnu.org/onlinedocs/gcc-11.1.0/cpp/Preprocessor-Output.html, linemarker)
111112
directives are normally embedded in the output of C preprocessors.)
112113

114+
113115
$(H2 $(LNAME2 limitations, Limitations))
114116

115117
$(H3 $(LNAME2 exceptions, Exception Handling))
116118

117119
$(P ImportC is assumed to never throw exceptions. `setjmp` and `longjmp` are not supported.)
118120

119-
$(H3 $(LNAME2 const, Transitive Const))
121+
$(H3 $(LNAME2 const, Const))
120122

121123
$(P C11 specifies that `const` only applies locally. `const` in ImportC applies transitively,
122124
meaning that although $(CCODE int *const p;) means in C11 that p is a const pointer to int,
123125
in ImportC it means p is a const pointer to a const int.)
124126

127+
$(H3 $(LNAME2 volatile, Volatile))
128+
129+
$(P The `volatile` type-qualifier (C11 6.7.3) is ignored. Use of `volatile` to implement shared
130+
memory access is unlikely to work anyway, $(LINK2 #_atomic, _Atomic) is for that.
131+
To use `volatile` as a device register, call a function to do it that is compiled separately,
132+
or use inline assembler.
133+
)
134+
135+
$(H3 $(LNAME2 restrict, Restrict))
136+
137+
$(P The `restrict` type-qualifier (C11 6.7.3) is ignored.)
138+
139+
$(H3 $(LNAME2 _atomic, _Atomic))
140+
141+
$(P The `_Atomic` type-qualifier (C11 6.7.3) is ignored.
142+
To do atomic operations, use an externally compiled function for that, or the inline assembler.)
143+
144+
125145
$(H2 $(LNAME2 extensions, Extensions))
126146

147+
$(H3 $(LNAME2 forward-references, Forward References))
148+
149+
$(P Any declarations in scope can be accessed, not just
150+
declarations that lexically precede a reference.)
151+
152+
$(H3 $(LNAME2 ctfe, Compile Time Function Execution))
153+
154+
$(P Evaluating constant expressions includes executing functions in the
155+
same manner as D's CTFE can.)
156+
157+
$(H3 $(LNAME2 inlining, Function Inlining))
158+
159+
$(P Functions for which the function body is present can
160+
be inlined by ImportC as well as by the D code that calls them.)
161+
162+
$(H3 $(LNAME2 register, Register Storage Class))
163+
164+
$(P Objects with `register` storage class are treated as `auto` declarations.)
165+
166+
$(P Objects with `register` storage class may have their address taken. C11 6.3.2.1-2)
167+
168+
$(P Arrays can have `register` storage class, and may be enregistered by the compiler. C11 6.3.2.1-3)
169+
127170

128171
$(H2 $(LNAME2 gnu-clang-extensions, Gnu and Clang Extensions))
129172

0 commit comments

Comments
 (0)