Re: [PATCH v2 4/6] compiler-gcc.h: add asm_inline definition

From: Miguel Ojeda
Date: Sun Sep 08 2019 - 09:55:49 EST


On Sat, Sep 7, 2019 at 3:11 PM Segher Boessenkool
<segher@xxxxxxxxxxxxxxxxxxx> wrote:
>
> I wouldn't. Please stop using that straw man. I'm not saying version
> checks are good, or useful for most things. I am saying they are not.
>
> Predefined compiler symbols to do version checking (of a feature) is
> just a lesser instance of the same problem though. (And it causes its
> own more or less obvious problems as well).

That is fair enough, but what are you suggesting we use, then?

Because "testing to do X to know if you can do X" cannot work with
source code alone and implies each project has to redo this work in
its build system for each compiler, plus each project ends up with
different names for these macros. The C++20 approach of having
standardized macros for major features is way better (whether we have
one macro per feature or a __has_feature(X) macro). Note this does not
mean we need to take this to the extreme and have a feature-test macro
for *every* feature, bugfix or behavior change as a macro.

Cheers,
Miguel