简体   繁体   English

用于C ++ 11支持的错误编译器版本的存储库

[英]Repository of buggy compiler versions for C++11 support

I have a C++ soft that gets compiled with different OSes, platforms & compilers. 我有一个C ++软件,可以使用不同的操作系统,平台和编译器进行编译。 Now sometimes compiler have bugs eg for instance this one , which implies that gcc versions pre 4.6.4 and pre 4.7.3 are a no-go. 现在有时编译器会出现错误,例如这个错误,这意味着gcc版本4.6.4之前和4.7.3之前是不行的。 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. 现在我可以包含一个显示错误的单元测试(也许这个问题将揭示确实这就是我应该做的事情),但这是一项繁琐的工作:编译器错误有时难以重现并且将其转换为单元测试可能不会很容易......当你手头有平台和编译器时就是这样。

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). 我正在寻找的是一个存储库,告诉我哪些版本的g ++,clang ++和msvc ++遭受了支持C ++ 11的致命错误(我不是在谈论缺少的功能,当功能不存在时我会解决它们) 。 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). 不错的功能是,我甚至没有被迫发现一个禁止编译器的bug(所以我为自己节省了未来的麻烦)。

Does such a list exist? 这样的清单是否存在?

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. 不支持此编译器,请参阅http://www.example.com/list_of_supported_compilers.html以获取我们支持的编译器列表。 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. 如果您选择继续使用此编译器,请随意执行此操作,但如果您发现问题,请不要期望我们的技术支持提供全面支持。

The reason I say this is that: 我说这个的原因是:

  1. 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 abc-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!] 但是,对于你所拥有的任何测试用例,你可以证明编译器X版本abc-d有效[这并不意味着这个编译器没有错误 - 只是你没有在你的测试中遇到任何这些错误!]
  2. Even if the compiler is "known good" (by whatever standard that is defined), your particular code may trigger bugs that affect your code. 即使编译器“已知良好”(通过任何定义的标准),您的特定代码也可能会触发影响代码的错误。

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. 依赖于外部“版本中存在已知的错误,例如编译器X”将无法帮助您避免影响代码的错误。 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. 话虽如此,大多数编译器都经过了相当好的测试,因此您(通常)需要做一些相当不寻常/复杂的事情来使编译器失败。

Investigate Boost.Config , in particular the header <boost/config.hpp> . 调查Boost.Config ,特别是头文件<boost/config.hpp>

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 ++功能已启用,已损坏等。它还包括一个全面的测试套件,可用于测试任何新编译器的缺失功能等等

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM