glibc 2.5 compat: use correct header for makedev() et al. #5945
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This commit adds configure checks to detect where makedev() is defined:
sys/sysmacros.h
sys/mkdev.h
sys/types.h
It assumes major() and minor() are defined in the same place.
The libspl types.h then includes
sys/sysmacros.h (preferred) or
sys/mkdev.h (2nd choice)
before including the system types.h.
This change revealed that __NORETURN was being defined in two places in ZoL,
libspl/include/sys/sysmacros.h and libspl/include/sys/feature_tests.h. The
redundant definition in sysmacros.h is removed.
Motivation and Context
In glibc 2.5, makedev(), major(), and minor() are defined in
sys/sysmacros.h. They are also defined in types.h for backward
compatability, but using these definitions triggers a compile warning.
This breaks the ZFS build, as it builds with -Werror.
gnulib/autoconf/glibc email threads indicate these macros may be defined
in sys/mkdev.h in some cases.
As of about a week ago, 2017-03-22, arch linux used glibc 2.25 and the
build failed due to this bug.
How Has This Been Tested?
So far I have only tested a build on arch. Further testing is needed.
Types of changes
Checklist: