<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Variables named `_` should not trigger -Wunused-parameter"
   href="http://llvm.org/bugs/show_bug.cgi?id=15859">15859</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Variables named `_` should not trigger -Wunused-parameter
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>-New Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>kenneth@ballenegger.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>It is common convention in other programming languages to use the variable name
`_` for unused parameters. In C, with blocks for callbacks, and in Objective-C
when using the delegation pattern, there are many valid use cases in which one
would not use a parameter (eg. when your block type / method signature is
defined in a third party api).

I think it would be best not to trigger the `unused-parameter` warning for
variables named `_`. That would enable users of the API to specify their
intention to actually not use the variable.

For example:

    - (IBAction)someAction:(id)_ { // <- warning, unused parameter
        printf("Hello, world!\n");
    }

Or:

    // In an API:
    void calculate_something(MyBlock callback);
    typedef void(^MyBlock)(int, char *info_message);

    // In end-developer code:
    {
        calculate_something(^(int i, char *_) { // <- warning
            printf("Int is: %d\n", i);
        });
    }</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>