title: What is the method for optimizing individual functions in a file in GCC 4.1.1?
body: <p>Various C / C++ compilers have <code>#pragma</code>s to control optimization.</p>
  
  <p>For example:</p>
  
  <p><strong>CodeWarrior</strong></p>
  
  <pre><code>#pragma optimization_level 0
  void func_no_opt()
  {
      // Some Work - not optimized
  }
  
  #pragma optimization_level 3
  void func_full_opt()
  {
      // Some Work - optimized
  }
  </code></pre>
  
  <p><strong>MSVC</strong></p>
  
  <pre><code>#pragma optimize("g", off)
  void func_no_opt()
  {
      // Some Work - not optimized
  }
  
  #pragma optimize("g", on)
  void func_full_opt()
  {
      // Some Work - optimized
  }
  
  #pragma optimize("", on)
  void func_default_opt()
  {
      // Some Work - default optimizations
  }
  </code></pre>
  
  <p>For purely performance reasons, I have a couple of functions that need to be optimized in all builds, including debug builds that are otherwise not optimized.</p>
  
  <p>Is there a way in GCC (specifically 4.1.1) to do something similar to these other compilers?  Unfortunately, GCC 4.4 is not supported on my target platform (proprietary hardware) so I can not use the optimize attribute -- i.e. <code>__attribute__((optimize(...)))</code>.</p>
  
  <p>Also, on the toolchain for this target platform, there is an auto-bulk-build tool; so it's also not possible to just split the functions off into a separate file and change the optimization parameters, since files within a project can be automatically combined for an increase in compilation and link speeds.  I would have to make a separate library of just those functions and have it be linked-in in order to do the split-off method.  This might be quite a bit more pain than it would be worth -- especially if there is a simpler method of accomplishing this.</p>