Enable building with gcc-14
Tagging subscribers to this area: @hoyosjs See info in area-owners.md if you want to be subscribed.
Updated gcc pipeline. gcc14 was picked up in the CI:
-- The C compiler identification is GNU 14.1.0
-- The CXX compiler identification is GNU 14.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/gcc-14 - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/g++-14 - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
@am11 - did you run into any compilation issues with gcc-14 that does not repro on gcc-12. E.g. https://dev.azure.com/dnceng-public/cbb18261-c48f-4abb-8651-8cdcb5474649/_apis/build/builds/706791/logs/284.
It is not liking the presence of if/else inside constexpr method. If I remove the if-else, things work fine. Any thoughts?
static constexpr regMaskTP CreateFromRegNum(const regNumber reg, regMaskSmall mask)
{
#ifdef HAS_MORE_THAN_64_REGISTERS
if (reg < 64)
{
}
else
{
}
return regMaskTP(mask, RBM_NONE);
#else
return regMaskTP(mask, RBM_NONE);
#endif
}
It's pedantically requiring single return for std=c++11 conformance:
static constexpr regMaskTP CreateFromRegNum(regNumber reg, regMaskSmall mask)
{
#ifdef HAS_MORE_THAN_64_REGISTERS
return (reg < 64) ? regMaskTP(mask, RBM_NONE) : regMaskTP(RBM_NONE, mask);
#else
return regMaskTP(mask, RBM_NONE);
#endif
}
(with std=c++14, if/else works)
C++11 page 140: https://open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3337.pdf
— its function-body shall be = delete, = default, or a compound-statement that contains only
— null statements,
— static_assert-declarations
— typedef declarations and alias-declarations that do not define classes or enumerations,
— using-declarations,
— using-directives,
— and exactly one return statement;
C++14 page 155: https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf
—(3.4) its function-body shall be = delete, = default, or a compound-statement that does not contain
—(3.4.1) an asm-definition,
—(3.4.2) a goto statement,
—(3.4.3) a try-block, or
—(3.4.4) a definition of a variable of non-literal type or of static or thread storage duration or for which
no initialization is performed.
(with std=c++14, if/else works)
hhm, how can i make my code work then in current scenario where we are on gcc-14 and in std=c++11 conformance?
Have you tried the code provided above?
Have you tried the code provided above?
sorry, earlier I missed that piece and was just staring at c++14 and c++11 conformance. Your suggestion works :)