Last update May 22, 2011

Submitting Patches



Prerequisites

Create a bugzilla entry for the issue. Be sure to mark it as an enhancement if it's new functionality.

Creating a patch

Important: Instead of creating a patch, consider creating a PullRequest.

The DMD, Phobos and druntime source code is distributed together with DMD, and is also stored on github: D-Programming-Language

If not using git, simply use the "diff" utility to compare the original and modified working tree. If using git, you can use the "git diff" command for simple modifications. Pipe the "diff" output to a file with the ".patch" extension.

Submitting a patch

  1. Attach the patch file to the relevant bug report.
  2. Add the patch keyword to the bug report.

Making it more likely that your patch is accepted

  • Test it.
  • Test it again.
  • Test it by patching a clean copy of Phobos/druntime/the DMD source.
  • Submit test cases.
A test case should be a standalone program that will compile without errors, producing an executable that exits with status 0, on success; or on failure, either fails to compile or exits with a status other than 0. Note that a failed assert or an uncaught exception will generate a non-zero exit status. The test should pass with any combination of compile options (such as -w, -O, -release, -g...). A good test will be short and readable, and ideally produce a reasonable error message on failure.

If your patch fixed an accepts-invalid bug, you can use static if (is (typeof)) or __traits(compiles) to test it. For instance, here is a test case for bug #314, regarding private renamed imports being accessible:

module contains_private_renamed_import;
private import io = std.stdio;

module uses_private_renamed_import;
import contains_private_renamed_import;
static assert (!is (typeof (io.writefln)), "private renamed import from another module is visible");
void main(){}


FrontPage | News | TestPage | MessageBoard | Search | Contributors | Folders | Index | Help | Preferences | Edit

Edit text of this page (date of last change: May 22, 2011 3:16 (diff))