I have a C++ soft that gets compiled with different OSes, platforms & compilers. Now sometimes compiler have bugs e.g. for instance this one, which implies that gcc versions pre 4.6.4 and pre 4.7.3 are a no-go. Now i could include a unit test that showcases the bug (and perhaps this question will reveal that indeed that's what I should be doing) but this is a tedious task: compiler bugs are sometimes hard to repro and turning one into a unit test might not be easy either... and that's when you have the platform & compiler at hand.
我有一个C ++软件,可以使用不同的操作系统,平台和编译器进行编译。现在有时编译器有bug,例如例如这一个,这意味着gcc版本4.6.4之前和4.7.3之前是不行的。现在我可以包含一个显示错误的单元测试(也许这个问题将揭示确实这就是我应该做的事情),但这是一项繁琐的工作:编译器错误有时难以重现并将其转换为单元测试可能不会很容易......当你手头有平台和编译器时就是这样。
What I'm looking for is a repository that tells me which versions of g++, clang++ and msvc++ suffers from fatal bugs for supporting C++11 (i'm not talking about missing features, when features are not there I work around them). I would then fatal crash when building with them in the build system. Nice feature is, I'm not even forced to hit a bug to ban a compiler (so I'm saving myself future trouble).
我正在寻找的是一个存储库,它告诉我哪些版本的g ++,clang ++和msvc ++受到支持C ++ 11的致命错误(我不是在谈论缺少的功能,当我没有使用功能时) 。在构建系统中使用它们进行构建时,我会致命崩溃。不错的功能是,我甚至没有*发现一个禁止编译器的bug(所以我为自己节省了未来的麻烦)。
Does such a list exist?
这样的清单是否存在?
2 个解决方案
#1
4
Investigate Boost.Config, in particular the header <boost/config.hpp>
.
调查Boost.Config,特别是头文件
This includes a large group of macros for a wide variety of compilers (and different versions there of) which indicate which C++ features are enabled, broken etc. It also includes a comprehensive test suite which can be used to test any new compiler for missing features etc.
这包括一大堆宏,用于各种编译器(以及它们的不同版本),它们指示哪些C ++功能已启用,已损坏等。它还包括一个全面的测试套件,可用于测试任何新编译器的缺失功能等等
#2
14
This is probably not the answer you are looking for, but I believe the correct way to deal with this is to have a white-list, rather than a black-list. In other words, have a list of compilers that you know works, and if the customer tries to build using a different version than the ones you have tested with, you issue a warning message as part of the build script saying something like this:
这可能不是您正在寻找的答案,但我相信处理这个问题的正确方法是使用白名单而不是黑名单。换句话说,有一个你知道可以工作的编译器列表,如果客户尝试使用与你测试过的版本不同的版本进行构建,你会发出一条警告消息,作为构建脚本的一部分,说明如下:
This compiler is not supported, please see http://www.example.com/list_of_supported_compilers.html for a list of compilers we support. If you choose to continue using this compiler, feel free to do so, but don't expect full support from our tech-support, if you find a problem.
不支持此编译器,请参阅http://www.example.com/list_of_supported_compilers.html以获取我们支持的编译器列表。如果您选择继续使用此编译器,请随意执行此操作,但如果您发现问题,请不要期望我们的技术支持提供全面支持。
The reason I say this is that:
我说这个的原因是:
- You will not be able to prove that EVERY version other than what is on your blacklist works correctly. You can, however, for whatever testcases you have, prove that compiler X version a.b.c-d works [this doesn't mean that this compiler is bug free - just that you haven't hit any of those bugs in your testing!]
- Even if the compiler is "known good" (by whatever standard that is defined), your particular code may trigger bugs that affect your code.
您将无法证明除黑名单之外的每个版本都能正常工作。但是,对于你所拥有的任何测试用例,你可以证明编译器X版本a.b.c-d有效[这并不意味着这个编译器没有错误 - 只是你没有在测试中遇到任何这些错误!]
即使编译器“已知良好”(通过任何已定义的标准),您的特定代码也可能会触发影响代码的错误。
Any sufficiently large software (or hardware) product will have bugs. You can only show that your software works by testing it. Relying on external "there is known bug in version such and such of compiler X" will not help you avoid bugs affecting your code. Having said that, most compilers are fairly well tested, so you (usually) need to do some fairly unusual/complicated things to make the compiler fail.
任何足够大的软件(或硬件)产品都会有错误。您只能通过测试来证明您的软件是有效的。依赖于外部“版本中存在已知的错误,例如编译器X”将无法帮助您避免影响代码的错误。话虽如此,大多数编译器都经过了相当好的测试,所以你(通常)需要做一些相当不寻常/复杂的事情来使编译器失败。
#1
4
Investigate Boost.Config, in particular the header <boost/config.hpp>
.
调查Boost.Config,特别是头文件
This includes a large group of macros for a wide variety of compilers (and different versions there of) which indicate which C++ features are enabled, broken etc. It also includes a comprehensive test suite which can be used to test any new compiler for missing features etc.
这包括一大堆宏,用于各种编译器(以及它们的不同版本),它们指示哪些C ++功能已启用,已损坏等。它还包括一个全面的测试套件,可用于测试任何新编译器的缺失功能等等
#2
14
This is probably not the answer you are looking for, but I believe the correct way to deal with this is to have a white-list, rather than a black-list. In other words, have a list of compilers that you know works, and if the customer tries to build using a different version than the ones you have tested with, you issue a warning message as part of the build script saying something like this:
这可能不是您正在寻找的答案,但我相信处理这个问题的正确方法是使用白名单而不是黑名单。换句话说,有一个你知道可以工作的编译器列表,如果客户尝试使用与你测试过的版本不同的版本进行构建,你会发出一条警告消息,作为构建脚本的一部分,说明如下:
This compiler is not supported, please see http://www.example.com/list_of_supported_compilers.html for a list of compilers we support. If you choose to continue using this compiler, feel free to do so, but don't expect full support from our tech-support, if you find a problem.
不支持此编译器,请参阅http://www.example.com/list_of_supported_compilers.html以获取我们支持的编译器列表。如果您选择继续使用此编译器,请随意执行此操作,但如果您发现问题,请不要期望我们的技术支持提供全面支持。
The reason I say this is that:
我说这个的原因是:
- You will not be able to prove that EVERY version other than what is on your blacklist works correctly. You can, however, for whatever testcases you have, prove that compiler X version a.b.c-d works [this doesn't mean that this compiler is bug free - just that you haven't hit any of those bugs in your testing!]
- Even if the compiler is "known good" (by whatever standard that is defined), your particular code may trigger bugs that affect your code.
您将无法证明除黑名单之外的每个版本都能正常工作。但是,对于你所拥有的任何测试用例,你可以证明编译器X版本a.b.c-d有效[这并不意味着这个编译器没有错误 - 只是你没有在测试中遇到任何这些错误!]
即使编译器“已知良好”(通过任何已定义的标准),您的特定代码也可能会触发影响代码的错误。
Any sufficiently large software (or hardware) product will have bugs. You can only show that your software works by testing it. Relying on external "there is known bug in version such and such of compiler X" will not help you avoid bugs affecting your code. Having said that, most compilers are fairly well tested, so you (usually) need to do some fairly unusual/complicated things to make the compiler fail.
任何足够大的软件(或硬件)产品都会有错误。您只能通过测试来证明您的软件是有效的。依赖于外部“版本中存在已知的错误,例如编译器X”将无法帮助您避免影响代码的错误。话虽如此,大多数编译器都经过了相当好的测试,所以你(通常)需要做一些相当不寻常/复杂的事情来使编译器失败。