Building bare arduino code with zero warning

I like to build my code with zero warning/error. Warning in some cases may be unavoidable but can be most of cases.

  1. I have written a bare minimum code as below
void setup(void)
{
}

void loop(void)
{
}
  1. On building code I have seen warnings in three files as below:
HardwareSerial.cpp.o 
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In function 'void store_char(unsigned char, ring_buffer*)':
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:98: warning: comparison between signed and unsigned integer expressions
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In function 'void __vector_18()':
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:127: warning: unused variable 'c'
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In member function 'void HardwareSerial::begin(long unsigned int, byte)':
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:368: warning: unused variable 'current_config'
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp: In member function 'virtual size_t HardwareSerial::write(uint8_t)':
C:\Program Files\Arduino\hardware\arduino\cores\arduino\HardwareSerial.cpp:467: warning: comparison between signed and unsigned integer expressions
Stream.cpp.o 
C:\Program Files\Arduino\hardware\arduino\cores\arduino\Stream.cpp: In member function 'bool Stream::find(char*)':
C:\Program Files\Arduino\hardware\arduino\cores\arduino\Stream.cpp:78: warning: deprecated conversion from string constant to 'char*'
Tone.cpp.o 
C:\Program Files\Arduino\hardware\arduino\cores\arduino\Tone.cpp:119: warning: only initialized variables can be placed into program memory area
  1. Warnings in HardwareSerial.cpp , I have removed & file I have attached.
    On top of attached file I have also mentioned how I have removed those.
    Any comment/suggestion on that whether I have done right or wrong?

  2. Warning in other files I don't understand. Anyone else can help on that??

  3. I am not very legalese person, so don't if editing these files violates anything?

HardwareSerial.cpp (14.1 KB)

It appears you are on WindowsXP, 32-bit.
It appears you are running Arduino 1.0.x

I like to build my code with zero warning/error. Warning in some cases may be unavoidable but can be most of cases.

There is no legal problem with changing core code unless you sell your sketch code to someone: then you must provide the modified files and enough detail such that the purchaser can recompile if they wished.

As far as wanting to have no warnings, good luck. 1.5.8 beta is out in the open and by the time you complete one version, another will emerge... An endless battle.

My suggestion, worry about errors first; then, if just look over the warnings to ensure the compiler made the correct choice.

Ray

These were reported a long time ago (warnings from arduino libraries, [imported] · Issue #963 · arduino/Arduino · GitHub , https://code.google.com/p/arduino/issues/detail?id=963)
And in fact they seem to be fixed in 1.5.x back in Feb, 2014. So the easiest fix is to simply update your IDE version.
(I suspect that this also means that there is no intent to fix these in the older SW.)

1.5.x also adds a "-w" (ignore warnings) switch to the compile statements, so such warnings might not show up even if they hadn't been fixed. But it's easy to change to "-Wall" by editing the build "recipes" in platforms.txt