为什么clang -dumpversion报告4.2.1 [英] Why does clang -dumpversion report 4.2.1

查看:193
本文介绍了为什么clang -dumpversion报告4.2.1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用-dumpversion来确定编译器是否可用。
我的项目编译clang和更新的gcc,但不是旧的gcc 4.2.1。



那么为什么clang假装是一个旧gcc? / p>

额外的问题,是否可以在运行时更改此值?



确定编译器版本与clang和gcc?

解决方案

Clang最初写与gcc 4.2.1兼容。已有一些讨论关于



对于autoconf检查,clang建议使用__has_feature扩展。 Clang的文档具有您可以使用__has_feature 查看的内容列表。


I was trying to use -dumpversion to determine if the compiler is usable. My project compiles with clang and newer gccs, but not with the old gcc 4.2.1.

So why does clang pretend to be an old gcc?

Extra questions, is it possible to change this value at runtime?

Or does anyone have a nice autoconf macro to determine the compiler version with both clang and gcc?

解决方案

Clang was originally written to be compatible with gcc 4.2.1. There has been some discussion about updating that number earlier this year, but there were issues.

For autoconf checking, clang suggests to use its __has_feature extension. Clang's document has a list of things you can check with __has_feature too.

这篇关于为什么clang -dumpversion报告4.2.1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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