How can I stub __attribute__ (((interrupt("IRQ"))) ?

359 views
Skip to first unread message

Vitaliy Bortsov

unread,
Oct 9, 2015, 1:20:34 AM10/9/15
to cpputest
Hello!
I work on embedded GCC ARM project. And want to call IRQ subroutines (written in C/C++) from test code to test behavior.

There are compilations warnings: halcogen/include/sys_vim.h:30:75: warning: 'interrupt' attribute directive ignored [-Wattributes]
 extern void mibspi5Level1Interrupt(void) __attribute__ ((interrupt("IRQ")));

Test works, but I want to stub __attribute__ (((interrupt("IRQ"))) to compile without warnings.

Is it possible?

Regards,
  Vitaliy

James Grenning

unread,
Oct 13, 2015, 4:37:32 PM10/13/15
to cpputest
Hello Vitaliy

I suggest you use a forced include that contains this macro

#define __attribute__(x)

Here is an article about how to do it.
http://www.renaissancesoftware.net/blog/archives/249

--------------------------------------------------------------------------
James Grenning - Author of TDD for Embedded C - wingman-sw.com/tddec
wingman-sw.com
wingman-sw.com/blog
twitter.com/jwgrenning
facebook.com/wingman.sw
[![wingman
software](http://www.wingman-sw.com/images/wingman.png)](http://wingman-sw.com)
> --
> You received this message because you are subscribed to the Google
> Groups "cpputest" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to cpputest+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Vitaliy Bortsov

unread,
Oct 14, 2015, 8:38:44 AM10/14/15
to cpputest
Hello, James.

There are problems: too many errors such:
/usr/lib/gcc/i686-pc-cygwin/4.9.3/include/xopintrin.h: In function '__m256d _mm256_frcz_pd(__m256d)':
/usr/lib/gcc/i686-pc-cygwin/4.9.3/include/xopintrin.h:772:58: error: cannot convert '__m256d {aka double}' to '__vector(4) double' for argument '1' to '__vector(4) double __builtin_ia32_vfrczpd256(__vector(4) double)'
   return (__m256d) __builtin_ia32_vfrczpd256 ((__v4df)__A);

Original string at line 769 from /usr/lib/gcc/i686-pc-cygwin/4.9.3/include/xopintrin.h looks like:
extern __inline __m256d __attribute__((__gnu_inline__, __always_inline__, __artificial__))
_mm256_frcz_pd
(__m256d __A)
{
 
return (__m256d) __builtin_ia32_vfrczpd256 ((__v4df)__A);
}


__attribute__ is very special keyword in GCC and cannot be stubbed to nothing

I think that I cannot do something to silent compiling (except option -Wno-attributes).

Regards,
  Vitaliy


среда, 14 октября 2015 г., 1:37:32 UTC+5 пользователь James Grenning написал:

James Grenning

unread,
Oct 16, 2015, 10:27:12 AM10/16/15
to cpputest
Does -Wno-attributes work?

You next thing to do is to move those problem constructs into macros or
helper functions.

Also think Lasagna code. Can there be a layer in your code that the
non-portable constructs are forbidden to cross? Can the code below the
layer be made small and conditional logic free so that only testing on
the target (then leaving the code alone) is good enough?

James
>> wingman-sw.com <http://wingman-sw.com/tddecwingman-sw.com>
>>> an email to cpputest+u...@googlegroups.com <javascript:>.
Reply all
Reply to author
Forward
0 new messages