[Mlir-commits] [mlir] fd4efec - [mlir] Fix warning due to non ISO standard __FUNCTION__ usage (#91851)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Sun May 12 23:31:45 PDT 2024


Author: Kai Sasaki
Date: 2024-05-13T15:31:41+09:00
New Revision: fd4efecac21d92428d2f804f43e85bdfa460bdd5

URL: https://github.com/llvm/llvm-project/commit/fd4efecac21d92428d2f804f43e85bdfa460bdd5
DIFF: https://github.com/llvm/llvm-project/commit/fd4efecac21d92428d2f804f43e85bdfa460bdd5.diff

LOG: [mlir] Fix warning due to non ISO standard __FUNCTION__ usage (#91851)

This PR fixes the warning message due to the non ISO standard usage of
`__FUNCTION__`

```
/home/lewuathe/llvm-project/mlir/test/CAPI/transform_interpreter.c: In function ‘testApplyNamedSequence’:
/home/lewuathe/llvm-project/mlir/test/CAPI/transform_interpreter.c:21:27: warning: ISO C does not support ‘__FUNCTION__’ predefined identifier [-Wpedantic]
   21 |   fprintf(stderr, "%s\n", __FUNCTION__);
      |  
```

As `__FUNCTION__` is another name of `__func__` and it conforms to the
specification. We should be able to use `__func__` here.

Ref:
https://stackoverflow.com/questions/52962812/how-to-silence-gcc-pedantic-wpedantic-warning-regarding-function


Compiler

```
Ubuntu clang version 18.1.3 (1)
Target: x86_64-pc-linux-gnu
```

Added: 
    

Modified: 
    mlir/test/CAPI/transform_interpreter.c

Removed: 
    


################################################################################
diff  --git a/mlir/test/CAPI/transform_interpreter.c b/mlir/test/CAPI/transform_interpreter.c
index f1ab185e0e214..a849b2f245264 100644
--- a/mlir/test/CAPI/transform_interpreter.c
+++ b/mlir/test/CAPI/transform_interpreter.c
@@ -18,7 +18,7 @@
 #include <stdlib.h>
 
 int testApplyNamedSequence(MlirContext ctx) {
-  fprintf(stderr, "%s\n", __FUNCTION__);
+  fprintf(stderr, "%s\n", __func__);
 
   const char module[] =
       "module attributes {transform.with_named_sequence} {"


        


More information about the Mlir-commits mailing list