Author Topic: Building bare arduino code with zero warning  (Read 2239 times)

0 Members and 1 Guest are viewing this topic.

Offline Vindhyachal.taknikiTopic starter

  • Frequent Contributor
  • **
  • Posts: 487
Building bare arduino code with zero warning
« on: December 17, 2014, 03:39:04 pm »
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.
Code: [Select]
void setup(void)
{
}

void loop(void)
{
}

2. On building code I have seen warnings in three files as below:
Code: [Select]
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



Code: [Select]
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*'



Code: [Select]
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





3. 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?


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


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

6. I have also attached 3 original files in which there were errors.
 

Offline bobcat

  • Regular Contributor
  • *
  • Posts: 94
  • Country: us
Re: Building bare arduino code with zero warning
« Reply #1 on: December 17, 2014, 11:55:19 pm »
Those errors are a quirk of the Arduino environment. It compiles all libraries even if you are not using them, so those warnings are harmless unless you actually use the libraries. It's just sloppy code. The unused libraries are not linked unless you use them.
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21658
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Building bare arduino code with zero warning
« Reply #2 on: December 18, 2014, 12:02:52 am »
Libraries, premade files, IP and whatnot -- who would've thought anyone would make public releases when they drop warnings like they're hot? :-DD

Worst I've seen personally was an ARM Cortex soft core that synthesized with ~300 warnings and such.  Essentially unsupported, too.  But I imagine others have far jucier stories to share, if we continue this tangent.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf