Skip to content

Fix compiler warnings for systems that treat warnings as errors#445

Open
magicrub wants to merge 1 commit intottlappalainen:masterfrom
magicrub:pr/fix_compiler_warnings1
Open

Fix compiler warnings for systems that treat warnings as errors#445
magicrub wants to merge 1 commit intottlappalainen:masterfrom
magicrub:pr/fix_compiler_warnings1

Conversation

@magicrub
Copy link
Copy Markdown

@magicrub magicrub commented Feb 5, 2025

Fix compiler warnings for systems that treat warnings as errors

@ttlappalainen
Copy link
Copy Markdown
Owner

I had forgot to check this.

Why did you change local variable name from MsgHandler to _local_MsgHandler?

@ttlappalainen
Copy link
Copy Markdown
Owner

This is a bit old, but had too much other work.

Instead of adding pragmas, I'd like to fix code. For double NaN would be proper value, but for some reason that did not always work properly with Arduino environment, when I started to write library. Instead of using N2kDoubleNA for setting, there should be N2kSetNA for different types.

  • N2kIsNA is a question. If we set v to exact NAValue, may it have different value depending in which register on CPU it has been saved? Anyway it could be replaced with different comparison e.g., return v<=N2kDoubleNAHigh && v>=N2kDoubleNALow
  • Why there is no complain for AddxDouble?
  • UndefVal as parameter could probably be removed. I do not thing anyone uses anything difference. Then all tests could use N2kIsNA
  • is -Wsuggest-override anymore necessary, if we add override to functions? Is there compilers less than C++11 using library. I use override in my other code.
  • for name _local_MsgHandler I prefer localMsgHandler

Thoughts?

@denravonska
Copy link
Copy Markdown
Contributor

I think you can safely assume that the compiler has support for override. This was added in gcc-4.7 back in 2012.

@ttlappalainen
Copy link
Copy Markdown
Owner

I am just worried since 2021 someone wrote:
"Different cores use different compilers. Different versions of the same core use different compilers. Different compilers provide different C++ standard levels.

Most cores use GCC or some variant thereof. That could be anything from GCC 3.x.x through to the most recent release (whatever that is this week)."

Maybe I just test with some cores on old Arduino (1.8) IDE.

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