From dc4df82289f702dc772c90694120edb12c141f57 Mon Sep 17 00:00:00 2001 From: Iain Buclaw Date: Sun, 17 Aug 2025 12:10:23 +0200 Subject: [PATCH] importc: Add .h files to list of ImportC file extensions --- dcompiler.dd | 4 ++++ spec/importc.dd | 9 ++++----- spec/module.dd | 1 + 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/dcompiler.dd b/dcompiler.dd index 927ed6ad27..6029715d2d 100644 --- a/dcompiler.dd +++ b/dcompiler.dd @@ -299,6 +299,10 @@ $(H2 $(LNAME2 switches, Compiler Arguments and Switches)) $(TD $(RELATIVE_LINK2 interface-files, D interface files)) ) $(TR + $(TD $(B .h)) + $(TD C header files) + ) + $(TR $(TD $(B .i)) $(TD preprocessed C source files) ) diff --git a/spec/importc.dd b/spec/importc.dd index 152e800524..0bf77277d4 100644 --- a/spec/importc.dd +++ b/spec/importc.dd @@ -95,8 +95,7 @@ $(H2 $(LNAME2 command-line, Invoking ImportC)) $(H3 $(LNAME2 command-line, ImportC Files on the Command Line)) - $(P ImportC files have one of the extensions `.i`, or `.c`. If no - extension is given, `.i` is tried first, then `.c`. + $(P ImportC files have one of the extensions `.i`, `.h`, or `.c`. ) $(CONSOLE @@ -106,7 +105,7 @@ dmd hello.c) file `hello` (`hello.exe` on Windows) ) - $(BEST_PRACTICE explicitly use a `.i` or `.c` extension when + $(BEST_PRACTICE explicitly use a `.i`, `.h`, or `.c` extension when specifying C files on the command line.) $(H3 $(LNAME2 importing, Importing C Files from D Code)) @@ -117,8 +116,8 @@ dmd hello.c) import hello; --- - $(P which will, if `hello` is not a D file, and has an extension `.i` or `.c`, - compile `hello` with ImportC. + $(P which will, if `hello` is not a D file, and has an extension `.i`, + `.h`, or `.c`, compile `hello` with ImportC. ) $(H2 $(LNAME2 preprocessor, Preprocessor)) diff --git a/spec/module.dd b/spec/module.dd index 57c66d88e6..8d7ceebbd8 100644 --- a/spec/module.dd +++ b/spec/module.dd @@ -229,6 +229,7 @@ qualified with whatever packages they are in. They are not considered to be relative to the module that imports them.) $(IMPLEMENTATION_DEFINED + $(OL $(LI How the compiler resolves the package and module identifiers in an import declaration to its corresponding source files.) ))