关掉优化特定功能在GCC 4.2.2 [英] Switching off optimization for a specific function in gcc 4.2.2

查看:200
本文介绍了关掉优化特定功能在GCC 4.2.2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以关闭特定功能的优化?
我的一个朋友有gcc的优化使得一些问题(未知对我)μ-控制器 - code不起作用。
我们知道,它的功能是,但我们没有了$ C $的线索C本身这样最简单,最安全的方式很可能是刚刚关掉的整体功能。

Is it possible to switch off optimization of a specific function? A friend of mine has the problem that the gcc optimization makes some (unknown to me) µ-controller-code not work. We know which functions it is, but we have no clue of the code itself so the easiest and safest way would probably be to just switch it off for the whole function.

可悲的是<一个href=\"http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html\">http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html显示有一个一个优化功能属性/编译,但它需要GCC 4.4,而我们没有。

Sadly http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html shows that there is a an optimize function attribute / pragma, but it requires gcc 4.4, which we do not have.

在此先感谢

推荐答案

如果在编译不会为你工作,尝试分裂功能到自己的文件,然后编译无优化标志设置该文件。

If the pragma won't work for you, try splitting the function into its own file, and then compile that file without the optimisation flag set.

这篇关于关掉优化特定功能在GCC 4.2.2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆