Skip to content
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

[CodeStyle] Fix some unused parameter compilation errors (not opened) #49147

Closed

Conversation

AndPuQing
Copy link
Contributor

@AndPuQing AndPuQing commented Dec 18, 2022

PR types

Others

PR changes

Others

Describe

该 PR 修复了一些未打开的 unused-parameter 编译 warning

修复方式主要有以下几种:

  • 对于在函数形式参数存在,但是后续函数体确实未使用的情况 采用注释掉参数名进行修复
void foo(int x){
   // do something
}

void foo(int /*x*/){
   // do something
}
  • 有些是因为该函数只在GPU上作用,这种情况,使用一个 UNUSED 宏声明参数可能会没用到
void foo(int UNUSED x){
   // do something
}

void foo(int UNUSED x){
   // do something
}

@luotao1

@paddle-bot
Copy link

paddle-bot bot commented Dec 18, 2022

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

@paddle-bot paddle-bot bot added contributor External developers status: proposed labels Dec 18, 2022
@AndPuQing AndPuQing changed the title [WIP][CodeStyle] Fix some unused parameter compilation errors (not opened) [CodeStyle] Fix some unused parameter compilation errors (not opened) Dec 18, 2022
@zhiqiu
Copy link
Contributor

zhiqiu commented Dec 20, 2022

我看基本都是 xx_sig.cc,@chenwhql 看下是否ok?

另外,如果修改我建议是否统一成 UNUSED? host code默认没有这个宏,可以定义一个:

#ifdef __GNUC__
#  define UNUSED  __attribute__((__unused__))
#else
#  define UNUSED 
#endif

@chenwhql
Copy link
Contributor

我看基本都是 xx_sig.cc,@chenwhql 看下是否ok?

另外,如果修改我建议是否统一成 UNUSED? host code默认没有这个宏,可以定义一个:

#ifdef __GNUC__
#  define UNUSED  __attribute__((__unused__))
#else
#  define UNUSED 
#endif

我这边ok,UNUSED的话,paddle/phi/core/macros.h里面有一个,可以视情况复用

@luotao1
Copy link
Contributor

luotao1 commented Jan 4, 2023

@AndPuQing

  1. 需要解决一下冲突,以及过一下CodeStyle流水线
  2. 关于统一成 UNUSED 的建议,如果修改起来有问题,可以在PR里讨论

@luotao1 luotao1 closed this May 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contributor External developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants