<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: #pragma INLINE in CodeWarrior for MCU</title>
    <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pragma-INLINE/m-p/157126#M4138</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;the compiler will only inline functions he is able to 'see': if the function is inside the same file, and above where you want to inline it.&lt;/P&gt;&lt;P&gt;So it is a good idea to place the functions to be inlined at the beginning of the C file.&lt;/P&gt;&lt;P&gt;If your function 'bar' does something short, you may consider to make a C macro out of it and have it placed in a header file: that way you can get inlining through the preprocessor.&lt;/P&gt;&lt;P&gt;The other idea would be to have bar() in a separate small file (defined as static function, btw):&lt;/P&gt;&lt;P&gt;Then you could include this file in each of the modules where you want to inline it.&lt;/P&gt;&lt;P&gt;In order not to change a lot of files (to include this 'inline' file), you could simply use the -AddIncl command line switch (e.g. -AddInclMyIncludeFile.inc )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 25 Nov 2009 20:55:15 GMT</pubDate>
    <dc:creator>BlackNight</dc:creator>
    <dc:date>2009-11-25T20:55:15Z</dc:date>
    <item>
      <title>#pragma INLINE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pragma-INLINE/m-p/157125#M4137</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I'm using CW 6.2 on a HS08QE16.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've a function in foo.c:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;#pragma INLINE&lt;/P&gt;&lt;P&gt;void bar(void)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;//do something short&amp;nbsp;&lt;/P&gt;&lt;P&gt;}&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Compiler has the -Oi flag.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now, if' I call this function within foo.c, it's inlined.&lt;/P&gt;&lt;P&gt;But if I use it on another file (for example main.c) it's not inlined. And I wish that it will be inlined everywhere.&lt;/P&gt;&lt;P&gt;In foo.h there is simply the declaration:&lt;/P&gt;&lt;P&gt;void bar(void);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried using extern:&lt;/P&gt;&lt;P&gt;extern void bar(void);&lt;/P&gt;&lt;P&gt;but it doesn't change anything.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Some ideas?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks Bye Jack&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2009 20:43:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pragma-INLINE/m-p/157125#M4137</guid>
      <dc:creator>jag</dc:creator>
      <dc:date>2009-11-25T20:43:06Z</dc:date>
    </item>
    <item>
      <title>Re: #pragma INLINE</title>
      <link>https://community.nxp.com/t5/CodeWarrior-for-MCU/pragma-INLINE/m-p/157126#M4138</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;the compiler will only inline functions he is able to 'see': if the function is inside the same file, and above where you want to inline it.&lt;/P&gt;&lt;P&gt;So it is a good idea to place the functions to be inlined at the beginning of the C file.&lt;/P&gt;&lt;P&gt;If your function 'bar' does something short, you may consider to make a C macro out of it and have it placed in a header file: that way you can get inlining through the preprocessor.&lt;/P&gt;&lt;P&gt;The other idea would be to have bar() in a separate small file (defined as static function, btw):&lt;/P&gt;&lt;P&gt;Then you could include this file in each of the modules where you want to inline it.&lt;/P&gt;&lt;P&gt;In order not to change a lot of files (to include this 'inline' file), you could simply use the -AddIncl command line switch (e.g. -AddInclMyIncludeFile.inc )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;BK&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Nov 2009 20:55:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/CodeWarrior-for-MCU/pragma-INLINE/m-p/157126#M4138</guid>
      <dc:creator>BlackNight</dc:creator>
      <dc:date>2009-11-25T20:55:15Z</dc:date>
    </item>
  </channel>
</rss>

