Compile issue with gcc 11 -std=c++23 #791
Labels
No labels
announcement
bug
build
CI
dependencies
documentation
duplicate
enhancement
experience feedback
feature request
github_actions
help wanted
install
invalid
Long-term
optimization
portability
question
target-specific
test issue
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-Cyan4973/xxHash#791
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Compiling with
gcc-11 -std=c++23:#782 introduced
github.com/Cyan4973/xxHash@6dba9abfaa/xxhash.h (L2049-L2052)The problem with
__cplusplusis that it does not necessarily mean that all features are available.It's usually more robust to use the feature testing macros (
__cpp_lib_unreachable).In this case, it would mean using
See also https://godbolt.org/z/5Ys77oM9j
I am not sure if this also applies to the C version. GCC defines
__STDC_VERSION_STDDEF_H__, but I haven't found a reference for this.cc @goldsteinn
Thank you, will update the CPP version to this.
By not sure if this applies to C, do you mean you're not sure if C can have the same issue if not-implement features, or you're not sure what the feature test define for something is?
My guess is if there is concern about it, we don't lose much dropping the C version. A compiler that doesn't implement some builtin for unreachable/assume is also likely to not use it an analysis even if it recognizes to stay conformant. Based on HEDLEY most of the common optimizing compilers are good with
assumeor__builtin_unreachable. @Cyan4973 what do you think?Fix is here: https://github.com/Cyan4973/xxHash/pull/792
Dropped the
c23version there as well to avoid more issues, but can obviously drop that.Both. I'm not sure whether C has the same issue regarding
__STDC_VERSION__, and whether there is a feature test macro for it.However, as pointed out here,
unreachablewas defined as a macro, so we can just check whether it's defined.@Cyan4973 should probably mark this resolved.