检查源代码是否使用双精度浮点操作
我正在寻找一种简单的方法来阻止我们的项目使用双精度浮点操作。当前,我正在尝试使用正则罚款来过滤我们项目中的两倍变量和常数。但是,很难遵循变量/常数/常数/常数/定义。 我们的MCU支持硬件单位浮点操作,但不支持双重精确。我们要严格禁止通过通知用户(例如构建过程失败)来无意使用双精度浮点操作。不幸的是,我们需要包括预制的SW模块,该模块禁止使用编译器标志(有一个自动将双重转换为float等)。有人有一种一般检查双精度操作的一般方法吗?例如在链接器中? 多谢!
I'm searching for an easy way to stop our project from using double-precision floating point operations. Currently, I'm trying the hard way, of using a regex to filter for double (long double,etc.) variables and constants in our project. But the flow of variables/constants/defines through the whole software is hard to follow.
Our MCU supports single-precision floating point operations by hardware, but not double-precision. We want to strictly prohibit the unintended use of double-precision floating point operations by notifying the user (e.g. failed build process). Unfortunately, we need to include prebuilt SW modules, which prohibits the use of compiler flags (there is one to automatically convert double to float, etc.). Does anyone have a general way of checking for double-precision operations? e.g. in the Linker?
Thanks a lot!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果双精度操作是通过fp仿真通过库函数来实现的,则可以检查它们是否存在于最终链接的二进制中。对于GNU目标,您可以使用EG
objdump
为此:或
readelf
:In case double precision operations are implemented via FP emulation i.e. through calls to library functions, you can check if they are present in final linked binary. For GNU targets you can use e.g.
objdump
for that:or
readelf
: