Skip to content

Fix an error under -Werror by removing redundant const#1639

Merged
houseroad merged 1 commit intoonnx:masterfrom
daquexian:fix_werror
Nov 21, 2018
Merged

Fix an error under -Werror by removing redundant const#1639
houseroad merged 1 commit intoonnx:masterfrom
daquexian:fix_werror

Conversation

@daquexian
Copy link
Copy Markdown
Member

I got an error

/home/daquexian/repos/onnx/onnx/shape_inference/implementation.cc: In function ‘void onnx::shape_inference::InferShapeForFunctionNode(const onnx::Function
Proto&, const onnx::ISchemaRegistry*, onnx::InferenceContext&)’:                                                                                         
/home/daquexian/repos/onnx/onnx/shape_inference/implementation.cc:242:53: error: type qualifiers ignored on cast result type [-Werror=ignored-qualifiers]
   for (int i = 0; i < (const int)(ctx.getNumInputs()); ++i) {                                                                                           
                                                     ^         

when using gcc 8.2.1.

It is no need to cast a rvalue to const, so I removed it. :)

@houseroad houseroad merged commit e38f3ec into onnx:master Nov 21, 2018
@rdzhabarov
Copy link
Copy Markdown
Contributor

any reason not to add -Werror flag to the CI?

@houseroad
Copy link
Copy Markdown
Member

Even with -Werror, such problem may not be detected. Also if we set -Werror, projects which use onnx may get frustrated.

Some useful blog: https://embeddedartistry.com/blog/2017/5/3/-werror-is-not-your-friend

hariharans29 pushed a commit to hariharans29/onnx that referenced this pull request Aug 15, 2019
jcwchen pushed a commit to jcwchen/onnx that referenced this pull request Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants