Commit 9f2069b2 authored by Augusto Caringi's avatar Augusto Caringi

Prevent empty trigger functions to be optimized away with -O2 (#218)

From the gcc manual: 'noinline - This function attribute prevents a
function from being considered for inlining. If the function does not
have side effects, there are optimizations other than inlining that
cause function calls to be optimized away, although the function call is
live. To keep such calls from being optimized away, put asm ("");'
(https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html)
parent 8082d4a4
...@@ -2,6 +2,6 @@ ...@@ -2,6 +2,6 @@
extern "C" extern "C"
{ {
void BEGIN_trigger() { } void __attribute__((noinline)) BEGIN_trigger() { asm (""); }
void END_trigger() { } void __attribute__((noinline)) END_trigger() { asm (""); }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment