<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - unused-macros reported for a marco used in pre-processor"
   href="https://bugs.llvm.org/show_bug.cgi?id=38693">38693</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>unused-macros reported for a marco used in pre-processor
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </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>eric.chamberland@giref.ulaval.ca
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=20764" name="attach_20764" title="The code for unsed-macros">attachment 20764</a> <a href="attachment.cgi?id=20764&action=edit" title="The code for unsed-macros">[details]</a></span>
The code for unsed-macros

Hi,

this example talks by itself:

------
/* In this example, the FUNC_NAME is used by the pre-processor, but not the
code
 * but is reported as "unused" by the compiler -Wunused-macro
 */
#pragma clang diagnostic warning "-Wunused-macros"

extern void foo(const char[]);

/*#  define PetscRegisterFUNC_NAME() foo(FUNCT_NAME)*/

#define PetscRegisterFUNC_NAME()

#define FUNC_NAME "tata"
void tata() {
  PetscRegisterFUNC_NAME();
}
------
clang -c t.c 
t.c:12:9: warning: macro is not used [-Wunused-macros]
#define FUNC_NAME "tata"

So the FUNC_NAME macro is used in the pre-processing stage, but not the
compiling stage.  Is it possible to tell to the -Wunused-macros to take
pre-processing into account?

Thanks,

Eric</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>