I have a project for which optimization has been set to "-Os" for all files via gcc command line flags. However, I want to disable optimization for some methods in one of the source files. To accomplish that, I am trying to specify the optimization attribute for those methods. However, gcc says that it is ignoring optimize attribute during build. Does any one know what the problem is? 
class C 
{
public:
    int __attribute__((optimize("-O0"))) foo();
    .
    .
 };
I am using gcc version 4.4.3.