[llvm-bugs] [Bug 38693] New: unused-macros reported for a marco used in pre-processor

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Aug 24 11:40:00 PDT 2018


https://bugs.llvm.org/show_bug.cgi?id=38693

            Bug ID: 38693
           Summary: unused-macros reported for a marco used in
                    pre-processor
           Product: clang
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric.chamberland at giref.ulaval.ca
                CC: llvm-bugs at lists.llvm.org

Created attachment 20764
  --> https://bugs.llvm.org/attachment.cgi?id=20764&action=edit
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

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20180824/7bf9c687/attachment.html>


More information about the llvm-bugs mailing list