Why does clang -dumpversion report 4.2.1

时光怂恿深爱的人放手 提交于 2019-12-08 15:40:27

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/12893731/why-does-clang-dumpversion-report-4-2-1

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!