Skip to content

[mlir] Fix warning due to non ISO standard __FUNCTION__ usage #91851

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 13, 2024

Conversation

Lewuathe
Copy link
Member

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

@Lewuathe Lewuathe requested a review from ftynse May 11, 2024 12:19
@llvmbot llvmbot added the mlir label May 11, 2024
@llvmbot
Copy link
Member

llvmbot commented May 11, 2024

@llvm/pr-subscribers-mlir

Author: Kai Sasaki (Lewuathe)

Changes

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

Full diff: https://github.com/llvm/llvm-project/pull/91851.diff

1 Files Affected:

  • (modified) mlir/test/CAPI/transform_interpreter.c (+1-1)
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} {"

@Lewuathe Lewuathe requested a review from joker-eph May 13, 2024 01:19
@Lewuathe Lewuathe merged commit fd4efec into llvm:main May 13, 2024
6 checks passed
@Lewuathe Lewuathe deleted the non-standard-warning branch May 13, 2024 06:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants