Go Down

Topic: Software Serial warning: always_inline function might not be inlinable (Read 1 time) previous topic - next topic

ahdavidson

When compiling a sketch that uses SoftwareSerial with Arduino 1.6.5 and compiler warnings set to default, I get the following warnings:

/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:375:6: warning: always_inline function might not be inlinable [-Wattributes]
 void SoftwareSerial::setRxIntMsk(bool enable)
      ^
/Applications/Arduino.app/Contents/Java/hardware/arduino/avr/libraries/SoftwareSerial/SoftwareSerial.cpp:121:6: warning: always_inline function might not be inlinable [-Wattributes]
 void SoftwareSerial::recv()
      ^

Does anyone know the cause of this?

Thanks.
.andy

kowalski

The compiler (without LTO enabled) will have a hard time with this function attribute as the source code is in the .cpp file. The source code is not correctly written if the inlined member functions are used externally. Internal usage will be inlined.

Cheers!

ahdavidson

I didn't write the library. It's part of the standard Arduino release. I shall let someone know!

.andy
.andy

Marciokoko

So should we enable LTO?  Is that something we want to do?

kowalski

@Marciokoko

There are several reasons to why link-time-optimization is not enabled in the Arduino IDE build.

The first step is to get the source code right. There seems to be a lot of confusion on how to structure code with header files, use inline, name spaces, classes, virtual member functions, templates, etc. But considering that most libraries are written by students (often Media) and not by professionals this should be expected :)

Cheers!

Go Up